I am into doing my first 3D world and I wonder what is the most common way to move around in it. Is it by rotating the environment by calling glRotate*() or is it by changing the gluLookAt() or a combination of them both?
I’d recommend you perhaps look at some tutorials like NeHe’s, and build a camera class of some sort.
If you fancy delving a little deeper I’d recommend learning about Quaternions right now and basing your rotations on those… It will require some head-scratching now, but will save a lot of head-scratching later down the line…
gluLookAt is just an utility function and is equivalent to glMultMatrixf(), glTranslate() etc.
In OpenGL the “camera” (so-called) is always fixed in the origin and the scene has to be moved accordingly.
Oh ok, so it dosn´t matter if I use gluLookAt() or glTranslate() to move around? No one is better than the other? Or is it in some cases?
In some cases moving camera is better. The quaternions help in this case as it provides you free rotation.
Ex1: 3D First Person Shooter games prefer camera motion.
Ex2: A large scene where activities are going recommend object motion.
So in this case the quaternions are to prefer. I have read on quaternions on Wikipedia and just want to check if I have unsterstood it - in this case a quaternion is the “free space” where objects are in?
Here the camera is fixed and the objects are moving through a call to glTranslate*()?
Q1. Yes. Quaternion is useful for providing free space rotation because it is a hypercomplex number and is in a way 4D vector. You can use glRotatef() but for complex rotations, the rotation matrix computation is expensive.
Ex: If you rotate around X ,then Y then Z , the total rotation matrix will be R = RzRyRx. In case of quaternion you have one vector only and changing components mean changing direction.It is compact. Wolf3D imo uses glRotatef where as Quake series use quaternions. So you can judge yourself.
Best way to understand quaternion is to take a sphere and then reach at any point using quaternion and using rotation matrix. The latter is sometimes hard to compute and get precise directions.The precise directions can be achieved through quaternion using slerp where as it is harder to achieve (sometimes) with matrix multiplication.
A2. Yes. Objects can rotate too.
A quaternion is generally associated with camera.