diff options
Diffstat (limited to 'src/classes/com/sun/opengl/impl/x11/glx')
5 files changed, 26 insertions, 21 deletions
diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java index 702ceb7b4..229686428 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java @@ -49,10 +49,9 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { protected GLCapabilitiesChooser chooser; protected X11GLXDrawable(GLDrawableFactory factory, NativeWindow comp, boolean realized, - GLCapabilities capabilities, + GLCapabilities requestedCapabilities, GLCapabilitiesChooser chooser) { - super(factory, comp, realized); - setChosenGLCapabilities(capabilities); + super(factory, comp, requestedCapabilities, realized); this.chooser = chooser; } @@ -89,7 +88,6 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { System.err.println("!!! Fetched XVisualInfo for visual ID 0x" + Long.toHexString(visualID)); System.err.println("!!! Resulting XVisualInfo: visualid = 0x" + Long.toHexString(infos[0].visualid())); } - // FIXME: the storage for the infos array is leaked (should // clean it up somehow when we're done with the visual we're // returning) @@ -120,7 +118,7 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { } finally { getFactory().unlockToolkit(); } - GLCapabilities capabilities = getCapabilities(); + GLCapabilities capabilities = getRequestedGLCapabilities(); int chosen = chooser.chooseCapabilities(capabilities, caps, -1); if (chosen < 0 || chosen >= caps.length) { throw new GLException("GLCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")"); diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java index 008cb9c2b..85e0ecc21 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java @@ -176,8 +176,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { Runnable r = new Runnable() { public void run() { X11PbufferGLXDrawable pbufferDrawable = new X11PbufferGLXDrawable(factory, capabilities, - initialWidth, - initialHeight); + initialWidth, + initialHeight); GLPbufferImpl pbuffer = new GLPbufferImpl(pbufferDrawable, shareWith); returnList.add(pbuffer); } diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java b/src/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java index 74b2191ab..9289d7c02 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java @@ -48,9 +48,9 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable { private boolean isDoubleBuffered; protected X11OffscreenGLXDrawable(GLDrawableFactory factory, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser) { - super(factory, new NullWindow(), true, capabilities, chooser); + GLCapabilities requestedCapabilities, + GLCapabilitiesChooser chooser) { + super(factory, new NullWindow(), true, requestedCapabilities, chooser); } public GLContext createContext(GLContext shareWith) { diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java b/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java index 107eba9d2..bc25594b6 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java @@ -81,4 +81,8 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable { } } + // This is public to allow access from the DrawableFactory + protected void setChosenGLCapabilities(GLCapabilities caps) { + super.setChosenGLCapabilities(caps); + } } diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java b/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java index 06aeba0b6..36422c994 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java @@ -52,9 +52,10 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { protected static final int MAX_PFORMATS = 256; protected static final int MAX_ATTRIBS = 256; - protected X11PbufferGLXDrawable(GLDrawableFactory factory, GLCapabilities capabilities, + protected X11PbufferGLXDrawable(GLDrawableFactory factory, + GLCapabilities requestedCapabilities, int initialWidth, int initialHeight) { - super(factory, new NullWindow(), true, capabilities, null); + super(factory, new NullWindow(), true, requestedCapabilities, null); if (initialWidth <= 0 || initialHeight <= 0) { throw new GLException("Initial width and height of pbuffer must be positive (were (" + initialWidth + ", " + initialHeight + "))"); @@ -63,10 +64,10 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { nw.setSize(initialWidth, initialHeight); if (DEBUG) { - System.out.println("Pbuffer caps on init: " + capabilities + - (capabilities.getPbufferRenderToTexture() ? " [rtt]" : "") + - (capabilities.getPbufferRenderToTextureRectangle() ? " [rect]" : "") + - (capabilities.getPbufferFloatingPointBuffers() ? " [float]" : "")); + System.out.println("Pbuffer caps on init: " + requestedCapabilities + + (requestedCapabilities.getPbufferRenderToTexture() ? " [rtt]" : "") + + (requestedCapabilities.getPbufferRenderToTextureRectangle() ? " [rect]" : "") + + (requestedCapabilities.getPbufferFloatingPointBuffers() ? " [float]" : "")); } nw.setDisplayHandle(X11GLXDrawableFactory.getDisplayConnection()); @@ -99,7 +100,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { createPbuffer(); } - public void createPbuffer() { + private void createPbuffer() { getFactory().lockToolkit(); try { NullWindow nw = (NullWindow) getNativeWindow(); @@ -110,15 +111,17 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { int screen = X11Lib.DefaultScreen(display); nw.setScreenIndex(screen); - if (getCapabilities().getPbufferRenderToTexture()) { + GLCapabilities capabilities = getRequestedGLCapabilities(); + + if (capabilities.getPbufferRenderToTexture()) { throw new GLException("Render-to-texture pbuffers not supported yet on X11"); } - if (getCapabilities().getPbufferRenderToTextureRectangle()) { + if (capabilities.getPbufferRenderToTextureRectangle()) { throw new GLException("Render-to-texture-rectangle pbuffers not supported yet on X11"); } - int[] iattributes = X11GLXDrawableFactory.glCapabilities2AttribList(getCapabilities(), + int[] iattributes = X11GLXDrawableFactory.glCapabilities2AttribList(capabilities, ((X11GLXDrawableFactory)getFactory()).isMultisampleAvailable(), true, display, screen); @@ -171,7 +174,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { // Pick innocent query values if multisampling or floating point buffers not available int sbAttrib = ((X11GLXDrawableFactory)getFactory()).isMultisampleAvailable() ? GLXExt.GLX_SAMPLE_BUFFERS: GLX.GLX_RED_SIZE; int samplesAttrib = ((X11GLXDrawableFactory)getFactory()).isMultisampleAvailable() ? GLXExt.GLX_SAMPLES: GLX.GLX_RED_SIZE; - int floatNV = getCapabilities().getPbufferFloatingPointBuffers() ? GLXExt.GLX_FLOAT_COMPONENTS_NV : GLX.GLX_RED_SIZE; + int floatNV = capabilities.getPbufferFloatingPointBuffers() ? GLXExt.GLX_FLOAT_COMPONENTS_NV : GLX.GLX_RED_SIZE; // Query the fbconfig to determine its GLCapabilities int[] iattribs = { |