equal
deleted
inserted
replaced
363 } |
363 } |
364 |
364 |
365 // Mac OS X specific APIs for JOGL/Java2D bridge... |
365 // Mac OS X specific APIs for JOGL/Java2D bridge... |
366 |
366 |
367 // given a surface create and attach GL context, then return it |
367 // given a surface create and attach GL context, then return it |
368 private native static long createCGLContextOnSurface(CGLSurfaceData sd, |
368 private static native long createCGLContextOnSurface(CGLSurfaceData sd, |
369 long sharedContext); |
369 long sharedContext); |
370 |
370 |
371 public static long createOGLContextOnSurface(Graphics g, long sharedContext) { |
371 public static long createOGLContextOnSurface(Graphics g, long sharedContext) { |
372 SurfaceData sd = ((SunGraphics2D) g).surfaceData; |
372 SurfaceData sd = ((SunGraphics2D) g).surfaceData; |
373 if ((sd instanceof CGLSurfaceData) == true) { |
373 if ((sd instanceof CGLSurfaceData) == true) { |
377 return 0L; |
377 return 0L; |
378 } |
378 } |
379 } |
379 } |
380 |
380 |
381 // returns whether or not the makeCurrent operation succeeded |
381 // returns whether or not the makeCurrent operation succeeded |
382 native static boolean makeCGLContextCurrentOnSurface(CGLSurfaceData sd, |
382 static native boolean makeCGLContextCurrentOnSurface(CGLSurfaceData sd, |
383 long ctx); |
383 long ctx); |
384 |
384 |
385 public static boolean makeOGLContextCurrentOnSurface(Graphics g, long ctx) { |
385 public static boolean makeOGLContextCurrentOnSurface(Graphics g, long ctx) { |
386 SurfaceData sd = ((SunGraphics2D) g).surfaceData; |
386 SurfaceData sd = ((SunGraphics2D) g).surfaceData; |
387 if ((ctx != 0L) && ((sd instanceof CGLSurfaceData) == true)) { |
387 if ((ctx != 0L) && ((sd instanceof CGLSurfaceData) == true)) { |
391 return false; |
391 return false; |
392 } |
392 } |
393 } |
393 } |
394 |
394 |
395 // additional cleanup |
395 // additional cleanup |
396 private native static void destroyCGLContext(long ctx); |
396 private static native void destroyCGLContext(long ctx); |
397 |
397 |
398 public static void destroyOGLContext(long ctx) { |
398 public static void destroyOGLContext(long ctx) { |
399 if (ctx != 0L) { |
399 if (ctx != 0L) { |
400 destroyCGLContext(ctx); |
400 destroyCGLContext(ctx); |
401 } |
401 } |