From f9a00b91dcd146c72a50237b62270f33bd0da98e Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 21 May 2014 08:53:54 +0200 Subject: 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 --- src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java | 4 ++-- src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java | 4 ++-- src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/x11/glx') diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java index ff9363ca0..45c666230 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java @@ -141,12 +141,12 @@ public class X11ExternalGLXContext extends X11GLXContext { } @Override - public int getWidth() { + public int getSurfaceWidth() { throw new GLException("Should not call this"); } @Override - public int getHeight() { + public int getSurfaceHeight() { throw new GLException("Should not call this"); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java index 0e771fd0f..ae2982269 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java @@ -105,9 +105,9 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { IntBuffer iattributes = Buffers.newDirectIntBuffer(7); iattributes.put(niattribs++, GLX.GLX_PBUFFER_WIDTH); - iattributes.put(niattribs++, ms.getWidth()); + iattributes.put(niattribs++, ms.getSurfaceWidth()); iattributes.put(niattribs++, GLX.GLX_PBUFFER_HEIGHT); - iattributes.put(niattribs++, ms.getHeight()); + iattributes.put(niattribs++, ms.getSurfaceHeight()); iattributes.put(niattribs++, GLX.GLX_LARGEST_PBUFFER); // exact iattributes.put(niattribs++, 0); iattributes.put(niattribs++, 0); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java index c1388db8a..42d76097c 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java @@ -83,7 +83,7 @@ public class X11PixmapGLXDrawable extends X11GLXDrawable { int screen = aScreen.getIndex(); pixmap = X11Lib.XCreatePixmap(dpy, X11Lib.RootWindow(dpy, screen), - surface.getWidth(), surface.getHeight(), bitsPerPixel); + surface.getSurfaceWidth(), surface.getSurfaceHeight(), bitsPerPixel); if (pixmap == 0) { throw new GLException("XCreatePixmap failed"); } -- cgit v1.2.3