Hi,
I’m currently porting my DX9 hardware shadow mapping implementation on opengl.
So i have to use the frame buffer object extension.
For the moment, i can create a Float32 render target but need to improve it with nvidia hardware implementation.
I use the following init code, i must miss something because no shadows are displayed (i check shadow bias and pixel/vertex shader, it seems the problem is in my fbo)
glGenFramebuffersEXT(1, &_uiSurface);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _uiSurface);
glGenTextures(1, &_Texture._gluiTextureIndex);
glBindTexture(_Texture._bindingTarget, _Texture._gluiTextureIndex);
glTexImage2D(_Texture._bindingTarget, 0, GL_RGBA8, uiWidth, uiHeight, 0, GL_RGBA, GL_FLOAT, NULL);
glTexParameterf(_Texture._bindingTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(_Texture._bindingTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(_Texture._bindingTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(_Texture._bindingTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
// attach texture to framebuffer object
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, _Texture._bindingTarget, _Texture._gluiTextureIndex, 0);
glGenTextures(1, &_Texture._gluiTextureIndex);
glBindTexture(_Texture._bindingTarget, _Texture._gluiTextureIndex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, uiWidth, uiHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT/*GL_FLOAT*/, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
// attach texture to framebuffer object
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, _Texture._bindingTarget, _Texture._gluiTextureIndex, 0);
Any ideas ?
I’m sure i’m not the first one to implement hardware SM with frame buffer object !!
If somebody knows a good sample showind how to use this wonderful extension, don’t hesitate.
Thanks in advance.