glDrawArrays doesn't work like glDrawElements

Shouldn’t these two functions produce the same thing? If I used glDrawArrays I get some really screwed up looking scene.

glDrawElements(GL_TRIANGLES, nFaces3, GL_UNSIGNED_INT, Tris);
glDrawArrays( GL_TRIANGLES, 0, nFaces
3);

My indices are unsigned ints, is that the problem? Is glDrawArrays assuming unsigned shorts?

[This message has been edited by WhatEver (edited 11-14-2002).]

I think I see the problem. glDrawArrays assumes there’s a unique vertex for each corner of every triangle. Am I right? I see you can’t specify indices so that makes sense.

Yes DrawArrays doesn’t use indices, so you need exactly 3 vertices in the aray per triangle.

As a side note, you wont get benefit of the gpu vertex cache if you dont use indexed mode.

Nutty

Now that I understand, glDrawArrays can’t be used efficiently. It’s a good thing I used indices then.

Thanks Nutty!