From what I read on GitHub, hardware instancing should work with OpenGL, and Jjagg posted a screenshot of a working sample.
I wanted to try some examples (here, and here), but I encountered a problem when trying to set the vertex buffers using SetVertexBuffers. In these examples, we need two bindings but this seems not possible, given the exception Max number of vertex buffers is 1.
I checked the OpenGL GraphicsDevice class, and as you can see on this line, there is a todo about this limitation.
So, the question is, is there any working sample with OpenGL and hardware instancing? How is it possible to get the two previous examples work with using only one vertex buffer?
Yeah, my PR was not merged yet so instancing for GL is not yet in the 3.6 release or the develop branch. Tests are working so IMO that’s good to be merged. I just pinged the maintainers on that PR, I’ll post back here when it’s merged. When that happens you can grab a develop build and use that.
Cool, I haven’t seen them and the second one looks intriguing. I wonder whether that approach can make CPU particles compete with the GPU particle approach from the XNA samples ( have a dynamic vertex buffer and draw all particles in one go)
Ah alright, I actually thought the main things were merged and you forgot some others or I don’t know what, didn’t really check the commits.
Anyways thanks a lot for your work. This was much needed.
You removed the wrong parameter. The original parameters were (PrimitiveType primitiveType, int baseVertex, int minVertexIndex, int numVertices, int startIndex, int primitiveCount, int instanceCount). In the new function, minVertexIndex and numVertices have been removed. So if you want to convert your first call to the new version, it should be