views:

71

answers:

1

Hi all, after reading stackoverflow questions on the topic, I am not able to find a solution.

I have a Rubik's cube displayed using OpenGl in a Java Eclipse application and I want to "rotate" this cube in response to mouse events.

I started with a "naive" (isn't it ?) solution as described here: http://stackoverflow.com/questions/1426415/opengl-moving-camera-with-mouse. With such solution in addition to the problem described (my problem is maybe the same ???) when I rotate 90 degrees according X-Axis to get 'upside front' i am not to rotate anymore according initial Y-Axis to get the new front on the right. Because of the first 90 degrees rotaion I will have now to rotate according to Z to get expected behavior.

Any help on the topic will be welcome ;-) May be using gluLookAt utility method is easiest than using modeling transformation in this case ?

Thanks in advance

+2  A: 

Would arcball make you happy ? (it should)

(I don't usually link to NeHe, but this one is independent from openGL)

Calvin1602
Exactly what I needed.
Manuel Selva