Discoloration of Texture

Sage
Posts: 1,066
Joined: 2004.07
Post: #1
Look at this site which has pictures of the texture and the results of the texturing. Why does it change everything to shades of blue? How can I fix this?
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #2
A couple of possible problems:

1. Are the pixel formats the same? You may need to have SDL convert the surface to the same format as the texture you are placing it in. You should do this anyway for compatibility.

2. Are you using modulation for the texture method? Set the color to white or use replace instead.
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #3
I'm pretty new to texturing but I'm using SDL_image for the texture loading. I'm not sure how to check/change the pixel formats and I have no idea what modulation is so I doubt I'm using it but I wouldn't know if I was. I'll look around but if someone can help me I would appreciate it.
Quote this message in a reply
Sage
Posts: 1,234
Joined: 2002.10
Post: #4
Nick, please go read the spec. How do you expect to do anything in OpenGL if you don't know how it works?

Specifically, read Rasterization>Texturing>Texture Environment. glTexEnv lets you set the texuring mode, the default is GL_MODULATE. That means that the color of each texel is multiplied with the current color during texturing. So the most likely explanation of your blue texture is that you've set the color to blue.
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #5
Thanks. That was informative but I couldn't get the right syntax. I searched the web a little and found the right way. Now they all look like they should. All it took was the line glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE); somewhere in my OpenGL initialization code.
Quote this message in a reply
Post Reply