cljfx

https://github.com/cljfx/cljfx
chrisn 2021-03-29T15:07:59.052400Z

@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 🙂.

chrisn 2021-03-29T15:56:10.052800Z

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

vlaaad 2021-03-29T16:07:30.052900Z

I have a resizable canvas in Reveal

vlaaad 2021-03-29T16:10:20.053200Z

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

👍 1
phronmophobic 2021-03-29T19:13:42.053400Z

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.

phronmophobic 2021-03-29T19:19:08.053800Z

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#L36https://github.com/phronmophobic/clj-cef/blob/main/examples/browser/src/clj_cef/browser.clj#L46