PDA

View Full Version : Correct selection of projection matrix + scaling to get an object to fill the screen



tumbleweed
05-21-2002, 05:12 AM
Hi,

I've managed to totally confuse myself with perpective projection, if I set up the projection matrix with say:

gluPerspective(60.0, float(width)/float(height), 0.1f, 200.1f);

and then I go to draw a unit sphere that is positioned at (0, 0, -100) what should I scale the sphere by to make it fill the screen?

Thanx,

Tumbleweed.

JeeTriX
05-21-2002, 05:38 AM
I forgot if that angle in gluPerspective is the half or the whole angle, but anyway, i think it's the whole one and in that case, try

57,735f

as radius of your sphere http://www.opengl.org/discussion_boards/ubb/tongue.gif)

this is where i got it :
--> sin(30)/(100/cos(30))