• 13
• 18
• 19
• 27
• 9

Only once

This topic is 4452 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Why does the Quad disappear after after the first frame? This is my display function (im using glut)... If i remove glClear it stays, but it only rotates on the first fram (i is increased every frame)
void display(void)
{
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glPushMatrix();

glRotatef(i, 0, 0, 1);
glTranslatef(0,0,0);

glColor3f(1.0f, 0.0f, 0.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(0, 0, 0);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(0, 1, 0);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(1, 1, 0);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(1, 0, 0);
glEnd();

glPopMatrix();

glutSwapBuffers();
}



Share on other sites
Are you calling the function at initialisation or during runtime?

Share on other sites
How have you setup your projection matrix? Have you turned backface culling on?

Share on other sites
runtime, its glut who handles the call to the function...
Everything works in the function but the drawing of the quad...

Share on other sites
backface culling is off

Only thing ive done with the projection matrix is:
	glLoadIdentity();	gluPerspective(45.0f, static_cast<GLfloat>(width) / static_cast<float>(height), 0.1f, 100.0f);

Share on other sites
Problem solved...

after about 24h of thinking, and asking for helps in forums i now found that im drawing my quad to close to the camera... :(

I moved the quad to -1 in z-axis...

Share on other sites
haha dont ya hate it when it takes forever to solve the simplest of problems!
tends to happen a lot with OGL :S