PDA

View Full Version : Keeping track of vecor that is parallel to screen horizontal and vertical??



delic
10-27-2002, 06:25 PM
I want to move the mouse horizontally and rotate my model about the model matrix vector that is parallel to the screen view..

I think I need to keep track of the up vector throughout my rotations. I am havin trouble with this though. Does anyone one know if this is the way to do this, or can help??

I can actually get it to work if I do only one rotation say just about the x or just the y by using these vectors:
upvect[0]=0.;
upvect[1]=cos(yrot*3.14159/180.);
upvect[2]=sin(yrot*3.14159/180.);

rgtvect[0]=cos(xrot*3.14159/180.);
rgtvect[1]=0.0;
rgtvect[2]=-sin(xrot*3.14159/180.);

but if i try to mix x and y rotation things get all mixed up.



[This message has been edited by delic (edited 10-27-2002).]

zed
10-28-2002, 11:56 AM
modelview matrix data 2,6,10 is the view direction (or the inverse)

delic
10-29-2002, 05:48 AM
at first i didnt know what you meant.. then i figured out that you can:
GLfloat curmatrix[4][4];
glGetFloatv(GL_MODELVIEW_MATRIX,&curmatrix[0][0]);

Damn, as u can see im a newbie.


[This message has been edited by delic (edited 10-29-2002).]

delic
10-29-2002, 06:29 AM
at first i didnt know what you meant.. then i figured out that you can:
GLfloat curmatrix[4][4];
glGetFloatv(GL_MODELVIEW_MATRIX,&curmatrix[0][0]);