PDA

View Full Version : update vertex attribute once per primitive?



sandbucket
06-22-2013, 09:18 AM
hi all. is their a way to have one vertex attribute being updated per a specified number of primitives?
thanks

GClements
06-22-2013, 09:43 AM
hi all. is their a way to have one vertex attribute being updated per a specified number of primitives?
thanks
Not directly. With instanced rendering, you can have an attribute updated once per a specified number of instances by using glVertexAttribDivisor() or glVertexBindingDivisor(). Or you can store the attribute data in a texture (or uniform array, buffer array, etc) and use gl_VertexID to calculate an index into the array.