discrepancy in viewport size under El Capitan

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

discrepancy in viewport size under El Capitan

camac
Shouldn’t GLCanvas#getWidth() produce the same result as GLAutoDrawable#getSurfaceWidth()? When I compare the output from these methods, I find the former to be exactly a factor of 2 smaller than the latter. The same is true for GLCanvas#getHeight() and GLAutoDrawable#getSurfaceHeight(). I’m running JOGL 2.3.2 on a MacBook Pro under OS X El Capitan 10.11.6 (latest version). The GLCanvas is instantiated using the default constructor with no arguments. What am I missing here?
 
Curt Moyer
[hidden email]



Reply | Threaded
Open this post in threaded view
|

Re: discrepancy in viewport size under El Capitan

gouessej
Administrator
Hi

No they shouldn't because of HiDPI. getWidth() returns the width of the client area in window units whereas getSurfaceWidth() returns the width of the client area in pixel units.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

discrepancy in viewport size under El Capitan

camac
In reply to this post by camac
Thanks Julien for the quick response; the Retina display on my MacBook Pro was indeed the culprit. But that leads to the obvious question: does Java (or Jogl) provide support for detecting a Retina or other hiDPI display and identifying the appropriate scale factor? I’m sure others have encountered the same issue, but my Google searches so far have been of limited value. Can you point me in the right direction?

Curt Moyer
[hidden email]



Reply | Threaded
Open this post in threaded view
|

Re: discrepancy in viewport size under El Capitan

gouessej
Administrator
Of course, it does and I advise you to look at the Java documentation of our API instead of making inaccurate searches with a search engine. Look at ScalableSurface, this interface is implemented by numerous canvases and windows:
http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/nativewindow/ScalableSurface.html
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

discrepancy in viewport size under El Capitan

camac
In reply to this post by camac
You are correct to suggest that I should have explored the JOGL API before raising the question here; sorry for that. I believe I have all that I need for now, so thanks again for your help.

Curt Moyer
[hidden email]



Reply | Threaded
Open this post in threaded view
|

Re: discrepancy in viewport size under El Capitan

gouessej
Administrator
I hope that I didn't hurt you, sorry. Your question was too much specific to be answered by a search engine in my humble opinion.
Julien Gouesse | Personal blog | Website