I have read the API Demo code. I have come up an idea to do it like this: 1)Map the touch point to 3D coordinates, and we can get a line when touch point moved, as Line1; 2)Also we can get another line which is vertical to the screen. Signed as Line2: gluunproject(x,y,0)-->gluunproject(x,y,1); 3)Line1 and Line2 can form a plane, and we can get the plane's normal line, it is just the rotation axis; 4)With a proper angle according to the touch point's moving distant, we can rotate the object. But this idea has come up a problem. how can I know the previous state of the object? I can't use the total angle to rotate because the axis is changable. I use gl.glLoadMatrixf(mModelViewMatrix, 0) to reach the previous state and then do glRotatef, it can work when I slip my finger quickly, but it works bad when I slip slowly.
On Jul 14, 11:34 pm, Streets Of Boston <[email protected]> wrote: > Take a careful look at the API Demo code. > And then take a look at the OpenGL ES documentation > (http://www.khronos.org/opengles/) > Having the code that shows you how to rotate around the X or Y axis, > it should not be hard to figure out how to rotate along the Z axis > > On Jul 14, 11:23 am, quill <[email protected]> wrote: > > > > > In the api demo, there is an example for how to rotate a cube, but it > > can only rotate about X axis or Y axis, without Z-Axis Rotation. > > So how to perform 3D Rotation? Any advice is appreciated.- Hide quoted text > > - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

