From: <sp...@us...> - 2010-03-23 12:43:51
|
Revision: 3293 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3293&view=rev Author: spasi Date: 2010-03-23 12:43:44 +0000 (Tue, 23 Mar 2010) Log Message: ----------- Added alternatives for glGetActiveUniform/Attrib. Added a javadoc comment to all alternative methods. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java 2010-03-17 19:03:03 UTC (rev 3292) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java 2010-03-23 12:43:44 UTC (rev 3293) @@ -48,4 +48,7 @@ /** If true, an alternate Java->native call will be created. Useful when the alternate implementation uses different types. */ boolean nativeAlt() default false; + + /** If true, the alternate method's name will be used for the Java call. */ + boolean javaAlt() default false; } \ No newline at end of file Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-17 19:03:03 UTC (rev 3292) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-23 12:43:44 UTC (rev 3293) @@ -210,7 +210,7 @@ StripPostfix strip_annotation = method.getAnnotation(StripPostfix.class); String method_name; Alternate alt_annotation = method.getAnnotation(Alternate.class); - method_name = alt_annotation == null ? method.getSimpleName() : alt_annotation.value(); + method_name = alt_annotation == null || alt_annotation.javaAlt() ? method.getSimpleName() : alt_annotation.value(); if (strip_annotation != null && mode == Mode.NORMAL) method_name = getPostfixStrippedName(type_map, interface_decl, method); writer.print(" " + method_name + "("); @@ -324,7 +324,7 @@ } String method_name; Alternate alt_annotation = method.getAnnotation(Alternate.class); - method_name = alt_annotation == null ? method.getSimpleName() : alt_annotation.value(); + method_name = alt_annotation == null || alt_annotation.javaAlt() ? method.getSimpleName() : alt_annotation.value(); String extension_postfix = "NULL".equals(strip_annotation.extension()) ? getExtensionPostfix(interface_decl) : strip_annotation.extension(); String result; Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-03-17 19:03:03 UTC (rev 3292) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-03-23 12:43:44 UTC (rev 3293) @@ -154,7 +154,8 @@ while (doc_lines.hasMoreTokens()) writer.println("\t *" + doc_lines.nextToken()); writer.println("\t */"); - } + } else if ( (decl instanceof MethodDeclaration) && decl.getAnnotation(Alternate.class) != null ) + writer.println("\t/** Overloads " + decl.getAnnotation(Alternate.class).value() + " */"); } public static AnnotationMirror getParameterAutoAnnotation(ParameterDeclaration param) { Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java 2010-03-17 19:03:03 UTC (rev 3292) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java 2010-03-23 12:43:44 UTC (rev 3293) @@ -227,6 +227,22 @@ @OutParameter @GLenum @Check("1") IntBuffer type, @OutParameter @GLcharARB ByteBuffer name); + @Alternate(value = "glGetActiveUniformARB", javaAlt = true) + @GLreturn(value = "size") + void glGetActiveUniformSizeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength, + @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, + @OutParameter IntBuffer size, + @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore + @GLcharARB @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name); + + @Alternate(value = "glGetActiveUniformARB", javaAlt = true) + @GLreturn(value = "type") + void glGetActiveUniformTypeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength, + @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, + @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore + @OutParameter @GLenum IntBuffer type, + @GLcharARB @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name); + @StripPostfix("params") void glGetUniformfvARB(@GLhandleARB int programObj, int location, @OutParameter @Check FloatBuffer params); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java 2010-03-17 19:03:03 UTC (rev 3292) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java 2010-03-23 12:43:44 UTC (rev 3293) @@ -117,7 +117,7 @@ @GLreturn("params") @StripPostfix("params") void glGetActiveUniformsiv(@GLuint int program, @Constant("1") @GLsizei int uniformCount, - @Constant(value = "APIUtils.getBufferInt().put(1, uniformIndex), 1", keepParam = true) int uniformIndex, // index 0 used by return value + @Constant(value = "params.put(1, uniformIndex), 1", keepParam = true) int uniformIndex, // Reuse params buffer @GLenum int pname, @OutParameter @GLint IntBuffer params); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java 2010-03-17 19:03:03 UTC (rev 3292) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java 2010-03-23 12:43:44 UTC (rev 3293) @@ -63,15 +63,11 @@ int GL_VERTEX_PROGRAM_POINT_SIZE_ARB = 0x8642; int GL_VERTEX_PROGRAM_TWO_SIDE_ARB = 0x8643; - /** - * Accepted by the <pname> parameter GetObjectParameter{if}vARB: - */ + /** Accepted by the <pname> parameter GetObjectParameter{if}vARB: */ int GL_OBJECT_ACTIVE_ATTRIBUTES_ARB = 0x8B89; int GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB = 0x8B8A; - /** - * Accepted by the <pname> parameter of GetVertexAttrib{dfi}vARB: - */ + /** Accepted by the <pname> parameter of GetVertexAttrib{dfi}vARB: */ int GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB = 0x8622; int GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB = 0x8623; int GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB = 0x8624; @@ -79,14 +75,10 @@ int GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB = 0x886A; int GL_CURRENT_VERTEX_ATTRIB_ARB = 0x8626; - /** - * Accepted by the <pname> parameter of GetVertexAttribPointervARB: - */ + /** Accepted by the <pname> parameter of GetVertexAttribPointervARB: */ int GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB = 0x8645; - /** - * Returned by the <type> parameter of GetActiveAttribARB: - */ + /** Returned by the <type> parameter of GetActiveAttribARB: */ int GL_FLOAT = 0x1406; int GL_FLOAT_VEC2_ARB = 0x8B50; int GL_FLOAT_VEC3_ARB = 0x8B51; @@ -122,7 +114,7 @@ void glVertexAttrib4NubARB(@GLuint int index, @GLubyte byte x, @GLubyte byte y, @GLubyte byte z, @GLubyte byte w); void glVertexAttribPointerARB(@GLuint int index, int size, @AutoType("buffer") @GLenum int type, boolean normalized, @GLsizei int stride, - @CachedReference(index="index",name="glVertexAttribPointer_buffer") + @CachedReference(index = "index", name = "glVertexAttribPointer_buffer") @BufferObject(BufferKind.ArrayVBO) @Check @Const @@ -145,19 +137,35 @@ void glBindAttribLocationARB(@GLhandleARB int programObj, @GLuint int index, @NullTerminated CharSequence name); void glGetActiveAttribARB(@GLhandleARB int programObj, @GLuint int index, @AutoSize("name") @GLsizei int maxLength, - @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, - @OutParameter @Check("1") IntBuffer size, - @OutParameter @GLenum @Check("1") IntBuffer type, - @OutParameter @GLcharARB ByteBuffer name); + @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, + @OutParameter @Check("1") IntBuffer size, + @OutParameter @GLenum @Check("1") IntBuffer type, + @OutParameter @GLcharARB ByteBuffer name); @Alternate("glGetActiveAttribARB") @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveAttribARB2(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length, - @OutParameter @Check("1") IntBuffer size, - @OutParameter @GLenum @Check("1") IntBuffer type, - @OutParameter @GLcharARB ByteBuffer name); + @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length, + @OutParameter @Check("1") IntBuffer size, + @OutParameter @GLenum @Check("1") IntBuffer type, + @OutParameter @GLcharARB ByteBuffer name); + @Alternate(value = "glGetActiveAttribARB", javaAlt = true) + @GLreturn(value = "size") + void glGetActiveAttribSizeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength, + @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, + @OutParameter IntBuffer size, + @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore + @GLcharARB @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name); + + @Alternate(value = "glGetActiveAttribARB", javaAlt = true) + @GLreturn(value = "type") + void glGetActiveAttribTypeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength, + @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, + @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore + @OutParameter @GLenum IntBuffer type, + @GLcharARB @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name); + int glGetAttribLocationARB(@GLhandleARB int programObj, @NullTerminated @Const @GLcharARB ByteBuffer name); @Alternate("glGetAttribLocationARB") Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java 2010-03-17 19:03:03 UTC (rev 3292) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java 2010-03-23 12:43:44 UTC (rev 3293) @@ -250,6 +250,22 @@ @OutParameter @GLenum @Check("1") IntBuffer type, @OutParameter @GLchar ByteBuffer name); + @Alternate(value = "glGetActiveUniform", javaAlt = true) + @GLreturn(value = "size") + void glGetActiveUniformSize(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength, + @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, + @OutParameter IntBuffer size, + @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore + @GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name); + + @Alternate(value = "glGetActiveUniform", javaAlt = true) + @GLreturn(value = "type") + void glGetActiveUniformType(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength, + @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, + @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore + @OutParameter @GLenum IntBuffer type, + @GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name); + @StripPostfix("params") void glGetUniformfv(@GLuint int program, int location, @OutParameter @Check FloatBuffer params); @@ -386,6 +402,22 @@ @OutParameter @GLenum @Check("1") IntBuffer type, @OutParameter @GLchar ByteBuffer name); + @Alternate(value = "glGetActiveAttrib", javaAlt = true) + @GLreturn(value = "size") + void glGetActiveAttribSize(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength, + @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, + @OutParameter IntBuffer size, + @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore + @GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name); + + @Alternate(value = "glGetActiveAttrib", javaAlt = true) + @GLreturn(value = "type") + void glGetActiveAttribType(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength, + @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, + @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore + @OutParameter @GLenum IntBuffer type, + @GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name); + int glGetAttribLocation(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name); @Alternate("glGetAttribLocation") Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java 2010-03-17 19:03:03 UTC (rev 3292) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java 2010-03-23 12:43:44 UTC (rev 3293) @@ -250,7 +250,7 @@ @GLreturn("params") @StripPostfix("params") void glGetActiveUniformsiv(@GLuint int program, @Constant("1") @GLsizei int uniformCount, - @Constant(value = "APIUtils.getBufferInt().put(0, uniformIndex), 0", keepParam = true) int uniformIndex, + @Constant(value = "params.put(1, uniformIndex), 1", keepParam = true) int uniformIndex, // Reuse params buffer @GLenum int pname, @OutParameter @GLint IntBuffer params); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |