API Review RT:17407 Canvas Node

Dr. Michael Paus mp at jugs.org
Wed Apr 25 12:47:26 PDT 2012

Am 25.04.2012 20:23, schrieb Jim Graham:
> Right now when you draw it has to be on the thread on which you 
> respond to inputs or do other SG modifications.

So in other words you are saying that while you are drawing you can't 
respond to any other input anymore, right?
That means while you are drawing you can't move the canvas around with 
the mouse, zoom in and out and so on?
Isn't that the definition of a non-responsive and bad user interface?

> In other words, any thread where you can appropriately call 
> cv.setWidth(), group.add(cv), etc. is a thread you can render on.  The 
> rendering is "remembered" in a buffer and it isn't actually drawn 
> until the render pass.  At that point we simply eat the buffer and 
> render it in a tight loop so any pauses for thought in your rendering 
> code would only affect the event and SG modification threads, not the 
> render thread.  (The pauses aren't stored in the buffer. ;)
> We looked at ways of relaxing that further, but they won't come in 
> this first round of the API.  It would necessitate having multiple HW 
> contexts and have a context set aside to only be used for Canvas 
> rendering into its texture with a clearly defined buffer swap that has 
> to be synchronized across the threads.  Unfortunately that model is 
> not easy to support with D3D, our most common hw solution, so it is 
> still just a pet theory...
>             ...jim
> On 4/25/12 1:38 AM, Dr. Michael Paus wrote:
>> Am 25.04.2012 10:03, schrieb Jim Graham:
>>> Hmmm... More variants of Canvas or more attributes to set...?
>> I was just thinking about potential use-cases for the canvas node and
>> stumbled over the
>> following question. How can I still provide a super-smooth GUI if I have
>> a canvas drawing
>> which lasts longer than the interval between two pulses. Maybe it even
>> lasts more than
>> a second. My understanding of the current canvas design proposal is that
>> when I redraw
>> the canvas, for whatever reason, the GUI is basically blocked for this
>> time. Is that true?
>> If the above interpretation is right I would like to propose a
>> modification of the design
>> which makes it possible to have a double buffer canvas where the
>> currently active
>> buffer is redrawn whenever the JavaFX runtime needs to redraw the node
>> and where
>> I can render into the second buffer from ANY thread at any time without
>> disturbing the
>> smoothness of the GUI. When I am done with the rendering I just signal a
>> buffer switch
>> and with the next pulse the new buffer is shown.
>> What do you think?
>> Michael

Dr. Michael Paus, Chairman of the Java User Group Stuttgart e.V. (JUGS).
For more information visit www.jugs.de.

More information about the openjfx-dev mailing list