I wrote a game in which, when onDrawFrame () is called, I first update the state of the game (game logic and drawing buffers), and then continue to make actual drawings. On Moto G and Nexus 7, everything works smoothly, and each call to onDrawFrame () takes only 1-5 ms. However, in the Samsung Galaxy S3, 90% of the onDrawFrame () call time takes 30-50 ms to update.
Further investigation of the problem, I found that the problem lies entirely with the first rendering method, which I apply below: (Edit: now the block is on glclear (), removing unnecessary calls to get descriptors, see Comments)
public void render(float[] m, FloatBuffer vertex, FloatBuffer texture, ShortBuffer indices, int TextureNumber) {
GLES20.glVertexAttribPointer(mPositionHandle, 3, GLES20.GL_FLOAT, false, 0, vertex);
GLES20.glEnableVertexAttribArray(mPositionHandle);
GLES20.glVertexAttribPointer(mTexCoordLoc, 2, GLES20.GL_FLOAT, false, 0, texture);
GLES20.glEnableVertexAttribArray(mTexCoordLoc);
GLES20.glUniformMatrix4fv(mtrxhandle, 1, false, m, 0);
int mSamplerLoc = GLES20.glGetUniformLocation(fhGraphicTools.sp_Image, "s_texture");
GLES20.glUniform1i(mSamplerLoc, TextureNumber);
GLES20.glDrawElements(GLES20.GL_TRIANGLES, indices.capacity(), GLES20.GL_UNSIGNED_SHORT, indices);
GLES20.glDisableVertexAttribArray(mPositionHandle);
GLES20.glDisableVertexAttribArray(mTexCoordLoc);
}
5 onDrawFrame() . ( 4 - , 1 ). , , , , S3, :
int mPositionHandle = GLES20.glGetAttribLocation(fhGraphicTools.sp_Image, "vPosition");
GLES20.glDrawElements(GLES20.GL_TRIANGLES, indices.capacity(), GLES20.GL_UNSIGNED_SHORT, indices);
render(), 1-2 . render(), , 1-2 , .
- , , S3 ? , S3 , GL onDrawFrame(), . , ?
.
Selvin.