hi there,
is this the correct way to set up depth cubemap texture arrays? My problem is that nothing is rendered to the textures...
EDIT: I seem to have been able to render 1 face correctly, I still suspect the setup code.
I get no errors or debug output messages.
I suspect that I should somehow enable each face as usual with the cubemaps, but I couldn't find a way to do that...
GLuint point_shadow_texture;
glGenTextures(1, &point_shadow_texture);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, point_shadow_texture);
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 );
glTexParameteri( GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexImage3D( GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_DEPTH_COMPONENT32, shadow_texture_size.x, shadow_texture_size.y, lights.size() * 6, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0 );
vector<GLuint> point_shadow_fbos;
point_shadow_fbos.resize( lights.size() );
glGenFramebuffers( lights.size(), &point_shadow_fbos[0] );
for( int c = 0; c < lights.size(); ++c )
{
glBindFramebuffer( GL_FRAMEBUFFER, point_shadow_fbos[c] );
glDrawBuffer( GL_NONE );
glFramebufferTextureLayer( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, point_shadow_texture, 0, c );
frm.check_fbo_status();
}
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
usually I set up non-texture-array depth cubemaps like this:
GLuint cubemap_tex;
glGenTextures( 1, &cubemap_tex );
glBindTexture( GL_TEXTURE_CUBE_MAP, cubemap_tex );
glTexParameteri( GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
uvec2 texsize( 1024 );
for( int c = 0; c < 6; ++c )
glTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_X + c, 0, GL_DEPTH_COMPONENT24, texsize.x, texsize.y, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0 );
GLuint cubemap_fbo;
glGenFramebuffers( 1, &cubemap_fbo );
glBindFramebuffer( GL_FRAMEBUFFER, cubemap_fbo );
//attach depth cubemap to fbo's depth attachment
glFramebufferTexture( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, cubemap_tex, 0 );
//no color textures attached
glDrawBuffer( GL_NONE );
frm.check_fbo_status();
//unbind
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
Best regards,
Yours3!f