简体   繁体   中英

Too many glDrawElements cause for low fps? OpenGL ES1.1 ( iPhone )

I am developing a 2D Tile based game and currently struggling with performance issue as I am getting around 10 - 15 FPS even when running on iPad 3. OpenGL ES Frame capture reveals that I am making call to glDrawElements 689 times per frame! Is that a lot? Could it be the case of low performance?

Should I stack everything in one huge array and perform 1 draw call? will it make any difference?

At this point in time, you are currently limited by your command issue(assuming), if you run opengl performance detective ( it's under xcode (right click, open developer tools) you may have to download it through preferences ).

Your goal is to be limited by fill rate at the end of the day, here are some tips to help you get there

Sort all sprites by Draw Depth Blend Mode Texture ID

Once sorted, Pack all sprites into one vertex buffer object and an index buffer object.

When ever your draw depth, blend mode, or texture ID change, it's time to make a new draw call and bind those resources.

Also keep in mind that your sprites should have your vertices flatted on the cpu side (pos x mvp ) and you should not be sending over matrices and any other attributes such as color, should be part of the vertex.

Typical vertex

{
    float pos[3]
    int color
    float uv[2]
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM