2011-12-21 25 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