Bad performance glDrawElement on Radeon 9700??

I am working on an octree implementation. When rendering nodes I use glDrawElement. Everything worked perfectly on my old Nvidia GF4 MX. Yet I recently bought a ATi Radeon 9700, and now I have a strange performance bottleneck. Whenever I use:

glDrawElements(GL_TRIANGLES, 3*nFaces, GL_UNSIGNED_INT, faces);

rendering slows to a crawl (approx. 1 fps). Yet when replacing the glDrawElement call with:

glBegin(GL_TRIANGLES);
for (unsigned int j=0; j< nFaces; j++)
{
glArrayElement((faces+j)->getIndexA());
glArrayElement((faces+j)->getIndexB());
glArrayElement((faces+j)->getIndexC());
}
glEnd();

everything works and performs as expected. Yet the effect of glDrawElements is defined to be (almost) identical to the code above. One would even expect the code above to be slightly slower due to the function call overhead of 3x glArrayElement…

What is happening here???

Hard to say without seing more code… normally it should run at the same speed, or faster (at least not slower). Do you see what’s expected on screen (ie. everything’s fine except for the speed) ? Are you using extensions ? What framerate do you get w/o drawElements ? Do you have the latest drivers (ATI & drivers: a love story) ?

Y.

There is not much more going on besides this… I am using no extentions and have installed all the latest drivers. When not using glDrawElements I get a very high framerate (well above 80 FPS). But when using glDrawElements the performance is very bad (1FPS), yet everythings look perfectly fine… :frowning:

Hum if you really have no idea, the best you can do i guess is, if you can, to post a binary along with the sources, so that we can see exactly what you’re doing wrong.

Y.

I can’t say for sure, but this sounds very much like an issue that was recently fixed in the driver. The problem would occur when you attempted to draw a few triangles out of a very large vertex array. The issue is that the driver has to make a decision on how to draw that data the fastest, and the information in drawelements makes it easy for the driver to sometimes make the wrong choice. This is whya you should prefer vertex array object, compiled vertex arrays, or draw range elements instead.

-Evan