Jump to content
  • Advertisement
Sign in to follow this  
Ewr

Only once

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

If you intended to correct an error in the post then please contact us.

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);
	glLoadIdentity();

	glPushMatrix();

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

	glBegin(GL_QUADS);
		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 this post


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

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!