More java-side pointer arithmetic.

Fixed pointer cast warning.
This commit is contained in:
Ioannis Tsakpinis 2011-07-16 16:42:51 +00:00
parent 0b0e185f47
commit 4a02aed129
11 changed files with 138 additions and 141 deletions

View File

@ -37,6 +37,7 @@ import java.util.HashMap;
import org.lwjgl.BufferChecks;
import org.lwjgl.LWJGLException;
import org.lwjgl.MemoryUtil;
/**
*
@ -180,10 +181,10 @@ public final class ALC10 {
*/
public static void alcGetInteger(ALCdevice device, int pname, IntBuffer integerdata) {
BufferChecks.checkDirect(integerdata);
nalcGetIntegerv(getDevice(device), pname, integerdata.remaining(), integerdata, integerdata.position());
nalcGetIntegerv(getDevice(device), pname, integerdata.remaining(), MemoryUtil.getAddress(integerdata));
Util.checkALCError(device);
}
static native void nalcGetIntegerv(long device, int pname, int size, Buffer integerdata, int offset);
static native void nalcGetIntegerv(long device, int pname, int size, long integerdata);
/**
* The <code>alcOpenDevice</code> function allows the application (i.e. the client program) to
@ -246,7 +247,7 @@ public final class ALC10 {
* @return New context, or null if creation failed
*/
public static ALCcontext alcCreateContext(ALCdevice device, IntBuffer attrList) {
long context_address = nalcCreateContext(getDevice(device), attrList);
long context_address = nalcCreateContext(getDevice(device), MemoryUtil.getAddressSafe(attrList));
Util.checkALCError(device);
if(context_address != 0) {
@ -259,7 +260,7 @@ public final class ALC10 {
}
return null;
}
static native long nalcCreateContext(long device, IntBuffer attrList);
static native long nalcCreateContext(long device, long attrList);
/**
* To make a Context current with respect to AL Operation (state changes by issueing

View File

@ -37,7 +37,7 @@ import java.nio.IntBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.MemoryUtil;
/**
* <p>
@ -162,9 +162,9 @@ public final class ALC11 {
* @param samples Number of samples to request
*/
public static void alcCaptureSamples(ALCdevice device, ByteBuffer buffer, int samples ) {
nalcCaptureSamples(ALC10.getDevice(device), buffer, buffer.position(), samples);
nalcCaptureSamples(ALC10.getDevice(device), MemoryUtil.getAddress(buffer), samples);
}
static native void nalcCaptureSamples(long device, ByteBuffer buffer, int position, int samples );
static native void nalcCaptureSamples(long device, long buffer, int samples );
static native void initNativeStubs() throws LWJGLException;

View File

@ -33,9 +33,9 @@ package org.lwjgl.opengles;
import org.lwjgl.BufferChecks;
import org.lwjgl.LWJGLException;
import org.lwjgl.MemoryUtil;
import org.lwjgl.PointerBuffer;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
/** EGL wrapper class. */
@ -266,11 +266,11 @@ public final class EGL {
static void eglInitialize(EGLDisplay dpy, IntBuffer version) throws LWJGLException {
//LWJGLUtil.log("eglInitialize");
BufferChecks.checkBuffer(version, 2);
if ( !neglInitialize(dpy.getPointer(), version, version.position()) )
if ( !neglInitialize(dpy.getPointer(), MemoryUtil.getAddress(version)) )
throwEGLError("Failed to initialize EGL display.");
}
private static native boolean neglInitialize(long dpy_ptr, IntBuffer version, int version_position);
private static native boolean neglInitialize(long dpy_ptr, long version);
/**
* Release the resources associated with the specified EGL display.
@ -314,7 +314,7 @@ public final class EGL {
//LWJGLUtil.log("eglGetConfigsNum");
IntBuffer num_config = APIUtil.getBufferInt();
if ( !neglGetConfigs(dpy.getPointer(), null, 0, 0, num_config, num_config.position()) )
if ( !neglGetConfigs(dpy.getPointer(), 0L, 0, MemoryUtil.getAddress0(num_config)) )
throwEGLError("Failed to get EGL configs.");
return num_config.get(0);
@ -340,14 +340,14 @@ public final class EGL {
BufferChecks.checkBuffer(num_config, 1);
if ( configs == null ) {
if ( !neglGetConfigs(dpy.getPointer(), null, 0, 0, num_config, num_config.position()) )
if ( !neglGetConfigs(dpy.getPointer(), 0L, 0, MemoryUtil.getAddress(num_config)) )
throwEGLError("Failed to get number of available EGL configs.");
configs = new EGLConfig[num_config.get(num_config.position())];
}
final PointerBuffer configs_buffer = APIUtil.getBufferPointer(configs.length);
if ( !neglGetConfigs(dpy.getPointer(), configs_buffer.getBuffer(), 0, configs.length, num_config, num_config.position()) )
if ( !neglGetConfigs(dpy.getPointer(), MemoryUtil.getAddress0(configs_buffer), configs.length, MemoryUtil.getAddress(num_config)) )
throwEGLError("Failed to get EGL configs.");
final int config_size = num_config.get(num_config.position());
@ -357,7 +357,7 @@ public final class EGL {
return configs;
}
private static native boolean neglGetConfigs(long dpy_ptr, ByteBuffer configs, int configs_position, int config_size, IntBuffer num_config, int num_config_position);
private static native boolean neglGetConfigs(long dpy_ptr, long configs, int config_size, long num_config);
/**
* Returns the number of EGLConfigs that are available on the specified display and
@ -376,7 +376,7 @@ public final class EGL {
checkAttribList(attrib_list);
IntBuffer num_config = APIUtil.getBufferInt();
if ( !neglChooseConfig(dpy.getPointer(), attrib_list, attrib_list == null ? 0 : attrib_list.position(), null, 0, 0, num_config, num_config.position()) )
if ( !neglChooseConfig(dpy.getPointer(), MemoryUtil.getAddressSafe(attrib_list), 0L, 0, MemoryUtil.getAddress0(num_config)) )
throwEGLError("Failed to get EGL configs.");
return num_config.get(0);
@ -405,7 +405,7 @@ public final class EGL {
int config_size;
if ( configs == null ) {
if ( !neglChooseConfig(dpy.getPointer(), attrib_list, attrib_list == null ? 0 : attrib_list.position(), null, 0, 0, num_config, num_config.position()) )
if ( !neglChooseConfig(dpy.getPointer(), MemoryUtil.getAddressSafe(attrib_list), 0L, 0, MemoryUtil.getAddress(num_config)) )
throwEGLError("Failed to get number of available EGL configs.");
config_size = num_config.get(num_config.position());
@ -414,7 +414,7 @@ public final class EGL {
//LWJGLUtil.log("config_size = " + config_size);
PointerBuffer configs_buffer = APIUtil.getBufferPointer(config_size);
if ( !neglChooseConfig(dpy.getPointer(), attrib_list, attrib_list == null ? 0 : attrib_list.position(), configs_buffer.getBuffer(), 0, config_size, num_config, num_config.position()) )
if ( !neglChooseConfig(dpy.getPointer(), MemoryUtil.getAddressSafe(attrib_list), MemoryUtil.getAddress0(configs_buffer), config_size, MemoryUtil.getAddress(num_config)) )
throwEGLError("Failed to choose EGL config.");
// Get the true number of configurations (the first neglChooseConfig call may return more than the second)
@ -427,7 +427,7 @@ public final class EGL {
return configs;
}
private static native boolean neglChooseConfig(long dpy_ptr, IntBuffer attrib_list, int attrib_list_position, ByteBuffer configs, int configs_position, int config_size, IntBuffer num_config, int num_config_position);
private static native boolean neglChooseConfig(long dpy_ptr, long attrib_list, long configs, int config_size, long num_config);
/**
* Returns the value of an EGL config attribute.
@ -442,13 +442,13 @@ public final class EGL {
//LWJGLUtil.log("eglGetConfigAttrib");
final IntBuffer value = APIUtil.getBufferInt();
if ( !neglGetConfigAttrib(dpy.getPointer(), config.getPointer(), attribute, value, value.position()) )
if ( !neglGetConfigAttrib(dpy.getPointer(), config.getPointer(), attribute, MemoryUtil.getAddress(value)) )
throwEGLError("Failed to get EGL config attribute.");
return value.get(0);
}
private static native boolean neglGetConfigAttrib(long dpy_ptr, long config_ptr, int attribute, IntBuffer value, int value_position);
private static native boolean neglGetConfigAttrib(long dpy_ptr, long config_ptr, int attribute, long value);
/**
* Creates an on-screen rendering surface on the specified EGL display.
@ -465,7 +465,7 @@ public final class EGL {
static EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, long win, IntBuffer attrib_list) throws LWJGLException {
//LWJGLUtil.log("eglCreateWindowSurface");
checkAttribList(attrib_list);
final long pointer = neglCreateWindowSurface(dpy.getPointer(), config.getPointer(), win, attrib_list, attrib_list == null ? 0 : attrib_list.position());
final long pointer = neglCreateWindowSurface(dpy.getPointer(), config.getPointer(), win, MemoryUtil.getAddressSafe(attrib_list));
if ( pointer == EGL_NO_SURFACE )
throwEGLError("Failed to create EGL window surface.");
@ -473,7 +473,7 @@ public final class EGL {
return new EGLSurface(dpy, config, pointer);
}
private static native long neglCreateWindowSurface(long dpy_ptr, long config_ptr, long win, IntBuffer attrib_list, int attrib_list_position);
private static native long neglCreateWindowSurface(long dpy_ptr, long config_ptr, long win, long attrib_list);
/**
* Creates an off-screen rendering surface on the specified EGL display.
@ -489,7 +489,7 @@ public final class EGL {
static EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, IntBuffer attrib_list) throws LWJGLException {
//LWJGLUtil.log("eglCreatePbufferSurface");
checkAttribList(attrib_list);
final long pointer = neglCreatePbufferSurface(dpy.getPointer(), config.getPointer(), attrib_list, attrib_list == null ? 0 : attrib_list.position());
final long pointer = neglCreatePbufferSurface(dpy.getPointer(), config.getPointer(), MemoryUtil.getAddressSafe(attrib_list));
if ( pointer == EGL_NO_SURFACE )
throwEGLError("Failed to create EGL pbuffer surface.");
@ -497,7 +497,7 @@ public final class EGL {
return new EGLSurface(dpy, config, pointer);
}
private static native long neglCreatePbufferSurface(long dpy_ptr, long config_ptr, IntBuffer attrib_list, int attrib_list_position);
private static native long neglCreatePbufferSurface(long dpy_ptr, long config_ptr, long attrib_list);
/*
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
@ -550,11 +550,11 @@ public final class EGL {
public static void eglQuerySurface(EGLDisplay dpy, EGLSurface surface, int attribute, IntBuffer value) throws LWJGLException {
//LWJGLUtil.log("eglQuerySurface");
BufferChecks.checkBuffer(value, 1);
if ( !neglQuerySurface(dpy.getPointer(), surface.getPointer(), attribute, value, value.position()) )
if ( !neglQuerySurface(dpy.getPointer(), surface.getPointer(), attribute, MemoryUtil.getAddress(value)) )
throwEGLError("Failed to query surface attribute.");
}
private static native boolean neglQuerySurface(long dpy_ptr, long surface_ptr, int attribute, IntBuffer value, int value_position);
private static native boolean neglQuerySurface(long dpy_ptr, long surface_ptr, int attribute, long value);
/**
* Binds the specified rendering API to the current thread.
@ -627,7 +627,7 @@ public final class EGL {
checkAttribList(attrib_list);
final long pointer = neglCreateContext(dpy.getPointer(), config.getPointer(),
share_context == null ? EGL_NO_CONTEXT : share_context.getPointer(),
attrib_list, attrib_list == null ? 0 : attrib_list.position());
MemoryUtil.getAddressSafe(attrib_list));
if ( pointer == EGL_NO_CONTEXT )
throwEGLError("Failed to create EGL context.");
@ -635,7 +635,7 @@ public final class EGL {
return new EGLContext(dpy, config, pointer);
}
private static native long neglCreateContext(long dpy_ptr, long config_ptr, long share_context_ptr, IntBuffer attrib_list, int attrib_list_position);
private static native long neglCreateContext(long dpy_ptr, long config_ptr, long share_context_ptr, long attrib_list);
/**
* Destroys a rendering context.
@ -714,7 +714,7 @@ public final class EGL {
// Query context's CONFIG_ID
final IntBuffer attrib_list = APIUtil.getBufferInt();
neglQueryContext(display.getPointer(), ctx, EGL_CONFIG_ID, attrib_list, 0);
neglQueryContext(display.getPointer(), ctx, EGL_CONFIG_ID, MemoryUtil.getAddress0(attrib_list));
final EGLConfig config = getEGLConfig(display, attrib_list);
@ -761,7 +761,7 @@ public final class EGL {
// Query context's CONFIG_ID
final IntBuffer attrib_list = APIUtil.getBufferInt();
if ( !neglQuerySurface(display.getPointer(), surface, EGL_CONFIG_ID, attrib_list, 0) )
if ( !neglQuerySurface(display.getPointer(), surface, EGL_CONFIG_ID, MemoryUtil.getAddress0(attrib_list)) )
throwEGLError("Failed to query surface EGL config ID.");
final EGLConfig config = getEGLConfig(display, attrib_list);
@ -799,11 +799,11 @@ public final class EGL {
public static void eglQueryContext(EGLDisplay dpy, EGLContext ctx, int attribute, IntBuffer value) throws LWJGLException {
//LWJGLUtil.log("eglQueryContext");
BufferChecks.checkBuffer(value, 1);
if ( !neglQueryContext(dpy.getPointer(), ctx.getPointer(), attribute, value, value.position()) )
if ( !neglQueryContext(dpy.getPointer(), ctx.getPointer(), attribute, MemoryUtil.getAddress(value)) )
throwEGLError("Failed to query context attribute.");
}
private static native boolean neglQueryContext(long dpy_ptr, long ctx_ptr, int attribute, IntBuffer value, int value_position);
private static native boolean neglQueryContext(long dpy_ptr, long ctx_ptr, int attribute, long value);
/**
* Prevents native rendering API functions from executing until any
@ -883,7 +883,7 @@ public final class EGL {
attrib_list.put(0, EGL_CONFIG_ID).put(1, configID).put(2, EGL_NONE);
final PointerBuffer configs_buffer = APIUtil.getBufferPointer(1);
if ( !neglChooseConfig(dpy.getPointer(), attrib_list, attrib_list.position(), configs_buffer.getBuffer(), 0, 1, attrib_list, attrib_list.position() + 3) )
if ( !neglChooseConfig(dpy.getPointer(), MemoryUtil.getAddress(attrib_list), MemoryUtil.getAddress0(configs_buffer), 1, MemoryUtil.getAddress(attrib_list, 3)) )
throwEGLError("Failed to choose EGL config.");
return new EGLConfig(dpy, configs_buffer.get(0));

View File

@ -32,6 +32,7 @@
package org.lwjgl.opengles;
import org.lwjgl.LWJGLException;
import org.lwjgl.MemoryUtil;
import java.nio.IntBuffer;
@ -102,7 +103,7 @@ public final class EGLKHRFenceSync {
public static EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, int type, IntBuffer attrib_list) throws LWJGLException {
checkAttribList(attrib_list);
final long pointer = neglCreateSyncKHR(dpy.getPointer(), type, attrib_list, attrib_list == null ? 0 : attrib_list.position());
final long pointer = neglCreateSyncKHR(dpy.getPointer(), type, MemoryUtil.getAddressSafe(attrib_list));
if ( pointer == EGL_NO_SYNC_KHR )
throwEGLError("Failed to create KHR fence sync object.");
@ -110,7 +111,7 @@ public final class EGLKHRFenceSync {
return new EGLSyncKHR(pointer);
}
private static native long neglCreateSyncKHR(long dpy_ptr, int type, IntBuffer attrib_list, int attrib_list_position);
private static native long neglCreateSyncKHR(long dpy_ptr, int type, long attrib_list);
/**
* Destroys an existing sync object.
@ -162,12 +163,12 @@ public final class EGLKHRFenceSync {
public static int eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, int attribute) throws LWJGLException {
final IntBuffer value = APIUtil.getBufferInt();
if ( !neglGetSyncAttribKHR(dpy.getPointer(), sync.getPointer(), attribute, value, value.position()) )
if ( !neglGetSyncAttribKHR(dpy.getPointer(), sync.getPointer(), attribute, MemoryUtil.getAddress(value)) )
throwEGLError("Failed to get KHR fence sync object attribute.");
return value.get(0);
}
private static native boolean neglGetSyncAttribKHR(long dpy_ptr, long sync_ptr, int attribute, IntBuffer value, int value_position);
private static native boolean neglGetSyncAttribKHR(long dpy_ptr, long sync_ptr, int attribute, long value);
}

View File

@ -32,6 +32,7 @@
package org.lwjgl.opengles;
import org.lwjgl.LWJGLException;
import org.lwjgl.MemoryUtil;
import java.nio.IntBuffer;
@ -112,7 +113,7 @@ public final class EGLNVSync {
public static EGLSyncNV eglCreateFenceSyncNV(EGLDisplay dpy, int condition, IntBuffer attrib_list) throws LWJGLException {
checkAttribList(attrib_list);
final long pointer = neglCreateFenceSyncNV(dpy.getPointer(), condition, attrib_list, attrib_list == null ? 0 : attrib_list.position());
final long pointer = neglCreateFenceSyncNV(dpy.getPointer(), condition, MemoryUtil.getAddressSafe(attrib_list));
if ( pointer == EGL_NO_SYNC_NV )
throwEGLError("Failed to create NV fence sync object.");
@ -120,7 +121,7 @@ public final class EGLNVSync {
return new EGLSyncNV(pointer);
}
private static native long neglCreateFenceSyncNV(long dpy_ptr, int condition, IntBuffer attrib_list, int attrib_list_position);
private static native long neglCreateFenceSyncNV(long dpy_ptr, int condition, long attrib_list);
/**
* Destroys an existing sync object.
@ -203,12 +204,12 @@ public final class EGLNVSync {
public static int eglGetSyncAttribNV(EGLSyncNV sync, int attribute) throws LWJGLException {
final IntBuffer value = APIUtil.getBufferInt();
if ( !neglGetSyncAttribNV(sync.getPointer(), attribute, value, 0) )
if ( !neglGetSyncAttribNV(sync.getPointer(), attribute, MemoryUtil.getAddress0(value)) )
throwEGLError("Failed to get NV fence sync object attribute.");
return value.get(0);
}
private static native boolean neglGetSyncAttribNV(long sync_ptr, int attribute, IntBuffer value, int value_position);
private static native boolean neglGetSyncAttribNV(long sync_ptr, int attribute, long value);
}

View File

@ -298,7 +298,7 @@ public class NativeMethodStubsGenerator {
writer.print("\t" + native_type + param.getSimpleName());
writer.print(BUFFER_ADDRESS_POSTFIX + " = (");
writer.print(native_type);
writer.print(")");
writer.print(")(intptr_t)");
if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null) {
writer.print("offsetToPointer(" + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX + ")");

View File

@ -43,9 +43,9 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglGetDisplay(JNIEnv *env,
return (intptr_t)eglGetDisplay((EGLNativeDisplayType)(intptr_t)display_id);
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglInitialize(JNIEnv *env, jclass clazz, jlong dpy_ptr, jobject version, jint version_position) {
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglInitialize(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong version) {
EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
EGLint *version_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, version)) + version_position;
EGLint *version_address = (EGLint *)(intptr_t)version;
return eglInitialize(dpy, version_address, version_address + 1);
}
@ -65,43 +65,43 @@ JNIEXPORT jstring JNICALL Java_org_lwjgl_opengles_EGL_neglQueryString(JNIEnv *en
return NewStringNativeWithLength(env, __result, strlen(__result));
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglGetConfigs(JNIEnv *env, jclass clazz, jlong dpy_ptr, jobject configs, jint configs_position, jint config_size, jobject num_config, jint num_config_position) {
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglGetConfigs(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong configs, jint config_size, jlong num_config) {
EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
EGLConfig *configs_address = ((EGLConfig *)safeGetBufferAddress(env, configs)) + configs_position;
EGLint *num_config_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, num_config)) + num_config_position;
EGLConfig *configs_address = (EGLConfig *)(intptr_t)configs;
EGLint *num_config_address = (EGLint *)(intptr_t)num_config;
return eglGetConfigs(dpy, configs_address, config_size, num_config_address);
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglChooseConfig(JNIEnv *env, jclass clazz, jlong dpy_ptr, jobject attrib_list, jint attrib_list_position, jobject configs, jint configs_position, jint config_size, jobject num_config, jint num_config_position) {
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglChooseConfig(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong attrib_list, jlong configs, jint config_size, jlong num_config) {
EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
const EGLint *attrib_list_address = ((EGLint *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
EGLConfig *configs_address = ((EGLConfig *)safeGetBufferAddress(env, configs)) + configs_position;
EGLint *num_config_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, num_config)) + num_config_position;
const EGLint *attrib_list_address = (EGLint *)(intptr_t)attrib_list;
EGLConfig *configs_address = (EGLConfig *)(intptr_t)configs;
EGLint *num_config_address = (EGLint *)(intptr_t)num_config;
return eglChooseConfig(dpy, attrib_list_address, configs_address, config_size, num_config_address);
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglGetConfigAttrib(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong config_ptr, jint attribute, jobject value, jint value_position) {
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglGetConfigAttrib(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong config_ptr, jint attribute, jlong value) {
EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
EGLConfig config = (EGLConfig)(intptr_t)config_ptr;
EGLint *value_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, value)) + value_position;
EGLint *value_address = (EGLint *)(intptr_t)value;
return eglGetConfigAttrib(dpy, config, attribute, value_address);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglCreateWindowSurface(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong config_ptr, jlong win, jobject attrib_list, jint attrib_list_position) {
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglCreateWindowSurface(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong config_ptr, jlong win, jlong attrib_list) {
EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
EGLConfig config = (EGLConfig)(intptr_t)config_ptr;
const EGLint *attrib_list_address = ((EGLint *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
const EGLint *attrib_list_address = (EGLint *)(intptr_t)attrib_list;
return (intptr_t)eglCreateWindowSurface(dpy, config, (EGLNativeWindowType)(intptr_t)win, attrib_list_address);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglCreatePbufferSurface(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong config_ptr, jobject attrib_list, jint attrib_list_position) {
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglCreatePbufferSurface(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong config_ptr, jlong attrib_list) {
EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
EGLConfig config = (EGLConfig)(intptr_t)config_ptr;
const EGLint *attrib_list_address = ((EGLint *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
const EGLint *attrib_list_address = (EGLint *)(intptr_t)attrib_list;
return (intptr_t)eglCreatePbufferSurface(dpy, config, attrib_list_address);
}
@ -120,10 +120,10 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglSurfaceAttrib(JNIEnv
return eglSurfaceAttrib(dpy, surface, attribute, value);
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglQuerySurface(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong surface_ptr, jint attribute, jobject value, jint value_position) {
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglQuerySurface(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong surface_ptr, jint attribute, jlong value) {
EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
EGLSurface surface = (EGLSurface)(intptr_t)surface_ptr;
EGLint *value_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, value)) + value_position;
EGLint *value_address = (EGLint *)(intptr_t)value;
return eglQuerySurface(dpy, surface, attribute, value_address);
}
@ -145,11 +145,11 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglSwapInterval(JNIEnv *
return eglSwapInterval(dpy, interval);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglCreateContext(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong config_ptr, jlong share_context_ptr, jobject attrib_list, jint attrib_list_position) {
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglCreateContext(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong config_ptr, jlong share_context_ptr, jlong attrib_list) {
EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
EGLConfig config = (EGLConfig)(intptr_t)config_ptr;
EGLContext share_context = (EGLContext)(intptr_t)share_context_ptr;
const EGLint *attrib_list_address = ((EGLint *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
const EGLint *attrib_list_address = (EGLint *)(intptr_t)attrib_list;
return (intptr_t)eglCreateContext(dpy, config, share_context, attrib_list_address);
}
@ -182,10 +182,10 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglGetCurrentDisplay(JNIEnv
return (intptr_t)eglGetCurrentDisplay();
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglQueryContext(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong ctx_ptr, jint attribute, jobject value, jint value_position) {
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglQueryContext(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong ctx_ptr, jint attribute, jlong value) {
EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
EGLContext ctx = (EGLContext)(intptr_t)ctx_ptr;
EGLint *value_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, value)) + value_position;
EGLint *value_address = (EGLint *)(intptr_t)value;
return eglQueryContext(dpy, ctx, attribute, value_address);

View File

@ -40,9 +40,9 @@ static PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR;
static PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR;
static PFNEGLGETSYNCATTRIBKHRPROC eglGetSyncAttribKHR;
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglCreateSyncKHR(JNIEnv *env, jclass clazz, jlong dpy_ptr, jint type, jobject attrib_list, jint attrib_list_position) {
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglCreateSyncKHR(JNIEnv *env, jclass clazz, jlong dpy_ptr, jint type, jlong attrib_list) {
EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
const EGLint *attrib_list_address = ((EGLint *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
const EGLint *attrib_list_address = (EGLint *)(intptr_t)attrib_list;
return (intptr_t)eglCreateSyncKHR(dpy, type, attrib_list_address);
}
@ -61,20 +61,20 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglClientWaitSyn
return eglClientWaitSyncKHR(dpy, sync, flags, timeout);
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglGetSyncAttribKHR(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong sync_ptr, jint attribute, jobject value, jint value_position) {
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglGetSyncAttribKHR(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong sync_ptr, jint attribute, jlong value) {
EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
EGLSyncKHR sync = (EGLSyncKHR)(intptr_t)sync_ptr;
EGLint *value_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, value)) + value_position;
EGLint *value_address = (EGLint *)(intptr_t)value;
return eglGetSyncAttribKHR(dpy, sync, attribute, value_address);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_initNativeStubs(JNIEnv *env, jclass clazz) {
JavaMethodAndExtFunction functions[] = {
{"neglCreateSyncKHR", "(JILjava/nio/IntBuffer;I)J", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglCreateSyncKHR, "eglCreateSyncKHR", (void *)&eglCreateSyncKHR},
{"neglCreateSyncKHR", "(JIJ)J", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglCreateSyncKHR, "eglCreateSyncKHR", (void *)&eglCreateSyncKHR},
{"neglDestroySyncKHR", "(JJ)Z", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglDestroySyncKHR, "eglDestroySyncKHR", (void *)&eglDestroySyncKHR},
{"neglClientWaitSyncKHR", "(JJIJ)I", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglClientWaitSyncKHR, "eglClientWaitSyncKHR", (void *)&eglClientWaitSyncKHR},
{"neglGetSyncAttribKHR", "(JJILjava/nio/IntBuffer;I)Z", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglGetSyncAttribKHR, "eglGetSyncAttribKHR", (void *)&eglGetSyncAttribKHR}
{"neglGetSyncAttribKHR", "(JJIJ)Z", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglGetSyncAttribKHR, "eglGetSyncAttribKHR", (void *)&eglGetSyncAttribKHR}
};
int num_functions = NUMFUNCTIONS(functions);
extgl_InitializeClass(env, clazz, num_functions, functions);

View File

@ -42,9 +42,9 @@ static PFNEGLCLIENTWAITSYNCNVPROC eglClientWaitSyncNV;
static PFNEGLSIGNALSYNCNVPROC eglSignalSyncNV;
static PFNEGLGETSYNCATTRIBNVPROC eglGetSyncAttribNV;
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglCreateFenceSyncNV(JNIEnv *env, jclass clazz, jlong dpy_ptr, jint condition, jobject attrib_list, jint attrib_list_position) {
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglCreateFenceSyncNV(JNIEnv *env, jclass clazz, jlong dpy_ptr, jint condition, jlong attrib_list) {
EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
const EGLint *attrib_list_address = ((EGLint *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
const EGLint *attrib_list_address = (EGLint *)(intptr_t)attrib_list;
return (intptr_t)eglCreateFenceSyncNV(dpy, condition, attrib_list_address);
}
@ -73,21 +73,21 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglSignalSyncNV(JN
return eglSignalSyncNV(sync, mode);
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglGetSyncAttribNV(JNIEnv *env, jclass clazz, jlong sync_ptr, jint attribute, jobject value, jint value_position) {
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglGetSyncAttribNV(JNIEnv *env, jclass clazz, jlong sync_ptr, jint attribute, jlong value) {
EGLSyncNV sync = (EGLSyncNV)(intptr_t)sync_ptr;
EGLint *value_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, value)) + value_position;
EGLint *value_address = (EGLint *)(intptr_t)value;
return eglGetSyncAttribNV(sync, attribute, value_address);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengles_EGLNVSync_initNativeStubs(JNIEnv *env, jclass clazz) {
JavaMethodAndExtFunction functions[] = {
{"neglCreateFenceSyncNV", "(JILjava/nio/IntBuffer;I)J", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglCreateFenceSyncNV, "eglCreateFenceSyncNV", (void *)&eglCreateFenceSyncNV},
{"neglCreateFenceSyncNV", "(JIJ)J", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglCreateFenceSyncNV, "eglCreateFenceSyncNV", (void *)&eglCreateFenceSyncNV},
{"neglDestroySyncNV", "(J)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglDestroySyncNV, "eglDestroySyncNV", (void *)&eglDestroySyncNV},
{"neglFenceNV", "(J)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglFenceNV, "eglFenceNV", (void *)&eglFenceNV},
{"neglClientWaitSyncNV", "(JIJ)I", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglClientWaitSyncNV, "eglClientWaitSyncNV", (void *)&eglClientWaitSyncNV},
{"neglSignalSyncNV", "(JI)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglSignalSyncNV, "eglSignalSyncNV", (void *)&eglSignalSyncNV},
{"neglGetSyncAttribNV", "(JILjava/nio/IntBuffer;I)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglGetSyncAttribNV, "eglGetSyncAttribNV", (void *)&eglGetSyncAttribNV}
{"neglGetSyncAttribNV", "(JIJ)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglGetSyncAttribNV, "eglGetSyncAttribNV", (void *)&eglGetSyncAttribNV}
};
int num_functions = NUMFUNCTIONS(functions);
extgl_InitializeClass(env, clazz, num_functions, functions);

View File

@ -1,40 +1,40 @@
/*
/*
* Copyright (c) 2002-2008 LWJGL Project
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* $Id: org_lwjgl_openal_ALC.c 2279 2006-02-23 19:22:00Z elias_naur $
*
* This is the actual JNI implementation of the OpenAL context/device library.
*
* This is the actual JNI implementation of the OpenAL context/device library.
*
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision: 2279 $
*/
@ -103,8 +103,8 @@ static jstring JNICALL Java_org_lwjgl_openal_ALC10_nalcGetString (JNIEnv *env, j
break;
}
case 0x1013: // ALC_ALL_DEVICES_SPECIFIER
while (alcString[i - 1] != '\0' || alcString[i] != '\0') {
i++;
while (alcString[i - 1] != '\0' || alcString[i] != '\0') {
i++;
}
length = i + 1;
break;
@ -116,21 +116,18 @@ static jstring JNICALL Java_org_lwjgl_openal_ALC10_nalcGetString (JNIEnv *env, j
/**
* This function returns integers related to the context.
*
*
* C Specification:
* ALvoid alcGetIntegerv(ALCdevice *device, ALenum token, ALsizei size, ALint *dest);
*/
static void JNICALL Java_org_lwjgl_openal_ALC10_nalcGetIntegerv (JNIEnv *env, jclass clazz, jlong deviceaddress, jint token, jint size, jobject dest, jint offset) {
ALint* address = NULL;
if (dest != NULL) {
address = offset + (ALint*) (*env)->GetDirectBufferAddress(env, dest);
}
alcGetIntegerv((ALCdevice*)((intptr_t)deviceaddress), (ALenum) token, (ALsizei) size, address);
static void JNICALL Java_org_lwjgl_openal_ALC10_nalcGetIntegerv (JNIEnv *env, jclass clazz, jlong deviceaddress, jint token, jint size, jlong dest) {
ALint* dest_address = (ALint*)(intptr_t)dest;
alcGetIntegerv((ALCdevice*)((intptr_t)deviceaddress), (ALenum) token, (ALsizei) size, dest_address);
}
/**
* This function opens a device by name.
*
*
* C Specification:
* ALCdevice *alcOpenDevice( const ALubyte *tokstr );
*/
@ -156,7 +153,7 @@ static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcOpenDevice (JNIEnv *env, jc
/**
* This function closes a device by name.
*
*
* C Specification:
* bool alcCloseDevice( ALCdevice *dev );
*/
@ -166,19 +163,16 @@ static jboolean JNICALL Java_org_lwjgl_openal_ALC10_nalcCloseDevice (JNIEnv *env
/**
* This function creates a context using a specified device.
*
*
* C Specification:
* ALCcontext* alcCreateContext( ALCdevice *dev, ALint* attrlist );
*/
static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcCreateContext (JNIEnv *env, jclass clazz, jlong deviceaddress, jobject attrlist) {
ALint* address = NULL;
static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcCreateContext (JNIEnv *env, jclass clazz, jlong deviceaddress, jlong attrlist) {
ALint* attrlist_address = (ALint*)(intptr_t)attrlist;
ALCcontext* context;
if (attrlist != NULL) {
address = (ALint*) safeGetBufferAddress(env, attrlist);
}
context = alcCreateContext((ALCdevice*)((intptr_t)deviceaddress), address);
context = alcCreateContext((ALCdevice*)((intptr_t)deviceaddress), attrlist_address);
return (jlong)((intptr_t)context);
}
@ -195,7 +189,7 @@ static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcMakeContextCurrent (JNIEnv *
/**
* This function tells a context to begin processing.
*
*
* C Specification:
* void alcProcessContext(ALCcontext *context);
*/
@ -205,7 +199,7 @@ static void JNICALL Java_org_lwjgl_openal_ALC10_nalcProcessContext (JNIEnv *env,
/**
* This function retrieves the current context.
*
*
* C Specification:
* ALCcontext* alcGetCurrentContext( ALvoid );
*/
@ -216,7 +210,7 @@ static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcGetCurrentContext (JNIEnv *
/**
* This function retrieves the specified contexts device
*
*
* C Specification:
* ALCdevice* alcGetContextsDevice(ALCcontext *context);
*/
@ -237,7 +231,7 @@ static void JNICALL Java_org_lwjgl_openal_ALC10_nalcSuspendContext (JNIEnv *env,
/**
* This function destroys a context.
*
*
* C Specification:
* void alcDestroyContext(ALCcontext *context);
*/
@ -247,7 +241,7 @@ static void JNICALL Java_org_lwjgl_openal_ALC10_nalcDestroyContext (JNIEnv *env,
/**
* This function retrieves the specified devices context error state.
*
*
* C Specification:
* ALCenum alcGetError(ALCdevice *device);
*/
@ -257,18 +251,18 @@ static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcGetError (JNIEnv *env, jclas
/**
* This function queries if a specified context extension is available.
*
*
* C Specification:
* ALboolean alcIsExtensionPresent(ALCdevice *device, ALubyte *extName);
*/
static jboolean JNICALL Java_org_lwjgl_openal_ALC10_nalcIsExtensionPresent (JNIEnv *env, jclass clazz, jlong deviceaddress, jstring extName) {
/* get extension */
ALubyte* functionname = (ALubyte*) GetStringNativeChars(env, extName);
jboolean result = (jboolean) alcIsExtensionPresent((ALCdevice*)((intptr_t)deviceaddress), functionname);
free(functionname);
return result;
}
@ -278,14 +272,14 @@ static jboolean JNICALL Java_org_lwjgl_openal_ALC10_nalcIsExtensionPresent (JNIE
* C Specification:
* ALenum alcGetEnumValue(ALCdevice *device, ALubyte *enumName);
*/
static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcGetEnumValue (JNIEnv *env, jclass clazz, jlong deviceaddress, jstring enumName) {
static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcGetEnumValue (JNIEnv *env, jclass clazz, jlong deviceaddress, jstring enumName) {
/* get extension */
ALubyte* enumerationname = (ALubyte*) GetStringNativeChars(env, enumName);
jint result = (jint) alcGetEnumValue((ALCdevice*)((intptr_t)deviceaddress), enumerationname);
free(enumerationname);
return result;
}

View File

@ -1,40 +1,40 @@
/*
/*
* Copyright (c) 2002-2008 LWJGL Project
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* $Id: org_lwjgl_openal_ALC.c 2279 2006-02-23 19:22:00Z elias_naur $
*
* This is the actual JNI implementation of the OpenAL context/device library.
*
* This is the actual JNI implementation of the OpenAL context/device library.
*
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision: 2279 $
*/
@ -106,8 +106,8 @@ static void JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureStop(JNIEnv * env, jc
* Method: nalcCaptureSamples
* Signature: (JLjava/nio/ByteBuffer;I)V
*/
static void JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureSamples(JNIEnv *env, jclass clazz, jlong device, jobject buffer, jint position, jint samples) {
ALvoid *buffer_address = ((ALbyte *)(((char*)(*env)->GetDirectBufferAddress(env, buffer)) + position));
static void JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureSamples(JNIEnv *env, jclass clazz, jlong device, jlong buffer, jint samples) {
ALvoid *buffer_address = (ALbyte *)(intptr_t)buffer;
alcCaptureSamples((ALCdevice*) ((intptr_t)device), buffer_address, samples);
}