Texture mishandling or bug?

Hello all

I’m having the following problem, and I don’t know it it is an error from my side or a bug somewhere else…

My code looks like

if (A)
{
glBindTexture(GL_TEXTURE_2D,tex1);
// Draw a textured Quad
}
if (B)
{
glBindTexture(GL_TEXTURE_2D,tex2);
// Draw a textured Quad
}

Now, if at the begging both A and B are true, it will only draw the texture for the second quad
and the first one will be blank.
If I turn the second one (B) off and turn it back on, then both will show even though I didn’t change Tex1 or Tex2

It looks like there is some problems binding the textures…or something like that.

any hint?..any clue?

Thank you all…
Asdiel.

If your code is as you say it is, the two parts will work completely independently. I can’t think of any possible thing in the driver that would make it behave as you say, so I can only conclude that there must be a bug somewhere in your program.

check the values of your texture handles. Maybe one of the texures aren’t a power of 2 in their dimensions, and so would break things. Make sure tex1 and tex2 aren’t 0.

can’t think of anything else.

Nutty

When you get these kinds of problems, the
first thing to check is that you’re testing
all your error conditions correctly, and
the second is to make sure you’re not using
any uninitilized member or stack variables.

If none of that is happening, try looking
for array overwrites, bad pointer arithmetic
or (uncaught) bad function arguments which
can mess up memory. Alas, not every bad
pointer dereference results in a crash :frowning: