I already asked that question in another thread of mine, but the topic was a bit misleading. So let me ask again:
Is it possible to write a shader that returns a “boolean” array, whether a triangle is visible or not after clipping?
For example you got 3 triangles
#1 gets clipped once
#2 doesnt get clipped
#3 gets fully clipped and discarded
the result would be something like that (in pixel colors) WHITE-WHITE-BLACK
I already managed to produce a shader that tells me if a edgepoint of that triangle is visible.
vertex shader:
void main()
{
gl_Position = gl_Color;
gl_ClipVertex = ftransform();
}
fragment shader:
void main() {
gl_FragColor = vec4(1.0,1.0,1.0,1.0);
}
gl_Color is used to position the information in a array and everything is rendered to a pbo. That works if I set glPolygonMode to GL_POINT, but it only recognizes the edges! I need something equivalent to that, but it needs to check every point of the triangle. Simply setting the glPolygonMode just gives me no results (why!?).
Regards
shiBBy2k9