OpenGL1.5 support

This commit is contained in:
Ioannis Tsakpinis 2004-02-15 15:21:24 +00:00
parent a2aedd996b
commit f3e853d70b
6 changed files with 1255 additions and 385 deletions

View File

@ -0,0 +1,299 @@
/*
* Copyright (c) 2002 Lightweight Java Game Library Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * 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 'Light Weight Java Game Library' 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
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* 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.
*/
/*
* Created by LWJGL.
* User: spasi
* Date: 02-15-2004
* Time: 4:14:52 pm
*/
package org.lwjgl.opengl;
import java.nio.*;
public class GL15 extends GL14 {
// ----------------------------------------------------------------------
// ---------------------- ARB_vertex_buffer_object ----------------------
// ----------------------------------------------------------------------
public static final int GL_ARRAY_BUFFER = 0x8892;
public static final int GL_ELEMENT_ARRAY_BUFFER = 0x8893;
public static final int GL_ARRAY_BUFFER_BINDING = 0x8894;
public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING = 0x8895;
public static final int GL_VERTEX_ARRAY_BUFFER_BINDING = 0x8896;
public static final int GL_NORMAL_ARRAY_BUFFER_BINDING = 0x8897;
public static final int GL_COLOR_ARRAY_BUFFER_BINDING = 0x8898;
public static final int GL_INDEX_ARRAY_BUFFER_BINDING = 0x8899;
public static final int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = 0x889A;
public static final int GL_EDGE_FLAG_ARRAY_BUFFER_BINDING = 0x889B;
public static final int GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING = 0x889C;
public static final int GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING = 0x889D;
public static final int GL_WEIGHT_ARRAY_BUFFER_BINDING = 0x889E;
public static final int GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;
public static final int GL_STREAM_DRAW = 0x88E0;
public static final int GL_STREAM_READ = 0x88E1;
public static final int GL_STREAM_COPY = 0x88E2;
public static final int GL_STATIC_DRAW = 0x88E4;
public static final int GL_STATIC_READ = 0x88E5;
public static final int GL_STATIC_COPY = 0x88E6;
public static final int GL_DYNAMIC_DRAW = 0x88E8;
public static final int GL_DYNAMIC_READ = 0x88E9;
public static final int GL_DYNAMIC_COPY = 0x88EA;
public static final int GL_READ_ONLY = 0x88B8;
public static final int GL_WRITE_ONLY = 0x88B9;
public static final int GL_READ_WRITE = 0x88BA;
public static final int GL_BUFFER_SIZE = 0x8764;
public static final int GL_BUFFER_USAGE = 0x8765;
public static final int GL_BUFFER_ACCESS = 0x88BB;
public static final int GL_BUFFER_MAPPED = 0x88BC;
public static final int GL_BUFFER_MAP_POINTER = 0x88BD;
public static void glBindBuffer(int target, int buffer) {
switch ( target ) {
case GL_ELEMENT_ARRAY_BUFFER:
VBOTracker.getVBOElementStack().setState(buffer);
break;
case GL_ARRAY_BUFFER:
VBOTracker.getVBOArrayStack().setState(buffer);
break;
default:
assert false: "Unsupported VBO target " + target;
}
nglBindBuffer(target, buffer);
}
private static native void nglBindBuffer(int target, int buffer);
public static void glDeleteBuffers(IntBuffer buffers) {
for ( int i = buffers.position(); i < buffers.limit(); i++ ) {
int buffer_handle = buffers.get(i);
if ( VBOTracker.getVBOElementStack().getState() == buffer_handle )
VBOTracker.getVBOElementStack().setState(0);
if ( VBOTracker.getVBOArrayStack().getState() == buffer_handle )
VBOTracker.getVBOArrayStack().setState(0);
}
nglDeleteBuffers(buffers.remaining(), buffers, buffers.position());
}
private static native void nglDeleteBuffers(int n, IntBuffer buffers, int buffers_offset);
public static void glGenBuffers(IntBuffer buffers) {
nglGenBuffers(buffers.remaining(), buffers, buffers.position());
}
private static native void nglGenBuffers(int n, IntBuffer buffers, int buffers_offset);
public static native boolean glIsBuffer(int buffer);
public static void glBufferData(int target, int size, ByteBuffer data, int usage) {
nglBufferData(target, size, data, data != null ? data.position() : 0, usage);
}
public static void glBufferData(int target, int size, ShortBuffer data, int usage) {
nglBufferData(target, size, data, data != null ? data.position() << 1 : 0, usage);
}
public static void glBufferData(int target, int size, FloatBuffer data, int usage) {
nglBufferData(target, size, data, data != null ? data.position() << 2 : 0, usage);
}
public static void glBufferData(int target, int size, IntBuffer data, int usage) {
nglBufferData(target, size, data, data != null ? data.position() << 2 : 0, usage);
}
private static native void nglBufferData(int target,
int size,
Buffer data,
int data_offset,
int usage);
public static void glBufferSubData(int target, int offset, ByteBuffer data) {
nglBufferSubData(target, offset, data.remaining(), data, data.position());
}
public static void glBufferSubData(int target, int offset, ShortBuffer data) {
nglBufferSubData(target, offset, data.remaining() << 1, data, data.position() << 1);
}
public static void glBufferSubData(int target, int offset, FloatBuffer data) {
nglBufferSubData(target, offset, data.remaining() << 2, data, data.position() << 2);
}
public static void glBufferSubData(int target, int offset, IntBuffer data) {
nglBufferSubData(target, offset, data.remaining() << 2, data, data.position() << 2);
}
private static native void nglBufferSubData(int target,
int offset,
int size,
Buffer data,
int data_offset);
public static void glGetBufferSubData(int target, int offset, ByteBuffer data) {
nglGetBufferSubData(target, offset, data.remaining(), data, data.position());
}
public static void glGetBufferSubData(int target, int offset, ShortBuffer data) {
nglGetBufferSubData(target, offset, data.remaining() << 1, data, data.position() << 1);
}
public static void glGetBufferSubData(int target, int offset, IntBuffer data) {
nglGetBufferSubData(target, offset, data.remaining() << 2, data, data.position() << 2);
}
public static void glGetBufferSubData(int target, int offset, FloatBuffer data) {
nglGetBufferSubData(target, offset, data.remaining() << 2, data, data.position() << 2);
}
private static native void nglGetBufferSubData(int target,
int offset,
int size,
Buffer data,
int data_offset);
/**
* glMapBuffer maps a gl vertex buffer buffer to a ByteBuffer. The oldBuffer argument can be
* null, in which case a new ByteBuffer will be created, pointing to the returned memory. If
* oldBuffer is non-null, it will be returned if it points to the same mapped memory, otherwise a
* new ByteBuffer is created. That way, an application will normally use glMapBuffer like this:
* <p/>
* ByteBuffer mapped_buffer; mapped_buffer = glMapBuffer(..., ..., ..., null); ... // Another
* map on the same buffer mapped_buffer = glMapBuffer(..., ..., ..., mapped_buffer);
*
* @param size The size of the buffer area.
* @param oldBuffer A ByteBuffer. If this argument points to the same address as the new mapping,
* it will be returned and no new buffer will be created. In that case, size is
* ignored.
*
* @return A ByteBuffer representing the mapped buffer memory.
*/
public static native ByteBuffer glMapBuffer(int target,
int access,
int size,
ByteBuffer oldBuffer);
public static native boolean glUnmapBuffer(int target);
public static void glGetBufferParameter(int target, int pname, IntBuffer params) {
// TODO:check buffer size
nglGetBufferParameteriv(target, pname, params, params.position());
}
private static native void nglGetBufferParameteriv(int target,
int pname,
IntBuffer params,
int params_offset);
public static native ByteBuffer glGetBufferPointer(int target, int pname, int size);
// -----------------------------------------------------------------
// ---------------------- ARB_occlusion_query ----------------------
// -----------------------------------------------------------------
/*
* Accepted by the <target> parameter of BeginQuery, EndQuery,
* and GetQueryiv:
*/
public static final int GL_SAMPLES_PASSED = 0x8914;
/*
Accepted by the <pname> parameter of GetQueryiv:
*/
public static final int GL_QUERY_COUNTER_BITS = 0x8864;
public static final int GL_CURRENT_QUERY = 0x8865;
/*
Accepted by the <pname> parameter of GetQueryObjectiv and
GetQueryObjectuiv:
*/
public static final int GL_QUERY_RESULT = 0x8866;
public static final int GL_QUERY_RESULT_AVAILABLE = 0x8867;
// ---------------------------
public static void glGenQueries(IntBuffer ids) {
nglGenQueries(ids.remaining(), ids, ids.position());
}
private static native void nglGenQueries(int n, IntBuffer ids, int idsOffset);
// ---------------------------
// ---------------------------
public static void glDeleteQueries(IntBuffer ids) {
nglDeleteQueries(ids.remaining(), ids, ids.position());
}
private static native void nglDeleteQueries(int n, IntBuffer ids, int idsOffset);
// ---------------------------
public static native boolean glIsQuery(int id);
public static native void glBeginQuery(int target, int id);
public static native void glEndQuery(int target);
// ---------------------------
public static void glGetQuery(int target, int pname, IntBuffer params) {
nglGetQueryiv(target, pname, params, params.position());
}
private static native void nglGetQueryiv(int target,
int pname,
IntBuffer params,
int paramsOffset);
// ---------------------------
// ---------------------------
public static void glGetQueryObjecti(int id, int pname, IntBuffer params) {
// TODO: check buffer size
nglGetQueryObjectiv(id, pname, params, params.position());
}
private static native void nglGetQueryObjectiv(int id,
int pname,
IntBuffer params,
int paramsOffset);
// ---------------------------
// ---------------------------
public static void glGetQueryObjectui(int id, int pname, IntBuffer params) {
// TODO: check buffer size
nglGetQueryObjectuiv(id, pname, params, params.position());
}
private static native void nglGetQueryObjectuiv(int id,
int pname,
IntBuffer params,
int paramsOffset);
// ---------------------------
}

