Archived

This topic is now archived and is closed to further replies.

Ledneh

Where IS (-1,0,0)?

Recommended Posts

I''m having something of a bit of confusion. In OpenGL, what actually defines how much you''re looking at? For example, say I wanted to draw a square that covered the whole screen, nothing more (i.e. don''t overextend the square past the screen borders), and nothing less. How would I know what the edge of the screen is? (Assume I''m at z=0, for purposes of my sanity). I''m using Nehe''s tutorials, if that helps. -Ledneh

Share this post


Link to post
Share on other sites
well, one way to do it is to extract the frustum and get the coordinates where it intersects the near clip plane. offhand there are some good tutorials on gamasutra for extracting the frustum, i think there are some also in the gamedev articles & resources section. i believe i initially found the turorials, though, through a google search for something like "extract openGL frustum C++" or varients thereof.

once you get the coords of the near clip plane you can draw a quad with the same coords (probably set a tiny bit back from the near plane to prevent z-fighting).

couple definitions:
- the frustum is the truncated pyramid that defines what area of the openGL world is displayed.

- the near clip plane is a plane set a certain distance from the camera. anything closer to the camera than the near clip plane is not drawn.

anyway, that's one way to do it. there may be a better way.

-me

[edited by - Palidine on March 5, 2003 2:01:30 PM]

Share this post


Link to post
Share on other sites
Aah, frustum, that's what I needed.

Now, with glFrustum(-1,1,-1,1,1,100), it's exactly like what I'm used to from Direct3d. Thanks

[edited by - Ledneh on March 5, 2003 2:28:58 PM]

Share this post


Link to post
Share on other sites