Next Meeting: October 7: Social gathering Next Installfest: TBD Latest News: Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk Page last updated: 2005 Jan 15 08:49
Re: [vox-tech] OpenGL - perspective projections

# Re: [vox-tech] OpenGL - perspective projections

```On Fri, 14 Jan 2005 11:15:19 -0500
p@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.
```

Attachment: pgp00014.pgp
Description: PGP signature

```_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech
```