Jump to content
  • Advertisement

Archived

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

freespace

Coloring B/W textures

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

Hey every one. Trying to do what NeHe does in the 6th (?) lesson, with the moving bitmaps. But despite specifying a color before I draw, and using a black and white bitmap, I always get white, and its very frustrating, as to why I can''t "color" the white region with glColor3f(); A bit of the code is below, its not exactly the same (probably why its not working) glColor4f(0.0, 0.0, 1.0, mother.children.life); glBegin(GL_TRIANGLE_STRIP); glTexCoord2d(1,1); glVertex3f(x+0.5f,y+0.5f,z); // Top Right glTexCoord2d(0,1); glVertex3f(x-0.5f,y+0.5f,z); // Top Left glTexCoord2d(1,0); glVertex3f(x+0.5f,y-0.5f,z); // Bottom Right glTexCoord2d(0,0); glVertex3f(x-0.5f,y-0.5f,z); // Bottom Left glEnd(); glBindTexture() has been called, with GL_TEXTURE_2D, and the texture ID of the texture, which is loaded from a TGA file (24 bit, black and white, no alpha); Full source code is avaliable upon request. Thanks in advance for any help. Best regards, Steve Friend don''''t get in your way, unless you are going down.

Share this post


Link to post
Share on other sites
Advertisement
Personally I would need more code to figure out what your problem was. Where is the Bind Texture command in your code? Is the shape completly white? If so you might be binding a non-existant texture, this sorta thing happens all the time to me when I''m not paying attention to my code. If it just stays in black and white the problem might be that your texture is not in powers of 2. Finally make sure all your texture loading code is correct.

Share this post


Link to post
Share on other sites
Texture has been verified to load properly, simply because its a star, and a star shows up, but the star should be colored not white, as in the image. Shape is not completely white, only the middle part is, the black is blended away.

Triple sure my texture loading code is 100% correct. I could send you the source if you like.

Best regards,
Steve

Share this post


Link to post
Share on other sites
Oh problem solved.

The important line was glEnable(GL_COLOR_MATERIAL); I needed this for it to work in conjuction with glEnable(GL_LIGHTENING);

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!