【问题标题】:openGL ES image click event in androidandroid中的openGL ES图像点击事件
【发布时间】:2011-12-21 13:25:02
【问题描述】:

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

【问题讨论】:

    标签: android android-layout opengl-es android-widget


    【解决方案1】:

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

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

    【讨论】:

    • 在android中你需要使用GLU.gluUnProject(),因为openGL-es没有unproject作为标准。要获取模型视图和投影矩阵,您需要使用来自 C:\android-sdk\samples\android-7\ApiDemos\src\com\example\android\apis\graphics\spritetext 的 MatrixGrabber MatrixTrackingGLMatrixStack然后使用developer.android.com/reference/android/opengl/…myGlSurfaceView.setWrapper((new GLSurfaceView.GLWrapper() { public GL wrap(GL gl) { return new MatrixTrackingGL(gl); }});
    猜你喜欢
    • 1970-01-01
    • 2016-06-07
    • 2016-10-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-19
    • 2011-06-02
    • 1970-01-01
    相关资源
    最近更新 更多