[vox-tech] OpenGL - perspective projections

Ken Bloom kabloom at ucdavis.edu
Fri Jan 14 09:04:32 PST 2005


On Fri, 14 Jan 2005 11:15:19 -0500
p at dirac.org (Peter Jay Salzman) wrote:

> Hi all,
> 
> In my little snatches of spare time, I've been reading a book on
> OpenGL. Don't care much for the book, but that's the breaks.
> 
> I have a question about the projection matrix.
> 
> When I draw stuff to the screen, OpenGL takes care of perspective for
> me. In other words, when I put a triangle centered at (0,0,-1), it
> apears bigger than a triangle centered at (0,0,-999999).  I don't have
> to play with a projection matrix for this to happen.
> 
> So, then, what exactly is the projection matrix used for?

There are many different options for how to project an image.

One reason you might change the projection matrix is if you wanted an
orthographic projection, where a triangle centered at (0,0,1) was the
same size as a triangle centered at (0,0,-999999)

Another reason is if you wanted to change the field of vision either by
changing its angle, its aspect ratio (which you probably want to keep
synchronized with the window), or changing the near or far clipping
distance. I'm surprised that you see a triangle centered at
(0,0,-999999) - I would expect the default clipping matrtix to
either clip off a triangle place that far back, or that triangle should
be so small that you don't even see it. Try placing triangles at
centered at (0,0,.5) (0,0,0) and (0,0,-.5), and see whether you're using
using an orthogonal matrix or a perspective matrix.

I suspect your default projection matrix should be the identity matrix -
an orthographic projection matrix that clips anything with a coordinate
greater than 1 or less than -1.

(Of course, if you haven't turned on depth buffering then it won't clip
anything at all based on depth.)

--Ken Bloom

-- 
I usually have a GPG digital signature included as an attachment.
See http://www.gnupg.org/ for info about these digital signatures.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://ns1.livepenguin.com/pipermail/vox-tech/attachments/20050114/1f8768f5/attachment.bin


More information about the vox-tech mailing list