Reputation: 395
I'm trying to implement shadowmapping, so I'm rendering to depth texture. When I don't bind framebuffer which contains depth texture and use default framebuffer, it outputs to screen. However, instead of white color for distant fragments, they're red.
This is my fragment shader:
#version 330
out float fragmentdepth;
uniform sampler2D inputTex;
void main(){
fragmentdepth = gl_FragCoord.z;
}
Is it a problem? Because shadowmapping isn't working and I'd like to rule out this as source of problem.
Upvotes: 1
Views: 3183
Reputation: 162317
Depth is a scalar value. Scalar is interpreted by OpenGL as a single component texture. Single component texture means that only the .x
or .r
element (whatever you use) gets nonzero.
Upvotes: 2