PDA

View Full Version : problem rotating objects



asma7
12-27-2008, 03:56 AM
hi all,

I want to scarmble a rubik's cube using opengl in c++, I have successfuly drawn the rubik's cube but I have problem scrambling it by rotating its different faces, my question is: isn't there any way to rotate already existing objects without having to redraw them? also how can I have to show the steps of solving the rubik's cube by reversing the steps of the scrambling, how can I show the steps of the solution using animation? that is: how can I show the rotation of the object..

best regards

ZbuffeR
12-27-2008, 04:21 AM
isn't there any way to rotate already existing objects without having to redraw them
No, because opengl is a drawing api : if you want anything to move/change, you have to send draw commands for each step.

For example to rotate the cube 90°, do it each step after step with smmal angle increments. Even better, take in account the time elapsed at each frame, and rotate 90/totalrotationtime*lastframetime.