Opengl-es very slow for 2d image rendering

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
[ghost]
Posts: 14
Joined: Sat Apr 16, 2011 8:00 pm

Opengl-es very slow for 2d image rendering

Post by [ghost] »

Hi,

we need somebody with a very good 3D knowledge to optimize the opengles 2D image rendering, I have a 2D sprite animation engine using draw2dImage to render frames and seems that the FPS drops drastically (under 10fps) when rendering over 40 modules(40 drawImage calls:) ) on screen.
[ghost]
Posts: 14
Joined: Sat Apr 16, 2011 8:00 pm

Post by [ghost] »

After reading this post http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=43891 I realize that I should cache all vertices and and use drawPrimitives ... method, but still think that it will be much easier if this could be done at opengl-es driver level for 2d rendering and have a flush2D method or something like that to actually render all cached vertices.
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Not sure if this really helps - I guess you are using different textures in each render call. And in that case you cannot merge those draw calls. If you have just one texture (e.g. for sprites) you can use the batched draw2dimage calls. Just create indices for the sprites to use and send an array of those indices to draw2dimageBatch
[ghost]
Posts: 14
Joined: Sat Apr 16, 2011 8:00 pm

Post by [ghost] »

I don't use different texture for each draw call,many draw calls share same texture ,I just tested to see how spritebank works, but there is no improvement if I use draw2DImageBatch() because it use NullDriver::draw2DImageBatch() that don't do nothing than looping between modules(rectangles) and render each rectangle using draw2DImage that result in same number of drawPrimitive calls as I done in my code without using draw2DImageBatch. This method(draw2DImageBatch) should be optimized to reduce number of calls to setRenderStates2DMode and drawPrimitives() and merge vertices of rectangles that use same texture before calling drawPrimitive.
Last edited by [ghost] on Sun May 22, 2011 8:34 pm, edited 1 time in total.
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Oh yeah, yet another thing you should copy over from COpenGLDriver
Ok, also patched this one. Already worked for ogl-es 2 driver, now also in ogl.es 1.x driver.
Post Reply