Hi I've recently been learning/hacking/having fun with elm and webgl and have been experimenting with rendering text using canvas textures. It seems that this is not possible using elm-graphics as it renders text using the DOM and not canvas, so I have slapped together a proof of concept (currently hard-coded for my use-case) which uses a native component to create a canvas and provide it as a texture fit for use in webgl - see the gist at:
https://gist.github.com/roovo/edff73230cb454a206e796f6e3fa71b0 This does work - yay - nice looking text and easy to use :) However, it's obviously a bad idea to create these canvas elements in the way that I am (directly on the DOM) as I am not using the virtual dom so on each animation frame I'll just be adding more until something goes pop. This is where I could do with some advice.... Is it possible to create these in a way that they will be managed by the virtual dom - i.e. so it won't create multiple canvases containing the same text, so ones that I'm not using anymore will be removed from the dom, and so that they will be available for use in the current render cycle (not sure if my terminology is correct here) by webgl. I need it to be available in the current cycle so I can find out how big it is so I can create an appropriately sized surface to render it on. I do hope that this makes sense - I'm new to both elm and webgl so apologies if I'm not using the best wordage... Many thanks -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
