Shadowmap first phase and shaders
- by KaiserJohaan
I am using OpenGL 3.3 and am tryin to implement shadow mapping using cube maps.
I have a framebuffer with a depth attachment and a cube map texture.
My question is how to design the shaders for the first pass, when creating the shadowmap.
This is my vertex shader:
in vec3 position;
uniform mat4 lightWVP;
void main()
{
gl_Position = lightWVP * vec4(position, 1.0);
}
Now, do I even need a fragment shader in this shader pass? from what I understand after reading http://www.opengl.org/wiki/Fragment_Shader, by default gl_FragCoord.z is written to the currently attached depth component (to which my cubemap texture is bound to).
Thus I shouldnt even need a fragment shader for this pass and from what I understand, there is no other work to do in the fragment shader other than writing this value.
Is this correct?