Here are my settings for opengl, incase they matter:

```
glViewport(0,0,w,h); //w=800, h=600
glShadeModel(GL_SMOOTH);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

```

For a while I thought that the clipping planes will apply to anything for which gl\_Position.z is outside -1 to 1. 
But even when I force gl\_Position.z to a constant number in the shader:

```
gl_Position.z = -0.01;

```

There is still correct z-buffering and clipping based on gl\_Position.w! So what are the rules?