elm-explorations / webgl

Functional rendering with WebGL in Elm
https://package.elm-lang.org/packages/elm-explorations/webgl/latest/
BSD 3-Clause "New" or "Revised" License
117 stars 17 forks source link

Allow Mat4 to be used as attribute to vertex shader #3

Closed emptyflash closed 5 years ago

emptyflash commented 6 years ago

Just ran into an issue where I was getting this error:

Uncaught Error: No info available for: 35676
    at _WebGL_doBindAttribute (Main.elm:6110)
    ...

After a little digging I discovered it's because there's no support for mat4 attributes.

It seems like this should be possible to do, and pretty straightforward: https://stackoverflow.com/questions/38853096/webgl-how-to-bind-values-to-a-mat4-attribute

My use case is passing in a separate transform for each Entity as an attribute, in order to do the transformation on the GPU. I'm willing to make the change, just wanted to get some opinions first.

w0rm commented 6 years ago

@emptyflash this seems like an overlook. I've never had such use case so I kept this code.

I think if it is possible to add Mat4 support without changing the api, then we should do it.

w0rm commented 5 years ago

@emptyflash did you work on this?

emptyflash commented 5 years ago

@w0rm unfortunately I haven't had the time to actually fix this. I was able to workaround it by sending 4 vec4s as attributes.