What is better? (More efficient)

Started by Cornix, July 13, 2013, 07:33:30

Previous topic - Next topic

Cornix

Hi, I am still quite new to openGL and all that, and I am curious which of these solutions is the better one:

Problem: I need to draw the same image 100 times on screen but each at a different location.

Solution A: I create 100 vbo's and the vertex data has the position hardcoded within.

Solution B: I have only 1 vbo and multiply a translation matrix 100 times to "move" it around on the screen.

Its obvious, that the second solution needs far less memory, but more processing power. The question is, whether the memory I save is worth the extra work for the GPU or not.

Thank you all for the help.

ic5y

Obviously the second one, especially with shaders. On the other hand, with 100 vbo, the continous switching between them is slower than translating the matrix.

Cornix

Okay, thanks. I wasnt quite sure how efficient the matrix multiplications would be. I know its pretty damn efficient, but maybe having more VBO's would be even faster. After all, it isnt that much memory which those VBO's take mostly, and many graphics cards have gigabytes of memory today.

quew8

Technically the fastest option would be to have ONE vbo storing all 100 images and draw them all with one call. No switching bindings, absolute minimum glDraw calls.

However I agree with @ic5y, no self respecting dev would go with anything but option 2 without a dam good reason.

Really the only reason I'm posting this is that it annoys me that people seem to determined to use a different vbo for every single thing they need to draw and this is probably the biggest performance loss in their entire application.

Cornix