PDA

View Full Version : Basic questions from a newbie

02-20-2001, 07:00 AM
Hello,

I'm new to OpenGL and there are a few things which I didn't really get when I read through my OpenGL book: the Viewport, Clipping areas or volumes and parallel projections.

In the text it says that if you want to draw in a window you have to tell OpenGL which coordinate system you want to use and how it should be translated into screen coordinates.
Furthermore it says that this can be done by specifying the Clipping area.
In the next step the viewport maps the clipping area to physical screen coordinates.

I wrote a program which draws a rectlange but nowhere I need to specify the clipping area of a window.
I just have to set the window's heigth and width, and can start drawing without concerning about the minimum and maximum x, and y range ( I don't mention the z axis here, because I just want to draw 2d stuff first ).
So my assumption is that the coordinates which I use to draw exactly match with the window.
Even if I change the original size of the window, I can draw in every part of it.

So, where do I need any translation then?
Why and where do I have to specify the clipping area if it seems to me to match exactly with the current windows size (in pixels) ?

By the way:
What are orthographical projections?
What do they do?
When do I need them?

I'm really frustrated...

I would appreciate any help,

Michael Steinberg
02-20-2001, 07:12 AM
Well, didn't get your question... Anyway.

You will always need a projection, to project a 3d vertex to a 2d pixel. So, if you call glPerspective glOrtho etc. these will set up the correct projection matrices (and store it on the GL_PROJECTION - matrix stack).
A perspective projection is a projection with a perspective ( http://www.opengl.org/discussion_boards/ubb/smile.gif ), means, objects far away get drawn smaller, object near you bigger. It has a fov, it's something like a pyramid going out of your eyes, where the top is in your is somewhere behind your eyes.
An orthographic projection lets object in every direction be of the same size. (3d modelers use that in the wireframe windows for example.)

02-20-2001, 11:09 AM
I think you need to go over your book again, only more slowly. OpenGL has some defaults specified which is probably why you haven't needed to set anything yet.

Othographical projections are only useful if you are trying to draw something theoretical, like a blue print or a mathematical model, since there is no correction for persective being done. In the real world things look smaller as they get further away from the viewer. So when you draw things onto a 2D surface the same size object needs to get smaller as it moves away from the viewer into the screen.

Try using the gluLookAt function to see how your model changes as you change your camera. First three parameters in the function http://www.opengl.org/discussion_boards/ubb/wink.gif