Android OpenGL performance issue
Hi I have been using open gl to draw objects on a blank black background and the performance has been fine so far. Now when I add a rectangular texture(similar to a level background) peformance is poor. How can I improve this?
The code I use to draw the background is as follows and is implemented in 开发者_C百科the onDraw() method
gl.glPushMatrix();
gl.glEnable(GL10.GL_TEXTURE_2D);
level1.draw(gl);
gl.glPopMatrix();
The texture for this background is loaded once as it does not change or animate.
Remove the sleep(100000)
from draw()
.
You say you are using a rectangular texture. Have you made sure its dimensions are a power of 2? Depending on the implementation of OpenGL it can either work fine, work slowly or not work at all if you don't.
精彩评论