Archived

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

Color disappears when using textures

This topic is 5536 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 found out that I wasn''t lossing what I was drawing to the screen, but I was only lossing the colors. I am using the glColor4f() function to add color to my menu screen but it doesn''t appear when using the texture. I am using the Nehe Linux SDL lesson 18 bmp loader to load the bitmap. Any help on solving the problem i''ll be glad to have.

Share this post


Link to post
Share on other sites
couple options (you may need to do both):

1)
try : glEnable(GL_COLOR_MATERIAL);

2)
if i understand you correctly, you are miffed that you have a color for the font that is not showing through the texture you have clamped onto the font surface. you need to set the alpha values of the texture bits to some value < 1.0f. in your tex loader you''ll also need to set GL_RGBA in your glTexImage2D() method call. if you''re putting a texture on an object, the underlying color won''t show through unless the texture is alpha''d. otherwise i believe you have to make 2 rendering passes to get both texture and color in the same obj.

-me

Share this post


Link to post
Share on other sites
Sorry about not specifying a few things. I am not trying to texture a font at the moment, I am making a cursor like thing for my options menu that is a textured sphere. I just went through a few ideas and found out that the color lose is because of the glEnable(GL_TEXTURE_2D); in my init();. I removed it and found that my color came back. The new thing I am woundering about is if it is a good idea to enable it right before i draw the sphere and then disable right after.

Another problem I just got was when I clicked the fullscreen button the texture was no longer there and the menu layout was screwed up. If I knew how to post images I would show you what it looks like.


Share this post


Link to post
Share on other sites
Sorry about not specifying a few things. I am not trying to texture a font at the moment, I am making a cursor like thing for my options menu that is a textured sphere. I just went through a few ideas and found out that the color lose is because of the glEnable(GL_TEXTURE_2D); in my init();. I removed it and found that my color came back. The new thing I am woundering about is if it is a good idea to enable it right before i draw the sphere and then disable right after.

Another problem I just got was when I clicked the fullscreen button the texture was no longer there and the menu layout was screwed up. If I knew how to post images I would show you what it looks like.


Share this post


Link to post
Share on other sites