There’s no depth testing in the shader. Here is the shader, if you’re curious:
uniform sampler2DRect imageTex, kernelTex;
void main() {
half3 accum = 0.0;
for(int y = 0; y < 13; ++ y) {
for(int x = 0; x < 13; ++ x) {
half3 sample = texture2DRect(imageTex, gl_TexCoord[0].st - half2(x - 6, y - 6)).rgb;
accum += sample * texture2DRect(kernelTex, half2(y * 13 + x, 1)).rgb;
}
}
}
(and yes, I’m aware it’s not a terribly efficient convolution; that’s the point, I wanted something slow enough to see the early rejection taking place
)
The difference certainly should be visible with a rectangle. The fragment shader takes more than a second to run on a 2K image, and the difference with the shader disabled is immense.
I’ve checked the link and my code already satisfies all the conditions, as far as I’m aware. This is roughly what the code does:
glUseProgramObjectARB(convolveProgram);
(...set some parameters...)
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glClearDepth(0.4f);
glClear(GL_DEPTH_BUFFER_BIT);
glDepthMask(GL_FALSE);
glViewport(0, 0, 2048, 1536);
glMatrixMode(GL_PROJECTION);
glOrtho(-1, 1, 1, -1, -10.0f, 10.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 1536.0f);
glVertex3f(-1.0f, -1.0f, 0.0f);
glTexCoord2f(2048.0f, 1536.0f);
glVertex3f(1.0f, -1.0f, 0.0f);
glTexCoord2f(2048.0f, 0.0f);
glVertex3f(1.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-1.0f, 1.0f, 0.0f);
glEnd();
glFinish();
(not cut and pasted, so minor errors might have crept in)
Nothing there that should prevent early z kicking in, surely?