gluLookAt basic questions

Hi i’m having a few questions in regrads to gluLookAt.

  1. Do i need to redraw my scene if i want to move the camera around? Or can i move / rotate the camera without needing to redraw the scene?

  2. Is there any good examples with gluLookAt that have rotation/movement and explain whats going on with the code as well as the trig?

Thanks guys.

Do i need to redraw my scene if i want to move the camera around? Or can i move / rotate the camera without needing to redraw the scene?

You need to redraw the scene because if you don’t, you’ll be overwriting the old image. This is true whether you’re moving the camera, objects, or anything that affects what the rendered image will be in any way.

Is there any good examples with gluLookAt that have rotation/movement and explain whats going on with the code as well as the trig?

Well, this doesn’t use gluLookAt per-se, but it uses equivalent code that generates the same matrices that gluLookAt would.

Thanks for the reply i have been trying for a while and have this problem

If an object has its own rotation set up then by rotating the camera in this way it wreaks the rotation of the object?

What do I have to do so that the objects in my scene that get draw are not effected untill either the end of the drawing or their own roations do not get messed up by the cameras?

Thanks again for the reply!

If an object has its own rotation set up then by rotating the camera in this way it wreaks the rotation of the object?

That’s a very vague question. You could be doing any number of things wrong, but since you haven’t explained how your code works or posted any of it, there’s no way for anyone to tell how your transforms are getting modified.

You need to preserve the value of the ModelView matrix beteen rendering calls and the camera setup for the scene. Use glPushMatrix and glPopMatrix commands

^ yes that was the problem!

I just wanted to say that i’m really new at this and i’m sorry for asking such a vague question.

Thankyou both so much for taking the time to help me learn! I really appreaciate it!