PDA

View Full Version : glTextureSubImage2D and CubeMaps



CornyKorn21
11-16-2015, 02:05 PM
I found a similar post concerning what I am about to ask. I'm just not certain I fully understood the response.
https://www.opengl.org/discussion_boards/showthread.php/186205-glTextureSubImage2D-vs-GL_TEXTURE_CUBE_MAP?highlight=glTextureSubImage2D


In this thread it was said we should treat the cube map as a 2D texture array with exactly 6 layers. I'm looking at the documentation for glTextureSubImage2D but it doesn't seem to mention anything about layers. Should I treat level as the layer in this situation? If that is the case then how do you set up mips for the cube map?

GClements
11-16-2015, 02:35 PM
In this thread it was said we should treat the cube map as a 2D texture array with exactly 6 layers. I'm looking at the documentation for glTextureSubImage2D but it doesn't seem to mention anything about layers.
If you read the thread a bit more closely, you'll find that you should be looking at the documentation for glTextureSubImage3D (https://www.opengl.org/sdk/docs/man4/html/glTexSubImage3D.xhtml). Array textures have an extra dimension.

The documentation fails to list GL_TEXTURE_CUBE_MAP as a valid target (which is discussed in the latter part of that thread), but it is. When the texture is a cube map, zoffset and depth indicate the first face to modify and the number of faces respectively.

For more accurate documentation, refer to section 8.6 of the OpenGL 4.5 specification (https://www.opengl.org/registry/doc/glspec45.core.pdf).

CornyKorn21
11-17-2015, 06:30 AM
Thanks! I glossed right over that.