aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-12-03 21:47:01 +0100
committerSven Gothel <[email protected]>2010-12-03 21:47:01 +0100
commitfd0d3f15d41d32b3987f4b88862619ef1a31b999 (patch)
tree04191b2c57b18b88842682ece7833a7ec89c5990 /src/newt
parentc58fd6b65a4da45663330f405ab94f24adb4c91d (diff)
Fix NEWT GLWindow: Adding missing shared GLContext setter (with unit test)
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 5531bf168..358a3d4ce 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -373,7 +373,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer {
drawable = factory.createGLDrawable(nw);
}
drawable.setRealized(true);
- context = drawable.createContext(null);
+ context = drawable.createContext(sharedContext);
}
if(Window.DEBUG_WINDOW_EVENT || Window.DEBUG_IMPLEMENTATION) {
String msg = new String("GLWindow.setVisibleActionPost("+visible+", "+nativeWindowCreated+") "+Thread.currentThread()+", fin");
@@ -404,6 +404,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer {
// OpenGL-related methods and state
//
+ private GLContext sharedContext = null;
private GLDrawableFactory factory;
private GLDrawable drawable;
private GLContext context;
@@ -419,6 +420,18 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer {
return factory;
}
+ /**
+ * Specifies an {@link javax.media.opengl.GLContext OpenGL context} to share with.<br>
+ * At native creation, {@link #setVisible(boolean) setVisible(true)},
+ * a {@link javax.media.opengl.GLDrawable drawable} and {@link javax.media.opengl.GLContext context} is created besides the native Window itself,<br>
+ * hence you shall set the shared context before.
+ *
+ * @param sharedContext The OpenGL context shared by this GLWindow's one
+ */
+ public void setSharedContext(GLContext sharedContext) {
+ this.sharedContext = sharedContext;
+ }
+
public void setContext(GLContext newCtx) {
context = newCtx;
}