What is the correct behavior when both a 1D and a 2D texture are bound in OpenGL?

后端 未结 3 1805
清歌不尽
清歌不尽 2021-02-19 22:20

Say you have something like this:

glBindTexture(GL_TEXTURE_2D, my2dTex);
glBindTexture(GL_TEXTURE_1D, my1dTex);
glBegin...

What is the correct

3条回答
  •  被撕碎了的回忆
    2021-02-19 22:49

    The applied texture is the last specified with BindTexture routine.

    From the specification:

    The new texture object bound to target is, and remains a texture of the dimensionality and type specified by target until it is deleted. .... If the bind is successful no change is made to the state of the bound texture object, and any previous binding to target is broken.

    Indeed in your example it will be applied the 1D texture, since it "overwrite" the state of the active texture unit.

提交回复
热议问题