Login  Register

Re: Pixel scale change notification

Posted by Martin on May 31, 2021; 5:53pm
URL: https://forum.jogamp.org/Pixel-scale-change-notification-tp4041118p4041149.html

Hi,

I ended by adding a ScheduledThreadExecutor that watches the GLCanvas surface width / height every second.  

Here is an example of how I did it in Jzy3D where the canvas owner fires a pixel scale change event to its listeners.

This allows updating everything that may be impacted by a change in pixel scale : resize text to keep it the same size visually, change the image used in overlays so that they do not look shrinking or bumping as soon as the application moves from a HiDPI screen to a non HiDPI screen.

This works well at the cost of an additional thread. I am interested by any improvement suggestion!