#### Archived

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

# How to draw a polygon at the edge of the screen?

This topic is 5369 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

after using gluPerspective(60.0f,(GLfloat)800/(GLfloat)600,0.1f,100.0f) in a 800 x 600 window, how to draw a quad that with it's top-left point at the top-left point of the window screen? how to calculate it, thank you? [edited by - silversaraph on February 7, 2004 8:17:35 PM]

##### Share on other sites
Highest visible point in frustrum at distance d:
[1] y = tan(fovy) * d

Leftmost visible point in frustrum at distance d:
[2] x = -tan(fovx) * d

You already have fovy. To calculate tan(fovx):
[3] fovy = atan(height / distance)[4] fovx = atan(width / distance)[5] tan(fovy) = height / distance (rearrangement of 3)[6] tan(fovx) = width / distance (rearrangement of 4)[7] distance = height / tan(fovy) (rearrangement of 5)[8] tan(fovx) = width / (height / tan(fovy)) (7 into 6)[9] tan(fovx) = (width * tan(fovy)) / height (rearrangement of 8)[10] tan(fovx) = tan(fovy) * (width / height) (rearrangement of 9)

Enigma

##### Share on other sites
Thank you Enigma, I will try it out

##### Share on other sites
It was late and I read his post and just assumed he really wanted to be able to position something at an absolute position under a perspective projection. Reading it again it''s quite possible that an orthographic projection would have been the simplest answer. Just goes to show that if you''re not careful how you specify your question you might not get the best answer!

Enigma

1. 1
Rutin
44
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632984
• Total Posts
3009713
• ### Who's Online (See full list)

There are no registered users currently online

×