PDA

View Full Version : Texture mapping with 2 texture maps help please



Julian
05-16-2002, 11:34 PM
I have a function which draws a rectangle surrounded by 4 quads. The data for the rectangle and its texture coordinates are in an array while the surrounding quads vertex and texture data is in a second array.

There is aseperate texture for each array.

I enable the glarrays with glEnableClientState and link the rectangles arrays, bind its texture and call glDrawArrays then link the quads arrays, bind the second texture and call glDrawArrays.

The problem is I dont get the correct texture on the rectangle. If I dont attempt to use the second texture (on the quads) all works well.

Somehow when I bind the second texture I lose the first. What am I doing wrong?

Help please

Julian

DFrey
05-17-2002, 06:08 AM
I would suggest you do some function logging for debugging purposes. Whenever you bind a texture, log it. When even you draw something, log that too. Whenever you disable or enable textures, log that too. Also whenever you Push or Pop Attributes, as well as whenever you touch the texture matrix. Run your code using both textures, then look at the log. See if the log indicates what is going wrong. Often times, with something like this, it could simply be a single misplaced bind.

Old GLman
05-17-2002, 07:04 AM
Hi, yeah it definately sounds like either a misplaced bind or your generating texture objects incorrectely. Just remember to call ActiveTexure, then bind, and then enable GL_TEXTURE_2D before you draw geometry with a new texture.

Old GLman