Little help, Rotation

Hi all, I’m new to openGL, but I have programmed in DirectX for a while now. I am making a “hello world” type or program, which basically consists of a texture mapped sphere that is rotating on its Y-axis (up). In DirectX we had a function SetRotation, which sets the object rotation and you don’t have to worry about it anymore the object will rotate without any Rotation call in the main rendering loop. Is there anything like that in openGL ? if not, can you recommend the best way to do it?

any help is appreciated, thanks

Unlike Direct3D’s Retained Mode, OpenGL operates at a lower level, like Direct3D’s Immediate Mode. So nothing like SetRotation is available. But it is not hard to do the equivalent. Just keep track of the current angle of rotation and rotate the sphere with the glRotate command.

[This message has been edited by DFrey (edited 11-06-2000).]

There is no automatic way to rotate an object indefinately. However if you create a function to increment the angle of rotation say something like:

void keepGoing(void)
rotationalValue += 0.5;

and in your program you call this function using the:


The object in question will keep rotating providing you have also modified your display to output the rotation.

ie. void display(void)
glRotatef(rotationalValue, x,y,z);

Hope that helps!


thanks guys this does help.