小编Bru*_*nes的帖子

无法实现60fps渲染简单的四核,Android,Opengl ES 2.0

我正在开发一款简单的乒乓球游戏来掌握opengl和android,并且在性能方面似乎已经打了一堵砖墙.

我的游戏逻辑在一个单独的线程上,draw命令通过阻塞队列发送到gl线程.问题是我被困在40fps左右,我尝试过的任何东西似乎都没有提高帧速率.

为了简单起见,我设置了opengl:

GLES20.glDisable(GLES20.GL_CULL_FACE);
GLES20.glDisable(GLES20.GL_DEPTH_TEST);
GLES20.glDisable(GLES20.GL_BLEND);
Run Code Online (Sandbox Code Playgroud)

设置opengl程序和绘图由以下类处理:

class GLRectangle {
private final String vertexShaderCode =
        "precision lowp float;" +
        // This matrix member variable provides a hook to manipulate
        // the coordinates of the objects that use this vertex shader
        "uniform lowp mat4 uMVPMatrix;" +

        "attribute lowp vec4 vPosition;" +
        "void main() {" +
        // the matrix must be included as a modifier of gl_Position
        "  gl_Position = vPosition * uMVPMatrix;" +
        "}";

private final String fragmentShaderCode =
        "precision lowp …
Run Code Online (Sandbox Code Playgroud)

optimization android opengl-es-2.0

6
推荐指数
1
解决办法
1858
查看次数

标签 统计

android ×1

opengl-es-2.0 ×1

optimization ×1