Skip to main content
gamedev.net
🔒 Locked

Problem Flashing object

Started by Zen721 Apr 24, 2006 at 12:36 PM 1 replies 950+ views
Original Post
Zen721
Zen721
When i run this code my texture and quad is still flushing it is not render smooth i'm using glut library to display objects... void display() { GLuint MenuList; MenuList = glGenLists(1); glNewList(MenuList, GL_COMPILE); glClear (GL_COLOR_BUFFER_BIT); gluLookAt (0.0, 0.0, -20.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0); glEnable(GL_TEXTURE_2D); zdjecie.inicjalizuj_zdjecia(); zdjecie.wczytaj_zdjecia(); /* glBegin(GL_QUADS); glTexCoord2i(0,0);glVertex2i(0, 0); glTexCoord2i(0,1);glVertex2i(0, 10); glTexCoord2i(1,1);glVertex2i(10, 10); glTexCoord2i(1,0);glVertex2i(10, 0); glEnd(); */ GLint TexArray[] = {0,0,0,1,1,1,1,0}; GLint QuadArray[] = {0,0,0,10,10,10,10,0}; glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(2,GL_INT, NULL, &QuadArray); glTexCoordPointer(2, GL_INT, NULL, &TexArray); glDrawArrays(GL_QUADS, 0, 8); glFlush(); glEndList(); glCallList(MenuList); glutPostRedisplay(); }
Foobar of Integers
Foobar of Integers
I don't think you're supposed to use glFlush() inside a display list, but I'm not sure.
"ok, pac man is an old gameand, there are faces which is eatin up shits" - da madface
songho
songho
Foobar of Integers is right. You cannot put glFlush(), glFinish() or any client related commands inside a display list.

Please compile a display list outside of your display() callback function.(build a DL only once) Then call the display list inside display() by using glCallList().

The flushing may happen because of single frame buffer. Did you enable double buffer? Then use glutSwapBuffers() instead of glFlush()

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.