Excellent - thanks for the info and link.... looks most cool indeed :) - 
just had a play - looking forward to being able to write something as 
capable at what you've got there (and as well organised code-wise).

One of my colleagues at work suggested the same approach (as why would you 
put text in webgl when you've got a perfectly capable text rendering engine 
in the browser)... It is still a (the) fallback solution - so I may be 
having a further delve into your code (thanks again).  However I'm wanting 
to put labels next to webgl renderings that stick with the things they 
label and scale with them in a responsive, dynamic way.  It is probably 
possible using an overlay but I managed to persuade myself that it would be 
more straight forward if I could do it all in webgl - hence the current 
course of action.... plus it felt like it should be possible - and it feels 
like I've got it working apart from this issue of handling the canvas 
elements that are needed so I don't kill the browser.


On Wednesday, August 31, 2016 at 7:07:06 PM UTC+1, Nick H wrote:
>
> My into-the-heavens project is using HTML divs to overlay text on a WebGL 
> canvas (link to relevant code 
> <https://github.com/nphollon/into-the-heavens/blob/master/src/Graphics/View.elm>
> ).
>
> This has worked fine for my needs, but my needs are pretty boring. Maybe 
> you want to do something cool & crazy with the canvas text?
>
> On Wed, Aug 31, 2016 at 10:53 AM, Nick H <falling...@gmail.com 
> <javascript:>> wrote:
>
>> Why do you want to render text using a canvas texture instead of the DOM? 
>> It seems like making a pure Elm function that places text in a div would 
>> give you the same results and would still integrate fine with elm-webgl.
>>
>> As for your specific question, I suspect the answer is no, but I don't 
>> know enough about the vdom implementation to say for sure.
>>
>> On Wed, Aug 31, 2016 at 10:26 AM, roovo <rupert....@gmail.com 
>> <javascript:>> wrote:
>>
>>> 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 elm-discuss...@googlegroups.com <javascript:>.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>

-- 
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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to