View Full Version : Is it possible to create an opengl space without glortho or glu perspective

tirengarfio

11-01-2006, 11:15 PM

Hi,

is it possible to create an opengl space without glortho or glu perspective?

i have an opengl code which draws a 3d object but it doesnt have anyone of these to functions.

So where does it specify the size of the frustum?

Relic

11-01-2006, 11:48 PM

OpenGL has defaults for all states.

The default for all matrices is the identity which makes the default viewing frustum to be identical to glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0).

Read the OpenGL programming guide (search for redbook.pdf) and the OpenGL 2.0 specs.

Komat

11-02-2006, 03:15 AM

Originally posted by tirengarfio:

is it possible to create an opengl space without glortho or glu perspective?

So where does it specify the size of the frustum? Both those functions only modify current matrix. The program can calculate the projection matrix in its own way and use the glLoadMatrix function to upload the resulting matrix.

Overmind

11-02-2006, 07:06 AM

And of course there is glFrustum ;)

lerwen

11-02-2006, 03:26 PM

yes the size of your space is always a 2x2x2 cube centered at the origin and your transformation matrix maps coordinates into that space, so with the identity matrix ana point (x,y,z) with an x value of -1 gets mapped to the left side of the vieport, x=1 to the right, y=-1 is the bottom, y=1 is the top, z=1 is closest to you, and z=-1 is the firthest away.

Note, when you load the identity transformation matrix, the x axis points to the right, y points up and z towards you, but after glOrtho(-1, 1, -1, 1, -1, 1) z points away from you.

Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.