# shadow cubemap FBO init = GL_FRAMEBUFFER_UNSUPPORTED_EXT?

## Recommended Posts

DeathCarrot    188
I couldn't find any resources on this so I pieced it together from here and there so it could be completely wrong, but this initialisation is causing a GL_FRAMEBUFFER_UNSUPPORTED_EXT error (The class itself is a mess as it handles all kinds of FBOs, not just shadow cubemaps, but these are the gl commands that are being run in it in this instance):
glGenFramebuffersEXT(1, &id);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, id);

glGenTextures(1, &img);
glBindTexture(GL_TEXTURE_CUBE_MAP, img);

glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_DEPTH_COMPONENT24,
width, height, 0,
GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);
.
.
.
glTexImage2D (GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_DEPTH_COMPONENT24,
width, height, 0,
GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);

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_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);

glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
GL_TEXTURE_CUBE_MAP_POSITIVE_X, img, 0);
glDrawBuffer(0);

glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);

The final command there returns GL_FRAMEBUFFER_UNSUPPORTED_EXT. Also, to select which face to render to, I just use glFramebufferTexture2DEXT right? Thanks.

##### Share on other sites
V-man    813
You can`t make depth cubemaps. Only 2D.

##### Share on other sites
DeathCarrot    188
Aah, well that would certainly explain the error, thanks. So for full shadows from a point-light I need 6 separate FBOs? Either that or render the depth component onto a colour buffer. Suggestions?

What about depth renderbuffers in cubemaps?

Thanks.

##### Share on other sites
V-man    813
For point lights, you can make 6 separate buffers, or use a cubemap buffer into which you specially write the depth values using a shader, or use 2 depth maps and use the parabolic projection method.

Depth render buffers are not supported on anything because the r component of str is needed for depth compare mode.
Cubemaps and depth maps are not compatible but maybe one day they will use the q component and finally offer an extension.

##### Share on other sites
_the_phantom_    11250
Quote:
 Original post by V-manDepth render buffers are not supported on anything because the r component of str is needed for depth compare mode.Cubemaps and depth maps are not compatible but maybe one day they will use the q component and finally offer an extension.

Already here; the GF8 series allows you to use depth cube maps by using the q param as the compare variable.

##### Share on other sites
V-man    813
Quote:
 Already here; the GF8 series allows you to use depth cube maps by using the q param as the compare variable.

Good thing that I have a GF8 :)
Is there a special extension or thing I need to do or I can just create a depth cubemap?

##### Share on other sites
_the_phantom_    11250
It's covered in the EXT_gpu_shader4 extension specs.

I think it just relaxes the rules on Cube map internal format and possibly gives you a new entry point for GLSL to perform the lookup, but I'm not 100% on that last one, you'll need to read the spec above.

Infact, I recommend reading the various EXT specs for DX10 stuffs, they are pretty intresting (like the ability to have layed FBOs so that you can use the geometry shader to decide which layer a primative goes to).

##### Share on other sites
glPetter3f    122
Is it possible to use the framebuffer's depth? I am trying to make a cubemap showing the reflections of the world so I want to render the environment to a cubemap (need some kind of depth buffer here) and use it in a shader.

## Create an account

Register a new account