I have my world rendered. Based on some specific requirements it includes (some time) some lights on the floor. I am rendering these lights using triangle primitives. Right now I have the following code to zoom and limit the rendering area:
if(aspect>1)
gl.glOrtho(-scale*aspect, scale*aspect, -scale, scale, 0, 2);
else
gl.glOrtho(-scale, scale, -scale/aspect, scale/aspect, 0, 2);
As you can see in this image, the far plane is cutting the light throught a line (parallel to the line on the circle between B and D)
The problem arises when I rotate my scene... the glOrtho "box" stays fix. You can notice it by looking always at the cutting line on the light. It is no more parallel to the line between B and D...
One of my friend suggested my this document. Basically it explains how to extract frustum planes...
But this would mean that I should check manually each primitive if it is inside or not..
Is there a method using the glOrtho call?
I would like to obtain something like this: