OpenGL ES性能2.0 vs 1.1(iPad)

OpenGL ES性能2.0 vs 1.1(iPad),ipad,ios,opengl-es,Ipad,Ios,Opengl Es,在我的简单2D游戏中,当使用ES2.0实现绘图时,我的帧率下降了2倍。如果使用得当,2.0应该更快一些吗 如果您对细节感兴趣,请注意。我使用非常简单的着色器: 顶点程序: uniform vec2 u_xyscale; uniform vec2 u_st_to_uv; attribute vec2 a_vertex; attribute vec2 a_texcoord; attribute vec4 a_diffuse; varying vec4 v_diffuse

在我的简单2D游戏中,当使用ES2.0实现绘图时,我的帧率下降了2倍。如果使用得当,2.0应该更快一些吗

如果您对细节感兴趣,请注意。我使用非常简单的着色器:

顶点程序:

uniform   vec2  u_xyscale;
uniform   vec2  u_st_to_uv;

attribute vec2  a_vertex;
attribute vec2  a_texcoord; 
attribute vec4  a_diffuse;

varying   vec4  v_diffuse;
varying   vec2  v_texcoord;

void main(void)
{
    v_diffuse  = a_diffuse;

    // convert texture coordinates from ST space to UV.
    v_texcoord = a_texcoord * u_st_to_uv;

    // transform XY coordinates from screen space to clip space.
    gl_Position.xy = a_vertex * u_xyscale + vec2( -1.0, 1.0 );
    gl_Position.zw = vec2( 0.0, 1.0 );
}
片段程序:

precision mediump float;

uniform sampler2D   t_bitmap;

varying lowp vec4   v_diffuse;
varying vec2        v_texcoord;

void main(void)
{
    vec4 color = texture2D( t_bitmap, v_texcoord );

    gl_FragColor = v_diffuse * color;
}
“color”是一个mediump变量,因为您指定了默认精度。这迫使实现将lowp采样结果转换为mediump。它还要求将漫反射转换为mediump以执行乘法


您可以通过将“颜色”声明为lowp来解决此问题。

谢谢!我会检查这一点,并投票支持你的答案,如果这将工作。