Target: OpenGL ES >= 3.0
My app:
1) creates several complicated Meshes
2) for each Mesh, renders it:
a) runs vertex shader which distorts the Mesh' vertices in nontrivial ways
b) nothing special in fragment shader
3) Again for each Mesh:
a) postprocess the area taken by it
Now, in order for postprocessing to be efficient, I call glScissor and make only the smallest rectangle containing the Mesh pass the Scissor test. In order to do that, I need to know the bounding rectangle, and to compute that, I need to know the Mesh
a) leftmost
b) rightmost
c) topmost
d) bottom-most
vertices in window coordinates. It wouldn't be such a big problem if not for the Vertex Shader which distorts the Mesh' vertices (step 2a above).
I deal with that by setting up Transform Feedback so that after step 2, I have the transformed vertices in CPU. I then compute the leftmost- (and the 3 others) one by simply one loop though all of them.
There are hundreds of thousands of vertices though and I was thinking if this job couldn't be done by the Vertex Shader itself.
Question: can a Vertex Shader - one which modifies the vertices positions - figure out the leftmost one and only pass me back it (and the 3 other 'extreme' vertices) ?