0

I wish to implement some Frustum Culling in my JavaFX application, as there can be a large amount of Nodes outside the scene but there are some mouse-events such as dragging which may bring them back to the Scene. Is there some method already in the JavaFX framework or would I have to implement this by myself. I have already tried to implement a clipping method which removes the Nodes outside of the Scene however its difficult to update the Scene after mouse events.

Any help would be appreciated Thanks

sazap10
  • 263
  • 2
  • 7
  • 15
  • Not a direct answer to your culling question, but setting [node.isCache(true)](http://docs.oracle.com/javafx/2/api/javafx/scene/Node.html#setCache%28boolean%29) and [node.setCacheHint(CacheHint.SPEED)](http://docs.oracle.com/javafx/2/api/javafx/scene/Node.html#setCacheHint%28javafx.scene.CacheHint%29) *may* help relieve some of your performance issues. – jewelsea Jan 22 '13 at 18:18

2 Answers2

0

Do you require the nodes to be completely removed forever or you worried about rendering?

Nodes outside of the scene should not be rendered at all, this is handled by JavaFX.

Andy Till
  • 3,101
  • 2
  • 16
  • 20
  • No not removed just not rendered. The performance of the application drops dramatically when using the mouse events to scroll through the rest of the nodes, if there is a large amount of them – sazap10 Jan 21 '13 at 18:58
  • How do you know that nodes in the scene are being rendered? Try using jvisualvm to profile while you drag the nodes around to see what is taking the processing power. This will probably show a lot of JavaFX stuff but could narrow it down. – Andy Till Jan 21 '13 at 22:06
  • If i have a small number of Nodes, there is almost no lag when dragging the Nodes however if there are lots like 100+ then the application stutters on dragging and has a lot of lag – sazap10 Jan 21 '13 at 23:14
0

My guess is that each node has Listeners attached.. therefore you are creating (n ->) listeners ... Perhaps try creating a method that when hovered, add drag listeners / and remove on hover exit.. Also Nodes not rendered on screen should remove such listeners as well.

And maybe wrapping those listeners in the WeakListener classes

just my thoughts...

jdub1581
  • 631
  • 5
  • 10