LWJGL Determining whether or not a polygon is on-screen.
Posted
by
Brandon oubiub
on Game Development
See other posts from Game Development
or by Brandon oubiub
Published on 2011-06-22T20:44:26Z
Indexed on
2011/06/23
0:33 UTC
Read the original article
Hit count: 372
Not sure whether this is an LWJGL or math question. I want to check whether a shape is on-screen, so that I don't have to render it if it isn't. First of all, is there any simple way to do this that I am overlooking? Like some method or something that I haven't found? I'm going to assume there isn't.
I tried using my trigonometry skills, but it is hard to do this because of how glRotate also distorts the image a little for perspective and realism. Or, is there any way to easily determine if a ray starting from the camera, and going outward in a straight line intersects a shape? (I can probably do it with my math skillz, but is there an easier way?)
By the way, I can easily determine the angle at which the camera is facing around the x and y axis.
EDIT: Or, possibly, I could get the angles of a vector from the camera to the object, and compare those angles to my camera angles. But I have a feeling that the distorts from glRotate and glTranslate would be an issue. I'll try it though.
© Game Development or respective owner