PDA

View Full Version : Rotate the cube by touching it



HoaiNguyen
05-25-2009, 03:16 AM
Hi everyone, I'm a beginer of OpenGL, and now I'm learning OpenGL on Android.
I have made a simple application for pratising OpenGL. That's a 3D-Cube allowed user to rotate it belong to 3 axis when touching on the cube object.
But I have a proplem here. When I touch the screen, I dont know this point is or isnot belong to the cube object.
I have tried to re-calculate the coordinate of the cube or the position of the center point of the cube, but it didn't work, because after rotated, everthing changes.
I'm stuck on it and I have no idea about solution. So, can anyone help me? Thanks alot.

todayman
06-06-2009, 06:57 AM
Take a look at gluUnProject(). That should help you transform window coordinates to coordinates in your world space, which you can compare to the cube.