-
VBOs strangely slow?
I have here two short programs doing the same thing, namely drawing random points on the screen.
The first one uses VBOs; the second, OpenGL 1.1 drawArrays. There are a couple parameters to play with; the number of VBOs to use in a round-robin fashion, etc. It doesn't really matter what parameters are used, as the results are approximately the same whatever you do.
That is, that the second, VBO-less program runs roughly ten times faster than the first in all cases, except if you comment out the VBO update entirely and only initialize them at startup, in which case they're the same speed.
Now, this is hardly the ideal use for VBOs - being used only once, and all - but it still seems odd to me that the difference would be that dramatic. Thus, my question: Am I doing something obviously and horribly wrong?
-
Member
Regular Contributor
Re: VBOs strangely slow?
I recall several discussions already claiming VBOs are slow. It almost doesn't make sense because they are the only choice in pure GL3. So, unless you are not aiming at future or doing something wrong, you can expect them to work at least as fast as vertex arrays.
Anyway, did you try to play with vbo usage hint parameter?
-
Re: VBOs strangely slow?
Yes, all _DRAW permutations have been tested; they make no apparent difference. (STATIC_DRAW was no slower, even.. you'd think it would be)
I also tested bufferSubData vs. bufferData in those permutations.
-
Re: VBOs strangely slow?
Orr it could be because the lowermost program actually transfers far less data. Um. Yeah.
Though even with that fixed, VBOs are /still/ 40% slower.
-
Senior Member
OpenGL Guru
Re: VBOs strangely slow?
Why are you creating the buffer object with GL_DYNAMIC_DRAW in one case, and GL_STREAM_DRAW in another?
Also, what hardware are you running this on?
-
Re: VBOs strangely slow?
I was testing various combinations to see what, if anything, had an effect. So far nothing's produced any change at all.
Fixing the non-VBO case so the entire array is actually used, I'm looking at ~6,000ms for non-VBO, ~10,000ms for VBO (absolutely regardless of that setting), and ~8,000ms to upload it as a texture which I then proceed not to use.
My preference would be to have a way to do this via DMA. Hand the drivers a pointer which I can tell them I won't be changing until some later point (at which point I presumably need a sync call of some sort), and let the DMA engine do the memory-copy. I don't suppose that's possible?
-
Re: VBOs strangely slow?
Use GL_STATIC_DRAW and don't update your data pointer (via glBufferData or glBufferSubData)in your for loop. I would think these calls cause the geometry to be sent over to the graphics adapter every time.
-
Re: VBOs strangely slow?
That's pretty much the idea. I don't actually update the array here (because I just want to benchmark transfer speed, not random-number generation), but the target program writes new data every frame.
Well, mapping the buffer works very nicely.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules