Converted Cursor and Pbuffer handles to ByteBuffers

This commit is contained in:
Elias Naur 2004-07-25 14:28:50 +00:00
parent efb28a1a85
commit bdf5a43d5e
9 changed files with 131 additions and 94 deletions

View File

@ -32,10 +32,10 @@
package org.lwjgl.input;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
import org.lwjgl.LWJGLException;
import org.lwjgl.BufferUtils;
import org.lwjgl.Sys;
/**
@ -49,8 +49,9 @@ import org.lwjgl.Sys;
*/
public class Cursor {
private final static int HANDLE_SIZE = 8;
/** First element to display */
private CursorElement[] cursors = null;
private final CursorElement[] cursors;
/** Index into list of cursors */
private int index = 0;
@ -88,15 +89,15 @@ public class Cursor {
yHotspot = height - 1 - yHotspot;
// create cursor (or cursors if multiple images supplied)
createCursors(width, height, xHotspot, yHotspot, numImages, images, delays);
cursors = createCursors(width, height, xHotspot, yHotspot, numImages, images, delays);
}
/**
* Creates the actual cursor, using a platform specific class
*/
private void createCursors(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException {
private static CursorElement[] createCursors(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException {
// create copy and flip images to match ogl
IntBuffer images_copy = ByteBuffer.allocateDirect(images.remaining()*4).order(ByteOrder.nativeOrder()).asIntBuffer();
IntBuffer images_copy = BufferUtils.createIntBuffer(images.remaining());
flipImages(width, height, numImages, images, images_copy);
// Win32 doesn't (afaik) allow for animation based cursors, except when they're
@ -107,25 +108,30 @@ public class Cursor {
// might want to split it into a X/Win/Mac cursor if it gets too cluttered
String osName = System.getProperty("os.name", "");
CursorElement[] cursors;
if (osName.startsWith("Win")) {
// create our cursor elements
cursors = new CursorElement[numImages];
for(int i=0; i<numImages; i++) {
cursors[i] = new CursorElement();
cursors[i].cursorHandle = nCreateCursor(width, height, xHotspot, yHotspot, 1, images_copy, images_copy.position(), null, 0);
cursors[i].delay = (delays != null) ? delays.get(i) : 0;
cursors[i].timeout = System.currentTimeMillis();
ByteBuffer handle = BufferUtils.createByteBuffer(HANDLE_SIZE);
nCreateCursor(handle, width, height, xHotspot, yHotspot, 1, images_copy, images_copy.position(), null, 0);
long delay = (delays != null) ? delays.get(i) : 0;
long timeout = System.currentTimeMillis();
cursors[i] = new CursorElement(handle, delay, timeout);
// offset to next image
images_copy.position(width*height*(i+1));
}
} else if (osName.startsWith("Lin")) {
// create our cursor elements
cursors = new CursorElement[1];
cursors[0] = new CursorElement();
cursors[0].cursorHandle = nCreateCursor(width, height, xHotspot, yHotspot, numImages, images_copy, images_copy.position(), delays, delays != null ? delays.position() : -1);
ByteBuffer handle = BufferUtils.createByteBuffer(HANDLE_SIZE);
nCreateCursor(handle, width, height, xHotspot, yHotspot, numImages, images_copy, images_copy.position(), delays, delays != null ? delays.position() : -1);
CursorElement cursor_element = new CursorElement(handle, -1, -1);
cursors = new CursorElement[]{cursor_element};
} else {
throw new RuntimeException("Unknown OS");
}
return cursors;
}
/**
@ -168,7 +174,7 @@ public class Cursor {
/**
* Gets the native handle associated with the cursor object.
*/
public long getHandle() {
ByteBuffer getHandle() {
return cursors[index].cursorHandle;
}
@ -215,24 +221,30 @@ public class Cursor {
/**
* Native method to create a native cursor
*/
private static native long nCreateCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, int images_offset, IntBuffer delays, int delays_offset);
private static native void nCreateCursor(ByteBuffer handle, int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, int images_offset, IntBuffer delays, int delays_offset) throws LWJGLException;
/**
* Native method to destroy a native cursor
*/
private static native void nDestroyCursor(long cursorHandle);
private static native void nDestroyCursor(ByteBuffer cursorHandle);
/**
* A single cursor element, used when animating
*/
protected class CursorElement {
private static class CursorElement {
/** Handle to cursor */
long cursorHandle;
final ByteBuffer cursorHandle;
/** How long a delay this element should have */
long delay;
final long delay;
/** Absolute time this element times out */
long timeout;
CursorElement(ByteBuffer cursorHandle, long delay, long timeout) {
this.cursorHandle = cursorHandle;
this.delay = delay;
this.timeout = timeout;
}
}
}

View File

@ -200,14 +200,14 @@ public class Mouse {
nSetNativeCursor(currentCursor.getHandle());
currentCursor.setTimeout();
} else {
nSetNativeCursor(0);
nSetNativeCursor(null);
}
}
return oldCursor;
}
/** Native method to set the native cursor */
private static native void nSetNativeCursor(long handle) throws LWJGLException;
private static native void nSetNativeCursor(ByteBuffer handle) throws LWJGLException;
/**
* Gets the minimum size of a native cursor. Can only be called if

View File

@ -32,9 +32,11 @@
package org.lwjgl.opengl;
import org.lwjgl.Sys;
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import java.nio.IntBuffer;
import java.nio.ByteBuffer;
/**
* $Id$
@ -134,10 +136,15 @@ public final class Pbuffer {
*/
public static final int DEPTH_BUFFER = RenderTexture.WGL_DEPTH_COMPONENT_NV;
/**
* The maximum number of bytes in the native handle
*/
private final static int HANDLE_SIZE = 24;
/**
* Handle to the native GL rendering context
*/
private final int handle;
private final ByteBuffer handle;
/**
* Width
@ -183,7 +190,7 @@ public final class Pbuffer {
public static Pbuffer createPbufferUsingDisplayContext(int width, int height, RenderTexture renderTexture) throws LWJGLException {
if (!Display.isCreated())
throw new IllegalStateException("The Display must be created before a shared Pbuffer can be created that use the Display context");
int handle = createPbuffer(true, width, height, null, renderTexture);
ByteBuffer handle = createPbuffer(true, width, height, null, renderTexture);
return new Pbuffer(width, height, Display.getContext(), handle);
}
@ -206,26 +213,28 @@ public final class Pbuffer {
* @param renderTexture
*/
public static Pbuffer createPbufferUsingUniqueContext(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture) throws LWJGLException {
int handle = createPbuffer(false, width, height, pixel_format, renderTexture);
ByteBuffer handle = createPbuffer(false, width, height, pixel_format, renderTexture);
return new Pbuffer(width, height, null, handle);
}
private Pbuffer(int width, int height, Object display_context, int handle) {
private Pbuffer(int width, int height, Object display_context, ByteBuffer handle) {
this.width = width;
this.height = height;
this.display_context = display_context;
this.handle = handle;
}
private static int createPbuffer(boolean use_display_context, int width, int height, PixelFormat pixel_format, RenderTexture renderTexture) throws LWJGLException {
private static ByteBuffer createPbuffer(boolean use_display_context, int width, int height, PixelFormat pixel_format, RenderTexture renderTexture) throws LWJGLException {
GLContext.loadOpenGLLibrary();
try {
ByteBuffer handle = BufferUtils.createByteBuffer(HANDLE_SIZE);
if ( renderTexture == null )
return nCreate(use_display_context, width, height, pixel_format, null, null);
nCreate(handle, use_display_context, width, height, pixel_format, null, null);
else
return nCreate(use_display_context, width, height, pixel_format,
nCreate(handle, use_display_context, width, height, pixel_format,
renderTexture.pixelFormatCaps,
renderTexture.pBufferAttribs);
return handle;
} catch (LWJGLException e) {
GLContext.unloadOpenGLLibrary();
throw e;
@ -246,7 +255,7 @@ public final class Pbuffer {
/**
* Native method to test for buffer integrity
*/
private static native boolean nIsBufferLost(int handle);
private static native boolean nIsBufferLost(ByteBuffer handle);
/**
* Method to make the Pbuffer context current. All subsequent OpenGL calls will go to this buffer.
@ -263,7 +272,7 @@ public final class Pbuffer {
/**
* Native method to make a pbuffer current.
*/
private static native void nMakeCurrent(int handle) throws LWJGLException;
private static native void nMakeCurrent(ByteBuffer handle) throws LWJGLException;
/**
* Gets the Pbuffer capabilities.
@ -275,7 +284,7 @@ public final class Pbuffer {
/**
* Native method to create a Pbuffer
*/
private static native int nCreate(boolean shared, int width, int height, PixelFormat pixel_format,
private static native void nCreate(ByteBuffer handle, boolean shared, int width, int height, PixelFormat pixel_format,
IntBuffer pixelFormatCaps,
IntBuffer pBufferAttribs) throws LWJGLException;
@ -300,7 +309,7 @@ public final class Pbuffer {
/**
* Natively destroy any GL-related stuff
*/
private static native void nDestroy(int handle);
private static native void nDestroy(ByteBuffer handle);
// -----------------------------------------------------------------------------------------
// ------------------------------- Render-to-Texture Methods -------------------------------
@ -322,7 +331,7 @@ public final class Pbuffer {
nSetAttrib(handle, attrib, value);
}
private static native void nSetAttrib(int handle, int attrib, int value);
private static native void nSetAttrib(ByteBuffer handle, int attrib, int value);
/**
* Binds the currently bound texture to the buffer specified. The buffer can be one of the following:
@ -335,7 +344,7 @@ public final class Pbuffer {
nBindTexImage(handle, buffer);
}
private static native void nBindTexImage(int handle, int buffer);
private static native void nBindTexImage(ByteBuffer handle, int buffer);
/**
* Releases the currently bound texture from the buffer specified.
@ -346,7 +355,7 @@ public final class Pbuffer {
nReleaseTexImage(handle, buffer);
}
private static native void nReleaseTexImage(int handle, int buffer);
private static native void nReleaseTexImage(ByteBuffer handle, int buffer);
/**
* @return Returns the height.

View File

@ -7,21 +7,23 @@
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_input_Cursor_HANDLE_SIZE
#define org_lwjgl_input_Cursor_HANDLE_SIZE 8L
/*
* Class: org_lwjgl_input_Cursor
* Method: nCreateCursor
* Signature: (IIIIILjava/nio/IntBuffer;ILjava/nio/IntBuffer;I)J
* Signature: (Ljava/nio/ByteBuffer;IIIIILjava/nio/IntBuffer;ILjava/nio/IntBuffer;I)V
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor
(JNIEnv *, jclass, jint, jint, jint, jint, jint, jobject, jint, jobject, jint);
JNIEXPORT void JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor
(JNIEnv *, jclass, jobject, jint, jint, jint, jint, jint, jobject, jint, jobject, jint);
/*
* Class: org_lwjgl_input_Cursor
* Method: nDestroyCursor
* Signature: (J)V
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_input_Cursor_nDestroyCursor
(JNIEnv *, jclass, jlong);
(JNIEnv *, jclass, jobject);
#ifdef __cplusplus
}

View File

@ -13,10 +13,19 @@ extern "C" {
#define org_lwjgl_input_Mouse_CURSOR_8_BIT_ALPHA 2L
#undef org_lwjgl_input_Mouse_CURSOR_ANIMATION
#define org_lwjgl_input_Mouse_CURSOR_ANIMATION 4L
#undef org_lwjgl_input_Mouse_MAX_SENSITIVITY
#define org_lwjgl_input_Mouse_MAX_SENSITIVITY 8L
#undef org_lwjgl_input_Mouse_MIN_SENSITIVITY
#define org_lwjgl_input_Mouse_MIN_SENSITIVITY 1L
/* Inaccessible static: sensitivity */
/* Inaccessible static: width */
/* Inaccessible static: height */
/* Inaccessible static: created */
/* Inaccessible static: buttons */
/* Inaccessible static: x */
/* Inaccessible static: y */
/* Inaccessible static: scrollX */
/* Inaccessible static: scrollY */
/* Inaccessible static: coord_buffer */
/* Inaccessible static: dx */
/* Inaccessible static: dy */
@ -33,6 +42,7 @@ extern "C" {
#undef org_lwjgl_input_Mouse_BUFFER_SIZE
#define org_lwjgl_input_Mouse_BUFFER_SIZE 50L
/* Inaccessible static: isGrabbed */
/* Inaccessible static: trackingEnabled */
/*
* Class: org_lwjgl_input_Mouse
* Method: nGetNativeCursorCaps
@ -44,10 +54,10 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetNativeCursorCaps
/*
* Class: org_lwjgl_input_Mouse
* Method: nSetNativeCursor
* Signature: (J)V
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nSetNativeCursor
(JNIEnv *, jclass, jlong);
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_input_Mouse

View File

@ -41,21 +41,23 @@ extern "C" {
#define org_lwjgl_opengl_Pbuffer_BACK_RIGHT_BUFFER 8326L
#undef org_lwjgl_opengl_Pbuffer_DEPTH_BUFFER
#define org_lwjgl_opengl_Pbuffer_DEPTH_BUFFER 8359L
#undef org_lwjgl_opengl_Pbuffer_HANDLE_SIZE
#define org_lwjgl_opengl_Pbuffer_HANDLE_SIZE 24L
/*
* Class: org_lwjgl_opengl_Pbuffer
* Method: nIsBufferLost
* Signature: (I)Z
* Signature: (Ljava/nio/ByteBuffer;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Pbuffer_nIsBufferLost
(JNIEnv *, jclass, jint);
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_Pbuffer
* Method: nMakeCurrent
* Signature: (I)V
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Pbuffer_nMakeCurrent
(JNIEnv *, jclass, jint);
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_Pbuffer
@ -68,42 +70,42 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Pbuffer_getPbufferCaps
/*
* Class: org_lwjgl_opengl_Pbuffer
* Method: nCreate
* Signature: (ZIILorg/lwjgl/opengl/PixelFormat;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;)I
* Signature: (Ljava/nio/ByteBuffer;ZIILorg/lwjgl/opengl/PixelFormat;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;)V
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Pbuffer_nCreate
(JNIEnv *, jclass, jboolean, jint, jint, jobject, jobject, jobject);
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Pbuffer_nCreate
(JNIEnv *, jclass, jobject, jboolean, jint, jint, jobject, jobject, jobject);
/*
* Class: org_lwjgl_opengl_Pbuffer
* Method: nDestroy
* Signature: (I)V
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Pbuffer_nDestroy
(JNIEnv *, jclass, jint);
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_Pbuffer
* Method: nSetAttrib
* Signature: (III)V
* Signature: (Ljava/nio/ByteBuffer;II)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Pbuffer_nSetAttrib
(JNIEnv *, jclass, jint, jint, jint);
(JNIEnv *, jclass, jobject, jint, jint);
/*
* Class: org_lwjgl_opengl_Pbuffer
* Method: nBindTexImage
* Signature: (II)V
* Signature: (Ljava/nio/ByteBuffer;I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Pbuffer_nBindTexImage
(JNIEnv *, jclass, jint, jint);
(JNIEnv *, jclass, jobject, jint);
/*
* Class: org_lwjgl_opengl_Pbuffer
* Method: nReleaseTexImage
* Signature: (II)V
* Signature: (Ljava/nio/ByteBuffer;I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Pbuffer_nReleaseTexImage
(JNIEnv *, jclass, jint, jint);
(JNIEnv *, jclass, jobject, jint);
#ifdef __cplusplus
}

View File

@ -44,17 +44,16 @@
#include "Window.h"
#include "common_tools.h"
/*
* Class: org_lwjgl_input_Cursor
* Method: nCreateCursor
* Signature: (IIIIIII)I
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor
(JNIEnv *env, jclass clazz, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset)
JNIEXPORT void JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor
(JNIEnv *env, jclass clazz, jobject handle_buffer, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset)
{
if (env->GetDirectBufferCapacity(handle_buffer) < sizeof(Cursor)) {
throwException(env, "Handle buffer not large enough");
return;
}
Display *disp = incDisplay(env);
if (disp == NULL)
return 0;
return;
const int *delays = NULL;
if (delay_buffer != NULL)
delays = (const int *)env->GetDirectBufferAddress(delay_buffer) + delays_offset;
@ -74,20 +73,16 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor
cursor_image->delay = delays[i];
cursor_images->images[i] = cursor_image;
}
Cursor cursor = XcursorImagesLoadCursor(disp, cursor_images);
Cursor *cursor = (Cursor *)env->GetDirectBufferAddress(handle_buffer);
*cursor = XcursorImagesLoadCursor(disp, cursor_images);
XcursorImagesDestroy(cursor_images);
return (jlong)cursor;
}
/*
* Class: org_lwjgl_input_Cursor
* Method: nDestroyCursor
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_input_Cursor_nDestroyCursor
(JNIEnv *env, jclass clazz, jlong cursor_handle)
(JNIEnv *env, jclass clazz, jobject cursor_handle_buffer)
{
Cursor cursor = (Cursor)cursor_handle;
XFreeCursor(getDisplay(), cursor);
Cursor *cursor = (Cursor *)env->GetDirectBufferAddress(cursor_handle_buffer);
// Cursor cursor = (Cursor)cursor_handle;
XFreeCursor(getDisplay(), *cursor);
decDisplay();
}

View File

@ -202,10 +202,11 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetNativeCursorCaps
return caps;
}
JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nSetNativeCursor (JNIEnv *env, jclass clazz, jlong cursor_handle) {
if (cursor_handle != 0) {
Cursor cursor = (Cursor)cursor_handle;
current_cursor = cursor;
JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nSetNativeCursor(JNIEnv *env, jclass clazz, jobject cursor_handle) {
if (cursor_handle != NULL) {
Cursor *cursor = (Cursor *)env->GetDirectBufferAddress(cursor_handle);
// Cursor cursor = (Cursor)cursor_handle;
current_cursor = *cursor;
} else
current_cursor = None;
updateCursor();

View File

@ -52,7 +52,7 @@ typedef struct _PbufferInfo {
} PbufferInfo;
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Pbuffer_nIsBufferLost
(JNIEnv *env, jclass clazz, jint handle)
(JNIEnv *env, jclass clazz, jobject handle_buffer)
{
// The buffer is never lost, because of the GLX_PRESERVED_CONTENTS flag
return JNI_FALSE;
@ -71,7 +71,7 @@ static void destroyPbuffer(PbufferInfo *buffer_info) {
glXDestroyPbuffer(getDisplay(), buffer);
if (!buffer_info->use_display_context)
glXDestroyContext(getDisplay(), context);
free(buffer_info);
// free(buffer_info);
decDisplay();
}
@ -147,17 +147,17 @@ static bool createPbufferUsingDisplayContext(JNIEnv *env, PbufferInfo *buffer_in
return true;
}
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Pbuffer_nCreate(JNIEnv *env, jclass clazz, jboolean use_display_context, jint width, jint height, jobject pixel_format, jobject pixelFormatCaps, jobject pBufferAttribs)
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Pbuffer_nCreate(JNIEnv *env, jclass clazz, jobject handle_buffer, jboolean use_display_context, jint width, jint height, jobject pixel_format, jobject pixelFormatCaps, jobject pBufferAttribs)
{
Display *disp = incDisplay(env);
if (disp == NULL) {
return -1;
return;
}
int current_screen = XDefaultScreen(disp);
if (!extgl_InitGLX(env, disp, current_screen)) {
decDisplay();
throwException(env, "Could not init GLX");
return -1;
return;
}
const int buffer_attribs[] = {GLX_PBUFFER_WIDTH, width,
@ -166,7 +166,12 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Pbuffer_nCreate(JNIEnv *env, jclass
GLX_LARGEST_PBUFFER, False,
None, None};
PbufferInfo *buffer_info = (PbufferInfo *)malloc(sizeof(PbufferInfo));
if (env->GetDirectBufferCapacity(handle_buffer) < sizeof(PbufferInfo)) {
throwException(env, "Handle buffer not large enough");
return;
}
PbufferInfo *buffer_info = (PbufferInfo *)env->GetDirectBufferAddress(handle_buffer);
// PbufferInfo *buffer_info = (PbufferInfo *)malloc(sizeof(PbufferInfo));
buffer_info->use_display_context = use_display_context;
bool result;
if (use_display_context) {
@ -175,18 +180,18 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Pbuffer_nCreate(JNIEnv *env, jclass
result = createPbufferUsingUniqueContext(env, buffer_info, pixel_format, width, height, buffer_attribs);
}
if (!result)
return -1;
return;
if (!checkXError(env)) {
destroyPbuffer(buffer_info);
return -1;
return;
}
return (jint)buffer_info;
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Pbuffer_nMakeCurrent
(JNIEnv *env, jclass clazz, jint handle)
(JNIEnv *env, jclass clazz, jobject handle_buffer)
{
PbufferInfo *buffer_info = (PbufferInfo *)handle;
PbufferInfo *buffer_info = (PbufferInfo *)env->GetDirectBufferAddress(handle_buffer);
//PbufferInfo *buffer_info = (PbufferInfo *)handle;
GLXPbuffer buffer = buffer_info->buffer;
GLXContext context = buffer_info->context;
if (glXMakeContextCurrent(getDisplay(), buffer, buffer, context) == False) {
@ -200,26 +205,27 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Pbuffer_nMakeCurrent
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Pbuffer_nDestroy
(JNIEnv *env, jclass clazz, jint handle)
(JNIEnv *env, jclass clazz, jobject handle_buffer)
{
PbufferInfo *buffer_info = (PbufferInfo *)handle;
PbufferInfo *buffer_info = (PbufferInfo *)env->GetDirectBufferAddress(handle_buffer);
//PbufferInfo *buffer_info = (PbufferInfo *)handle;
destroyPbuffer(buffer_info);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Pbuffer_nSetAttrib
(JNIEnv *env, jclass clazz, jint handle, jint attrib, jint value)
(JNIEnv *env, jclass clazz, jobject handle_buffer, jint attrib, jint value)
{
throwException(env, "The render-to-texture extension is not supported.");
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Pbuffer_nBindTexImage
(JNIEnv *env, jclass clazz, jint handle, jint buffer)
(JNIEnv *env, jclass clazz, jobject handle_buffer, jint buffer)
{
throwException(env, "The render-to-texture extension is not supported.");
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Pbuffer_nReleaseTexImage
(JNIEnv *env, jclass clazz, jint handle, jint buffer)
(JNIEnv *env, jclass clazz, jobject handle_buffer, jint buffer)
{
throwException(env, "The render-to-texture extension is not supported.");
}