I tried loading a texture, which loaded fine using GenTextures, BindTexture, and TexImage2D. All that goes by without a problem, and the texture shows up how I want it too. But the color of the entire window is messed up.
I have 2 shapes, a 5 sided pyramid with colored corners, and a cube with textured sides. The pyramid seems to be colored correctly, but it’s dim as if I turned down the contrast on my screen. The textured cube is not showing any red or blue, only green.
I tried to figure out my problem on my own, and the only thing I was able to find was that by taking out these two lines:
the problem goes away. However, the cube becomes only green with no texture.
by the way…I’m following Jeff Molofee’s tutorial at his site, NeHe, which is the best one out there IMO.
How do you have glTexEnv set? What color are your objects? If other than white and with texenv set to default of GL_MODULATE may be your problem. Try glTexEnv with GL_REPLACE. Also, do you have lighting enabled?
I have no lighting features, but I did play around with that TexEnv function. If I pass the past parameter as GL_DECAL or GL_REPLACE, the texture shows up fine, but my colored pyramid is wrong.
It’s supposed to have red, green, blue, purple, and yellow corners, all blended smoothly. But it shows up completely yellow. Yellow is also the background color of my texture. Coincidence? I think not.
When drawing the pyramid, you should disable textures. The last called tex coord becomes the current tex coord for all subsequent vertices until another call to glTexCoord is made, and the color associated with that tex coord is used while textures are enabled.
[This message has been edited by shinpaughp (edited 05-31-2003).]