What can’t you do, once you lock an array? I know you can’t change the contence of the array, but are there any openGL commands you can’t use?
The extension is actually somewhat murky WRT this subject. I’ve heard Matt complain about that before
I believe almost anything is allowed, but that certain commands (especially those that change the modelview or projection matrices) will negate any benefit of the lock, because it’ll force the driver to flush its post-transform state.
The way most people use it, and the thing that drivers seem to optimize for, is multi-pass rendering over the same geometry to compensate for a lack of texture units (i e you may need 4 texture passes, but there’s only 2 units). Thus, I believe changing the texture pointer and/or the texture matrix would still keep you on the optimized path (although of course the driver will have to re-transform the texture coordinates if you change the matrix).
For HT&L cards, the benefits of locking are less, but better than nothing. VAR/AGP/fence is much better, though.
So, in other words, I should lock only what I will render right away (because I have to do transformations between groups of vertex data)?
Also, should one use glDrawElements and/or glDrawArrays, when using compiled vertex arrays?
Yes, the extension is extremely vague. I don’t like the CVA extension at all.
If DrawArrays works on your data, you should use that, as dealing with indexes involves extra overhead. However, if using indexes means you send fewer vertices to the driver (i e there is vertex re-use) then you should use DrawElements – the overhead of processing the indexes is less than the overhead of tranforming vertexes more than once for “typical” meshes.
Locking a vertex array does only seem useful for the local case (i e around a grouped set of redering calls for the same geometry). If you need to change the modelview or projection matrices, you shouldn’t keep the arrays locked.
An interesting experiment is to run GLTrace on something using the Quake3 engine (like Quake3, or Alice) – looking at that output, it’s pretty clear how LockArrays should be used
GLTrace? How do I do that?
Originally posted by mcraighead:
[b]Yes, the extension is extremely vague. I don’t like the CVA extension at all.
If CVA is not a good extension, what kind of drawing method should be used if I have a GeForce2 and I want to use vertex programs?
If I’m remembering well in a doc you said that VAR extension should not be used with GF2 and vertex programs (because of the software vertex transforming).
If you’re using vertex programs, CVA won’t help. You’ll have to live with whatever performance you get. It’s not in HW, so don’t expect anything special.