PDA

View Full Version : Is binding the same texture twice legal?



Krylloan
03-13-2002, 09:58 PM
is the code below legal?

glBindTexture(GL_TEXTURE_2D, tnum);
glBindTexture(GL_TEXTURE_2D, tnum);
(same code repeated, tnum same both times)

It crashes my program.

This occurs when I render a model that ends with texture X, then render another model that begins with texture X.

I can easily fix this by keeping a record of the currently bound texture and only calling glBindTexture when a different texture is required.

Do most GL coders use a check like this. Is this good programming style? Or is this a problem with my setup, either with the Kyro's gl drivers, or my code, or something else. Any ideas?


Specs:
Devel: Using SDL in Visual C++ 6.0 under Windows XP.
GFX Card: Hercules 3d Prophet 4500 64mb (KyroII)
Driver (And GL driver): (3DPK-XP-14028.exe)


Thanks for all assistance
Simon Hill

T2k
03-13-2002, 11:32 PM
i think its not illegal, so its a driver fault, but it isnt whise to repeat such calls, because they reduce the speed of you app(statechanges are slow!!!), so try too keep tracking it (like good OpenGL coders do)