Login  Register

Re: NEWTCanvasJFX Resize

Posted by Sven Gothel on Jan 10, 2020; 8:49pm
URL: https://forum.jogamp.org/NEWTCanvasJFX-Resize-tp4040254p4040256.html

I would refrain from it, as this is more intended
to be a vehicle to have an opque child window
exposing 'a main scene' and doesn't integrate too
well into JFX.

For the latter a shared native image buffer would be desired,
to be rendered into offscreen via FBO.
AFAIK there was something implemented lately in JFX,
have a look at the bug reports.

If you like make your NewtCanvasJFX findings persistent
in our bugzilla, PM me so I can give you an account.

Cheers, Sven

On 1/10/20 6:06 PM, MikeORC [via jogamp] wrote:

> Ok I figured out some things:
>
> I changed the initial block of code that sets up the window and NewtCanvasJFX
> to listen for width/height properties from the stackpane and forward them to
> Window which makes resizing work but it acts as if the initialize size is the
> minimum (see below).  The next question I have is, with NewtCanvasJFX can
> other JavaFX elements such as Slider be drawn on top of it?  Under normal
> circumstances in JavaFX it is possible to have Sliders and buttons on top of
> other things using StackPane.
>
>       glWindow = GLWindow.create(capabilities);
>       glWindow.setSize(300, 250);
>       this.glPanel = new NewtCanvasJFX(glWindow);
>       this.glPanel.setWidth(300);
>       this.glPanel.setHeight(250);
>       openGLPane.getChildren().add(0, glPanel);
>
>       glWindow.addGLEventListener(this);
>
>       this.openGLPane.widthProperty().addListener(new ChangeListener<Number>()
>       {
>         @Override
>         public void changed(ObservableValue<? extends Number> observable,
> Number oldValue, Number newValue)
>         {
>           System.out.println("resizing");
>           glWindow.setSize(newValue.intValue(), glWindow.getHeight());
>         }
>       });
>
>       this.openGLPane.heightProperty().addListener(new ChangeListener<Number>()
>       {
>         @Override
>         public void changed(ObservableValue<? extends Number> observable,
> Number oldValue, Number newValue)
>         {
>           System.out.println("resizing");
>           glWindow.setSize(glWindow.getWidth(), newValue.intValue());
>         }
>       });