Rotate the cube by touching it

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.

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.