diff options
author | Michael Bien <[email protected]> | 2010-03-30 14:01:15 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-03-30 14:01:15 +0200 |
commit | 44b93b2d63539bca4c7e3facfee90d5f3bbb67cf (patch) | |
tree | 528cb1b0c5e965cc07cfd390196caf05aba9aa7f /src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl | |
parent | f250183bc3d8eb4ef87cecb3311eae554dcafe53 (diff) | |
parent | 62dcd1a3fe345c4d2c0e42472d2c7646fe224e8f (diff) |
Merge branch 'master' of github.com:mbien/jogl
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java | 15 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java | 7 |
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) { |