Sign in to follow this  
tre

Push and pop matrix question

Recommended Posts

Hi, could anyone explain to me why the below code won't render the sphere?
void Draw(void){
	glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();
	Lighting();
	
	initShader();
		glPushMatrix();
			glTranslatef (0.0f, 0.0f, -10.0f);
			glutSolidTeapot(1);
		glPopMatrix();

		glPushMatrix();
			glTranslatef (-2.0f, -2.0f, 0.0f);
			glutSolidSphere(1, 10, 10);
		glPopMatrix();
	deinitShader();
}

What am I not getting with the Push and Pop Matrix calls? Thanks! Marcus

Share this post


Link to post
Share on other sites
Quote:
Original post by szecs
The sphere is probably too close. What is your projection matrix?

Try to:
glTranslatef(-2.0f, -2.0f, -10.0f); with the sphere.

If it doesn't work, than it's not a projection issue.


Haha, man, do I feel stupid :)
I guess I'm going programming blind here.
Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this