diff options
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/impl/x11/glx')
10 files changed, 77 insertions, 85 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java index 475f413ba..690bc4b52 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java @@ -45,12 +45,12 @@ public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable { */ public X11DummyGLXDrawable(X11GraphicsScreen screen, GLDrawableFactory factory, GLProfile glp) { super(factory, - new NullWindow(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic( + new ProxySurface(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic( new GLCapabilities(glp), null, screen))); this.realized = true; - NullWindow nw = (NullWindow) getNativeWindow(); - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)nw.getGraphicsConfiguration().getNativeGraphicsConfiguration(); + ProxySurface ns = (ProxySurface) getNativeSurface(); + X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)ns.getGraphicsConfiguration().getNativeGraphicsConfiguration(); X11GraphicsDevice device = (X11GraphicsDevice) screen.getDevice(); long dpy = device.getHandle(); @@ -58,7 +58,7 @@ public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable { long visualID = config.getVisualID(); dummyWindow = X11Lib.CreateDummyWindow(dpy, scrn, visualID); - nw.setSurfaceHandle( dummyWindow ); + ns.setSurfaceHandle( dummyWindow ); updateHandle(); } @@ -77,7 +77,7 @@ public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable { public void destroy() { if(0!=dummyWindow) { destroyHandle(); - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration(); + X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); X11Lib.DestroyDummyWindow(config.getScreen().getDevice().getHandle(), dummyWindow); } } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java index 550bde761..76f7f6591 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -43,7 +44,7 @@ import javax.media.nativewindow.*; import javax.media.nativewindow.x11.*; import javax.media.opengl.*; import com.jogamp.opengl.impl.*; -import com.jogamp.nativewindow.impl.NullWindow; +import com.jogamp.nativewindow.impl.ProxySurface; public class X11ExternalGLXContext extends X11GLXContext { private boolean firstMakeCurrent = true; @@ -77,9 +78,9 @@ public class X11ExternalGLXContext extends X11GLXContext { GLX.glXQueryContext(display, ctx, GLX.GLX_FBCONFIG_ID, val, 0); X11GLXGraphicsConfiguration cfg = X11GLXGraphicsConfiguration.create(glp, x11Screen, val[0]); - NullWindow nw = new NullWindow(cfg); - nw.setSurfaceHandle(drawable); - return new X11ExternalGLXContext(new Drawable(factory, nw), ctx); + ProxySurface ns = new ProxySurface(cfg); + ns.setSurfaceHandle(drawable); + return new X11ExternalGLXContext(new Drawable(factory, ns), ctx); } protected boolean createImpl() { @@ -117,7 +118,7 @@ public class X11ExternalGLXContext extends X11GLXContext { // Need to provide the display connection to extension querying APIs static class Drawable extends X11GLXDrawable { - Drawable(GLDrawableFactory factory, NativeWindow comp) { + Drawable(GLDrawableFactory factory, NativeSurface comp) { super(factory, comp, true); } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java index d930179df..b83703ef1 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java @@ -42,13 +42,13 @@ package com.jogamp.opengl.impl.x11.glx; import javax.media.nativewindow.*; import javax.media.nativewindow.x11.*; import javax.media.opengl.*; -import com.jogamp.nativewindow.impl.NullWindow; +import com.jogamp.nativewindow.impl.ProxySurface; public class X11ExternalGLXDrawable extends X11GLXDrawable { - private X11ExternalGLXDrawable(GLDrawableFactory factory, NativeWindow component) { - super(factory, component, true); + private X11ExternalGLXDrawable(GLDrawableFactory factory, NativeSurface surface) { + super(factory, surface, true); } protected static X11ExternalGLXDrawable create(GLDrawableFactory factory, GLProfile glp) { @@ -83,10 +83,10 @@ public class X11ExternalGLXDrawable extends X11GLXDrawable { System.err.println("X11ExternalGLXDrawable: WARNING: forcing GLX_RGBA_TYPE for newly created contexts (current 0x"+Integer.toHexString(val[0])+")"); } } - NullWindow nw = new NullWindow(cfg); - nw.setSurfaceHandle(drawable); - nw.setSize(w, h); - return new X11ExternalGLXDrawable(factory, nw); + ProxySurface ns = new ProxySurface(cfg); + ns.setSurfaceHandle(drawable); + ns.setSize(w, h); + return new X11ExternalGLXDrawable(factory, ns); } public GLContext createContext(GLContext shareWith) { @@ -97,14 +97,6 @@ public class X11ExternalGLXDrawable extends X11GLXDrawable { throw new GLException("Should not call this"); } - public int getWidth() { - return getNativeWindow().getWidth(); - } - - public int getHeight() { - return getNativeWindow().getHeight(); - } - class Context extends X11GLXContext { Context(X11GLXDrawable drawable, GLContext shareWith) { super(drawable, shareWith); diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java index 90650bde9..494860c5b 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -130,7 +131,7 @@ public abstract class X11GLXContext extends GLContextImpl { } protected void destroyContextARBImpl(long ctx) { - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration(); + X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); long display = config.getScreen().getDevice().getHandle(); glXMakeContextCurrent(display, 0, 0, 0); @@ -139,7 +140,7 @@ public abstract class X11GLXContext extends GLContextImpl { protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) { X11GLXDrawableFactory factory = (X11GLXDrawableFactory)drawable.getFactoryImpl(); - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration(); + X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); long display = config.getScreen().getDevice().getHandle(); GLXExt glXExt; @@ -215,7 +216,7 @@ public abstract class X11GLXContext extends GLContextImpl { protected boolean createContext(boolean direct) { isDirect = false; // default X11GLXDrawableFactory factory = (X11GLXDrawableFactory)drawable.getFactoryImpl(); - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration(); + X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); long display = config.getScreen().getDevice().getHandle(); X11GLXContext other = (X11GLXContext) GLContextShareSet.getShareContext(this); @@ -328,7 +329,7 @@ public abstract class X11GLXContext extends GLContextImpl { } protected void makeCurrentImpl(boolean newCreated) throws GLException { - long dpy = drawable.getNativeWindow().getDisplayHandle(); + long dpy = drawable.getNativeSurface().getDisplayHandle(); if (GLX.glXGetCurrentContext() != contextHandle) { if (!glXMakeContextCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) { @@ -345,14 +346,14 @@ public abstract class X11GLXContext extends GLContextImpl { } protected void releaseImpl() throws GLException { - long display = drawable.getNativeWindow().getDisplayHandle(); + long display = drawable.getNativeSurface().getDisplayHandle(); if (!glXMakeContextCurrent(display, 0, 0, 0)) { throw new GLException("Error freeing OpenGL context"); } } protected void destroyImpl() throws GLException { - long display = drawable.getNativeWindow().getDisplayHandle(); + long display = drawable.getNativeSurface().getDisplayHandle(); if (DEBUG) { System.err.println("glXDestroyContext(dpy " + toHexString(display)+ @@ -368,7 +369,7 @@ public abstract class X11GLXContext extends GLContextImpl { protected void copyImpl(GLContext source, int mask) throws GLException { long dst = getHandle(); long src = source.getHandle(); - long display = drawable.getNativeWindow().getDisplayHandle(); + long display = drawable.getNativeSurface().getDisplayHandle(); if (0 == display) { throw new GLException("Connection to X display not yet set up"); } @@ -399,8 +400,8 @@ public abstract class X11GLXContext extends GLContextImpl { glXQueryExtensionsStringInitialized = true; } if (glXQueryExtensionsStringAvailable) { - NativeWindow nw = drawable.getNativeWindow(); - String ret = GLX.glXQueryExtensionsString(nw.getDisplayHandle(), nw.getScreenIndex()); + NativeSurface ns = drawable.getNativeSurface(); + String ret = GLX.glXQueryExtensionsString(ns.getDisplayHandle(), ns.getScreenIndex()); if (DEBUG) { System.err.println("!!! GLX extensions: " + ret); } @@ -414,7 +415,7 @@ public abstract class X11GLXContext extends GLContextImpl { if (glExtensionName.equals("GL_ARB_pbuffer") || glExtensionName.equals("GL_ARB_pixel_format")) { return getGLDrawable().getFactory().canCreateGLPbuffer( - drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice() ); + drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice() ); } return super.isExtensionAvailable(glExtensionName); } @@ -423,7 +424,7 @@ public abstract class X11GLXContext extends GLContextImpl { private int hasSwapIntervalSGI = 0; protected void setSwapIntervalImpl(int interval) { - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration(); + X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); GLCapabilities glCaps = (GLCapabilities) config.getChosenCapabilities(); if(!glCaps.isOnscreen()) return; diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java index 8547471fb..9c3737d3d 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -44,7 +45,7 @@ import javax.media.opengl.*; import com.jogamp.opengl.impl.*; public abstract class X11GLXDrawable extends GLDrawableImpl { - protected X11GLXDrawable(GLDrawableFactory factory, NativeWindow comp, boolean realized) { + protected X11GLXDrawable(GLDrawableFactory factory, NativeSurface comp, boolean realized) { super(factory, comp, realized); } @@ -54,7 +55,7 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { protected void setRealizedImpl() { if(realized) { - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration(); + X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); config.updateGraphicsConfiguration(); if (DEBUG) { @@ -64,7 +65,7 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { } protected void swapBuffersImpl() { - GLX.glXSwapBuffers(getNativeWindow().getDisplayHandle(), getHandle()); + GLX.glXSwapBuffers(getNativeSurface().getDisplayHandle(), getHandle()); } //--------------------------------------------------------------------------- diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java index 98be19263..2ae53fb9d 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -44,7 +45,7 @@ import javax.media.opengl.*; import com.jogamp.opengl.impl.*; import com.jogamp.common.JogampRuntimeException; import com.jogamp.common.util.*; -import com.jogamp.nativewindow.impl.NullWindow; +import com.jogamp.nativewindow.impl.ProxySurface; import com.jogamp.nativewindow.impl.x11.*; public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { @@ -164,14 +165,14 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { X11Util.shutdown( false, DEBUG ); } - public GLDrawableImpl createOnscreenDrawable(NativeWindow target) { + public GLDrawableImpl createOnscreenDrawable(NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } return new X11OnscreenGLXDrawable(this, target); } - protected GLDrawableImpl createOffscreenDrawable(NativeWindow target) { + protected GLDrawableImpl createOffscreenDrawable(NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -209,7 +210,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return ( glxVersionMajor > majorReq ) || ( glxVersionMajor == majorReq && glxVersionMinor >= minorReq ) ; } - protected GLDrawableImpl createGLPbufferDrawableImpl(final NativeWindow target) { + protected GLDrawableImpl createGLPbufferDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -238,12 +239,12 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } - protected NativeWindow createOffscreenWindow(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) { - NullWindow nw = new NullWindow(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capabilities, chooser, sharedScreen)); - if(nw != null) { - nw.setSize(width, height); + protected NativeSurface createOffscreenSurface(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) { + ProxySurface ns = new ProxySurface(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capabilities, chooser, sharedScreen)); + if(ns != null) { + ns.setSize(width, height); } - return nw; + return ns; } public GLContext createExternalGLContext() { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java index 6f24d5a60..bde65f3bb 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -54,7 +55,7 @@ public class X11OffscreenGLXContext extends X11GLXContext { } public int getOffscreenContextReadBuffer() { - GLCapabilities caps = (GLCapabilities)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities(); + GLCapabilities caps = (GLCapabilities)drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities(); if (caps.getDoubleBuffered()) { return GL.GL_BACK; } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java index 230387c1c..3be34eb6a 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -46,7 +47,7 @@ import com.jogamp.nativewindow.impl.x11.*; public class X11OffscreenGLXDrawable extends X11GLXDrawable { private long pixmap; - protected X11OffscreenGLXDrawable(GLDrawableFactory factory, NativeWindow target) { + protected X11OffscreenGLXDrawable(GLDrawableFactory factory, NativeSurface target) { super(factory, target, true); create(); } @@ -64,8 +65,8 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable { } private void create() { - NativeWindow nw = getNativeWindow(); - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration) nw.getGraphicsConfiguration().getNativeGraphicsConfiguration(); + NativeSurface ns = getNativeSurface(); + X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration) ns.getGraphicsConfiguration().getNativeGraphicsConfiguration(); XVisualInfo vis = config.getXVisualInfo(); int bitsPerPixel = vis.getDepth(); AbstractGraphicsScreen aScreen = config.getScreen(); @@ -74,7 +75,7 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable { int screen = aScreen.getIndex(); pixmap = X11Lib.XCreatePixmap(dpy, X11Lib.RootWindow(dpy, screen), - component.getWidth(), component.getHeight(), bitsPerPixel); + surface.getWidth(), surface.getHeight(), bitsPerPixel); if (pixmap == 0) { throw new GLException("XCreatePixmap failed"); } @@ -84,7 +85,7 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable { pixmap = 0; throw new GLException("glXCreateGLXPixmap failed"); } - ((SurfaceChangeable)nw).setSurfaceHandle(drawable); + ((SurfaceChangeable)ns).setSurfaceHandle(drawable); if (DEBUG) { System.err.println("Created pixmap " + toHexString(pixmap) + ", GLXPixmap " + toHexString(drawable) + @@ -95,10 +96,10 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable { public void destroy() { if (pixmap == 0) return; - NativeWindow nw = getNativeWindow(); - long display = nw.getDisplayHandle(); + NativeSurface ns = getNativeSurface(); + long display = ns.getDisplayHandle(); - long drawable = nw.getSurfaceHandle(); + long drawable = ns.getSurfaceHandle(); if (DEBUG) { System.err.println("Destroying pixmap " + toHexString(pixmap) + ", GLXPixmap " + toHexString(drawable) + @@ -124,7 +125,7 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable { X11Lib.XFreePixmap(display, pixmap); drawable = 0; pixmap = 0; - ((SurfaceChangeable)nw).setSurfaceHandle(0); + ((SurfaceChangeable)ns).setSurfaceHandle(0); display = 0; } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java index 3a8bbfecc..5243e8c46 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -48,7 +49,7 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable { long glXWindow; // GLXWindow, a GLXDrawable representation boolean useGLXWindow; - protected X11OnscreenGLXDrawable(GLDrawableFactory factory, NativeWindow component) { + protected X11OnscreenGLXDrawable(GLDrawableFactory factory, NativeSurface component) { super(factory, component, false); glXWindow=0; useGLXWindow=false; @@ -58,12 +59,12 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable { if(useGLXWindow) { return glXWindow; } - return getNativeWindow().getSurfaceHandle(); + return getNativeSurface().getSurfaceHandle(); } protected void destroyHandle() { if(0!=glXWindow) { - GLX.glXDestroyWindow(getNativeWindow().getDisplayHandle(), glXWindow); + GLX.glXDestroyWindow(getNativeSurface().getDisplayHandle(), glXWindow); glXWindow = 0; useGLXWindow=false; } @@ -72,16 +73,16 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable { /** must be locked already */ protected void updateHandle() { if(USE_GLXWINDOW) { - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration(); + X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); if(config.getFBConfig()>=0) { useGLXWindow=true; - long dpy = getNativeWindow().getDisplayHandle(); + long dpy = getNativeSurface().getDisplayHandle(); if(0!=glXWindow) { GLX.glXDestroyWindow(dpy, glXWindow); } - glXWindow = GLX.glXCreateWindow(dpy, config.getFBConfig(), getNativeWindow().getSurfaceHandle(), null, 0); + glXWindow = GLX.glXCreateWindow(dpy, config.getFBConfig(), getNativeSurface().getSurfaceHandle(), null, 0); if (DEBUG) { - System.err.println("!!! X11OnscreenGLXDrawable.setRealized(true): glXWindow: "+toHexString(getNativeWindow().getSurfaceHandle())+" -> "+toHexString(glXWindow)); + System.err.println("!!! X11OnscreenGLXDrawable.setRealized(true): glXWindow: "+toHexString(getNativeSurface().getSurfaceHandle())+" -> "+toHexString(glXWindow)); } if(0==glXWindow) { throw new GLException("X11OnscreenGLXDrawable.setRealized(true): GLX.glXCreateWindow() failed: "+this); @@ -93,12 +94,4 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable { public GLContext createContext(GLContext shareWith) { return new X11OnscreenGLXContext(this, shareWith); } - - public int getWidth() { - return component.getWidth(); - } - - public int getHeight() { - return component.getHeight(); - } } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java index c00f9909e..ce9e6d75d 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -43,14 +44,14 @@ import javax.media.opengl.*; import javax.media.nativewindow.*; public class X11PbufferGLXDrawable extends X11GLXDrawable { - protected X11PbufferGLXDrawable(GLDrawableFactory factory, NativeWindow target) { + protected X11PbufferGLXDrawable(GLDrawableFactory factory, NativeSurface target) { /* GLCapabilities caps, GLCapabilitiesChooser chooser, int width, int height */ super(factory, target, true); if (DEBUG) { - System.out.println("Pbuffer config: " + getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration()); + System.out.println("Pbuffer config: " + getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration()); } createPbuffer(); @@ -73,15 +74,15 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { } public void destroy() { - NativeWindow nw = getNativeWindow(); - if (nw.getSurfaceHandle() != 0) { - GLX.glXDestroyPbuffer(nw.getDisplayHandle(), nw.getSurfaceHandle()); + NativeSurface ns = getNativeSurface(); + if (ns.getSurfaceHandle() != 0) { + GLX.glXDestroyPbuffer(ns.getDisplayHandle(), ns.getSurfaceHandle()); } - ((SurfaceChangeable)nw).setSurfaceHandle(0); + ((SurfaceChangeable)ns).setSurfaceHandle(0); } private void createPbuffer() { - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration) getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration(); + X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration) getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); AbstractGraphicsScreen aScreen = config.getScreen(); AbstractGraphicsDevice aDevice = aScreen.getDevice(); long display = aDevice.getHandle(); @@ -91,7 +92,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { throw new GLException("Null display"); } - NativeWindow nw = getNativeWindow(); + NativeSurface ns = getNativeSurface(); GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities(); @@ -108,9 +109,9 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { int[] iattributes = new int[5]; iattributes[niattribs++] = GLX.GLX_PBUFFER_WIDTH; - iattributes[niattribs++] = nw.getWidth(); + iattributes[niattribs++] = ns.getWidth(); iattributes[niattribs++] = GLX.GLX_PBUFFER_HEIGHT; - iattributes[niattribs++] = nw.getHeight(); + iattributes[niattribs++] = ns.getHeight(); iattributes[niattribs++] = 0; long pbuffer = GLX.glXCreatePbuffer(display, config.getFBConfig(), iattributes, 0); @@ -120,7 +121,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { } // Set up instance variables - ((SurfaceChangeable)nw).setSurfaceHandle(pbuffer); + ((SurfaceChangeable)ns).setSurfaceHandle(pbuffer); // Determine the actual width and height we were able to create. int[] tmp = new int[1]; @@ -128,7 +129,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { int width = tmp[0]; GLX.glXQueryDrawable(display, pbuffer, GLX.GLX_HEIGHT, tmp, 0); int height = tmp[0]; - ((SurfaceChangeable)nw).setSize(width, height); + ((SurfaceChangeable)ns).setSize(width, height); } public int getFloatingPointMode() { |