diff options
Diffstat (limited to 'src/classes/com/sun')
3 files changed, 47 insertions, 0 deletions
diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXGLContext.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLContext.java index 16855efb8..02bf81f2e 100644 --- a/src/classes/com/sun/opengl/impl/macosx/MacOSXGLContext.java +++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLContext.java @@ -277,6 +277,18 @@ public abstract class MacOSXGLContext extends GLContextImpl return (nsContext != 0); } + public void copy(GLContext source, int mask) throws GLException { + long dst = getNSContext(); + long src = ((MacOSXGLContext) source).getNSContext(); + if (src == 0) { + throw new GLException("Source OpenGL context has not been created"); + } + if (dst == 0) { + throw new GLException("Destination OpenGL context has not been created"); + } + CGL.copyContext(dst, src, mask); + } + protected void resetGLFunctionAvailability() { super.resetGLFunctionAvailability(); diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsGLContext.java b/src/classes/com/sun/opengl/impl/windows/WindowsGLContext.java index 7a4b73351..1276aea92 100644 --- a/src/classes/com/sun/opengl/impl/windows/WindowsGLContext.java +++ b/src/classes/com/sun/opengl/impl/windows/WindowsGLContext.java @@ -207,6 +207,20 @@ public class WindowsGLContext extends GLContextImpl { return (hglrc != 0); } + public void copy(GLContext source, int mask) throws GLException { + long dst = getHGLRC(); + long src = ((WindowsGLContext) source).getHGLRC(); + if (src == 0) { + throw new GLException("Source OpenGL context has not been created"); + } + if (dst == 0) { + throw new GLException("Destination OpenGL context has not been created"); + } + if (!WGL.wglCopyContext(src, dst, mask)) { + throw new GLException("wglCopyContext failed"); + } + } + protected void resetGLFunctionAvailability() { super.resetGLFunctionAvailability(); if (DEBUG) { diff --git a/src/classes/com/sun/opengl/impl/x11/X11GLContext.java b/src/classes/com/sun/opengl/impl/x11/X11GLContext.java index 0ed5eaebb..17b2cca40 100644 --- a/src/classes/com/sun/opengl/impl/x11/X11GLContext.java +++ b/src/classes/com/sun/opengl/impl/x11/X11GLContext.java @@ -193,6 +193,27 @@ public abstract class X11GLContext extends GLContextImpl { return (context != 0); } + public void copy(GLContext source, int mask) throws GLException { + long dst = getContext(); + long src = ((X11GLContext) source).getContext(); + if (src == 0) { + throw new GLException("Source OpenGL context has not been created"); + } + if (dst == 0) { + throw new GLException("Destination OpenGL context has not been created"); + } + if (mostRecentDisplay == 0) { + throw new GLException("Connection to X display not yet set up"); + } + lockToolkit(); + try { + GLX.glXCopyContext(mostRecentDisplay, src, dst, mask); + // Should check for X errors and raise GLException + } finally { + unlockToolkit(); + } + } + protected void resetGLFunctionAvailability() { super.resetGLFunctionAvailability(); if (DEBUG) { |