glDrawArrays slower?


I made a program to render .obj files, and on my ATI Radeon 9600 glDrawArrays is faster than inmediate mode, but the difference is not important… 10 or 30fps. The same program on a laptop (HP zv5000… I think that it has an ATI 9000 mobility) is very very sloooooow compared with inmediate mode (glDrawArrays = 90fps, Inmediate = 290fps)… It does not seems to be a driver problem because most games works fast and smooth… what it the best bet? is (always) glDrawArrays FASTER that inmediate mode? is here something wrong?

GL.glEnableClientState( GL.GL_VERTEX_ARRAY );
GL.glEnableClientState( GL.GL_TEXTURE_COORD_ARRAY );

GL.glVertexPointer( 3, GL.GL_FLOAT, 0, vertices );
GL.glTexCoordPointer( 2, GL.GL_FLOAT, 0, verticesTex );
GL.glDrawArrays( GL.GL_TRIANGLES , 0, poligonos );

GL.glDisableClientState( GL.GL_VERTEX_ARRAY );
GL.glDisableClientState( GL.GL_TEXTURE_COORD_ARRAY );

thanks a lot :slight_smile:

I assume you’re using vanilla vertex arrays as shown before the vertex buffer extension came out. If so, you won’t get MASSIVE performance boosts with vertes arrays. Then again, some people would look at an additional 10 fps in their program and be overjoyed.

If you want to really make it fly, consider the vertex buffer object extension (now ARB really). If you already am, make sure you’ve updated your drivers.

My first experience with vertex buffer objects was on a Radeon 9200 with the default drivers. Rendering actually slowed down when I moved over to vertex buffers from vertex arrays. However, a driver update took me from 30fps to 120fps!

How big are your arrays that you are trying to draw? IIRC there is a limit, that is implementation specific, on how many elements you can (should) render per call. This might be less on the 9000 than it is on 9600.

Looking in the Red book I can see a reference to glGetIntegerv(GL_MAX_ELEMENTS_VERTICES) and GL_MAX_ELEMENTS_INDICES - however this is mentioned under glDrawRangeElements(). I am not sure if this applies to glDrawArrays().

No doubt someone else will.

Hi again

Thanks for your answers, I don’t know where is the problem :frowning: :frowning: I tried with DIFFERENT graphics cards and last drivers for all (NVidia and ATI) and some computers with the SAME graphics cards and the problem persist… I get 380fps on some computers and 80fps on another with better graphics card using vertex arrays :frowning:

I tried ARB_vertex_buffer_object but does not make difference, it still slower than inmediate mode.

is really vertex arrays FASTER?


With vertex arrays (VBO or not) you eliminate the CPU overhead of funcion calls for each vertex so they should result in an speed increase if your program is CPU-limited.

If you have static geometry (you don’t change any vertex between frames) you can use display lists with vertex arrays, that should be the fastest way of rendering in most cards.

If you have indices you should use glDrawRangeElements to render to save bandwidth of repeated vertices.

It should never be slower than immediate mode, though you may want to try interleaving vertex array and texcoord array rather than putting it into different arrays. It’s generally faster that way.

Originally posted by Humus:
It should never be slower than immediate mode, though you may want to try interleaving vertex array and texcoord array rather than putting it into different arrays. It’s generally faster that way.
I tried glInterleavedArrays with the same result :frowning:

The question is: what could be wrong configure for get less performance on a Geforce 5200FX (150fps) compared with a Geforce 3 Ti200 (400fps)?!?!?!?!?!

I tried to install the last drivers from nvidia, the last chipset drivers, I changed the AGP aperture, etc etc…


Didn’t mean you should use glInterleavedArrays(), but rather something like this:

glVertexPointer(3, GL_FLOAT, 5 * sizeof(float), vertices);
glTexCoordPointer(2, GL_FLOAT, 5 * sizeof(float), ((char *) vertices) + 3 * sizeof(float));

It probably won’t matter anyway, but this way you’re not limited to just the small set of options in glInterleavedArrays().

after try for various machines I get the follow conclusion:

For ATI and NVidia implementations glDrawElements is the fastest way to render triangles in ALL models of their graphics cards, even if using index for EVERY vertex instead the same index for shared vertex. glDrawElements is se second, very close to glInterleavedArray in LAST models of ATI because old models like ATI 7000 immediate mode is faster.


I’ll add that on Mac OS X, I’ve found glDrawRangeElements and glDrawElements (with interleaved vertex/texture/color) to be SLOWER than immediate mode on the Radeon 7000. It is faster on every other card, including the Rage128.