aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/util
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-05-21 08:53:54 +0200
committerSven Gothel <[email protected]>2014-05-21 08:53:54 +0200
commitf9a00b91dcd146c72a50237b62270f33bd0da98e (patch)
treef4387da868608cea5066ce3a8cb9039a16b529de /src/jogl/classes/com/jogamp/opengl/util
parent0ffba122ea5c4b8cc247234ca9f48ccfcce833cd (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/com/jogamp/opengl/util')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java14
3 files changed, 15 insertions, 15 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java
index 25a012bb9..2b4795aaa 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java
@@ -154,13 +154,13 @@ public class GLReadBufferUtil {
public boolean readPixels(GL gl, int inX, int inY, int inWidth, int inHeight, boolean mustFlipVertically) {
final GLDrawable drawable = gl.getContext().getGLReadDrawable();
final int width, height;
- if( 0 >= inWidth || drawable.getWidth() < inWidth ) {
- width = drawable.getWidth();
+ if( 0 >= inWidth || drawable.getSurfaceWidth() < inWidth ) {
+ width = drawable.getSurfaceWidth();
} else {
width = inWidth;
}
- if( 0 >= inHeight || drawable.getHeight() < inHeight ) {
- height = drawable.getHeight();
+ if( 0 >= inHeight || drawable.getSurfaceHeight() < inHeight ) {
+ height = drawable.getSurfaceHeight();
} else {
height= inHeight;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java
index 9490e041b..3c5d6be2d 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java
@@ -87,13 +87,13 @@ public class AWTGLReadBufferUtil extends GLReadBufferUtil {
public BufferedImage readPixelsToBufferedImage(GL gl, int inX, int inY, int inWidth, int inHeight, boolean awtOrientation) {
final GLDrawable drawable = gl.getContext().getGLReadDrawable();
final int width, height;
- if( 0 >= inWidth || drawable.getWidth() < inWidth ) {
- width = drawable.getWidth();
+ if( 0 >= inWidth || drawable.getSurfaceWidth() < inWidth ) {
+ width = drawable.getSurfaceWidth();
} else {
width = inWidth;
}
- if( 0 >= inHeight || drawable.getHeight() < inHeight ) {
- height = drawable.getHeight();
+ if( 0 >= inHeight || drawable.getSurfaceHeight() < inHeight ) {
+ height = drawable.getSurfaceHeight();
} else {
height= inHeight;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java
index 931f59869..1ad7b9987 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java
@@ -119,7 +119,7 @@ public class Overlay {
*/
public void drawAll() throws GLException {
beginRendering();
- draw(0, 0, drawable.getWidth(), drawable.getHeight());
+ draw(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
endRendering();
}
@@ -130,7 +130,7 @@ public class Overlay {
@throws GLException If an OpenGL context is not current when this method is called
*/
public void beginRendering() throws GLException {
- renderer.beginOrthoRendering(drawable.getWidth(), drawable.getHeight());
+ renderer.beginOrthoRendering(drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
}
/** Ends the OpenGL rendering process for the overlay. This is
@@ -198,13 +198,13 @@ public class Overlay {
private void validateRenderer() {
if (renderer == null) {
- renderer = new TextureRenderer(drawable.getWidth(),
- drawable.getHeight(),
+ renderer = new TextureRenderer(drawable.getSurfaceWidth(),
+ drawable.getSurfaceHeight(),
true);
contentsLost = true;
- } else if (renderer.getWidth() != drawable.getWidth() ||
- renderer.getHeight() != drawable.getHeight()) {
- renderer.setSize(drawable.getWidth(), drawable.getHeight());
+ } else if (renderer.getWidth() != drawable.getSurfaceWidth() ||
+ renderer.getHeight() != drawable.getSurfaceHeight()) {
+ renderer.setSize(drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
contentsLost = true;
} else {
contentsLost = false;