-
Notifications
You must be signed in to change notification settings - Fork 226
Description
Hello,
I've been doing some research about uniform block objects and instancing with OGL. Right now Geometry raises a warning for anything that's contained inside of a uniform block object. It also raises a warning for gl_InstanceID.
attribute vec3 position; attribute vec3 offset; uniform Group { uniform vec3 groupPos[10]; uniform vec3 groupRotation[10]; }; void main() { vec3 pos = position; pos += groupPosition[gl_InstanceID]+ offset + groupRotation[gl_InstanceID]; gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0); }
Secondly, on this line right here:
Line 179 in 9dae6ba
It chokes on gl_InstanceID. I just did a check to see if it's that name and bail out if it is.
If I make a PR that provided better support for instancing and Uniform Block Objects would that be ok? The reason I'm interested in doing it this way is because I can get really good performance and modify groups of instances of different geometries with a single change. BTW this code won't work on Firefox atm. Firefox doesn't support vectors in uniform block objects for some reason. uniform vec3 groupPos[10];. Safari and Chrome are fine though.
If there's another way to do this let me know please.