From a0c04406276133db40cd39799a0f845369385400 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Mon, 10 Jul 2006 20:18:26 +0000 Subject: Added code to support new entry points in sun.java2d.opengl.CGLSurfaceData added by gziemski to enable the Java2D/JOGL bridge on Mac OS X. Currently untested. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@838 232f8b59-042b-4e1e-8c03-345bb8c30851 --- src/classes/javax/media/opengl/GLJPanel.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/classes/javax/media/opengl/GLJPanel.java') diff --git a/src/classes/javax/media/opengl/GLJPanel.java b/src/classes/javax/media/opengl/GLJPanel.java index 192c5f1b1..6ab2a9ec7 100644 --- a/src/classes/javax/media/opengl/GLJPanel.java +++ b/src/classes/javax/media/opengl/GLJPanel.java @@ -551,8 +551,13 @@ public class GLJPanel extends JPanel implements GLAutoDrawable { j2dSurface = curSurface; } if (joglContext == null) { - joglDrawable = GLDrawableFactory.getFactory().createExternalGLDrawable(); - joglContext = joglDrawable.createContext(shareWith); + if (GLDrawableFactory.getFactory().canCreateExternalGLDrawable()) { + joglDrawable = GLDrawableFactory.getFactory().createExternalGLDrawable(); + joglContext = joglDrawable.createContext(shareWith); + } else if (GLDrawableFactoryImpl.getFactoryImpl().canCreateContextOnJava2DSurface()) { + // Mac OS X code path + joglContext = GLDrawableFactoryImpl.getFactoryImpl().createContextOnJava2DSurface(g); + } if (DEBUG) { joglContext.setGL(new DebugGL(joglContext.getGL())); } @@ -563,6 +568,10 @@ public class GLJPanel extends JPanel implements GLAutoDrawable { createNewDepthBuffer = true; } } + if (joglContext instanceof Java2DGLContext) { + // Mac OS X code path + ((Java2DGLContext) joglContext).setGraphics(g); + } if (DEBUG && VERBOSE && Java2D.isFBOEnabled()) { System.err.print("-- Surface type: "); -- cgit v1.2.3