I am trying to get everything up and running with my engine but am having trouble figuring out what order to add objects and lights to get everything rendered correctly.
I set up my projection and modelview matrix in my itialization:
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(75.0f,(GLfloat)width/(GLfloat)height, 0.1f , 1000.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
Then, when I am rendering geometry, I clear the buffer and load the identity matrix and update my camera.
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
// Camera updates
glRotatef(camera.anglePitch, 1.0f, 0.0f, 0.0f);
glRotatef(camera.angleYaw, 0.0f, 1.0f, 0.0f);
glTranslatef(-camera.position.x, -camera.position.y, -camera.position.z);
// Now render
level.render();
My view of my level is a camera, which I gather is eye coordinates moving around. I am trying to render objects and lights in my level and have them show up in the correct places.
I need to add the objects at specific points in the world. For instance, a torus at (10, 10, 25). Is there anything I need to do before I render this torus objects that will make them appear correctly at 10, 10, 25? Do I need to render and then translate them for instance?
Also, part 2 has to do with lights. It is pretty much the same question. What consideration do I have to have when rendering say a light at 50, 50, 50? Can I just position the light normally or do again do I have to translate it to there? Or am I over thinking this?
If I understand the issue, I would agree that you are overthinking this. The transformations from glTranslate and glRotate are applied to the modelview matrix, by which all your vertices are multiplied to provide the eye coordinates that will later be clipped in projection. The same transformations are applied to your lights as well.
You can also use glPopMatrix and glPushMatrix to apply different states of the modelview matrix to different vertices.
I would also refer you to question 9.070 in http://www.opengl.org/resources/faq/technical/transformations.htm