View Full Version : Please help me for the Display Lists

11-21-2016, 12:16 PM
I am the beginner for OpenGL. I want to using the display list to switch two images on the screen with 60Hz with Vsync on.
I first generate two lists for each image.

glNewList(index, GL_COMPILE);
glDrawPixels(GLwidth, GLheight, GL_BGR_EXT, GL_UNSIGNED_BYTE, image2.data);

glNewList(index + 1, GL_COMPILE);
glDrawPixels(GLwidth, GLheight, GL_BGR_EXT, GL_UNSIGNED_BYTE, image.data);

lists[0] = 0; lists[1] = 2;

Then in the display function, I use following code

if (flag == 0)
flag = 1;
glCallList(index + 1);
flag = 0;

But after I run it, the screen dose not update. But sometimes, if I move the frame, it start to update. But it stops after several seconds. Dose anyone know what's wrong with my code?

Dark Photon
11-21-2016, 04:17 PM
Have you checked for GL errors (link (https://www.opengl.org/wiki/OpenGL_Error))?

If you find one, identify which GL call is triggering it. That will give you clues.

Does your code work properly if you inline the code DrawPixels calls instead of calling the display list?

Also, what do you hope that using display lists here will do for you?