In OpenGL architectures scissor testing is typically performed on a per-fragment basis. That's great if you have hardware that explicitly includes this functionality at no cost but sadly this is not the case for me.
What I'd like to do is support glScissor at the transform+clipping level. I figure that I can come up with a mechanism to generate a 4x4 transform matrix that is tacked on after the modelview and projection matrix transforms. This matrix will translate, zoom, and adjust the aspect ratio for the scene such that it fits precisely in the scissor box thus allowing the frustum clipper to effectively be my scissor test.
I'm going to sit down now and try and work out the math to do this, but I figured I should ask here first if: 1) is it actually possible? and 2) can you think of any scenarios where this would not be identical to a per-fragment scissor box test? I would like my implementation to be GL-conformant and I only need to support one scissor box.
Thanks,
-Toasty
What I'd like to do is support glScissor at the transform+clipping level. I figure that I can come up with a mechanism to generate a 4x4 transform matrix that is tacked on after the modelview and projection matrix transforms. This matrix will translate, zoom, and adjust the aspect ratio for the scene such that it fits precisely in the scissor box thus allowing the frustum clipper to effectively be my scissor test.
I'm going to sit down now and try and work out the math to do this, but I figured I should ask here first if: 1) is it actually possible? and 2) can you think of any scenarios where this would not be identical to a per-fragment scissor box test? I would like my implementation to be GL-conformant and I only need to support one scissor box.
Thanks,
-Toasty