In OpenGL I have always understood that glEnable(GL_TEXTURE_1D)
, glEnable(GL_TEXTURE_2D)
and/or glEnable(GL_TEXTURE_3D)
(and corresponding glDisable
) is a per texture unit parameter.
Recently I tried to confirm this but have not found any clear documentation confirming either way regarding this question.
Put simply and in code, should I be doing this
glActiveTexture(GL_TEXTURE0);
glEnable(GL_TEXTURE_2D);
... bind etc ...
glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
... bind etc ...
or this
glEnable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE0);
... bind etc ...
glActiveTexture(GL_TEXTURE1);
.... bind etc ...
I was hoping to find some clarity.
It is indeed per texture unit. The most recent documentation I found mentioning this explicitly was the Open GL specification 2.1 (2006 update) here
In section 3.8.16: Texture Application
It is probably mentioned somewhere in the new specifications but they were heavy re-organized. You can have a look at all the Open GL version specifications on the opengl org website (I wanted to post a link but I can't seem to post more than one).
It's per texture unit.
From the GL1.5 specification, 3.8.15:
Each texture unit is enabled and bound to texture objects independently from the other texture units
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With