I’m using a Perspective View with gluPerspective and gluLookAt and I have the x,y world coordinates of an object. How can I determine if the object is outside the viewable area? Note that the camera is always moving around.
I’m using a Perspective View with gluPerspective and gluLookAt and I have the x,y
Share
First thing first: OpenGL doesn’t have a camera. It just transforms vertices around. And gluLookAt just applies a transformation on the objects that’s inverse to a movement of a thought camera.
The solution had already been given in the first comment by Robert Massaioli: In OpenGL a perspective transformation is described in terms of a frustum (gluPerpective just calculates frustum parameters and passes these to glFrustum). So by determining frustum culling of your objects, i.e. if they are culled, you determine if they’re still visible.