Skip to content
Advertisement

How am I going wrong in glMultiDrawArraysIndirect function?

I’m programming using Python and Modern OpenGL, and I tried to implement the glMultiDrawArraysIndirect function in my code to draw a simple shape, I want to apply it later on to a more complex thing, but this is just a simple test that I don’t know exactly where the error is.

JavaScript

In the VBO there is a square, but I was going to draw only 2 triangles using the first 3 points and then the last 3 next to each other, I didn’t find many examples of this type of code on the internet, only glMultiDrawArraysIndirect documentation but I couldn’t do it run in my code, at least not without giving a good lock, when I change the drawcount for 1 wheel but nothing appears on the screen.

There is and the drawcount I took from the site: http://docs.gl/gl4/glMultiDrawArraysIndirect

I tried to change the indirect value for different types of numpy arrays, with different uint dtypes but most of them either error or run without anything appearing on the screen does anyone know what’s wrong?

Advertisement

Answer

When you specify the NumPy array you need to specify the type uint32. The last argument (stride) is specifies the distance in basic machine units between elements of the draw parameter array (16 bytes):
(see glMultiDrawArraysIndirect)

JavaScript

or

JavaScript

The above code does the same as:
(see glDrawArraysIndirect)

JavaScript

Respectively the same as:
(see glDrawArraysInstancedBaseInstance)

JavaScript

When you use glDrawArraysIndirect or glMultiDrawArraysIndirect, you need to create the following data structure: (see GLAPI/glMultiDrawArraysIndirect)

JavaScript

This can be achieved using a NumPy array with the data type uint32:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement