Jump to content
  • Advertisement
Sign in to follow this  

Texture mapping messes with colors

This topic is 4748 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. I'm trying to do some simple texture mapping (which I've done before). I can get the texture mapping to work, say, making a cube spin in the program with a texture on each face. However, if I load textures into the program, it messes with all the other colors. What it seems to be doing is coloring everything according to the colors in the texture. Its very odd. Just as a test, I took the source from NeHe's lesson #6, and tried drawing a white line right after drawing the cube, by adding this code:
glColor3f(1.0f, 1.0f, 1.0f);
glBegin(GL_LINES);
    glVertex3f(-2.0f, -3.0f, -1.0f);
    glVertex3f(2.0f, 1.0f, 1.0f);
glEnd();


The line ended up being drawn correctly, but it is dark blue instead of white! To test and see what the problem was, I started commenting things out. Commenting out the cube drawing procedure in DrawGLScene() didn't affect the line's color, but when I also commented out the call to LoadGLTextures(), the function that NeHe uses to load a bitmap texture, the line was drawn white. Any thoughts on why this happens? Thanks. [EDIT] maybe this should be moved to the NeHe forum? I don't know.

Share this post


Link to post
Share on other sites
Advertisement
Hmm try adding glDisable(GL_TEXTURE_2D) before you render the line and glEnable(GL_TEXTURE_2D) after you finished rendering the line

[EDIT] posted to late [headshake]

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!