diff options
author | Sven Gothel <[email protected]> | 2014-05-21 08:53:54 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-05-21 08:53:54 +0200 |
commit | f9a00b91dcd146c72a50237b62270f33bd0da98e (patch) | |
tree | f4387da868608cea5066ce3a8cb9039a16b529de /src/jogl/classes/jogamp/opengl/GLDrawableHelper.java | |
parent | 0ffba122ea5c4b8cc247234ca9f48ccfcce833cd (diff) |
Bug 742 HiDPI: [Core API Change] Distinguish window-units and pixel-units; Add HiDPI for AWT GLCanvas w/ OSX CALayer
Core API Change:
To support HiDPI thoroughly in JOGL (NativeWindow, JOGL, NEWT)
we need to separate window- and pixel units.
NativeWindow and NativeSurface now have distinguished
access methods for window units and pixel units.
NativeWindow: Using window units
- getWindowWidth() * NEW Method *
- getWindowHeight() * NEW Method *
- getX(), getY(), ...
NativeSurface: Using pixel units
- getWidth() -> getSurfaceWidth() * RENAMED *
- getHeight() -> getSurfaceHeight() * RENAMED *
GLDrawable: Using pixel units
- getWidth() -> getSurfaceWidth() * RENAMED, aligned w/ NativeSurface *
- getHeight() -> getSurfaceHeight() * RENAMED, aligned w/ NativeSurface *
Above changes also removes API collision w/ other windowing TK,
e.g. AWT's getWidth()/getHeight() in GLCanvas
and the same method names in GLDrawable before this change.
+++
Now preliminary 'working':
- AWT GLCanvas
- AWT GLJPanel
Tested manually on OSX w/ and w/o HiDPI Retina:
java com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT -manual -noanim -time 1000000
java com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT -manual -noanim -time 1000000
+++
TODO:
- NEWT
- Change Window.setSize(..) to use pixel units ?
- OSX HiDPI support
- Testing ..
- API refinement
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLDrawableHelper.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLDrawableHelper.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java index 0e135d5e0..6116a2886 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java @@ -362,7 +362,7 @@ public class GLDrawableHelper { final ProxySurface ps = (ProxySurface) ns; final UpstreamSurfaceHook ush = ps.getUpstreamSurfaceHook(); if(ush instanceof UpstreamSurfaceHook.MutableSize) { - ((UpstreamSurfaceHook.MutableSize)ush).setSize(newWidth, newHeight); + ((UpstreamSurfaceHook.MutableSize)ush).setPixelSize(newWidth, newHeight); } else if(DEBUG) { // we have to assume UpstreamSurfaceHook contains the new size already, hence size check @ bottom System.err.println("GLDrawableHelper.resizeOffscreenDrawable: Drawable's offscreen ProxySurface n.a. UpstreamSurfaceHook.MutableSize, but "+ush.getClass().getName()+": "+ush); } @@ -379,7 +379,7 @@ public class GLDrawableHelper { } finally { ns.unlockSurface(); } - if( validateSize && ( drawable.getWidth() != newWidth || drawable.getHeight() != newHeight ) ) { + if( validateSize && ( drawable.getSurfaceWidth() != newWidth || drawable.getSurfaceHeight() != newHeight ) ) { throw new InternalError("Incomplete resize operation: expected "+newWidth+"x"+newHeight+", has: "+drawable); } return drawable; @@ -616,7 +616,7 @@ public class GLDrawableHelper { private final void init(GLEventListener l, GLAutoDrawable drawable, boolean sendReshape, boolean setViewport) { l.init(drawable); if(sendReshape) { - reshape(l, drawable, 0, 0, drawable.getWidth(), drawable.getHeight(), setViewport, false /* checkInit */); + reshape(l, drawable, 0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), setViewport, false /* checkInit */); } } @@ -640,7 +640,7 @@ public class GLDrawableHelper { } } else { // Expose same GL initialization if not using GLEventListener - drawable.getGL().glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); + drawable.getGL().glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); } } } |