Jump to content

  • Log In with Google      Sign In   
  • Create Account

Camera Rotation Whitout Matrix


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 uncutno   Members   -  Reputation: 146

Like
Likes
Like

Posted 26 June 2001 - 01:55 PM

Ok, here is my problem! Ive got a ViweDirection Vector! Ive got a UpDirection Vector, Ive even got a RightDirection Vector! These three makes a perfect matrix for rotation! My question is, how do i make OpenGL use these vectors, so that the "camera" points that way? I found a hard way, with filling up a float m[15], and then use something like glMultMatrix(m), but there must be a easy way? -Anders-Oredsson-Norway-

Sponsor:

#2 mittens   Moderators   -  Reputation: 1315

Like
Likes
Like

Posted 26 June 2001 - 02:40 PM

I would *STRONGLY* recommend that you don''t use your own matrices for rotations and such (even the Red Book says its not recommended). The gl commands for translation/rotation/scaling/etc are *FAR* faster than yours can ever be (unless of course you figure out a way to do in hardware). And if you want to look at a specific point, use gluLookAt(...).

------------------------------
Trent (ShiningKnight)
E-mail me
OpenGL Game Programming Tutorials

#3 SirKnight   Members   -  Reputation: 316

Like
Likes
Like

Posted 26 June 2001 - 03:02 PM

Well if you have a geforce 3 then its easy to do it in hardware. Just use vertex programs.

But yes, since you have those three vectors, gluLookAt is just what you need. That function wants those exact vectors you already have!

-SirKnight

#4 Obelix   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 June 2001 - 11:40 PM

use gluLookAt. From the MSDN documentation:

gluLookAt
The gluLookAt function defines a viewing transformation.

void gluLookAt(
GLdouble eyex,
GLdouble eyey,
GLdouble eyez,
GLdouble centerx,
GLdouble centery,
GLdouble centerz,
GLdouble upx,
GLdouble upy,
GLdouble upz
);
Parameters
eyex, eyey, eyez
The position of the eye point.
centerx, centery, centerz
The position of the reference point.
upx, upy, upz
The direction of the up vector.
Remarks
The gluLookAt function creates a viewing matrix derived from an eye point, a reference point indicating the center of the scene, and an up vector. The matrix maps the reference point to the negative z-axis and the eye point to the origin, so that when you use a typical projection matrix, the center of the scene maps to the center of the viewport. Similarly, the direction described by the up vector projected onto the viewing plane is mapped to the positive y-axis so that it points upward in the viewport. The up vector must not be parallel to the line of sight from the eye to the reference point.

The matrix generated by gluLookAt postmultiplies the current matrix.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS