Jump to content
  • Advertisement
Sign in to follow this  
meanoldgeezer

OpenGL Color Freak

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

Ok, so I'm rather new to OpenGL and for my senior project I decided to write a 3d game. Maybe a rather ambitious undertaking since I had no real prior knowledge with openGL. Anyway, I am using someone else's texture loader that I got from a link somewhere on here. It's a bmp loader. Anyway, after drawing my buildings with the texture applied if I try to use glColor3f or glColorPointer then the colors are off. According to a friend, the way the textures work, each color is multiplied by the color in the texture, or something similar to that. Anyway, the last color/pixel seems to be carried over. So, when I try to apply new colors with the other calls they are multiplied by that color as well. How can I fix this? If you need more information just ask. Thanks

Share this post


Link to post
Share on other sites
Advertisement
At a guess you're drawing textured buildings, then afterwards your untextured objects have their colour muddied up? You've probably left texturing enabled, so you're still getting a single pixel of the texture applied to your untextured objects.

glDisable(GL_TEXTURE_2D); after you've finished drawing textured objects should do the trick.

Share this post


Link to post
Share on other sites
Or are you saying that you want the buildings to be textured AND colored? If so, look into glColorMaterial.
Levi

Share this post


Link to post
Share on other sites
About the last point, I've also had success at using a special light in my display functions, without using materials.

Disable the normal light, enable the special light, set the 'ambient' values that you want to give it a coloured tint (maybe using another special function to do that with any three floats that you give it), then draw your thing, then disable the light afterwards, and enable the normal light...

Actually sounds a bit complicated writen like that, but i find it easier :)

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!