/** * @(#) GLFunc14JauJNI.java */ package gl4java; import java.nio.*; import gl4java.utils.DirectBufferCleanup; /** * The default implementation class for OpenGL native function mapping * * @version 2.00, 21. April 1999 * @author Sven Goethel */ public class GLFunc14JauJNI implements GLFunc14 { //---------------------------------------------------------------------- // Special-case routines requiring hand coding // /** Access to the underlying wglAllocateMemoryNV or glXAllocateMemoryNV routine, if present. Presence of this routine can be queried by calling GLContext.gljTestGLProc with the argument "glAllocateMemoryNV". */ public ByteBuffer glAllocateMemoryNV(int size, float readFreq, float writeFreq, float priority) { long address = glAllocateMemoryNV0(size, readFreq, writeFreq, priority); if (address == 0) { throw new OutOfMemoryError(); } ByteBuffer buf = newDirectByteBuffer(address, size); registerForCleanup(this, buf); return buf; } /** This delegates to either wglAllocateMemoryNV or glXAllocateMemoryNV in the native code, depending on the window system */ private native long glAllocateMemoryNV0(int size, float readFreq, float writeFreq, float priority); /** This delegates to either wglFreeMemoryNV or glXFreeMemoryNV in the native code, depending on the window system */ private native void glFreeMemoryNV0(long addr); /** Allocate a direct byte buffer pointing at an arbitrary memory address -- must be hidden for security reasons */ private native ByteBuffer newDirectByteBuffer(long addr, int capacity); private static volatile DirectBufferCleanup cleanup; private static synchronized void registerForCleanup(final GLFunc14JauJNI gl, Buffer buf) { if (cleanup == null) { cleanup = new DirectBufferCleanup(new DirectBufferCleanup.Callback() { public void cleanup(long addr) { gl.glFreeMemoryNV0(addr); } }); } cleanup.register(buf); } //---------------------------------------------------------------------- // All other routines below are autogenerated //