Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

GekkoCube

beginner - rendering confusion.

This topic is 5239 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

i thought i understood the concept of glPushMatrix(), but im not so sure anymore. I am following NeHe''s tutorials.
glTranslatef(0.0f,0.0f,-9.0f);

   glPushMatrix();
      glBegin(GL_QUADS);	
      glColor3f(1.0f, 1.0f, 1.0f);
      glVertex3f(-1.0f, 1.0f, 0.0f);				// Top Left

		glVertex3f( 1.0f, 1.0f, 0.0f);				// Top Right

		glVertex3f( 1.0f,-1.0f, 0.0f);				// Bottom Right

		glVertex3f(-1.0f,-1.0f, 0.0f);				// Bottom Left

      glEnd();
   glPopMatrix();

   glPushMatrix();
      glTranslatef(-1.0f, 0.0f, 1.0f);
      glBegin(GL_QUADS);	
      glColor3f(1.0f, 0.0f, 1.0f);
      glVertex3f(-1.0f, 1.0f, 0.0f);				// Top Left

		glVertex3f( 1.0f, 1.0f, 0.0f);				// Top Right

		glVertex3f( 1.0f,-1.0f, 0.0f);				// Bottom Right

		glVertex3f(-1.0f,-1.0f, 0.0f);				// Bottom Left

      glEnd();
   glPopMatrix();
that code should draw two square, one white and the other purple or something. but the colors appear to be off, for example, the first square is not white. more importantly, commenting out the glPushMatrix and glPopMatrix yields very different results. how does openGL work?

Share this post


Link to post
Share on other sites
Advertisement
glPushMatrix(); has nothing to do with the colors.
glColor3f(1.0f, 1.0f, 1.0f); and glColor3f(1.0f, 0.0f, 1.0f); changes the color.

Share this post


Link to post
Share on other sites
I think what you need is to read a little about matrixes if you don''t know how they work. There are A LOT of matrix questions, so maybe you should consider reading them. It will help you when your objects are going to twist and move and so on.

Share this post


Link to post
Share on other sites
my number one point of confusion is the color3f.

isn''t (1.0f, 1.0f, 1.0f) the color white?

well, my opengl app fills the shape as a shade of light yellow-tanish color. very subtle. it should be pure, bright white...no?

Share this post


Link to post
Share on other sites
Are you using a light source at all? The colour of the light will effect the colour of your poly.

Share this post


Link to post
Share on other sites

  • 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!