Constant buffers

How are rendering constants added to a constants buffer? The documentation is a bit minimalistic…

It’s just a Lua table so you do it yourself:

self.constants = render.constant_buffer()
self.constants.tint = vmath.vector4(1, 1, 1, 1)

render.draw(self.my_pred, self.constants)

(Yes, the documentation for the render API needs to be fleshed out)

Weird, that was my initial assumption but I didn’t get it to work. Guess I did something else wrong because now it works like a charm!

Thanks!

1 Like

I dug deeper and no, it’s not a real Lua table. It’s user data implementing parts of what’s in a table but not everything. You can’t do pairs() on them, for instance.

1 Like