Hi!

What are the key parameters to look at in order to have fragment depth mapped to the range (-1.0 -> 1.0) instead of the range (near plane -> far plane) ? I'm trying to get rid of the far plane divide in the following (extremely simple) shader code because I don't think it's neat

Vertex shader:
Code :
void main( void ) {
 
	gl_Position = ftransform();
}

Fragment shader:
Code :
void main (void) {
	float result=gl_FragCoord.z/gl_FragCoord.w;
	result/=10.0; // <--- this must go
	gl_FragColor = vec4(result,result,result,1.0);
}

I'm rendering to an FBO which has a depth attachment with internal and external format GL_DEPTH_COMPONENT and have tried several texture types (GL_FLOAT, GL_HALF_FLOAT, GL_UNSIGNED_BYTE) but nothing seems to make it so the frag depth is ranged from -1.0 to 1.0, the values always range from 0 to 10.0 (far plane)

It's something simple I'm overlooking but I can't put my finger on it. Maybe you can?