Quote Originally Posted by jdarling
Thanks for the links and basics so far... Let me see if I have this somewhat correct:
1) Translate/rotate my view (Camera) before I do anything else. This is one mistake I've been making as I thought I was setting up the "world" and then moving through it.
2) Stop trying to consider world and view as different, I never change the world moves around me LOL
3) I need to call glMatrixMode(GL_MODELVIEW) some place in my code.
4) glLoadIdentity() seems to reset the view (or is it world) matrix back to 0 so, for "world" translations call it before you move something. For relative movement (IE: Based on the position of something else) don't call it?
5) ... I'm still lost , then again 3D has evaded me for many MANY years now.

If I wanted to have a basic "object" it would seem that it would have a placement vector and a rotation vector, but reading User137's post that would be wrong?

There has to be a for dummies out there I haven't read yet LOL

- Jeremy
1. Yes, In OpenGL you have to set up the camera before you can render your geometry. This is because the view transformation and the world (model) transformation are combined. You cannot independantly change one of them.

When you call OpenGL matrix functions, you are manipulating the one of the openGl matrices (this depends on the mode you are in. change it using glMatrixMode() ). Most functions will add new transformations on top of the ones you allready built. Let's say if you do:

[pascal]
glScale( ... )
glRotate( ... )
glTranslate( ... )
[/pascal]

and you want to change the scale again, you cannot. You must either call glLoadIdentity() and rebuild everything from ground up or use a the transform stack:

[pascal]
glScale( ... )
glPushMatrix(); //We push the current Modelview matrix to the stack to save it

//So some additional transforms
glRotate( ... )
glTranslate( ... )

//Render some stuff

glPopMatrix(); //We pop the matrix that we pushed from the stack to restore its transformation
[/pascal]

2. Well, you need to view these things as separate because they actually are. It's just that opengl doesn't separate them, so if you are thinking in terms of OpenGL programming, these are indeed combined. Direct3D seperates the view from the world transform, and I think that's a better way.

3. Yeah, every time you want to modify the MODELVIEW matrix, you have to call this routine. Unless you are sure that OpenGL is allready in MODELVIEW mode. This takes some getting used to.

4. Yes, glLoadIdentity() is used to reset your transform. Be carefull with this, because if you do this, you will also reset your camera transform (because MODELVIEW was view+model combined). You probably want to use the stack to save the transforms.

5. The hardest part of this is properly understanding matrices and vectors. It took me a lot of time to squeeze them in, but it was worth it. I suggest you start looking at simple demo's and start decomposing them. If you understand how they are build, you're on the right track.

Hope this helps.