How to rotate without glRotate() ?

Started by
26 comments, last by ChacaL 21 years, 11 months ago
What do you mean?

Is it not what I just did?

By hand? Do you mean with a peice of paper and your head?

[edited by - __ALex_J_ on May 8, 2002 4:42:33 PM]
Advertisement
you need to create a rotation matrix. and multiply the vector through the rotation matrix. if you want to know how OpenGL does it....


go here.... OpenGL Programmer''s Guide click on the Appendix F
Homogeneous Coordinates and Transformation Matrices
chapter and go down to glRotate .....


if you need to know how to multiply a vector through a matrix, search the web or gamedev....


To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
The following transformation rotates the point (x, y, z) around the x-axis, producing a new point (x'', y'', z'').

[x''y''z''1] = [x y z 1] * 1 0 0 0
0 cos(a) sin(a) 0
0 -sin(a) cos(a) 0
0 0 0 1

In this example matrix, the letter a stands for the angle of rotation, in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.

sorry in that last reply but I couldnt get the 4*4 matrix to appear correctly
quote:Original post by Anonymous Poster
sorry in that last reply but I couldnt get the 4*4 matrix to appear correctly


[code] and [/code] help to preserve spacing.
quote:Original post by jenova
you need to create a rotation matrix. and multiply the vector through the rotation matrix. if you want to know how OpenGL does it....


Couldn''t the techniques I used in the small program (I sent to this thread) be useful as well?

If you are applying a lot of transformations to your scene using OpenGL functions, it may be easier to get the exact result this way.

Or maybe not?
you can do it that way.... i was only providing a link to allow the original poster to understand the math behind glRotate .... most OpenGL (x86) implemetations will either use specialized vector units or SSE (if available) to speed things up.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
Alex_J,

I''m trying to use your code, but I''m getting LINK errors on the glut.h libraries, even installing the GLUT files.

Tried to use the ''vertex_trans'' function at my program but the vertices are rotating in a strange way.

I sent you a e-mail explaing better the situation.

If you could read the mail and answer me I''ll thank you a lot!

See you!

This topic is closed to new replies.

Advertisement