PDA

View Full Version : gluLookAt basic questions



CoolBeanJ
04-04-2011, 01:35 AM
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.

Alfonse Reinheart
04-04-2011, 01:56 AM
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 (http://www.arcsynthesis.org/gltut/Positioning/Tutorial%2007.html) doesn't use gluLookAt per-se, but it uses equivalent code that generates the same matrices that gluLookAt would.

CoolBeanJ
04-10-2011, 01:37 AM
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!

Alfonse Reinheart
04-10-2011, 03:18 AM
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.

BionicBytes
04-10-2011, 03:18 AM
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

CoolBeanJ
04-10-2011, 05:10 AM
^ 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!