Repeated data in vbo

I’m just curios what to do if I have a array of colors, lets say float c[3][30]={1} & I must get according vertices to vbo. Do I need to call glColor3f(1,1,1); before drawelements once or waste memory fo this array c?

That is an interesting question. It all depends on how well the implementation aliases immediate-mode state commands with VBO’s. It is entirely possible that the driver would be forced to play certain tricks to pass this information along (like creating a VBO in the background, copy the data to it, and using it that way). This would, almost certainly, be slower than just having the color be part of the VBO data.

Unless one of the driver developers comes along, you’ll just have to benchmark it.

Originally posted by M/\dm/
:
I’m just curios what to do if I have a array of colors, lets say float c[3][30]={1} & I must get according vertices to vbo. Do I need to call glColor3f(1,1,1); before drawelements once or waste memory fo this array c?

Surely enough once.
Think a bit: this is same as you would have only one normal.
If you don’t give any normal vector the card use the last (if needed for lighting for example) and ofcourse there is no performance lost…
So simply call glColor.

and ofcourse there is no performance lost

Assuming your card works like OpenGL does. IE, has some constant registers for vertex attribute state. However, it’s entirely possible that the card only accepts data via vertex arrays, and the driver implements this behind the scenes. It certainly saves on silicon, and virtually all hardware makers stress using vertex arrays over immediate mode as a means of achieving performance.

You don’t need to create a “dummy” array on any NVIDIA hardware. Just use immediate mode to change parameters that do not vary inside begin/end (or array-drawing calls).

Thanks -
Cass

OpenGL is a state machine. If you set a state (in this case the color using glColor3f(1,1,1)) it should be valid until you change it with this or another command that changes this state (primary color). i.e. You don’t need to create the color array.

Hope this helps.

Thanks, I’m glad that the way I have implemented is right one. But VBO’s are real dissapointment for static, simply shaded data, even for 2x AGP there is NO!!! performance gain. Or maybe FX5200 on GF2 core isn’t doing the best?

Originally posted by M/\dm/
:
Thanks, I’m glad that the way I have implemented is right one. But VBO’s are real dissapointment for static, simply shaded data, even for 2x AGP there is NO!!! performance gain. Or maybe FX5200 on GF2 core isn’t doing the best?

I’m sorry but I’ve done different testing with VBO with static and dynamic geometry in GFFX, GF4Ti and GF4MX (i.e. GF2) and the results are very similar of the ones using NV_VAR (which I tested on all the GeForce range). And the speedup is significant. Currently, I haven’t checked in an AGP2x machine but I checked it sometimes when it was using VAR.
The only problem I remember (three years ago) was with some machines (Dell in this case) where I can’t allocate AGP memory (with NV_VAR). It was because a bad AGP configuration.
Test your code. I think there are some examples in the web. In the extension spec there are also a few examples (the only thing I don’t like in the spec is that they don’t use glGenBuffersARB to get the buffer’s name so it can generate confusion).
Check for OpenGL errors.
Be sure you are drawing a good number of polygons per call (at least 100) to see the speedup. (To test, try with models that you can draw 30000 polys (i.e) per call and draw the same model in different places in the same scene.
Hope this helps.

[This message has been edited by Cab (edited 06-17-2003).]

Well, actually there is 1 fps gain in comparison to vertex arrays ‘compiled’ in display list, and when & only when custom vertex program is on (in current situation ligting override). Model polly count isn’t that small either. Maybe
glBindBuffer(GL_A_B, vb);
glBindBuffer(GL_E_A_B, ind);
draw stuff;
glBindBuffer(GL_A_B, 0);
glBindBuffer(GL_E_A_B, 0);
approach isn’t the best, but I have to bind unbind my buffer as I have classic va’s out there, and anyway it’s not NV’s heavyweight binding (I’m creating buffers in init f/n or when switching res).
BTW, what’s about size of VBO’s, is it better to have one huge VBO (and what’s the limit) with 10 models inside or smaler vbos => vertex cache thingy?

I’m waiting for the PBO

[This message has been edited by M/\dm/
(edited 06-19-2003).]