Fork me on GitHub
#cljfx
<
2021-03-29
>
chrisn15:03:59

@smith.adriane - your canvas example is really good and is probably the way to go at first. I would rather use an imageview than a canvas but some people will want to use a canvas so they can render the 3d scene and then use canvas to render text and various 2d graphics on top. I guess the thing to test is the performance of the canvas at 60fps to render an HD image to the screen. If it is negligable (<< 16ms) then canvas may be the best way. As a 3d person all I want to start with is the :draw callback. There are two different overall modes for rendering; one for interactive mode when a mouse click means select object or perhaps rotate scene all rendering is done via callbacks from user interaction. The second mode is a playback mode where you are playing animations or whatever and spacebar pauses/plays the scene. The first mode I think it is clear how it works but the second mode I am not so sure really. I am also not sure the performance implications of rendering a writable image to a canvas as opposed to setting it as the image behind an imageview. So a few things to test šŸ™‚.

phronmophobic19:03:42

In case you didn't have enough options, there are also similar examples for https://github.com/phronmophobic/membrane/blob/master/src/membrane/skija.clj which uses lwgl and glfw rather than cljfx.

phronmophobic19:03:08

I also don't know what the performance implications, but I would be interested to hear your results since I do a similar thing to implement offscreen rendering for clj-cef: ā€¢ https://github.com/phronmophobic/clj-cef/blob/main/examples/htmltoimage/src/clj_cef/htmltoimage.clj#L36 ā€¢ https://github.com/phronmophobic/clj-cef/blob/main/examples/browser/src/clj_cef/browser.clj#L46

chrisn00:03:23

I saw Skia's implementation but I do want to have a full UI toolkit and for 95% of the application cljfx fits the bill perfectly. When I get enough going I will put that on the list to benchmark and be sure about.

šŸ‘ 3
phronmophobic00:03:19

I think cljfx would simplify distribution as well

chrisn15:03:10

ouch. resizable isn't a property and requires derivation to work with.

vlaaad16:03:30

I have a resizable canvas in Reveal

vlaaad16:03:20

I think I still needed to wrap it in something like stack-pane for some reason... Here https://github.com/vlaaad/reveal/blob/master/src/vlaaad/reveal/output_panel.clj#L462

šŸ‘ 3