From ed33158d3330dfe2287af5bfaf5aea99f199887c Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 9 Nov 2011 17:19:36 +0100 Subject: Cleanup offscreen/pbuffer drawables - minor edits --- .../jogamp/opengl/egl/EGLPbufferDrawable.java | 34 +++++++++------------- .../macosx/cgl/MacOSXOffscreenCGLDrawable.java | 6 ++-- .../macosx/cgl/MacOSXOnscreenCGLDrawable.java | 1 - .../macosx/cgl/MacOSXPbufferCGLDrawable.java | 12 +++----- .../windows/wgl/WindowsPbufferWGLDrawable.java | 12 +++----- .../opengl/x11/glx/X11PbufferGLXDrawable.java | 9 +++--- 6 files changed, 28 insertions(+), 46 deletions(-) (limited to 'src/jogl') diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java index 256007834..be6c80c41 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java @@ -40,48 +40,40 @@ package jogamp.opengl.egl; +import javax.media.nativewindow.AbstractGraphicsConfiguration; import javax.media.nativewindow.NativeSurface; import javax.media.nativewindow.SurfaceChangeable; import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLContext; import javax.media.opengl.GLException; -import jogamp.opengl.x11.glx.GLX; - public class EGLPbufferDrawable extends EGLDrawable { private int texFormat; protected static final boolean useTexture = false; // No yet .. protected EGLPbufferDrawable(EGLDrawableFactory factory, NativeSurface target) { super(factory, target); + setRealized(true); + } - // get choosen ones .. - GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) - getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities(); + protected void destroyImpl() { + setRealized(false); + } + + protected long createSurface(long eglDpy, long eglNativeCfg, long surfaceHandle) { + final AbstractGraphicsConfiguration config = getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); + final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); if(useTexture) { - this.texFormat = caps.getAlphaBits() > 0 ? EGL.EGL_TEXTURE_RGBA : EGL.EGL_TEXTURE_RGB ; + texFormat = caps.getAlphaBits() > 0 ? EGL.EGL_TEXTURE_RGBA : EGL.EGL_TEXTURE_RGB ; } else { - this.texFormat = EGL.EGL_NO_TEXTURE; - } - - if (DEBUG) { - System.out.println("Pbuffer config: " + getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration()); + texFormat = EGL.EGL_NO_TEXTURE; } - setRealized(true); - if (DEBUG) { - System.out.println("Created pbuffer: " + this); + System.out.println("Pbuffer config: " + config); } - } - - protected void destroyImpl() { - setRealized(false); - } - - protected long createSurface(long eglDpy, long eglNativeCfg, long surfaceHandle) { NativeSurface nw = getNativeSurface(); int[] attrs = EGLGraphicsConfiguration.CreatePBufferSurfaceAttribList(nw.getWidth(), nw.getHeight(), texFormat); long surf = EGL.eglCreatePbufferSurface(eglDpy, eglNativeCfg, attrs, 0); diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java index 29a448980..ae3fa1428 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java @@ -40,9 +40,9 @@ package jogamp.opengl.macosx.cgl; -import javax.media.opengl.*; -import javax.media.nativewindow.*; -import jogamp.opengl.*; +import javax.media.nativewindow.NativeSurface; +import javax.media.opengl.GLContext; +import javax.media.opengl.GLDrawableFactory; public class MacOSXOffscreenCGLDrawable extends MacOSXPbufferCGLDrawable { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java index c1f793c0b..80c54042f 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java @@ -44,7 +44,6 @@ import javax.media.nativewindow.NativeSurface; import javax.media.opengl.GLContext; import javax.media.opengl.GLDrawableFactory; - public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable { protected MacOSXOnscreenCGLDrawable(GLDrawableFactory factory, NativeSurface component) { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java index 5c4c3907c..5e831ed59 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java @@ -77,17 +77,9 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { public MacOSXPbufferCGLDrawable(GLDrawableFactory factory, NativeSurface target, boolean realizeNow) { super(factory, target, false); - if (DEBUG) { - System.out.println("Pbuffer config: " + getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration()); - } - if(realizeNow) { setRealized(true); } - - if (DEBUG) { - System.err.println("Created pbuffer " + this); - } } protected void destroyImpl() { @@ -139,6 +131,10 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { final GLProfile glProfile = capabilities.getGLProfile(); MacOSXCGLDrawableFactory.SharedResource sr = ((MacOSXCGLDrawableFactory)factory).getOrCreateOSXSharedResource(config.getScreen().getDevice()); + if (DEBUG) { + System.out.println("Pbuffer config: " + config); + } + if ( capabilities.getPbufferRenderToTextureRectangle() && null!=sr && sr.isRECTTextureAvailable() ) { pBufferTexTarget = GL2.GL_TEXTURE_RECTANGLE; } else { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java index e34301328..7181a5d3c 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -65,15 +65,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { protected WindowsPbufferWGLDrawable(GLDrawableFactory factory, NativeSurface target) { super(factory, target, false); - if (DEBUG) { - System.out.println("Pbuffer config: " + getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration()); - } - setRealized(true); - - if (DEBUG) { - System.err.println("Created pbuffer " + this); - } } protected void destroyImpl() { @@ -130,6 +122,10 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { long parentHdc = sharedResource.getDrawable().getNativeSurface().getSurfaceHandle(); WGLExt wglExt = sharedResource.getContext().getWGLExt(); + if (DEBUG) { + System.out.println("Pbuffer config: " + config); + } + int[] iattributes = new int [2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS]; float[] fattributes = new float[1]; int[] floatModeTmp = new int[1]; diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java index 77598e011..885890892 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java @@ -50,10 +50,6 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { int width, int height */ super(factory, target, false); - if (DEBUG) { - System.out.println("Pbuffer config: " + getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration()); - } - setRealized(true); if (DEBUG) { @@ -90,7 +86,10 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { AbstractGraphicsScreen aScreen = config.getScreen(); AbstractGraphicsDevice aDevice = aScreen.getDevice(); long display = aDevice.getHandle(); - int screen = aScreen.getIndex(); + + if (DEBUG) { + System.out.println("Pbuffer config: " + config); + } if (display==0) { throw new GLException("Null display"); -- cgit v1.2.3