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

后端 未结 3 2146
清歌不尽
清歌不尽 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:41

    I think that the 1d texture will be drawn. As far as I know, each texture unit can have only one texture bound at a time. The number of dimensions of the texture doesn't really come into it.

    To have more than one texture bound you have to activate more than one texture unit (using glActiveTexture), like this:

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, my2dTex);
    glActiveTexture(GL_TEXTURE1);
    glBindTexture(GL_TEXTURE_1D, my1dTex);
    

    This comes from my knowledge of OpenGL 2.1 though, so please correct me if they've introduced some fancy new texture extension in a later version!

提交回复
热议问题