i needed suggestions regarding implementation of First Person View. What i thought of doing is:
1)Render the entire scene.
2)Depending on the input, move the camera using gluLookAt().
(Well, i had seen an example in NeHe tutorials, which used after seeing which, i thought i can use the above mentioned approach)
But, is this approach feasible? i mean, is there a better way to do it?
Also, what strategy(or design) is usually used in Games?
Any suggestions would be really helpful.
I’m just a beginner too, so no warranty on this.
In OpenGL there isn’t such a thing like a camera. It’s a little bit hard to understand but moving the "camera " is actually moving all objects in the world.
GluLookAt() creates a matrix.
All following matrices are multiplied with this matrix and therefore rotated and translated in an appropriate way.
So 1. Push the Cameras Matrix on top of the Matrix Stack (gluLookAt()
2. Render the Objects (glVertex3f…)
3. Take the Picture ( Viewport, Projection/Orthogonal)
4. Swap Buffers (if Double Buffered) and/or Flush
Before starting with coding you should inform yourself about Szenegraphs, GameEngines and maby PhysicEngines this could save you looooots of time.
There is a good Book called “OpenGL Programming Guide” (Addison-Wesley) which can also be found on the web
Thanks for the reply yodakohl.