Organizational Research By

Surprising Reserch Topic

Question:Android Openg GL ES 2 drawing big textures slow


I am very new to OpenGL.

I am trying to draw textured quads (2 triangles). The size of texture is 900x900px. I have no problems with one quad but when I trying to draw 5-10 quads I see noticable slow down.

Maybe I'm doing something wrong...

Code:

public void onDrawFrame(GL10 gl) {
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
    ... matrix calculation ...
    GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mvpMatrix, 0);
    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
}

Vertex shaders:

uniform mat4 uMVPMatrix;
attribute vec4 vPosition;
attribute vec2 a_TexCoordinate;
varying vec2 v_TexCoordinate;
void main() {
  gl_Position = uMVPMatrix*vPosition;
  v_TexCoordinate = a_TexCoordinate;
}

Fragment shader:

    precision mediump float;
    uniform sampler2D u_PreviewTexture;
    varying vec2 v_TexCoordinate;

    void main() {
      vec4 color = texture2D(u_PreviewTexture, v_TexCoordinate);
      gl_FragColor = color;
    }

Testing platform is Galaxy S3. In profiler I see that about 60ms takes eglSwapBuffers call.

How can I draw quads with big textures fast?

 

asked Sep 13, 2013 in ANDROID by rajesh
edited Sep 12, 2013
0 votes
92 views



Related Hot Questions



Government Jobs Opening


...