Jim has posted 66 posts at DZone. You can read more from them at their website. View Full User Profile

Speeding up the JavaFX Presentation Cube for Jfokus

01.08.2009
| 5090 views |
  • submit to reddit

I'll be traveling to Stockholm in a few days to give a University session on JavaFX at Jfokus on January 27, 2009.  During that week on January 29-30 I'll also be teaching an intensive two-day class on creating JavaFX applications, with a focus on developing Rich Internet Applications.  In the past I've used a rotating cube developed in JavaFX to display static and dynamic (executing JavaFX code) content.

JFokus-pres-screenshot-small

The cube uses the PerspectiveTransform effect to do faux-3D, and was running at around 10 frames per second.  I asked Stephen Chin if he could tune it up a bit, and he sent me back a modified program that consistently achieves 60+ FPS on my dual core 2.4 GHz Vista machine.  In a later post Stephen and I will point out the optimization techniques used, but for now I wanted to give you a Java Web Start link to try it out: 

Webstartsmall2

To see the FPS that the cube is achieving on your machine, take a look at the Java console.  It also displays any acceleration type in use.  Here's my console output for reference:

Acceleration Type is: Direct3D
Animation FPS: 62
Animation FPS: 64
Animation FPS: 64
Animation FPS: 64
Animation FPS: 64
Animation FPS: 64
Animation FPS: 64
Animation FPS: 64
Animation FPS: 63
Animation FPS: 64

By the way, the presentation slides in the example that you'll be running are dated, but I'll post the actual Jfokus presentation cube on this blog for you shortly after the session.  Also, as I mentioned in yesterday's WidgetFX 1.0 post, I'll show you the code for this presentation cube as well as walking through how to tweak the code to convert it into a WidgetFX widget.

Enjoy,
Jim Weaver
JavaFXpert.com

Published at DZone with permission of its author, Jim Weaver.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags:

Comments

Dmitri Trembovetski replied on Fri, 2009/01/09 - 8:14pm

Would be cool if the slide that shows the dialogs was live.

BTW, you could try to set these properties to enable vsync and get rid of tearing when switching slides (unfortunately, only when running localy for now or if you're willing to make the app signed): -Dcom.sun.scenario.animation.adaptivepulse=true -Dcom.sun.scenario.animation.vsync=true .

Dmitri

 

Jim Weaver replied on Fri, 2009/01/09 - 9:05pm in response to: Dmitri Trembovetski

"Would be cool if the slide that shows the dialogs was live.  BTW, you could try to set these properties to enable vsync and get rid of tearing when switching slides (unfortunately, only when running localy for now or if you're willing to make the app signed): -Dcom.sun.scenario.animation.adaptivepulse=true -Dcom.sun.scenario.animation.vsync=true"

 

Dmitri,

Thanks for these properties!  I'll give them a try!

Jim Weaver

Osvaldo Doederlein replied on Sat, 2009/01/10 - 1:12pm

I'd be curious to check both the quality and performance of this program if each side of the cube was a vector graphics (I see that slides are just PNGs). We could make good use of a pdf2fxz translator, for resources created in Office applications, that don't typically export to SVG or other vector format. In many cases, including typical presentation slides, the vector format would even be smaller to download.

 With vector -based cube faces, you could also try to eliminate the cube moving effect (going away and then back). This wouldn't allow to see the cube's entire perimeter, but I think the transition would be much smoother. And when (in the middle of the transition) an edge "approaches" to observer, the maximized, but perfectly rendered [vector] content near the faces' edges would be cool.

Jim Weaver replied on Sat, 2009/01/10 - 3:05pm in response to: Osvaldo Doederlein

Osvaldo,

Great suggestions.  Do you know if anyone is working on a pdf2fxz translator (although I suppose Office app files like PowerPoint could be converted to SVG and then be converted by the SVG to FXZ tool that comes with the JavaFX Production Suite)?

I'd be glad to make the code available for the presentation cube if you'd like to play around with it.  Just email me (jim.weaver at javafxpert.com).  That would belp me a lot, as I would like to have this as smooth as possible for the Jfokus session, etc. 

Thanks,

Jim Weaver

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.