PDA

View Full Version : where did all my color go?



skorman00
05-29-2003, 03:36 PM
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:

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST);(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER ,GL_NEAREST);

the problem goes away. However, the cube becomes only green with no texture.

Any suggestions?

skorman00
05-29-2003, 03:38 PM
by the way....I'm following Jeff Molofee's tutorial at his site, NeHe, which is the best one out there IMO.

shinpaughp
05-29-2003, 04:58 PM
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?

skorman00
05-30-2003, 03:34 AM
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.

shinpaughp
05-30-2003, 10:42 PM
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.

glEnable(TEXTURE_2D);
DrawTexturedObject
glDisable(GL_TEXTURE_2D);
DrawColoredPyramid

[This message has been edited by shinpaughp (edited 05-31-2003).]