Reply – Re: Understanding issue with automatic buffer swapping
Your Name
or Cancel
In Reply To
Re: Understanding issue with automatic buffer swapping
— by xghost xghost
Hi Xerxes,

First of all, thanks for your time and help.

Xerxes Rånby wrote
You want to invert the logic on line #L287 of GL4RenderSystem and use
        if (!canvas.getAutoSwapBufferMode())
so that your buffers will get swapped when you have disabled automatic buffer swapping.
Just to double-check, please make sure you're looking at the branch with the latest content (git checkout -b latest origin/feature/final-updates-and-documentation). The workaround commit I linked in the previous post is there (not master) and does not have the lines.

I apologize for not making this clearer before. (Just basing that on the URL you posted.)

Xerxes Rånby wrote
After fixing that you can remove all the workaround swap logic from GenericSceneManager
Remove lines 517-522.
I went back to the master branch you seem to have looked at (which disables auto swapping), tested the following based on your suggestions (slightly different):

// Commented out the manual swapping logic on the GL4RenderSystem file to let the SceneManager do it
// if (canvas.getAutoSwapBufferMode())
        // canvas.swapBuffers();

// On the GenericSceneManager file, removed the if-check, so that swapBuffers() is always invoked

I can still observe the problem on my desktop, even though it should always be swapping the buffers like this. It's as if the following were not really swapping the buffers(?)

    public void swapBuffers() {

Wouldn't it be "preferable" to call swapBuffers only once after all cameras have finished with their viewports (i.e. once per frame) instead of several times?

Is trying to call canvas.swapBuffers() outside the GLEventListener thread incorrect usage?

Just for checks, I had experimented with grabbing a context to see if it was that (pseudo-ish), but IIRC, that caused a recursive lock issue with JOGL:

GLContext ctx = canvas.getContext();

I figured I was trying using it incorrectly at on that and had returned it back to a simple canvas.swapBuffers(), though the Javadoc didn't seem to indicate it might be a problem.

Thanks again. Much appreciated.

EDIT: Your last post came in as I was writing this one. I'll get to it in a separate reply as needed.