2
$\begingroup$

This code works:

unsigned int n;
for (n = 0; n < draw_count; n++) {
     const DrawArraysIndirectCommand *cmd;
     cmd = (const DrawArraysIndirectCommand  *)draw_data + n;
     set_uniform_int("draw_call", n, program);
     glDrawArraysInstancedBaseInstance(GL_TRIANGLE_STRIP, cmd->first, cmd->count, cmd->instanceCount, cmd->baseInstance);
}

Replacing this with glMultiDrawArraysIndirect doesn't render anything:

glMultiDrawArraysIndirect(GL_TRIANGLE_STRIP, (GLvoid*)0, draw_count, 0);

Before I do this, I bind:

glBindBuffer(GL_DRAW_INDIRECT_BUFFER, vb->m_draw_call_ib);
glBufferSubData(GL_DRAW_INDIRECT_BUFFER, 0, draw_count * sizeof(DrawArraysIndirectCommand), draw_data);
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, 0);

glBindVertexArray(vb->m_vao);

glBindBuffer(GL_DRAW_INDIRECT_BUFFER, vb->m_draw_call_ib);

glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 5, vb->m_chunk_ssbo);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 4, vb->m_draw_ssbo);

Do I need a specific version of opengl, why would this not work on the khronos page they said that glMultiDrawArraysIndirect was an exact replica of my working piece of code?

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.