Double Buffering in JOGL

Hello,

I’m new to all this graphics programming and I’m trying to do a project in JOGL. I want to get double buffering to work so that my animations are smooth, but it doesn’t seem to be working properly. At the moment I create a GLCapabilities object and turn on double buffering, then make my canvas with it. I also have a glenable(GL.GL_DOUBLEBUFFER); statement in my initialisation, but it doesn’t seem to make any difference to the appearance of my project. I read that in opengl you have to use a commal glutSwapBuffers instead of glFlush to get it to work, do I have to do that in JOGL? At the moment I use glFlush(), but I don’t know where the glutSwapBuffers equivalent is, or how to use it if there is one.

Thanks in advance,

Hayden Devlin

Setting double buffered in the capabilities object is the only thing that needs to be done.

And unfortunately I think you misunderstand what double buffering does. It doesn’t really make animation smoother, rather it avoids tearing, and at that you need to have vertical sync (v-sync) on to completely avoid tearing.

Now what is tearing you might ask? It’s an artifact that shows up in double buffering with v-sync off and when the monitor is part of the way through the verticle refresh the video card then directs it to use the other buffer, causing the image on the screen to tear because the first portion was drawn from one rendered image and the rest from a second image. In a single buffered display, tearing will be seen as an unfinished image in the process of being draw and then when finished probably abruptly cleared and the process starts over again.

I know that wasn’t the clearest description but I hope it helps.

Thanks that has cleared everything up, to make my animation smoother I just need to improve it don’t I! Like adding more frames, etc. My double buffering now works as well, cheers,

Hayden Devlin