I “project” the depth of a scene, made up by a terrain and a feature, onto a cubemap. I want to be able to store or project the results of stencil test onto another cubemap but I am uncertain how to do this. So far I have written the following code which is failing,
cube_tex = glGenTextures(1)
glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, cube_tex)
for i in range(6):
glTexImage3D(GL_TEXTURE_CUBE_MAP_POSITIVE_X+i, 0, GL_R32F, 2000, 2000, 12, 0, GL_RED, GL_FLOAT, None)
glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, cube_tex, 0, i)
glTexImage3D(GL_TEXTURE_CUBE_MAP_POSITIVE_X+6+i, 0, GL_STENCIL_INDEX8, 2000, 2000, 12, 0, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, None)
glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, cube_tex, 0, 6+i)
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE)
I believe that I need to use glTexImage3D once I am using a GL_TEXTURE_CUBE_MAP_ARRAY but I am uncertain about the rest.
Can anyone provide me some guidance or references (preferably with examples) that I could consult?
Thanks