Skip to content

How to advance through vertex buffer across instances? #2016

Answered by kvark
smolck asked this question in Q&A
Discussion options

You must be logged in to vote

Graphics APIs do not offer that. If you want the advancement to be done for each vertex and also for instances, then you'd need to make this a non-instanced draw call. As for the buffer you are currently using as instanced, there are at least 2 choices:

  1. make it so it duplicates the info for each vertex in a quad. It's a waste, but if you don't draw that many quads it could be OK.
  2. bind this buffer as a read-only storage buffer instead of a vertex buffer, and load data from it via something like gl_VertexIndex / 6 index. This would mean the buffer is exactly what you have today, and it's advanced once per 6 vertices.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@cwfitzgerald
Comment options

@smolck
Comment options

@cwfitzgerald
Comment options

@CatCode79
Comment options

Answer selected by smolck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants