Color disappears when using textures

Started by
2 comments, last by enigmamwu03 21 years, 6 months ago
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.
Advertisement
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
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.


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.


This topic is closed to new replies.

Advertisement