【问题标题】:Official Google OpenGL ES 2.0 demo blank on Note II, but not Nexus 7?Note II 上的官方 Google OpenGL ES 2.0 演示空白,但不是 Nexus 7?
【发布时间】:2014-01-22 17:17:11
【问题描述】:

注二(4.1.2):http://i.imgur.com/orfAxBW.png

Nexus 7 (4.3):http://i.imgur.com/CZhQ59o.png

使用的代码:http://developer.android.com/training/graphics/opengl/index.html

据我所知,手机和Android版本都应该支持OpenGL 2.0。

此外,我尝试在开发面板中切换各种 GPU 设置后运行该应用程序,但它们没有任何区别,因此我将其恢复为默认值。如果有人想知道,正方形或三角形没有显示“布局边界”。

我还尝试切换背景颜色以查看它是否只是在另一个之上绘制,但这没有任何作用。

【问题讨论】:

  • 在我的情况下,使用 opengl es 2.0 没有任何问题,现在我的应用程序仍在服务中,没有任何抱怨。所有这些都使用带有opengl es 2.0的NDK c++。然而,由于所有平台都有不同的规格,有时我不得不为某些设备的工件更改我的着色器代码。在您的情况下,这不是 opengl 支持问题它可能只是设置问题。因此,只需查看上下文或清单文件
  • 这个例子有很多错误,见讨论stackoverflow.com/questions/11925647/…

标签: android opengl-es opengl-es-2.0


【解决方案1】:

我最终在我的 Nexus7 上继续开发,当我更进一步时,我将它闪到我的 Note II 上,它又可以工作了!如果你愿意,你可以在这里玩我的代码:stable commitcode for that commit.

将此设置为社区 wiki,因此如果有人追踪到原始问题,请随时在此处添加。

Reddit /r/gamedev thread

【讨论】:

    【解决方案2】:

    一般来说,调试它的方法是使用 glGetError()。这是我使用的方法,它帮助我调试了 OpenGL。它检查是否发生了任何错误,并引发异常以便您进行调试。您可以将其复制粘贴到某处,然后在两次绘制调用之间调用它以找出导致问题的原因。

    注意:you can also 检查 Eclipse 是否在调试模式下编译了应用程序:

    /** This method will check for any OpenGL errors that have occurred since the last time you called it.
     * If it finds one, it will cause the program to crash immediately and output a stacktrace.
     * To debug OpenGL, call this in between your OpenGL functions to zero in on where the error is.
     * @param operationDescription Note to yourself about what you were doing, to be printed if there's an error
     */
    static final void checkGlError(String operationDescription){
    
        if(Main.DEBUGGING){//only do the program-crashing thing in debug mode. In release mode, try to ride through errors. Replace my boolean with yours.
            int errorCode;
            while ((errorCode = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
                String error;
                switch(errorCode) {
                    case GLES20.GL_INVALID_OPERATION:      error="INVALID_OPERATION";      break;
                    case GLES20.GL_INVALID_ENUM:           error="INVALID_ENUM";           break;
                    case GLES20.GL_INVALID_VALUE:          error="INVALID_VALUE";          break;
                    case GLES20.GL_OUT_OF_MEMORY:          error="OUT_OF_MEMORY";          break;
                    case GLES20.GL_INVALID_FRAMEBUFFER_OPERATION:  error="INVALID_FRAMEBUFFER_OPERATION";  break;
                    default: error="Unknown error code";
                }
                Log.e("checkGlError", operationDescription + ": glError " + error);
                throw new RuntimeException(operationDescription + ": glError " + error);
            }
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-06-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多