View File

@ -40,5 +40,8 @@ COMMON = \
org_lwjgl_opengl_GL12.h \
org_lwjgl_opengl_GL13.cpp \
org_lwjgl_opengl_GL13.h \
org_lwjgl_opengl_GL14.cpp
org_lwjgl_opengl_GL14.cpp \
org_lwjgl_opengl_GL14.h \
org_lwjgl_opengl_GL15.cpp \
org_lwjgl_opengl_GL15.h

View File

@ -1116,10 +1116,14 @@ static void extgl_InitSupportedExtensions(JNIEnv *env, jobject ext_set)
extgl_Extensions.OpenGL12 = false;
extgl_Extensions.OpenGL13 = false;
extgl_Extensions.OpenGL14 = false;
extgl_Extensions.OpenGL15 = false;
if (s != NULL)
{
// Fall trhough
switch (s[2]) {
case '5':
extgl_Extensions.OpenGL15 = true;
insertExtension(env, ext_set, "OpenGL15");
case '4':
extgl_Extensions.OpenGL14 = true;
insertExtension(env, ext_set, "OpenGL14");
@ -1290,6 +1294,7 @@ extern void extgl_InitATIVertexStreams(JNIEnv *env, jobject ext_set);
extern void extgl_InitOpenGL1_2(JNIEnv *env, jobject ext_set);
extern void extgl_InitOpenGL1_3(JNIEnv *env, jobject ext_set);
extern void extgl_InitOpenGL1_4(JNIEnv *env, jobject ext_set);
extern void extgl_InitOpenGL1_5(JNIEnv *env, jobject ext_set);
/* extgl_Init the extensions and load all the functions */
bool extgl_Initialize(JNIEnv *env, jobject ext_set)
@ -1363,6 +1368,7 @@ bool extgl_Initialize(JNIEnv *env, jobject ext_set)
extgl_InitOpenGL1_2(env, ext_set);
extgl_InitOpenGL1_3(env, ext_set);
extgl_InitOpenGL1_4(env, ext_set);
extgl_InitOpenGL1_5(env, ext_set);
#ifdef _WIN32
/* load WGL extensions */

View File

@ -3166,6 +3166,7 @@ struct ExtensionTypes
bool OpenGL12;
bool OpenGL13;
bool OpenGL14;
bool OpenGL15;
bool GL_ARB_imaging;
bool GL_ARB_depth_texture;

View File

@ -0,0 +1,362 @@
/*
* Copyright (c) 2002 Lightweight Java Game Library Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * 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 'Light Weight Java Game Library' 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
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* 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.
*/
// ----------------------------------
// IMPLEMENTATION OF NATIVE METHODS FOR CLASS: org.lwjgl.opengl.GL15
// ----------------------------------
#include "org_lwjgl_opengl_GL15.h"
#include "extgl.h"
#include "checkGLerror.h"
typedef int GLintptr;
typedef unsigned int GLsizeiptr;
typedef void (APIENTRY * glBindBufferPROC) (GLenum target, GLuint buffer);
typedef void (APIENTRY * glDeleteBuffersPROC) (GLsizei n, const GLuint *buffers);
typedef void (APIENTRY * glGenBuffersPROC) (GLsizei n, GLuint *buffers);
typedef GLboolean (APIENTRY * glIsBufferPROC) (GLuint buffer);
typedef void (APIENTRY * glBufferDataPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
typedef void (APIENTRY * glBufferSubDataPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
typedef void (APIENTRY * glGetBufferSubDataPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
typedef void * (APIENTRY * glMapBufferPROC) (GLenum target, GLenum access);
typedef GLboolean (APIENTRY * glUnmapBufferPROC) (GLenum target);
typedef void (APIENTRY * glGetBufferParameterivPROC) (GLenum target, GLenum pname, GLint *params);
typedef void (APIENTRY * glGetBufferPointervPROC) (GLenum target, GLenum pname, GLvoid **params);
typedef void (APIENTRY * glGenQueriesPROC) (GLsizei n, GLuint *ids);
typedef void (APIENTRY * glDeleteQueriesPROC) (GLsizei n, const GLuint *ids);
typedef GLboolean (APIENTRY * glIsQueryPROC) (GLuint id);
typedef void (APIENTRY * glBeginQueryPROC) (GLenum target, GLuint id);
typedef void (APIENTRY * glEndQueryPROC) (GLenum target);
typedef void (APIENTRY * glGetQueryivPROC) (GLenum target, GLenum pname, GLint *params);
typedef void (APIENTRY * glGetQueryObjectivPROC) (GLuint id, GLenum pname, GLint *params);
typedef void (APIENTRY * glGetQueryObjectuivPROC) (GLuint id, GLenum pname, GLuint *params);
static glBindBufferPROC glBindBuffer;
static glDeleteBuffersPROC glDeleteBuffers;
static glGenBuffersPROC glGenBuffers;
static glIsBufferPROC glIsBuffer;
static glBufferDataPROC glBufferData;
static glBufferSubDataPROC glBufferSubData;
static glGetBufferSubDataPROC glGetBufferSubData;
static glMapBufferPROC glMapBuffer;
static glUnmapBufferPROC glUnmapBuffer;
static glGetBufferParameterivPROC glGetBufferParameteriv;
static glGetBufferPointervPROC glGetBufferPointerv;
static glGenQueriesPROC glGenQueries;
static glDeleteQueriesPROC glDeleteQueries;
static glIsQueryPROC glIsQuery;
static glBeginQueryPROC glBeginQuery;
static glEndQueryPROC glEndQuery;
static glGetQueryivPROC glGetQueryiv;
static glGetQueryObjectivPROC glGetQueryObjectiv;
static glGetQueryObjectuivPROC glGetQueryObjectuiv;
void extgl_InitOpenGL1_5(JNIEnv *env, jobject ext_set)
{
if (!extgl_Extensions.OpenGL15)
return;
glBindBuffer = (glBindBufferPROC) extgl_GetProcAddress("glBindBuffer");
glDeleteBuffers = (glDeleteBuffersPROC) extgl_GetProcAddress("glDeleteBuffers");
glGenBuffers = (glGenBuffersPROC) extgl_GetProcAddress("glGenBuffers");
glIsBuffer = (glIsBufferPROC) extgl_GetProcAddress("glIsBuffer");
glBufferData = (glBufferDataPROC) extgl_GetProcAddress("glBufferData");
glBufferSubData = (glBufferSubDataPROC) extgl_GetProcAddress("glBufferSubData");
glGetBufferSubData = (glGetBufferSubDataPROC) extgl_GetProcAddress("glGetBufferSubData");
glMapBuffer = (glMapBufferPROC) extgl_GetProcAddress("glMapBuffer");
glUnmapBuffer = (glUnmapBufferPROC) extgl_GetProcAddress("glUnmapBuffer");
glGetBufferParameteriv = (glGetBufferParameterivPROC) extgl_GetProcAddress("glGetBufferParameteriv");
glGetBufferPointerv = (glGetBufferPointervPROC) extgl_GetProcAddress("glGetBufferPointerv");
glGenQueries = (glGenQueriesPROC) extgl_GetProcAddress("glGenQueries");
glDeleteQueries = (glDeleteQueriesPROC) extgl_GetProcAddress("glDeleteQueries");
glIsQuery = (glIsQueryPROC) extgl_GetProcAddress("glIsQuery");
glBeginQuery = (glBeginQueryPROC) extgl_GetProcAddress("glBeginQuery");
glEndQuery = (glEndQueryPROC) extgl_GetProcAddress("glEndQuery");
glGetQueryiv = (glGetQueryivPROC) extgl_GetProcAddress("glGetQueryiv");
glGetQueryObjectiv = (glGetQueryObjectivPROC) extgl_GetProcAddress("glGetQueryObjectiv");
glGetQueryObjectuiv = (glGetQueryObjectuivPROC) extgl_GetProcAddress("glGetQueryObjectuiv");
EXTGL_SANITY_CHECK(env, ext_set, OpenGL15)
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglBindBuffer
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglBindBuffer
(JNIEnv * env, jclass clazz, jint target, jint buffer)
{
CHECK_EXISTS(glBindBuffer)
glBindBuffer(target, buffer);
CHECK_GL_ERROR
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglDeleteBuffers
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglDeleteBuffers
(JNIEnv * env, jclass clazz, jint n, jobject buffers, jint buffers_offset)
{
CHECK_EXISTS(glDeleteBuffers)
GLuint *buffers_ptr = (GLuint *)env->GetDirectBufferAddress(buffers) + buffers_offset;
glDeleteBuffers(n, buffers_ptr);
CHECK_GL_ERROR
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglGenBuffers
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglGenBuffers
(JNIEnv * env, jclass clazz, jint n, jobject buffers, jint buffers_offset)
{
CHECK_EXISTS(glGenBuffers)
GLuint *buffers_ptr = (GLuint *)env->GetDirectBufferAddress(buffers) + buffers_offset;
glGenBuffers(n, buffers_ptr);
CHECK_GL_ERROR
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: glIsBuffer
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_GL15_glIsBuffer
(JNIEnv * env, jclass clazz, jint buffer)
{
CHECK_EXISTS(glIsBuffer)
GLboolean result = glIsBuffer(buffer);
CHECK_GL_ERROR
return result;
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglBufferData
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglBufferData
(JNIEnv * env, jclass clazz, jint target, jint size, jobject data, jint data_offset, jint usage)
{
CHECK_EXISTS(glBufferData)
GLvoid *data_ptr = (GLvoid *)safeGetBufferAddress(env, data, data_offset);
glBufferData(target, size, data_ptr, usage);
CHECK_GL_ERROR
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglBufferSubData
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglBufferSubData
(JNIEnv * env, jclass clazz, jint target, jint offset, jint size, jobject data, jint data_offset)
{
CHECK_EXISTS(glBufferSubData)
GLvoid *data_ptr = (GLvoid *)((GLubyte *)env->GetDirectBufferAddress(data) + data_offset);
glBufferSubData(target, offset, size, data_ptr);
CHECK_GL_ERROR
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglGetBufferSubData
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglGetBufferSubData
(JNIEnv * env, jclass clazz, jint target, jint offset, jint size, jobject data, jint data_offset)
{
CHECK_EXISTS(glGetBufferSubData)
GLvoid *data_ptr = (GLvoid *)((GLubyte *)env->GetDirectBufferAddress(data) + data_offset);
glGetBufferSubData(target, offset, size, data_ptr);
CHECK_GL_ERROR
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: glMapBuffer
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_GL15_glMapBuffer
(JNIEnv * env, jclass clazz, jint target, jint access, jint size, jobject oldBuffer)
{
CHECK_EXISTS(glMapBuffer)
void *buffer_address = glMapBuffer((GLenum)target, (GLenum)access);
CHECK_GL_ERROR
if (oldBuffer != NULL) {
void *old_buffer_address = env->GetDirectBufferAddress(oldBuffer);
if (old_buffer_address == buffer_address)
return oldBuffer;
}
return safeNewBuffer(env, buffer_address, size);
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: glUnmapBuffer
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_GL15_glUnmapBuffer
(JNIEnv * env, jclass clazz, jint target)
{
CHECK_EXISTS(glUnmapBuffer)
GLboolean result = glUnmapBuffer(target);
CHECK_GL_ERROR
return result;
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglGetBufferParameteriv
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglGetBufferParameteriv
(JNIEnv * env, jclass clazz, jint target, jint pname, jobject params, jint params_offset)
{
CHECK_EXISTS(glGetBufferParameteriv)
GLint *params_ptr = (GLint *)env->GetDirectBufferAddress(params) + params_offset;
glGetBufferParameteriv(target, pname, params_ptr);
CHECK_GL_ERROR
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: glGetBufferPointer
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_GL15_glGetBufferPointer
(JNIEnv * env, jclass clazz, jint target, jint pname, jint size)
{
CHECK_EXISTS(glGetBufferPointerv)
void *pointer;
glGetBufferPointerv((GLenum)target, (GLenum)pname, &pointer);
CHECK_GL_ERROR
return safeNewBuffer(env, pointer, size);
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglGenQueries
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglGenQueries
(JNIEnv * env, jclass clazz, jint n, jobject ids, jint idsOffset)
{
CHECK_EXISTS(glGenQueries)
GLuint *ids_ptr = (GLuint *)env->GetDirectBufferAddress(ids) + idsOffset;
glGenQueries(n, ids_ptr);
CHECK_GL_ERROR
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglDeleteQueries
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglDeleteQueries
(JNIEnv * env, jclass clazz, jint n, jobject ids, jint idsOffset)
{
CHECK_EXISTS(glDeleteQueries)
GLuint *ids_ptr = (GLuint *)env->GetDirectBufferAddress(ids) + idsOffset;
glDeleteQueries(n, ids_ptr);
CHECK_GL_ERROR
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: glIsQuery
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_GL15_glIsQuery
(JNIEnv * env, jclass clazz, jint id)
{
CHECK_EXISTS(glIsQuery)
GLboolean result = glIsQuery(id);
CHECK_GL_ERROR
return result;
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: glBeginQuery
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_glBeginQuery
(JNIEnv * env, jclass clazz, jint target, jint id)
{
CHECK_EXISTS(glBeginQuery)
glBeginQuery(target, id);
CHECK_GL_ERROR
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: glEndQuery
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_glEndQuery
(JNIEnv * env, jclass clazz, jint target)
{
CHECK_EXISTS(glEndQuery)
glEndQuery(target);
CHECK_GL_ERROR
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglGetQueryiv
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglGetQueryiv
(JNIEnv * env, jclass clazz, jint target, jint pname, jobject params, jint paramsOffset)
{
CHECK_EXISTS(glGetQueryiv)
GLint *params_ptr = (GLint *)env->GetDirectBufferAddress(params) + paramsOffset;
glGetQueryiv(target, pname, params_ptr);
CHECK_GL_ERROR
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglGetQueryObjectiv
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglGetQueryObjectiv
(JNIEnv * env, jclass clazz, jint id, jint pname, jobject params, jint paramsOffset)
{
CHECK_EXISTS(glGetQueryObjectiv)
GLint *params_ptr = (GLint *)env->GetDirectBufferAddress(params) + paramsOffset;
glGetQueryObjectiv(id, pname, params_ptr);
CHECK_GL_ERROR
}
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglGetQueryObjectuiv
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglGetQueryObjectuiv
(JNIEnv * env, jclass clazz, jint id, jint pname, jobject params, jint paramsOffset)
{
CHECK_EXISTS(glGetQueryObjectuiv)
GLuint *params_ptr = (GLuint *)env->GetDirectBufferAddress(params) + paramsOffset;
glGetQueryObjectuiv(id, pname, params_ptr);
CHECK_GL_ERROR
}

View File

@ -0,0 +1,199 @@
/*
* Copyright (c) 2002 Lightweight Java Game Library Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * 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 'Light Weight Java Game Library' 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
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* 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.
*/
// ----------------------------------
// MACHINE GENERATED HEADER OF CLASS: org.lwjgl.opengl.GL15
// ----------------------------------
#include <jni.h>
#ifndef _Included_org_lwjgl_opengl_GL15
#define _Included_org_lwjgl_opengl_GL15
#ifdef __cplusplus
extern "C" {
#endif
// ----------------------------------------------------------------------
// ---------------------- ARB_vertex_buffer_object ----------------------
// ----------------------------------------------------------------------
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglBindBuffer
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglBindBuffer
(JNIEnv *, jclass, jint, jint);
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglDeleteBuffers
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglDeleteBuffers
(JNIEnv *, jclass, jint, jobject, jint);
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglGenBuffers
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglGenBuffers
(JNIEnv *, jclass, jint, jobject, jint);
/*
* Class: org.lwjgl.opengl.GL15
* Method: glIsBuffer
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_GL15_glIsBuffer
(JNIEnv *, jclass, jint);
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglBufferData
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglBufferData
(JNIEnv *, jclass, jint, jint, jobject, jint, jint);
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglBufferSubData
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglBufferSubData
(JNIEnv *, jclass, jint, jint, jint, jobject, jint);
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglGetBufferSubData
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglGetBufferSubData
(JNIEnv *, jclass, jint, jint, jint, jobject, jint);
/*
* Class: org.lwjgl.opengl.GL15
* Method: glMapBuffer
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_GL15_glMapBuffer
(JNIEnv *, jclass, jint, jint, jint, jobject);
/*
* Class: org.lwjgl.opengl.GL15
* Method: glUnmapBuffer
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_GL15_glUnmapBuffer
(JNIEnv *, jclass, jint);
/*
* Class: org.lwjgl.opengl.GL15
* Method: nglGetBufferParameteriv
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglGetBufferParameteriv
(JNIEnv *, jclass, jint, jint, jobject, jint);
/*
* Class: org.lwjgl.opengl.GL15
* Method: glGetBufferPointer
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_GL15_glGetBufferPointer
(JNIEnv *, jclass, jint, jint, jint);
// -----------------------------------------------------------------
// ---------------------- ARB_occlusion_query ----------------------
// -----------------------------------------------------------------
/*
* Class: org_lwjgl_opengl_GL15
* Method: nglGenQueries
* Signature: (ILjava/nio/IntBuffer;I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglGenQueries
(JNIEnv *, jclass, jint, jobject, jint);
/*
* Class: org_lwjgl_opengl_GL15
* Method: nglDeleteQueries
* Signature: (ILjava/nio/IntBuffer;I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglDeleteQueries
(JNIEnv *, jclass, jint, jobject, jint);
/*
* Class: org_lwjgl_opengl_GL15
* Method: glIsQuery
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_GL15_glIsQuery
(JNIEnv *, jclass, jint);
/*
* Class: org_lwjgl_opengl_GL15
* Method: glBeginQuery
* Signature: (II)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_glBeginQuery
(JNIEnv *, jclass, jint, jint);
/*
* Class: org_lwjgl_opengl_GL15
* Method: glEndQuery
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_glEndQuery
(JNIEnv *, jclass, jint);
/*
* Class: org_lwjgl_opengl_GL15
* Method: nglGetQueryiv
* Signature: (IILjava/nio/IntBuffer;I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglGetQueryiv
(JNIEnv *, jclass, jint, jint, jobject, jint);
/*
* Class: org_lwjgl_opengl_GL15
* Method: nglGetQueryObjectiv
* Signature: (IILjava/nio/IntBuffer;I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglGetQueryObjectiv
(JNIEnv *, jclass, jint, jint, jobject, jint);
/*
* Class: org_lwjgl_opengl_GL15
* Method: nglGetQueryObjectuiv
* Signature: (IILjava/nio/IntBuffer;I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_nglGetQueryObjectuiv
(JNIEnv *, jclass, jint, jint, jobject, jint);
#ifdef __cplusplus
}
#endif
#endif