Viewable area

Hi

I am new to this forum so hello everybody! I am also new to opengl and have few questions.

I’ve been using the NeHe Productions tutorials on gamedev to learn opengl. They are really good as a starting point but they dont go into a lot of detail on some points.

What I am concerned with is the screen area.

In one of the tutorials there is a line of code

glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0

this line is followed by code which draws a shape.

If I dont include this line nothing appears on my screen. What is this line of code doing? Why do I need to ‘move’ into the screen? What am I moving into the screen? Can’t I just have a screen with the btop left being 0,0 or the middle being 0,0 and then work from there?

Also this glTranslatef seems to be used for animating objects. If I want to move an object I have to use this command and then draw the object specifying its coords but each time I move the object the coords stay and same but I increment the glTranslatef parameters. This is confusing to me…why dont I increment the x and y coords of the object? Am I missing something here?

In my mind I thought it would work something like this…one has a screen set to resolution. This will tell me how many pixels are in the viewable area. Top left of the screen would be 0,0 and bottom left would be the max x and y values for the resolution. Placing an object would be simply a case of picking its place on this screen and then drawing the object. Animating would be simply a case of incrementing the x and y values of said object.

I understand it does not work quite like this because as well as a virtual space one has a view point which can move around the virtual space…is that correct?

So I guess then my over all question would be how do I set my view so I know the top left is 0,0? Also how do I know where the boundaries are (i.e. where the edge of the screen is from that view point)? And, finally, why does animation require I use glTranslatef and not just change the x, y coords of said object? Of course I accept I may have the wrong end of the stick and thus my questions may be stupid or irrelevant.

Thank you all for your time
Andrew

You need to read a tutorial on transforms. It will describe the purposes of a modeling, viewing, and projection transform. I suggest you pick up the OpenGL Programming Guide (or read it online) and read Chapter 3: Viewing.