OpenGL 2.0 support

This commit is contained in:
Ioannis Tsakpinis 2004-09-09 23:51:16 +00:00
parent dccf2e08e7
commit 8041524332
10 changed files with 3651 additions and 293 deletions

View File

@ -32,6 +32,7 @@
package org.lwjgl.opengl;
public final class ARBFragmentShader {
/*
* Accepted by the <shaderType> argument of CreateShaderObjectARB and
* returned by the <params> parameter of GetObjectParameter{fi}vARB:
@ -42,7 +43,6 @@ public final class ARBFragmentShader {
* Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
* GetFloatv, and GetDoublev:
*/
public static final int GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB = 0x8B49;
public static final int GL_MAX_TEXTURE_COORDS_ARB = 0x8871;
public static final int GL_MAX_TEXTURE_IMAGE_UNITS_ARB = 0x8872;

View File

@ -1,37 +1,38 @@
/*
/*
* Copyright (c) 2002-2004 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.
*/
package org.lwjgl.opengl;
public final class ARBPointSprite {
/*
* Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, by
* the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and
@ -45,7 +46,6 @@ public final class ARBPointSprite {
* GetTexEnvfv, or GetTexEnviv is POINT_SPRITE_ARB, then the value of
* <pname> may be:
*/
public static final int GL_COORD_REPLACE_ARB = 0x8862;
private ARBPointSprite() {

View File

@ -1,40 +1,40 @@
/*
/*
* Copyright (c) 2002-2004 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.
*/
package org.lwjgl.opengl;
import java.nio.*;
import org.lwjgl.LWJGLException;
import org.lwjgl.BufferChecks;
import org.lwjgl.LWJGLException;
import java.nio.*;
public final class GL15 {
@ -125,24 +125,20 @@ public final class GL15 {
public static void glBufferData(int target, int size, ShortBuffer data, int usage) {
BufferChecks.checkDirectOrNull(data);
nglBufferData(target, data != null ? data.remaining()<<1 : size, data, data != null ? data.position() << 1 : 0, usage);
nglBufferData(target, data != null ? data.remaining() << 1 : size, data, data != null ? data.position() << 1 : 0, usage);
}
public static void glBufferData(int target, int size, FloatBuffer data, int usage) {
BufferChecks.checkDirectOrNull(data);
nglBufferData(target, data != null ? data.remaining()<<2 : size, data, data != null ? data.position() << 2 : 0, usage);
nglBufferData(target, data != null ? data.remaining() << 2 : size, data, data != null ? data.position() << 2 : 0, usage);
}
public static void glBufferData(int target, int size, IntBuffer data, int usage) {
BufferChecks.checkDirectOrNull(data);
nglBufferData(target, data != null ? data.remaining()<<2 : size, data, data != null ? data.position() << 2 : 0, usage);
nglBufferData(target, data != null ? data.remaining() << 2 : 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);
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) {
BufferChecks.checkDirect(data);
@ -164,11 +160,7 @@ public final class GL15 {
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);
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) {
BufferChecks.checkDirect(data);
@ -190,32 +182,24 @@ public final class GL15 {
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);
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:
* 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);
* 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.
* @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 ByteBuffer glMapBuffer(int target, int access, int size, ByteBuffer oldBuffer);
public static native boolean glUnmapBuffer(int target);
@ -224,10 +208,7 @@ public final class GL15 {
nglGetBufferParameteriv(target, pname, params, params.position());
}
private static native void nglGetBufferParameteriv(int target,
int pname,
IntBuffer params,
int params_offset);
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);
@ -284,10 +265,7 @@ public final class GL15 {
nglGetQueryiv(target, pname, params, params.position());
}
private static native void nglGetQueryiv(int target,
int pname,
IntBuffer params,
int paramsOffset);
private static native void nglGetQueryiv(int target, int pname, IntBuffer params, int paramsOffset);
// ---------------------------
// ---------------------------
@ -296,10 +274,7 @@ public final class GL15 {
nglGetQueryObjectiv(id, pname, params, params.position());
}
private static native void nglGetQueryObjectiv(int id,
int pname,
IntBuffer params,
int paramsOffset);
private static native void nglGetQueryObjectiv(int id, int pname, IntBuffer params, int paramsOffset);
// ---------------------------
// ---------------------------
@ -308,10 +283,7 @@ public final class GL15 {
nglGetQueryObjectuiv(id, pname, params, params.position());
}
private static native void nglGetQueryObjectuiv(int id,
int pname,
IntBuffer params,
int paramsOffset);
private static native void nglGetQueryObjectuiv(int id, int pname, IntBuffer params, int paramsOffset);
// ---------------------------
}

View File

@ -0,0 +1,631 @@
/*
* Copyright (c) 2002-2004 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
* 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 '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
* 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.
*/
package org.lwjgl.opengl;
import org.lwjgl.BufferChecks;
import org.lwjgl.LWJGLException;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
public final class GL20 {
private GL20() {
}
static native void initNativeStubs() throws LWJGLException;
// ------------------------------------------------------------------
// ----------------------[ ARB_shader_objects ]----------------------
// ------------------------------------------------------------------
/*
* Accepted by the <pname> argument of GetHandleARB:
*/
public static final int GL_PROGRAM_OBJECT = 0x8B40;
/*
* Accepted by the <pname> parameter of GetObjectParameter{fi}vARB:
*/
public static final int GL_SHADER_TYPE = 0x8B4E;
public static final int GL_DELETE_STATUS = 0x8B80;
public static final int GL_COMPILE_STATUS = 0x8B81;
public static final int GL_LINK_STATUS = 0x8B82;
public static final int GL_VALIDATE_STATUS = 0x8B83;
public static final int GL_INFO_LOG_LENGTH = 0x8B84;
public static final int GL_ATTACHED_SHADERS = 0x8B85;
public static final int GL_ACTIVE_UNIFORMS = 0x8B86;
public static final int GL_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87;
public static final int GL_ACTIVE_ATTRIBUTES = 0x8B89;
public static final int GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A;
public static final int GL_SHADER_SOURCE_LENGTH = 0x8B88;
/*
* Returned by the <params> parameter of GetObjectParameter{fi}vARB:
*/
public static final int GL_SHADER_OBJECT = 0x8B48;
/*
* Returned by the <type> parameter of GetActiveUniformARB:
*/
public static final int GL_FLOAT_VEC2 = 0x8B50;
public static final int GL_FLOAT_VEC3 = 0x8B51;
public static final int GL_FLOAT_VEC4 = 0x8B52;
public static final int GL_INT_VEC2 = 0x8B53;
public static final int GL_INT_VEC3 = 0x8B54;
public static final int GL_INT_VEC4 = 0x8B55;
public static final int GL_BOOL = 0x8B56;
public static final int GL_BOOL_VEC2 = 0x8B57;
public static final int GL_BOOL_VEC3 = 0x8B58;
public static final int GL_BOOL_VEC4 = 0x8B59;
public static final int GL_FLOAT_MAT2 = 0x8B5A;
public static final int GL_FLOAT_MAT3 = 0x8B5B;
public static final int GL_FLOAT_MAT4 = 0x8B5C;
public static final int GL_SAMPLER_1D = 0x8B5D;
public static final int GL_SAMPLER_2D = 0x8B5E;
public static final int GL_SAMPLER_3D = 0x8B5F;
public static final int GL_SAMPLER_CUBE = 0x8B60;
public static final int GL_SAMPLER_1D_SHADOW = 0x8B61;
public static final int GL_SAMPLER_2D_SHADOW = 0x8B62;
public static final int GL_SAMPLER_2D_RECT = 0x8B63;
public static final int GL_SAMPLER_2D_RECT_SHADOW = 0x8B64;
// ---------------------------
/**
* The ARB_shader_objects extension allows multiple, optionally null-terminated, source strings to define a shader program.
* <p/>
* This method uses just a single string, that should NOT be null-terminated.
*
* @param shader
* @param string
*/
public static void glShaderSource(int shader, ByteBuffer string) {
BufferChecks.checkDirect(string);
initShaderSource(1);
setShaderString(0, string, string.position(), string.remaining());
nglShaderSource(shader);
}
/**
* The ARB_shader_objects extension allows multiple, optionally null-terminated, source strings to define a shader program.
* <p/>
* This method uses an array of strings, that should NOT be null-terminated.
*
* @param shader
* @param strings
*/
public static void glShaderSource(int shader, ByteBuffer[] strings) {
initShaderSource(strings.length);
for ( int i = 0; i < strings.length; i++ ) {
BufferChecks.checkDirect(strings[i]);
setShaderString(i, strings[i], strings[i].position(), strings[i].remaining());
}
nglShaderSource(shader);
}
private static native void initShaderSource(int count);
private static native void setShaderString(int index, ByteBuffer string, int stringOffset, int stringLength);
private static native void nglShaderSource(int shader);
// ---------------------------
public static native int glCreateShader(int type);
public static native boolean glIsShader(int shader);
public static native void glCompileShader(int shader);
public static native void glDeleteShader(int shader);
public static native int glCreateProgram();
public static native boolean glIsProgram(int program);
public static native void glAttachShader(int program, int shader);
public static native void glDetachShader(int program, int shader);
public static native void glLinkProgram(int program);
public static native void glUseProgram(int program);
public static native void glValidateProgram(int program);
public static native void glDeleteProgram(int program);
public static native void glUniform1f(int location, float v0);
public static native void glUniform2f(int location, float v0, float v1);
public static native void glUniform3f(int location, float v0, float v1, float v2);
public static native void glUniform4f(int location, float v0, float v1, float v2, float v3);
public static native void glUniform1i(int location, int v0);
public static native void glUniform2i(int location, int v0, int v1);
public static native void glUniform3i(int location, int v0, int v1, int v2);
public static native void glUniform4i(int location, int v0, int v1, int v2, int v3);
// ---------------------------
public static void glUniform1(int location, FloatBuffer values) {
BufferChecks.checkDirect(values);
nglUniform1fv(location, values.remaining(), values, values.position());
}
private static native void nglUniform1fv(int location, int count, FloatBuffer values, int valuesOffset);
// ---------------------------
// ---------------------------
public static void glUniform2(int location, FloatBuffer values) {
BufferChecks.checkDirect(values);
nglUniform2fv(location, values.remaining() >> 1, values, values.position());
}
private static native void nglUniform2fv(int location, int count, FloatBuffer values, int valuesOffset);
// ---------------------------
// ---------------------------
public static void glUniform3(int location, FloatBuffer values) {
BufferChecks.checkDirect(values);
nglUniform3fv(location, values.remaining() / 3, values, values.position());
}
private static native void nglUniform3fv(int location, int count, FloatBuffer values, int valuesOffset);
// ---------------------------
// ---------------------------
public static void glUniform4(int location, FloatBuffer values) {
BufferChecks.checkDirect(values);
nglUniform4fv(location, values.remaining() >> 2, values, values.position());
}
private static native void nglUniform4fv(int location, int count, FloatBuffer values, int valuesOffset);
// ---------------------------
// ---------------------------
public static void glUniform1(int location, IntBuffer values) {
BufferChecks.checkDirect(values);
nglUniform1iv(location, values.remaining(), values, values.position());
}
private static native void nglUniform1iv(int location, int count, IntBuffer values, int valuesOffset);
// ---------------------------
// ---------------------------
public static void glUniform2(int location, IntBuffer values) {
BufferChecks.checkDirect(values);
nglUniform2iv(location, values.remaining() >> 1, values, values.position());
}
private static native void nglUniform2iv(int location, int count, IntBuffer values, int valuesOffset);
// ---------------------------
// ---------------------------
public static void glUniform3(int location, IntBuffer values) {
BufferChecks.checkDirect(values);
nglUniform3iv(location, values.remaining() / 3, values, values.position());
}
private static native void nglUniform3iv(int location, int count, IntBuffer values, int valuesOffset);
// ---------------------------
// ---------------------------
public static void glUniform4(int location, IntBuffer values) {
BufferChecks.checkDirect(values);
nglUniform4iv(location, values.remaining() >> 2, values, values.position());
}
private static native void nglUniform4iv(int location, int count, IntBuffer values, int valuesOffset);
// ---------------------------
// ---------------------------
public static void glUniformMatrix2(int location, boolean transpose, FloatBuffer matrices) {
BufferChecks.checkDirect(matrices);
nglUniformMatrix2fv(location, matrices.remaining() >> 2, transpose, matrices, matrices.position());
}
private static native void nglUniformMatrix2fv(int location, int count, boolean transpose,
FloatBuffer matrices, int matricesOffset);
// ---------------------------
// ---------------------------
public static void glUniformMatrix3(int location, boolean transpose, FloatBuffer matrices) {
BufferChecks.checkDirect(matrices);
nglUniformMatrix3fv(location, matrices.remaining() / (3 * 3), transpose, matrices, matrices.position());
}
private static native void nglUniformMatrix3fv(int location, int count, boolean transpose,
FloatBuffer matrices, int matricesOffset);
// ---------------------------
// ---------------------------
public static void glUniformMatrix4(int location, boolean transpose, FloatBuffer matrices) {
BufferChecks.checkDirect(matrices);
nglUniformMatrix4fv(location, matrices.remaining() >> 4, transpose, matrices, matrices.position());
}
private static native void nglUniformMatrix4fv(int location, int count, boolean transpose,
FloatBuffer matrices, int matricesOffset);
// ---------------------------
// ---------------------------
public static void glGetShader(int shader, int pname, FloatBuffer params) {
BufferChecks.checkDirect(params);
nglGetShaderfv(shader, pname, params, params.position());
}
private static native void nglGetShaderfv(int shader, int pname, FloatBuffer params, int paramsOffset);
// ---------------------------
// ---------------------------
public static void glGetShader(int shader, int pname, IntBuffer params) {
BufferChecks.checkDirect(params);
nglGetShaderiv(shader, pname, params, params.position());
}
private static native void nglGetShaderiv(int shader, int pname, IntBuffer params, int paramsOffset);
// ---------------------------
// ---------------------------
public static void glGetProgram(int program, int pname, FloatBuffer params) {
BufferChecks.checkDirect(params);
nglGetProgramfv(program, pname, params, params.position());
}
private static native void nglGetProgramfv(int program, int pname, FloatBuffer params, int paramsOffset);
// ---------------------------
// ---------------------------
public static void glGetProgram(int program, int pname, IntBuffer params) {
BufferChecks.checkDirect(params);
nglGetProgramiv(program, pname, params, params.position());
}
private static native void nglGetProgramiv(int program, int pname, IntBuffer params, int paramsOffset);
// ---------------------------
// ---------------------------
public static void glGetShaderInfoLog(int shader, IntBuffer length, ByteBuffer infoLog) {
BufferChecks.checkDirect(infoLog);
if ( length == null ) {
nglGetShaderInfoLog(shader, infoLog.remaining(), null, -1, infoLog, infoLog.position());
} else {
BufferChecks.checkBuffer(length, 1);
nglGetShaderInfoLog(shader, infoLog.remaining(), length, length.position(), infoLog, infoLog.position());
}
}
private static native void nglGetShaderInfoLog(int shader, int maxLength,
IntBuffer length, int lengthOffset,
ByteBuffer infoLog, int infoLogOffset);
// ---------------------------
// ---------------------------
public static void glGetProgramInfoLog(int program, IntBuffer length, ByteBuffer infoLog) {
BufferChecks.checkDirect(infoLog);
if ( length == null ) {
nglGetProgramInfoLog(program, infoLog.remaining(), null, -1, infoLog, infoLog.position());
} else {
BufferChecks.checkBuffer(length, 1);
nglGetProgramInfoLog(program, infoLog.remaining(), length, length.position(), infoLog, infoLog.position());
}
}
private static native void nglGetProgramInfoLog(int program, int maxLength,
IntBuffer length, int lengthOffset,
ByteBuffer infoLog, int infoLogOffset);
// ---------------------------
// ---------------------------
public static void glGetAttachedShaders(int program, IntBuffer count, IntBuffer shaders) {
if ( count == null )
nglGetAttachedShaders(program, shaders.remaining(), null, -1, shaders, shaders.position());
else {
if ( count.remaining() == 0 )
throw new BufferOverflowException();
nglGetAttachedShaders(program, shaders.remaining(), count, count.position(), shaders, shaders.position());
}
}
private static native void nglGetAttachedShaders(int program, int maxCount,
IntBuffer count, int countOffset, IntBuffer shaders, int shadersOffset);
// ---------------------------
// ---------------------------
/**
* Returns the location of the uniform with the specified name. The ByteBuffer should contain the uniform name as a
* <b>null-terminated</b> string.
*
* @param program
* @param name
*
* @return
*/
public static int glGetUniformLocation(int program, ByteBuffer name) {
// TODO: How do we check that the string is null-terminated?
return nglGetUniformLocation(program, name, name.position());
}
private static native int nglGetUniformLocation(int program, ByteBuffer name, int nameOffset);
// ---------------------------
// ---------------------------
public static void glGetActiveUniform(int program, int index,
IntBuffer length, IntBuffer size, IntBuffer type, ByteBuffer name) {
if ( size.remaining() == 0 )
throw new BufferOverflowException();
if ( type.remaining() == 0 )
throw new BufferOverflowException();
if ( length == null )
nglGetActiveUniform(program, index, name.remaining(), null, -1,
size, size.position(), type, type.position(), name, name.position());
else {
if ( length.remaining() == 0 )
throw new BufferOverflowException();
nglGetActiveUniform(program, index, name.remaining(), length, length.position(),
size, size.position(), type, type.position(), name, name.position());
}
}
private static native void nglGetActiveUniform(int program, int index, int maxLength,
IntBuffer length, int lengthOffset,
IntBuffer size, int sizeOffset,
IntBuffer type, int typeOffset,
ByteBuffer name, int nameOffset);
// ---------------------------
// ---------------------------
public static void glGetUniform(int program, int location, FloatBuffer params) {
nglGetUniformfv(program, location, params, params.position());
}
private static native void nglGetUniformfv(int program, int location, FloatBuffer params, int paramsOffset);
// ---------------------------
// ---------------------------
public static void glGetUniform(int program, int location, IntBuffer params) {
nglGetUniformiv(program, location, params, params.position());
}
private static native void nglGetUniformiv(int program, int location, IntBuffer params, int paramsOffset);
// ---------------------------
// ---------------------------
public static void glGetShaderSource(int shader, IntBuffer length, ByteBuffer source) {
if ( length == null )
nglGetShaderSource(shader, source.remaining(), null, -1, source, source.position());
else {
nglGetShaderSource(shader, source.remaining(), length, length.position(), source, source.position());
}
}
private static native void nglGetShaderSource(int shader, int maxLength,
IntBuffer length, int lengthOffset, ByteBuffer source, int sourceOffset);
// ---------------------------
// -----------------------------------------------------------------
// ----------------------[ ARB_vertex_shader ]----------------------
// -----------------------------------------------------------------
/*
* Accepted by the <shaderType> argument of CreateShader and
* returned by the <params> parameter of GetShader{if}v:
*/
public static final int GL_VERTEX_SHADER = 0x8B31;
/*
* Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
* GetFloatv, and GetDoublev:
*/
public static final int GL_MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A;
public static final int GL_MAX_VARYING_FLOATS = 0x8B4B;
public static final int GL_MAX_VERTEX_ATTRIBS = 0x8869;
public static final int GL_MAX_TEXTURE_IMAGE_UNITS = 0x8872;
public static final int GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C;
public static final int GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
public static final int GL_MAX_TEXTURE_COORDS = 0x8871;
/*
* Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, and
* by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and
* GetDoublev:
*/
public static final int GL_VERTEX_PROGRAM_POINT_SIZE = 0x8642;
public static final int GL_VERTEX_PROGRAM_TWO_SIDE = 0x8643;
/*
* Accepted by the <pname> parameter of GetVertexAttrib{dfi}vARB:
*/
public static final int GL_VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622;
public static final int GL_VERTEX_ATTRIB_ARRAY_SIZE = 0x8623;
public static final int GL_VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624;
public static final int GL_VERTEX_ATTRIB_ARRAY_TYPE = 0x8625;
public static final int GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A;
public static final int GL_CURRENT_VERTEX_ATTRIB = 0x8626;
/*
* Accepted by the <pname> parameter of GetVertexAttribPointervARB:
*/
public static final int GL_VERTEX_ATTRIB_ARRAY_POINTER = 0x8645;
// ---------------------------
public static void glBindAttribLocation(int program, int index, ByteBuffer name) {
BufferChecks.checkDirect(name);
if ( name.get(name.limit() - 1) != 0 ) {
throw new IllegalArgumentException("<name> must be a null-terminated string.");
}
nglBindAttribLocation(program, index, name, name.position());
}
private static native void nglBindAttribLocation(int program, int index, ByteBuffer name, int nameOffset);
// ---------------------------
// ---------------------------
public static void glGetActiveAttrib(int program, int index,
IntBuffer length, IntBuffer size, IntBuffer type, ByteBuffer name) {
BufferChecks.checkDirect(name);
BufferChecks.checkDirect(size);
BufferChecks.checkDirect(type);
if ( length == null ) {
nglGetActiveAttrib(program, index, name.remaining(), null, -1,
size, size.position(), type, type.position(), name, name.position());
} else {
BufferChecks.checkDirect(length);
nglGetActiveAttrib(program, index, name.remaining(), length, length.position(),
size, size.position(), type, type.position(), name, name.position());
}
}
private static native void nglGetActiveAttrib(int program, int index, int maxLength,
IntBuffer length, int lengthOffset,
IntBuffer size, int sizeOffset,
IntBuffer type, int typeOffset,
ByteBuffer name, int nameOffset);
// ---------------------------
// ---------------------------
public static int glGetAttribLocation(int program, ByteBuffer name) {
BufferChecks.checkDirect(name);
if ( name.get(name.limit() - 1) != 0 ) {
throw new IllegalArgumentException("<name> must be a null-terminated string.");
}
return nglGetAttribLocation(program, name, name.position());
}
private static native int nglGetAttribLocation(int program, ByteBuffer name, int nameOffset);
// ---------------------------
// -------------------------------------------------------------------
// ----------------------[ ARB_fragment_shader ]----------------------
// -------------------------------------------------------------------
/*
* Accepted by the <shaderType> argument of CreateShader and
* returned by the <params> parameter of GetShader{fi}vARB:
*/
public static final int GL_FRAGMENT_SHADER = 0x8B30;
/*
* Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
* GetFloatv, and GetDoublev:
*/
public static final int GL_MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49;
/*
* Accepted by the <target> parameter of Hint and the <pname> parameter of
* GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev:
*/
public static final int GL_FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B;
// ----------------------------------------------------------------
// ----------------------[ ARB_draw_buffers ]----------------------
// ----------------------------------------------------------------
/*
* Accepted by the <pname> parameters of GetIntegerv, GetFloatv,
* and GetDoublev:
*/
public static final int GL_MAX_DRAW_BUFFERS = 0x8824;
public static final int GL_DRAW_BUFFER0 = 0x8825;
public static final int GL_DRAW_BUFFER1 = 0x8826;
public static final int GL_DRAW_BUFFER2 = 0x8827;
public static final int GL_DRAW_BUFFER3 = 0x8828;
public static final int GL_DRAW_BUFFER4 = 0x8829;
public static final int GL_DRAW_BUFFER5 = 0x882A;
public static final int GL_DRAW_BUFFER6 = 0x882B;
public static final int GL_DRAW_BUFFER7 = 0x882C;
public static final int GL_DRAW_BUFFER8 = 0x882D;
public static final int GL_DRAW_BUFFER9 = 0x882E;
public static final int GL_DRAW_BUFFER10 = 0x882F;
public static final int GL_DRAW_BUFFER11 = 0x8830;
public static final int GL_DRAW_BUFFER12 = 0x8831;
public static final int GL_DRAW_BUFFER13 = 0x8832;
public static final int GL_DRAW_BUFFER14 = 0x8833;
public static final int GL_DRAW_BUFFER15 = 0x8834;
// ---------------------------
public static void glDrawBuffers(IntBuffer buffers) {
BufferChecks.checkBuffer(buffers, 1);
nglDrawBuffers(buffers.remaining(), buffers, buffers.position());
}
private static native void nglDrawBuffers(int size, IntBuffer buffers, int buffersOffset);
// ---------------------------
// ----------------------------------------------------------------
// ----------------------[ ARB_point_sprite ]----------------------
// ----------------------------------------------------------------
/*
* Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, by
* the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and
* GetDoublev, and by the <target> parameter of TexEnvi, TexEnviv,
* TexEnvf, TexEnvfv, GetTexEnviv, and GetTexEnvfv:
*/
public static final int GL_POINT_SPRITE = 0x8861;
/*
* When the <target> parameter of TexEnvf, TexEnvfv, TexEnvi, TexEnviv,
* GetTexEnvfv, or GetTexEnviv is POINT_SPRITE, then the value of
* <pname> may be:
*/
public static final int GL_COORD_REPLACE = 0x8862;
// -----------------------------------------------------------------
// ----------------------[ Two-Sided Stencil ]----------------------
// -----------------------------------------------------------------
public static final int GL_STENCIL_BACK_FUNC = 0x8800;
public static final int GL_STENCIL_BACK_FAIL = 0x8801;
public static final int GL_STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802;
public static final int GL_STENCIL_BACK_PASS_DEPTH_PASS = 0x8803;
public static final int GL_STENCIL_BACK_REF = 0x0000; // TODO: Find this value
public static final int GL_STENCIL_BACK_VALUE_MASK = 0x0000; // TODO: Find this value
public static native void glStencilFuncSeparate(int face, int func, int ref, int mask);
public static native void glStencilOpSeparate(int face, int sfail, int dpfail, int dppass);
}

View File

@ -31,34 +31,30 @@
*/
package org.lwjgl.opengl;
import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.HashSet;
import java.util.Set;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;
import java.util.StringTokenizer;
import java.lang.reflect.Method;
import org.lwjgl.Sys;
import org.lwjgl.LWJGLException;
import java.lang.reflect.Modifier;
import java.util.*;
/**
* $Id$
* <p/>
* Manages GL contexts. Before any rendering is done by a LWJGL system, a call should be made to
* GLContext.useContext() with a context. This will ensure that GLContext has an accurate reflection
* of the current context's capabilities and function pointers.
* Manages GL contexts. Before any rendering is done by a LWJGL system, a call should be made to GLContext.useContext() with a
* context. This will ensure that GLContext has an accurate reflection of the current context's capabilities and function
* pointers.
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision$
*/
public final class GLContext {
/** The currently initialised context */
/**
* The currently initialised context
*/
private static WeakReference currentContext;
/*
@ -182,22 +178,24 @@ public final class GLContext {
public static boolean OpenGL13;
public static boolean OpenGL14;
public static boolean OpenGL15;
public static boolean OpenGL20;
/** Map of classes that have native stubs loaded */
/**
* Map of classes that have native stubs loaded
*/
private static Map exts;
private static int gl_ref_count = 0;
private static boolean did_auto_load = false;
private static boolean loaded_stubs = false;
private static int gl_ref_count;
private static boolean did_auto_load;
private static boolean loaded_stubs;
static {
Sys.initialize();
}
/**
* Determine which extensions are available. Use this to initialize capability fields. Can only be
* called _after_ the Display context or a Pbuffer has been created (or a context from some other GL library).
* Using LWJGL, this method is called automatically for you when the LWJGL Window is created and there
* is no need to call it yourself.
* Determine which extensions are available. Use this to initialize capability fields. Can only be called _after_ the Display
* context or a Pbuffer has been created (or a context from some other GL library). Using LWJGL, this method is called
* automatically for you when the LWJGL Window is created and there is no need to call it yourself.
*
* @param exts A Set of OpenGL extension string names
*/
@ -217,24 +215,23 @@ public final class GLContext {
}
/**
* Makes a GL context the current LWJGL context by loading GL function pointers.
* The context must be current before a call to this method!
* Instead it simply ensures that the current context is reflected accurately by GLContext's
* extension caps and function pointers. Use useContext(null) when no context is active.
* <p>If the context is the same as last time, then this is a no-op.
* <p>If the context has not been encountered before it will be fully initialized from scratch.
* Otherwise a cached set of caps and function pointers will be used.
* <p>The reference to the context is held in a weak reference; therefore if no strong reference
* exists to the GL context it will automatically be forgotten by the VM at an indeterminate point
* in the future, freeing up a little RAM.
* @param context The context object, which uniquely identifies a GL context. If context is null,
* the native stubs are unloaded.
* Makes a GL context the current LWJGL context by loading GL function pointers. The context must be current before a call to
* this method! Instead it simply ensures that the current context is reflected accurately by GLContext's extension caps and
* function pointers. Use useContext(null) when no context is active. <p>If the context is the same as last time, then this is
* a no-op. <p>If the context has not been encountered before it will be fully initialized from scratch. Otherwise a cached set
* of caps and function pointers will be used. <p>The reference to the context is held in a weak reference; therefore if no
* strong reference exists to the GL context it will automatically be forgotten by the VM at an indeterminate point in the
* future, freeing up a little RAM.
*
* @param context The context object, which uniquely identifies a GL context. If context is null, the native stubs are
* unloaded.
*
* @throws LWJGLException if context non-null, and the gl library can't be loaded or the basic GL11 functions can't be loaded
*/
public static void useContext(Object context) throws LWJGLException {
if (context == null) {
if ( context == null ) {
unloadStubs();
if (did_auto_load)
if ( did_auto_load )
unloadOpenGLLibrary();
currentContext = null;
VBOTracker.setCurrent(null);
@ -242,13 +239,13 @@ public final class GLContext {
}
// Is this the same as last time?
Object current = currentContext == null ? null : currentContext.get();
if (current == context) {
if ( current == context ) {
// Yes, so we don't need to do anything. Our caps and function pointers are still valid.
return;
}
// Ok, now it's the current context.
if (gl_ref_count == 0) {
if ( gl_ref_count == 0 ) {
loadOpenGLLibrary();
did_auto_load = true;
}
@ -257,58 +254,71 @@ public final class GLContext {
currentContext = new WeakReference(context);
VBOTracker.setCurrent(context);
} catch (LWJGLException e) {
if (did_auto_load)
if ( did_auto_load )
unloadOpenGLLibrary();
throw e;
}
}
private static void getExtensionClassesAndNames(Map exts, Set exts_names) {
String version_string = GL11.glGetString(GL11.GL_VERSION);
int version_index = version_string.indexOf("1.");
if (version_index != -1) {
String version = version_string.substring(version_index);
char minor_version = version_string.charAt(2);
switch (minor_version) {
case '5':
addExtensionClass(exts, exts_names, "GL15", "OpenGL15");
// Fall through
case '4':
addExtensionClass(exts, exts_names, "GL14", "OpenGL14");
// Fall through
case '3':
addExtensionClass(exts, exts_names, "GL13", "OpenGL13");
// Fall through
case '2':
addExtensionClass(exts, exts_names, "GL12", "OpenGL12");
// Fall through
default:
break;
}
/*
The version number is either of the form
<major number>.<minor number>
or
<major number>.<minor number>.<release number>
where the numbers all have one or more digits.
*/
String version = GL11.glGetString(GL11.GL_VERSION);
int majorEnd = version.indexOf('.');
int minorEnd = version.indexOf('.', majorEnd + 1);
int majorVersion = Integer.parseInt(version.substring(0, majorEnd));
int minorVersion = Integer.parseInt(version.substring(majorEnd + 1, minorEnd));
if ( majorVersion == 2 ) {
// ----------------------[ 2.X ]----------------------
addExtensionClass(exts, exts_names, "GL20", "OpenGL20");
// ----------------------[ 1.X ]----------------------
addExtensionClass(exts, exts_names, "GL15", "OpenGL15");
addExtensionClass(exts, exts_names, "GL14", "OpenGL14");
addExtensionClass(exts, exts_names, "GL13", "OpenGL13");
addExtensionClass(exts, exts_names, "GL12", "OpenGL12");
} else {
switch ( minorVersion ) {
case 5:
addExtensionClass(exts, exts_names, "GL15", "OpenGL15");
case 4:
addExtensionClass(exts, exts_names, "GL14", "OpenGL14");
case 3:
addExtensionClass(exts, exts_names, "GL13", "OpenGL13");
case 2:
addExtensionClass(exts, exts_names, "GL12", "OpenGL12");
}
}
addExtensionClass(exts, exts_names, "EXTTextureCompressionS3TC", "");
String extensions_string = GL11.glGetString(GL11.GL_EXTENSIONS);
StringTokenizer tokenizer = new StringTokenizer(extensions_string);
while (tokenizer.hasMoreTokens()) {
while ( tokenizer.hasMoreTokens() ) {
String extension_string = tokenizer.nextToken();
StringBuffer converted_name = new StringBuffer();
int gl_prefix_index = extension_string.indexOf("GL_");
if (gl_prefix_index == -1)
if ( gl_prefix_index == -1 )
continue;
if (extension_string.equals("GL_EXT_texture_compression_s3tc")) {
if ( "GL_EXT_texture_compression_s3tc".equals(extension_string) ) {
// Special workaround
addExtensionClass(exts, exts_names, "EXTTextureCompressionS3TC", "GL_EXT_texture_compression_s3tc");
} else if (extension_string.equals("GL_EXT_texture_lod_bias")) {
} else if ( "GL_EXT_texture_lod_bias".equals(extension_string) ) {
// Special workaround
addExtensionClass(exts, exts_names, "EXTTextureLODBias", "GL_EXT_texture_lod_bias");
} else if (extension_string.equals("GL_NV_texture_compression_vtc")) {
} else if ( "GL_NV_texture_compression_vtc".equals(extension_string) ) {
// Special workaround
addExtensionClass(exts, exts_names, "NVTextureCompressionVTC", "GL_NV_texture_compression_vtc");
} else {
for (int i = gl_prefix_index + 3; i < extension_string.length(); i++) {
for ( int i = gl_prefix_index + 3; i < extension_string.length(); i++ ) {
char c;
if (extension_string.charAt(i) == '_') {
if ( extension_string.charAt(i) == '_' ) {
i++;
c = Character.toUpperCase(extension_string.charAt(i));
} else
@ -324,8 +334,8 @@ public final class GLContext {
}
private static void addExtensionClass(Map exts, Set exts_names, String ext_class_name, String ext_name) {
if (ext_name != null) {
if (exts_names.contains(ext_name)) {
if ( ext_name != null ) {
if ( exts_names.contains(ext_name) ) {
// Already added; ignore
return;
}
@ -343,20 +353,19 @@ public final class GLContext {
}
private static void loadStubs() throws LWJGLException {
if (loaded_stubs)
if ( loaded_stubs )
return;
GL11.initNativeStubs();
exts = new HashMap();
Set exts_names = new HashSet();
getExtensionClassesAndNames(exts, exts_names);
Iterator exts_it = exts.keySet().iterator();
while (exts_it.hasNext()) {
while ( exts_it.hasNext() ) {
Class extension_class = (Class)exts_it.next();
resetNativeStubs(extension_class);
try {
Method init_stubs_method = extension_class.getDeclaredMethod("initNativeStubs", null);
init_stubs_method.invoke(null, null);
String ext_name = (String)exts.get(extension_class);
} catch (Exception e) {
Sys.log("Failed to initialize extension " + extension_class);
exts_it.remove();
@ -368,11 +377,11 @@ public final class GLContext {
}
private static void unloadStubs() {
if (!loaded_stubs)
if ( !loaded_stubs )
return;
loaded_stubs = false;
Iterator exts_it = exts.keySet().iterator();
while (exts_it.hasNext()) {
while ( exts_it.hasNext() ) {
Class ext_class = (Class)exts_it.next();
resetNativeStubs(ext_class);
}
@ -380,11 +389,10 @@ public final class GLContext {
}
/**
* If the OpenGL reference count is 0, the library is loaded. The
* reference count is then incremented.
* If the OpenGL reference count is 0, the library is loaded. The reference count is then incremented.
*/
public static void loadOpenGLLibrary() throws LWJGLException {
if (gl_ref_count == 0)
if ( gl_ref_count == 0 )
nLoadOpenGLLibrary();
gl_ref_count++;
}
@ -392,12 +400,11 @@ public final class GLContext {
private static native void nLoadOpenGLLibrary() throws LWJGLException;
/**
* The OpenGL library reference count is decremented, and if it
* reaches 0, the library is unloaded.
* The OpenGL library reference count is decremented, and if it reaches 0, the library is unloaded.
*/
public static void unloadOpenGLLibrary() {
gl_ref_count--;
if (gl_ref_count == 0)
if ( gl_ref_count == 0 )
nUnloadOpenGLLibrary();
}

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +1,38 @@
/*
/*
* Copyright (c) 2002-2004 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.
*/
package org.lwjgl.util;
import org.lwjgl.opengl.GL20;
import java.nio.*;
/**
@ -3644,7 +3646,7 @@ public class GLImpl implements IGL {
* @param v1
* @param v2
* @param vstride
* @param vorder
* @param vorder
* @param points
*/
public void glMap2f(int target, float u1, float u2, int ustride, int uorder, float v1, float v2, int vstride, int vorder, FloatBuffer points) {
@ -6092,4 +6094,456 @@ public class GLImpl implements IGL {
public void glWriteMaskEXT(int res, int in, int outX, int outY, int outZ, int outW) {
GL.glWriteMaskEXT(res, in, outX, outY, outZ, outW);
}
// ----------------------------------------------------------
// ----------------------[ OpenGL 2.0 ]----------------------
// ----------------------------------------------------------
/**
* @param shader
* @param string
*/
public void glShaderSource(int shader, ByteBuffer string) {
GL.glShaderSource(shader, string);
}
/**
* @param shader
* @param strings
*/
public void glShaderSource(int shader, ByteBuffer[] strings) {
GL.glShaderSource(shader, strings);
}
/**
* @param type
*
* @return
*/
public int glCreateShader(int type) {
return GL.glCreateShader(type);
}
/**
* @param shader
*
* @return
*/
public boolean glIsShader(int shader) {
return GL.glIsShader(shader);
}
/**
* @param shader
*/
public void glCompileShader(int shader) {
GL.glCompileShader(shader);
}
/**
* @param shader
*/
public void glDeleteShader(int shader) {
GL.glDeleteShader(shader);
}
/**
* @return
*/
public int glCreateProgram() {
return GL.glCreateProgram();
}
/**
* @param program
*
* @return
*/
public boolean glIsProgram(int program) {
return GL.glIsProgram(program);
}
/**
* @param program
* @param shader
*/
public void glAttachShader(int program, int shader) {
GL.glAttachShader(program, shader);
}
/**
* @param program
* @param shader
*/
public void glDetachShader(int program, int shader) {
GL.glDetachShader(program, shader);
}
/**
* @param program
*/
public void glLinkProgram(int program) {
GL.glLinkProgram(program);
}
/**
* @param program
*/
public void glUseProgram(int program) {
GL.glUseProgram(program);
}
/**
* @param program
*/
public void glValidateProgram(int program) {
GL.glValidateProgram(program);
}
/**
* @param program
*/
public void glDeleteProgram(int program) {
GL.glDeleteProgram(program);
}
/**
* @param location
* @param v0
*/
public void glUniform1f(int location, float v0) {
GL.glUniform1f(location, v0);
}
/**
* @param location
* @param v0
* @param v1
*/
public void glUniform2f(int location, float v0, float v1) {
GL.glUniform2f(location, v0, v1);
}
/**
* @param location
* @param v0
* @param v1
* @param v2
*/
public void glUniform3f(int location, float v0, float v1, float v2) {
GL.glUniform3f(location, v0, v1, v2);
}
/**
* @param location
* @param v0
* @param v1
* @param v2
* @param v3
*/
public void glUniform4f(int location, float v0, float v1, float v2, float v3) {
GL.glUniform4f(location, v0, v1, v2, v3);
}
/**
* @param location
* @param v0
*/
public void glUniform1i(int location, int v0) {
GL.glUniform1i(location, v0);
}
/**
* @param location
* @param v0
* @param v1
*/
public void glUniform2i(int location, int v0, int v1) {
GL.glUniform2i(location, v0, v1);
}
/**
* @param location
* @param v0
* @param v1
* @param v2
*/
public void glUniform3i(int location, int v0, int v1, int v2) {
GL.glUniform3i(location, v0, v1, v2);
}
/**
* @param location
* @param v0
* @param v1
* @param v2
* @param v3
*/
public void glUniform4i(int location, int v0, int v1, int v2, int v3) {
GL.glUniform4i(location, v0, v1, v2, v3);
}
/**
* @param location
* @param values
*/
public void glUniform1(int location, FloatBuffer values) {
GL.glUniform1(location, values);
}
/**
* @param location
* @param values
*/
public void glUniform2(int location, FloatBuffer values) {
GL.glUniform2(location, values);
}
/**
* @param location
* @param values
*/
public void glUniform3(int location, FloatBuffer values) {
GL.glUniform3(location, values);
}
/**
* @param location
* @param values
*/
public void glUniform4(int location, FloatBuffer values) {
GL.glUniform4(location, values);
}
/**
* @param location
* @param values
*/
public void glUniform1(int location, IntBuffer values) {
GL.glUniform1(location, values);
}
/**
* @param location
* @param values
*/
public void glUniform2(int location, IntBuffer values) {
GL.glUniform2(location, values);
}
/**
* @param location
* @param values
*/
public void glUniform3(int location, IntBuffer values) {
GL.glUniform3(location, values);
}
/**
* @param location
* @param values
*/
public void glUniform4(int location, IntBuffer values) {
GL.glUniform4(location, values);
}
/**
* @param location
* @param transpose
* @param matrices
*/
public void glUniformMatrix2(int location, boolean transpose, FloatBuffer matrices) {
GL.glUniformMatrix2(location, transpose, matrices);
}
/**
* @param location
* @param transpose
* @param matrices
*/
public void glUniformMatrix3(int location, boolean transpose, FloatBuffer matrices) {
GL.glUniformMatrix3(location, transpose, matrices);
}
/**
* @param location
* @param transpose
* @param matrices
*/
public void glUniformMatrix4(int location, boolean transpose, FloatBuffer matrices) {
GL.glUniformMatrix4(location, transpose, matrices);
}
/**
* @param shader
* @param pname
* @param params
*/
public void glGetShader(int shader, int pname, FloatBuffer params) {
GL.glGetShader(shader, pname, params);
}
/**
* @param shader
* @param pname
* @param params
*/
public void glGetShader(int shader, int pname, IntBuffer params) {
GL.glGetShader(shader, pname, params);
}
/**
* @param program
* @param pname
* @param params
*/
public void glGetProgram(int program, int pname, FloatBuffer params) {
GL.glGetProgram(program, pname, params);
}
/**
* @param program
* @param pname
* @param params
*/
public void glGetProgram(int program, int pname, IntBuffer params) {
GL.glGetProgram(program, pname, params);
}
/**
* @param shader
* @param length
* @param infoLog
*/
public void glGetShaderInfoLog(int shader, IntBuffer length, ByteBuffer infoLog) {
GL.glGetShaderInfoLog(shader, length, infoLog);
}
/**
* @param program
* @param length
* @param infoLog
*/
public void glGetProgramInfoLog(int program, IntBuffer length, ByteBuffer infoLog) {
GL.glGetProgramInfoLog(program, length, infoLog);
}
/**
* @param program
* @param count
* @param shaders
*/
public void glGetAttachedShaders(int program, IntBuffer count, IntBuffer shaders) {
GL.glGetAttachedShaders(program, count, shaders);
}
/**
* @param program
* @param name
*
* @return
*/
public int glGetUniformLocation(int program, ByteBuffer name) {
return GL.glGetUniformLocation(program, name);
}
/**
* @param program
* @param index
* @param length
* @param size
* @param type
* @param name
*/
public void glGetActiveUniform(int program, int index,
IntBuffer length, IntBuffer size, IntBuffer type, ByteBuffer name) {
GL.glGetActiveUniform(program, index, length, size, type, name);
}
/**
* @param program
* @param location
* @param params
*/
public void glGetUniform(int program, int location, FloatBuffer params) {
GL.glGetUniform(program, location, params);
}
/**
* @param program
* @param location
* @param params
*/
public void glGetUniform(int program, int location, IntBuffer params) {
GL.glGetUniform(program, location, params);
}
/**
* @param shader
* @param length
* @param source
*/
public void glGetShaderSource(int shader, IntBuffer length, ByteBuffer source) {
GL.glGetShaderSource(shader, length, source);
}
/**
* @param program
* @param index
* @param name
*/
public void glBindAttribLocation(int program, int index, ByteBuffer name) {
GL.glBindAttribLocation(program, index, name);
}
/**
* @param program
* @param index
* @param length
* @param size
* @param type
* @param name
*/
public void glGetActiveAttrib(int program, int index,
IntBuffer length, IntBuffer size, IntBuffer type, ByteBuffer name) {
GL.glGetActiveAttrib(program, index, length, size, type, name);
}
/**
* @param program
* @param name
*
* @return
*/
public int glGetAttribLocation(int program, ByteBuffer name) {
return GL.glGetAttribLocation(program, name);
}
/**
* @param buffers
*/
public void glDrawBuffers(IntBuffer buffers) {
GL.glDrawBuffers(buffers);
}
/**
* @param face
* @param func
* @param ref
* @param mask
*/
public void glStencilFuncSeparate(int face, int func, int ref, int mask) {
GL.glStencilFuncSeparate(face, func, ref, mask);
}
/**
* @param face
* @param sfail
* @param dpfail
* @param dppass
*/
public void glStencilOpSeparate(int face, int sfail, int dpfail, int dppass) {
GL.glStencilOpSeparate(face, sfail, dpfail, dppass);
}
}

View File

@ -1,31 +1,31 @@
/*
/*
* Copyright (c) 2002-2004 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.
*/
@ -4926,5 +4926,353 @@ public interface IGL {
*/
void glVertexWeightPointerEXT(int size, int type, int stride, int buffer_offset);
// ----------------------------------------------------------
// ----------------------[ OpenGL 2.0 ]----------------------
// ----------------------------------------------------------
/**
* @param shader
* @param string
*/
void glShaderSource(int shader, ByteBuffer string);
/**
* @param shader
* @param strings
*/
void glShaderSource(int shader, ByteBuffer[] strings);
/**
* @param type
*
* @return
*/
int glCreateShader(int type);
/**
* @param shader
*
* @return
*/
boolean glIsShader(int shader);
/**
* @param shader
*/
void glCompileShader(int shader);
/**
* @param shader
*/
void glDeleteShader(int shader);
/**
* @return
*/
int glCreateProgram();
/**
* @param program
*
* @return
*/
boolean glIsProgram(int program);
/**
* @param program
* @param shader
*/
void glAttachShader(int program, int shader);
/**
* @param program
* @param shader
*/
void glDetachShader(int program, int shader);
/**
* @param program
*/
void glLinkProgram(int program);
/**
* @param program
*/
void glUseProgram(int program);
/**
* @param program
*/
void glValidateProgram(int program);
/**
* @param program
*/
void glDeleteProgram(int program);
/**
* @param location
* @param v0
*/
void glUniform1f(int location, float v0);
/**
* @param location
* @param v0
* @param v1
*/
void glUniform2f(int location, float v0, float v1);
/**
* @param location
* @param v0
* @param v1
* @param v2
*/
void glUniform3f(int location, float v0, float v1, float v2);
/**
* @param location
* @param v0
* @param v1
* @param v2
* @param v3
*/
void glUniform4f(int location, float v0, float v1, float v2, float v3);
/**
* @param location
* @param v0
*/
void glUniform1i(int location, int v0);
/**
* @param location
* @param v0
* @param v1
*/
void glUniform2i(int location, int v0, int v1);
/**
* @param location
* @param v0
* @param v1
* @param v2
*/
void glUniform3i(int location, int v0, int v1, int v2);
/**
* @param location
* @param v0
* @param v1
* @param v2
* @param v3
*/
void glUniform4i(int location, int v0, int v1, int v2, int v3);
/**
* @param location
* @param values
*/
void glUniform1(int location, FloatBuffer values);
/**
* @param location
* @param values
*/
void glUniform2(int location, FloatBuffer values);
/**
* @param location
* @param values
*/
void glUniform3(int location, FloatBuffer values);
/**
* @param location
* @param values
*/
void glUniform4(int location, FloatBuffer values);
/**
* @param location
* @param values
*/
void glUniform1(int location, IntBuffer values);
/**
* @param location
* @param values
*/
void glUniform2(int location, IntBuffer values);
/**
* @param location
* @param values
*/
void glUniform3(int location, IntBuffer values);
/**
* @param location
* @param values
*/
void glUniform4(int location, IntBuffer values);
/**
* @param location
* @param transpose
* @param matrices
*/
void glUniformMatrix2(int location, boolean transpose, FloatBuffer matrices);
/**
* @param location
* @param transpose
* @param matrices
*/
void glUniformMatrix3(int location, boolean transpose, FloatBuffer matrices);
/**
* @param location
* @param transpose
* @param matrices
*/
void glUniformMatrix4(int location, boolean transpose, FloatBuffer matrices);
/**
* @param shader
* @param pname
* @param params
*/
void glGetShader(int shader, int pname, FloatBuffer params);
/**
* @param shader
* @param pname
* @param params
*/
void glGetShader(int shader, int pname, IntBuffer params);
/**
* @param program
* @param pname
* @param params
*/
void glGetProgram(int program, int pname, FloatBuffer params);
/**
* @param program
* @param pname
* @param params
*/
void glGetProgram(int program, int pname, IntBuffer params);
/**
* @param shader
* @param length
* @param infoLog
*/
void glGetShaderInfoLog(int shader, IntBuffer length, ByteBuffer infoLog);
/**
* @param program
* @param length
* @param infoLog
*/
void glGetProgramInfoLog(int program, IntBuffer length, ByteBuffer infoLog);
/**
* @param program
* @param count
* @param shaders
*/
void glGetAttachedShaders(int program, IntBuffer count, IntBuffer shaders);
/**
* @param program
* @param name
*
* @return
*/
int glGetUniformLocation(int program, ByteBuffer name);
/**
* @param program
* @param index
* @param length
* @param size
* @param type
* @param name
*/
void glGetActiveUniform(int program, int index,
IntBuffer length, IntBuffer size, IntBuffer type, ByteBuffer name);
/**
* @param program
* @param location
* @param params
*/
void glGetUniform(int program, int location, FloatBuffer params);
/**
* @param program
* @param location
* @param params
*/
void glGetUniform(int program, int location, IntBuffer params);
/**
* @param shader
* @param length
* @param source
*/
void glGetShaderSource(int shader, IntBuffer length, ByteBuffer source);
/**
* @param program
* @param index
* @param name
*/
void glBindAttribLocation(int program, int index, ByteBuffer name);
/**
* @param program
* @param index
* @param length
* @param size
* @param type
* @param name
*/
void glGetActiveAttrib(int program, int index,
IntBuffer length, IntBuffer size, IntBuffer type, ByteBuffer name);
/**
* @param program
* @param name
*
* @return
*/
int glGetAttribLocation(int program, ByteBuffer name);
/**
* @param buffers
*/
void glDrawBuffers(IntBuffer buffers);
/**
* @param face
* @param func
* @param ref
* @param mask
*/
void glStencilFuncSeparate(int face, int func, int ref, int mask);
/**
* @param face
* @param sfail
* @param dpfail
* @param dppass
*/
void glStencilOpSeparate(int face, int sfail, int dpfail, int dppass);
}

View File

@ -39,13 +39,8 @@ COMMON = \
org_lwjgl_openal_eax_EAXListenerProperties.h \
org_lwjgl_opengl_GLContext.cpp \
org_lwjgl_opengl_GL11.cpp \
org_lwjgl_opengl_GL11.h \
org_lwjgl_opengl_GL12.cpp \
org_lwjgl_opengl_GL12.h \
org_lwjgl_opengl_GL13.cpp \
org_lwjgl_opengl_GL13.h \
org_lwjgl_opengl_GL14.cpp \
org_lwjgl_opengl_GL14.h \
org_lwjgl_opengl_GL15.cpp \
org_lwjgl_opengl_GL15.h
org_lwjgl_opengl_GL20.cpp

View File

@ -0,0 +1,838 @@
/*
* Copyright (c) 2002-2004 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
* 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 '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
* 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.GL20
// ----------------------------------
#include "extgl.h"
#include "common_tools.h"
typedef int GLintptr;
typedef unsigned int GLsizeiptr;
typedef unsigned char GLchar;
// ARB_shader_objects
typedef void (APIENTRY * glAttachShaderPROC) (GLuint program, GLuint shader);
typedef void (APIENTRY * glCompileShaderPROC) (GLuint shader);
typedef GLint (APIENTRY * glCreateProgramPROC) (void);
typedef GLint (APIENTRY * glCreateShaderPROC) (GLuint type);
typedef void (APIENTRY * glDeleteProgramPROC) (GLuint program);
typedef void (APIENTRY * glDeleteShaderPROC) (GLuint shader);
typedef void (APIENTRY * glDetachShaderPROC) (GLuint program, GLuint shader);
typedef void (APIENTRY * glGetActiveUniformPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, const GLchar *name);
typedef void (APIENTRY * glGetAttachedShadersPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
typedef void (APIENTRY * glGetProgramfvPROC) (GLuint program, GLenum pname, GLfloat *params);
typedef void (APIENTRY * glGetProgramivPROC) (GLuint program, GLenum pname, GLint *params);
typedef void (APIENTRY * glGetProgramInfoLogPROC) (GLuint program, GLsizei maxLength, GLsizei *length, GLchar *infoLog);
typedef void (APIENTRY * glGetShaderfvPROC) (GLuint shader, GLenum pname, GLfloat *params);
typedef void (APIENTRY * glGetShaderivPROC) (GLuint shader, GLenum pname, GLint *params);
typedef void (APIENTRY * glGetShaderInfoLogPROC) (GLuint shader, GLsizei maxLength, GLsizei *length, GLchar *infoLog);
typedef void (APIENTRY * glGetShaderSourcePROC) (GLuint shader, GLsizei maxLength, GLsizei *length, GLchar *source);
typedef void (APIENTRY * glGetUniformfvPROC) (GLuint program, GLint location, GLfloat *params);
typedef void (APIENTRY * glGetUniformivPROC) (GLuint program, GLint location, GLint *params);
typedef GLint (APIENTRY * glGetUniformLocationPROC) (GLuint program, const GLchar *name);
typedef GLboolean (APIENTRY * glIsProgramPROC) (GLuint program);
typedef GLboolean (APIENTRY * glIsShaderPROC) (GLuint shader);
typedef void (APIENTRY * glLinkProgramPROC) (GLuint program);
typedef void (APIENTRY * glShaderSourcePROC) (GLuint shader, GLsizei count, const GLchar **string, const GLint *length);
typedef void (APIENTRY * glUniform1fPROC) (GLint location, GLfloat v0);
typedef void (APIENTRY * glUniform2fPROC) (GLint location, GLfloat v0, GLfloat v1);
typedef void (APIENTRY * glUniform3fPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
typedef void (APIENTRY * glUniform4fPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
typedef void (APIENTRY * glUniform1iPROC) (GLint location, GLint v0);
typedef void (APIENTRY * glUniform2iPROC) (GLint location, GLint v0, GLint v1);
typedef void (APIENTRY * glUniform3iPROC) (GLint location, GLint v0, GLint v1, GLint v2);
typedef void (APIENTRY * glUniform4iPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
typedef void (APIENTRY * glUniform1fvPROC) (GLint location, GLsizei count, GLfloat *value);
typedef void (APIENTRY * glUniform2fvPROC) (GLint location, GLsizei count, GLfloat *value);
typedef void (APIENTRY * glUniform3fvPROC) (GLint location, GLsizei count, GLfloat *value);
typedef void (APIENTRY * glUniform4fvPROC) (GLint location, GLsizei count, GLfloat *value);
typedef void (APIENTRY * glUniform1ivPROC) (GLint location, GLsizei count, GLint *value);
typedef void (APIENTRY * glUniform2ivPROC) (GLint location, GLsizei count, GLint *value);
typedef void (APIENTRY * glUniform3ivPROC) (GLint location, GLsizei count, GLint *value);
typedef void (APIENTRY * glUniform4ivPROC) (GLint location, GLsizei count, GLint *value);
typedef void (APIENTRY * glUniformMatrix2fvPROC) (GLint location, GLsizei count, GLboolean transpose, GLfloat *value);
typedef void (APIENTRY * glUniformMatrix3fvPROC) (GLint location, GLsizei count, GLboolean transpose, GLfloat *value);
typedef void (APIENTRY * glUniformMatrix4fvPROC) (GLint location, GLsizei count, GLboolean transpose, GLfloat *value);
typedef void (APIENTRY * glUseProgramPROC) (GLuint program);
typedef void (APIENTRY * glValidateProgramPROC) (GLuint program);
static const int initialSourcesSize = 8;
static int sourcesSize = initialSourcesSize;
static int sourceCount;
static GLchar** sources = new GLchar*[initialSourcesSize];
static GLint* sourcesLengths = new GLint[initialSourcesSize];
// ARB_vertex_shader
typedef void (APIENTRY * glBindAttribLocationPROC) (GLuint program, GLuint index, const GLchar *name);
typedef void (APIENTRY * glGetActiveAttribPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, const GLchar *name);
typedef GLint (APIENTRY * glGetAttribLocationPROC) (GLuint program, const GLchar *name);
// ARB_draw_buffers
typedef void (APIENTRY * glDrawBuffersPROC) (GLsizei n, const GLenum *bufs);
// Two-Sided Stencil
typedef void (APIENTRY * glStencilFuncSeparatePROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
typedef void (APIENTRY * glStencilOpSeparatePROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
// ARB_shader_objects
static glAttachShaderPROC glAttachShader;
static glCompileShaderPROC glCompileShader;
static glCreateProgramPROC glCreateProgram;
static glCreateShaderPROC glCreateShader;
static glDeleteProgramPROC glDeleteProgram;
static glDeleteShaderPROC glDeleteShader;
static glDetachShaderPROC glDetachShader;
static glGetActiveUniformPROC glGetActiveUniform;
static glGetAttachedShadersPROC glGetAttachedShaders;
static glGetProgramfvPROC glGetProgramfv;
static glGetProgramivPROC glGetProgramiv;
static glGetProgramInfoLogPROC glGetProgramInfoLog;
static glGetShaderfvPROC glGetShaderfv;
static glGetShaderivPROC glGetShaderiv;
static glGetShaderInfoLogPROC glGetShaderInfoLog;
static glGetShaderSourcePROC glGetShaderSource;
static glGetUniformfvPROC glGetUniformfv;
static glGetUniformivPROC glGetUniformiv;
static glGetUniformLocationPROC glGetUniformLocation;
static glIsProgramPROC glIsProgram;
static glIsShaderPROC glIsShader;
static glLinkProgramPROC glLinkProgram;
static glShaderSourcePROC glShaderSource;
static glUniform1fPROC glUniform1f;
static glUniform2fPROC glUniform2f;
static glUniform3fPROC glUniform3f;
static glUniform4fPROC glUniform4f;
static glUniform1iPROC glUniform1i;
static glUniform2iPROC glUniform2i;
static glUniform3iPROC glUniform3i;
static glUniform4iPROC glUniform4i;
static glUniform1fvPROC glUniform1fv;
static glUniform2fvPROC glUniform2fv;
static glUniform3fvPROC glUniform3fv;
static glUniform4fvPROC glUniform4fv;
static glUniform1ivPROC glUniform1iv;
static glUniform2ivPROC glUniform2iv;
static glUniform3ivPROC glUniform3iv;
static glUniform4ivPROC glUniform4iv;
static glUniformMatrix2fvPROC glUniformMatrix2fv;
static glUniformMatrix3fvPROC glUniformMatrix3fv;
static glUniformMatrix4fvPROC glUniformMatrix4fv;
static glUseProgramPROC glUseProgram;
static glValidateProgramPROC glValidateProgram;
// ARB_vertex_shader
static glBindAttribLocationPROC glBindAttribLocation;
static glGetActiveAttribPROC glGetActiveAttrib;
static glGetAttribLocationPROC glGetAttribLocation;
// ARB_draw_buffers
static glDrawBuffersPROC glDrawBuffers;
// Two-Sided Stencil
static glStencilFuncSeparatePROC glStencilFuncSeparate;
static glStencilOpSeparatePROC glStencilOpSeparate;
// ------------------------------------------------------------------
// ----------------------[ ARB_shader_objects ]----------------------
// ------------------------------------------------------------------
/*
* Class: org.lwjgl.opengl.GL20
* Method: initShaderSource
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_initShaderSource
(JNIEnv * env, jclass clazz, jint count)
{
sourceCount = count;
if ( sourceCount > sourcesSize ) {
sourcesSize = sourceCount * 2;
delete sources;
delete sourcesLengths;
sources = new GLchar*[sourcesSize];
sourcesLengths = new GLint[sourcesSize];
}
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: setShaderString
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_setShaderString
(JNIEnv * env, jclass clazz, jint index, jobject string, jint stringOffset, jint stringLength)
{
GLchar *string_ptr = (GLchar *)((GLubyte *)env->GetDirectBufferAddress(string) + stringOffset);
sources[index] = string_ptr;
sourcesLengths[index] = stringLength;
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglShaderSource
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglShaderSource
(JNIEnv * env, jclass clazz, jint shader)
{
glShaderSource(shader, sourceCount, (const GLchar **)sources, (const GLint *)sourcesLengths);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glCreateShader
*/
static jint JNICALL Java_org_lwjgl_opengl_GL20_glCreateShader
(JNIEnv * env, jclass clazz, jint type)
{
return glCreateShader(type);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glIsShader
*/
static jboolean JNICALL Java_org_lwjgl_opengl_GL20_glIsShader
(JNIEnv * env, jclass clazz, jint shader)
{
return glIsShader(shader);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glCompileShader
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glCompileShader(JNIEnv * env, jclass clazz, jint shader)
{
glCompileShader(shader);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glDeleteShader
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glDeleteShader
(JNIEnv * env, jclass clazz, jint shader)
{
glDeleteShader(shader);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glCreateProgram
*/
static jint JNICALL Java_org_lwjgl_opengl_GL20_glCreateProgram
(JNIEnv * env, jclass clazz)
{
return glCreateProgram();
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glIsProgram
*/
static jboolean JNICALL Java_org_lwjgl_opengl_GL20_glIsProgram
(JNIEnv * env, jclass clazz, jint program)
{
return glIsProgram(program);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glAttachShader
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glAttachShader
(JNIEnv * env, jclass clazz, jint program, jint shader)
{
glAttachShader(program, shader);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glDetachShader
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glDetachShader
(JNIEnv * env, jclass clazz, jint program, jint shader)
{
glDetachShader(program, shader);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glLinkProgram
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glLinkProgram
(JNIEnv * env, jclass clazz, jint program)
{
glLinkProgram(program);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glUseProgram
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glUseProgram
(JNIEnv * env, jclass clazz, jint program)
{
glUseProgram(program);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glValidateProgram
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glValidateProgram
(JNIEnv * env, jclass clazz, jint program)
{
glValidateProgram(program);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glDeleteProgram
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glDeleteProgram
(JNIEnv * env, jclass clazz, jint program)
{
glDeleteProgram(program);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glUniform1f
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glUniform1f
(JNIEnv * env, jclass clazz, jint location, jfloat v0)
{
glUniform1f(location, v0);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glUniform2f
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glUniform2f
(JNIEnv * env, jclass clazz, jint location, jfloat v0, jfloat v1)
{
glUniform2f(location, v0, v1);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glUniform3f
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glUniform3f
(JNIEnv * env, jclass clazz, jint location, jfloat v0, jfloat v1, jfloat v2)
{
glUniform3f(location, v0, v1, v2);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glUniform4f
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glUniform4f
(JNIEnv * env, jclass clazz, jint location, jfloat v0, jfloat v1, jfloat v2, jfloat v3)
{
glUniform4f(location, v0, v1, v2, v3);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glUniform1i
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glUniform1i
(JNIEnv * env, jclass clazz, jint location, jint v0)
{
glUniform1i(location, v0);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glUniform2i
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glUniform2i
(JNIEnv * env, jclass clazz, jint location, jint v0, jint v1)
{
glUniform2i(location, v0, v1);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glUniform3i
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glUniform3i
(JNIEnv * env, jclass clazz, jint location, jint v0, jint v1, jint v2)
{
glUniform3i(location, v0, v1, v2);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glUniform4i
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glUniform4i
(JNIEnv * env, jclass clazz, jint location, jint v0, jint v1, jint v2, jint v3)
{
glUniform4i(location, v0, v1, v2, v3);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglUniform1fv
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglUniform1fv
(JNIEnv * env, jclass clazz, jint location, jint count, jobject values, jint valuesOffset)
{
GLfloat *values_ptr = (GLfloat *)env->GetDirectBufferAddress(values) + valuesOffset;
glUniform1fv(location, count, values_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglUniform2fv
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglUniform2fv
(JNIEnv * env, jclass clazz, jint location, jint count, jobject values, jint valuesOffset)
{
GLfloat *values_ptr = (GLfloat *)env->GetDirectBufferAddress(values) + valuesOffset;
glUniform2fv(location, count, values_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglUniform3fv
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglUniform3fv
(JNIEnv * env, jclass clazz, jint location, jint count, jobject values, jint valuesOffset)
{
GLfloat *values_ptr = (GLfloat *)env->GetDirectBufferAddress(values) + valuesOffset;
glUniform3fv(location, count, values_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglUniform4fv
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglUniform4fv
(JNIEnv * env, jclass clazz, jint location, jint count, jobject values, jint valuesOffset)
{
GLfloat *values_ptr = (GLfloat *)env->GetDirectBufferAddress(values) + valuesOffset;
glUniform4fv(location, count, values_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglUniform1iv
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglUniform1iv
(JNIEnv * env, jclass clazz, jint location, jint count, jobject values, jint valuesOffset)
{
GLint *values_ptr = (GLint *)env->GetDirectBufferAddress(values) + valuesOffset;
glUniform1iv(location, count, values_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglUniform2iv
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglUniform2iv
(JNIEnv * env, jclass clazz, jint location, jint count, jobject values, jint valuesOffset)
{
GLint *values_ptr = (GLint *)env->GetDirectBufferAddress(values) + valuesOffset;
glUniform2iv(location, count, values_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglUniform3iv
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglUniform3iv
(JNIEnv * env, jclass clazz, jint location, jint count, jobject values, jint valuesOffset)
{
GLint *values_ptr = (GLint *)env->GetDirectBufferAddress(values) + valuesOffset;
glUniform3iv(location, count, values_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglUniform4iv
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglUniform4iv
(JNIEnv * env, jclass clazz, jint location, jint count, jobject values, jint valuesOffset)
{
GLint *values_ptr = (GLint *)env->GetDirectBufferAddress(values) + valuesOffset;
glUniform4iv(location, count, values_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglUniformMatrix2fv
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglUniformMatrix2fv
(JNIEnv * env, jclass clazz, jint location, jint count, jboolean transpose, jobject matrices, jint matricesOffset)
{
GLfloat *matrices_ptr = (GLfloat *)env->GetDirectBufferAddress(matrices) + matricesOffset;
glUniformMatrix2fv(location, count, transpose, matrices_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglUniformMatrix3fv
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglUniformMatrix3fv
(JNIEnv * env, jclass clazz, jint location, jint count, jboolean transpose, jobject matrices, jint matricesOffset)
{
GLfloat *matrices_ptr = (GLfloat *)env->GetDirectBufferAddress(matrices) + matricesOffset;
glUniformMatrix3fv(location, count, transpose, matrices_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglUniformMatrix4fv
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglUniformMatrix4fv
(JNIEnv * env, jclass clazz, jint location, jint count, jboolean transpose, jobject matrices, jint matricesOffset)
{
GLfloat *matrices_ptr = (GLfloat *)env->GetDirectBufferAddress(matrices) + matricesOffset;
glUniformMatrix4fv(location, count, transpose, matrices_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglGetShaderfv
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglGetShaderfv
(JNIEnv * env, jclass clazz, jint shader, jint pname, jobject params, jint paramsOffset)
{
GLfloat *params_ptr = (GLfloat *)env->GetDirectBufferAddress(params) + paramsOffset;
glGetShaderfv(shader, pname, params_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglGetShaderiv
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglGetShaderiv
(JNIEnv * env, jclass clazz, jint shader, jint pname, jobject params, jint paramsOffset)
{
GLint *params_ptr = (GLint *)env->GetDirectBufferAddress(params) + paramsOffset;
glGetShaderiv(shader, pname, params_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglGetProgramfv
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglGetProgramfv
(JNIEnv * env, jclass clazz, jint program, jint pname, jobject params, jint paramsOffset)
{
GLfloat *params_ptr = (GLfloat *)env->GetDirectBufferAddress(params) + paramsOffset;
glGetProgramfv(program, pname, params_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglGetProgramiv
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglGetProgramiv
(JNIEnv * env, jclass clazz, jint program, jint pname, jobject params, jint paramsOffset)
{
GLint *params_ptr = (GLint *)env->GetDirectBufferAddress(params) + paramsOffset;
glGetProgramiv(program, pname, params_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglGetShaderInfoLog
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglGetShaderInfoLog
(JNIEnv * env, jclass clazz, jint shader, jint maxLength, jobject length, jint lengthOffset, jobject infoLog, jint infoLogOffset)
{
GLubyte *infoLog_ptr = (GLubyte *)env->GetDirectBufferAddress(infoLog) + infoLogOffset;
if ( length == NULL ) {
glGetShaderInfoLog(shader, maxLength, NULL, infoLog_ptr);
} else {
GLsizei *length_ptr = (GLsizei *)env->GetDirectBufferAddress(length) + lengthOffset;
glGetShaderInfoLog(shader, maxLength, length_ptr, infoLog_ptr);
}
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglGetProgramInfoLog
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglGetProgramInfoLog
(JNIEnv * env, jclass clazz, jint program, jint maxLength, jobject length, jint lengthOffset, jobject infoLog, jint infoLogOffset)
{
GLubyte *infoLog_ptr = (GLubyte *)env->GetDirectBufferAddress(infoLog) + infoLogOffset;
if ( length == NULL ) {
glGetProgramInfoLog(program, maxLength, NULL, infoLog_ptr);
} else {
GLsizei *length_ptr = (GLsizei *)env->GetDirectBufferAddress(length) + lengthOffset;
glGetProgramInfoLog(program, maxLength, length_ptr, infoLog_ptr);
}
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglGetAttachedShaders
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglGetAttachedShaders
(JNIEnv * env, jclass clazz, jint program, jint maxCount, jobject count, jint countOffset, jobject shaders, jint shadersOffset)
{
GLuint *shaders_ptr = (GLuint *)env->GetDirectBufferAddress(shaders) + shadersOffset;
if ( count == NULL ) {
glGetAttachedShaders(program, maxCount, NULL, shaders_ptr);
} else {
GLsizei *count_ptr = (GLsizei *)env->GetDirectBufferAddress(count) + countOffset;
glGetAttachedShaders(program, maxCount, count_ptr, shaders_ptr);
}
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglGetUniformLocation
*/
static jint JNICALL Java_org_lwjgl_opengl_GL20_nglGetUniformLocation
(JNIEnv * env, jclass clazz, jint program, jobject name, jint nameOffset)
{
GLubyte *name_ptr = (GLubyte *)env->GetDirectBufferAddress(name) + nameOffset;
return glGetUniformLocation(program, name_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglGetActiveUniform
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglGetActiveUniform
(JNIEnv * env, jclass clazz, jint program, jint index, jint maxLength, jobject length, jint lengthOffset, jobject size, jint sizeOffset, jobject type, jint typeOffset, jobject name, jint nameOffset)
{
GLint *size_ptr = (GLint *)env->GetDirectBufferAddress(size) + sizeOffset;
GLenum *type_ptr = (GLenum *)env->GetDirectBufferAddress(type) + typeOffset;
GLchar *name_ptr = (GLchar *)env->GetDirectBufferAddress(name) + nameOffset;
if ( length == NULL ) {
glGetActiveUniform(program, index, maxLength, (GLsizei *)NULL, size_ptr, type_ptr, name_ptr);
} else {
GLsizei *length_ptr = (GLsizei *)env->GetDirectBufferAddress(length) + lengthOffset;
glGetActiveUniform(program, index, maxLength, length_ptr, size_ptr, type_ptr, name_ptr);
}
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglGetUniformfv
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglGetUniformfv
(JNIEnv * env, jclass clazz, jint program, jint location, jobject params, jint paramsOffset)
{
GLfloat *params_ptr = (GLfloat *)env->GetDirectBufferAddress(params) + paramsOffset;
glGetUniformfv(program, location, params_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglGetUniformiv
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglGetUniformiv
(JNIEnv * env, jclass clazz, jint program, jint location, jobject params, jint paramsOffset)
{
GLint *params_ptr = (GLint *)env->GetDirectBufferAddress(params) + paramsOffset;
glGetUniformiv(program, location, params_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglGetShaderSource
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglGetShaderSource
(JNIEnv * env, jclass clazz, jint shader, jint maxLength, jobject length, jint lengthOffset, jobject source, jint sourceOffset)
{
GLubyte *source_ptr = (GLubyte *)env->GetDirectBufferAddress(source) + sourceOffset;
if ( length == NULL ) {
glGetShaderSource(shader, maxLength, NULL, source_ptr);
} else {
GLint *length_ptr = (GLint *)env->GetDirectBufferAddress(length) + lengthOffset;
glGetShaderSource(shader, maxLength, length_ptr, source_ptr);
}
}
// ------------------------------------------------------------------
// ----------------------[ ARB_vertex_shaders ]----------------------
// ------------------------------------------------------------------
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglBindAttribLocation
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglBindAttribLocation
(JNIEnv * env, jclass clazz, jint program, jint index, jobject name, jint nameOffset)
{
GLubyte *name_ptr = (GLubyte *)env->GetDirectBufferAddress(name) + nameOffset;
glBindAttribLocation(program, index, name_ptr);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglGetActiveAttrib
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglGetActiveAttrib
(JNIEnv * env, jclass clazz, jint program, jint index, jint maxLength, jobject length, jint lengthOffset, jobject size, jint sizeOffset, jobject type, jint typeOffset, jobject name, jint nameOffset)
{
GLint *size_ptr = (GLint *)env->GetDirectBufferAddress(size) + sizeOffset;
GLenum *type_ptr = (GLenum *)env->GetDirectBufferAddress(type) + typeOffset;
GLchar *name_ptr = (GLchar *)env->GetDirectBufferAddress(name) + nameOffset;
if ( length == NULL ) {
glGetActiveAttrib(program, index, maxLength, NULL, size_ptr, type_ptr, name_ptr);
} else {
GLsizei *length_ptr = (GLsizei *)env->GetDirectBufferAddress(length) + lengthOffset;
glGetActiveAttrib(program, index, maxLength, length_ptr, size_ptr, type_ptr, name_ptr);
}
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglGetAttribLocation
*/
static jint JNICALL Java_org_lwjgl_opengl_GL20_nglGetAttribLocation
(JNIEnv * env, jclass clazz, jint program, jobject name, jint nameOffset)
{
GLubyte *name_ptr = (GLubyte *)env->GetDirectBufferAddress(name) + nameOffset;
return glGetAttribLocation(program, name_ptr);
}
// ----------------------------------------------------------------
// ----------------------[ ARB_draw_buffers ]----------------------
// ----------------------------------------------------------------
/*
* Class: org.lwjgl.opengl.GL20
* Method: nglDrawBuffers
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_nglDrawBuffers
(JNIEnv * env, jclass clazz, jint size, jobject buffers, jint buffersOffset)
{
GLuint *buffers_ptr = (GLuint *)env->GetDirectBufferAddress(buffers) + buffersOffset;
glDrawBuffers(size, buffers_ptr);
}
// -----------------------------------------------------------------
// ----------------------[ Two-Sided Stencil ]----------------------
// -----------------------------------------------------------------
/*
* Class: org.lwjgl.opengl.GL20
* Method: glStencilFuncSeparate
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glStencilFuncSeparate
(JNIEnv * env, jclass clazz, jint face, jint func, jint ref, jint mask)
{
glStencilFuncSeparate(face, func, ref, mask);
}
/*
* Class: org.lwjgl.opengl.GL20
* Method: glStencilOpSeparate
*/
static void JNICALL Java_org_lwjgl_opengl_GL20_glStencilOpSeparate
(JNIEnv * env, jclass clazz, jint face, jint sfail, jint dpfail, jint dppass)
{
glStencilOpSeparate(face, sfail, dpfail, dppass);
}
extern "C" {
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL20_initNativeStubs(JNIEnv *env, jclass clazz) {
JavaMethodAndExtFunction functions[] = {
// ARB_shader_objects
{"glIsShader", "(I)Z", (void*)&Java_org_lwjgl_opengl_GL20_glIsShader, "glIsShader", (void**)&glIsShader},
{"glIsProgram", "(I)Z", (void*)&Java_org_lwjgl_opengl_GL20_glIsProgram, "glIsProgram", (void**)&glIsProgram},
{"glDeleteShader", "(I)V", (void*)&Java_org_lwjgl_opengl_GL20_glDeleteShader, "glDeleteShader", (void**)&glDeleteShader},
{"glDeleteProgram", "(I)V", (void*)&Java_org_lwjgl_opengl_GL20_glDeleteProgram, "glDeleteProgram", (void**)&glDeleteProgram},
{"glDetachShader", "(II)V", (void*)&Java_org_lwjgl_opengl_GL20_glDetachShader, "glDetachShader", (void**)&glDetachShader},
{"glCreateShader", "(I)I", (void*)&Java_org_lwjgl_opengl_GL20_glCreateShader, "glCreateShader", (void**)&glCreateShader},
{"initShaderSource", "(I)V", (void*)&Java_org_lwjgl_opengl_GL20_initShaderSource, NULL, NULL},
{"setShaderString", "(ILjava/nio/ByteBuffer;II)V", (void*)&Java_org_lwjgl_opengl_GL20_setShaderString, NULL, NULL},
{"nglShaderSource", "(I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglShaderSource, "glShaderSource", (void**)&glShaderSource},
{"glCompileShader", "(I)V", (void*)&Java_org_lwjgl_opengl_GL20_glCompileShader, "glCompileShader", (void**)&glCompileShader},
{"glCreateProgram", "()I", (void*)&Java_org_lwjgl_opengl_GL20_glCreateProgram, "glCreateProgram", (void**)&glCreateProgram},
{"glAttachShader", "(II)V", (void*)&Java_org_lwjgl_opengl_GL20_glAttachShader, "glAttachShader", (void**)&glAttachShader},
{"glLinkProgram", "(I)V", (void*)&Java_org_lwjgl_opengl_GL20_glLinkProgram, "glLinkProgram", (void**)&glLinkProgram},
{"glUseProgram", "(I)V", (void*)&Java_org_lwjgl_opengl_GL20_glUseProgram, "glUseProgram", (void**)&glUseProgram},
{"glValidateProgram", "(I)V", (void*)&Java_org_lwjgl_opengl_GL20_glValidateProgram, "glValidateProgram", (void**)&glValidateProgram},
{"glUniform1f", "(IF)V", (void*)&Java_org_lwjgl_opengl_GL20_glUniform1f, "glUniform1f", (void**)&glUniform1f},
{"glUniform2f", "(IFF)V", (void*)&Java_org_lwjgl_opengl_GL20_glUniform2f, "glUniform2f", (void**)&glUniform2f},
{"glUniform3f", "(IFFF)V", (void*)&Java_org_lwjgl_opengl_GL20_glUniform3f, "glUniform3f", (void**)&glUniform3f},
{"glUniform4f", "(IFFFF)V", (void*)&Java_org_lwjgl_opengl_GL20_glUniform4f, "glUniform4f", (void**)&glUniform4f},
{"glUniform1i", "(II)V", (void*)&Java_org_lwjgl_opengl_GL20_glUniform1i, "glUniform1i", (void**)&glUniform1i},
{"glUniform2i", "(III)V", (void*)&Java_org_lwjgl_opengl_GL20_glUniform2i, "glUniform2i", (void**)&glUniform2i},
{"glUniform3i", "(IIII)V", (void*)&Java_org_lwjgl_opengl_GL20_glUniform3i, "glUniform3i", (void**)&glUniform3i},
{"glUniform4i", "(IIIII)V", (void*)&Java_org_lwjgl_opengl_GL20_glUniform4i, "glUniform4i", (void**)&glUniform4i},
{"nglUniform1fv", "(IILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglUniform1fv, "glUniform1fv", (void**)&glUniform1fv},
{"nglUniform2fv", "(IILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglUniform2fv, "glUniform2fv", (void**)&glUniform2fv},
{"nglUniform3fv", "(IILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglUniform3fv, "glUniform3fv", (void**)&glUniform3fv},
{"nglUniform4fv", "(IILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglUniform4fv, "glUniform4fv", (void**)&glUniform4fv},
{"nglUniform1iv", "(IILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglUniform1iv, "glUniform1iv", (void**)&glUniform1iv},
{"nglUniform2iv", "(IILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglUniform2iv, "glUniform2iv", (void**)&glUniform2iv},
{"nglUniform3iv", "(IILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglUniform3iv, "glUniform3iv", (void**)&glUniform3iv},
{"nglUniform4iv", "(IILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglUniform4iv, "glUniform4iv", (void**)&glUniform4iv},
{"nglUniformMatrix2fv", "(IIZLjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglUniformMatrix2fv, "glUniformMatrix2fv", (void**)&glUniformMatrix2fv},
{"nglUniformMatrix3fv", "(IIZLjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglUniformMatrix3fv, "glUniformMatrix3fv", (void**)&glUniformMatrix3fv},
{"nglUniformMatrix4fv", "(IIZLjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglUniformMatrix4fv, "glUniformMatrix4fv", (void**)&glUniformMatrix4fv},
{"nglGetShaderfv", "(IILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglGetShaderfv, "glGetShaderfv", (void**)&glGetShaderfv},
{"nglGetShaderiv", "(IILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglGetShaderiv, "glGetShaderiv", (void**)&glGetShaderiv},
{"nglGetProgramfv", "(IILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglGetProgramfv, "glGetProgramfv", (void**)&glGetProgramfv},
{"nglGetProgramiv", "(IILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglGetProgramiv, "glGetProgramiv", (void**)&glGetProgramiv},
{"nglGetShaderInfoLog", "(IILjava/nio/IntBuffer;ILjava/nio/ByteBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglGetShaderInfoLog, "glGetShaderInfoLog", (void**)&glGetShaderInfoLog},
{"nglGetProgramInfoLog", "(IILjava/nio/IntBuffer;ILjava/nio/ByteBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglGetProgramInfoLog, "glGetProgramInfoLog", (void**)&glGetProgramInfoLog},
{"nglGetAttachedShaders", "(IILjava/nio/IntBuffer;ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglGetAttachedShaders, "glGetAttachedShaders", (void**)&glGetAttachedShaders},
{"nglGetUniformLocation", "(ILjava/nio/ByteBuffer;I)I", (void*)&Java_org_lwjgl_opengl_GL20_nglGetUniformLocation, "glGetUniformLocation", (void**)&glGetUniformLocation},
{"nglGetActiveUniform", "(IIILjava/nio/IntBuffer;ILjava/nio/IntBuffer;ILjava/nio/IntBuffer;ILjava/nio/ByteBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglGetActiveUniform, "glGetActiveUniform", (void**)&glGetActiveUniform},
{"nglGetUniformfv", "(IILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglGetUniformfv, "glGetUniformfv", (void**)&glGetUniformfv},
{"nglGetUniformiv", "(IILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglGetUniformiv, "glGetUniformiv", (void**)&glGetUniformiv},
{"nglGetShaderSource", "(IILjava/nio/IntBuffer;ILjava/nio/ByteBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglGetShaderSource, "glGetShaderSource", (void**)&glGetShaderSource}
// ARB_vertex_shader
{"nglBindAttribLocation", "(IILjava/nio/ByteBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglBindAttribLocation, "glBindAttribLocation", (void**)&glBindAttribLocation},
{"nglGetActiveAttrib", "(IIILjava/nio/IntBuffer;ILjava/nio/IntBuffer;ILjava/nio/IntBuffer;ILjava/nio/ByteBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglGetActiveAttrib, "glGetActiveAttrib", (void**)&glGetActiveAttrib},
{"nglGetAttribLocation", "(ILjava/nio/ByteBuffer;I)I", (void*)&Java_org_lwjgl_opengl_GL20_nglGetAttribLocation, "glGetAttribLocation", (void**)&glGetAttribLocation}
// ARB_draw_buffers
{"nglDrawBuffers", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL20_nglDrawBuffers, "glDrawBuffers", (void**)&glDrawBuffers}
// Two-Sided Stencil
{"glStencilFuncSeparate", "(IIII)V", (void*)&Java_org_lwjgl_opengl_GL20_glStencilFuncSeparate, "glStencilFuncSeparate", (void**)&glStencilFuncSeparate},
{"glStencilOpSeparate", "(IIII)V", (void*)&Java_org_lwjgl_opengl_GL20_glStencilOpSeparate, "glStencilOpSeparate", (void**)&glStencilOpSeparate}
};
int num_functions = NUMFUNCTIONS(functions);
extgl_InitializeClass(env, clazz, num_functions, functions);
}
}