OpenGL ES 2.x: snap both GL_TEXTURE_2D and GL_TEXTURE_CUBE_MAP in the same block of texture images?

What happens if you bind (different textures) to GL_TEXTURE_2Dand GL_TEXTURE_CUBE_MAPin the same block of texture images?

For example, suppose I bind one texture to GL_TEXTURE0 GL_TEXTURE_2Dtarget and another texture to the same texture unit GL_TEXTURE_CUBE_MAP. Can I then have two uniform variables: a sampler2D, and the other a, samplerCubeand set both values ​​to 0 (to indicate GL_TEXTURE0)?

I suspect the answer is no (or the result is undefined), but I did not find anything in the specification that specifically prohibits the use of multiple texture objects in the same block of texture images.

+5
source share
1 answer

I did not find anything that describes if you can bind the 2D texture and the texture of the cubic map in the same texture unit, but (or so), I think it is quite possible. It makes sense to allow this, since all texture modification functions require that you specify the purpose of the texture to work, anyway.

But the OpenGL ES 2 specification explicitly prohibits the use of both in the shader at the same time, as Chapter 2.10 states:

You cannot have variables of different types of samplers pointing to the same block of texture image inside the program object. This situation can only be detected with the next rendering command, and then an INVALID_OPERATION error will be generated.

, sampler2D, samplerCube, , .

+7

All Articles