View Full Version : Texture/Interleaved Array Problem

09-28-2000, 06:09 AM
I am having a problem rendering an object in front of a textured background.

I am rendering my object using a call to interleaved arrays with GL_C3F_V3F format. I am loading this from a file that has vertex and color values.

Next, I am trying to draw a background using textures for the walls. My problem is that everytime I enable textures my object loses its colors.

I want to retain my object colors and the textures for my background.

I have tried various lighting scenarios without success. Can anyone help me?

09-28-2000, 06:51 AM
Bind your texture, and call glTexEnvi to tell OpenGL how to blend your texture with the color of the polygon.

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE) will tell OpenGL to multiply each texel color with the color of the specific pixel on the polygon.
glTexEnviGL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE or GL_DECAL) is probably what you have, and this tells OpenGL to more or less replace the current color with the color of the texel.

You only need to call this once, and best place to call is is probably before uploading it, while setting texture parameters.

[This message has been edited by Bob (edited 09-28-2000).]

09-28-2000, 08:03 AM
Thanks, Bob for the prompt reply.

I tried that but it did not work.

I am a newcomer to OpenGL and maybe I am not explaining it correctly. I will try again.

I make a call to interleaved array with GL_C3F_V3F and it displays my object correctly but my textured background becomes black. When I run the command glDisableClientState(GL_COLOR_ARRAY), my textures come back but only now my object has lost its original colors.

Any more suggestions?

Thanks again for your reply.