Rotate view with mouse

Hi all,

I have currently made a basic OpenGL 3D cube in a scene. I now want to rotate this cube by mouse dragging it? How can I do this. “glRotate” doesn’t seem to work very correct… :confused:

Greets,

Ralf

It probably won’t if you’re only trying to do it with one line of code. Have you tried it like:

// rotate around the x axis
glRotatef(rot_x,1.0f,0.0f,0.0f);
// rotate around the y axis
glRotatef(rot_y,0.0f,1.0f,0.0f);
// rotate around the z axis
glRotatef(rot_z,0.0f,0.0f,1.0f);

Where rot_x, rot_y, rot_z are floats indicating how much you want to rotate around each axis?

If this doesn’t work, you’ll need to post your code to show us what’s going wrong.

Daz.