You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sp...@us...> - 2010-03-31 15:46:30
|
Revision: 3299 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3299&view=rev Author: spasi Date: 2010-03-31 15:46:16 +0000 (Wed, 31 Mar 2010) Log Message: ----------- Added support for NVX_gpu_memory_info (experimental extension). Added support for initializing extensions that are not exposed in GL_EXTENSIONS (enables EXT_direct_state_access and NV_primitive_restart on AMD GPUs, use at your own risk). Updated @Optional functions for AMD GPUs (driver version: 10.3) Modified Paths: -------------- trunk/LWJGL/platform_build/build-definitions.xml trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_half_float.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_primitive_restart.java Added Paths: ----------- trunk/LWJGL/src/java/org/lwjgl/util/generator/ForceInit.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_texture_env_combine3.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NVX_gpu_memory_info.java Modified: trunk/LWJGL/platform_build/build-definitions.xml =================================================================== --- trunk/LWJGL/platform_build/build-definitions.xml 2010-03-28 23:11:17 UTC (rev 3298) +++ trunk/LWJGL/platform_build/build-definitions.xml 2010-03-31 15:46:16 UTC (rev 3299) @@ -14,7 +14,7 @@ <property name="lwjgl.res" location="res" /> <property name="lwjgl.version" value="2.4" /> - <property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/AMD*.java,org/lwjgl/opengl/APPLE*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java,org/lwjgl/opengl/GREMEDY*.java"/> + <property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/AMD*.java,org/lwjgl/opengl/APPLE*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/NVX*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java,org/lwjgl/opengl/GREMEDY*.java"/> <!-- ================================================================== --> <!-- Filesets used for targets --> <!-- ================================================================== --> Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2010-03-28 23:11:17 UTC (rev 3298) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2010-03-31 15:46:16 UTC (rev 3299) @@ -164,6 +164,8 @@ public static void generateInitStubs(PrintWriter writer, InterfaceDeclaration d, boolean context_specific) { if ( d.getMethods().size() > 0 ) { if ( context_specific ) { + if ( d.getAnnotation(ForceInit.class) != null ) + writer.println("\t\t" + CACHED_EXTS_VAR_NAME + ".add(\"" + translateFieldName(d.getSimpleName()) + "\");"); writer.print("\t\tif (" + CACHED_EXTS_VAR_NAME + ".contains(\""); writer.print(translateFieldName(d.getSimpleName()) + "\")"); writer.print(" && !" + getAddressesInitializerName(d.getSimpleName()) + "("); @@ -218,7 +220,7 @@ continue; if ( !first ) - writer.println(" &&"); + writer.println(" &"); else first = false; Added: trunk/LWJGL/src/java/org/lwjgl/util/generator/ForceInit.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/ForceInit.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/ForceInit.java 2010-03-31 15:46:16 UTC (rev 3299) @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator; + +/** + * Extensions marked with ForceInit will be initialized by LWJGL even if not exposed in the GL_EXTENSIONS string. + * + * @author spasi + */ + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@Target({ ElementType.TYPE }) +public @interface ForceInit { +} \ No newline at end of file Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-28 23:11:17 UTC (rev 3298) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-31 15:46:16 UTC (rev 3299) @@ -186,6 +186,7 @@ //java_writer.println("import org.lwjgl.NondirectBufferWrapper;"); java_writer.println("import java.nio.*;"); java_writer.println(); + Utils.printDocComment(java_writer, d); java_writer.print("public "); boolean is_final = Utils.isFinal(d); if (is_final) Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-03-28 23:11:17 UTC (rev 3298) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-03-31 15:46:16 UTC (rev 3299) @@ -149,11 +149,12 @@ public static void printDocComment(PrintWriter writer, Declaration decl) { String doc_comment = decl.getDocComment(); if (doc_comment != null) { - writer.println("\t/**"); + String tab = decl instanceof InterfaceDeclaration ? "" : "\t"; + writer.println(tab + "/**"); StringTokenizer doc_lines = new StringTokenizer(doc_comment, "\n"); while (doc_lines.hasMoreTokens()) - writer.println("\t *" + doc_lines.nextToken()); - writer.println("\t */"); + writer.println(tab + " * " + doc_lines.nextToken()); + writer.println(tab + " */"); } else if ( (decl instanceof MethodDeclaration) && decl.getAnnotation(Alternate.class) != null ) writer.println("\t/** Overloads " + decl.getAnnotation(Alternate.class).value() + " */"); } Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_texture_env_combine3.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_texture_env_combine3.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_texture_env_combine3.java 2010-03-31 15:46:16 UTC (rev 3299) @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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; + +public interface ATI_texture_env_combine3 { + + /** + * Accepted by the <params> parameter of TexEnvf, TexEnvi, TexEnvfv, + * and TexEnviv when the <pname> parameter value is COMBINE_RGB_ARB + * or COMBINE_ALPHA_ARB + */ + int GL_MODULATE_ADD_ATI = 0x8744; + int GL_MODULATE_SIGNED_ADD_ATI = 0x8745; + int GL_MODULATE_SUBTRACT_ATI = 0x8746; + +} \ No newline at end of file Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java 2010-03-28 23:11:17 UTC (rev 3298) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java 2010-03-31 15:46:16 UTC (rev 3299) @@ -35,6 +35,7 @@ import java.nio.*; +@ForceInit @Dependent @DeprecatedGL public interface EXT_direct_state_access { @@ -518,9 +519,11 @@ value parameters */ + @Optional(reason = "AMD does not expose this (last driver checked: 10.3)") @Dependent("OpenGL30") void glEnableClientStateiEXT(@GLenum int array, @GLuint int index); + @Optional(reason = "AMD does not expose this (last driver checked: 10.3)") @Dependent("OpenGL30") void glDisableClientStateiEXT(@GLenum int array, @GLuint int index); @@ -562,6 +565,7 @@ and before state value parameters */ + @Optional(reason = "AMD does not expose this (last driver checked: 10.3)") @Dependent("OpenGL30") @StripPostfix("params") void glGetFloati_vEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") FloatBuffer params); @@ -572,6 +576,7 @@ @StripPostfix("params") void glGetFloati_vEXT2(@GLenum int pname, @GLuint int index, @OutParameter FloatBuffer params); + @Optional(reason = "AMD does not expose this (last driver checked: 10.3)") @Dependent("OpenGL30") @StripPostfix("params") void glGetDoublei_vEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") DoubleBuffer params); @@ -582,6 +587,7 @@ @StripPostfix("params") void glGetDoublei_vEXT2(@GLenum int pname, @GLuint int index, @OutParameter DoubleBuffer params); + @Optional(reason = "AMD does not expose this (last driver checked: 10.3)") @Dependent("OpenGL30") @StripPostfix(value = "params", hasPostfix = false) void glGetPointeri_vEXT(@GLenum int pname, @GLuint int index, @Result @GLvoid ByteBuffer params); @@ -812,6 +818,7 @@ @GLshort @GLint Buffer img); + @Dependent("OpenGL13") void glGetCompressedTexImage(@GLenum int target, int lod, @OutParameter @BufferObject(BufferKind.PackPBO) @@ -946,6 +953,7 @@ @Dependent("OpenGL20") void glProgramUniform4fEXT(@GLuint int program, int location, float v0, float v1, float v2, float v3); + @Dependent("OpenGL20") void glProgramUniform1iEXT(@GLuint int program, int location, int v0); @Dependent("OpenGL20") Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java 2010-03-28 23:11:17 UTC (rev 3298) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java 2010-03-31 15:46:16 UTC (rev 3299) @@ -63,7 +63,6 @@ // ----------------------[ ARB_draw_elements_base_vertex ]---------------------- // ----------------------------------------------------------------------------- - @Optional(reason = "AMD's 3.2 implementation does not expose this (last driver checked: 10.1)") void glDrawElementsBaseVertex(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type, @BufferObject(BufferKind.ElementVBO) @Const @@ -71,7 +70,6 @@ @GLushort @GLuint Buffer indices, int basevertex); - @Optional(reason = "AMD's 3.2 implementation does not expose this (last driver checked: 10.1)") void glDrawRangeElementsBaseVertex(@GLenum int mode, @GLuint int start, @GLuint int end, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type, @BufferObject(BufferKind.ElementVBO) @Const @@ -79,7 +77,6 @@ @GLushort @GLuint Buffer indices, int basevertex); - @Optional(reason = "AMD's 3.2 implementation does not expose this (last driver checked: 10.1)") void glDrawElementsInstancedBaseVertex(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type, @BufferObject(BufferKind.ElementVBO) @Const @@ -326,7 +323,6 @@ @Alternate("glGetInteger64i_v") @GLreturn("data") @StripPostfix(value = "data", postfix = "64") - @Optional(reason = "NV's 3.2 implementation does not expose this (last driver checked: 19?.??)") void glGetInteger64i_v2(@GLenum int value, @GLuint int index, @OutParameter @GLint64 LongBuffer data); @StripPostfix("values") Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java 2010-03-28 23:11:17 UTC (rev 3298) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java 2010-03-31 15:46:16 UTC (rev 3299) @@ -46,12 +46,16 @@ // ----------------------[ ARB_draw_buffers_blend ]---------------------- // ---------------------------------------------------------------------- + @Optional(reason = "AMD's 4.0 implementation does not expose this (last driver checked: 10.3)") void glBlendEquationi(@GLuint int buf, @GLenum int mode); + @Optional(reason = "AMD's 4.0 implementation does not expose this (last driver checked: 10.3)") void glBlendEquationSeparatei(@GLuint int buf, @GLenum int modeRGB, @GLenum int modeAlpha); + @Optional(reason = "AMD's 4.0 implementation does not expose this (last driver checked: 10.3)") void glBlendFunci(@GLuint int buf, @GLenum int src, @GLenum int dst); + @Optional(reason = "AMD's 4.0 implementation does not expose this (last driver checked: 10.3)") void glBlendFuncSeparatei(@GLuint int buf, @GLenum int srcRGB, @GLenum int dstRGB, @GLenum int srcAlpha, @GLenum int dstAlpha); // ----------------------------------------------------------------- @@ -182,6 +186,7 @@ */ int GL_MIN_SAMPLE_SHADING_VALUE = 0x8C37; + @Optional(reason = "AMD's 4.0 implementation does not expose this (last driver checked: 10.3)") void glMinSampleShading(@GLclampf float value); // --------------------------------------------------------------------- Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/NVX_gpu_memory_info.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/NVX_gpu_memory_info.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/NVX_gpu_memory_info.java 2010-03-31 15:46:16 UTC (rev 3299) @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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; + +/** Experimental extension, may be removed/changed in the future. */ +public interface NVX_gpu_memory_info { + + /** Accepted by the <pname> parameter of GetIntegerv: */ + int GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX = 0x9047; + int GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX = 0x9048; + int GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX = 0x9049; + int GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX = 0x904A; + int GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX = 0x904B; + +} \ No newline at end of file Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_half_float.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_half_float.java 2010-03-28 23:11:17 UTC (rev 3298) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_half_float.java 2010-03-31 15:46:16 UTC (rev 3299) @@ -78,23 +78,34 @@ void glSecondaryColor3hNV(@GLhalf short red, @GLhalf short green, @GLhalf short blue); + @Optional(reason = "AMD does not expose this (last driver checked: 10.3)") + void glVertexWeighthNV(@GLhalf short weight); + + @Optional(reason = "AMD does not expose this (last driver checked: 10.3)") void glVertexAttrib1hNV(@GLuint int index, @GLhalf short x); + @Optional(reason = "AMD does not expose this (last driver checked: 10.3)") void glVertexAttrib2hNV(@GLuint int index, @GLhalf short x, @GLhalf short y); + @Optional(reason = "AMD does not expose this (last driver checked: 10.3)") void glVertexAttrib3hNV(@GLuint int index, @GLhalf short x, @GLhalf short y, @GLhalf short z); + @Optional(reason = "AMD does not expose this (last driver checked: 10.3)") void glVertexAttrib4hNV(@GLuint int index, @GLhalf short x, @GLhalf short y, @GLhalf short z, @GLhalf short w); + @Optional(reason = "AMD does not expose this (last driver checked: 10.3)") @StripPostfix("attribs") void glVertexAttribs1hvNV(@GLuint int index, @AutoSize("attribs") @GLsizei int n, @Const @GLhalf ShortBuffer attribs); + @Optional(reason = "AMD does not expose this (last driver checked: 10.3)") @StripPostfix("attribs") void glVertexAttribs2hvNV(@GLuint int index, @AutoSize(value = "attribs", expression = " >> 1") @GLsizei int n, @Const @GLhalf ShortBuffer attribs); + @Optional(reason = "AMD does not expose this (last driver checked: 10.3)") @StripPostfix("attribs") void glVertexAttribs3hvNV(@GLuint int index, @AutoSize(value = "attribs", expression = " / 3") @GLsizei int n, @Const @GLhalf ShortBuffer attribs); + @Optional(reason = "AMD does not expose this (last driver checked: 10.3)") @StripPostfix("attribs") void glVertexAttribs4hvNV(@GLuint int index, @AutoSize(value = "attribs", expression = " >> 2") @GLsizei int n, @Const @GLhalf ShortBuffer attribs); } Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_primitive_restart.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_primitive_restart.java 2010-03-28 23:11:17 UTC (rev 3298) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_primitive_restart.java 2010-03-31 15:46:16 UTC (rev 3299) @@ -33,6 +33,7 @@ import org.lwjgl.util.generator.*; +@ForceInit public interface NV_primitive_restart { /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-03-28 23:11:24
|
Revision: 3298 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3298&view=rev Author: matzon Date: 2010-03-28 23:11:17 +0000 (Sun, 28 Mar 2010) Log Message: ----------- bumping native version Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java Modified: trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2010-03-27 16:04:30 UTC (rev 3297) +++ trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2010-03-28 23:11:17 UTC (rev 3298) @@ -39,7 +39,7 @@ * $Id$ */ final class LinuxSysImplementation extends J2SESysImplementation { - private final static int JNI_VERSION = 17; + private final static int JNI_VERSION = 18; static { java.awt.Toolkit.getDefaultToolkit(); // This will make sure libjawt.so is loaded Modified: trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java 2010-03-27 16:04:30 UTC (rev 3297) +++ trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java 2010-03-28 23:11:17 UTC (rev 3298) @@ -42,7 +42,7 @@ * $Id$ */ final class MacOSXSysImplementation extends J2SESysImplementation { - private final static int JNI_VERSION = 17; + private final static int JNI_VERSION = 18; static { // Make sure AWT is properly initialized. This avoids hangs on Mac OS X 10.3 Modified: trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2010-03-27 16:04:30 UTC (rev 3297) +++ trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2010-03-28 23:11:17 UTC (rev 3298) @@ -45,7 +45,7 @@ * $Id$ */ final class WindowsSysImplementation extends DefaultSysImplementation { - private final static int JNI_VERSION = 21; + private final static int JNI_VERSION = 22; static { Sys.initialize(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-03-27 16:04:36
|
Revision: 3297 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3297&view=rev Author: kappa1 Date: 2010-03-27 16:04:30 +0000 (Sat, 27 Mar 2010) Log Message: ----------- Further improvement to mouse ungrab position behaviour. Mouse no longer limited to just ungrabbing at the position it was grabbed, now you can can call setCursorPosition(x,y) while mouse is grabbed and ungrab the mouse at any position you like. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java Modified: trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2010-03-27 01:12:05 UTC (rev 3296) +++ trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2010-03-27 16:04:30 UTC (rev 3297) @@ -204,8 +204,13 @@ throw new IllegalStateException("Mouse is not created"); x = event_x = new_x; y = event_y = new_y; - if (!isGrabbed() && (Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0) + if (!isGrabbed() && (Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0) { implementation.setCursorPosition(x, y); + } + else { + grab_x = new_x; + grab_y = new_y; + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sp...@us...> - 2010-03-27 01:12:12
|
Revision: 3296 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3296&view=rev Author: spasi Date: 2010-03-27 01:12:05 +0000 (Sat, 27 Mar 2010) Log Message: ----------- Added support for APPLE extensions. Modified Paths: -------------- trunk/LWJGL/platform_build/build-definitions.xml trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_element_array.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java Added Paths: ----------- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_aux_depth_stencil.java trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_client_storage.java trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_element_array.java trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_fence.java trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_float_pixels.java trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_flush_buffer_range.java trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_object_purgeable.java trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_packed_pixels.java trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_rgb_422.java trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_row_bytes.java trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_texture_range.java trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_range.java trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_program_evaluators.java trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_ycbcr_422.java Modified: trunk/LWJGL/platform_build/build-definitions.xml =================================================================== --- trunk/LWJGL/platform_build/build-definitions.xml 2010-03-26 19:52:40 UTC (rev 3295) +++ trunk/LWJGL/platform_build/build-definitions.xml 2010-03-27 01:12:05 UTC (rev 3296) @@ -14,7 +14,7 @@ <property name="lwjgl.res" location="res" /> <property name="lwjgl.version" value="2.4" /> - <property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/AMD*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java,org/lwjgl/opengl/GREMEDY*.java"/> + <property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/AMD*.java,org/lwjgl/opengl/APPLE*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java,org/lwjgl/opengl/GREMEDY*.java"/> <!-- ================================================================== --> <!-- Filesets used for targets --> <!-- ================================================================== --> Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_aux_depth_stencil.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_aux_depth_stencil.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_aux_depth_stencil.java 2010-03-27 01:12:05 UTC (rev 3296) @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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; + +public interface APPLE_aux_depth_stencil { + + /** Accepted by the <pname> parameter of GetIntegerv. */ + int GL_AUX_DEPTH_STENCIL_APPLE = 0x8A14; + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_client_storage.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_client_storage.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_client_storage.java 2010-03-27 01:12:05 UTC (rev 3296) @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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; + +public interface APPLE_client_storage { + + /** Accepted by the <pname> parameters of PixelStore: */ + int GL_UNPACK_CLIENT_STORAGE_APPLE = 0x85B2; + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_element_array.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_element_array.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_element_array.java 2010-03-27 01:12:05 UTC (rev 3296) @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator.*; + +import java.nio.Buffer; +import java.nio.IntBuffer; + +public interface APPLE_element_array { + + /** + * Accepted by the <array> parameter of EnableClientState and + * DisableClientState and the <value> parameter of IsEnabled: + */ + int GL_ELEMENT_ARRAY_APPLE = 0x8768; + + /** + * Accepted by the <value> parameter of GetBooleanv, GetIntegerv, + * GetFloatv, and GetDoublev: + */ + int GL_ELEMENT_ARRAY_TYPE_APPLE = 0x8769; + + /** Accepted by the <pname> parameter of GetPointerv: */ + int GL_ELEMENT_ARRAY_POINTER_APPLE = 0x876A; + + void glElementPointerAPPLE(@AutoType("pointer") @GLenum int type, + @Check + @Const + @GLubyte + @GLushort + @GLuint Buffer pointer); + + void glDrawElementArrayAPPLE(@GLenum int mode, int first, @GLsizei int count); + + void glDrawRangeElementArrayAPPLE(@GLenum int mode, @GLuint int start, @GLuint int end, int first, @GLsizei int count); + + void glMultiDrawElementArrayAPPLE(@GLenum int mode, + @Const IntBuffer first, + @Const @Check("first.remaining()") @GLsizei IntBuffer count, + @AutoSize("first") @GLsizei int primcount); + + void glMultiDrawRangeElementArrayAPPLE(@GLenum int mode, @GLuint int start, @GLuint int end, + @Const IntBuffer first, + @Const @Check("first.remaining()") @GLsizei IntBuffer count, + @AutoSize("first") @GLsizei int primcount); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_fence.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_fence.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_fence.java 2010-03-27 01:12:05 UTC (rev 3296) @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator.*; + +import java.nio.IntBuffer; + +public interface APPLE_fence { + + /** Accepted by the <object> parameter of TestObjectAPPLE and FinishObjectAPPLE: */ + int GL_DRAW_PIXELS_APPLE = 0x8A0A; + int GL_FENCE_APPLE = 0x8A0B; + + void glGenFencesAPPLE(@AutoSize("fences") @GLsizei int n, @OutParameter @GLuint IntBuffer fences); + + @Alternate("glGenFencesAPPLE") + @GLreturn("fences") + void glGenFencesAPPLE2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer fences); + + void glDeleteFencesAPPLE(@AutoSize("fences") @GLsizei int n, @Const @GLuint IntBuffer fences); + + @Alternate("glDeleteFencesAPPLE") + void glDeleteFencesAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtils.getBufferInt().put(0, fence), 0", keepParam = true) int fence); + + void glSetFenceAPPLE(@GLuint int fence); + + boolean glIsFenceAPPLE(@GLuint int fence); + + boolean glTestFenceAPPLE(@GLuint int fence); + + void glFinishFenceAPPLE(@GLuint int fence); + + boolean glTestObjectAPPLE(@GLenum int object, @GLuint int name); + + void glFinishObjectAPPLE(@GLenum int object, int name); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_float_pixels.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_float_pixels.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_float_pixels.java 2010-03-27 01:12:05 UTC (rev 3296) @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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; + +public interface APPLE_float_pixels { + + /** + * Accepted by the parameters of DrawPixels, ReadPixels, TexImage1D, + * TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D, TexSubImage3D, and + * GetTexImage: + */ + int GL_HALF_APPLE = 0x140B; + + /** Accepted by the GetBooleanv: */ + int GL_COLOR_FLOAT_APPLE = 0x8A0F; + + /** + * Accepted by the parameter of TexImage1D, + * TexImage2D, and TexImage3D: + */ + int GL_RGBA_FLOAT32_APPLE = 0x8814; + int GL_RGB_FLOAT32_APPLE = 0x8815; + int GL_ALPHA_FLOAT32_APPLE = 0x8816; + int GL_INTENSITY_FLOAT32_APPLE = 0x8817; + int GL_LUMINANCE_FLOAT32_APPLE = 0x8818; + int GL_LUMINANCE_ALPHA_FLOAT32_APPLE = 0x8819; + int GL_RGBA_FLOAT16_APPLE = 0x881A; + int GL_RGB_FLOAT16_APPLE = 0x881B; + int GL_ALPHA_FLOAT16_APPLE = 0x881C; + int GL_INTENSITY_FLOAT16_APPLE = 0x881D; + int GL_LUMINANCE_FLOAT16_APPLE = 0x881E; + int GL_LUMINANCE_ALPHA_FLOAT16_APPLE = 0x881F; + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_flush_buffer_range.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_flush_buffer_range.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_flush_buffer_range.java 2010-03-27 01:12:05 UTC (rev 3296) @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator.GLenum; +import org.lwjgl.util.generator.GLintptr; +import org.lwjgl.util.generator.GLsizeiptr; + +public interface APPLE_flush_buffer_range { + + /** + * Accepted by the <pname> parameter of BufferParameteriAPPLE and + * GetBufferParameteriv: + */ + int GL_BUFFER_SERIALIZED_MODIFY_APPLE = 0x8A12; + int GL_BUFFER_FLUSHING_UNMAP_APPLE = 0x8A13; + + void glBufferParameteriAPPLE(@GLenum int target, @GLenum int pname, int param); + + void glFlushMappedBufferRangeAPPLE(@GLenum int target, @GLintptr long offset, @GLsizeiptr long size); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_object_purgeable.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_object_purgeable.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_object_purgeable.java 2010-03-27 01:12:05 UTC (rev 3296) @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator.*; + +import java.nio.IntBuffer; + +public interface APPLE_object_purgeable { + + /** + * Accepted by the <option> parameter of ObjectPurgeable, and returned + * by ObjectPurgeable: + */ + int GL_RELEASED_APPLE = 0x8A19; + int GL_VOLATILE_APPLE = 0x8A1A; + + /** + * Accepted by the <option> parameters of ObjectUnpurgeable, and + * returned by ObjectUnpurgeable: + */ + int GL_RETAINED_APPLE = 0x8A1B; + int GL_UNDEFINED_APPLE = 0x8A1C; + + /** Accepted by the <pname> parameters of GetObjectParameteriv: */ + int GL_PURGEABLE_APPLE = 0x8A1D; + + /** + * Accepted by the <objectType> parameters of ObjectPurgeableAPPLE, + * ObjectUnpurgeableAPPLE and GetObjectParameteriv: + */ + int GL_BUFFER_OBJECT_APPLE = 0x85B3; + + @GLenum + int glObjectPurgeableAPPLE(@GLenum int objectType, @GLuint int name, @GLenum int option); + + @GLenum + int glObjectUnpurgeableAPPLE(@GLenum int objectType, @GLuint int name, @GLenum int option); + + @StripPostfix("params") + void glGetObjectParameterivAPPLE(@GLenum int objectType, @GLuint int name, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetObjectParameterivAPPLE") + @GLreturn("params") + @StripPostfix("params") + void glGetObjectParameterivAPPLE2(@GLenum int objectType, @GLuint int name, @GLenum int pname, @OutParameter IntBuffer params); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_packed_pixels.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_packed_pixels.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_packed_pixels.java 2010-03-27 01:12:05 UTC (rev 3296) @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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; + +public interface APPLE_packed_pixels { + + /** + * Accepted by the <type> parameter of DrawPixels, ReadPixels, TexImage1D, + * TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, + * TexSubImage2D, TexSubImage3D, GetHistogram, GetMinmax, + * ConvolutionFilter1D, ConvolutionFilter2D, ConvolutionFilter3D, + * GetConvolutionFilter, SeparableFilter2D, SeparableFilter3D, + * GetSeparableFilter, ColorTable, GetColorTable, TexImage4DSGIS, + * and TexSubImage4DSGIS: + */ + int GL_UNSIGNED_BYTE_3_3_2 = 0x8032; + int GL_UNSIGNED_BYTE_2_3_3_REV = 0x8362; + int GL_UNSIGNED_SHORT_5_6_5 = 0x8363; + int GL_UNSIGNED_SHORT_5_6_5_REV = 0x8364; + int GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033; + int GL_UNSIGNED_SHORT_4_4_4_4_REV = 0x8365; + int GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034; + int GL_UNSIGNED_SHORT_1_5_5_5_REV = 0x8366; + int GL_UNSIGNED_INT_8_8_8_8 = 0x8035; + int GL_UNSIGNED_INT_8_8_8_8_REV = 0x8367; + int GL_UNSIGNED_INT_10_10_10_2 = 0x8036; + int GL_UNSIGNED_INT_2_10_10_10_REV = 0x8368; + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_rgb_422.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_rgb_422.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_rgb_422.java 2010-03-27 01:12:05 UTC (rev 3296) @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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; + +public interface APPLE_rgb_422 { + + /** + * Accepted by the <format> parameter of DrawPixels, ReadPixels, TexImage1D, + * TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, TexSubImage2D, + * TexSubImage3D, GetHistogram, GetMinmax, ConvolutionFilter1D, + * ConvolutionFilter2D, GetConvolutionFilter, SeparableFilter2D, + * GetSeparableFilter, ColorTable, GetColorTable: + */ + int GL_RGB_422_APPLE = 0x8A1F; + + /** + * Accepted by the <type> parameter of DrawPixels, ReadPixels, TexImage1D, + * TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, TexSubImage2D, + * TexSubImage3D, GetHistogram, GetMinmax, ConvolutionFilter1D, + * ConvolutionFilter2D, GetConvolutionFilter, SeparableFilter2D, + * GetSeparableFilter, ColorTable, GetColorTable: + */ + int GL_UNSIGNED_SHORT_8_8_APPLE = 0x85BA; + int GL_UNSIGNED_SHORT_8_8_REV_APPLE = 0x85BB; + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_row_bytes.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_row_bytes.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_row_bytes.java 2010-03-27 01:12:05 UTC (rev 3296) @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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; + +public interface APPLE_row_bytes { + + /** + * Accepted by the <pname> parameter of PixelStorei and the <pname> + * parameter of GetIntegerv: + */ + int GL_PACK_ROW_BYTES_APPLE = 0x8A15; + int GL_UNPACK_ROW_BYTES_APPLE = 0x8A16; + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_texture_range.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_texture_range.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_texture_range.java 2010-03-27 01:12:05 UTC (rev 3296) @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator.*; + +import java.nio.Buffer; +import java.nio.ByteBuffer; + +public interface APPLE_texture_range { + + /** + * Accepted by the <pname> parameters of TexParameteri, TexParameterf, + * TexParameteriv, TexParameterfv, GetTexParameteriv, and + * GetTexParameterfv: + */ + int GL_TEXTURE_STORAGE_HINT_APPLE = 0x85BC; + + /** + * Accepted by the <param> parameters of TexParameteri, TexParameterf, + * TexParameteriv, and TexParameterfv: + */ + int GL_STORAGE_PRIVATE_APPLE = 0x85BD; + int GL_STORAGE_CACHED_APPLE = 0x85BE; + int GL_STORAGE_SHARED_APPLE = 0x85BF; + + /** + * Accepted by the <pname> parameters of GetTexParameteriv and + * GetTexParameterfv: + */ + int GL_TEXTURE_RANGE_LENGTH_APPLE = 0x85B7; + + /** Accepted by the <pname> parameters of GetTexParameterPointerv: */ + int GL_TEXTURE_RANGE_POINTER_APPLE = 0x85B8; + + void glTextureRangeAPPLE(@GLenum int target, @AutoSize("pointer") @GLsizei int length, @GLvoid ByteBuffer pointer); + + void glGetTexParameterPointervAPPLE(@GLenum int target, @GLenum int pname, @Result @GLvoid Buffer params); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java 2010-03-27 01:12:05 UTC (rev 3296) @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator.*; + +import java.nio.IntBuffer; + +public interface APPLE_vertex_array_object { + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, + * and GetDoublev: + */ + int GL_VERTEX_ARRAY_BINDING_APPLE = 0x85B5; + + void glBindVertexArrayAPPLE(@GLuint int array); + + void glDeleteVertexArraysAPPLE(@AutoSize("arrays") @GLsizei int n, @Const @GLuint IntBuffer arrays); + + @Alternate("glDeleteVertexArraysAPPLE") + void glDeleteVertexArraysAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtils.getBufferInt().put(0, array), 0", keepParam = true) int array); + + void glGenVertexArraysAPPLE(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); + + @Alternate("glGenVertexArraysAPPLE") + @GLreturn("arrays") + void glGenVertexArraysAPPLE2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); + + boolean glIsVertexArrayAPPLE(@GLuint int array); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_range.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_range.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_range.java 2010-03-27 01:12:05 UTC (rev 3296) @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator.AutoSize; +import org.lwjgl.util.generator.GLenum; +import org.lwjgl.util.generator.GLsizei; +import org.lwjgl.util.generator.GLvoid; + +import java.nio.ByteBuffer; + +public interface APPLE_vertex_array_range { + + /** + * Accepted by the <cap> parameter of EnableClientState, DisableClientState, + * and IsEnabled: + */ + int GL_VERTEX_ARRAY_RANGE_APPLE = 0x851D; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, + * and GetDoublev: + */ + + int GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE = 0x851E; + int GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_APPLE = 0x8520; + + /** Accepted by the <pname> parameter of GetPointerv: */ + + int GL_VERTEX_ARRAY_RANGE_POINTER_APPLE = 0x8521; + + /** + * Accepted by the <pname> parameter of VertexArrayParameteriAPPLE, + * GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev: + */ + + int GL_VERTEX_ARRAY_STORAGE_HINT_APPLE = 0x851F; + + /** Accepted by the <param> parameter of VertexArrayParameteriAPPLE: */ + + int GL_STORAGE_CACHED_APPLE = 0x85BE; + int GL_STORAGE_SHARED_APPLE = 0x85BF; + + /** Accepted by the <object> parameter of TestObjectAPPLE and FinishObjectAPPLE: */ + int GL_DRAW_PIXELS_APPLE = 0x8A0A; + int GL_FENCE_APPLE = 0x8A0B; + + void glVertexArrayRangeAPPLE(@AutoSize("pointer") @GLsizei int length, @GLvoid ByteBuffer pointer); + + void glFlushVertexArrayRangeAPPLE(@AutoSize("pointer") @GLsizei int length, @GLvoid ByteBuffer pointer); + + void glVertexArrayParameteriAPPLE(@GLenum int pname, int param); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_program_evaluators.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_program_evaluators.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_program_evaluators.java 2010-03-27 01:12:05 UTC (rev 3296) @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator.Check; +import org.lwjgl.util.generator.Const; +import org.lwjgl.util.generator.GLenum; +import org.lwjgl.util.generator.GLuint; + +import java.nio.DoubleBuffer; +import java.nio.FloatBuffer; + +public interface APPLE_vertex_program_evaluators { + + /** + * Accepted by the <pname> parameter of EnableVertexAttribAPPLE, + * DisableVertexAttribAPPLE, and IsVertexAttribEnabledAPPLE. + */ + int GL_VERTEX_ATTRIB_MAP1_APPLE = 0x8A00; + int GL_VERTEX_ATTRIB_MAP2_APPLE = 0x8A01; + + /** + * Accepted by the <pname> parameter of GetVertexAttribdvARB, + * GetVertexAttribfvARB, and GetVertexAttribivARB. + */ + int GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE = 0x8A02; + int GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE = 0x8A03; + int GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE = 0x8A04; + int GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE = 0x8A05; + int GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE = 0x8A06; + int GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE = 0x8A07; + int GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE = 0x8A08; + int GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE = 0x8A09; + + void glEnableVertexAttribAPPLE(@GLuint int index, @GLenum int pname); + + void glDisableVertexAttribAPPLE(@GLuint int index, @GLenum int pname); + + boolean glIsVertexAttribEnabledAPPLE(@GLuint int index, @GLenum int pname); + + void glMapVertexAttrib1dAPPLE(@GLuint int index, @GLuint int size, double u1, double u2, + int stride, int order, @Check @Const DoubleBuffer points); + + void glMapVertexAttrib1fAPPLE(@GLuint int index, @GLuint int size, float u1, float u2, + int stride, int order, @Check @Const FloatBuffer points); + + void glMapVertexAttrib2dAPPLE(@GLuint int index, @GLuint int size, double u1, double u2, + int ustride, int uorder, double v1, double v2, int vstride, int vorder, + @Check @Const DoubleBuffer points); + + void glMapVertexAttrib2fAPPLE(@GLuint int index, @GLuint int size, float u1, float u2, + int ustride, int uorder, float v1, float v2, int vstride, int vorder, + @Check @Const FloatBuffer points); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_ycbcr_422.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_ycbcr_422.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_ycbcr_422.java 2010-03-27 01:12:05 UTC (rev 3296) @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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; + +public interface APPLE_ycbcr_422 { + + /** + * Accepted by the <format> parameter of DrawPixels, ReadPixels, TexImage1D, + * TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, TexSubImage2D, + * TexSubImage3D, GetHistogram, GetMinmax, ConvolutionFilter1D, + * ConvolutionFilter2D, ConvolutionFilter3D, GetConvolutionFilter, + * SeparableFilter2D, SeparableFilter3D, GetSeparableFilter, ColorTable, + * GetColorTable: + */ + int GL_YCBCR_422_APPLE = 0x85B9; + + /** + * Accepted by the <type> parameter of DrawPixels, ReadPixels, TexImage1D, + * TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, TexSubImage2D, + * TexSubImage3D, GetHistogram, GetMinmax, ConvolutionFilter1D, + * ConvolutionFilter2D, ConvolutionFilter3D, GetConvolutionFilter, + * SeparableFilter2D, SeparableFilter3D, GetSeparableFilter, ColorTable, + * GetColorTable: + */ + int GL_UNSIGNED_SHORT_8_8_APPLE = 0x85BA; + int GL_UNSIGNED_SHORT_8_8_REV_APPLE = 0x85BB; + +} \ No newline at end of file Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_element_array.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_element_array.java 2010-03-26 19:52:40 UTC (rev 3295) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_element_array.java 2010-03-27 01:12:05 UTC (rev 3296) @@ -41,8 +41,6 @@ int GL_ELEMENT_ARRAY_POINTER_ATI = 0x876A; void glElementPointerATI(@AutoType("pPointer") @GLenum int type, - @CachedReference - @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLubyte Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java 2010-03-26 19:52:40 UTC (rev 3295) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java 2010-03-27 01:12:05 UTC (rev 3296) @@ -275,6 +275,12 @@ void glGetActiveUniformBlockiv(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname, @OutParameter @Check(value = "16") @GLint IntBuffer params); + @Alternate("glGetActiveUniformBlockiv") + @GLreturn("params") + @StripPostfix("params") + void glGetActiveUniformBlockiv2(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname, + @OutParameter @GLint IntBuffer params); + void glGetActiveUniformBlockName(@GLuint int program, @GLuint int uniformBlockIndex, @AutoSize("uniformBlockName") @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer uniformBlockName); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-03-26 19:52:47
|
Revision: 3295 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3295&view=rev Author: kappa1 Date: 2010-03-26 19:52:40 +0000 (Fri, 26 Mar 2010) Log Message: ----------- oops, windows mousegrab fixed Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java Modified: trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2010-03-26 19:17:53 UTC (rev 3294) +++ trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2010-03-26 19:52:40 UTC (rev 3295) @@ -614,14 +614,15 @@ */ public static void setGrabbed(boolean grab) { synchronized (OpenGLPackageAccess.global_lock) { - + boolean grabbed = isGrabbed; + isGrabbed = grab; if (isCreated()) { - if (grab && !isGrabbed) { + if (grab && !grabbed) { // store location mouse was grabbed grab_x = x; grab_y = y; } - else if (!grab && isGrabbed) { + else if (!grab && grabbed) { // move mouse back to location it was grabbed before ungrabbing if ((Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0) implementation.setCursorPosition(grab_x, grab_y); @@ -634,7 +635,6 @@ event_y = y; resetMouse(); } - isGrabbed = grab; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-03-26 19:17:59
|
Revision: 3294 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3294&view=rev Author: kappa1 Date: 2010-03-26 19:17:53 +0000 (Fri, 26 Mar 2010) Log Message: ----------- Consistent mouse grab behaviour on all platforms. Mouse will now ungrab at the same place it was grabbed from. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java Modified: trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2010-03-23 12:43:44 UTC (rev 3293) +++ trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2010-03-26 19:17:53 UTC (rev 3294) @@ -125,6 +125,9 @@ private static int event_x; private static int event_y; private static long event_nanos; + /** The position of the mouse it was grabbed at */ + private static int grab_x; + private static int grab_y; /** Buffer size in events */ private static final int BUFFER_SIZE = 50; @@ -611,15 +614,27 @@ */ public static void setGrabbed(boolean grab) { synchronized (OpenGLPackageAccess.global_lock) { - isGrabbed = grab; + if (isCreated()) { - implementation.grabMouse(isGrabbed); + if (grab && !isGrabbed) { + // store location mouse was grabbed + grab_x = x; + grab_y = y; + } + else if (!grab && isGrabbed) { + // move mouse back to location it was grabbed before ungrabbing + if ((Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0) + implementation.setCursorPosition(grab_x, grab_y); + } + + implementation.grabMouse(grab); // Get latest values from native side poll(); event_x = x; event_y = y; resetMouse(); } + isGrabbed = grab; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <ma...@us...> - 2010-03-17 19:03:10
|
Revision: 3292 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3292&view=rev Author: matzon Date: 2010-03-17 19:03:03 +0000 (Wed, 17 Mar 2010) Log Message: ----------- forgot to tag 2.3 Added Paths: ----------- tags/lwjgl2.3/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-03-17 18:58:25
|
Revision: 3291 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3291&view=rev Author: matzon Date: 2010-03-17 18:58:18 +0000 (Wed, 17 Mar 2010) Log Message: ----------- 2.4 release Modified Paths: -------------- trunk/LWJGL/platform_build/build-definitions.xml trunk/LWJGL/src/java/org/lwjgl/Sys.java Modified: trunk/LWJGL/platform_build/build-definitions.xml =================================================================== --- trunk/LWJGL/platform_build/build-definitions.xml 2010-03-17 18:55:59 UTC (rev 3290) +++ trunk/LWJGL/platform_build/build-definitions.xml 2010-03-17 18:58:18 UTC (rev 3291) @@ -12,7 +12,7 @@ <property name="lwjgl.docs" location="doc" /> <property name="lwjgl.temp" location="temp" /> <property name="lwjgl.res" location="res" /> - <property name="lwjgl.version" value="2.3" /> + <property name="lwjgl.version" value="2.4" /> <property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/AMD*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java,org/lwjgl/opengl/GREMEDY*.java"/> <!-- ================================================================== --> Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2010-03-17 18:55:59 UTC (rev 3290) +++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2010-03-17 18:58:18 UTC (rev 3291) @@ -54,7 +54,7 @@ private static final String JNI_LIBRARY_NAME = "lwjgl"; /** Current version of library */ - private static final String VERSION = "2.3"; + private static final String VERSION = "2.4"; /** The implementation instance to delegate platform specific behavior to */ private final static SysImplementation implementation; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-03-17 18:56:09
|
Revision: 3290 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3290&view=rev Author: matzon Date: 2010-03-17 18:55:59 +0000 (Wed, 17 Mar 2010) Log Message: ----------- patch as per http://lwjgl.org/forum/index.php/topic,3124.0.html Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2010-03-16 19:05:19 UTC (rev 3289) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2010-03-17 18:55:59 UTC (rev 3290) @@ -690,15 +690,16 @@ if (mouse != null) { mouse.handleMouseButton((byte)button, (byte)state, millis); + // need to capture? + if (captureMouse == -1 && button != -1 && state == 1) { + captureMouse = button; + nSetCapture(hwnd); + } + // done with capture? if(captureMouse != -1 && button == captureMouse && state == 0) { - nReleaseCapture(); captureMouse = -1; - - // force mouse update - else we will run into an issue where the - // button state is "stale" while captureMouse == -1 which causes - // handleMouseMoved to issue a setCapture. - Mouse.poll(); + nReleaseCapture(); } } @@ -714,16 +715,6 @@ private void handleMouseMoved(int x, int y, long millis) { if (mouse != null) { mouse.handleMouseMoved(x, y, millis, shouldGrab()); - - // Moving - while mouse is down? - // need to capture - if(!Mouse.isGrabbed()) { - int button = firstMouseButtonDown(); - if(captureMouse == -1 && button != -1) { - captureMouse = button; - nSetCapture(hwnd); - } - } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sp...@us...> - 2010-03-16 19:05:26
|
Revision: 3289 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3289&view=rev Author: spasi Date: 2010-03-16 19:05:19 +0000 (Tue, 16 Mar 2010) Log Message: ----------- Added JNIEXPORT to AL alternate methods. Now forcing full regen when any class in the Generator changes. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java Property Changed: ---------------- trunk/LWJGL/src/native/common/ trunk/LWJGL/src/native/linux/ trunk/LWJGL/src/native/macosx/ trunk/LWJGL/src/native/windows/ Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java 2010-03-16 17:58:48 UTC (rev 3288) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java 2010-03-16 19:05:19 UTC (rev 3289) @@ -35,6 +35,8 @@ import com.sun.mirror.apt.*; import com.sun.mirror.declaration.*; +import java.io.File; +import java.io.FileFilter; import java.util.Collection; import java.util.Set; import java.util.Map; @@ -108,10 +110,11 @@ TypeDeclaration lastFile = null; try { + long generatorLM = getGeneratorLastModified(); TypeMap type_map = (TypeMap)(Class.forName(typemap_classname).newInstance()); for (TypeDeclaration typedecl : env.getSpecifiedTypeDeclarations()) { lastFile = typedecl; - typedecl.accept(getDeclarationScanner(new GeneratorVisitor(env, type_map, generate_error_checks, context_specific), NO_OP)); + typedecl.accept(getDeclarationScanner(new GeneratorVisitor(env, type_map, generate_error_checks, context_specific, generatorLM), NO_OP)); } } catch (Exception e) { if ( lastFile == null ) @@ -120,5 +123,35 @@ throw new RuntimeException("\n-- Failed to process template: " + lastFile.getQualifiedName() + " --", e); } } + + /** + * Gets the time of the latest change on the Generator classes. + * + * @return time of the latest change + */ + private static long getGeneratorLastModified() { + final File pck = new File(System.getProperty("user.dir") + "/bin/org/lwjgl/util/generator"); + if ( !pck.exists() || !pck.isDirectory() ) + return Long.MAX_VALUE; + + final File[] classes = pck.listFiles(new FileFilter() { + public boolean accept(final File pathname) { + return pathname.isFile() && pathname.getName().endsWith(".class"); + } + }); + + if ( classes == null || classes.length == 0 ) + return Long.MAX_VALUE; + + long lastModified = 0; + + for ( File clazz : classes ) { + long lm = clazz.lastModified(); + if ( lastModified < lm ) + lastModified = lm; + } + + return lastModified; + } } -} +} \ No newline at end of file Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-16 17:58:48 UTC (rev 3288) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-16 19:05:19 UTC (rev 3289) @@ -58,12 +58,14 @@ private final TypeMap type_map; private final boolean generate_error_checks; private final boolean context_specific; + private final long generatorLM; - public GeneratorVisitor(AnnotationProcessorEnvironment env, TypeMap type_map, boolean generate_error_checks, boolean context_specific) { + public GeneratorVisitor(AnnotationProcessorEnvironment env, TypeMap type_map, boolean generate_error_checks, boolean context_specific, long generatorLM) { this.env = env; this.type_map = type_map; this.generate_error_checks = generate_error_checks; this.context_specific = context_specific; + this.generatorLM = generatorLM; } private void validateMethods(InterfaceDeclaration d) { @@ -254,7 +256,7 @@ try { // Skip this class if the output exists and the input has not been modified. - if ( output.exists() && input.lastModified() < output.lastModified() ) + if ( output.exists() && Math.max(input.lastModified(), generatorLM) < output.lastModified() ) return; if (d.getMethods().size() > 0 || d.getFields().size() > 0) { Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2010-03-16 17:58:48 UTC (rev 3288) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2010-03-16 19:05:19 UTC (rev 3289) @@ -87,7 +87,7 @@ } private static void generateMethodStub(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, String interface_name, MethodDeclaration method, Mode mode, boolean generate_error_checks, boolean context_specific) { - if ( !context_specific ) + if ( !context_specific && method.getAnnotation(Alternate.class) == null ) writer.print("static "); else writer.print("JNIEXPORT "); Property changes on: trunk/LWJGL/src/native/common ___________________________________________________________________ Modified: svn:ignore - Debug Release org_lwjgl_input_Cursor.h org_lwjgl_input_Keyboard.h org_lwjgl_input_Mouse.h org_lwjgl_openal_AL.h org_lwjgl_openal_ALC.h org_lwjgl_opengl_GLContext.h org_lwjgl_opengl_Pbuffer.h org_lwjgl_Sys.h org_lwjgl_opengl_Display.h org_lwjgl_DefaultSysImplementation.h org_lwjgl_NativeSysImplementation.h + Debug Release org_lwjgl_DefaultSysImplementation.h org_lwjgl_NativeSysImplementation.h org_lwjgl_Sys.h org_lwjgl_input_Cursor.h org_lwjgl_input_Cursor_CursorElement.h org_lwjgl_input_Keyboard.h org_lwjgl_input_Keyboard_KeyEvent.h org_lwjgl_input_Mouse.h org_lwjgl_openal_AL.h org_lwjgl_openal_ALC.h org_lwjgl_opengl_AWTSurfaceLock.h org_lwjgl_opengl_Display.h org_lwjgl_opengl_GLContext.h org_lwjgl_opengl_GLContext_CapabilitiesCacheEntry.h org_lwjgl_opengl_Pbuffer.h Property changes on: trunk/LWJGL/src/native/linux ___________________________________________________________________ Modified: svn:ignore - org_lwjgl_opengl_LinuxDisplay.h + org_lwjgl_LinuxSysImplementation.h org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.h org_lwjgl_opengl_LinuxCanvasImplementation.h org_lwjgl_opengl_LinuxContextImplementation.h org_lwjgl_opengl_LinuxDisplay.h org_lwjgl_opengl_LinuxDisplayPeerInfo.h org_lwjgl_opengl_LinuxEvent.h org_lwjgl_opengl_LinuxKeyboard.h org_lwjgl_opengl_LinuxMouse.h org_lwjgl_opengl_LinuxPbufferPeerInfo.h org_lwjgl_opengl_LinuxPeerInfo.h Property changes on: trunk/LWJGL/src/native/macosx ___________________________________________________________________ Modified: svn:ignore - org_lwjgl_opengl_MacOSXDisplay.h + org_lwjgl_MacOSXSysImplementation.h org_lwjgl_opengl_MacOSXCanvasPeerInfo.h org_lwjgl_opengl_MacOSXContextImplementation.h org_lwjgl_opengl_MacOSXDisplay.h org_lwjgl_opengl_MacOSXMouseEventQueue.h org_lwjgl_opengl_MacOSXPbufferPeerInfo.h org_lwjgl_opengl_MacOSXPeerInfo.h Property changes on: trunk/LWJGL/src/native/windows ___________________________________________________________________ Modified: svn:ignore - Debug Release org_lwjgl_opengl_Win32Display.h org_lwjgl_Win32SysImplementation.h org_lwjgl_NativeSysImplementation.h + Debug Release org_lwjgl_NativeSysImplementation.h org_lwjgl_Win32SysImplementation.h org_lwjgl_WindowsSysImplementation.h org_lwjgl_opengl_Win32Display.h org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.h org_lwjgl_opengl_WindowsContextImplementation.h org_lwjgl_opengl_WindowsDisplay.h org_lwjgl_opengl_WindowsDisplayPeerInfo.h org_lwjgl_opengl_WindowsDisplay_Rect.h org_lwjgl_opengl_WindowsKeyboard.h org_lwjgl_opengl_WindowsPbufferPeerInfo.h org_lwjgl_opengl_WindowsPeerInfo.h org_lwjgl_opengl_WindowsRegistry.h This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sp...@us...> - 2010-03-16 17:58:55
|
Revision: 3288 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3288&view=rev Author: spasi Date: 2010-03-16 17:58:48 +0000 (Tue, 16 Mar 2010) Log Message: ----------- Added some alternate AL functions. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java trunk/LWJGL/src/templates/org/lwjgl/openal/AL10.java Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java 2010-03-14 23:24:40 UTC (rev 3287) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java 2010-03-16 17:58:48 UTC (rev 3288) @@ -153,6 +153,8 @@ } void cleanup() { + GL15.glDeleteBuffers(bufferID); + GL20.glDetachShader(programID, shaderID); GL20.glDeleteShader(shaderID); Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-14 23:24:40 UTC (rev 3287) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-16 17:58:48 UTC (rev 3288) @@ -173,9 +173,7 @@ writer.println("static " + Utils.getTypedefName(method) + " " + method.getSimpleName() + ";"); } - private void generateJavaSource(InterfaceDeclaration d) throws IOException { - validateMethods(d); - PrintWriter java_writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, d.getPackage().getQualifiedName(), new File(Utils.getSimpleClassName(d) + ".java"), null); + private void generateJavaSource(InterfaceDeclaration d, PrintWriter java_writer) throws IOException { java_writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */"); java_writer.println(); java_writer.println("package " + d.getPackage().getQualifiedName() + ";"); @@ -252,23 +250,25 @@ File input = d.getPosition().file(); File output = new File(env.getOptions().get("-s") + '/' + d.getPackage().getQualifiedName().replace('.', '/'), Utils.getSimpleClassName(d) + ".java"); + PrintWriter java_writer = null; + try { // Skip this class if the output exists and the input has not been modified. if ( output.exists() && input.lastModified() < output.lastModified() ) return; - if (d.getMethods().size() > 0 || d.getFields().size() > 0) - generateJavaSource(d); + if (d.getMethods().size() > 0 || d.getFields().size() > 0) { + validateMethods(d); + java_writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, d.getPackage().getQualifiedName(), new File(Utils.getSimpleClassName(d) + ".java"), null); + generateJavaSource(d, java_writer); + } if (d.getMethods().size() > 0) generateNativeSource(d); } catch (Exception e) { - try { - // If anything goes wrong mid-gen, delete output to allow regen next time we run. - if ( output.exists() ) - output.delete(); - } catch (Exception e2) { - // ignore - } + // If anything goes wrong mid-gen, delete output to allow regen next time we run. + if ( java_writer != null ) java_writer.close(); + if ( output.exists() ) output.delete(); + throw new RuntimeException(e); } } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-14 23:24:40 UTC (rev 3287) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-16 17:58:48 UTC (rev 3288) @@ -73,6 +73,8 @@ } Alternate alt_annotation = method.getAnnotation(Alternate.class); if ( alt_annotation == null || alt_annotation.nativeAlt() ) { + if ( alt_annotation != null && method.getSimpleName().equals(alt_annotation.value()) ) + throw new RuntimeException("An alternate function with native code should have a different name than the main function."); printJavaNativeStub(writer, method, Mode.NORMAL, generate_error_checks, context_specific); if (Utils.hasMethodBufferObjectParameter(method)) { printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.BUFFEROBJECT, generate_error_checks, context_specific); Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java 2010-03-14 23:24:40 UTC (rev 3287) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java 2010-03-16 17:58:48 UTC (rev 3288) @@ -52,6 +52,8 @@ Iterator<? extends MethodDeclaration> it = d.getMethods().iterator(); while (it.hasNext()) { MethodDeclaration method = it.next(); + if ( method.getAnnotation(Alternate.class) != null ) + continue; EnumSet<Platform> platforms; PlatformDependent platform_annotation = method.getAnnotation(PlatformDependent.class); if (platform_annotation != null) Modified: trunk/LWJGL/src/templates/org/lwjgl/openal/AL10.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/openal/AL10.java 2010-03-14 23:24:40 UTC (rev 3287) +++ trunk/LWJGL/src/templates/org/lwjgl/openal/AL10.java 2010-03-16 17:58:48 UTC (rev 3288) @@ -721,6 +721,10 @@ @ALvoid void alGenSources(@AutoSize("sources") @ALsizei int n, @OutParameter @ALuint IntBuffer sources); + @Alternate(value = "alGenSources", nativeAlt = true) + @ALvoid + void alGenSources2(@Constant("1") @ALsizei int n, @Result @ALuint int source); + /** * The application requests deletion of a number of Sources by DeleteSources. * @@ -729,6 +733,10 @@ @ALvoid void alDeleteSources(@AutoSize("sources") @ALsizei int n, @ALuint IntBuffer sources); + @Alternate(value = "alDeleteSources", nativeAlt = true) + @ALvoid + void alDeleteSources2(@Constant("1") @ALsizei int n, @Indirect @ALuint int source); + /** * The application can verify whether a source name is valid using the IsSource query. * @@ -945,6 +953,10 @@ @ALvoid void alGenBuffers(@AutoSize("buffers") @ALsizei int n, @OutParameter @ALuint IntBuffer buffers); + @Alternate(value = "alGenBuffers", nativeAlt = true) + @ALvoid + void alGenBuffers2(@Constant("1") @ALsizei int n, @Result @ALuint int buffer); + /** * <p> * The application requests deletion of a number of Buffers by calling DeleteBuffers. @@ -964,6 +976,10 @@ @ALvoid void alDeleteBuffers(@AutoSize("buffers") @ALsizei int n, @ALuint IntBuffer buffers); + @Alternate(value = "alDeleteBuffers", nativeAlt = true) + @ALvoid + void alDeleteBuffers2(@Constant("1") @ALsizei int n, @Indirect @ALuint int buffer); + /** * The application can verify whether a buffer Name is valid using the IsBuffer query. * @@ -1052,6 +1068,10 @@ @ALvoid void alSourceQueueBuffers(@ALuint int source, @AutoSize("buffers") @ALsizei int n, @ALuint IntBuffer buffers); + @Alternate(value = "alSourceQueueBuffers", nativeAlt = true) + @ALvoid + void alSourceQueueBuffers2(@ALuint int source, @Constant("1") @ALsizei int n, @Indirect @ALuint int buffer); + /** * <p> * Once a queue entry for a buffer has been appended to a queue and is pending @@ -1074,6 +1094,10 @@ @ALvoid void alSourceUnqueueBuffers(@ALuint int source, @AutoSize("buffers") @ALsizei int n, @OutParameter @ALuint IntBuffer buffers); + @Alternate(value = "alSourceUnqueueBuffers", nativeAlt = true) + @ALvoid + void alSourceUnqueueBuffers2(@ALuint int source, @Constant("1") @ALsizei int n, @Result @ALuint int buffer); + /** * <p> * Samples usually use the entire dynamic range of the chosen format/encoding, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sp...@us...> - 2010-03-14 23:24:49
|
Revision: 3287 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3287&view=rev Author: spasi Date: 2010-03-14 23:24:40 +0000 (Sun, 14 Mar 2010) Log Message: ----------- Added support for single primitive input/output parameters. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/test/opengl/SyncTest.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/Shader.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFSH.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVP.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVSH.java trunk/LWJGL/src/java/org/lwjgl/util/generator/Constant.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/PostfixTranslator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_program.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_subroutine.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sync.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_timer_query.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback3.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_program.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_draw_buffers2.java trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_multi_draw_arrays.java trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_integer.java trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_timer_query.java trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL14.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL33.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GREMEDY_string_marker.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_explicit_multisample.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_occlusion_query.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_program.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_register_combiners.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_shader_buffer_load.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_transform_feedback.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_vertex_buffer_unified_memory.java Added Paths: ----------- trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtils.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GLreturn.java Removed Paths: ------------- trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstring.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstringOffset.java Copied: trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtils.java (from rev 3286, trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java) =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtils.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtils.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -0,0 +1,354 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.BufferUtils; + +import java.nio.*; +import java.nio.charset.Charset; +import java.nio.charset.CharsetEncoder; + +/** @author spasi */ +final class APIUtils { + + private static final int INITIAL_BUFFER_SIZE = 256; + private static final int INITIAL_LENGTHS_SIZE = 4; + + private static final int BUFFERS_SIZE = 32; + + private static final ThreadLocal arrayTL = new ThreadLocal() { + protected Object initialValue() { return new char[INITIAL_BUFFER_SIZE]; } + }; + + private static final ThreadLocal bufferTL = new ThreadLocal() { + protected Object initialValue() { return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); } + }; + + private static final ThreadLocal lengthsTL = new ThreadLocal() { + protected Object initialValue() { return BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE); } + }; + + private static final ThreadLocal infiniteSeqTL = new ThreadLocal() { + protected Object initialValue() { return new InfiniteCharSequence(); } + }; + + private static final ThreadLocal buffersTL = new ThreadLocal() { + protected Object initialValue() { return new Buffers(); } + }; + + private static CharsetEncoder encoder = Charset.forName("US-ASCII").newEncoder(); + + private APIUtils() { + } + + private static char[] getArray(final int size) { + char[] array = (char[])arrayTL.get(); + + if ( array.length < size ) { + int sizeNew = array.length << 1; + while ( sizeNew < size ) + sizeNew <<= 1; + + array = new char[size]; + arrayTL.set(array); + } + + return array; + } + + static ByteBuffer getBufferByte(final int size) { + ByteBuffer buffer = (ByteBuffer)bufferTL.get(); + + if ( buffer.capacity() < size ) { + int sizeNew = buffer.capacity() << 1; + while ( sizeNew < size ) + sizeNew <<= 1; + + buffer = BufferUtils.createByteBuffer(size); + bufferTL.set(buffer); + } else + buffer.clear(); + + return buffer; + } + + private static ByteBuffer getBufferByteOffset(final int size) { + ByteBuffer buffer = (ByteBuffer)bufferTL.get(); + + if ( buffer.capacity() < size ) { + int sizeNew = buffer.capacity() << 1; + while ( sizeNew < size ) + sizeNew <<= 1; + + final ByteBuffer bufferNew = BufferUtils.createByteBuffer(size); + bufferNew.put(buffer); + bufferTL.set(buffer = bufferNew); + } else { + buffer.position(buffer.limit()); + buffer.limit(buffer.capacity()); + } + + return buffer; + } + + static ShortBuffer getBufferShort() { return ((Buffers)buffersTL.get()).shorts; } + + static IntBuffer getBufferInt() { return ((Buffers)buffersTL.get()).ints; } + + static LongBuffer getBufferLong() { return ((Buffers)buffersTL.get()).longs; } + + static FloatBuffer getBufferFloat() { return ((Buffers)buffersTL.get()).floats; } + + static DoubleBuffer getBufferDouble() { return ((Buffers)buffersTL.get()).doubles; } + + static IntBuffer getLengths() { + return getLengths(1); + } + + static IntBuffer getLengths(final int size) { + IntBuffer lengths = (IntBuffer)lengthsTL.get(); + + if ( lengths.capacity() < size ) { + int sizeNew = lengths.capacity(); + while ( sizeNew < size ) + sizeNew <<= 1; + + lengths = BufferUtils.createIntBuffer(size); + lengthsTL.set(lengths); + } else + lengths.clear(); + + return lengths; + } + + private static InfiniteCharSequence getInfiniteSeq() { + return (InfiniteCharSequence)infiniteSeqTL.get(); + } + + private static void encode(final ByteBuffer buffer, final CharSequence string) { + final InfiniteCharSequence infiniteSeq = getInfiniteSeq(); + infiniteSeq.setString(string); + encoder.encode(infiniteSeq.buffer, buffer, true); + } + + /** + * Reads a byte string from the specified buffer. + * + * @param buffer + * + * @return the buffer as a String. + */ + static String getString(final ByteBuffer buffer) { + final int length = buffer.remaining(); + final char[] charArray = getArray(length); + + for ( int i = buffer.position(); i < buffer.limit(); i++ ) + charArray[i - buffer.position()] = (char)buffer.get(i); + + return new String(charArray, 0, length); + } + + /** + * Returns a buffer containing the specified string as bytes. + * + * @param string + * + * @return the String as a ByteBuffer + */ + static ByteBuffer getBuffer(final CharSequence string) { + final ByteBuffer buffer = getBufferByte(string.length()); + + encode(buffer, string); + + buffer.flip(); + return buffer; + } + + /** + * Returns a buffer containing the specified string as bytes, starting at the specified offset. + * + * @param string + * + * @return the String as a ByteBuffer + */ + static ByteBuffer getBuffer(final CharSequence string, final int offset) { + final ByteBuffer buffer = getBufferByteOffset(offset + string.length()); + + encode(buffer, string); + + buffer.flip(); + return buffer; + } + + /** + * Returns a buffer containing the specified string as bytes, including null-termination. + * + * @param string + * + * @return the String as a ByteBuffer + */ + static ByteBuffer getBufferNT(final CharSequence string) { + final ByteBuffer buffer = getBufferByte(string.length() + 1); + + encode(buffer, string); + + buffer.put((byte)0); + buffer.flip(); + return buffer; + } + + static int getTotalLength(final CharSequence[] strings) { + int length = 0; + for ( int i = 0; i < strings.length; i++ ) + length += strings[i].length(); + + return length; + } + + /** + * Returns a buffer containing the specified strings as bytes. + * + * @param strings + * + * @return the Strings as a ByteBuffer + */ + static ByteBuffer getBuffer(final CharSequence[] strings) { + final ByteBuffer buffer = getBufferByte(getTotalLength(strings)); + + final InfiniteCharSequence infiniteSeq = getInfiniteSeq(); + for ( int i = 0; i < strings.length; i++ ) { + infiniteSeq.setString(strings[i]); + encoder.encode(infiniteSeq.buffer, buffer, true); + } + infiniteSeq.clear(); + + buffer.flip(); + return buffer; + } + + /** + * Returns a buffer containing the specified strings as bytes, including null-termination. + * + * @param strings + * + * @return the Strings as a ByteBuffer + */ + static ByteBuffer getBufferNT(final CharSequence[] strings) { + final ByteBuffer buffer = getBufferByte(getTotalLength(strings) + strings.length); + + final InfiniteCharSequence infiniteSeq = getInfiniteSeq(); + for ( int i = 0; i < strings.length; i++ ) { + infiniteSeq.setString(strings[i]); + encoder.encode(infiniteSeq.buffer, buffer, true); + buffer.put((byte)0); + } + infiniteSeq.clear(); + + buffer.flip(); + return buffer; + } + + /** + * Returns a buffer containing the lengths of the specified strings. + * + * @param strings + * + * @return the String lengths in an IntBuffer + */ + static IntBuffer getLengths(final CharSequence[] strings) { + IntBuffer buffer = getLengths(strings.length); + + for ( int i = 0; i < strings.length; i++ ) + buffer.put(strings[i].length()); + + buffer.flip(); + return buffer; + } + + /** + * A mutable CharSequence with very large initial length. We can wrap this in a re-usable CharBuffer for decoding. + * We cannot subclass CharBuffer because of {@link CharBuffer#toString(int,int)}. + */ + private static class InfiniteCharSequence implements CharSequence { + + final CharBuffer buffer; + + CharSequence string; + + InfiniteCharSequence() { + buffer = CharBuffer.wrap(this); + } + + void setString(final CharSequence string) { + this.string = string; + this.buffer.position(0); + this.buffer.limit(string.length()); + } + + void clear() { + this.string = null; + } + + public int length() { + return Integer.MAX_VALUE; + } + + public char charAt(final int index) { + return string.charAt(index); + } + + public CharSequence subSequence(final int start, final int end) { + return string.subSequence(start, end); + } + } + + private static class Buffers { + + final ShortBuffer shorts; + final IntBuffer ints; + final LongBuffer longs; + + final FloatBuffer floats; + final DoubleBuffer doubles; + + Buffers() { + shorts = BufferUtils.createShortBuffer(BUFFERS_SIZE); + ints = BufferUtils.createIntBuffer(BUFFERS_SIZE); + longs = BufferUtils.createLongBuffer(BUFFERS_SIZE); + + floats = BufferUtils.createFloatBuffer(BUFFERS_SIZE); + doubles = BufferUtils.createDoubleBuffer(BUFFERS_SIZE); + } + + } + +} \ No newline at end of file Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -1,324 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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.BufferUtils; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.IntBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetEncoder; - -/** @author spasi */ -final class StringUtils { - - private static final int INITIAL_BUFFER_SIZE = 256; - private static final int INITIAL_LENGTHS_SIZE = 4; - - private static final ThreadLocal arrayTL = new ThreadLocal() { - protected Object initialValue() { - return new char[INITIAL_BUFFER_SIZE]; - } - }; - - private static final ThreadLocal bufferTL = new ThreadLocal() { - protected Object initialValue() { - return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); - } - }; - - private static final ThreadLocal lengthsTL = new ThreadLocal() { - protected Object initialValue() { - return BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE); - } - }; - - private static final ThreadLocal infiniteSeqTL = new ThreadLocal() { - protected Object initialValue() { - return new InfiniteCharSequence(); - } - }; - - private static CharsetEncoder encoder = Charset.forName("US-ASCII").newEncoder(); - - private StringUtils() { - } - - private static char[] getArray(final int size) { - char[] array = (char[])arrayTL.get(); - - if ( array.length < size ) { - int sizeNew = array.length << 1; - while ( sizeNew < size ) - sizeNew <<= 1; - - array = new char[size]; - arrayTL.set(array); - } - - return array; - } - - static ByteBuffer getBuffer(final int size) { - ByteBuffer buffer = (ByteBuffer)bufferTL.get(); - - if ( buffer.capacity() < size ) { - int sizeNew = buffer.capacity() << 1; - while ( sizeNew < size ) - sizeNew <<= 1; - - buffer = BufferUtils.createByteBuffer(size); - bufferTL.set(buffer); - } - - buffer.clear(); - return buffer; - } - - private static ByteBuffer getBufferOffset(final int size) { - ByteBuffer buffer = (ByteBuffer)bufferTL.get(); - - if ( buffer.capacity() < size ) { - int sizeNew = buffer.capacity() << 1; - while ( sizeNew < size ) - sizeNew <<= 1; - - final ByteBuffer bufferNew = BufferUtils.createByteBuffer(size); - bufferNew.put(buffer); - bufferTL.set(buffer = bufferNew); - } else { - buffer.position(buffer.limit()); - buffer.limit(buffer.capacity()); - } - - return buffer; - } - - static IntBuffer getLengths(final int size) { - IntBuffer lengths = (IntBuffer)lengthsTL.get(); - - if ( lengths.capacity() < size ) { - int sizeNew = lengths.capacity(); - while ( sizeNew < size ) - sizeNew <<= 1; - - lengths = BufferUtils.createIntBuffer(size); - lengthsTL.set(lengths); - } - - lengths.clear(); - return lengths; - } - - static InfiniteCharSequence getInfiniteSeq() { - return (InfiniteCharSequence)infiniteSeqTL.get(); - } - - /** - * Reads a byte string from the specified buffer. - * - * @param buffer - * - * @return the buffer as a String. - */ - static String getString(final ByteBuffer buffer) { - final int length = buffer.remaining(); - final char[] charArray = getArray(length); - - for ( int i = buffer.position(); i < buffer.limit(); i++ ) - charArray[i - buffer.position()] = (char)buffer.get(i); - - return new String(charArray, 0, length); - } - - private static void encode(final ByteBuffer buffer, final CharSequence string) { - final InfiniteCharSequence infiniteSeq = getInfiniteSeq(); - infiniteSeq.setString(string); - encoder.encode(infiniteSeq.buffer, buffer, true); - } - - /** - * Returns a buffer containing the specified string as bytes. - * - * @param string - * - * @return the String as a ByteBuffer - */ - static ByteBuffer getBuffer(final CharSequence string) { - final ByteBuffer buffer = getBuffer(string.length()); - - encode(buffer, string); - - buffer.flip(); - return buffer; - } - - /** - * Returns a buffer containing the specified string as bytes, starting at the specified offset. - * - * @param string - * - * @return the String as a ByteBuffer - */ - static ByteBuffer getBufferOffset(final CharSequence string, final int offset) { - final ByteBuffer buffer = getBufferOffset(offset + string.length()); - - encode(buffer, string); - - buffer.flip(); - return buffer; - } - - /** - * Returns a buffer containing the specified string as bytes, including null-termination. - * - * @param string - * - * @return the String as a ByteBuffer - */ - static ByteBuffer getBufferNT(final CharSequence string) { - final ByteBuffer buffer = getBuffer(string.length() + 1); - - encode(buffer, string); - - buffer.put((byte)0); - buffer.flip(); - return buffer; - } - - private static int getTotalLength(final CharSequence[] strings) { - int length = 0; - for ( int i = 0; i < strings.length; i++ ) - length += strings[i].length(); - - return length; - } - - /** - * Returns a buffer containing the specified strings as bytes. - * - * @param strings - * - * @return the Strings as a ByteBuffer - */ - static ByteBuffer getBuffer(final CharSequence[] strings) { - final ByteBuffer buffer = getBuffer(getTotalLength(strings)); - - final InfiniteCharSequence infiniteSeq = getInfiniteSeq(); - for ( int i = 0; i < strings.length; i++ ) { - infiniteSeq.setString(strings[i]); - encoder.encode(infiniteSeq.buffer, buffer, true); - } - infiniteSeq.clear(); - - buffer.flip(); - return buffer; - } - - /** - * Returns a buffer containing the specified strings as bytes, including null-termination. - * - * @param strings - * - * @return the Strings as a ByteBuffer - */ - static ByteBuffer getBufferNT(final CharSequence[] strings) { - final ByteBuffer buffer = getBuffer(getTotalLength(strings) + strings.length); - - final InfiniteCharSequence infiniteSeq = getInfiniteSeq(); - for ( int i = 0; i < strings.length; i++ ) { - infiniteSeq.setString(strings[i]); - encoder.encode(infiniteSeq.buffer, buffer, true); - buffer.put((byte)0); - } - infiniteSeq.clear(); - - buffer.flip(); - return buffer; - } - - /** - * Returns a buffer containing the lengths of the specified strings. - * - * @param strings - * - * @return the String lengths in an IntBuffer - */ - static IntBuffer getLengths(final CharSequence[] strings) { - IntBuffer buffer = getLengths(strings.length); - - for ( int i = 0; i < strings.length; i++ ) - buffer.put(strings[i].length()); - - buffer.flip(); - return buffer; - } - - /** - * A mutable CharSequence with very large initial length. We can wrap this in a re-usable CharBuffer for decoding. - * We cannot subclass CharBuffer because of {@link CharBuffer#toString(int,int)}. - */ - private static class InfiniteCharSequence implements CharSequence { - - final CharBuffer buffer; - - CharSequence string; - - InfiniteCharSequence() { - buffer = CharBuffer.wrap(this); - } - - void setString(final CharSequence string) { - this.string = string; - this.buffer.position(0); - this.buffer.limit(string.length()); - } - - void clear() { - this.string = null; - } - - public int length() { - return Integer.MAX_VALUE; - } - - public char charAt(final int index) { - return string.charAt(index); - } - - public CharSequence subSequence(final int start, final int end) { - return string.subSequence(start, end); - } - } - -} \ No newline at end of file Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/SyncTest.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/SyncTest.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/SyncTest.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -31,17 +31,13 @@ */ package org.lwjgl.test.opengl; -import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import org.lwjgl.opengl.*; -import java.nio.IntBuffer; import java.util.Random; -/** - * @author spasi <sp...@us...> - */ +/** @author spasi <sp...@us...> */ public final class SyncTest { private SyncTest() { @@ -131,9 +127,7 @@ System.out.println("Unexpected wait status: 0x" + Integer.toHexString(status)); } - IntBuffer property = BufferUtils.createIntBuffer(1); - GL32.glGetSync(sync, GL32.GL_SYNC_STATUS, null, property); - System.out.println("Sync Status: " + (property.get(0) == GL32.GL_UNSIGNALED ? "UNSIGNALED" : "SIGNALED")); + System.out.println("Sync Status: " + (GL32.glGetSync(sync, GL32.GL_SYNC_STATUS) == GL32.GL_UNSIGNALED ? "UNSIGNALED" : "SIGNALED")); GL32.glDeleteSync(sync); Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -44,7 +44,6 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; -import java.nio.IntBuffer; import org.lwjgl.Sys; import org.lwjgl.input.Keyboard; @@ -191,9 +190,7 @@ System.out.println("ARB VBO not supported!"); System.exit(1); } - IntBuffer int_buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer(); - ARBBufferObject.glGenBuffersARB(int_buffer); - buffer_id = int_buffer.get(0); + buffer_id = ARBBufferObject.glGenBuffersARB(); ARBBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, buffer_id); vertices = ByteBuffer.allocateDirect(2 * 4 * 4).order(ByteOrder.nativeOrder()).asFloatBuffer(); vertices.put(-50).put(-50).put(50).put(-50).put(50).put(50).put(-50).put(50); @@ -206,9 +203,7 @@ * Cleanup */ private static void cleanup() { - IntBuffer int_buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer(); - int_buffer.put(0, buffer_id); - ARBBufferObject.glDeleteBuffersARB(int_buffer); + ARBBufferObject.glDeleteBuffersARB(buffer_id); Display.destroy(); } } Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/Shader.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/Shader.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/Shader.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -37,21 +37,18 @@ */ package org.lwjgl.test.opengl.shaders; -import java.io.BufferedInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.ByteBuffer; -import java.nio.IntBuffer; - import org.lwjgl.BufferUtils; import org.lwjgl.opengl.ARBProgram; import org.lwjgl.opengl.ARBShaderObjects; import org.lwjgl.opengl.GL11; +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; + abstract class Shader { - private static final IntBuffer int_buffer = BufferUtils.createIntBuffer(16); - protected static IntBuffer programBuffer = BufferUtils.createIntBuffer(1); protected static ByteBuffer fileBuffer = BufferUtils.createByteBuffer(1024 * 10); protected Shader() { @@ -61,18 +58,6 @@ abstract void cleanup(); - /** - * Obtain a GL integer value from the driver - * - * @param gl_enum The GL value you want - * - * @return the integer value - */ - public static int glGetInteger(int gl_enum) { - GL11.glGetInteger(gl_enum, int_buffer); - return int_buffer.get(0); - } - protected static String getShaderText(String file) { String shader = null; @@ -107,7 +92,7 @@ protected static void checkProgramError(String programFile, String programSource) { if ( GL11.glGetError() == GL11.GL_INVALID_OPERATION ) { - final int errorPos = glGetInteger(ARBProgram.GL_PROGRAM_ERROR_POSITION_ARB); + final int errorPos = GL11.glGetInteger(ARBProgram.GL_PROGRAM_ERROR_POSITION_ARB); int lineStart = 0; int lineEnd = -1; for ( int i = 0; i < programSource.length(); i++ ) { @@ -140,9 +125,7 @@ } protected static void printShaderObjectInfoLog(String file, int ID) { - ARBShaderObjects.glGetObjectParameterARB(ID, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB, programBuffer); - - final int logLength = programBuffer.get(0); + final int logLength = ARBShaderObjects.glGetObjectParameteriARB(ID, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB); if ( logLength <= 1 ) return; @@ -153,9 +136,7 @@ } protected static void printShaderProgramInfoLog(int ID) { - ARBShaderObjects.glGetObjectParameterARB(ID, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB, programBuffer); - - final int logLength = programBuffer.get(0); + final int logLength = ARBShaderObjects.glGetObjectParameteriARB(ID, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB); if ( logLength <= 1 ) return; Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -60,10 +60,8 @@ vpFile = vpShaderFile; vpSource = getShaderText(vpShaderFile); - ARBProgram.glGenProgramsARB(programBuffer); + vpID = ARBProgram.glGenProgramsARB(); - vpID = programBuffer.get(0); - ARBProgram.glBindProgramARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, vpID); ARBProgram.glProgramStringARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, ARBProgram.GL_PROGRAM_FORMAT_ASCII_ARB, vpSource); @@ -73,10 +71,8 @@ fpFile = fpShaderFile; fpSource = getShaderText(fpShaderFile); - ARBProgram.glGenProgramsARB(programBuffer); + fpID = ARBProgram.glGenProgramsARB(); - fpID = programBuffer.get(0); - ARBProgram.glBindProgramARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, fpID); ARBProgram.glProgramStringARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, ARBProgram.GL_PROGRAM_FORMAT_ASCII_ARB, fpSource); @@ -104,11 +100,8 @@ } void cleanup() { - programBuffer.put(0, vpID); - ARBProgram.glDeleteProgramsARB(programBuffer); - - programBuffer.put(0, fpID); - ARBProgram.glDeleteProgramsARB(programBuffer); + ARBProgram.glDeleteProgramsARB(vpID); + ARBProgram.glDeleteProgramsARB(fpID); } } \ No newline at end of file Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFSH.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFSH.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFSH.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -70,8 +70,7 @@ printShaderObjectInfoLog(this.vshFile, vshID); - ARBShaderObjects.glGetObjectParameterARB(vshID, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB, programBuffer); - if ( programBuffer.get(0) == GL11.GL_FALSE ) + if ( ARBShaderObjects.glGetObjectParameteriARB(vshID, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE ) ShadersTest.kill("A compilation error occured in a vertex shader."); // Initialize the fragment shader. @@ -84,8 +83,7 @@ printShaderObjectInfoLog(this.fshFile, fshID); - ARBShaderObjects.glGetObjectParameterARB(fshID, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB, programBuffer); - if ( programBuffer.get(0) == GL11.GL_FALSE ) + if ( ARBShaderObjects.glGetObjectParameteriARB(fshID, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE ) ShadersTest.kill("A compilation error occured in a fragment shader."); // Initialize the shader program. @@ -98,8 +96,7 @@ printShaderProgramInfoLog(programID); - ARBShaderObjects.glGetObjectParameterARB(programID, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB, programBuffer); - if ( programBuffer.get(0) == GL11.GL_FALSE ) + if ( ARBShaderObjects.glGetObjectParameteriARB(programID, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE ) ShadersTest.kill("A linking error occured in a shader program."); uniformLocation = getUniformLocation(programID, "UNIFORMS"); Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -70,8 +70,7 @@ printShaderObjectInfoLog(file, shaderID); - GL20.glGetShader(shaderID, GL20.GL_COMPILE_STATUS, programBuffer); - if ( programBuffer.get(0) == GL11.GL_FALSE ) + if ( GL20.glGetShader(shaderID, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE ) ShadersTest.kill("A compilation error occured in a vertex shader."); programID = GL20.glCreateProgram(); @@ -81,27 +80,19 @@ printShaderProgramInfoLog(programID); - GL20.glGetProgram(programID, GL20.GL_LINK_STATUS, programBuffer); - if ( programBuffer.get(0) == GL11.GL_FALSE ) + if ( GL20.glGetProgram(programID, GL20.GL_LINK_STATUS) == GL11.GL_FALSE ) ShadersTest.kill("A linking error occured in a shader program."); final String[] uniformNames = { "uniformA", "uniformB" }; - IntBuffer indexes = BufferUtils.createIntBuffer(uniformNames.length); - IntBuffer params = BufferUtils.createIntBuffer(uniformNames.length); - IntBuffer getBuffer = BufferUtils.createIntBuffer(16); - IntBuffer buffers = BufferUtils.createIntBuffer(1); - // Get uniform block index and data size final int blockIndex = ARBUniformBufferObject.glGetUniformBlockIndex(programID, "test"); - ARBUniformBufferObject.glGetActiveUniformBlock(programID, blockIndex, ARBUniformBufferObject.GL_UNIFORM_BLOCK_DATA_SIZE, getBuffer); - final int blockSize = getBuffer.get(0); + final int blockSize = ARBUniformBufferObject.glGetActiveUniformBlock(programID, blockIndex, ARBUniformBufferObject.GL_UNIFORM_BLOCK_DATA_SIZE); System.out.println("blockSize = " + blockSize); // Create uniform buffer object and allocate a ByteBuffer - GL15.glGenBuffers(buffers); - bufferID = buffers.get(0); + bufferID = GL15.glGenBuffers(); GL15.glBindBuffer(ARBUniformBufferObject.GL_UNIFORM_BUFFER, bufferID); GL15.glBufferData(ARBUniformBufferObject.GL_UNIFORM_BUFFER, blockSize, GL15.GL_DYNAMIC_DRAW); buffer = BufferUtils.createFloatBuffer(blockSize); @@ -111,6 +102,9 @@ ARBUniformBufferObject.glUniformBlockBinding(programID, blockIndex, 0); // Get uniform information + IntBuffer indexes = BufferUtils.createIntBuffer(uniformNames.length); + IntBuffer params = BufferUtils.createIntBuffer(uniformNames.length); + ARBUniformBufferObject.glGetUniformIndices(programID, uniformNames, indexes); uniformA_index = indexes.get(0); uniformB_index = indexes.get(1); Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVP.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVP.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVP.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -53,10 +53,8 @@ file = shaderFile; source = getShaderText(shaderFile); - ARBProgram.glGenProgramsARB(programBuffer); + ID = ARBProgram.glGenProgramsARB(); - ID = programBuffer.get(0); - ARBProgram.glBindProgramARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, ID); ARBProgram.glProgramStringARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, ARBProgram.GL_PROGRAM_FORMAT_ASCII_ARB, source); @@ -76,8 +74,7 @@ } void cleanup() { - programBuffer.put(0, ID); - ARBProgram.glDeleteProgramsARB(programBuffer); + ARBProgram.glDeleteProgramsARB(ID); } } \ No newline at end of file Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVSH.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVSH.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVSH.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -38,8 +38,6 @@ package org.lwjgl.test.opengl.shaders; -import java.nio.ByteBuffer; - import org.lwjgl.opengl.ARBShaderObjects; import org.lwjgl.opengl.ARBVertexShader; import org.lwjgl.opengl.GL11; @@ -64,8 +62,7 @@ printShaderObjectInfoLog(file, shaderID); - ARBShaderObjects.glGetObjectParameterARB(shaderID, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB, programBuffer); - if ( programBuffer.get(0) == GL11.GL_FALSE ) + if ( ARBShaderObjects.glGetObjectParameteriARB(shaderID, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE ) ShadersTest.kill("A compilation error occured in a vertex shader."); programID = ARBShaderObjects.glCreateProgramObjectARB(); @@ -75,8 +72,7 @@ printShaderProgramInfoLog(programID); - ARBShaderObjects.glGetObjectParameterARB(programID, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB, programBuffer); - if ( programBuffer.get(0) == GL11.GL_FALSE ) + if ( ARBShaderObjects.glGetObjectParameteriARB(programID, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE ) ShadersTest.kill("A linking error occured in a shader program."); uniformLocation = getUniformLocation(programID, "UNIFORMS"); Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Constant.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/Constant.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Constant.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -44,4 +44,6 @@ @Target(ElementType.PARAMETER) public @interface Constant { String value(); + /** If true, the original parameter will not be removed from the method. */ + boolean keepParam() default false; } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -220,7 +220,7 @@ else if ( type.equals(boolean.class) ) return new Class[] { GLboolean.class }; else if ( type.equals(void.class) ) - return new Class[] { GLvoid.class, GLstring.class }; + return new Class[] { GLvoid.class, GLreturn.class }; else return new Class[] { }; } @@ -244,7 +244,7 @@ else if ( PointerWrapper.class.isAssignableFrom(type) ) valid_types = new Class[] { GLpointer.class }; else if (void.class.equals(type) ) - valid_types = new Class[] { GLstring.class }; + valid_types = new Class[] { GLreturn.class }; else valid_types = new Class[] { }; return valid_types; Copied: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLreturn.java (from rev 3281, trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstring.java) =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLreturn.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLreturn.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator; + +/** + * When a method is annonated with @GLreturn, the specified output Buffer parameter + * will be used to return a single value. The primitive type will match the Buffer type. + * String will be returned if the Buffer is a ByteBuffer annotated with @GLchar. + * + * @author spasi + */ +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@NativeType +@Target({ ElementType.METHOD }) +public @interface GLreturn { + /** The Buffer parameter to use as the method result. */ + String value(); + /** The argument that specifies the maximum number of bytes that may be read (String results only). */ + String maxLength() default ""; + /** If true, the maxLength value is going to be used when creating the String. */ + boolean forceMaxLength() default false; + ///** If we use the byte buffer for another parameter, an offset must be used. */ + //String offset() default ""; +} \ No newline at end of file Deleted: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstring.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstring.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstring.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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.util.generator; - -/** - * Methods annotated with @GLstring will return a String instead of void. - * - * @author spasi - */ - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -@NativeType -@Target({ ElementType.METHOD }) -public @interface GLstring { - /** The ByteBuffer argument that will be used to retrieve the String bytes. */ - String string(); - /** The argument that specifies the maximum number of bytes that may be read. */ - String maxLength(); -} \ No newline at end of file Deleted: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstringOffset.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstringOffset.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstringOffset.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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.util.generator; - -/** - * This annotation must be used when there are more than one CharSequence arguments in a method. - * TODO: Add support for CharSequence[] if/when we need it. - * - * @author spasi - */ - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -@Target({ ElementType.PARAMETER }) -public @interface GLstringOffset { - /** An expression that will specify the offset from which this String will be written to the ByteBuffer. */ - String value(); -} \ No newline at end of file Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -105,17 +105,19 @@ } if (typemap_classname == null) throw new RuntimeException("No TypeMap class name specified with -Atypemap=<class-name>"); + + TypeDeclaration lastFile = null; try { TypeMap type_map = (TypeMap)(Class.forName(typemap_classname).newInstance()); for (TypeDeclaration typedecl : env.getSpecifiedTypeDeclarations()) { + lastFile = typedecl; typedecl.accept(getDeclarationScanner(new GeneratorVisitor(env, type_map, generate_error_checks, context_specific), NO_OP)); } - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } catch (InstantiationException e) { - throw new RuntimeException(e); - } catch (ClassNotFoundException e) { - throw new RuntimeException(e); + } catch (Exception e) { + if ( lastFile == null ) + throw new RuntimeException(e); + else + throw new RuntimeException("\n-- Failed to process template: " + lastFile.getQualifiedName() + " --", e); } } } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -81,7 +81,7 @@ throw new RuntimeException("Method " + method.getSimpleName() + " throws checked exceptions"); validateParameters(method); StripPostfix strip_annotation = method.getAnnotation(StripPostfix.class); - if (strip_annotation != null) { + if (strip_annotation != null && method.getAnnotation(Alternate.class) == null) { String postfix_param_name = strip_annotation.value(); ParameterDeclaration postfix_param = Utils.findParameter(method, postfix_param_name); if (Utils.isParameterMultiTyped(postfix_param)) @@ -142,9 +142,9 @@ if (!found_auto_size_param && param.getAnnotation(Result.class) == null && param.getAnnotation(Constant.class) == null - && !Utils.isReturnString(method, param) + && !Utils.isReturnParameter(method, param) ) - throw new RuntimeException(param + " has no Check, Result nor Constant annotation and no other parameters has" + + throw new RuntimeException(param + " has no Check, Result nor Constant annotation, is not the return parameter and no other parameter has" + " an @AutoSize annotation on it in method " + method); } if (param.getAnnotation(CachedReference.class) != null && param.getAnnotation(Result.class) != null) @@ -249,10 +249,11 @@ } public void visitInterfaceDeclaration(InterfaceDeclaration d) { + File input = d.getPosition().file(); + File output = new File(env.getOptions().get("-s") + '/' + d.getPackage().getQualifiedName().replace('.', '/'), Utils.getSimpleClassName(d) + ".java"); + try { // Skip this class if the output exists and the input has not been modified. - File input = d.getPosition().file(); - File output = new File(env.getOptions().get("-s") + '/' + d.getPackage().getQualifiedName().replace('.', '/'), Utils.getSimpleClassName(d) + ".java"); if ( output.exists() && input.lastModified() < output.lastModified() ) return; @@ -260,7 +261,14 @@ generateJavaSource(d); if (d.getMethods().size() > 0) generateNativeSource(d); - } catch (IOException e) { + } catch (Exception e) { + try { + // If anything goes wrong mid-gen, delete output to allow regen next time we run. + if ( output.exists() ) + output.delete(); + } catch (Exception e2) { + // ignore + } throw new RuntimeException(e); } } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -122,7 +122,7 @@ } } else if ( param.getAnnotation(Result.class) == null - && (native_stub || (param.getAnnotation(Constant.class) == null && !Utils.isReturnString(method, param))) + && (native_stub || ((param.getAnnotation(Constant.class) == null || param.getAnnotation(Constant.class).keepParam()) && !Utils.isReturnParameter(method, param))) && (getAutoTypeParameter(method, param) == null || mode != Mode.AUTOS) ) { @@ -237,12 +237,9 @@ if ( method.getAnnotation(GLpointer.class) != null ) writer.print("new " + method.getReturnType() + "("); } - GLstring string_annotation = method.getAnnotation(GLstring.class); - if ( string_annotation != null ) { + if ( method.getAnnotation(GLreturn.class) != null ) { has_result = true; - writer.println("IntBuffer " + string_annotation.string() + "_length = StringUtils.getLengths(1);"); - writer.println("\t\tByteBuffer " + string_annotation.string() + " = StringUtils.getBuffer(" + string_annotation.maxLength() + ");"); - writer.print("\t\t"); + Utils.printGLReturnPre(writer, method, method.getAnnotation(GLreturn.class)); } writer.print(Utils.getSimpleNativeMethodName(method, generate_error_checks, context_specific)); if (mode == Mode.BUFFEROBJECT) @@ -262,12 +259,10 @@ // DISABLED: indirect buffer support //printNondirectParameterCopies(writer, method, mode); if (has_result) { - if ( string_annotation == null ) + if ( method.getAnnotation(GLreturn.class) == null ) writer.println("\t\treturn " + Utils.RESULT_VAR_NAME + ";"); - else { - writer.println("\t\t" + string_annotation.string() + ".limit(" + string_annotation.string() + "_length.get(0));"); - writer.println("\t\treturn StringUtils.getString(" + string_annotation.string() + ");"); - } + else + Utils.printGLReturnPost(writer, method, method.getAnnotation(GLreturn.class)); } writer.println("\t}"); } @@ -403,22 +398,20 @@ if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null) { writer.print(param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX); } else { + Class type = typeinfos_instance.get(param).getType(); boolean hide_buffer = mode == Mode.AUTOS && getAutoTypeParameter(method, param) != null; if (hide_buffer) writer.print("null"); else { - Class type = typeinfos_instance.get(param).getType(); if ( type == CharSequence.class || type == CharSequence[].class ) { - GLstringOffset offset_annotation = param.getAnnotation(GLstringOffset.class); + final String offset = Utils.getStringOffset(method, param); - writer.print("StringUtils.getBuffer"); - if ( offset_annotation != null ) - writer.print("Offset"); + writer.print("APIUtils.getBuffer"); if ( param.getAnnotation(NullTerminated.class) != null ) writer.print("NT"); writer.print("(" + param.getSimpleName()); - if ( offset_annotation != null ) - writer.print(", " + offset_annotation.value()); + if ( offset != null ) + writer.print(", " + offset); writer.print(")"); hide_buffer = true; } else @@ -443,9 +436,10 @@ writer.print(" << " + shifting); if (check_annotation != null && check_annotation.canBeNull()) writer.print(" : 0"); - } else if ( param.getAnnotation(GLstringOffset.class) != null ) - writer.print(param.getAnnotation(GLstringOffset.class).value()); - else + } else if ( type == CharSequence.class || type == CharSequence[].class ) { + final String offset = Utils.getStringOffset(method, param); + writer.print(offset == null ? "0" : offset); + } else writer.print("0"); } else if ( param.getAnnotation(GLpointer.class) != null ) { writer.print(".getPointer()"); @@ -531,7 +525,7 @@ (mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) && (mode != Mode.AUTOS || getAutoTypeParameter(method, param) == null) && param.getAnnotation(Result.class) == null && - !Utils.isReturnString(method, param) ) { + !Utils.isReturnParameter(method, param) ) { String check_value = null; boolean can_be_null = false; Check check_annotation = param.getAnnotation(Check.class); @@ -589,8 +583,8 @@ private static void printResultType(PrintWriter writer, MethodDeclaration method, boolean native_stub) { if ( native_stub && method.getAnnotation(GLpointer.class) != null ) writer.print("long"); - else if ( !native_stub && method.getAnnotation(GLstring.class) != null ) - writer.print("String"); + else if ( !native_stub && method.getAnnotation(GLreturn.class) != null ) + writer.print(Utils.getMethodReturnType(method, method.getAnnotation(GLreturn.class), false)); else writer.print(Utils.getMethodReturnType(method).toString()); } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -62,34 +62,31 @@ throw new RuntimeException(t + " is not allowed"); } - public void visitPrimitiveType(PrimitiveType t) { - switch (t.getKind()) { + public static Class getPrimitiveClassFromKind(PrimitiveType.Kind kind) { + switch ( kind ) { case LONG: - type = long.class; - break; + return long.class; case INT: - type = int.class; - break; + return int.class; case DOUBLE: - type = double.class; - break; + return double.class; case FLOAT: - type = float.class; - break; + return float.class; case SHORT: - type = short.class; - break; + return short.class; case BYTE: - type = byte.class; - break; + return byte.class; case BOOLEAN: - type = boolean.class; - break; + return boolean.class; default: - throw new RuntimeException(t.getKind() + " is not allowed"); + throw new RuntimeException(kind + " is not allowed"); } } + public void visitPrimitiveType(PrimitiveType t) { + type = getPrimitiveClassFromKind(t.getKind()); + } + public void visitDeclaredType(DeclaredType t) { throw new RuntimeException(t + " is not allowed"); } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/PostfixTranslator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/PostfixTranslator.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/PostfixTranslator.java 2010-03-14 23:24:40 UTC (rev 3287) @@ -71,17 +71,17 @@ } private static PrimitiveType.Kind getPrimitiveKindFromBufferClass(Class c) { - if (IntBuffer.class.equals(c)) + if (IntBuffer.class.equals(c) || int.class.equals(c) ) return PrimitiveType.Kind.INT; - else if (DoubleBuffer.class.equals(c)) + else if (DoubleBuffer.class.equals(c) || double.class.equals(c) ) return PrimitiveType.Kind.DOUBLE; - else if (ShortBuffer.class.equals(c)) + else if (ShortBuffer.class.equals(c) || short.class.equals(c) ) return PrimitiveType.Kind.SHORT; - else if (ByteBuffer.class.equals(c)) + else if (ByteBuffer.class.equals(c) || byte.class.equals(c) ) return PrimitiveType.Kind.BYTE; - else if (FloatBuffer.class.equals(c)) + else if (FloatBuffer.class.equals(c) || float.class.equals(c)) return PrimitiveType.Kind.FLOAT; - else if (LongBuffer.class.equals(c)) + else if (LongBuffer.class.equals(c) || long.class.equals(c) ) return PrimitiveType.Kind.LONG; else throw new RuntimeException(c + " is not allowed"); @@ -127,7 +127,7 @@ } public void visitPrimitiveType(PrimitiveType t) { - throw new RuntimeException(t + " is not allowed"); + visitPrimitiveTypeKind(t.getKind()); } private void visitPrimitiveTypeKind(PrimitiveType.Kind kind) { Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-03-14 00:19:48 UTC (rev 3286) +++ trunk/LWJ... [truncated message content] |
From: <sp...@us...> - 2010-03-14 00:20:01
|
Revision: 3286 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3286&view=rev Author: spasi Date: 2010-03-14 00:19:48 +0000 (Sun, 14 Mar 2010) Log Message: ----------- Added Charset encoding to StringUtils Changed shader tests to use the String APIs Finished ARB_uniform_buffer_object shader test Fixed native code compiler warnings Made the generator check file timestamps to avoid unnecessary 3+ min builds Modified Paths: -------------- trunk/LWJGL/platform_build/build-definitions.xml trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/Shader.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFSH.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVP.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVSH.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/shaderUNI.vsh trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java Modified: trunk/LWJGL/platform_build/build-definitions.xml =================================================================== --- trunk/LWJGL/platform_build/build-definitions.xml 2010-03-13 00:45:44 UTC (rev 3285) +++ trunk/LWJGL/platform_build/build-definitions.xml 2010-03-14 00:19:48 UTC (rev 3286) @@ -49,6 +49,7 @@ <include name="org/lwjgl/test/opengl/shaders/shaderFSH.vsh" /> <include name="org/lwjgl/test/opengl/shaders/shaderVP.vp" /> <include name="org/lwjgl/test/opengl/shaders/shaderVSH.vsh" /> + <include name="org/lwjgl/test/opengl/shaders/shaderUNI.vsh" /> </fileset> <!-- Files to include in the lwjgl_util.jar file --> Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java 2010-03-13 00:45:44 UTC (rev 3285) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java 2010-03-14 00:19:48 UTC (rev 3286) @@ -34,7 +34,10 @@ import org.lwjgl.BufferUtils; import java.nio.ByteBuffer; +import java.nio.CharBuffer; import java.nio.IntBuffer; +import java.nio.charset.Charset; +import java.nio.charset.CharsetEncoder; /** @author spasi */ final class StringUtils { @@ -60,6 +63,14 @@ } }; + private static final ThreadLocal infiniteSeqTL = new ThreadLocal() { + protected Object initialValue() { + return new InfiniteCharSequence(); + } + }; + + private static CharsetEncoder encoder = Charset.forName("US-ASCII").newEncoder(); + private StringUtils() { } @@ -129,14 +140,17 @@ return lengths; } - /* + static InfiniteCharSequence getInfiniteSeq() { + return (InfiniteCharSequence)infiniteSeqTL.get(); + } + + /** * Reads a byte string from the specified buffer. * * @param buffer * * @return the buffer as a String. */ - static String getString(final ByteBuffer buffer) { final int length = buffer.remaining(); final char[] charArray = getArray(length); @@ -147,6 +161,12 @@ return new String(charArray, 0, length); } + private static void encode(final ByteBuffer buffer, final CharSequence string) { + final InfiniteCharSequence infiniteSeq = getInfiniteSeq(); + infiniteSeq.setString(string); + encoder.encode(infiniteSeq.buffer, buffer, true); + } + /** * Returns a buffer containing the specified string as bytes. * @@ -157,8 +177,7 @@ static ByteBuffer getBuffer(final CharSequence string) { final ByteBuffer buffer = getBuffer(string.length()); - for ( int i = 0; i < string.length(); i++ ) - buffer.put((byte)string.charAt(i)); + encode(buffer, string); buffer.flip(); return buffer; @@ -174,8 +193,7 @@ static ByteBuffer getBufferOffset(final CharSequence string, final int offset) { final ByteBuffer buffer = getBufferOffset(offset + string.length()); - for ( int i = 0; i < string.length(); i++ ) - buffer.put((byte)string.charAt(i)); + encode(buffer, string); buffer.flip(); return buffer; @@ -191,14 +209,21 @@ static ByteBuffer getBufferNT(final CharSequence string) { final ByteBuffer buffer = getBuffer(string.length() + 1); - for ( int i = 0; i < string.length(); i++ ) - buffer.put((byte)string.charAt(i)); + encode(buffer, string); buffer.put((byte)0); buffer.flip(); return buffer; } + private static int getTotalLength(final CharSequence[] strings) { + int length = 0; + for ( int i = 0; i < strings.length; i++ ) + length += strings[i].length(); + + return length; + } + /** * Returns a buffer containing the specified strings as bytes. * @@ -207,17 +232,14 @@ * @return the Strings as a ByteBuffer */ static ByteBuffer getBuffer(final CharSequence[] strings) { - int length = 0; - for ( int i = 0; i < strings.length; i++ ) - length += strings[i].length(); + final ByteBuffer buffer = getBuffer(getTotalLength(strings)); - final ByteBuffer buffer = getBuffer(length); - + final InfiniteCharSequence infiniteSeq = getInfiniteSeq(); for ( int i = 0; i < strings.length; i++ ) { - final CharSequence string = strings[i]; - for ( int j = 0; j < string.length(); j++ ) - buffer.put((byte)string.charAt(i)); + infiniteSeq.setString(strings[i]); + encoder.encode(infiniteSeq.buffer, buffer, true); } + infiniteSeq.clear(); buffer.flip(); return buffer; @@ -231,18 +253,15 @@ * @return the Strings as a ByteBuffer */ static ByteBuffer getBufferNT(final CharSequence[] strings) { - int length = 0; - for ( int i = 0; i < strings.length; i++ ) - length += strings[i].length() + 1; + final ByteBuffer buffer = getBuffer(getTotalLength(strings) + strings.length); - final ByteBuffer buffer = getBuffer(length); - + final InfiniteCharSequence infiniteSeq = getInfiniteSeq(); for ( int i = 0; i < strings.length; i++ ) { - final CharSequence string = strings[i]; - for ( int j = 0; j < string.length(); j++ ) - buffer.put((byte)string.charAt(i)); + infiniteSeq.setString(strings[i]); + encoder.encode(infiniteSeq.buffer, buffer, true); buffer.put((byte)0); } + infiniteSeq.clear(); buffer.flip(); return buffer; @@ -265,4 +284,41 @@ return buffer; } + /** + * A mutable CharSequence with very large initial length. We can wrap this in a re-usable CharBuffer for decoding. + * We cannot subclass CharBuffer because of {@link CharBuffer#toString(int,int)}. + */ + private static class InfiniteCharSequence implements CharSequence { + + final CharBuffer buffer; + + CharSequence string; + + InfiniteCharSequence() { + buffer = CharBuffer.wrap(this); + } + + void setString(final CharSequence string) { + this.string = string; + this.buffer.position(0); + this.buffer.limit(string.length()); + } + + void clear() { + this.string = null; + } + + public int length() { + return Integer.MAX_VALUE; + } + + public char charAt(final int index) { + return string.charAt(index); + } + + public CharSequence subSequence(final int start, final int end) { + return string.subSequence(start, end); + } + } + } \ No newline at end of file Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/Shader.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/Shader.java 2010-03-13 00:45:44 UTC (rev 3285) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/Shader.java 2010-03-14 00:19:48 UTC (rev 3286) @@ -1,31 +1,31 @@ -/* +/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -73,8 +73,8 @@ return int_buffer.get(0); } - protected static ByteBuffer getShaderText(String file) { - ByteBuffer shader = null; + protected static String getShaderText(String file) { + String shader = null; try { ClassLoader loader = ShadersTest.class.getClassLoader(); @@ -93,10 +93,10 @@ fileBuffer.flip(); - shader = BufferUtils.createByteBuffer(fileBuffer.limit()); - shader.put(fileBuffer); + byte[] array = new byte[fileBuffer.remaining()]; + fileBuffer.get(array); + shader = new String(array); - shader.clear(); fileBuffer.clear(); } catch (IOException e) { ShadersTest.kill("Failed to read the shader source file: " + file, e); @@ -105,17 +105,13 @@ return shader; } - protected static void checkProgramError(String programFile, ByteBuffer programSource) { + protected static void checkProgramError(String programFile, String programSource) { if ( GL11.glGetError() == GL11.GL_INVALID_OPERATION ) { - programSource.clear(); - final byte[] bytes = new byte[programSource.capacity()]; - programSource.get(bytes); - final int errorPos = glGetInteger(ARBProgram.GL_PROGRAM_ERROR_POSITION_ARB); int lineStart = 0; int lineEnd = -1; - for ( int i = 0; i < bytes.length; i++ ) { - if ( bytes[i] == '\n' ) { + for ( int i = 0; i < programSource.length(); i++ ) { + if ( programSource.charAt(i) == '\n' ) { if ( i <= errorPos ) { lineStart = i + 1; } else { @@ -126,29 +122,17 @@ } if ( lineEnd == -1 ) - lineEnd = bytes.length; + lineEnd = programSource.length(); ShadersTest.kill("Low-level program error in file: " + programFile - + "\n\tError line: " + new String(bytes, lineStart, lineEnd - lineStart) + + "\n\tError line: " + programSource.substring(lineStart, lineEnd) + "\n\tError message: " + GL11.glGetString(ARBProgram.GL_PROGRAM_ERROR_STRING_ARB)); } } protected static int getUniformLocation(int ID, String name) { - fileBuffer.clear(); + final int location = ARBShaderObjects.glGetUniformLocationARB(ID, name); - int length = name.length(); - - char[] charArray = new char[length]; - name.getChars(0, length, charArray, 0); - - for ( int i = 0; i < length; i++ ) - fileBuffer.put((byte)charArray[i]); - fileBuffer.put((byte)0); // Must be null-terminated. - fileBuffer.flip(); - - final int location = ARBShaderObjects.glGetUniformLocationARB(ID, fileBuffer); - if ( location == -1 ) throw new IllegalArgumentException("The uniform \"" + name + "\" does not exist in the Shader Program."); @@ -159,42 +143,25 @@ ARBShaderObjects.glGetObjectParameterARB(ID, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB, programBuffer); final int logLength = programBuffer.get(0); - if ( logLength <= 1 ) return; - final ByteBuffer log = BufferUtils.createByteBuffer(logLength); - - ARBShaderObjects.glGetInfoLogARB(ID, null, log); - - final char[] charArray = new char[logLength]; - for ( int i = 0; i < logLength; i++ ) - charArray[i] = (char)log.get(); - System.out.println("\nInfo Log of Shader Object: " + file); System.out.println("--------------------------"); - System.out.println(new String(charArray, 0, logLength)); + System.out.println(ARBShaderObjects.glGetInfoLogARB(ID, logLength)); + } protected static void printShaderProgramInfoLog(int ID) { ARBShaderObjects.glGetObjectParameterARB(ID, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB, programBuffer); final int logLength = programBuffer.get(0); - if ( logLength <= 1 ) return; - final ByteBuffer log = BufferUtils.createByteBuffer(logLength); - - ARBShaderObjects.glGetInfoLogARB(ID, null, log); - - final char[] charArray = new char[logLength]; - for ( int i = 0; i < logLength; i++ ) - charArray[i] = (char)log.get(); - System.out.println("\nShader Program Info Log: "); System.out.println("--------------------------"); - System.out.println(new String(charArray, 0, logLength)); + System.out.println(ARBShaderObjects.glGetInfoLogARB(ID, logLength)); } } Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java 2010-03-13 00:45:44 UTC (rev 3285) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java 2010-03-14 00:19:48 UTC (rev 3286) @@ -1,31 +1,31 @@ -/* +/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -38,8 +38,6 @@ package org.lwjgl.test.opengl.shaders; -import java.nio.ByteBuffer; - import org.lwjgl.opengl.ARBFragmentProgram; import org.lwjgl.opengl.ARBProgram; import org.lwjgl.opengl.ARBVertexProgram; @@ -48,12 +46,12 @@ final class ShaderFP extends Shader { final String vpFile; - final ByteBuffer vpSource; + final String vpSource; final int vpID; final String fpFile; - final ByteBuffer fpSource; + final String fpSource; final int fpID; Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFSH.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFSH.java 2010-03-13 00:45:44 UTC (rev 3285) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderFSH.java 2010-03-14 00:19:48 UTC (rev 3286) @@ -1,31 +1,31 @@ -/* +/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -38,8 +38,6 @@ package org.lwjgl.test.opengl.shaders; -import java.nio.ByteBuffer; - import org.lwjgl.opengl.ARBFragmentShader; import org.lwjgl.opengl.ARBShaderObjects; import org.lwjgl.opengl.ARBVertexShader; @@ -48,12 +46,12 @@ final class ShaderFSH extends Shader { final String vshFile; - final ByteBuffer vshSource; + final String vshSource; final int vshID; final String fshFile; - final ByteBuffer fshSource; + final String fshSource; final int fshID; Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java 2010-03-13 00:45:44 UTC (rev 3285) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java 2010-03-14 00:19:48 UTC (rev 3286) @@ -38,24 +38,28 @@ package org.lwjgl.test.opengl.shaders; import org.lwjgl.BufferUtils; -import org.lwjgl.opengl.ARBUniformBufferObject; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL20; +import org.lwjgl.opengl.*; -import java.nio.ByteBuffer; +import java.nio.FloatBuffer; import java.nio.IntBuffer; final class ShaderUNI extends Shader { final String file; - final ByteBuffer source; + final String source; final int shaderID; final int programID; - final int uniformA; - final int uniformB; + final int bufferID; + final FloatBuffer buffer; + final int uniformA_index; + final int uniformA_offset; + + final int uniformB_index; + final int uniformB_offset; + ShaderUNI(final String shaderFile) { file = shaderFile; source = getShaderText(shaderFile); @@ -81,39 +85,74 @@ if ( programBuffer.get(0) == GL11.GL_FALSE ) ShadersTest.kill("A linking error occured in a shader program."); - uniformA = getUniformLocation(programID, "uniformA"); - uniformB = getUniformLocation(programID, "uniformB"); + final String[] uniformNames = { "uniformA", "uniformB" }; - String[] uniformNames = { "uniformA", "uniformB" }; - IntBuffer tmp = BufferUtils.createIntBuffer(uniformNames.length); + IntBuffer indexes = BufferUtils.createIntBuffer(uniformNames.length); + IntBuffer params = BufferUtils.createIntBuffer(uniformNames.length); + IntBuffer getBuffer = BufferUtils.createIntBuffer(16); + IntBuffer buffers = BufferUtils.createIntBuffer(1); - ARBUniformBufferObject.glGetUniformIndices(programID, toByteBuffer(uniformNames), tmp); + // Get uniform block index and data size + final int blockIndex = ARBUniformBufferObject.glGetUniformBlockIndex(programID, "test"); + ARBUniformBufferObject.glGetActiveUniformBlock(programID, blockIndex, ARBUniformBufferObject.GL_UNIFORM_BLOCK_DATA_SIZE, getBuffer); + final int blockSize = getBuffer.get(0); - System.out.println("uniformA index = " + tmp.get(0)); - System.out.println("uniformB index = " + tmp.get(1)); - } + System.out.println("blockSize = " + blockSize); - private static ByteBuffer toByteBuffer(String[] strs) { - int length = 0; - for ( int i = 0; i < strs.length; i++ ) - length += strs[i].length() + 1; // +1 for the NULL-character + // Create uniform buffer object and allocate a ByteBuffer + GL15.glGenBuffers(buffers); + bufferID = buffers.get(0); + GL15.glBindBuffer(ARBUniformBufferObject.GL_UNIFORM_BUFFER, bufferID); + GL15.glBufferData(ARBUniformBufferObject.GL_UNIFORM_BUFFER, blockSize, GL15.GL_DYNAMIC_DRAW); + buffer = BufferUtils.createFloatBuffer(blockSize); - final ByteBuffer buff = BufferUtils.createByteBuffer(length); - for ( int i = 0; i < strs.length; i++ ) { - buff.put(strs[i].getBytes()); - buff.put((byte)0); // The ending NULL-character - } - buff.flip(); + // Attach UBO and associate uniform block to binding point 0 + ARBUniformBufferObject.glBindBufferBase(ARBUniformBufferObject.GL_UNIFORM_BUFFER, 0, bufferID); + ARBUniformBufferObject.glUniformBlockBinding(programID, blockIndex, 0); - return buff; + // Get uniform information + ARBUniformBufferObject.glGetUniformIndices(programID, uniformNames, indexes); + uniformA_index = indexes.get(0); + uniformB_index = indexes.get(1); + + ARBUniformBufferObject.glGetActiveUniforms(programID, indexes, ARBUniformBufferObject.GL_UNIFORM_OFFSET, params); + uniformA_offset = params.get(0); + uniformB_offset = params.get(1); + + System.out.println("\nuniformA index = " + uniformA_index); + System.out.println("uniformB index = " + uniformB_index); + + System.out.println("\nuniformA offset = " + uniformA_offset + " - should be 0 for std140"); + System.out.println("uniformB offset = " + uniformB_offset + " - should be 16 for std140"); + + Util.checkGLError(); } void render() { GL20.glUseProgram(programID); - GL20.glUniform2f(uniformA, ShadersTest.getSin(), ShadersTest.getSpecularity() * 8.0f); - GL20.glUniform3f(uniformB, 0.0f, 0.7f, 0.0f); + //* -- std140 layout + // Uniform A + buffer.put(0, ShadersTest.getSin()).put(1, ShadersTest.getSpecularity() * 8.0f); + // Uniform B - str140 alignment at 16 bytes + buffer.put(4, 0.0f).put(5, 0.7f).put(6, 0.0f); + GL15.glBindBuffer(ARBUniformBufferObject.GL_UNIFORM_BUFFER, bufferID); + GL15.glBufferData(ARBUniformBufferObject.GL_UNIFORM_BUFFER, buffer, GL15.GL_DYNAMIC_DRAW); + //*/ + + /* -- non-std140 layout + // Uniform A + buffer.put(ShadersTest.getSin()).put(ShadersTest.getSpecularity() * 8.0f); + buffer.flip(); + GL15.glBufferSubData(ARBUniformBufferObject.GL_UNIFORM_BUFFER, uniformA_offset, buffer); + // Uniform B + buffer.clear(); + buffer.put(0.0f).put(0.7f).put(0.0f); + buffer.flip(); + GL15.glBufferSubData(ARBUniformBufferObject.GL_UNIFORM_BUFFER, uniformB_offset, buffer); + //*/ + ShadersTest.renderObject(); GL20.glUseProgram(0); Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVP.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVP.java 2010-03-13 00:45:44 UTC (rev 3285) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVP.java 2010-03-14 00:19:48 UTC (rev 3286) @@ -1,31 +1,31 @@ -/* +/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -38,8 +38,6 @@ package org.lwjgl.test.opengl.shaders; -import java.nio.ByteBuffer; - import org.lwjgl.opengl.ARBProgram; import org.lwjgl.opengl.ARBVertexProgram; import org.lwjgl.opengl.GL11; @@ -47,7 +45,7 @@ final class ShaderVP extends Shader { final String file; - final ByteBuffer source; + final String source; final int ID; Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVSH.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVSH.java 2010-03-13 00:45:44 UTC (rev 3285) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderVSH.java 2010-03-14 00:19:48 UTC (rev 3286) @@ -1,31 +1,31 @@ -/* +/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -47,7 +47,7 @@ final class ShaderVSH extends Shader { final String file; - final ByteBuffer source; + final String source; final int shaderID; final int programID; Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java 2010-03-13 00:45:44 UTC (rev 3285) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java 2010-03-14 00:19:48 UTC (rev 3286) @@ -141,35 +141,37 @@ kill(e.getMessage()); } + final ContextCapabilities caps = GLContext.getCapabilities(); + if ( "NONE".equalsIgnoreCase(args[0]) ) { shader = null; } else if ( "VP".equalsIgnoreCase(args[0]) ) { - if ( !GLContext.getCapabilities().GL_ARB_vertex_program ) + if ( !caps.GL_ARB_vertex_program ) kill("The ARB_vertex_program extension is not supported."); shader = new ShaderVP("shaderVP.vp"); } else if ( "FP".equalsIgnoreCase(args[0]) ) { - if ( !GLContext.getCapabilities().GL_ARB_vertex_program ) + if ( !caps.GL_ARB_vertex_program ) kill("The ARB_vertex_program extension is not supported."); - if ( !GLContext.getCapabilities().GL_ARB_fragment_program ) + if ( !caps.GL_ARB_fragment_program ) kill("The ARB_fragment_program extension is not supported."); shader = new ShaderFP("shaderFP.vp", "shaderFP.fp"); } else if ( "VSH".equalsIgnoreCase(args[0]) ) { - if ( !GLContext.getCapabilities().GL_ARB_vertex_shader ) + if ( !caps.GL_ARB_vertex_shader ) kill("The ARB_vertex_shader extension is not supported."); shader = new ShaderVSH("shaderVSH.vsh"); } else if ( "FSH".equalsIgnoreCase(args[0]) ) { - if ( !GLContext.getCapabilities().GL_ARB_vertex_shader ) + if ( !caps.GL_ARB_vertex_shader ) kill("The ARB_vertex_shader extension is not supported."); - if ( !GLContext.getCapabilities().GL_ARB_fragment_shader ) + if ( !caps.GL_ARB_fragment_shader ) kill("The ARB_fragment_shader extension is not supported."); shader = new ShaderFSH("shaderFSH.vsh", "shaderFSH.fsh"); } else if ("UNI".equalsIgnoreCase(args[0]) ) { - if ( !GLContext.getCapabilities().OpenGL31 ) - kill("OpenGL version 3.1 is not supported."); + if ( !(caps.OpenGL31 || caps.GL_ARB_uniform_buffer_object) ) + kill("Neither OpenGL version 3.1 nor ARB_uniform_buffer_object are supported."); shader = new ShaderUNI("shaderUNI.vsh"); } else { @@ -316,6 +318,7 @@ System.out.println("vsh\t- Use ARB_vertex_shader (GLSL) only."); System.out.println("fp\t- Use ARB_vertex_program + ARB_fragment_program (low-level)."); System.out.println("fsh\t- Use ARB_vertex_shader + ARB_fragment_shader (GLSL)."); + System.out.println("uni\t- Use ARB_uniform_buffer_object to update shader uniforms (GLSL)."); cleanup(); System.exit(-1); Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/shaderUNI.vsh =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/shaderUNI.vsh 2010-03-13 00:45:44 UTC (rev 3285) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/shaderUNI.vsh 2010-03-14 00:19:48 UTC (rev 3286) @@ -1,7 +1,10 @@ #version 140 +#extension GL_ARB_uniform_buffer_object : enable -uniform vec2 uniformA; -uniform vec3 uniformB; +layout(std140) uniform test { + vec2 uniformA; + vec3 uniformB; +}; void main(void) { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-13 00:45:44 UTC (rev 3285) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-14 00:19:48 UTC (rev 3286) @@ -250,6 +250,12 @@ public void visitInterfaceDeclaration(InterfaceDeclaration d) { try { + // Skip this class if the output exists and the input has not been modified. + File input = d.getPosition().file(); + File output = new File(env.getOptions().get("-s") + '/' + d.getPackage().getQualifiedName().replace('.', '/'), Utils.getSimpleClassName(d) + ".java"); + if ( output.exists() && input.lastModified() < output.lastModified() ) + return; + if (d.getMethods().size() > 0 || d.getFields().size() > 0) generateJavaSource(d); if (d.getMethods().size() > 0) Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2010-03-13 00:45:44 UTC (rev 3285) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2010-03-14 00:19:48 UTC (rev 3286) @@ -161,7 +161,7 @@ } else if (String.class.equals(java_result_type)) { writer.print("NewStringNativeUnsigned(env, "); } else if ( method.getAnnotation(GLpointer.class) != null ) { - writer.print("(jlong)"); + writer.print("(intptr_t)"); } writer.print(Utils.RESULT_VAR_NAME); if (Buffer.class.isAssignableFrom(java_result_type)) { @@ -192,8 +192,8 @@ } private static void generateCallParameter(PrintWriter writer, TypeMap type_map, ParameterDeclaration param) { - boolean is_indirect = param.getAnnotation(Indirect.class) != null || param.getAnnotation(StringList.class) != null; - if (is_indirect) { + boolean is_indirect = param.getAnnotation(Indirect.class) != null; + if (is_indirect || param.getAnnotation(StringList.class) != null) { writer.print("("); NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param); param.getType().accept(translator); @@ -201,7 +201,7 @@ writer.print("*)"); } if ( param.getAnnotation(GLpointer.class) != null ) - writer.print("(" + param.getAnnotation(GLpointer.class).value() + ")"); + writer.print("(" + param.getAnnotation(GLpointer.class).value() + ")(intptr_t)"); if (param.getAnnotation(Result.class) != null || is_indirect) writer.print("&"); if (param.getAnnotation(Result.class) != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sp...@us...> - 2010-03-13 00:45:50
|
Revision: 3285 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3285&view=rev Author: spasi Date: 2010-03-13 00:45:44 +0000 (Sat, 13 Mar 2010) Log Message: ----------- String support for ProgramStringARB. Modified Paths: -------------- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_program.java Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_program.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_program.java 2010-03-12 23:35:55 UTC (rev 3284) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_program.java 2010-03-13 00:45:44 UTC (rev 3285) @@ -33,19 +33,18 @@ import org.lwjgl.util.generator.*; -import java.nio.*; +import java.nio.Buffer; +import java.nio.DoubleBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; @Extension(postfix = "ARB", isFinal = false) public interface ARB_program { - /** - * Accepted by the <format> parameter of ProgramStringARB: - */ + /** Accepted by the <format> parameter of ProgramStringARB: */ int GL_PROGRAM_FORMAT_ASCII_ARB = 0x8875; - /** - * Accepted by the <pname> parameter of GetProgramivARB: - */ + /** Accepted by the <pname> parameter of GetProgramivARB: */ int GL_PROGRAM_LENGTH_ARB = 0x8627; int GL_PROGRAM_FORMAT_ARB = 0x8876; int GL_PROGRAM_BINDING_ARB = 0x8677; @@ -69,9 +68,7 @@ int GL_MAX_PROGRAM_ENV_PARAMETERS_ARB = 0x88B5; int GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB = 0x88B6; - /** - * Accepted by the <pname> parameter of GetProgramStringARB: - */ + /** Accepted by the <pname> parameter of GetProgramStringARB: */ int GL_PROGRAM_STRING_ARB = 0x8628; /** @@ -85,14 +82,10 @@ int GL_MAX_PROGRAM_MATRICES_ARB = 0x862F; int GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB = 0x862E; - /** - * Accepted by the <name> parameter of GetString: - */ + /** Accepted by the <name> parameter of GetString: */ int GL_PROGRAM_ERROR_STRING_ARB = 0x8874; - /** - * Accepted by the <mode> parameter of MatrixMode: - */ + /** Accepted by the <mode> parameter of MatrixMode: */ int GL_MATRIX0_ARB = 0x88C0; int GL_MATRIX1_ARB = 0x88C1; int GL_MATRIX2_ARB = 0x88C2; @@ -128,6 +121,9 @@ void glProgramStringARB(@GLenum int target, @GLenum int format, @AutoSize("string") @GLsizei int length, @Const @GLbyte Buffer string); + @Alternate("glProgramStringARB") + void glProgramStringARB(@GLenum int target, @GLenum int format, @Constant("string.length()") @GLsizei int length, CharSequence string); + void glBindProgramARB(@GLenum int target, @GLuint int program); void glDeleteProgramsARB(@AutoSize("programs") @GLsizei int n, @Const @GLuint IntBuffer programs); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sp...@us...> - 2010-03-12 23:36:21
|
Revision: 3284 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3284&view=rev Author: spasi Date: 2010-03-12 23:35:55 +0000 (Fri, 12 Mar 2010) Log Message: ----------- Force Indirect for StringLists Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2010-03-12 22:20:25 UTC (rev 3283) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2010-03-12 23:35:55 UTC (rev 3284) @@ -192,7 +192,7 @@ } private static void generateCallParameter(PrintWriter writer, TypeMap type_map, ParameterDeclaration param) { - boolean is_indirect = param.getAnnotation(Indirect.class) != null; + boolean is_indirect = param.getAnnotation(Indirect.class) != null || param.getAnnotation(StringList.class) != null; if (is_indirect) { writer.print("("); NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sp...@us...> - 2010-03-12 22:20:34
|
Revision: 3283 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3283&view=rev Author: spasi Date: 2010-03-12 22:20:25 +0000 (Fri, 12 Mar 2010) Log Message: ----------- Cleaned imports. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-03-12 22:14:11 UTC (rev 3282) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-03-12 22:20:25 UTC (rev 3283) @@ -46,13 +46,7 @@ import java.nio.ByteBuffer; import java.util.*; -import javax.lang.model.util.SimpleTypeVisitor6; - import com.sun.mirror.declaration.*; -import com.sun.mirror.type.PrimitiveType.Kind; -import com.sun.mirror.util.SimpleTypeVisitor; -import com.sun.mirror.util.TypeVisitor; -import com.sun.mirror.util.Types; public class Utils { public static final String TYPEDEF_POSTFIX = "PROC"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sp...@us...> - 2010-03-12 22:14:18
|
Revision: 3282 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3282&view=rev Author: spasi Date: 2010-03-12 22:14:11 +0000 (Fri, 12 Mar 2010) Log Message: ----------- Address var fix. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2010-03-12 21:55:13 UTC (rev 3281) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2010-03-12 22:14:11 UTC (rev 3282) @@ -301,7 +301,7 @@ writer.println("\twhile ( _str_i < " + stringList_annotation.value() + " ) {"); if ( lengths.length() == 0 ) { writer.println("\t\t" + param.getSimpleName() + STRING_LIST_POSTFIX + "[_str_i++] = _str_address;"); - writer.println("\t\t_str_address += strlen(_str_address_next) + 1;"); + writer.println("\t\t_str_address += strlen(_str_address) + 1;"); } else { writer.println("\t\t" + param.getSimpleName() + STRING_LIST_POSTFIX + "[_str_i] = _str_address;"); writer.println("\t\t_str_address += " + lengths + BUFFER_ADDRESS_POSTFIX + "[_str_i++];"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sp...@us...> - 2010-03-12 21:55:21
|
Revision: 3281 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3281&view=rev Author: spasi Date: 2010-03-12 21:55:13 +0000 (Fri, 12 Mar 2010) Log Message: ----------- Added support for Strings! (WIP, needs more testing) Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java trunk/LWJGL/src/java/org/lwjgl/util/generator/JNITypeTranslator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/StringList.java trunk/LWJGL/src/java/org/lwjgl/util/generator/TypedefsGenerator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.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/EXT_gpu_shader4.java trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_separate_shader_objects.java trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL33.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_transform_feedback.java Added Paths: ----------- trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstring.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstringOffset.java Added: trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/StringUtils.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -0,0 +1,268 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.BufferUtils; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +/** @author spasi */ +final class StringUtils { + + private static final int INITIAL_BUFFER_SIZE = 256; + private static final int INITIAL_LENGTHS_SIZE = 4; + + private static final ThreadLocal arrayTL = new ThreadLocal() { + protected Object initialValue() { + return new char[INITIAL_BUFFER_SIZE]; + } + }; + + private static final ThreadLocal bufferTL = new ThreadLocal() { + protected Object initialValue() { + return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); + } + }; + + private static final ThreadLocal lengthsTL = new ThreadLocal() { + protected Object initialValue() { + return BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE); + } + }; + + private StringUtils() { + } + + private static char[] getArray(final int size) { + char[] array = (char[])arrayTL.get(); + + if ( array.length < size ) { + int sizeNew = array.length << 1; + while ( sizeNew < size ) + sizeNew <<= 1; + + array = new char[size]; + arrayTL.set(array); + } + + return array; + } + + static ByteBuffer getBuffer(final int size) { + ByteBuffer buffer = (ByteBuffer)bufferTL.get(); + + if ( buffer.capacity() < size ) { + int sizeNew = buffer.capacity() << 1; + while ( sizeNew < size ) + sizeNew <<= 1; + + buffer = BufferUtils.createByteBuffer(size); + bufferTL.set(buffer); + } + + buffer.clear(); + return buffer; + } + + private static ByteBuffer getBufferOffset(final int size) { + ByteBuffer buffer = (ByteBuffer)bufferTL.get(); + + if ( buffer.capacity() < size ) { + int sizeNew = buffer.capacity() << 1; + while ( sizeNew < size ) + sizeNew <<= 1; + + final ByteBuffer bufferNew = BufferUtils.createByteBuffer(size); + bufferNew.put(buffer); + bufferTL.set(buffer = bufferNew); + } else { + buffer.position(buffer.limit()); + buffer.limit(buffer.capacity()); + } + + return buffer; + } + + static IntBuffer getLengths(final int size) { + IntBuffer lengths = (IntBuffer)lengthsTL.get(); + + if ( lengths.capacity() < size ) { + int sizeNew = lengths.capacity(); + while ( sizeNew < size ) + sizeNew <<= 1; + + lengths = BufferUtils.createIntBuffer(size); + lengthsTL.set(lengths); + } + + lengths.clear(); + return lengths; + } + + /* + * Reads a byte string from the specified buffer. + * + * @param buffer + * + * @return the buffer as a String. + */ + + static String getString(final ByteBuffer buffer) { + final int length = buffer.remaining(); + final char[] charArray = getArray(length); + + for ( int i = buffer.position(); i < buffer.limit(); i++ ) + charArray[i - buffer.position()] = (char)buffer.get(i); + + return new String(charArray, 0, length); + } + + /** + * Returns a buffer containing the specified string as bytes. + * + * @param string + * + * @return the String as a ByteBuffer + */ + static ByteBuffer getBuffer(final CharSequence string) { + final ByteBuffer buffer = getBuffer(string.length()); + + for ( int i = 0; i < string.length(); i++ ) + buffer.put((byte)string.charAt(i)); + + buffer.flip(); + return buffer; + } + + /** + * Returns a buffer containing the specified string as bytes, starting at the specified offset. + * + * @param string + * + * @return the String as a ByteBuffer + */ + static ByteBuffer getBufferOffset(final CharSequence string, final int offset) { + final ByteBuffer buffer = getBufferOffset(offset + string.length()); + + for ( int i = 0; i < string.length(); i++ ) + buffer.put((byte)string.charAt(i)); + + buffer.flip(); + return buffer; + } + + /** + * Returns a buffer containing the specified string as bytes, including null-termination. + * + * @param string + * + * @return the String as a ByteBuffer + */ + static ByteBuffer getBufferNT(final CharSequence string) { + final ByteBuffer buffer = getBuffer(string.length() + 1); + + for ( int i = 0; i < string.length(); i++ ) + buffer.put((byte)string.charAt(i)); + + buffer.put((byte)0); + buffer.flip(); + return buffer; + } + + /** + * Returns a buffer containing the specified strings as bytes. + * + * @param strings + * + * @return the Strings as a ByteBuffer + */ + static ByteBuffer getBuffer(final CharSequence[] strings) { + int length = 0; + for ( int i = 0; i < strings.length; i++ ) + length += strings[i].length(); + + final ByteBuffer buffer = getBuffer(length); + + for ( int i = 0; i < strings.length; i++ ) { + final CharSequence string = strings[i]; + for ( int j = 0; j < string.length(); j++ ) + buffer.put((byte)string.charAt(i)); + } + + buffer.flip(); + return buffer; + } + + /** + * Returns a buffer containing the specified strings as bytes, including null-termination. + * + * @param strings + * + * @return the Strings as a ByteBuffer + */ + static ByteBuffer getBufferNT(final CharSequence[] strings) { + int length = 0; + for ( int i = 0; i < strings.length; i++ ) + length += strings[i].length() + 1; + + final ByteBuffer buffer = getBuffer(length); + + for ( int i = 0; i < strings.length; i++ ) { + final CharSequence string = strings[i]; + for ( int j = 0; j < string.length(); j++ ) + buffer.put((byte)string.charAt(i)); + buffer.put((byte)0); + } + + buffer.flip(); + return buffer; + } + + /** + * Returns a buffer containing the lengths of the specified strings. + * + * @param strings + * + * @return the String lengths in an IntBuffer + */ + static IntBuffer getLengths(final CharSequence[] strings) { + IntBuffer buffer = getLengths(strings.length); + + for ( int i = 0; i < strings.length; i++ ) + buffer.put(strings[i].length()); + + buffer.flip(); + return buffer; + } + +} \ No newline at end of file Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java 2010-03-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -42,6 +42,10 @@ */ @Target({ ElementType.METHOD }) public @interface Alternate { + /** This must match an existing GL method name. */ String value(); + + /** If true, an alternate Java->native call will be created. Useful when the alternate implementation uses different types. */ + boolean nativeAlt() default false; } \ No newline at end of file Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2010-03-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -210,8 +210,18 @@ writer.println(") {"); writer.println("\t\treturn "); + + boolean first = true; while ( methods.hasNext() ) { MethodDeclaration method = methods.next(); + if ( method.getAnnotation(Alternate.class) != null ) + continue; + + if ( !first ) + writer.println(" &&"); + else + first = false; + optional = method.getAnnotation(Optional.class) != null; deprecated = method.getAnnotation(DeprecatedGL.class) != null; dependent = method.getAnnotation(Dependent.class); @@ -261,8 +271,6 @@ writer.print(')'); if ( optional ) writer.print(" || true)"); - if ( methods.hasNext() ) - writer.println(" &&"); } writer.println(";"); writer.println("\t}"); @@ -271,7 +279,8 @@ public static void generateSymbolAddresses(PrintWriter writer, InterfaceDeclaration d) { for ( MethodDeclaration method : d.getMethods() ) { - writer.println("\tlong " + Utils.getFunctionAddressName(d, method) + ";"); + if ( method.getAnnotation(Alternate.class) == null ) + writer.println("\tlong " + Utils.getFunctionAddressName(d, method) + ";"); } } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java 2010-03-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -220,7 +220,7 @@ else if ( type.equals(boolean.class) ) return new Class[] { GLboolean.class }; else if ( type.equals(void.class) ) - return new Class[] { GLvoid.class }; + return new Class[] { GLvoid.class, GLstring.class }; else return new Class[] { }; } @@ -243,6 +243,8 @@ valid_types = new Class[] { GLubyte.class }; else if ( PointerWrapper.class.isAssignableFrom(type) ) valid_types = new Class[] { GLpointer.class }; + else if (void.class.equals(type) ) + valid_types = new Class[] { GLstring.class }; else valid_types = new Class[] { }; return valid_types; Added: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstring.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstring.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstring.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator; + +/** + * Methods annotated with @GLstring will return a String instead of void. + * + * @author spasi + */ + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@NativeType +@Target({ ElementType.METHOD }) +public @interface GLstring { + /** The ByteBuffer argument that will be used to retrieve the String bytes. */ + String string(); + /** The argument that specifies the maximum number of bytes that may be read. */ + String maxLength(); +} \ No newline at end of file Added: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstringOffset.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstringOffset.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLstringOffset.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator; + +/** + * This annotation must be used when there are more than one CharSequence arguments in a method. + * TODO: Add support for CharSequence[] if/when we need it. + * + * @author spasi + */ + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@Target({ ElementType.PARAMETER }) +public @interface GLstringOffset { + /** An expression that will specify the offset from which this String will be written to the ByteBuffer. */ + String value(); +} \ No newline at end of file Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -125,7 +125,8 @@ private void validateParameters(MethodDeclaration method) { for (ParameterDeclaration param : method.getParameters()) { validateTypes(method, param.getAnnotationMirrors(), param.getType()); - if (Utils.getNIOBufferType(param.getType()) != null) { + Class<?> param_type = Utils.getJavaType(param.getType()); + if (Utils.getNIOBufferType(param.getType()) != null && param_type != CharSequence.class && param_type != CharSequence[].class) { Check parameter_check_annotation = param.getAnnotation(Check.class); NullTerminated null_terminated_annotation = param.getAnnotation(NullTerminated.class); if (parameter_check_annotation == null && null_terminated_annotation == null) { @@ -138,7 +139,11 @@ break; } } - if (!found_auto_size_param && param.getAnnotation(Result.class) == null && param.getAnnotation(Constant.class) == null) + if (!found_auto_size_param + && param.getAnnotation(Result.class) == null + && param.getAnnotation(Constant.class) == null + && !Utils.isReturnString(method, param) + ) throw new RuntimeException(param + " has no Check, Result nor Constant annotation and no other parameters has" + " an @AutoSize annotation on it in method " + method); } @@ -158,8 +163,10 @@ } private static void generateMethodsNativePointers(PrintWriter writer, Collection<? extends MethodDeclaration> methods) { - for (MethodDeclaration method : methods) - generateMethodNativePointers(writer, method); + for (MethodDeclaration method : methods) { + if ( method.getAnnotation(Alternate.class) == null ) + generateMethodNativePointers(writer, method); + } } private static void generateMethodNativePointers(PrintWriter writer, MethodDeclaration method) { Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JNITypeTranslator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/JNITypeTranslator.java 2010-03-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JNITypeTranslator.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -56,7 +56,10 @@ } public void visitArrayType(ArrayType t) { - throw new RuntimeException(t + " is not allowed"); + if ( "java.lang.CharSequence".equals(t.getComponentType().toString()) ) + signature.append("jobject"); + else + throw new RuntimeException(t + " is not allowed"); } public void visitClassType(ClassType t) { Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -71,7 +71,8 @@ if ( method.getAnnotation(CachedResult.class) != null && !method.getAnnotation(CachedResult.class).isRange() ) { printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.CACHEDRESULT, generate_error_checks, context_specific); } - if ( method.getAnnotation(Alternate.class) == null ) { + Alternate alt_annotation = method.getAnnotation(Alternate.class); + if ( alt_annotation == null || alt_annotation.nativeAlt() ) { printJavaNativeStub(writer, method, Mode.NORMAL, generate_error_checks, context_specific); if (Utils.hasMethodBufferObjectParameter(method)) { printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.BUFFEROBJECT, generate_error_checks, context_specific); @@ -119,8 +120,12 @@ writer.print("boolean " + TypeInfo.UNSIGNED_PARAMETER_NAME); } } - } else if (param.getAnnotation(Result.class) == null && (native_stub || param.getAnnotation(Constant.class) == null) && - (getAutoTypeParameter(method, param) == null || mode != Mode.AUTOS)) { + } else if ( + param.getAnnotation(Result.class) == null + && (native_stub || (param.getAnnotation(Constant.class) == null && !Utils.isReturnString(method, param))) + && (getAutoTypeParameter(method, param) == null || mode != Mode.AUTOS) + ) + { TypeInfo type_info = typeinfos_instance.get(param); first_parameter = generateParameterJava(writer, param, type_info, native_stub, first_parameter, mode); } @@ -161,10 +166,15 @@ } else { if ( native_stub && param.getAnnotation(GLpointer.class) != null ) writer.print("long"); - else - writer.print(type_info.getType().getSimpleName()); + else { + Class type = type_info.getType(); + if ( native_stub && (type == CharSequence.class || type == CharSequence[].class) ) + writer.print("ByteBuffer"); + else + writer.print(type_info.getType().getSimpleName()); + } writer.print(" " + param.getSimpleName()); - if (buffer_type != null && native_stub) + if ( native_stub && buffer_type != null ) writer.print(", int " + param.getSimpleName() + NativeMethodStubsGenerator.BUFFER_POSITION_POSTFIX); } return false; @@ -208,7 +218,7 @@ if (context_specific) { writer.println("\t\tContextCapabilities caps = GLContext.getCapabilities();"); writer.print("\t\tlong " + Utils.FUNCTION_POINTER_VAR_NAME + " = caps."); - writer.println(Utils.getFunctionAddressName(interface_decl, method) + ";"); + writer.println(Utils.getFunctionAddressName(interface_decl, method, true) + ";"); writer.print("\t\tBufferChecks.checkFunctionAddress("); writer.println(Utils.FUNCTION_POINTER_VAR_NAME + ");"); } @@ -227,6 +237,13 @@ if ( method.getAnnotation(GLpointer.class) != null ) writer.print("new " + method.getReturnType() + "("); } + GLstring string_annotation = method.getAnnotation(GLstring.class); + if ( string_annotation != null ) { + has_result = true; + writer.println("IntBuffer " + string_annotation.string() + "_length = StringUtils.getLengths(1);"); + writer.println("\t\tByteBuffer " + string_annotation.string() + " = StringUtils.getBuffer(" + string_annotation.maxLength() + ");"); + writer.print("\t\t"); + } writer.print(Utils.getSimpleNativeMethodName(method, generate_error_checks, context_specific)); if (mode == Mode.BUFFEROBJECT) writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX); @@ -244,8 +261,14 @@ writer.println("\t\t" + type_map.getErrorCheckMethodName() + ";"); // DISABLED: indirect buffer support //printNondirectParameterCopies(writer, method, mode); - if (has_result) - writer.println("\t\treturn " + Utils.RESULT_VAR_NAME + ";"); + if (has_result) { + if ( string_annotation == null ) + writer.println("\t\treturn " + Utils.RESULT_VAR_NAME + ";"); + else { + writer.println("\t\t" + string_annotation.string() + ".limit(" + string_annotation.string() + "_length.get(0));"); + writer.println("\t\treturn StringUtils.getString(" + string_annotation.string() + ");"); + } + } writer.println("\t}"); } @@ -383,8 +406,24 @@ boolean hide_buffer = mode == Mode.AUTOS && getAutoTypeParameter(method, param) != null; if (hide_buffer) writer.print("null"); - else - writer.print(param.getSimpleName()); + else { + Class type = typeinfos_instance.get(param).getType(); + if ( type == CharSequence.class || type == CharSequence[].class ) { + GLstringOffset offset_annotation = param.getAnnotation(GLstringOffset.class); + + writer.print("StringUtils.getBuffer"); + if ( offset_annotation != null ) + writer.print("Offset"); + if ( param.getAnnotation(NullTerminated.class) != null ) + writer.print("NT"); + writer.print("(" + param.getSimpleName()); + if ( offset_annotation != null ) + writer.print(", " + offset_annotation.value()); + writer.print(")"); + hide_buffer = true; + } else + writer.print(param.getSimpleName()); + } Class buffer_type = Utils.getNIOBufferType(param.getType()); if (buffer_type != null) { writer.print(", "); @@ -404,7 +443,9 @@ writer.print(" << " + shifting); if (check_annotation != null && check_annotation.canBeNull()) writer.print(" : 0"); - } else + } else if ( param.getAnnotation(GLstringOffset.class) != null ) + writer.print(param.getAnnotation(GLstringOffset.class).value()); + else writer.print("0"); } else if ( param.getAnnotation(GLpointer.class) != null ) { writer.print(".getPointer()"); @@ -489,7 +530,8 @@ if (Utils.isAddressableType(java_type) && (mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) && (mode != Mode.AUTOS || getAutoTypeParameter(method, param) == null) && - param.getAnnotation(Result.class) == null) { + param.getAnnotation(Result.class) == null && + !Utils.isReturnString(method, param) ) { String check_value = null; boolean can_be_null = false; Check check_annotation = param.getAnnotation(Check.class); @@ -547,6 +589,8 @@ private static void printResultType(PrintWriter writer, MethodDeclaration method, boolean native_stub) { if ( native_stub && method.getAnnotation(GLpointer.class) != null ) writer.print("long"); + else if ( !native_stub && method.getAnnotation(GLstring.class) != null ) + writer.print("String"); else writer.print(Utils.getMethodReturnType(method).toString()); } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java 2010-03-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -56,7 +56,10 @@ } public void visitArrayType(ArrayType t) { - throw new RuntimeException(t + " is not allowed"); + if ( "java.lang.CharSequence".equals(t.getComponentType().toString()) ) + type = CharSequence[].class; + else + throw new RuntimeException(t + " is not allowed"); } public void visitPrimitiveType(PrimitiveType t) { Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2010-03-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -56,6 +56,9 @@ public static void generateNativeMethodStubs(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration d, boolean generate_error_checks, boolean context_specific) { for (MethodDeclaration method : d.getMethods()) { + Alternate alt_annotation = method.getAnnotation(Alternate.class); + if ( alt_annotation != null && !alt_annotation.nativeAlt() ) + continue; generateMethodStub(env, type_map, writer, Utils.getQualifiedClassName(d), method, Mode.NORMAL, generate_error_checks, context_specific); if (Utils.hasMethodBufferObjectParameter(method)) generateMethodStub(env, type_map, writer, Utils.getQualifiedClassName(d), method, Mode.BUFFEROBJECT, generate_error_checks, context_specific); @@ -117,9 +120,10 @@ } writer.println(") {"); generateBufferParameterAddresses(type_map, writer, method, mode); + Alternate alt_annotation = method.getAnnotation(Alternate.class); if (context_specific) { String typedef_name = Utils.getTypedefName(method); - writer.print("\t" + typedef_name + " " + method.getSimpleName()); + writer.print("\t" + typedef_name + " " + (alt_annotation == null ? method.getSimpleName() : alt_annotation.value())); writer.print(" = (" + typedef_name + ")((intptr_t)"); writer.println(Utils.FUNCTION_POINTER_VAR_NAME + ");"); } @@ -141,7 +145,7 @@ } else writer.print(" = "); } - writer.print(method.getSimpleName() + "("); + writer.print((alt_annotation == null ? method.getSimpleName() : alt_annotation.value()) + "("); generateCallParameters(writer, type_map, method.getParameters()); writer.print(")"); writer.println(";"); @@ -222,13 +226,13 @@ } private static void generateBufferParameterAddresses(TypeMap type_map, PrintWriter writer, MethodDeclaration method, Mode mode) { + boolean loopDeclared = false; for (ParameterDeclaration param : method.getParameters()) - if (Utils.isAddressableType(param.getType()) && - param.getAnnotation(Result.class) == null) - generateBufferParameterAddress(type_map, writer, method, param, mode); + if (Utils.isAddressableType(param.getType()) && param.getAnnotation(Result.class) == null) + loopDeclared = generateBufferParameterAddress(type_map, writer, method, param, mode, loopDeclared); } - private static void generateBufferParameterAddress(TypeMap type_map, PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Mode mode) { + private static boolean generateBufferParameterAddress(TypeMap type_map, PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Mode mode, boolean loopDeclared) { NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param); param.getType().accept(translator); writer.print("\t" + translator.getSignature() + param.getSimpleName()); @@ -240,7 +244,7 @@ writer.print("offsetToPointer(" + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX + "))"); } else { Class java_type = Utils.getJavaType(param.getType()); - if (Buffer.class.isAssignableFrom(java_type)) { + if (Buffer.class.isAssignableFrom(java_type) || java_type.equals(CharSequence.class) || java_type.equals(CharSequence[].class)) { boolean explicitly_byte_sized = java_type.equals(Buffer.class) || translator.getAnnotationType().equals(type_map.getVoidType()); if (explicitly_byte_sized) @@ -262,30 +266,47 @@ writer.println(";"); if ( param.getAnnotation(StringList.class) != null ) { - if ( param.getAnnotation(GLchar.class) == null || - param.getAnnotation(NullTerminated.class) == null || - param.getAnnotation(NullTerminated.class).value().length() == 0 + if ( Utils.getJavaType(param.getType()) != CharSequence[].class && ( + param.getAnnotation(GLchar.class) == null || + param.getAnnotation(NullTerminated.class) == null || + param.getAnnotation(NullTerminated.class).value().length() == 0 + ) ) throw new RuntimeException("StringList annotation can only be applied on null-terminated GLchar buffers."); - // Declare string array and loop counters - writer.print("\tGLchar **" + param.getSimpleName() + STRING_LIST_POSTFIX + "; "); - writer.println("\tunsigned int " + param.getSimpleName() + "_i = 0;"); - writer.println("\tGLchar *" + param.getSimpleName() + "_next = (GLchar *)" + param.getSimpleName() + BUFFER_ADDRESS_POSTFIX + ";"); + if ( "_str".equals(param.getSimpleName()) ) + throw new RuntimeException("The name '_str' is not valid for arguments annotated with StringList"); + + // Declare loop counters and allocate string array + if ( !loopDeclared ) { + writer.println("\tunsigned int _str_i;"); + writer.println("\tGLchar *_str_address;"); + loopDeclared = true; + } + writer.println("\tGLchar **" + param.getSimpleName() + STRING_LIST_POSTFIX + " = (GLchar **) malloc(" + param.getAnnotation(StringList.class).value() + "*sizeof(GLchar*));"); } + return loopDeclared; } private static void generateStringListInits(PrintWriter writer, Collection<ParameterDeclaration> params) { for ( ParameterDeclaration param : params ) { StringList stringList_annotation = param.getAnnotation(StringList.class); if ( stringList_annotation != null ) { - // Allocate the string array - writer.println("\t" + param.getSimpleName() + STRING_LIST_POSTFIX + " = (GLchar **) malloc(" + stringList_annotation.value() + "*sizeof(GLchar*));"); + String lengths = stringList_annotation.lengths(); + + // Init vars + writer.println("\t_str_i = 0;"); + writer.println("\t_str_address = (GLchar *)" + param.getSimpleName() + BUFFER_ADDRESS_POSTFIX + ";"); // Fill string array with the string pointers - writer.println("\tdo {"); - writer.println("\t\t" + param.getSimpleName() + STRING_LIST_POSTFIX + "[" + param.getSimpleName() + "_i++] = " + param.getSimpleName() + "_next;"); - writer.println("\t\t" + param.getSimpleName() + "_next += strlen(" + param.getSimpleName() + "_next) + 1;"); - writer.println("\t} while ( " + param.getSimpleName() + "_i < " + stringList_annotation.value() + " );"); + writer.println("\twhile ( _str_i < " + stringList_annotation.value() + " ) {"); + if ( lengths.length() == 0 ) { + writer.println("\t\t" + param.getSimpleName() + STRING_LIST_POSTFIX + "[_str_i++] = _str_address;"); + writer.println("\t\t_str_address += strlen(_str_address_next) + 1;"); + } else { + writer.println("\t\t" + param.getSimpleName() + STRING_LIST_POSTFIX + "[_str_i] = _str_address;"); + writer.println("\t\t_str_address += " + lengths + BUFFER_ADDRESS_POSTFIX + "[_str_i++];"); + } + writer.println("\t}"); } } } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java 2010-03-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -104,7 +104,12 @@ } public void visitArrayType(ArrayType t) { - throw new RuntimeException(t + " is not allowed"); + if ( "java.lang.CharSequence".equals(t.getComponentType().toString()) ) { + is_indirect = true; + native_types = new ArrayList<Class>(); + native_types.add(GLchar.class); + } else + throw new RuntimeException(t + " is not allowed"); } public static PrimitiveType.Kind getPrimitiveKindFromBufferClass(Class c) { Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/StringList.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/StringList.java 2010-03-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/StringList.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -41,5 +41,8 @@ @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface StringList { + /** Number of values in the string list (name of native-side parameter) */ String value(); + /** List of string lengths (name of native-side parameter) */ + String lengths() default ""; } \ No newline at end of file Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/TypedefsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/TypedefsGenerator.java 2010-03-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/TypedefsGenerator.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -82,8 +82,10 @@ } public static void generateNativeTypedefs(TypeMap type_map, PrintWriter writer, Collection<? extends MethodDeclaration> methods) { - for (MethodDeclaration method : methods) - generateNativeTypedefs(type_map, writer, method); + for (MethodDeclaration method : methods) { + if ( method.getAnnotation(Alternate.class) == null ) + generateNativeTypedefs(type_map, writer, method); + } } } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-03-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -43,9 +43,16 @@ import com.sun.mirror.type.*; import java.nio.Buffer; import java.io.*; +import java.nio.ByteBuffer; import java.util.*; +import javax.lang.model.util.SimpleTypeVisitor6; + import com.sun.mirror.declaration.*; +import com.sun.mirror.type.PrimitiveType.Kind; +import com.sun.mirror.util.SimpleTypeVisitor; +import com.sun.mirror.util.TypeVisitor; +import com.sun.mirror.util.Types; public class Utils { public static final String TYPEDEF_POSTFIX = "PROC"; @@ -63,13 +70,22 @@ private static final String OVERLOADED_METHOD_PREFIX = "n"; public static String getTypedefName(MethodDeclaration method) { - return method.getSimpleName() + TYPEDEF_POSTFIX; + Alternate alt_annotation = method.getAnnotation(Alternate.class); + return (alt_annotation == null ? method.getSimpleName() : alt_annotation.value()) + TYPEDEF_POSTFIX; } public static String getFunctionAddressName(InterfaceDeclaration interface_decl, MethodDeclaration method) { - return interface_decl.getSimpleName() + "_" + method.getSimpleName() + FUNCTION_POINTER_POSTFIX; + return getFunctionAddressName(interface_decl, method, false); } + public static String getFunctionAddressName(InterfaceDeclaration interface_decl, MethodDeclaration method, boolean forceAlt) { + Alternate alt_annotation = method.getAnnotation(Alternate.class); + if ( alt_annotation == null || (alt_annotation.nativeAlt() && !forceAlt) ) + return interface_decl.getSimpleName() + "_" + method.getSimpleName() + FUNCTION_POINTER_POSTFIX; + else + return interface_decl.getSimpleName() + "_" + alt_annotation.value() + FUNCTION_POINTER_POSTFIX; + } + public static boolean isFinal(InterfaceDeclaration d) { Extension extension_annotation = d.getAnnotation(Extension.class); return extension_annotation == null || extension_annotation.isFinal(); @@ -103,7 +119,7 @@ } public static boolean isAddressableType(Class type) { - return Buffer.class.isAssignableFrom(type) || String.class.equals(type); + return Buffer.class.isAssignableFrom(type) || String.class.equals(type) || CharSequence.class.equals(type) || CharSequence[].class.equals(type); } public static Class getJavaType(TypeMirror type_mirror) { @@ -248,6 +264,8 @@ Class<?> param_type = getJavaType(t); if (Buffer.class.isAssignableFrom(param_type)) return param_type; + else if ( param_type == CharSequence.class || param_type == CharSequence[].class ) + return ByteBuffer.class; else return null; } @@ -255,10 +273,15 @@ public static String getSimpleNativeMethodName(MethodDeclaration method, boolean generate_error_checks, boolean context_specific) { 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.nativeAlt() ? method.getSimpleName() : alt_annotation.value(); if (isMethodIndirect(generate_error_checks, context_specific, method)) method_name = OVERLOADED_METHOD_PREFIX + method_name; return method_name; } + static boolean isReturnString(MethodDeclaration method, ParameterDeclaration param) { + GLstring string_annotation = method.getAnnotation(GLstring.class); + return string_annotation != null && string_annotation.string().equals(param.getSimpleName()); + } + } Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java 2010-03-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -68,14 +68,25 @@ void glGetPerfMonitorGroupStringAMD(@GLuint int group, @AutoSize("groupString") @GLsizei int bufSize, - @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, - @GLchar ByteBuffer groupString); + @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, + @OutParameter @GLchar ByteBuffer groupString); - void glGetPerfMonitorCounterStringAMD(@GLuint int group, @GLuint int counter, - @AutoSize("counterString") @GLsizei int bufSize, - @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, - @GLchar ByteBuffer counterString); + @Alternate("glGetPerfMonitorGroupStringAMD") + @GLstring(string = "groupString", maxLength = "bufSize") + void glGetPerfMonitorGroupStringAMD2(@GLuint int group, @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("groupString_length, 0") IntBuffer length, + @OutParameter @GLchar ByteBuffer groupString); + void glGetPerfMonitorCounterStringAMD(@GLuint int group, @GLuint int counter, @AutoSize("counterString") @GLsizei int bufSize, + @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, + @OutParameter @GLchar ByteBuffer counterString); + + @Alternate("glGetPerfMonitorCounterStringAMD") + @GLstring(string = "counterString", maxLength = "bufSize") + void glGetPerfMonitorCounterStringAMD2(@GLuint int group, @GLuint int counter, @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("counterString_length, 0") IntBuffer length, + @OutParameter @GLchar ByteBuffer counterString); + void glGetPerfMonitorCounterInfoAMD(@GLuint int group, @GLuint int counter, @GLenum int pname, @Check(value = "16") @GLvoid ByteBuffer data); void glGenPerfMonitorsAMD(@AutoSize("monitors") @GLsizei int n, @OutParameter @GLuint IntBuffer monitors); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java 2010-03-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -31,10 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.util.generator.Const; -import org.lwjgl.util.generator.GLchar; -import org.lwjgl.util.generator.GLuint; -import org.lwjgl.util.generator.NullTerminated; +import org.lwjgl.util.generator.*; import java.nio.ByteBuffer; @@ -58,6 +55,12 @@ void glBindFragDataLocationIndexed(@GLuint int program, @GLuint int colorNumber, @GLuint int index, @NullTerminated @Const @GLchar ByteBuffer name); + @Alternate("glBindFragDataLocationIndexed") + void glBindFragDataLocationIndexed(@GLuint int program, @GLuint int colorNumber, @GLuint int index, @NullTerminated CharSequence name); + int glGetFragDataIndex(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name); + @Alternate("glGetFragDataIndex") + int glGetFragDataIndex(@GLuint int program, @NullTerminated CharSequence name); + } \ No newline at end of file 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-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -105,15 +105,17 @@ * This method uses just a single string, that should NOT be null-terminated. */ void glShaderSourceARB(@GLhandleARB int shader, @Constant("1") @GLsizei int count, - @Indirect - @Check - @Const - @GLcharARB ByteBuffer string, - @AutoSize("string") - @Indirect - @Const - @GLint int length); + @Indirect @Const @GLcharARB @Check ByteBuffer string, + @AutoSize("string") @Indirect @Const @GLint int length); + @Alternate("glShaderSourceARB") + void glShaderSourceARB2(@GLhandleARB int shader, @Constant("1") @GLsizei int count, CharSequence string, @Constant("string.length()") @Indirect @Const int length); + + @Alternate(value = "glShaderSourceARB", nativeAlt = true) + void glShaderSourceARB3(@GLhandleARB int shader, @Constant("strings.length") @GLsizei int count, + @Const @StringList(value = "count", lengths = "length") CharSequence[] strings, + @Constant("StringUtils.getLengths(strings), 0") @Const IntBuffer length); + void glCompileShaderARB(@GLhandleARB int shaderObj); @GLhandleARB @@ -183,18 +185,18 @@ void glGetObjectParameterivARB(@GLhandleARB int obj, @GLenum int pname, @OutParameter @Check IntBuffer params); void glGetInfoLogARB(@GLhandleARB int obj, @AutoSize("infoLog") @GLsizei int maxLength, - @OutParameter - @Check(value = "1", canBeNull = true) - @GLsizei IntBuffer length, - @OutParameter - @GLcharARB ByteBuffer infoLog); + @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, + @OutParameter @GLcharARB ByteBuffer infoLog); + @Alternate("glGetInfoLogARB") + @GLstring(string = "infoLog", maxLength = "maxLength") + void glGetInfoLogARB2(@GLhandleARB int obj, @GLsizei int maxLength, + @OutParameter @GLsizei @Constant("infoLog_length, 0") IntBuffer length, + @OutParameter @GLcharARB ByteBuffer infoLog); + void glGetAttachedObjectsARB(@GLhandleARB int containerObj, @AutoSize("obj") @GLsizei int maxCount, - @OutParameter - @Check(value = "1", canBeNull = true) - @GLsizei IntBuffer count, - @OutParameter - @GLhandleARB IntBuffer obj); + @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer count, + @OutParameter @GLhandleARB IntBuffer obj); /** * Returns the location of the uniform with the specified name. The ByteBuffer should contain the uniform name as a <b>null-terminated</b> string. @@ -204,16 +206,23 @@ */ int glGetUniformLocationARB(@GLhandleARB int programObj, @NullTerminated @Const @GLcharARB ByteBuffer name); + @Alternate("glGetUniformLocationARB") + int glGetUniformLocationARB(@GLhandleARB int programObj, @NullTerminated CharSequence name); + void glGetActiveUniformARB(@GLhandleARB int programObj, @GLuint int index, @AutoSize("name") @GLsizei int maxLength, - @OutParameter - @Check(value = "1", canBeNull = true) - @GLsizei IntBuffer length, - @Check("1") IntBuffer size, - @Check("1") - @GLenum 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("glGetActiveUniformARB") + @GLstring(string = "name", maxLength = "maxLength") + void glGetActiveUniformARB2(@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); + @StripPostfix("params") void glGetUniformfvARB(@GLhandleARB int programObj, int location, @OutParameter @Check FloatBuffer params); @@ -221,9 +230,13 @@ void glGetUniformivARB(@GLhandleARB int programObj, int location, @OutParameter @Check IntBuffer params); void glGetShaderSourceARB(@GLhandleARB int obj, @AutoSize("source") @GLsizei int maxLength, - @OutParameter - @Check(value = "1", canBeNull = true) - @GLsizei IntBuffer length, - @OutParameter - @GLcharARB ByteBuffer source); + @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, + @OutParameter @GLcharARB ByteBuffer source); + + @Alternate("glGetShaderSourceARB") + @GLstring(string = "source", maxLength = "maxLength") + void glGetShaderSourceARB2(@GLhandleARB int obj, @GLsizei int maxLength, + @OutParameter @GLsizei @Constant("source_length, 0") IntBuffer length, + @OutParameter @GLcharARB ByteBuffer source); + } Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java 2010-03-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -45,29 +45,50 @@ int GL_NAMED_STRING_LENGTH_ARB = 0x8DE9; int GL_NAMED_STRING_TYPE_ARB = 0x8DEA; - void glNamedStringARB(@GLenum int type, @AutoSize("name") int namelen, @Const ByteBuffer name, @AutoSize("string") int stringlen, @Const ByteBuffer string); + void glNamedStringARB(@GLenum int type, + @AutoSize("name") int namelen, @Const @GLchar ByteBuffer name, + @AutoSize("string") int stringlen, @Const @GLchar ByteBuffer string); - void glDeleteNamedStringARB(@AutoSize("name") int namelen, @Const ByteBuffer name); + @Alternate("glNamedStringARB") + void glNamedStringARB(@GLenum int type, + @Constant("name.length()") int namelen, CharSequence name, + @Constant("string.length()") int stringlen, @GLstringOffset("name.length()") CharSequence string); + void glDeleteNamedStringARB(@AutoSize("name") int namelen, @Const @GLchar ByteBuffer name); + + @Alternate("glDeleteNamedStringARB") + void glDeleteNamedStringARB(@Constant("name.length()") int namelen, CharSequence name); + void glCompileShaderIncludeARB(@GLuint int shader, @GLsizei int count, @Const @NullTerminated("count") @StringList("count") @GLchar ByteBuffer path, @Constant("null, 0") @Const IntBuffer length); - /* TODO: Implement @Check - @Alternate("glCompileShaderIncludeARB") - void glCompileShaderIncludeARB2(@GLuint int shader, @AutoSize("length") @GLsizei int count, - @Const @Check("...") @StringList("count") @GLchar ByteBuffer path, - @Const IntBuffer length); - */ + @Alternate(value = "glCompileShaderIncludeARB", nativeAlt = true) + void glCompileShaderIncludeARB2(@GLuint int shader, @Constant("path.length") @GLsizei int count, + @Const @StringList(value = "count", lengths = "length") CharSequence[] path, + @Constant("StringUtils.getLengths(path), 0") @Const IntBuffer length); - boolean glIsNamedStringARB(@AutoSize("name") int namelen, @Const ByteBuffer name); + boolean glIsNamedStringARB(@AutoSize("name") int namelen, @Const @GLchar ByteBuffer name); - void glGetNamedStringARB(@AutoSize("name") int namelen, @Const ByteBuffer name, + @Alternate("glIsNamedStringARB") + boolean glIsNamedStringARB(@Constant("name.length()") int namelen, CharSequence name); + + void glGetNamedStringARB(@AutoSize("name") int namelen, @Const @GLchar ByteBuffer name, @AutoSize("string") @GLsizei int bufSize, @OutParameter @Check(value = "1", canBeNull = true) IntBuffer stringlen, @OutParameter ByteBuffer string); + @Alternate("glGetNamedStringARB") + void glGetNamedStringARB(@Constant("name.length()") int namelen, CharSequence name, + @AutoSize("string") @GLsizei int bufSize, + @OutParameter @Check(value = "1", canBeNull = true) IntBuffer stringlen, + @OutParameter ByteBuffer string); + @StripPostfix("params") - void glGetNamedStringivARB(@AutoSize("name") int namelen, @Const ByteBuffer name, @GLenum int pname, @Check("1") @OutParameter IntBuffer params); + void glGetNamedStringivARB(@AutoSize("name") int namelen, @Const @GLchar ByteBuffer name, @GLenum int pname, @Check("1") @OutParameter IntBuffer params); + @StripPostfix("params") + @Alternate("glGetNamedStringivARB") + void glGetNamedStringivARB2(@Constant("name.length()") int namelen, CharSequence name, @GLenum int pname, @Check("1") @OutParameter IntBuffer params); + } \ No newline at end of file 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-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -102,27 +102,47 @@ @Const @NullTerminated("uniformIndices.remaining()") @GLchar @StringList("uniformCount") ByteBuffer uniformNames, @OutParameter @GLuint IntBuffer uniformIndices); + @Alternate(value = "glGetUniformIndices") + void glGetUniformIndices(@GLuint int program, @Constant("uniformNames.length") @GLsizei int uniformCount, + @Const @NullTerminated @StringList("uniformCount") CharSequence[] uniformNames, + @OutParameter @Check("uniformNames.length") @GLuint IntBuffer uniformIndices); + @StripPostfix("params") void glGetActiveUniformsiv(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount, @Const @GLuint IntBuffer uniformIndices, - @GLenum int pname, - @Check(value = "1") @GLint IntBuffer params); // TODO: We need to AutoSize "params" using "uniformCount" + @GLenum int pname, @Check("uniformIndices.remaining()") @GLint IntBuffer params); void glGetActiveUniformName(@GLuint int program, @GLuint int uniformIndex, @AutoSize("uniformName") @GLsizei int bufSize, - @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, - @GLchar ByteBuffer uniformName); + @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, + @OutParameter @GLchar ByteBuffer uniformName); + @Alternate("glGetActiveUniformName") + @GLstring(string = "uniformName", maxLength = "bufSize") + void glGetActiveUniformName2(@GLuint int program, @GLuint int uniformIndex, @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("uniformName_length, 0") IntBuffer length, + @OutParameter @GLchar ByteBuffer uniformName); + @GLuint int glGetUniformBlockIndex(@GLuint int program, @Const @NullTerminated @GLchar ByteBuffer uniformBlockName); + @Alternate("glGetUniformBlockIndex") + @GLuint + int glGetUniformBlockIndex(@GLuint int program, @NullTerminated CharSequence uniformBlockName); + @StripPostfix("params") void glGetActiveUniformBlockiv(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname, @OutParameter @Check(value = "16") @GLint IntBuffer params); void glGetActiveUniformBlockName(@GLuint int program, @GLuint int uniformBlockIndex, @AutoSize("uniformBlockName") @GLsizei int bufSize, - @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, - @GLchar ByteBuffer uniformBlockName); + @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, + @OutParameter @GLchar ByteBuffer uniformBlockName); + @Alternate("glGetActiveUniformBlockName") + @GLstring(string = "uniformBlockName", maxLength = "bufSize") + void glGetActiveUniformBlockName2(@GLuint int program, @GLuint int uniformBlockIndex, @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("uniformBlockName_length, 0") IntBuffer length, + @OutParameter @GLchar ByteBuffer uniformBlockName); + void glBindBufferRange(@GLenum int target, @GLuint int index, @GLuint int buffer, @GLintptr long offset, @GLsizeiptr long size); void glBindBufferBase(@GLenum int target, @GLuint int index, @GLuint int buffer); 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-12 20:15:38 UTC (rev 3280) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java 2010-03-12 21:55:13 UTC (rev 3281) @@ -141,22 +141,28 @@ void glBindAttribLocationARB(@GLhandleARB int programObj, @GLuint int index, @NullTerminated @Const @GLcharARB ByteBuffer name); - void glGetActiveAttribARB(@GLhandleARB int programObj, @GLuint int index, - ... [truncated message content] |
From: <en...@us...> - 2010-03-12 20:15:44
|
Revision: 3280 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3280&view=rev Author: endolf Date: 2010-03-12 20:15:38 +0000 (Fri, 12 Mar 2010) Log Message: ----------- Try and find a sensible video driver to report on rather than assuming it's video0. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2010-03-11 21:06:49 UTC (rev 3279) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2010-03-12 20:15:38 UTC (rev 3280) @@ -341,18 +341,33 @@ public String getAdapter() { try { - String adapter_string = WindowsRegistry.queryRegistrationKey( + String maxObjNo = WindowsRegistry.queryRegistrationKey( WindowsRegistry.HKEY_LOCAL_MACHINE, "HARDWARE\\DeviceMap\\Video", - "\\Device\\Video0"); - String root_key = "\\registry\\machine\\"; - if (adapter_string.toLowerCase().startsWith(root_key)) { - String driver_value = WindowsRegistry.queryRegistrationKey( + "MaxObjectNumber"); + int maxObjectNumber = maxObjNo.charAt(0); + String vga_driver_value = ""; + for(int i=0;i<maxObjectNumber;i++) { + String adapter_string = WindowsRegistry.queryRegistrationKey( WindowsRegistry.HKEY_LOCAL_MACHINE, - adapter_string.substring(root_key.length()), - "InstalledDisplayDrivers"); - return driver_value; + "HARDWARE\\DeviceMap\\Video", + "\\Device\\Video" + i); + String root_key = "\\registry\\machine\\"; + if (adapter_string.toLowerCase().startsWith(root_key)) { + String driver_value = WindowsRegistry.queryRegistrationKey( + WindowsRegistry.HKEY_LOCAL_MACHINE, + adapter_string.substring(root_key.length()), + "InstalledDisplayDrivers"); + if(driver_value.toUpperCase().startsWith("VGA")) { + vga_driver_value = driver_value; + } else if(!driver_value.toUpperCase().startsWith("RDP") && !driver_value.toUpperCase().startsWith("NMNDD")) { + return driver_value; + } + } } + if(!vga_driver_value.equals("")) { + return vga_driver_value; + } } catch (LWJGLException e) { LWJGLUtil.log("Exception occurred while querying registry: " + e); } @@ -362,9 +377,12 @@ public String getVersion() { String driver = getAdapter(); if (driver != null) { - WindowsFileVersion version = nGetVersion(driver + ".dll"); - if (version != null) - return version.toString(); + String[] drivers = driver.split(","); + if(drivers.length>0) { + WindowsFileVersion version = nGetVersion(drivers[0] + ".dll"); + if (version != null) + return version.toString(); + } } return null; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sp...@us...> - 2010-03-11 22:09:21
|
Revision: 3279 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3279&view=rev Author: spasi Date: 2010-03-11 21:06:49 +0000 (Thu, 11 Mar 2010) Log Message: ----------- Added support for OpenGL 3.3 and OpenGL 4.0. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java trunk/LWJGL/src/java/org/lwjgl/opengl/StateTracker.java trunk/LWJGL/src/java/org/lwjgl/util/generator/BufferKind.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GLvoid.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeInfo.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/GL20.java Added Paths: ----------- trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_explicit_attrib_location.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_gpu_shader5.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query2.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_bit_encoding.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_subroutine.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_tessellation_shader.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_buffer_object_rgb32.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_compression_bptc.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_rgb10_a2ui.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_swizzle.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_timer_query.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback3.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_type_2_10_10_10_rev.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL33.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java Modified: trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2010-03-08 21:29:32 UTC (rev 3278) +++ trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -85,6 +85,13 @@ throw new IllegalArgumentException("Missing null termination"); } + /** Helper methods to ensure an IntBuffer is null-terminated */ + public static void checkNullTerminated(IntBuffer buf) { + if ( buf.get(buf.limit() - 1) != 0 ) { + throw new IllegalArgumentException("Missing null termination"); + } + } + public static void checkNotNull(Object o) { if (o == null) throw new IllegalArgumentException("Null argument"); Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java 2010-03-08 21:29:32 UTC (rev 3278) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/BaseReferences.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -46,6 +46,8 @@ int pixelPackBuffer; int pixelUnpackBuffer; + int indirectBuffer; + BaseReferences(ContextCapabilities caps) { IntBuffer temp = caps.scratch_int_buffer; @@ -78,6 +80,8 @@ this.pixelPackBuffer = 0; this.pixelUnpackBuffer = 0; + + this.indirectBuffer = 0; } void copy(BaseReferences references, int mask) { @@ -87,6 +91,8 @@ this.glClientActiveTexture = references.glClientActiveTexture; System.arraycopy(references.glVertexAttribPointer_buffer, 0, glVertexAttribPointer_buffer, 0, glVertexAttribPointer_buffer.length); System.arraycopy(references.glTexCoordPointer_buffer, 0, glTexCoordPointer_buffer, 0, glTexCoordPointer_buffer.length); + + this.indirectBuffer = references.indirectBuffer; } if ( (mask & GL11.GL_CLIENT_PIXEL_STORE_BIT) != 0 ) { Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2010-03-08 21:29:32 UTC (rev 3278) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -114,6 +114,18 @@ throw new OpenGLException("Cannot use offsets when Element Array Buffer Object is disabled"); } + /** Helper method to ensure that array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */ + static void ensureIndirectBOdisabled(ContextCapabilities caps) { + if ( StateTracker.getReferencesStack(caps).getReferences().indirectBuffer != 0 ) + throw new OpenGLException("Cannot use Buffers when Draw Indirect Object is enabled"); + } + + /** Helper method to ensure that array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */ + static void ensureIndirectBOenabled(ContextCapabilities caps) { + if ( StateTracker.getReferencesStack(caps).getReferences().indirectBuffer == 0 ) + throw new OpenGLException("Cannot use offsets when Draw Indirect Object is disabled"); + } + /** Helper method to ensure that pixel pack buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */ static void ensurePackPBOdisabled(ContextCapabilities caps) { if ( StateTracker.getReferencesStack(caps).getReferences().pixelPackBuffer != 0 ) Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2010-03-08 21:29:32 UTC (rev 3278) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -199,7 +199,13 @@ LWJGLUtil.log("The major and/or minor OpenGL version is malformed: " + e.getMessage()); } + // ----------------------[ 4.X ]---------------------- + if ( 4 <= majorVersion ) + supported_extensions.add("OpenGL40"); + // ----------------------[ 3.X ]---------------------- + if ( 3 < majorVersion || (3 == majorVersion && 3 <= minorVersion) ) + supported_extensions.add("OpenGL33"); if ( 3 < majorVersion || (3 == majorVersion && 2 <= minorVersion) ) supported_extensions.add("OpenGL32"); if ( 3 < majorVersion || (3 == majorVersion && 1 <= minorVersion) ) Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/StateTracker.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/StateTracker.java 2010-03-08 21:29:32 UTC (rev 3278) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/StateTracker.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -76,6 +76,9 @@ case GL21.GL_PIXEL_UNPACK_BUFFER: references_stack.getReferences().pixelUnpackBuffer = buffer; break; + case GL40.GL_DRAW_INDIRECT_BUFFER: + references_stack.getReferences().indirectBuffer = buffer; + break; } } Added: trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Alternate.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +/** + * When a method is annonated with @Alternate, no native stub will be created and the Java method will be renamed to value(). + * This can be useful when we want to provide an alternate GL call with different arguments (created by different annotations) + * + * @author spasi <sp...@us...> + */ +@Target({ ElementType.METHOD }) +public @interface Alternate { + /** This must match an existing GL method name. */ + String value(); +} \ No newline at end of file Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/BufferKind.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/BufferKind.java 2010-03-08 21:29:32 UTC (rev 3278) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/BufferKind.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -42,5 +42,6 @@ UnpackPBO, PackPBO, ElementVBO, - ArrayVBO + ArrayVBO, + IndirectBO } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java 2010-03-08 21:29:32 UTC (rev 3278) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -188,7 +188,7 @@ private static Class[] getValidBufferTypes(Class type) { if ( type.equals(IntBuffer.class) ) return new Class[] { GLbitfield.class, GLenum.class, GLhandleARB.class, GLint.class, - GLsizei.class, GLuint.class }; + GLsizei.class, GLuint.class, GLvoid.class }; else if ( type.equals(FloatBuffer.class) ) return new Class[] { GLclampf.class, GLfloat.class }; else if ( type.equals(ByteBuffer.class) ) Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLvoid.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLvoid.java 2010-03-08 21:29:32 UTC (rev 3278) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLvoid.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -41,7 +41,10 @@ import java.lang.annotation.Target; import java.lang.annotation.ElementType; +import com.sun.mirror.type.PrimitiveType; + @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLvoid { + PrimitiveType.Kind value() default PrimitiveType.Kind.BYTE; } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-08 21:29:32 UTC (rev 3278) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -138,7 +138,7 @@ break; } } - if (!found_auto_size_param && param.getAnnotation(Result.class) == null) + if (!found_auto_size_param && param.getAnnotation(Result.class) == null && param.getAnnotation(Constant.class) == null) throw new RuntimeException(param + " has no Check, Result nor Constant annotation and no other parameters has" + " an @AutoSize annotation on it in method " + method); } @@ -146,8 +146,8 @@ throw new RuntimeException(param + " can't be annotated with both CachedReference and Result"); if (param.getAnnotation(BufferObject.class) != null && param.getAnnotation(Result.class) != null) throw new RuntimeException(param + " can't be annotated with both BufferObject and Result"); - if (param.getAnnotation(Constant.class) != null) - throw new RuntimeException("Buffer parameter " + param + " cannot be Constant"); + //if (param.getAnnotation(Constant.class) != null) + //throw new RuntimeException("Buffer parameter " + param + " cannot be Constant"); } else { if (param.getAnnotation(BufferObject.class) != null) throw new RuntimeException(param + " type is not a buffer, but annotated as a BufferObject"); Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-08 21:29:32 UTC (rev 3278) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -71,10 +71,12 @@ if ( method.getAnnotation(CachedResult.class) != null && !method.getAnnotation(CachedResult.class).isRange() ) { printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.CACHEDRESULT, generate_error_checks, context_specific); } - printJavaNativeStub(writer, method, Mode.NORMAL, generate_error_checks, context_specific); - if (Utils.hasMethodBufferObjectParameter(method)) { - printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.BUFFEROBJECT, generate_error_checks, context_specific); - printJavaNativeStub(writer, method, Mode.BUFFEROBJECT, generate_error_checks, context_specific); + if ( method.getAnnotation(Alternate.class) == null ) { + printJavaNativeStub(writer, method, Mode.NORMAL, generate_error_checks, context_specific); + if (Utils.hasMethodBufferObjectParameter(method)) { + printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.BUFFEROBJECT, generate_error_checks, context_specific); + printJavaNativeStub(writer, method, Mode.BUFFEROBJECT, generate_error_checks, context_specific); + } } } @@ -194,7 +196,9 @@ writer.print("\tpublic static "); printResultType(writer, method, false); StripPostfix strip_annotation = method.getAnnotation(StripPostfix.class); - String method_name = method.getSimpleName(); + String method_name; + Alternate alt_annotation = method.getAnnotation(Alternate.class); + method_name = alt_annotation == null ? method.getSimpleName() : alt_annotation.value(); if (strip_annotation != null && mode == Mode.NORMAL) method_name = getPostfixStrippedName(type_map, interface_decl, method); writer.print(" " + method_name + "("); @@ -298,7 +302,10 @@ postfix_parameter.getType().accept(translator); postfix = translator.getSignature(); } - String method_name = method.getSimpleName(); + String method_name; + Alternate alt_annotation = method.getAnnotation(Alternate.class); + method_name = alt_annotation == null ? method.getSimpleName() : alt_annotation.value(); + String extension_postfix = "NULL".equals(strip_annotation.extension()) ? getExtensionPostfix(interface_decl) : strip_annotation.extension(); String result; @@ -491,7 +498,7 @@ can_be_null = check_annotation.canBeNull(); } NullTerminated null_terminated = param.getAnnotation(NullTerminated.class); - if (Buffer.class.isAssignableFrom(java_type)) { + if (Buffer.class.isAssignableFrom(java_type) && param.getAnnotation(Constant.class) == null) { boolean indirect_buffer_allowed = false && param.getAnnotation(CachedReference.class) == null; // DISABLED: indirect buffer support boolean out_parameter = param.getAnnotation(OutParameter.class) != null; TypeInfo typeinfo = typeinfos.get(param); Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeInfo.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeInfo.java 2010-03-08 21:29:32 UTC (rev 3278) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeInfo.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -168,7 +168,9 @@ } } Class type; - PrimitiveType.Kind kind = type_map.getPrimitiveTypeFromNativeType(annotation_type); + PrimitiveType.Kind kind; + GLvoid void_annotation = param.getAnnotation(GLvoid.class); + kind = void_annotation == null ? type_map.getPrimitiveTypeFromNativeType(annotation_type) : void_annotation.value(); if (Utils.getNIOBufferType(decl_type) != null) type = getBufferTypeFromPrimitiveKind(kind); else Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-03-08 21:29:32 UTC (rev 3278) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -253,7 +253,9 @@ } public static String getSimpleNativeMethodName(MethodDeclaration method, boolean generate_error_checks, boolean context_specific) { - String method_name = method.getSimpleName(); + String method_name; + Alternate alt_annotation = method.getAnnotation(Alternate.class); + method_name = alt_annotation == null ? method.getSimpleName() : alt_annotation.value(); if (isMethodIndirect(generate_error_checks, context_specific, method)) method_name = OVERLOADED_METHOD_PREFIX + method_name; return method_name; Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator.Const; +import org.lwjgl.util.generator.GLchar; +import org.lwjgl.util.generator.GLuint; +import org.lwjgl.util.generator.NullTerminated; + +import java.nio.ByteBuffer; + +public interface ARB_blend_func_extended { + + /** + * Accepted by the <src> and <dst> parameters of BlendFunc and + * BlendFunci, and by the <srcRGB>, <dstRGB>, <srcAlpha> and <dstAlpha> + * parameters of BlendFuncSeparate and BlendFuncSeparatei: + */ + int GL_SRC1_COLOR = 0x88F9; + int GL_SRC1_ALPHA = GL15.GL_SRC1_ALPHA; + int GL_ONE_MINUS_SRC1_COLOR = 0x88FA; + int GL_ONE_MINUS_SRC1_ALPHA = 0x88FB; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv + * and GetDoublev: + */ + int GL_MAX_DUAL_SOURCE_DRAW_BUFFERS = 0x88FC; + + void glBindFragDataLocationIndexed(@GLuint int program, @GLuint int colorNumber, @GLuint int index, @NullTerminated @Const @GLchar ByteBuffer name); + + int glGetFragDataIndex(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator.*; + +import java.nio.IntBuffer; + +import com.sun.mirror.type.PrimitiveType; + +public interface ARB_draw_indirect { + + /** + * Accepted by the <target> parameters of BindBuffer, BufferData, + * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, + * GetBufferPointerv, MapBufferRange, FlushMappedBufferRange, + * GetBufferParameteriv, BindBufferRange, BindBufferBase, and + * CopyBufferSubData: + */ + int GL_DRAW_INDIRECT_BUFFER = 0x8F3F; + + /** + * Accepted by the <value> parameter of GetIntegerv, GetBooleanv, GetFloatv, + * and GetDoublev: + */ + int GL_DRAW_INDIRECT_BUFFER_BINDING = 0x8F43; + + void glDrawArraysIndirect(@GLenum int mode, @BufferObject(BufferKind.IndirectBO) @Check("4") @NullTerminated @Const @GLvoid(PrimitiveType.Kind.INT) IntBuffer indirect); + + void glDrawElementsIndirect(@GLenum int mode, @GLenum int type, @BufferObject(BufferKind.IndirectBO) @Check("5") @NullTerminated @Const @GLvoid(PrimitiveType.Kind.INT) IntBuffer indirect); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_explicit_attrib_location.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_explicit_attrib_location.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_explicit_attrib_location.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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; + +public interface ARB_explicit_attrib_location { +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_gpu_shader5.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_gpu_shader5.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_gpu_shader5.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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; + +public interface ARB_gpu_shader5 { + + /** Accepted by the <pname> parameter of GetProgramiv: */ + int GL_GEOMETRY_SHADER_INVOCATIONS = 0x887F; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, + * GetDoublev, and GetInteger64v: + */ + int GL_MAX_GEOMETRY_SHADER_INVOCATIONS = 0x8E5A; + int GL_MIN_FRAGMENT_INTERPOLATION_OFFSET = 0x8E5B; + int GL_MAX_FRAGMENT_INTERPOLATION_OFFSET = 0x8E5C; + int GL_FRAGMENT_INTERPOLATION_OFFSET_BITS = 0x8E5D; + int GL_MAX_VERTEX_STREAMS = 0x8E71; + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator.*; + +import java.nio.*; + +@Dependent +@Extension(postfix = "") +public interface ARB_gpu_shader_fp64 { + + /** + * Returned in the <type> parameter of GetActiveUniform, and + * GetTransformFeedbackVarying: + */ + int GL_DOUBLE = GL11.GL_DOUBLE; + int GL_DOUBLE_VEC2 = 0x8FFC; + int GL_DOUBLE_VEC3 = 0x8FFD; + int GL_DOUBLE_VEC4 = 0x8FFE; + int GL_DOUBLE_MAT2 = 0x8F46; + int GL_DOUBLE_MAT3 = 0x8F47; + int GL_DOUBLE_MAT4 = 0x8F48; + int GL_DOUBLE_MAT2x3 = 0x8F49; + int GL_DOUBLE_MAT2x4 = 0x8F4A; + int GL_DOUBLE_MAT3x2 = 0x8F4B; + int GL_DOUBLE_MAT3x4 = 0x8F4C; + int GL_DOUBLE_MAT4x2 = 0x8F4D; + int GL_DOUBLE_MAT4x3 = 0x8F4E; + + void glUniform1d(int location, double x); + + void glUniform2d(int location, double x, double y); + + void glUniform3d(int location, double x, double y, double z); + + void glUniform4d(int location, double x, double y, double z, double w); + + @StripPostfix("value") + void glUniform1dv(int location, @AutoSize("value") @GLsizei int count, @Const DoubleBuffer value); + + @StripPostfix("value") + void glUniform2dv(int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const DoubleBuffer value); + + @StripPostfix("value") + void glUniform3dv(int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const DoubleBuffer value); + + @StripPostfix("value") + void glUniform4dv(int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const DoubleBuffer value); + + @StripPostfix("value") + void glUniformMatrix2dv(int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + + @StripPostfix("value") + void glUniformMatrix3dv(int location, @AutoSize(value = "value", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + + @StripPostfix("value") + void glUniformMatrix4dv(int location, @AutoSize(value = "value", expression = " >> 4") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + + @StripPostfix("value") + void glUniformMatrix2x3dv(int location, @AutoSize(value = "value", expression = " / (2 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + + @StripPostfix("value") + void glUniformMatrix2x4dv(int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + + @StripPostfix("value") + void glUniformMatrix3x2dv(int location, @AutoSize(value = "value", expression = " / (3 * 2)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + + @StripPostfix("value") + void glUniformMatrix3x4dv(int location, @AutoSize(value = "value", expression = " / (3 * 4)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + + @StripPostfix("value") + void glUniformMatrix4x2dv(int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + + @StripPostfix("value") + void glUniformMatrix4x3dv(int location, @AutoSize(value = "value", expression = " / (4 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + + @StripPostfix("params") + void glGetUniformdv(@GLuint int program, int location, @OutParameter @Check DoubleBuffer params); + + // ---- + + @Dependent("GL_EXT_direct_state_access") + void glProgramUniform1dEXT(@GLuint int program, int location, double x); + + @Dependent("GL_EXT_direct_state_access") + void glProgramUniform2dEXT(@GLuint int program, int location, double x, double y); + + @Dependent("GL_EXT_direct_state_access") + void glProgramUniform3dEXT(@GLuint int program, int location, double x, double y, double z); + + @Dependent("GL_EXT_direct_state_access") + void glProgramUniform4dEXT(@GLuint int program, int location, double x, double y, double z, double w); + + @Dependent("GL_EXT_direct_state_access") + @StripPostfix(value="value", extension="EXT") + void glProgramUniform1dvEXT(@GLuint int program, int location, @AutoSize(value = "value") @GLsizei int count, @Const DoubleBuffer value); + + @Dependent("GL_EXT_direct_state_access") + @StripPostfix(value = "value", extension = "EXT") + void glProgramUniform2dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const DoubleBuffer value); + + @Dependent("GL_EXT_direct_state_access") + @StripPostfix(value = "value", extension = "EXT") + void glProgramUniform3dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const DoubleBuffer value); + + @Dependent("GL_EXT_direct_state_access") + @StripPostfix(value = "value", extension = "EXT") + void glProgramUniform4dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const DoubleBuffer value); + + @Dependent("GL_EXT_direct_state_access") + @StripPostfix(value = "value", extension = "EXT") + void glProgramUniformMatrix2dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + + @Dependent("GL_EXT_direct_state_access") + @StripPostfix(value = "value", extension = "EXT") + void glProgramUniformMatrix3dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + + @Dependent("GL_EXT_direct_state_access") + @StripPostfix(value = "value", extension = "EXT") + void glProgramUniformMatrix4dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 4") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + + @Dependent("GL_EXT_direct_state_access") + @StripPostfix(value = "value", extension = "EXT") + void glProgramUniformMatrix2x3dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (2 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + + @Dependent("GL_EXT_direct_state_access") + @StripPostfix(value = "value", extension = "EXT") + void glProgramUniformMatrix2x4dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + + @Dependent("GL_EXT_direct_state_access") + @StripPostfix(value = "value", extension = "EXT") + void glProgramUniformMatrix3x2dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 2)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + + @Dependent("GL_EXT_direct_state_access") + @StripPostfix(value = "value", extension = "EXT") + void glProgramUniformMatrix3x4dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 4)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + + @Dependent("GL_EXT_direct_state_access") + @StripPostfix(value = "value", extension = "EXT") + void glProgramUniformMatrix4x2dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + + @Dependent("GL_EXT_direct_state_access") + @StripPostfix(value = "value", extension = "EXT") + void glProgramUniformMatrix4x3dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (4 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query2.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query2.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query2.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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; + +public interface ARB_occlusion_query2 { + + /** + * Accepted by the <target> parameter of BeginQuery, EndQuery, + * and GetQueryiv: + */ + int GL_ANY_SAMPLES_PASSED = 0x8C2F; + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator.*; + +import java.nio.FloatBuffer; +import java.nio.IntBuffer; + +@Extension(postfix = "") +public interface ARB_sampler_objects { + + /** + * Accepted by the <value> parameter of the GetBooleanv, GetIntegerv, + * GetInteger64v, GetFloatv and GetDoublev functions: + */ + int GL_SAMPLER_BINDING = 0x8919; + + void glGenSamplers(@AutoSize("samplers") @GLsizei int count, @OutParameter @GLuint IntBuffer samplers); + + void glDeleteSamplers(@AutoSize("samplers") @GLsizei int count, @Const @GLuint IntBuffer samplers); + + boolean glIsSampler(@GLuint int sampler); + + void glBindSampler(@GLenum int unit, @GLuint int sampler); + + void glSamplerParameteri(@GLuint int sampler, @GLenum int pname, int param); + + void glSamplerParameterf(@GLuint int sampler, @GLenum int pname, float param); + + @StripPostfix("params") + void glSamplerParameteriv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const IntBuffer params); + + @StripPostfix("params") + void glSamplerParameterfv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const FloatBuffer params); + + @StripPostfix("params") + void glSamplerParameterIiv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const IntBuffer params); + + @StripPostfix("params") + void glSamplerParameterIuiv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const @GLuint IntBuffer params); + + @StripPostfix("params") + void glGetSamplerParameteriv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); + + @StripPostfix("params") + void glGetSamplerParameterfv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter FloatBuffer params); + + @StripPostfix("params") + void glGetSamplerParameterIiv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); + + @StripPostfix("params") + void glGetSamplerParameterIfv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter FloatBuffer params); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_bit_encoding.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_bit_encoding.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_bit_encoding.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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; + +public interface ARB_shader_bit_encoding { +} \ No newline at end of file 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-08 21:29:32 UTC (rev 3278) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -144,37 +144,37 @@ void glUniform4iARB(int location, int v0, int v1, int v2, int v3); @StripPostfix("values") - void glUniform1fvARB(int location, @AutoSize("values") @GLsizei int count, FloatBuffer values); + void glUniform1fvARB(int location, @AutoSize("values") @GLsizei int count, @Const FloatBuffer values); @StripPostfix("values") - void glUniform2fvARB(int location, @AutoSize(value = "values", expression = " >> 1") @GLsizei int count, FloatBuffer values); + void glUniform2fvARB(int location, @AutoSize(value = "values", expression = " >> 1") @GLsizei int count, @Const FloatBuffer values); @StripPostfix("values") - void glUniform3fvARB(int location, @AutoSize(value = "values", expression = " / 3") @GLsizei int count, FloatBuffer values); + void glUniform3fvARB(int location, @AutoSize(value = "values", expression = " / 3") @GLsizei int count, @Const FloatBuffer values); @StripPostfix("values") - void glUniform4fvARB(int location, @AutoSize(value = "values", expression = " >> 2") @GLsizei int count, FloatBuffer values); + void glUniform4fvARB(int location, @AutoSize(value = "values", expression = " >> 2") @GLsizei int count, @Const FloatBuffer values); @StripPostfix("values") - void glUniform1ivARB(int location, @AutoSize(value = "values") @GLsizei int count, IntBuffer values); + void glUniform1ivARB(int location, @AutoSize(value = "values") @GLsizei int count, @Const IntBuffer values); @StripPostfix("values") - void glUniform2ivARB(int location, @AutoSize(value = "values", expression = " >> 1") @GLsizei int count, IntBuffer values); + void glUniform2ivARB(int location, @AutoSize(value = "values", expression = " >> 1") @GLsizei int count, @Const IntBuffer values); @StripPostfix("values") - void glUniform3ivARB(int location, @AutoSize(value = "values", expression = " / 3") @GLsizei int count, IntBuffer values); + void glUniform3ivARB(int location, @AutoSize(value = "values", expression = " / 3") @GLsizei int count, @Const IntBuffer values); @StripPostfix("values") - void glUniform4ivARB(int location, @AutoSize(value = "values", expression = " >> 2") @GLsizei int count, IntBuffer values); + void glUniform4ivARB(int location, @AutoSize(value = "values", expression = " >> 2") @GLsizei int count, @Const IntBuffer values); @StripPostfix("matrices") - void glUniformMatrix2fvARB(int location, @AutoSize(value = "matrices", expression = " >> 2") @GLsizei int count, boolean transpose, FloatBuffer matrices); + void glUniformMatrix2fvARB(int location, @AutoSize(value = "matrices", expression = " >> 2") @GLsizei int count, boolean transpose, @Const FloatBuffer matrices); @StripPostfix("matrices") - void glUniformMatrix3fvARB(int location, @AutoSize(value = "matrices", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, FloatBuffer matrices); + void glUniformMatrix3fvARB(int location, @AutoSize(value = "matrices", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const FloatBuffer matrices); @StripPostfix("matrices") - void glUniformMatrix4fvARB(int location, @AutoSize(value = "matrices", expression = " >> 4") @GLsizei int count, boolean transpose, FloatBuffer matrices); + void glUniformMatrix4fvARB(int location, @AutoSize(value = "matrices", expression = " >> 4") @GLsizei int count, boolean transpose, @Const FloatBuffer matrices); @StripPostfix("params") void glGetObjectParameterfvARB(@GLhandleARB int obj, @GLenum int pname, @OutParameter @Check FloatBuffer params); Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_subroutine.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_subroutine.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_subroutine.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator.*; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +@Extension(postfix = "") +public interface ARB_shader_subroutine { + + /** Accepted by the <pname> parameter of GetProgramStageiv: */ + int GL_ACTIVE_SUBROUTINES = 0x8DE5; + int GL_ACTIVE_SUBROUTINE_UNIFORMS = 0x8DE6; + int GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS = 0x8E47; + int GL_ACTIVE_SUBROUTINE_MAX_LENGTH = 0x8E48; + int GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH = 0x8E49; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * GetFloatv, GetDoublev, and GetInteger64v: + */ + int GL_MAX_SUBROUTINES = 0x8DE7; + int GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS = 0x8DE8; + + /** Accepted by the <pname> parameter of GetActiveSubroutineUniformiv: */ + int GL_NUM_COMPATIBLE_SUBROUTINES = 0x8E4A; + int GL_COMPATIBLE_SUBROUTINES = 0x8E4B; + int GL_UNIFORM_SIZE = GL31.GL_UNIFORM_SIZE; + int GL_UNIFORM_NAME_LENGTH = GL31.GL_UNIFORM_NAME_LENGTH; + + int glGetSubroutineUniformLocation(@GLuint int program, @GLenum int shadertype, @Const @NullTerminated ByteBuffer name); + + @GLuint + int glGetSubroutineIndex(@GLuint int program, @GLenum int shadertype, @Const @NullTerminated ByteBuffer name); + + @StripPostfix("values") + void glGetActiveSubroutineUniformiv(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLenum int pname, + @Check("1") @OutParameter IntBuffer values); + + void glGetActiveSubroutineUniformName(@GLuint int program, @GLenum int shadertype, @GLuint int index, + @AutoSize("name") @GLsizei int bufsize, + @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @OutParameter ByteBuffer name); + + void glGetActiveSubroutineName(@GLuint int program, @GLenum int shadertype, @GLuint int index, + @AutoSize("name") @GLsizei int bufsize, + @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @OutParameter ByteBuffer name); + + @StripPostfix("indices") + void glUniformSubroutinesuiv(@GLenum int shadertype, @AutoSize("indices") @GLsizei int count, @Const @GLuint IntBuffer indices); + + @StripPostfix("params") + void glGetUniformSubroutineuiv(@GLenum int shadertype, int location, @Check("1") @OutParameter @GLuint IntBuffer params); + + @StripPostfix("values") + void glGetProgramStageiv(@GLuint int program, @GLenum int shadertype, @GLenum int pname, @Check("1") @OutParameter IntBuffer values); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * 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.util.generator.*; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +public interface ARB_shading_language_include { + + /** Accepted by the <type> parameter of NamedStringARB: */ + int GL_SHADER_INCLUDE_ARB = 0x8DAE; + + /** Accepted by the <pname> parameter of GetNamedStringivARB: */ + int GL_NAMED_STRING_LENGTH_ARB = 0x8DE9; + int GL_NAMED_STRING_TYPE_ARB = 0x8DEA; + + void glNamedStringARB(@GLenum int type, @AutoSize("name") int namelen, @Const ByteBuffer name, @AutoSize("string") int stringlen, @Const ByteBuffer string); + + void glDeleteNamedStringARB(@AutoSize("name") int namelen, @Const ByteBuffer name); + + void glCompileShaderIncludeARB(@GLuint int shader, @GLsizei int count, + @Const @NullTerminated("count") @StringList("count") @GLchar ByteBuffer path, + @Constant("null, 0") @Const IntBuffer length); + + /* TODO: Implement @Check + @Alternate("glCompileShaderIncludeARB") + void glCompileShaderIncludeARB2(@GLuint int shader, @AutoSize("length") @GLsizei int count, + @Const @Check("...") @StringList("count") @GLchar ByteBuffer path, + @Const IntBuffer length); + */ + + boolean glIsNamedStringARB(@AutoSize("name") int namelen, @Const ByteBuffer name); + + void glGetNamedStringARB(@AutoSize("name") int namelen, @Const ByteBuffer name, + @AutoSize("string") @GLsizei int bufSize, + @OutParameter @Check(value = "1", canBeNull = true) IntBuffer stringlen, + @OutParameter ByteBuffer string); + + @StripPostfix("params") + void glGetNamedStringivARB(@AutoSize("name") int namelen, @Const ByteBuffer name, @GLenum int pname, @Check("1") @OutParameter IntBuffer params); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_tessellation_shader.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_tessellation_shader.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_tessellation_shader.java 2010-03-11 21:06:49 UTC (rev 3279) @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions... [truncated message content] |
From: Shop V. P. on www.yj65.c. <fi...@cl...> - 2010-03-09 19:06:52
|
torso alche mist brand ied stumb ling throu ghout calce s strai ghten er trois rehas h regul ative trans ports perid otiti c expen d haver sack alloc ator cogni sance swing ing athan asius ayes medit ate roily ganof bruta lity prost medit ate frizz led latex narvi k alche mist idola trize d diver siona ry veldt s dilog arith m expen d prote rs scyph ozoan cymop hane djebe l proro guing conce rt catti ly organ s trans ports bidia gonal gyrat ing wroug ht bidia gonal grill e brand ied velcr o herni a drava drago oned gradu ation estab lishe d trois atriu m blood line eolia n panda s organ s crown s devit alizi ng preci senes s diver siona ry confo und barns torme r undra w altru ists animi st opera tise tille d unmec hanis es arrow wood sinto n tattl er collu des stock jobbe r unalt erabl y nonpa rty leaf |
From: <ma...@us...> - 2010-03-08 21:29:43
|
Revision: 3278 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3278&view=rev Author: matzon Date: 2010-03-08 21:29:32 +0000 (Mon, 08 Mar 2010) Log Message: ----------- added new XRandR stuff fixed credits doc a bit Modified Paths: -------------- trunk/LWJGL/doc/CREDITS trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java Added Paths: ----------- trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java Modified: trunk/LWJGL/doc/CREDITS =================================================================== --- trunk/LWJGL/doc/CREDITS 2010-02-21 21:27:35 UTC (rev 3277) +++ trunk/LWJGL/doc/CREDITS 2010-03-08 21:29:32 UTC (rev 3278) @@ -1,11 +1,8 @@ The following people have helped to make this project what it is today: -active developers: - Caspian Rychlik-Prince <cp...@sh...> - Brian Matzon <br...@ma...> - Elias Naur <eli...@gm...> - Ioannis Tsakpinis <sp...@us...> - -contributors: - Niels J\xF8rgensen <nj...@ni...> - Tristan Campbell <tr...@ha...> - Gregory Pierce <gre...@ya...> @@ -16,6 +13,8 @@ - Kevin Glass <ke...@co...> - Atsuya Takagi - kappaOne + - Simon Felix + - Ryan McNally additional credits goes to: - Joseph I. Valenzuela [OpenAL stuff] @@ -26,6 +25,7 @@ - OpenAL, Creative Labs - http://openal.org/ - jinput, Sun - https://jinput.dev.java.net/ - lzma, p7zip - http://p7zip.sourceforge.net/ + - JOGL, Sun - http://kenai.com/projects/jogl/pages/Home Please see the /doc/3rdparty/ directory for licenses. Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2010-02-21 21:27:35 UTC (rev 3277) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2010-03-08 21:29:32 UTC (rev 3278) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2008 LWJGL Project + * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,17 +38,15 @@ * @author elias_naur */ +import java.awt.Canvas; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; -import java.awt.Canvas; -import java.awt.event.FocusListener; -import java.awt.event.FocusEvent; - import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; +import org.lwjgl.opengl.XRandR.Screen; final class LinuxDisplay implements DisplayImplementation { /* X11 constants */ @@ -113,6 +111,8 @@ /** Saved mode to restore with */ private DisplayMode saved_mode; private DisplayMode current_mode; + + private Screen[] savedXrandrConfig; private boolean keyboard_grabbed; private boolean pointer_grabbed; @@ -522,7 +522,14 @@ public void resetDisplayMode() { lockAWT(); try { - switchDisplayMode(saved_mode); + if( current_displaymode_extension == XRANDR && savedXrandrConfig.length > 0 ) + { + XRandR.setConfiguration( savedXrandrConfig ); + } + else + { + switchDisplayMode(saved_mode); + } if (isXF86VidModeSupported()) doSetGamma(saved_gamma); } catch (LWJGLException e) { @@ -608,6 +615,7 @@ throw new LWJGLException("No modes available"); switch (current_displaymode_extension) { case XRANDR: + savedXrandrConfig = XRandR.getConfiguration(); saved_mode = getCurrentXRandrMode(); break; case XF86VIDMODE: @@ -880,7 +888,14 @@ if (current_window_mode == FULLSCREEN_NETWM) { nIconifyWindow(getDisplay(), getWindow(), getDefaultScreen()); try { - switchDisplayModeOnTmpDisplay(saved_mode); + if( current_displaymode_extension == XRANDR && savedXrandrConfig.length > 0 ) + { + XRandR.setConfiguration( savedXrandrConfig ); + } + else + { + switchDisplayModeOnTmpDisplay(saved_mode); + } setGammaRampOnTmpDisplay(saved_gamma); } catch (LWJGLException e) { LWJGLUtil.log("Failed to restore saved mode: " + e.getMessage()); Added: trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java 2010-03-08 21:29:32 UTC (rev 3278) @@ -0,0 +1,250 @@ +/* + * Copyright (c) 2002-2010 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 java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Pattern; + +/** + * Utility for working with the xrandr commmand-line utility. Assumes + * xrandr v1.2 or higher. + * + * @author ryanm + */ +public class XRandR { + + private static Screen[] current; + + private static Map /* <String, Screen[]> */screens; + + private static void populate() { + if (screens == null) { + screens = new HashMap/* <String, Screen[]> */(); + + // ProcessBuilder pb = new ProcessBuilder( "xrandr", "-q" ); + // pb.redirectErrorStream(); + try { + // Process p= pb.start(); + Process p = Runtime.getRuntime().exec(new String[] { "xrandr", "-q"}); + + List/* <Screen> */currentList = new ArrayList/* <Screen> */(); + List/* <Screen> */possibles = new ArrayList/* <Screen> */(); + String name = null; + + BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); + String line; + while ((line = br.readLine()) != null) { + line = line.trim(); + String[] sa = line.split("\\s+"); + + if (sa[1].equals("connected")) { + // found a new screen block + if (name != null) { + screens.put(name, possibles.toArray(new Screen[possibles.size()])); + possibles.clear(); + } + name = sa[0]; + + // record the current config + currentList.add(new Screen(name, sa[2])); + } else if (Pattern.matches("\\d*x\\d*", sa[0])) { + // found a new mode line + possibles.add(new Screen(name, sa[0])); + } + } + + screens.put(name, possibles.toArray(new Screen[possibles.size()])); + + current = (Screen[]) currentList.toArray(new Screen[currentList.size()]); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + /** + * @return The current screen configuration, or an empty array if + * xrandr is not supported + */ + public static Screen[] getConfiguration() { + populate(); + + return (Screen[]) current.clone(); + } + + /** + * @param screens + * The desired screen set, may not be <code>null</code> + */ + public static void setConfiguration(Screen[]/* ... */screens) { + if (screens.length == 0) { + throw new IllegalArgumentException("Must specify at least one screen"); + } + + List/* <String> */cmd = new ArrayList/* <String> */(); + cmd.add("xrandr"); + + // switch off those in the current set not in the new set + for (int i = 0; i < current.length; i++) { + boolean found = false; + for (int j = 0; j < screens.length; j++) { + if (screens[j].name.equals(current[i].name)) { + found = true; + break; + } + } + + if (!found) { + cmd.add("--output"); + cmd.add(current[i].name); + cmd.add("--off"); + } + } + + // set up new set + for (int i = 0; i < screens.length; i++) { + screens[i].getArgs(cmd); + } + + try { + // ProcessBuilder pb = new ProcessBuilder( cmd ); + // pb.redirectErrorStream(); + // Process p = pb.start(); + Process p = Runtime.getRuntime().exec((String[]) cmd.toArray(new String[cmd.size()])); + // no output is expected, but check anyway + BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); + String line; + while ((line = br.readLine()) != null) { + System.out.println(line); + } + current = screens; + } catch (IOException e) { + e.printStackTrace(); + } + + } + + /** + * @return the name of connected screens, or an empty array if + * xrandr is not supported + */ + public static String[] getScreenNames() { + populate(); + return (String[]) screens.keySet().toArray(new String[screens.size()]); + } + + /** + * @param name + * @return the possible resolutions of the named screen, or + * <code>null</code> if there is no such screen + */ + public static Screen[] getResolutions(String name) { + populate(); + // clone the array to prevent held copies being altered + return (Screen[]) ((Screen[]) screens.get(name)).clone(); + } + + /** + * Encapsulates the configuration of a monitor. Resolution is + * fixed, position is mutable + * + * @author ryanm + */ + public static class Screen implements Cloneable { + + /** + * Name for this output + */ + public final String name; + + /** + * Width in pixels + */ + public final int width; + + /** + * Height in pixels + */ + public final int height; + + /** + * Position on the x-axis, in pixels + */ + public int xPos = 0; + + /** + * Position on the y-axis, in pixels + */ + public int yPos = 0; + + /** + * @param name + * name of the screen + * @param conf + * config string, format either widthxheight or + * widthxheight+xPos+yPos + */ + private Screen(String name, String conf) { + this.name = name; + + String[] sa = conf.split("\\D"); + width = Integer.parseInt(sa[0]); + height = Integer.parseInt(sa[1]); + + if (sa.length > 2) { + xPos = Integer.parseInt(sa[2]); + yPos = Integer.parseInt(sa[3]); + } + } + + private void getArgs(List/* <String> */argList) { + argList.add("--output"); + argList.add(name); + argList.add("--mode"); + argList.add(width + "x" + height); + argList.add("--pos"); + argList.add(xPos + "x" + yPos); + } + + // @Override + public String toString() { + return name + " " + width + "x" + height + " @ " + xPos + "x" + yPos; + } + } +} Property changes on: trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java ___________________________________________________________________ Added: svn:mime-type + text/plain This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-02-21 21:27:41
|
Revision: 3277 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3277&view=rev Author: matzon Date: 2010-02-21 21:27:35 +0000 (Sun, 21 Feb 2010) Log Message: ----------- fixed non-direct buffer issue Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/test/applet/GearsApplet.java Modified: trunk/LWJGL/src/java/org/lwjgl/test/applet/GearsApplet.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/applet/GearsApplet.java 2010-02-21 21:18:17 UTC (rev 3276) +++ trunk/LWJGL/src/java/org/lwjgl/test/applet/GearsApplet.java 2010-02-21 21:27:35 UTC (rev 3277) @@ -225,11 +225,16 @@ protected void initGL() { try { // setup ogl - FloatBuffer pos = FloatBuffer.wrap(new float[] { 5.0f, 5.0f, 10.0f, 0.0f}); - FloatBuffer red = FloatBuffer.wrap(new float[] { 0.8f, 0.1f, 0.0f, 1.0f}); - FloatBuffer green = FloatBuffer.wrap(new float[] { 0.0f, 0.8f, 0.2f, 1.0f}); - FloatBuffer blue = FloatBuffer.wrap(new float[] { 0.2f, 0.2f, 1.0f, 1.0f}); + FloatBuffer pos = BufferUtils.createFloatBuffer(4).put(new float[] { 5.0f, 5.0f, 10.0f, 0.0f}); + FloatBuffer red = BufferUtils.createFloatBuffer(4).put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f}); + FloatBuffer green = BufferUtils.createFloatBuffer(4).put(new float[] { 0.0f, 0.8f, 0.2f, 1.0f}); + FloatBuffer blue = BufferUtils.createFloatBuffer(4).put(new float[] { 0.2f, 0.2f, 1.0f, 1.0f}); + pos.flip(); + red.flip(); + green.flip(); + blue.flip(); + GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, pos); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_LIGHTING); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-02-21 21:18:25
|
Revision: 3276 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3276&view=rev Author: matzon Date: 2010-02-21 21:18:17 +0000 (Sun, 21 Feb 2010) Log Message: ----------- fixed non-direct buffer issue Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/test/opengl/Gears.java Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/Gears.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/Gears.java 2010-02-20 10:43:45 UTC (rev 3275) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/Gears.java 2010-02-21 21:18:17 UTC (rev 3276) @@ -160,10 +160,15 @@ Display.create(); // setup ogl - FloatBuffer pos = FloatBuffer.wrap(new float[] { 5.0f, 5.0f, 10.0f, 0.0f}); - FloatBuffer red = FloatBuffer.wrap(new float[] { 0.8f, 0.1f, 0.0f, 1.0f}); - FloatBuffer green = FloatBuffer.wrap(new float[] { 0.0f, 0.8f, 0.2f, 1.0f}); - FloatBuffer blue = FloatBuffer.wrap(new float[] { 0.2f, 0.2f, 1.0f, 1.0f}); + FloatBuffer pos = BufferUtils.createFloatBuffer(4).put(new float[] { 5.0f, 5.0f, 10.0f, 0.0f}); + FloatBuffer red = BufferUtils.createFloatBuffer(4).put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f}); + FloatBuffer green = BufferUtils.createFloatBuffer(4).put(new float[] { 0.0f, 0.8f, 0.2f, 1.0f}); + FloatBuffer blue = BufferUtils.createFloatBuffer(4).put(new float[] { 0.2f, 0.2f, 1.0f, 1.0f}); + + pos.flip(); + red.flip(); + green.flip(); + blue.flip(); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, pos); GL11.glEnable(GL11.GL_CULL_FACE); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |