Re: [Plib-users] sgFrustum setting to the same as opengl
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2000-05-10 03:22:16
|
Oliver Batchelor wrote: > > I have a function for setting up a view frustum I want to know if > its getting the right values to be setup the same as the opengl one > ... > I am getting some wierd results in my landscape renderer - > If I roll around etc everything dissapears but I cant see whats > going wrong ... > > here is the setup code ... > > void View::Set(float angle, float near, float far) { > glMatrixMode(GL_PROJECTION); > glLoadIdentity(); // Reset The Projection Matrix > > gluPerspective(angle, 640.0/480.0, near, far); // Calculate The Aspect Ratio Of The Window > glMatrixMode(GL_MODELVIEW); > > frustum.setFOV(angle, angle) ; ^^^^^^^^^^^^ That's going to set the HFOV and VFOV to the same values - but you (seem to) have a 640x480 window. Try using (angle,-1) - and we'll compute the second angle for you assuming a 3:4 aspect ratio. Dunno if that's enough to account for your wierdness. You could also use a sgFrustum::getMat4 to grab the matrix out of the sgFrustum - then you can use glLoadMatrix to put it onto the projection stack - no messing with gluPerspective - and it guarantees a good match. -- Steve Baker http://web2.airmail.net/sjbaker1 sjb...@ai... (home) http://www.woodsoup.org/~sbaker sj...@ht... (work) |