I did have a question though regarding JOGL. I know that in LWJGL that the flush takes a long time. So basically you can send all the commands to the card but when you call flush there is this long pause while it actually finishes rendering. It seems like the request to draw the Drawable and the resulting callback to the event listener does not return until the flush is complete.

Is there anyway I can have the flush operate on another thread so that I can be building the next frame? I would need to have some way to detect that the frame was actually done before I start to render the next one, but I think this would be a valuable peice of parallalism.

I have not confirmed the time delta between exiting the draw callback and returning from the call to Drawable draw, but I suspect it is a significant period of time.

You might be confusing a glFlush, which simply makes the OGL driver dump it's outstanding OGL commands to the card, witha buffer swap that flips the back buffer to the front.

The buffer swap will wait for all outstanding OGL commands to complete before flipping the buffers, making sure that a complete buffer is shown on the monitor.

So ,waht does this mean to you? Simple, you _can't_ render the next frame without the previous being finished. However, you can do the non-rendering work if you like. You'd simply order your render loop work like this:

I know that in LWJGL that the flush takes a long time. So basically you can send all the commands to the card but when you call flush there is this long pause while it actually finishes rendering. It seems like the request to draw the Drawable and the resulting callback to the event listener does not return until the flush is complete.

As another person mentioned, there is a difference between and explicit glFlush(), an explicit glFinish(), and an implicit finish caused by a buffer swap.

In general, glFlush() is a bad thing because it forces the driver to finish executing all glCommands before returning control to the caller. When using glFinish() or doing a buffer swap (which JOGL does internally at the end of each frame), it merely tells the graphics driver to begin processing commands and then returns control back to the user. This facilitates parallelism by allowing your app to continue processing while the card is busy flushing queued events.

So, in general, if you're using JOGL you neither have to nor need to do make calls to glFlush(), glFinish(), or SwapBuffers(HDC). Calling glFlush() explicity shouldn't cause any harm, but it will certainly kill your performance.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org