PDA

View Full Version : glrotate



tpthyd
02-08-2009, 09:40 PM
hi,
i am new to opengl. i rendered some basic primitives( triangles, polygons etc..).
i use glortho(), glviewport(), and glmatrix(0 etc..

now i would like to rotate along x, and y-axis. i knew one fun glrotate(). but how to use this for my program . can anyone help me please.

appleGuy
02-11-2009, 04:12 AM
hi,
i am new to opengl. i rendered some basic primitives( triangles, polygons etc..).
i use glortho(), glviewport(), and glmatrix(0 etc..

now i would like to rotate along x, and y-axis. i knew one fun glrotate(). but how to use this for my program . can anyone help me please.

In your draw code simply do something like this:

load modelview matrix
load identity matrix
do all your rotation stuff:
you need to rotate around each axis through separate calls
rotate around y example: glRotatef(45.0f, 0, 1, 0); // where arg 1 is in degrees and the other represent the axis: x, y and z respectively..

draw your stuff .. etc etc