elm-community / webgl

Moved to elm-explorations/webgl
https://package.elm-lang.org/packages/elm-explorations/webgl/latest
BSD 3-Clause "New" or "Revised" License
131 stars 18 forks source link

Create textures procedurally #55

Closed milibopp closed 6 years ago

milibopp commented 6 years ago

Provided I understand the current API correctly, there is currently no way to create a texture programatically by providing the color values as data to some constructor. Is this intentional?

I kind of have a use case for procedural textures, namely converting colormaps into textures on the fly. If this is a desired feature, I might be interested in implementing it.

w0rm commented 6 years ago

@aepsil0n correct, there is no API in the Elm platform that allows to work with binary data.

You can do work in JS and then send a Blob URL through a port and use it to load as a Texture.

There is also this package https://github.com/justgook/elm-image-encode that allows to encode an image into a base64 encoded URL, that is also possible to load as a Texture.

Hopefully any of these two solutions would work for your case. Happy to discuss this in the webgl channel in Elm slack.

I'm closing the issue here because the 0.19 version has been moved here: https://github.com/elm-explorations/webgl

milibopp commented 6 years ago

Thanks for the tips. This might actually work, I have to give it a try.