PDA

View Full Version : glMultiDrawElements



jl110
02-07-2012, 03:12 PM
Hi all,

I'm having trouble calling the glMultiDrawElements function, i thought it was my code to start with, but i have since copied and pasted a number of code fragments from the internet and books and found they all produce the same compilation error:

The latest of the copied and pasted codes is as follows:

static GLubyte frontIndices[] = {4, 5, 6, 7};
static GLubyte rightIndices[] = {1, 2, 6, 5};
static GLubyte bottomIndices[] = {0, 1, 5, 4};
static GLubyte backIndices[] = {0, 3, 2, 1};
static GLubyte leftIndices[] = {0, 4, 7, 3};
static GLubyte topIndices[] = {2, 3, 7, 6};

static GLubyte * indices[] = { frontIndices, rightIndices, bottomIndices, backIndices, leftIndices, topIndices };
static GLsizei counts[] = {4, 4, 4, 4, 4, 4 };
glMultiDrawElements(GL_QUADS,counts,GL_UNSIGNED_BY TE,indices,6);

I have no trouble running glDrawElements, but the glMultiDrawElements comes up with the following error every time:

Error 1 error C2664: 'void (GLenum,const GLsizei *,GLenum,const GLvoid **,GLsizei)' : cannot convert parameter 4 from 'GLubyte *[6]' to 'const GLvoid **'

and

Error 2 error C2664: 'void (GLenum,const GLsizei *,GLenum,const GLvoid **,GLsizei)' : cannot convert parameter 2 from 'int' to 'const GLsizei *'

Can anyone shed some light on this issue?

Thanks very much :D

Aleksandar
02-07-2012, 03:21 PM
Just cast arguments to appropriate (requested) types.

jl110
02-07-2012, 03:36 PM
Just cast arguments to appropriate (requested) types.

Would you be kind enough to show me how this would be done so that i can try it out knowing its right? I really could do with some kind of definitive answer if possible. I have spent well over an hour trying to solve this one problem! :-(

Aleksandar
02-07-2012, 05:51 PM
glMultiDrawElements(GL_QUADS, (int*)counts, GL_UNSIGNED_BYTE, (const void**)indices, 6);