Skip to main content
gamedev.net
🔒 Locked

openGL coordinates

Started by safiire Oct 23, 2000 at 7:20 AM 0 replies 200+ views
Original Post
safiire
safiire
Quick question that would help me out a lot: If I were to tranlsate the amount (x,y,z) glTranslatef(x, y, z); // then rotate a certain amount glRotatef(xRotate, 1, 0, 0); glRotatef(yRotate, 0, 1, 0); glRotatef(zRotate, 0, 0, 1); // then translate backwards the same amount as previous glTranslatef(-x, -y, -z); This is for rotating an object around a pivot point that is at (x, y, z) by xRotate on the x axis, yRotate on the y Axis, and zRotate on the z axis. This works fine, but I lose track of what the objects coordinates are after doing these operations on it. How can i get the coordinates i am at directly after this code? Without using the law of cosines please, that will work but I really don''t want to use that. Can I somehow get these coordinates out of the matrix that ive done these translations/rotations on? I know that openGL has done the math for me, which is one reason why I don''t just use the law of cosines.
zedzeek
zedzeek
have a search opn the net about eular angles to see why this is a no no
glRotatef(xRotate, 1, 0, 0);
glRotatef(yRotate, 0, 1, 0);
glRotatef(zRotate, 0, 0, 1);

youre better off using a matrix and to find out the new position just have a look in your matrix

http://members.xoom.com/myBollux

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.