Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
5 posts
|
I'm just learning OpenGL using JOGL and, after dozens of hours of debugging, I think I found a bug..
When using the window scaling feature of windows (usefull for small high-resolution screens, laptops, ..) and Java 9 or 10 (Java 8 works fine though) the AWT Frame scales (when using 125% scaling a 500x500 Frame will be 625x625) but the GLCanvas doesnt. Java 8, everything works as expected: https://prnt.sc/kjf9fp Java 10, the window is 25% larger and has a nasty black border at the right and the top: https://prnt.sc/kjf9zq Is this a known bug? Does anyone know of a workaround? |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
5 posts
|
If it was possible to get the scaling factor (or the "true" size of the window), I could do something like
glViewport(0, 0, width * scalingFactor, height * scalingFactor) |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
6038 posts
|
In reply to this post by nyxcode
Hello
You can simply disable the HiDPI support by setting the system property "sun.java2d.dpiaware" to false (or use "-Dsun.java2d.dpiaware=false" as a VM argument).
Julien Gouesse | Personal blog | Website
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
5 posts
|
Thanks for your response!
I tried your suggestion with HotSpot build 10.0.2+13 and OpenJDK Zulu build 9.0.7.1+1 - both without success. Am I missing something? I have read multiple times that this system property did not work on 1.8 - which is confusing since I didn't have any problems with 1.8. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
6038 posts
|
You have to set it very early to give it a chance to work, it's mentioned in the source code in sun.java2d.windows.WindowsFlags. How did you try it?
Edit.: The flag still exists in the source code and works with Java 1.10.
Julien Gouesse | Personal blog | Website
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
5 posts
|
I am not sure what part of the source you are refering to.. I couldn't find any instructions there.. Could you clarify what you mean with "very early"?
So far I have set the flag through a vm parameter - System.getProperty() confirms that it has been set successfully. Edit: this worked out for me. I would definetly prefer an other solution though.. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
6038 posts
|
I'm referring to the source code of OpenJDK.
Thank you for sharing your workaround. I see no other solution for now, xerxes mentioned some changes we have to do in JOGL to take into account HiDPI under Windows, I wrongly assumed that it was already done, it's not trivial, we have to use two different APIs to handle HiDPI under Windows >= 10 and Windows < 10.
Julien Gouesse | Personal blog | Website
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
5 posts
|
Ah - I almost thought I was too stupid to pass a VM flag ^^
Thanks for investigating this. I'll stick with 1.8 (using Kotlin anyways) for now! |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
6038 posts
|
By the way, AdoptOpenJDK provides OpenJDK builds too, I use their OpenJDK 1.8 builds for my own projects.
Julien Gouesse | Personal blog | Website
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
318 posts
|
Hi!
I am having a similar problem : my application running on windows 10+jre 10 is scaled by HiDPI. As describe in this jzy3d issue, I wasn't able to avoid scaling with the JVM flag mentionned above. I was however able to remove the buggy scaling using Windows configuration (see my post). This Windows configuration workaround is not satisfying for me since it desactivates HiDPI for the complete application, I hence loose all rendering improvements on widgets, text, etc. Is there a mean to avoid inappropriate GL scaling for the GL canvas only - without changing whole the application? Thanks in advance, Martin |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
26 posts
|
This post was updated on Apr 03, 2019; 1:55pm.
Hello Martin,
which canvas do you use. I was able to workaround the scaling issues (OpenJDK 12) on NewtCanvasSWT by introduce an SWT scaling. I also patched the SWT_AWT class for Windows introducing a wrong layout, see (only 200% but not 150% works in SWT): https://bugs.eclipse.org/bugs/show_bug.cgi?id=545265 You might also play with the following java vm arg settings to scale Swing/Awt (AWT has still some issues): -Dsun.java2d.uiScale=2.0 see (in one answer): https://superuser.com/questions/988379/how-do-i-run-java-apps-upscaled-on-a-high-dpi-display It might be that the GLCanvas (client area) must be scaled, too, to make an appropriate layout, see: https://github.com/sgothel/jogl/blob/master/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java As afore mentioned on SWT I did this with the Dpi API: DPIUtil.autoScaleUp(getClientArea()); which I thin only allows 200%, 300% settings so a zoom factor would be more appropriate. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
318 posts
|
Thanks you for these hints!
I am using the AWT GLCanvas. Do you have a similar solution for non SWT canvases? The DPIUtil class seem to work in SWT only environments? To my memory, NewtCanvasAwt was attempted as an alternative but had the same problem. I need to verify that point. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
6038 posts
|
There is no miraculous solution. HiDPI isn't handled correctly within JOGL on some platforms including Windows. Don't expect a quick fix, sorry.
Julien Gouesse | Personal blog | Website
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
2 posts
|
I would like to ask about plans for fixing this issue for AWT GLCanvas and GLJPanel in next release.
Thank you Martin |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
6038 posts
|
Hello
As far as I understand, some problems on HiDPI will only be solved in JOGL 2.5, not in JOGL 2.4.
Julien Gouesse | Personal blog | Website
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
2933 posts
|
On 5/23/19 7:25 PM, gouessej [via jogamp] wrote:
> Hello > > As far as I understand, some problems on HiDPI will only be solved in JOGL > 2.5, not in JOGL 2.4. As this seems to have been fixed in Java 11, yes. It will be squeezed into the next cycles (read: ~4-6 weeks). ~Sven |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
41 posts
|
Is it possible to disable dpi-scaling for a specific JPanel, but leave the scaling enabled for the rest of the GUI? I'm having this same problem, and if there is a way to tell Swing to handle a JPanel in the "dumb, give me true pixels" kind of way, that would be a decent work around.
-Farrell |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
6038 posts
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
41 posts
|
In reply to this post by farrellf
I found a work around. For anyone that finds this thread in the future, see my reply here:
http://forum.jogamp.org/canvas-not-filling-frame-tp4040092p4040138.html |
Free forum by Nabble | Edit this page |