From 1a2a54a83a9adb95b4bfe9c337751acbef0cb0d3 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Tue, 30 Mar 2010 02:01:15 +0200
Subject: Adaptions to     http://www.jogamp.org/bugzilla/show_bug.cgi?id=392  
   7220416bcef3140883d3966d921442feae3107c4

---
 .../opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java   | 15 ++++++++-------
 .../opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java  |  7 ++++---
 2 files changed, 12 insertions(+), 10 deletions(-)

(limited to 'src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl')

diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
index 131375338..aacd2c38e 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
@@ -6,6 +6,7 @@ import java.util.*;
 import javax.media.opengl.*;
 import javax.media.nativewindow.*;
 import com.jogamp.opengl.impl.*;
+import com.jogamp.gluegen.runtime.PointerBuffer;
 
 public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
   protected MacOSXPbufferCGLDrawable drawable;
@@ -312,29 +313,29 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
       }
 
       // Use attribute array to select pixel format
-      long[] fmt = new long[1];
+      PointerBuffer fmt = PointerBuffer.allocateDirect(1);
       long[] numScreens = new long[1];
-      int res = CGL.CGLChoosePixelFormat(attrs, 0, fmt, 0, numScreens, 0);
+      int res = CGL.CGLChoosePixelFormat(attrs, 0, fmt, numScreens, 0);
       if (res != CGL.kCGLNoError) {
         throw new GLException("Error code " + res + " while choosing pixel format");
       }
       
       // Create new context
-      long[] ctx = new long[1];
+      PointerBuffer ctx = PointerBuffer.allocateDirect(1);
       if (DEBUG) {
         System.err.println("Share context for CGL-based pbuffer context is " + toHexString(share));
       }
-      res = CGL.CGLCreateContext(fmt[0], share, ctx, 0);
-      CGL.CGLDestroyPixelFormat(fmt[0]);
+      res = CGL.CGLCreateContext(fmt.get(0), share, ctx);
+      CGL.CGLDestroyPixelFormat(fmt.get(0));
       if (res != CGL.kCGLNoError) {
         throw new GLException("Error code " + res + " while creating context");
       }
       // Attach newly-created context to the pbuffer
-      res = CGL.CGLSetPBuffer(ctx[0], drawable.getPbuffer(), 0, 0, 0);
+      res = CGL.CGLSetPBuffer(ctx.get(0), drawable.getPbuffer(), 0, 0, 0);
       if (res != CGL.kCGLNoError) {
         throw new GLException("Error code " + res + " while attaching context to pbuffer");
       }
-      return ctx[0];
+      return ctx.get(0);
     }
     
     public boolean destroy(long ctx) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
index eb6de929d..95609aee5 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
@@ -42,6 +42,7 @@ package com.jogamp.opengl.impl.macosx.cgl;
 import javax.media.opengl.*;
 import javax.media.nativewindow.*;
 import com.jogamp.opengl.impl.*;
+import com.jogamp.gluegen.runtime.PointerBuffer;
 
 public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
   private static final boolean DEBUG = Debug.debug("MacOSXPbufferCGLDrawable");
@@ -232,12 +233,12 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
   // CGL implementation
   class CGLImpl implements Impl {
     public long create(int renderTarget, int internalFormat, int width, int height) {
-      long[] pbuffer = new long[1];
-      int res = CGL.CGLCreatePBuffer(width, height, renderTarget, internalFormat, 0, pbuffer, 0);
+      PointerBuffer pbuffer = PointerBuffer.allocateDirect(1);
+      int res = CGL.CGLCreatePBuffer(width, height, renderTarget, internalFormat, 0, pbuffer);
       if (res != CGL.kCGLNoError) {
         throw new GLException("Error creating CGL-based pbuffer: error code " + res);
       }
-      return pbuffer[0];
+      return pbuffer.get(0);
     }
 
     public void destroy(long pbuffer) {
-- 
cgit v1.2.3