Is there a way to update gluPerspective by using LoadIdentity or anything else?
Thank You.
- VC6-OGL
Is there a way to update gluPerspective by using LoadIdentity or anything else?
Thank You.
- VC6-OGL
gluPerspective effectively makes a matrix from the argument list and then calls glMultMatrix with it. In other words, gluPerspective is not a matrix, it just modifies the active matrix.
I am trying to create a camera scene by changing the gluPerspective, for example:
So far n = 1, but if I change n from 1 to 2, the perspective view does not update. Why?Code :void reshape( int w, int h ) { h = h < 1 ? 1 : h; n = 1.0; glMatrixMode( GL_PROJECTION ); glLoadIdentity(); glViewport( 0, 0, w, h ); ratio = n * w / h; gluPerspective( 75.0, ratio, 1.0, 1000.0 ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); }
- VC6-OGL
[This message has been edited by VC6-OGL (edited 01-01-2003).]
[This message has been edited by VC6-OGL (edited 01-01-2003).]
[This message has been edited by VC6-OGL (edited 01-01-2003).]
[This message has been edited by VC6-OGL (edited 01-01-2003).]
[This message has been edited by VC6-OGL (edited 01-01-2003).]
gluPerspective( 75.0, ratio, 1.0, 1000.0 );
belongs in the modelview not projection
gluPerspective belongs in the PROJECTION matrix.
From your description it looks like changing n *should* have an obvious effect.
Thanks -
Cass
Cass Everitt -- cass@xyzw.us
Thanx,
I figured out what I was missing.
- VC6-OGL
Come on Cass you know that gluPerspective is completely valid for any matrix mode. Imagine the scene geometry (or texture coords for that matter) taking on perspective !!! Ahhh my head hurts trying to picture that. ( :Originally posted by cass:
gluPerspective belongs in the PROJECTION matrix.
From your description it looks like changing n *should* have an obvious effect.
Thanks -
Cass
Devulon
The only reason I made this post is because I haven't posted anything in a while. Currently occupied with a massive 3dStudio Max Exporter.
My Program works just fine if I define gluPerspective in PROJECTION Matrix Mode. What really needs to go in the MODELVIEW Matrix Mode is glTranslatef or gluLookAt, which I have defined in my Display function for camera motion.
- VC6-OGL
Now, what I forgot to do before was, glLoadIdentity was not set in my function using 'n', so I could not change Perspective view, but changing float n from 1 to 2 was successful, but it never changed the view as 'n' requested. After using glLoadIdentity, I set n to equal 2 and my Perspective changed. So, using gluPerspective in PROJECTION Matrix Mode does not change the fact of using gluPerspective in MODELVIEW or any other Matrix Mode.
Thank you, Cass.
- VC6-OGL
[This message has been edited by VC6-OGL (edited 01-02-2003).]
One more thing, my screen blanks out defining gluPerspective in MODELVIEW Matrix Mode before or after glLoadIdentity, including glOrtho or almost anything besides glTranslatef or gluLookAt.
- VC6-OGL