amphetaman@[EMAIL PROTECTED]
a écrit :
> Greetings!
Hello
> I recently started learning OpenGL and I have run into
> quite a problem. I really have no idea how to implement a simple
> camera using OpenGL's transformation functions. What particularly
> bothers me is the order in which transformations must be applied.
>
> Suppose the camera is located at (x, y, z) and its rotation is -45
> degrees (from the default orientation, that is, looking towards (0, 0,
> -1)).
If I don't mistake, if you want to look at (0,0,-1) the rotation is 0
degrees from the default orientation. The 45-degrees rotation show you
the point (-1,0,-1).
>
> If I translate first, by calling glTranslate(-x, -y, -z), the rotation
> will have that point as its origin. I don't need that.
>
> If I rotate first, I will have to somehow calculate the translation
> vector (because forward, for example, won't be (0, 0, -1) anymore).
If you start with OpenGL, try to learn as much as you can at
http://nehe.gamedev.net/.
For the particular case of transformation order, have a look at lesson
10, where it deals with "Displaying Worlds":
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=10.
Hope it helps
David


|