Skip to main content
GameDev.net gamedev.net
🔒 Locked

glMultiDrawArrays

Started by JinJo Apr 29, 2004 at 12:38 PM 3 replies 5.3k views
Original Post
JinJo
JinJo
How do I use this function? I pass in GL_TRIANGLE_FAN, then 0 as the start index, the number of vertices being rendered and then there is this extra parameter called primCount, what do I do with that? Also I can''t get it to compile because of the 3rd parameter, it wants a ptr to int, but i was passing in an unsigned variable, numOfVertices, what should I do here.
SantaClaws
SantaClaws
What are you trying to do? glMultiDrawArraysEXT lets you draw multiple sets of primitives with one function call. If you're only looking to draw once, look at glDrawArrays.

glMultiDrawArraysEXT works just like glDrawArrays, except you're supplying multiple sets of values for the second and third parameters, hence the additional parameter - specifying how many sets of values you have.

It would work something like this:

GLint firstValues[] = { 0, 10, 40, 80 };
GLsizei countValues[] = { 3, 9, 3, 12 };
glMultiDrawArraysEXT( GL_TRIANGLES, firstValues, countValues, 4 );


firstValues[] specifies 4 starting indexes in the arrays you've setup with the calls such as glVertexPointer, etc. countValues specifies 4 values telling how many vertexes to render from each starting index. The last parameter tells how many "sets" of GL_TRIANGLES you're going to render.

[edited by - SantaClaws on April 29, 2004 4:16:54 PM]
JinJo
JinJo
Ah right, I thought it was used when doing multitexturing.

So when drawing a primitive that has multi-texturing should I still just use glDrawArrays?

If so then there''s something strange going on as it isn''t rendering using multi-texturing, I have binded textures to ARB0 and ARB1 and set the clientTextureArray twice (once after each call to setting the current texture) is this correct?

I have probably gave you a bad description and I''m not near my code but I thnk you may get the idea.
JinJo
JinJo
I think I know what was wrong, but I still can''t check the code.
I was calling glEnableClientState(GL_TEXTURE_COORD_ARRAY) only once, I''m sure I have to do this evertime I call glClientActiveTextureARB(GL_TEXTURE0_ARB) with a different texture unit as the parameter. Is this correct?

SantaClaws
SantaClaws
Correct, and remember that you need to set the glTexCoordPointer for each, as well.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.