In the attempt to get a speed increase by removing the overhead of hundreds of glcolor* and glvertex* calls, I started using vertex arrays with a single call to glDrawElements to draw a triangle strip. I repeat this 10 times a frame(reload the vertex buffer then call glDrawElements). To my surprise, this actually draws slower!!! I get the same behavior with and without hardware acceleration. Anyone know why?!?!?!
Sometimes, if a format hasn’t been optimized in a driver, the driver will effectively convert your vertex array call into internal immediate mode calls. (Yuck!)
Just re-read your post. By “format” do you mean float/double/byte/etc? Is it possible there’s a better way to specify my vertex data to allow this to be optimal?
I can help you if it’s NVIDIA HW, but if not, not much I can do. I’d need to know the specific format you are using, the HW, the driver version, and the DrawElements parameters.
Also make sure that you fill your vertex
buffers correctly, because it is uncached
memory and writes are VERY EXPENSIVE (but
works out OK if you write serially, dword
or qword size chunks at a time).
If you’re re-filling the geometry ten times
a frame, it seems your vertex buffer is too
small. Ideally, you’ll be able to allocate
enough vertex buffer space to hold your
entire geometry, load it once at scene
prepare, and then just issue indexed drawing
commands, not touching the vertex data at
all (same goes for color, normals, texcoords
etc).
what do you mean by “fill my buffers correctly”. You mean just because the time it takes to write into the buffers? Right now I’m looking only at the time to draw using vertex arrays vs. immediate mode. Not looking at the overhead of filling the buffers. Also - If I understand Matt correctly, he is correct. My vertex and color array are in system memory. I’m trying to optimize my code for software rendering(and it must be multi-platform) which is why I’m not using any extensions and also why I’m using OGL. Maybe it’s not the best way, though. What I’m working on is a 3d-type graph which has ten plots of ~2000 data points(thus 4000 verticies for drawing triangle strips for each plot)…I don’t know what the optimal size of a vertex array is, but I figure 40,000 verticies may be too large. Then again, maybe because I’m working in software this is all moot.
J
[This message has been edited by drumminj (edited 11-17-2000).]