What's the meaning of the indirect cmd used in glMultiDrawElementsIndirect

I’m confused about using glMultiDrawElementsIndirect(), could anyone explain to me the meaning of the cmd struct used by that drawing command?

struct cmd:

count = ..
primCount = ..
firstIndex = ..
baseVertex = ..
baseInstance = ..

if I have three different triangle strips to draw, would that be like this?

for (int n = 0; n < 3; n++)
{
	count = indexCount;
    primCount = 1;
	firstIndex = n * count;
	baseVertex = 0;
	baseInstance = n;
}

Setup Buffers:

protected void setupBuffers()
{
    gl.glGenVertexArrays(1, vaoBuff);
    gl.glBindVertexArray(vaoBuff.get(0));

    gl.glGenBuffers(5, vboBuff);

    //bind indirect buffer object
    gl.glBindBuffer(GL4.GL_DRAW_INDIRECT_BUFFER, vboBuff.get(0));
    gl.glBufferData(GL4.GL_DRAW_INDIRECT_BUFFER, instanceCount * 5 * Integer.SIZE / 8, null, GL4.GL_STATIC_DRAW);
    gl.glBufferSubData(...);

    //bind draw instance ID in the shader with a buffer object
    gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboBuff.get(1));
    gl.glBufferData(GL4.GL_ARRAY_BUFFER, instanceCount * Integer.SIZE / 8, drawIndexBuff, GL4.GL_STATIC_DRAW);
    gl.glVertexAttribIPointer(d_idLoc, 1, GL4.GL_UNSIGNED_INT, 0, 0);
    gl.glVertexAttribDivisor(d_idLoc, 1);
    gl.glEnableVertexAttribArray(d_idLoc);

    //bind vertex data buffer object
    gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboBuff.get(2));
    gl.glBufferData(GL4.GL_ARRAY_BUFFER, instanceCount / column_subdivision * vertBuffSize * Float.SIZE / 8, null, GL4.GL_STATIC_DRAW);
    gl.glBufferSubData(...);
    gl.glVertexAttribPointer(verPosLoc, 3, GL4.GL_FLOAT, false, 0, 0);
    gl.glEnableVertexAttribArray(verPosLoc);

    //bind vertex index data buffer object
	gl.glBindBuffer(GL4.GL_ELEMENT_ARRAY_BUFFER, vboBuff.get(3));
	gl.glBufferData(GL4.GL_ELEMENT_ARRAY_BUFFER, instanceCount / column_subdivision * indexBuffSize * Integer.SIZE / 8, null, GL4.GL_STATIC_DRAW);
	gl.glBufferSubData(...);
    
    //bind texture coordinate data buffer object
    gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboBuff.get(4));
    gl.glBufferData(GL4.GL_ARRAY_BUFFER, instanceCount / column_subdivision * texBuffSize * Float.SIZE / 8, null, GL4.GL_STATIC_DRAW);
    gl.glBufferSubData(...);
    gl.glVertexAttribPointer(tc_inLoc, 2, GL4.GL_FLOAT, false, 0, 0);
    gl.glEnableVertexAttribArray(tc_inLoc);
}

drawing command:

gl.glMultiDrawElementsIndirect(GL4.GL_TRIANGLE_STRIP, GL4.GL_UNSIGNED_INT, null, 3, 0);

Fixed it, it was the problem about vertex data, nothing relevant to the drawing commands. And the baseVertex should be 0.

The struct members have the exact same meaning as the corresponding parameters to glDrawElementsInstancedBaseVertexBaseInstance​().

So is that correct?

for (int n = 0; n < 3; n++)
{
count = indexCount;
primCount = 1;
firstIndex = n * count;
baseVertex = n * count / 2;
baseInstance = n;
}

So if my first strip is: 10, 0, 11, 1, … 19, 9
second strip: 20, 10, … 29, 19
then the baseVertex should be 10 * n ? (n means the index of the strip)

then the baseVertex should be 10 * n ? (n means the index of the strip)

No. The BaseVertex is the index offset to be added to each index in the index list for that primitive. Your indices appear to already have any such offset, so having a BaseVertex other than 0 makes no sense.

When I linked you to that page, I was kind of hoping you would read it.

[QUOTE=Alfonse Reinheart;1264918]No. The BaseVertex is the index offset to be added to each index in the index list for that primitive. Your indices appear to already have any such offset, so having a BaseVertex other than 0 makes no sense.

When I linked you to that page, I was kind of hoping you would read it.[/QUOTE]

I did that. Thanks. And I have already tried 0 before you said that, yet it still appeared not correctly. So I was assuming that I misunderstood it.

OK, show us the code that actually works. That is, the sequence of drawing commands that actually achieves what you’re trying to do.