I have a scientific animation that uses OpenGL and that is both in 2 and in 3D. My assumption was that 2D would be much faster, because the objects that need to be rendered are much simpler (say disks versus spheres).
In 2D, I set up the perspective using gluOrtho2D, and then I render the disks using a glList which has a glu quadric Disk stored in it. I change the color using glColor. Lighting is disabled. In opposition, in 3D I use a true gluPerspective and use glu quadric Sphere object with lighting enabled and change color via glMaterial. So I assumed everything would run much faster in 2D.
Although this is true, the screen flickers in the 2D animations. But it does not in the 3D ones. I use double buffering in GLUT and glutSwapBuffers, so I cannot understand where the flickering comes from.
Any clues on what it is that GL does not like about 2D graphics would be helpful.
Thanks for the clues, I found the problem–it was my programming that was an error. I had by mistake turned double-buffering off in 2D, probably thinking at some point that it would be fast enough not to require it.
Just a note on 2D, most 2D games use a double buffer, to reduce the flicker when the screen data is changing like in a game or animation.
Originally posted by donev:
[b]Hello,
Thanks for the clues, I found the problem–it was my programming that was an error. I had by mistake turned double-buffering off in 2D, probably thinking at some point that it would be fast enough not to require it.