Jump to content
  • Advertisement
Sign in to follow this  
k0d3rk1dd33

OpenGL Color not showing up (strange)

This topic is 5062 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 have a md2 model walking around and I want to put a colored quad under him so i do this.... <code> glPushMatrix(); glColor3f(1.0, 1.0, 0.0); glTranslatef(0.0f,-6.5f,0.0f); glScalef(10,10,10); glBegin(GL_QUADS); glVertex3f(1,0,1); glVertex3f(1,0,-1); glVertex3f(-1,0,-1); glVertex3f(-1,0,1); glEnd(); glColor3f(1.0, 1.0, 1.0); glPopMatrix(); </code> Well, the quad shows up, but it is a very dark grey color (almost black), but then when the model does a certain animation, the quad flashes a shade of brown (which is similar to my models texture). I am basically using the Opengl Game Programming, md2 loader and animator, any reason why my model would mess with my quad colors?

Share this post


Link to post
Share on other sites
Advertisement
I think you should disable texture rendering:

glDisable (GL_TEXTURE_2D);

Also, if lighting is set up, you must either disable it or use also:

glEnable (GL_COLOR_MATERIAL);
glColorMaterial (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);

(this will make the quad's material have the same color that you've set with glColor3f).

But, if you don't want to light the quad, use:

glDisable (GL_LIGHTING);

And you can forget about materials then (I think).

Hope it helps...

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!