Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


3D rotation


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
5 replies to this topic

#1 INVERSED   Members   -  Reputation: 172

Like
Likes
Like

Posted 01 September 1999 - 10:16 PM

I've been working on a 3D modeler, and I was wondering how to do rotations without having the object move all over the screen, i.e., How to rotate around locale coords instead of world. I'm using OpenGL. I'd perfer to just be pointed in the direction of a site with an article on the subject. thanx all for the help.

Sponsor:

#2 Sengir   Members   -  Reputation: 122

Like
Likes
Like

Posted 31 August 1999 - 10:03 PM

rotate the object in objectspace and _then_ transform it to worldspace.


#3 INVERSED   Members   -  Reputation: 172

Like
Likes
Like

Posted 01 September 1999 - 06:38 AM

I'm not quite sure how to do that though. How do you make your rotations in object space?

#4 Sengir   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 September 1999 - 06:48 AM

each of your objects should have its own origin. so if you rotate the object, it rotates around its origin, not around the world origin. after rotation you translate the objects into worldspace, which means you move them to the right coordinates.
you can perform all this in one transformation step through matrices, and you _must_ du that with openGL.

Sengir


#5 INVERSED   Members   -  Reputation: 172

Like
Likes
Like

Posted 01 September 1999 - 07:53 AM

Let me see if I have this right then. First I rotate my objects normally with matrices as such

mx[0] = 1;mx[4] = 0;mx[8] = 0;mx[12] = 0;
mx[1]=0;mx[5]=cos(x);mx[9] = sin(x);mx[13]=0;
mx[2]=0;mx[6]=-sin(x);mx[10]=cos(x);mx[14]=0;
mx[3]=0;mx[7]=0;mx[11]=0;mx[15] = 1;
glMultMatrixd(mx);

mx[0]=cos(y);mx[4]=0;mx[8]=-sin(y);mx[12]=0;
mx[1]=0;mx[5]=1;mx[9]=0;mx[13]=0;
mx[2]=sin(y);mx[6]=0;mx[10]=cos(y);mx[14]=0;
mx[3]=0;mx[7]=0;mx[11]=0;mx[15]=1;
glMultMatrixd(mx);

mx[0]=cos(z);mx[4]=sin(z);mx[8]=0;mx[12]=0;
mx[1]=-sin(z);mx[5]=cos(z);mx[9]=0;mx[13]=0;
mx[2]=0;mx[6]=0;mx[10]=1;mx[14]=0;
mx[3]=0;mx[7]=0;mx[11]=0;mx[15]=1;
glMultMatrixd(mx);

and then just call glTranslated to move it to where I want it to be. Or do I have to do they rotations with out calling glMultMatrix, and multiply the vertices by the rotation matrix by hand? If no, I guess my next question, is how do I know how much the object needs to be translated by.
thanx for all the help, I'm a little new to 3d (can u tell)


#6 INVERSED   Members   -  Reputation: 172

Like
Likes
Like

Posted 01 September 1999 - 10:16 PM

never mind, I figured out what i needed to do, thanx to for the help though.




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