diff options
author | Kenneth Russel <[email protected]> | 2008-12-13 01:45:22 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2008-12-13 01:45:22 +0000 |
commit | 638507b43021bc7635844ba38ea4db4e1ab5ef87 (patch) | |
tree | 8c36e1d72bde729cd0fc3e403b0de82adb34a81e /src | |
parent | bceba0ee1c30b6cfcf54d973c0bf25e09b5ce74d (diff) |
Fixed initialization of chosen GLCapabilities on X11 platforms for
on-screen GLDrawables
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1818 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src')
-rw-r--r-- | src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java | 11 | ||||
-rw-r--r-- | src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java | 6 |
2 files changed, 12 insertions, 5 deletions
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 85e0ecc21..22ba775ec 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java @@ -107,11 +107,12 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { throw new IllegalArgumentException("Null target"); } target = NativeWindowFactory.getNativeWindow(target); - X11OnscreenGLXDrawable drawable = new X11OnscreenGLXDrawable(this, target); - long visualID = target.getVisualID(); - int screen = target.getScreenIndex(); - drawable.setChosenGLCapabilities((GLCapabilities) visualToGLCapsMap.get(new ScreenAndVisualIDKey(screen, visualID))); - return drawable; + return new X11OnscreenGLXDrawable(this, target); + } + + public GLCapabilities lookupCapabilitiesByScreenAndVisualID(int screenIndex, + long visualID) { + return (GLCapabilities) visualToGLCapsMap.get(new ScreenAndVisualIDKey(screenIndex, visualID)); } public GLDrawableImpl createOffscreenDrawable(GLCapabilities capabilities, diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java b/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java index 7152a6238..f1743a8b4 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java @@ -60,6 +60,12 @@ public class X11OnscreenGLXContext extends X11GLXContext { protected int makeCurrentImpl() throws GLException { int lockRes = drawable.lockSurface(); + if (drawable.getChosenGLCapabilities() == null) { + X11GLXDrawableFactory factory = (X11GLXDrawableFactory) drawable.getFactory(); + NativeWindow window = drawable.getNativeWindow(); + drawable.setChosenGLCapabilities(factory.lookupCapabilitiesByScreenAndVisualID(window.getScreenIndex(), + window.getVisualID())); + } boolean exceptionOccurred = false; try { if (lockRes == NativeWindow.LOCK_SURFACE_NOT_READY) { |