I'm getting my hands dirty in OpenGL and something is bothering me a bit.
It's my understanding from reading about the subject that a call to gluLookAt basically multiplies a matrix on the stack that moves the world in a way such as to "emulate" a camera. After my reading, I came under the impression that calling:
glTranslatef(0.0f, 0.0f, -10.0f);
then perform some drawing was equivalent to calling:
gluLookAt(0.0f, 0.0f, 10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f);
However it is not and I'm at a loss as to where the flaw is in my reasoning. I also tried manually computing a matrix from a position, a direction vector and an up vector but failed to find texts describing this process.
Can anyone shed some light on this? I'd much rather like to understand the underlying matrix creation process to create a transformation matrix that corresponds to an inverse camera transform, but just getting gluLookAt to behave the way I want would be great as well. Thank you.
EDIT: Turns out my mistake was that I mistakenly set the up vector to [0, 0, 1] instead of [0, 1, 0]. I'm checking the answer below to see if it's giving me satisfying results regarding matrix creation.