Hi,
I searched the forums for recent posts with a similar issue, but haven’t found any, so here’s the situation.
I run Ubuntu 8.10 on a laptop, with an ATI Mobile HD 2600, res 1680x1050, using the ATI fglrx video driver.
I wrote some test in Java2D to “simulate” another system with graphics, and all got pretty well.
Then I tried the OpenGL pipeline, hoping it would bring me useful acceleration when things would get heavier.
It doesn’t work that bad, but I have a strange issue: using opengl, the Canvas I use in my Frame stays gray as long as I don’t resize the frame. Is there a known reason for that, am I missing something obvious ?
I tried many differents things over time, to no avail:
- use a Frame or a JFrame for the main window
- use a Canvas or a JPanel for the component I render to (it is the only component in the window)
- at first I used manual double buffering, creating a BufferedImage, drawing stuff to it, then drawImage() it to the component. But then there was a problem with opengl: the rendered frames had an important vertical offset even though the buffer was copied to the component at pos 0,0 (the bottom of the rendered frame was near the top of the component, and wrapping to the bottom)
- I now use a BufferStrategy on the Component (Canvas), either with 2 or 3 buffers, and there’s no more offset (only the gray/no-display problem)
- I tried paint()/update()/… rendering, but now I use active rendering every N milliseconds (with strategy.show())
- since I use active rendering, I setIgnoreRepaint(true) on the component, but even when I don’t, the issue remains
- I tried to use or not use setSize(), setPreferredSize(), pack()/no pack() on the window and/or component
- maybe I’m forgetting some other things I tried…
For info, the BufferStrategy is created for the component after the window and the component have been created (of course), associated, sized, shown, …
Also, the stuff I usually compute inside the app regarding the number of rendered frames and the like, is computed correctly even when I only see an “empty” component, so the frames are effectively rendered, I just can’t see them.
Has anyone encountered this kind of problem, do I need an additional step to “wake up” the opengl pipeline and display the first frame ?