best practice to get maximum perfs when drawing images

Hi,

I am conducting a few benchmarks to maximize the perfs while drawing a huge number of images in 2D fashion (just like Java2D would)

I am doing so by drawing textured quads in a loop. The unique texture (might be more in the future) is set up at the first frame, and just bound afterwards.Bu t I am a bit disappointed by the speed which is actually slower than it is when doing that with Java2D.

What are the best practices to do that ? Is a 100000 loop of quads a wrong way to do that ?

Thanks for any advice

Hi,

You should give a try to vertex arrays, or even better VBOs. Another way to look at are point sprites.
I made some benchmarks and if I remember correctly VBOs are the fastest way, closely folllowed by point sprites.(but it might depend on your graphic card).
But the loop for quad will always be the slowest.

Thanks for your advice.
I guesse you are talking about a vertex array containing points for all quads. In this case, is it possible to assign different textures to different quads ?

Well one thing that might be useful is to use an array for vertex coordinates in order to use only one texture (so only one bind, so better perfs).
You have to use an array (Buffer) to specify the texture coordinates relating to the part of the big texture you want to display.
For the vertex arrays you will not have one point per quad but 4, as a standard quad. You will have only one point (center of the textured quad) if you use point sprites.

I don’t have code right here, but can find you some part if you want.

Yes, that would be great … Nice of you thanks

I understand the big texture part. But say I have 10 different textures of 1024x1024… I guess one big texture is not gonna fit in memory, or is it ?

Well I was thinking that you will render a ot of small images.
So you can drop the point sprite part. And you will have to forget about only a big texture…
I think that you will have to sort you quads by texture rendered on them and create 10 vertex arrays (or VBOs) ie 1 per texture.
This will limit the number of binds and should speed up the things a little bit.

By the way, it seems strange to render such a big amount of big textures…

I know it might seem a bit unusual…
But this was to replace the java2D path for an application drawing images. And I might have many images as large as 1024x1024 to draw, possibly in much smaller areas. But I admit that in this case, I should probably use mipmaps or, in any way, use reduced size texture according to my real needs on screen.

Anyway, these tests were more of an experiment

Thanks anyway