I'm confused about using glMultiDrawElementsInirect (), did anyone know me about cmd struct used by that drawing command Can you explain the meaning of?
Structure CMD:
count = .. primcount = .. firstIndex = .. baseVertex = .. baseInstance = ..
If I have three different triangle strips, will it happen?
(int n = 0; n & lt; 3; n ++) {count = indexCount; Primcount = 1; First index = n * count; BaseVertex = 0; BaseInstance = n; ...}
Setup Buffers:
Protected Zero Setup Buffers () {gl.glGenVertexArrays (1, Voobf); Gl.glBindVertexArray (vaoBuff.get (0)); Gl.glGenBuffers (5, vboBuff); // bound indirect buffer object gl.glBindBuffer (GL4.GL_DRAW_INDIRECT_BUFFER, vboBuff.get (0)); Gl.glBufferData (GL4.GL_DRAW_INDIRECT_BUFFER, ExampleCount * 5 * integer. SISE / 8, blank, GL 4.GL_STATIC_DRAW); Gl.glBufferSubData (...); // Drag the example ID into the shader with buffer object gl.glBindBuffer (GL4.GL_ARRAY_BUFFER, vboBuff.get (1)); Gl.glBufferData (GL4.GL_ARRAY_BUFFER, example work * integer. SESE / 8, drawnexbuff, GL 4.GLSADATCDRAW); 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, ExampleCount / Column_subdivision * Work Buffets * Float. SESEA / 8, Blank, GL 4.GLSAMTICDRW); Gl.glBufferSubData (...); Gl.glVertexAttribPointer (verPosLoc, 3, GL4.GL_FLOAT, incorrect, 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, ExampleCount / Column_sub division * Index buffs * integer. SISEA / 8, blank, GL 4.GLSADATADRAW); Gl.glBufferSubData (...); // bind texture coordinate data buffer object gl.glBindBuffer (GL4.GL_ARRAY_BUFFER, vboBuff.get (4)); Gl.glBufferData (GL4.GL_ARRAY_BUFFER, ExampleCount / Column_sub division * TexasBuffies * Float. SSEAG / 8, blank, GL 4.GLSADATACDRAW); Gl.glBufferSubData (...); Gl.glVertexAttribPointer (tc_inLoc, 2, GL4.GL_FLOAT, false, 0, 0); Gl.glEnableVertexAttribArray (tc_inLoc); }
Drawing command:
gl.glBindVertexArray (vaoBuff.get (0)); Globind buffer (GL4.GL_DRAW_INDIRECT_BUFFER, vboBuff.get (0)); Gl.glMultiDrawElementsInirect (GL4.GL_TRIANGLE_STRIP, GL 4.GL_UNSIGNED_INT, blank, 3, 0);
It is certain, there are some problems within the top data. The second is all right.
No comments:
Post a Comment