HanWu
12-18-2010, 06:56 AM
I tried creating a soft shadow using FBO (Frame buffer object) and vertex Shader. I first render the shadow and capture it with FBO and attach it to a texture. Because the glTexImage2D method require a n power of 2 width and height so I created an image larger than the screen size and later using the glTexCoord2d to specify the portion of texture that is exactly the same size of my current screen. After that, the texture will be render with the vertex shader to produce a blur effect(sampling).
glUseProgramObjectARB(m_glslContext);
glUniform1fARB(m_glslSampleDist, fSampleDist);
glUniform1iARB(m_glslFrameBufferTexture, 0);
glBindTexture(GL_TEXTURE_2D, uiFrameBufferTexture);
Everything looks fine except the border or edge of the texture also get affected by the sampling effect and create a Re-sampling artifacts at the edge. I then called the following method
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
The left edge and bottom edge of the texture is no longer get affected by the sampling effect but the top edge and right edge of the texture still get affecting by the sampling effect. Is there a way to get rid of this problem? Please Advise! Thanks in advance!
glUseProgramObjectARB(m_glslContext);
glUniform1fARB(m_glslSampleDist, fSampleDist);
glUniform1iARB(m_glslFrameBufferTexture, 0);
glBindTexture(GL_TEXTURE_2D, uiFrameBufferTexture);
Everything looks fine except the border or edge of the texture also get affected by the sampling effect and create a Re-sampling artifacts at the edge. I then called the following method
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
The left edge and bottom edge of the texture is no longer get affected by the sampling effect but the top edge and right edge of the texture still get affecting by the sampling effect. Is there a way to get rid of this problem? Please Advise! Thanks in advance!