GLcanvas vs NEWT on Hi DPI Screens

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

GLcanvas vs NEWT on Hi DPI Screens

mahesh
I am using JOGL 2.4 for my java application. I runs fine on default 80/90dpi screen, but on hi dpi screen I made following observations.
Currenly App runs on Java8 with dpiaware flag set to false, but on high dpi screens, swing UI as well as Graphics on opengl appear blurry, which is obvious due to scaling.


If I switch to java 9, Swing UI renders fine on high dpi screens but NEWT canvas window shrinks to quarter of screen (since pixelScaleFractor =2 in this case). Even scaling viewport has no effect on it. I think there is some problem with NEWT Canvas implementation (atleast on windows) which does't let canvas fill up whole space.


I tested by replacing NewtWindow with GLCanvas on Java9, it fills entire space, just I need to scale the GL viewport dimensions by pixel ScaleFactor.


Now there seem to be 2 solutions
1. Replace NEWT with GLcanvas, whcih will need rewriting mouse , key events listeners, adjusting framebuffers etc, but I will lose advantages of NEWT like mutitouch and some performace gains.
2. Wait for NEWT implemenation to be fixed (for windows in particular)


Is there some other solution or workaround?
Is there any plan of providing a fix for NEWT?
Reply | Threaded
Open this post in threaded view
|

Re: GLcanvas vs NEWT on Hi DPI Screens

gouessej
Administrator
Hello

Please fill a bug report. Have you tried to modify the pixel scale to work around this problem?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLcanvas vs NEWT on Hi DPI Screens

mahesh
This post was updated on .
Have you tried to modify the pixel scale to work around this problem?
gouessej wrote
 Have you tried to modify the pixel scale to work around this problem?
Yes I used that but it works in GLCanvas but not in NEWTCanvas (my machine is windows surface pro 6).
I looked into several discussions in the forum, but could't conclude if NEWTcanvas deals with highdpi on windows or not.

The problem is, not getting pixelScale but NEWTCanvas is not resizing to fill the whole window. For pixelScale=2 (hihdpi monitor), it is filled in just 1/4th part. For pixelScale=1 (normal monitor) it fills completely. Is it a known bug?





Reply | Threaded
Open this post in threaded view
|

Re: GLcanvas vs NEWT on Hi DPI Screens

gouessej
Administrator
Please comment the following bug:
https://jogamp.org/bugzilla/show_bug.cgi?id=1374
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLcanvas vs NEWT on Hi DPI Screens

mahesh
This post was updated on .
Would you please create bugzilla account for my Mail:
ma*******010@gamil.com
Reply | Threaded
Open this post in threaded view
|

Re: GLcanvas vs NEWT on Hi DPI Screens

gouessej
Administrator
Please send me an email so that I can give you your password in return. Don't post your email address here, some spam bots will see it :s
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLcanvas vs NEWT on Hi DPI Screens

mahesh
In reply to this post by mahesh
I have two workarounds which work fine with JDK9 and windows 10.
1. Set layout as null, and manually scale dimesions of canvas by pixelScaleFactor.
2. Override getPreferredSize() ,getWidth() and getHeight() of NewtAwtCanvas and return scaled dimensions.

Associated test snippet can be found here.
https://gist.github.com/maheshkurmi/e984430d33236b6bfb7c3de0f8a1a0e5
Reply | Threaded
Open this post in threaded view
|

Re: GLcanvas vs NEWT on Hi DPI Screens

gouessej
Administrator
Don't forget to mention it in a bug report.
Julien Gouesse | Personal blog | Website