Fork me on GitHub
#cljfx
<
2021-03-30
>
chrisn14:03:02

How are you managing redrawing your canvas when the user resizes the main window? Are you keeping a mirror of the window properties in an atom to force a redraw that way?

vlaaad14:03:27

I put canvas’s width and height into app state, and listen to size changes to update the state. Then redraws will happen automatically on resize

chrisn14:03:09

That makes sense. I am bit concerned about how smooth that will appear but since I am bouncing all the way to opengl and back anyway I don't think it can be butter smooth.

chrisn14:03:24

Does that coalesce rendering? For example does a single resize cause 2 render requests?

chrisn15:03:49

Yes, it appears like it does with batching descriptions. This is great.

vlaaad15:03:54

Not sure I understand the question, but you can request rendering million times per second from multiple threads, and it should preform redraws once per frame from javafx ui thread

vlaaad15:03:54

That's when using renderer abstraction

vlaaad15:03:10

There's an example of that somewhere...

chrisn15:03:26

That is what I was looking for. If a user starts resizing the window then you can easily end up with too many events to render and some level of coalescing makes sense. Sorry of all the detailed questions, I am also going through the code to see what is going on.