aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/impl/macosx
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-03-30 02:01:15 +0200
committerSven Gothel <[email protected]>2010-03-30 02:01:15 +0200
commit1a2a54a83a9adb95b4bfe9c337751acbef0cb0d3 (patch)
tree70eaf25d06284c2d71db7d51a5efdf7f18607be2 /src/jogl/classes/com/jogamp/opengl/impl/macosx
parentb3f2ab84401efef233c0038f004a9f210cbe83fc (diff)
Adaptions to
http://www.jogamp.org/bugzilla/show_bug.cgi?id=392 7220416bcef3140883d3966d921442feae3107c4
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/impl/macosx')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java15
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java7
2 files changed, 12 insertions, 10 deletions
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) {