no message

This commit is contained in:
Ioannis Tsakpinis 2004-03-15 16:31:09 +00:00
parent 536bab5a52
commit 1a66a0c515
2 changed files with 78 additions and 178 deletions

View File

@ -97,8 +97,7 @@ public final class ARBShaderObjects {
// --------------------------- // ---------------------------
/** /**
* The ARB_shader_objects extension allows multiple, optionally null-terminated, source strings to * The ARB_shader_objects extension allows multiple, optionally null-terminated, source strings to define a shader program.
* define a shader program.
* <p/> * <p/>
* This method uses just a single string, that should NOT be null-terminated. * This method uses just a single string, that should NOT be null-terminated.
* *
@ -113,8 +112,7 @@ public final class ARBShaderObjects {
} }
/** /**
* The ARB_shader_objects extension allows multiple, optionally null-terminated, source strings to * The ARB_shader_objects extension allows multiple, optionally null-terminated, source strings to define a shader program.
* define a shader program.
* <p/> * <p/>
* This method uses an array of strings, that should NOT be null-terminated. * This method uses an array of strings, that should NOT be null-terminated.
* *
@ -131,10 +129,7 @@ public final class ARBShaderObjects {
private static native void initShaderSource(int count); private static native void initShaderSource(int count);
private static native void setShaderString(int index, private static native void setShaderString(int index, ByteBuffer string, int stringOffset, int stringLength);
ByteBuffer string,
int stringOffset,
int stringLength);
private static native void nglShaderSourceARB(int shaderObj); private static native void nglShaderSourceARB(int shaderObj);
// --------------------------- // ---------------------------
@ -172,10 +167,7 @@ public final class ARBShaderObjects {
nglUniform1fvARB(location, values.remaining(), values, values.position()); nglUniform1fvARB(location, values.remaining(), values, values.position());
} }
private static native void nglUniform1fvARB(int location, private static native void nglUniform1fvARB(int location, int count, FloatBuffer values, int valuesOffset);
int count,
FloatBuffer values,
int valuesOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
@ -183,10 +175,7 @@ public final class ARBShaderObjects {
nglUniform2fvARB(location, values.remaining() >> 1, values, values.position()); nglUniform2fvARB(location, values.remaining() >> 1, values, values.position());
} }
private static native void nglUniform2fvARB(int location, private static native void nglUniform2fvARB(int location, int count, FloatBuffer values, int valuesOffset);
int count,
FloatBuffer values,
int valuesOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
@ -194,10 +183,7 @@ public final class ARBShaderObjects {
nglUniform3fvARB(location, values.remaining() / 3, values, values.position()); nglUniform3fvARB(location, values.remaining() / 3, values, values.position());
} }
private static native void nglUniform3fvARB(int location, private static native void nglUniform3fvARB(int location, int count, FloatBuffer values, int valuesOffset);
int count,
FloatBuffer values,
int valuesOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
@ -205,10 +191,7 @@ public final class ARBShaderObjects {
nglUniform4fvARB(location, values.remaining() >> 2, values, values.position()); nglUniform4fvARB(location, values.remaining() >> 2, values, values.position());
} }
private static native void nglUniform4fvARB(int location, private static native void nglUniform4fvARB(int location, int count, FloatBuffer values, int valuesOffset);
int count,
FloatBuffer values,
int valuesOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
@ -216,20 +199,15 @@ public final class ARBShaderObjects {
nglUniform1ivARB(location, values.remaining(), values, values.position()); nglUniform1ivARB(location, values.remaining(), values, values.position());
} }
private static native void nglUniform1ivARB(int location, private static native void nglUniform1ivARB(int location, int count, IntBuffer values, int valuesOffset);
int count, // ---------------------------
IntBuffer values,
int valuesOffset);// ---------------------------
// --------------------------- // ---------------------------
public static void glUniform2ARB(int location, IntBuffer values) { public static void glUniform2ARB(int location, IntBuffer values) {
nglUniform2ivARB(location, values.remaining() >> 1, values, values.position()); nglUniform2ivARB(location, values.remaining() >> 1, values, values.position());
} }
private static native void nglUniform2ivARB(int location, private static native void nglUniform2ivARB(int location, int count, IntBuffer values, int valuesOffset);
int count,
IntBuffer values,
int valuesOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
@ -237,10 +215,7 @@ public final class ARBShaderObjects {
nglUniform3ivARB(location, values.remaining() / 3, values, values.position()); nglUniform3ivARB(location, values.remaining() / 3, values, values.position());
} }
private static native void nglUniform3ivARB(int location, private static native void nglUniform3ivARB(int location, int count, IntBuffer values, int valuesOffset);
int count,
IntBuffer values,
int valuesOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
@ -248,58 +223,34 @@ public final class ARBShaderObjects {
nglUniform4ivARB(location, values.remaining() >> 2, values, values.position()); nglUniform4ivARB(location, values.remaining() >> 2, values, values.position());
} }
private static native void nglUniform4ivARB(int location, private static native void nglUniform4ivARB(int location, int count, IntBuffer values, int valuesOffset);
int count,
IntBuffer values,
int valuesOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
public static void glUniformMatrix2ARB(int location, boolean transpose, FloatBuffer matrices) { public static void glUniformMatrix2ARB(int location, boolean transpose, FloatBuffer matrices) {
nglUniformMatrix2fvARB(location, nglUniformMatrix2fvARB(location, matrices.remaining() >> 2, transpose, matrices, matrices.position());
matrices.remaining() >> 2,
transpose,
matrices,
matrices.position());
} }
private static native void nglUniformMatrix2fvARB(int location, private static native void nglUniformMatrix2fvARB(int location, int count, boolean transpose,
int count, FloatBuffer matrices, int matricesOffset);
boolean transpose,
FloatBuffer matrices,
int matricesOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
public static void glUniformMatrix3ARB(int location, boolean transpose, FloatBuffer matrices) { public static void glUniformMatrix3ARB(int location, boolean transpose, FloatBuffer matrices) {
nglUniformMatrix3fvARB(location, nglUniformMatrix3fvARB(location, matrices.remaining() / (3 * 3), transpose, matrices, matrices.position());
matrices.remaining() / ( 3 * 3 ),
transpose,
matrices,
matrices.position());
} }
private static native void nglUniformMatrix3fvARB(int location, private static native void nglUniformMatrix3fvARB(int location, int count, boolean transpose,
int count, FloatBuffer matrices, int matricesOffset);
boolean transpose,
FloatBuffer matrices,
int matricesOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
public static void glUniformMatrix4ARB(int location, boolean transpose, FloatBuffer matrices) { public static void glUniformMatrix4ARB(int location, boolean transpose, FloatBuffer matrices) {
nglUniformMatrix4fvARB(location, nglUniformMatrix4fvARB(location, matrices.remaining() >> 4, transpose, matrices, matrices.position());
matrices.remaining() >> 4,
transpose,
matrices,
matrices.position());
} }
private static native void nglUniformMatrix4fvARB(int location, private static native void nglUniformMatrix4fvARB(int location, int count, boolean transpose,
int count, FloatBuffer matrices, int matricesOffset);
boolean transpose,
FloatBuffer matrices,
int matricesOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
@ -307,10 +258,7 @@ public final class ARBShaderObjects {
nglGetObjectParameterfvARB(obj, pname, params, params.position()); nglGetObjectParameterfvARB(obj, pname, params, params.position());
} }
private static native void nglGetObjectParameterfvARB(int obj, private static native void nglGetObjectParameterfvARB(int obj, int pname, FloatBuffer params, int paramsOffset);
int pname,
FloatBuffer params,
int paramsOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
@ -318,10 +266,7 @@ public final class ARBShaderObjects {
nglGetObjectParameterivARB(obj, pname, params, params.position()); nglGetObjectParameterivARB(obj, pname, params, params.position());
} }
private static native void nglGetObjectParameterivARB(int obj, private static native void nglGetObjectParameterivARB(int obj, int pname, IntBuffer params, int paramsOffset);
int pname,
IntBuffer params,
int paramsOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
@ -329,111 +274,78 @@ public final class ARBShaderObjects {
if ( length == null ) if ( length == null )
nglGetInfoLogARB(obj, infoLog.remaining(), null, -1, infoLog, infoLog.position()); nglGetInfoLogARB(obj, infoLog.remaining(), null, -1, infoLog, infoLog.position());
else { else {
if (length.remaining() == 0) { if ( length.remaining() == 0 )
throw new BufferOverflowException(); throw new BufferOverflowException();
}
nglGetInfoLogARB(obj, infoLog.remaining(), length, length.position(), infoLog, infoLog.position()); nglGetInfoLogARB(obj, infoLog.remaining(), length, length.position(), infoLog, infoLog.position());
} }
} }
private static native void nglGetInfoLogARB(int obj, private static native void nglGetInfoLogARB(int obj, int maxLength,
int maxLength, IntBuffer length, int lengthOffset,
IntBuffer length, ByteBuffer infoLog, int infoLogOffset);
int lengthOffset,
ByteBuffer infoLog,
int infoLogOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
public static void glGetAttachedObjectsARB(int containerObj, public static void glGetAttachedObjectsARB(int containerObj, IntBuffer count, IntBuffer obj) {
IntBuffer count,
IntBuffer obj) {
if ( count == null ) if ( count == null )
nglGetAttachedObjectsARB(containerObj, obj.remaining(), null, -1, obj, obj.position()); nglGetAttachedObjectsARB(containerObj, obj.remaining(), null, -1, obj, obj.position());
else { else {
if (count.remaining() == 0) { if ( count.remaining() == 0 )
throw new BufferOverflowException(); throw new BufferOverflowException();
}
nglGetAttachedObjectsARB(containerObj, obj.remaining(), count, count.position(), obj, obj.position()); nglGetAttachedObjectsARB(containerObj, obj.remaining(), count, count.position(), obj, obj.position());
} }
} }
private static native void nglGetAttachedObjectsARB(int containerObj, private static native void nglGetAttachedObjectsARB(int containerObj, int maxCount,
int maxCount, IntBuffer count, int countOffset, IntBuffer obj, int objOffset);
IntBuffer count,
int countOffset,
IntBuffer obj,
int objOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
/**
* 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 programObj
* @param name
*
* @return
*/
public static int glGetUniformLocationARB(int programObj, ByteBuffer name) { public static int glGetUniformLocationARB(int programObj, ByteBuffer name) {
if (name.get(name.limit() - 1) != 0) { // TODO: How do we check that the string is null-terminated?
throw new RuntimeException("<name> must be null-terminated.");
}
return nglGetUniformLocationARB(programObj, name, name.position()); return nglGetUniformLocationARB(programObj, name, name.position());
} }
private static native int nglGetUniformLocationARB(int programObj, private static native int nglGetUniformLocationARB(int programObj, ByteBuffer name, int nameOffset);
ByteBuffer name,
int nameOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
public static void glGetActiveUniformARB(int programObj, public static void glGetActiveUniformARB(int programObj, int index,
int index, IntBuffer length, IntBuffer size, IntBuffer type, ByteBuffer name) {
IntBuffer length, if ( size.remaining() == 0 )
IntBuffer size,
IntBuffer type,
ByteBuffer name) {
if (size.remaining() == 0) {
throw new BufferOverflowException(); throw new BufferOverflowException();
}
if (type.remaining() == 0) { if ( type.remaining() == 0 )
throw new BufferOverflowException(); throw new BufferOverflowException();
}
if ( length == null ) if ( length == null )
nglGetActiveUniformARB(programObj, nglGetActiveUniformARB(programObj, index, name.remaining(), null, -1,
index, size, size.position(), type, type.position(), name, name.position());
name.remaining(),
null,
-1,
size,
size.position(),
type,
type.position(),
name,
name.position());
else { else {
if (length.remaining() == 0) { if ( length.remaining() == 0 )
throw new BufferOverflowException(); throw new BufferOverflowException();
}
nglGetActiveUniformARB(programObj, nglGetActiveUniformARB(programObj, index, name.remaining(), length, length.position(),
index, size, size.position(), type, type.position(), name, name.position());
name.remaining(),
length,
length.position(),
size,
size.position(),
type,
type.position(),
name,
name.position());
} }
} }
private static native void nglGetActiveUniformARB(int programObj, private static native void nglGetActiveUniformARB(int programObj, int index, int maxLength,
int index, IntBuffer length, int lengthOffset,
int maxLength, IntBuffer size, int sizeOffset,
IntBuffer length, IntBuffer type, int typeOffset,
int lengthOffset, ByteBuffer name, int nameOffset);
IntBuffer size,
int sizeOffset,
IntBuffer type,
int typeOffset,
ByteBuffer name,
int nameOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
@ -441,10 +353,7 @@ public final class ARBShaderObjects {
nglGetUniformfvARB(programObj, location, params, params.position()); nglGetUniformfvARB(programObj, location, params, params.position());
} }
private static native void nglGetUniformfvARB(int programObj, private static native void nglGetUniformfvARB(int programObj, int location, FloatBuffer params, int paramsOffset);
int location,
FloatBuffer params,
int paramsOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
@ -452,16 +361,11 @@ public final class ARBShaderObjects {
nglGetUniformivARB(programObj, location, params, params.position()); nglGetUniformivARB(programObj, location, params, params.position());
} }
private static native void nglGetUniformivARB(int programObj, private static native void nglGetUniformivARB(int programObj, int location, IntBuffer params, int paramsOffset);
int location,
IntBuffer params,
int paramsOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
public static void glGetShaderSourceARB(int obj, public static void glGetShaderSourceARB(int obj, IntBuffer length, ByteBuffer source) {
IntBuffer length,
ByteBuffer source) {
if ( length == null ) if ( length == null )
nglGetShaderSourceARB(obj, source.remaining(), null, -1, source, source.position()); nglGetShaderSourceARB(obj, source.remaining(), null, -1, source, source.position());
else { else {
@ -469,12 +373,8 @@ public final class ARBShaderObjects {
} }
} }
private static native void nglGetShaderSourceARB(int obj, private static native void nglGetShaderSourceARB(int obj, int maxLength,
int maxLength, IntBuffer length, int lengthOffset, ByteBuffer source, int sourceOffset);
IntBuffer length,
int lengthOffset,
ByteBuffer source,
int sourceOffset);
// --------------------------- // ---------------------------
} }

View File

@ -66,39 +66,39 @@ public final class ARBVertexShader {
// --------------------------- // ---------------------------
public static void glBindAttribLocationARB(int programObj, int index, ByteBuffer name) { public static void glBindAttribLocationARB(int programObj, int index, ByteBuffer name) {
if (name.get(name.limit() - 1) != 0) { if ( name.get(name.limit() - 1) != 0 ) {
throw new RuntimeException("<name> must be a null-terminated string."); throw new RuntimeException("<name> must be a null-terminated string.");
} }
nglBindAttribLocationARB(programObj, index, name, name.position()); nglBindAttribLocationARB(programObj, index, name, name.position());
} }
private static native void nglBindAttribLocationARB(int programObj, int index, ByteBuffer name, private static native void nglBindAttribLocationARB(int programObj, int index, ByteBuffer name, int nameOffset);
int nameOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
public static void glGetActiveAttribARB(int programObj, int index, IntBuffer length, public static void glGetActiveAttribARB(int programObj, int index,
IntBuffer size, IntBuffer type, ByteBuffer name) { IntBuffer length, IntBuffer size, IntBuffer type, ByteBuffer name) {
BufferChecks.checkBuffer(name); BufferChecks.checkBuffer(name);
if ( length == null ) if ( length == null )
nglGetActiveAttribARB(programObj, index, name.remaining(), null, -1, size, size.position(), nglGetActiveAttribARB(programObj, index, name.remaining(), null, -1,
type, type.position(), name, name.position()); size, size.position(), type, type.position(), name, name.position());
else { else {
nglGetActiveAttribARB(programObj, index, name.remaining(), length, length.position(), size, nglGetActiveAttribARB(programObj, index, name.remaining(), length, length.position(),
size.position(), type, type.position(), name, name.position()); size, size.position(), type, type.position(), name, name.position());
} }
} }
private static native void nglGetActiveAttribARB(int programObj, int index, int maxLength, private static native void nglGetActiveAttribARB(int programObj, int index, int maxLength,
IntBuffer length, int lengthOffset, IntBuffer length, int lengthOffset,
IntBuffer size, int sizeOffset, IntBuffer type, IntBuffer size, int sizeOffset,
int typeOffset, ByteBuffer name, int nameOffset); IntBuffer type, int typeOffset,
ByteBuffer name, int nameOffset);
// --------------------------- // ---------------------------
// --------------------------- // ---------------------------
public static int glGetAttribLocationARB(int programObj, ByteBuffer name) { public static int glGetAttribLocationARB(int programObj, ByteBuffer name) {
if (name.get(name.limit() - 1) != 0) { if ( name.get(name.limit() - 1) != 0 ) {
throw new RuntimeException("<name> must be a null-terminated string."); throw new RuntimeException("<name> must be a null-terminated string.");
} }
return nglGetAttribLocationARB(programObj, name, name.position()); return nglGetAttribLocationARB(programObj, name, name.position());