I would like to be able to detect a square edges on variable zoom lvls.
My square is at fixed position on the modelview, and I am using gluLookAt to zoom in or out. When I am zoomed out at max ( then square fits screen exactly ), I do not need to be able to move the camera left/right/up/down, but when I am zoomed in ( any zoom level ), I need to able to move camera until square edge is found.
In a using glFrustrum to set the matrix and gluLookAt to make my zooms.
How could I calculate the camera’s moving area against camera’s distance from my source ?
Project square coordinates from world space to screen space with your model view, projection and viewport matrix. Then check each points that they’re outside of the screen space. If it passes, then you can allow to move camera. Here is a sample code for projection: http://www.flipcode.com/archives/Object_To_Screen_Space.shtml