2011-12-21 29 views
-2

我在android中使用openGL es。我用不同的面孔淹没了6个图像的立方体。 我如何找到这些图片上的点击事件。我需要找到用户点击哪一侧或哪一个图像,并且需要根据它执行一些操作。请分享此代码...在android中的openGL ES图像点击事件

回答

0

一个解决方案是与您的模型面执行射线/四边形相交。

看看Point-triangle intersection in 3d from mouse coordinates?例如

+0

在Android中,你需要使用'GLU.gluUnProject()'和OpenGL-ES没有配备unproject标准。要获得模型视图和投影矩阵,您需要使用C:\ android-sdk \ samples \ android-7 \ ApiDemos \ src \ com \ example \ android \ apis \ graphics \ spritetext中的MatrixGrabber'' MatrixTrackingGL'和'MatrixStack' 然后使用http://developer.android.com/reference/android/opengl/GLSurfaceView.html#setGLWrapper%28android.opengl.GLSurfaceView.GLWrapper%29'myGlSurfaceView.setWrapper((new GLSurfaceView.GLWrapper(){public GL换行(GL gl){返回新的MatrixTrackingGL(gl);}});' – 2011-12-22 12:34:28