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
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
|
1
(3) |
2
(3) |
3
(4) |
4
(2) |
5
(2) |
6
|
7
(4) |
8
(3) |
9
(1) |
10
(2) |
11
(5) |
12
(1) |
13
(2) |
14
(3) |
15
(4) |
16
(4) |
17
(6) |
18
(2) |
19
(3) |
20
(7) |
21
(4) |
22
(5) |
23
|
24
(12) |
25
(4) |
26
(1) |
27
(4) |
28
(3) |
29
(3) |
30
(2) |
31
(5) |
|
|
|
|
|
From: <sp...@us...> - 2010-05-28 00:09:04
|
Revision: 3356 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3356&view=rev Author: spasi Date: 2010-05-28 00:08:58 +0000 (Fri, 28 May 2010) Log Message: ----------- Documented glDebugMessageCallbackAMD. Modified Paths: -------------- trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_debug_output.java Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_debug_output.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_debug_output.java 2010-05-27 22:56:29 UTC (rev 3355) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_debug_output.java 2010-05-28 00:08:58 UTC (rev 3356) @@ -73,6 +73,18 @@ @Alternate("glDebugMessageInsertAMD") void glDebugMessageInsertAMD(@GLenum int category, @GLenum int severity, @GLuint int id, @Constant("buf.length()") @GLsizei int length, CharSequence buf); + /** + * The {@code AMDDebugOutputCallback.Handler} implementation passed to this method will be used for + * AMD_debug_output messages. If callback is null, any previously registered handler for the current + * thread will be unregistered and stop receiving messages. + * <p/> + * The userParam buffer will be passed to the GL, but the current implementation will ignore it and + * never return it to the handler. Instead, users are encouraged to use a custom callback handler + * implentation to store context-specific data. + * + * @param callback the callback function to use + * @param userParam the user-specified data + */ void glDebugMessageCallbackAMD(@GLpointer(value = "GLDEBUGPROCAMD", canBeNull = true) AMDDebugOutputCallback callback, @Check(canBeNull = true) @GLvoid ByteBuffer userParam); @GLuint This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sp...@us...> - 2010-05-27 22:56:36
|
Revision: 3355 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3355&view=rev Author: spasi Date: 2010-05-27 22:56:29 +0000 (Thu, 27 May 2010) Log Message: ----------- Added PixelFormat support for framebuffer CSAA (NV_multisample_coverage, WGL & GLX only). Added support for AMD_name_gen_delete and AMD_debug_output. The AMDDebugOutputCallback class enables query-less message handling. Added support for extension aliases. Modified Paths: -------------- trunk/LWJGL/build.xml trunk/LWJGL/platform_build/build-generator.xml trunk/LWJGL/src/java/org/lwjgl/opengl/AbstractDrawable.java trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableLWJGL.java trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java trunk/LWJGL/src/java/org/lwjgl/opengl/PixelFormat.java trunk/LWJGL/src/java/org/lwjgl/opengl/SharedDrawable.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/VersionTest.java trunk/LWJGL/src/java/org/lwjgl/util/generator/AutoSize.java trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/FieldsGenerator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GLpointer.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java trunk/LWJGL/src/native/common/extgl.h trunk/LWJGL/src/native/linux/context.c trunk/LWJGL/src/native/linux/extgl_glx.c trunk/LWJGL/src/native/linux/extgl_glx.h trunk/LWJGL/src/native/windows/context.c trunk/LWJGL/src/native/windows/extgl_wgl.c trunk/LWJGL/src/native/windows/extgl_wgl.h 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 Added Paths: ----------- trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputUtil.java trunk/LWJGL/src/java/org/lwjgl/util/generator/Alias.java trunk/LWJGL/src/native/common/org_lwjgl_opengl_AMDDebugOutputCallback.c trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_debug_output.java trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_multisample_coverage.java Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/build.xml 2010-05-27 22:56:29 UTC (rev 3355) @@ -253,6 +253,7 @@ <class name="org.lwjgl.openal.AL" /> <class name="org.lwjgl.opengl.GLContext" /> <class name="org.lwjgl.opengl.Pbuffer" /> + <class name="org.lwjgl.opengl.AMDDebugOutputCallback" /> </javah> </target> Modified: trunk/LWJGL/platform_build/build-generator.xml =================================================================== --- trunk/LWJGL/platform_build/build-generator.xml 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/platform_build/build-generator.xml 2010-05-27 22:56:29 UTC (rev 3355) @@ -13,8 +13,10 @@ <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/util/generator/**.java" source="1.5" target="1.5" taskname="generator"> <compilerarg value="-Xlint:all"/> </javac> + <!-- Compile helper classes used by the templates --> <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" source="1.4" target="1.4" taskname="generator"> <include name="org/lwjgl/opengl/GLSync.java"/> + <include name="org/lwjgl/opengl/AMDDebugOutputCallback.java"/> <include name="org/lwjgl/opengl/PointerWrapper.java"/> </javac> </target> Added: trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java 2010-05-27 22:56:29 UTC (rev 3355) @@ -0,0 +1,162 @@ +/* + * 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; + +/** + * Instances of this class are needed to use the callback functionality of the AMD_debug_output extension. + * A debug context must be current before creating instances of this class. Users of this class may provide + * implementations of the {@code Handler} interface to receive notifications. The same {@code Handler} + * instance may be used by different contexts but it is not recommended. Handler notifications are synchronized. + * + * @author Spasi + */ +public final class AMDDebugOutputCallback implements PointerWrapper { + + /** Severity levels. */ + private static final int GL_DEBUG_SEVERITY_HIGH_AMD = 0x9146, + GL_DEBUG_SEVERITY_MEDIUM_AMD = 0x9147, + GL_DEBUG_SEVERITY_LOW_AMD = 0x9148; + + /** Categories */ + private static final int GL_DEBUG_CATEGORY_API_ERROR_AMD = 0x9149, + GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD = 0x914A, + GL_DEBUG_CATEGORY_DEPRECATION_AMD = 0x914B, + GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD = 0x914C, + GL_DEBUG_CATEGORY_PERFORMANCE_AMD = 0x914D, + GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD = 0x914E, + GL_DEBUG_CATEGORY_APPLICATION_AMD = 0x914F, + GL_DEBUG_CATEGORY_OTHER_AMD = 0x9150; + + private final long pointer; + + /** + * Creates a AMDDebugOutputCallback with a default callback handler. + * The default handler will simply print the message on System.err. + */ + public AMDDebugOutputCallback() { + this(new Handler() { + public void handleMessage(final int id, final int category, final int severity, final String message) { + System.err.println("[LWJGL] AMD_debug_output message"); + System.err.println("\tID: " + id); + + String description; + switch ( category ) { + case GL_DEBUG_CATEGORY_API_ERROR_AMD: + description = "API ERROR"; + break; + case GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD: + description = "WINDOW SYSTEM"; + break; + case GL_DEBUG_CATEGORY_DEPRECATION_AMD: + description = "DEPRECATION"; + break; + case GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD: + description = "UNDEFINED BEHAVIOR"; + break; + case GL_DEBUG_CATEGORY_PERFORMANCE_AMD: + description = "PERFORMANCE"; + break; + case GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD: + description = "SHADER COMPILER"; + break; + case GL_DEBUG_CATEGORY_APPLICATION_AMD: + description = "APPLICATION"; + break; + case GL_DEBUG_CATEGORY_OTHER_AMD: + description = "OTHER"; + break; + default: + description = "Unknown (" + Integer.toHexString(category) + ")"; + } + System.err.println("\tCategory: " + description); + + switch ( severity ) { + case GL_DEBUG_SEVERITY_HIGH_AMD: + description = "HIGH"; + break; + case GL_DEBUG_SEVERITY_MEDIUM_AMD: + description = "MEDIUM"; + break; + case GL_DEBUG_SEVERITY_LOW_AMD: + description = "LOW"; + break; + default: + description = "Unknown (" + Integer.toHexString(category) + ")"; + } + System.err.println("\tSeverity: " + description); + + System.err.println("\tMessage: " + message); + } + }); + } + + /** + * Creates a AMDDebugOutputCallback with the specified callback handlers. + * The handler's {@code handleMessage} method will be called whenever + * debug output is generated by the GL. + * + * @param handler the callback handler + */ + public AMDDebugOutputCallback(final Handler handler) { + try { + // We have to call registerHandler reflectively because we need this class to compile before we run the Generator. + // The registerHandler method depends on org.lwjgl.opengl.Context, if we touched that we would need to compile + // the whole library (which is not possible). + Class.forName("org.lwjgl.opengl.AMDDebugOutputUtil").getMethod("registerHandler", new Class[] { Handler.class }).invoke(null, new Object[] { handler }); + } catch (Exception e) { + throw new RuntimeException(e.getCause() != null ? e.getCause() : e); + } + this.pointer = getFunctionPointer(); + } + + public long getPointer() { + return pointer; + } + + private static native long getFunctionPointer(); + + /** Implementations of this interface can be used to receive AMD_debug_output notifications. */ + public interface Handler { + + /** + * This method will be called when an AMD_debug_output message is generated. + * + * @param id the message ID + * @param category the message category + * @param severity the message severity + * @param message the string representation of the message. + */ + void handleMessage(int id, int category, int severity, String message); + + } + +} Added: trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputUtil.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputUtil.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputUtil.java 2010-05-27 22:56:29 UTC (rev 3355) @@ -0,0 +1,59 @@ +package org.lwjgl.opengl; + +import org.lwjgl.opengl.AMDDebugOutputCallback.Handler; + +import java.nio.ByteBuffer; +import java.util.Map; +import java.util.WeakHashMap; + +/** + * This class handles AMDDebugOutputCallback.Handler registration and notification. + * We could have put this in AMDDebugOutputCallback, but we need to compile it for + * the generator. Registration is done reflectively in the AMDDebugOutputCallback + * constructor. + * + * @author Spasi + */ +final class AMDDebugOutputUtil { + + private static final Map handlers = new WeakHashMap(); + + private AMDDebugOutputUtil() {} + + public static void registerHandler(final Handler handler) { + final Context ctx = Context.getCurrentContext(); + if ( ctx == null ) + throw new IllegalStateException("No context is current."); + + if ( !ctx.getContextAttribs().isDebug() ) + throw new IllegalStateException("The current context is not a debug context."); + + if ( !GLContext.getCapabilities().GL_AMD_debug_output ) + throw new IllegalStateException("AMD_debug_output is not supported."); + + handlers.put(ctx, handler); + } + + /** + * This method is called by native code. If finds the callback handler associated + * with the current Thread and calls its {@code handleMessage} method. + * + * @param id the message ID + * @param category the message category + * @param severity the message severity + * @param message the string representation of the message. + * @param userParam the user-specified data specified in glDebugMessageCallbackAMD. For the current implementation this is always null and we ignore it. + */ + private static void messageCallback(final int id, final int category, final int severity, final String message, final ByteBuffer userParam) { + synchronized ( GlobalLock.lock ) { + final Context ctx = Context.getCurrentContext(); + if ( ctx == null ) + return; + + final Handler handler = (Handler)handlers.get(ctx); + if ( handler != null ) + handler.handleMessage(id, category, severity, message); + } + } + +} Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/AbstractDrawable.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/AbstractDrawable.java 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/AbstractDrawable.java 2010-05-27 22:56:29 UTC (rev 3355) @@ -5,7 +5,6 @@ /** * @author Spasi - * @since 22 \xC1\xF0\xF1 2010 */ abstract class AbstractDrawable implements DrawableLWJGL { @@ -79,4 +78,4 @@ throw new IllegalStateException("The Drawable has no context available."); } -} \ No newline at end of file +} Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableLWJGL.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableLWJGL.java 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableLWJGL.java 2010-05-27 22:56:29 UTC (rev 3355) @@ -4,7 +4,6 @@ /** * @author Spasi - * @since 23 \xC1\xF0\xF1 2010 */ interface DrawableLWJGL extends Drawable { @@ -22,4 +21,4 @@ */ Context createSharedContext() throws LWJGLException; -} \ No newline at end of file +} Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2010-05-27 22:56:29 UTC (rev 3355) @@ -169,6 +169,22 @@ return 0; } + /** + * Helper method to get a pointer to a named function with aliases in the OpenGL library. + * + * @param aliases the function name aliases. + * + * @return the function pointer address + */ + static long getFunctionAddress(String[] aliases) { + for ( int i = 0; i < aliases.length; i++ ) { + long address = getFunctionAddress(aliases[i]); + if ( address != 0 ) + return address; + } + return 0; + } + /** Helper method to get a pointer to a named function in the OpenGL library */ static native long getFunctionAddress(String name); Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/PixelFormat.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/PixelFormat.java 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/PixelFormat.java 2010-05-27 22:56:29 UTC (rev 3355) @@ -66,6 +66,14 @@ * 0 means that anti-aliasing is disabled. */ private int samples; + /** + * The number of COLOR_SAMPLES_NV to use for Coverage Sample Anti-aliasing (CSAA). + * When this number is greater than 0, the {@code samples} property will be treated + * as if it were the COVERAGE_SAMPLES_NV property. + * <p/> + * This property is currently a no-op for the MacOS implementation. + */ + private int colorSamples; /** The number of auxiliary buffers */ private int num_aux_buffers; /** The number of bits per pixel in the accumulation buffer */ @@ -76,9 +84,15 @@ private boolean stereo; /** Whether this format specifies a floating point format */ private boolean floating_point; - /** Whether this format specifies a packed floating point format (32 bit unsigned - R11F_G11F_B10F) */ + /** + * Whether this format specifies a packed floating point format (32 bit unsigned - R11F_G11F_B10F) + * This property is currently a no-op for the MacOS implementation. + */ private boolean floating_point_packed; - /** Whether this format specifies an sRGB format */ + /** + * Whether this format specifies an sRGB format + * This property is currently a no-op for the MacOS implementation. + */ private boolean sRGB; /** @@ -132,6 +146,7 @@ this.stencil = pf.stencil; this.samples = pf.samples; + this.colorSamples = pf.colorSamples; this.num_aux_buffers = pf.num_aux_buffers; @@ -245,6 +260,38 @@ return pf; } + /** + * Returns a new PixelFormat object with the same properties as this PixelFormat and the new color samples values. + * A value greater than 0 is valid only if the {@code samples} property is also greater than 0. Additionally, the + * color samples value needs to be lower than or equal to the {@code samples} property. + * + * @param colorSamples the new color samples value. + * + * @return the new PixelFormat + */ + public PixelFormat withCoverageSamples(final int colorSamples) { + return withCoverageSamples(colorSamples, samples); + } + + /** + * Returns a new PixelFormat object with the same properties as this PixelFormat and the new color samples + * and coverage samples values. + * + * @param colorSamples the new color samples value. This value must be lower than or equal to the coverage samples value. + * @param coverageSamples the new coverage samples value. + * + * @return the new PixelFormat + */ + public PixelFormat withCoverageSamples(final int colorSamples, final int coverageSamples) { + if ( coverageSamples < 0 || colorSamples < 0 || (coverageSamples == 0 && 0 < colorSamples) || coverageSamples < colorSamples ) + throw new IllegalArgumentException("Invalid number of coverage samples specified: " + coverageSamples + " - " + colorSamples); + + final PixelFormat pf = new PixelFormat(this); + pf.samples = coverageSamples; + pf.colorSamples = colorSamples; + return pf; + } + public int getAuxBuffers() { return num_aux_buffers; } Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/SharedDrawable.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/SharedDrawable.java 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/SharedDrawable.java 2010-05-27 22:56:29 UTC (rev 3355) @@ -35,7 +35,6 @@ /** * @author Spasi - * @since 20 \xC1\xF0\xF1 2010 */ /** @@ -55,4 +54,4 @@ throw new UnsupportedOperationException(); } -} \ No newline at end of file +} Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/VersionTest.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/VersionTest.java 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/VersionTest.java 2010-05-27 22:56:29 UTC (rev 3355) @@ -148,7 +148,7 @@ boolean success = false; boolean check; - if ( majorInput < 3 || minorInput == 0 ) { + if ( majorInput < 3 || (majorInput == 3 && minorInput == 0) ) { System.out.println("\nA version less than or equal to 3.0 is requested, the context\n" + "returned may implement any of the following versions:"); @@ -252,4 +252,4 @@ System.exit(-1); } -} \ No newline at end of file +} Added: trunk/LWJGL/src/java/org/lwjgl/util/generator/Alias.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/Alias.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Alias.java 2010-05-27 22:56:29 UTC (rev 3355) @@ -0,0 +1,54 @@ +/* + * 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 can be used for extensions that have aliases + * with the exact same functionality. + * <p/> + * This is currently only implemented for context-specific functionality. + * + * @author Spasi <sp...@us...> + */ +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +public @interface Alias { + + /** The aliased extension name. */ + String value(); + + /** The function name postfix for the aliased version. (optional) */ + String postfix() default ""; + +} \ No newline at end of file Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/AutoSize.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/AutoSize.java 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/AutoSize.java 2010-05-27 22:56:29 UTC (rev 3355) @@ -49,4 +49,5 @@ public @interface AutoSize { String value(); // The name of the Buffer parameter String expression() default ""; // This value is added after the argument + boolean canBeNull() default false; // When this is true and the Buffer parameter is null, 0 will be used. } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2010-05-27 22:56:29 UTC (rev 3355) @@ -51,13 +51,13 @@ */ public class ContextCapabilitiesGenerator { - private final static String STUBS_LOADED_NAME = "loaded_stubs"; - private final static String ALL_INIT_METHOD_NAME = "initAllStubs"; - private final static String POINTER_INITIALIZER_POSTFIX = "_initNativeFunctionAddresses"; - private final static String CACHED_EXTS_VAR_NAME = "supported_extensions"; - private final static String PROFILE_MASK_VAR_NAME = "profileMask"; - private final static String EXTENSION_PREFIX = "GL_"; - private final static String CORE_PREFIX = "Open"; + private static final String STUBS_LOADED_NAME = "loaded_stubs"; + private static final String ALL_INIT_METHOD_NAME = "initAllStubs"; + private static final String POINTER_INITIALIZER_POSTFIX = "_initNativeFunctionAddresses"; + private static final String CACHED_EXTS_VAR_NAME = "supported_extensions"; + private static final String PROFILE_MASK_VAR_NAME = "profileMask"; + private static final String EXTENSION_PREFIX = "GL_"; + private static final String CORE_PREFIX = "Open"; public static void generateClassPrologue(PrintWriter writer, boolean context_specific, boolean generate_error_checks) { writer.println("public class " + Utils.CONTEXT_CAPS_CLASS_NAME + " {"); @@ -108,6 +108,12 @@ writer.print("\t\t\t&& " + CACHED_EXTS_VAR_NAME + ".contains(\""); writer.print(translateFieldName(super_interface.getDeclaration().getSimpleName()) + "\")"); } + Alias alias_annotation = d.getAnnotation(Alias.class); + if ( alias_annotation != null ) { + writer.println(); + writer.print("\t\t\t|| " + CACHED_EXTS_VAR_NAME + ".contains(\""); + writer.print(translateFieldName(alias_annotation.value()) + "\")"); + } writer.println(";"); } @@ -164,10 +170,19 @@ public static void generateInitStubs(PrintWriter writer, InterfaceDeclaration d, boolean context_specific) { if ( d.getMethods().size() > 0 ) { if ( context_specific ) { + final Alias alias_annotation = d.getAnnotation(Alias.class); + 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("\t\tif ("); + if ( alias_annotation != null ) + writer.print("("); + writer.print(CACHED_EXTS_VAR_NAME + ".contains(\""); writer.print(translateFieldName(d.getSimpleName()) + "\")"); + if ( alias_annotation != null ) { + writer.print(" || " + CACHED_EXTS_VAR_NAME + ".contains(\""); + writer.print(translateFieldName(alias_annotation.value()) + "\"))"); + } writer.print(" && !" + getAddressesInitializerName(d.getSimpleName()) + "("); if ( d.getAnnotation(DeprecatedGL.class) != null ) writer.print("forwardCompatible"); @@ -176,10 +191,16 @@ writer.print(","); writer.print("supported_extensions"); } - writer.println("))"); - //writer.print("\t\t\t" + CACHED_EXTS_VAR_NAME + ".remove(\""); + if ( alias_annotation != null ) { + writer.println(")) {"); + writer.print("\t\t\tremove(" + CACHED_EXTS_VAR_NAME + ", \""); + writer.println(translateFieldName(alias_annotation.value()) + "\");"); + } else + writer.println("))"); writer.print("\t\t\tremove(" + CACHED_EXTS_VAR_NAME + ", \""); writer.println(translateFieldName(d.getSimpleName()) + "\");"); + if ( alias_annotation != null ) + writer.println("\t\t}"); } else { writer.print("\t\tGLContext." + Utils.STUB_INITIALIZER_NAME + "(" + Utils.getSimpleClassName(d)); writer.println(".class, " + CACHED_EXTS_VAR_NAME + ", \"" + translateFieldName(d.getSimpleName()) + "\");"); @@ -210,6 +231,9 @@ writer.print("Set supported_extensions"); } + Alias alias_annotation = d.getAnnotation(Alias.class); + boolean aliased = alias_annotation != null && alias_annotation.postfix().length() > 0; + writer.println(") {"); writer.println("\t\treturn "); @@ -266,9 +290,12 @@ writer.print(", "); } writer.print("}, "); + } else if ( aliased ) { + writer.print("GLContext.getFunctionAddress(new String[] {\"" + method.getSimpleName() + "\",\"" + method.getSimpleName() + alias_annotation.postfix() + "\"})) != 0"); } else writer.print("GLContext.getFunctionAddress("); - writer.print("\"" + method.getSimpleName() + "\")) != 0"); + if ( !aliased ) + writer.print("\"" + method.getSimpleName() + "\")) != 0"); if ( deprecated || dependent != null ) writer.print(')'); if ( optional ) Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/FieldsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/FieldsGenerator.java 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/FieldsGenerator.java 2010-05-27 22:56:29 UTC (rev 3355) @@ -32,70 +32,90 @@ package org.lwjgl.util.generator; -import com.sun.mirror.declaration.*; -import com.sun.mirror.type.*; +import java.io.PrintWriter; +import java.util.Collection; -import java.io.*; -import java.util.*; +import com.sun.mirror.declaration.FieldDeclaration; +import com.sun.mirror.declaration.Modifier; +import com.sun.mirror.type.PrimitiveType; +import com.sun.mirror.type.TypeMirror; public class FieldsGenerator { + private static void validateField(FieldDeclaration field) { - // Check if field is "public static final" - Collection<Modifier> modifiers = field.getModifiers(); - if (modifiers.size() != 3 - || !modifiers.contains(Modifier.PUBLIC) - || !modifiers.contains(Modifier.STATIC) - || !modifiers.contains(Modifier.FINAL)) { - throw new RuntimeException("Field " + field.getSimpleName() + " is not declared public static final"); - } + // Check if field is "public static final" + Collection<Modifier> modifiers = field.getModifiers(); + if ( modifiers.size() != 3 + || !modifiers.contains(Modifier.PUBLIC) + || !modifiers.contains(Modifier.STATIC) + || !modifiers.contains(Modifier.FINAL) ) { + throw new RuntimeException("Field " + field.getSimpleName() + " is not declared public static final"); + } - // Check suported types (int, long, float, String) - TypeMirror field_type = field.getType(); - if (field_type instanceof PrimitiveType) { - PrimitiveType field_type_prim = (PrimitiveType) field_type; - PrimitiveType.Kind field_kind = field_type_prim.getKind(); - if (field_kind != PrimitiveType.Kind.INT - && field_kind != PrimitiveType.Kind.LONG - && field_kind != PrimitiveType.Kind.FLOAT) { - throw new RuntimeException("Field " + field.getSimpleName() + " is not of type 'int', 'long' or 'float'"); - } - } else if (field_type.toString().equals("java.lang.String")) { - } else { - throw new RuntimeException("Field " + field.getSimpleName() + " is not a primitive type or String"); - } + // Check suported types (int, long, float, String) + TypeMirror field_type = field.getType(); + if ( field_type instanceof PrimitiveType ) { + PrimitiveType field_type_prim = (PrimitiveType)field_type; + PrimitiveType.Kind field_kind = field_type_prim.getKind(); + if ( field_kind != PrimitiveType.Kind.INT + && field_kind != PrimitiveType.Kind.LONG + && field_kind != PrimitiveType.Kind.FLOAT ) { + throw new RuntimeException("Field " + field.getSimpleName() + " is not of type 'int', 'long' or 'float'"); + } + } else if ( "java.lang.String".equals(field_type.toString()) ) { + } else { + throw new RuntimeException("Field " + field.getSimpleName() + " is not a primitive type or String"); + } - Object field_value = field.getConstantValue(); - if (field_value == null) { - throw new RuntimeException("Field " + field.getSimpleName() + " has no initial value"); - } + Object field_value = field.getConstantValue(); + if ( field_value == null ) { + throw new RuntimeException("Field " + field.getSimpleName() + " has no initial value"); + } } - private static void generateField(PrintWriter writer, FieldDeclaration field) { - validateField(field); + private static void generateField(PrintWriter writer, FieldDeclaration field, FieldDeclaration prev_field) { + validateField(field); - Object value = field.getConstantValue(); - String field_value_string; - Class field_value_class = value.getClass(); - if (field_value_class.equals(Integer.class)) { - field_value_string = "0x" + Integer.toHexString((Integer) field.getConstantValue()); - } else if (field_value_class.equals(Long.class)) { - field_value_string = "0x" + Long.toHexString((Long) field.getConstantValue()) + 'l'; - } else if (field_value_class.equals(Float.class)) { - field_value_string = field.getConstantValue() + "f"; - } else if (field_value_class.equals(String.class)) { - field_value_string = "\"" + field.getConstantValue() + "\""; - } else { - throw new RuntimeException("Field is of unexpected type. This means there is a bug in validateField()."); - } + Object value = field.getConstantValue(); + String field_value_string; + Class field_value_class = value.getClass(); + if ( field_value_class.equals(Integer.class) ) { + field_value_string = "0x" + Integer.toHexString((Integer)field.getConstantValue()).toUpperCase(); + } else if ( field_value_class.equals(Long.class) ) { + field_value_string = "0x" + Long.toHexString((Long)field.getConstantValue()).toUpperCase() + 'L'; + } else if ( field_value_class.equals(Float.class) ) { + field_value_string = field.getConstantValue() + "f"; + } else if ( field_value_class.equals(String.class) ) { + field_value_string = "\"" + field.getConstantValue() + "\""; + } else { + throw new RuntimeException("Field is of unexpected type. This means there is a bug in validateField()."); + } - Utils.printDocComment(writer, field); - // Print field declaration - writer.println("\tpublic static final " + field.getType().toString() + " " + field.getSimpleName() + " = " + field_value_string + ";"); + boolean hadDoc = prev_field != null && prev_field.getDocComment() != null; + boolean hasDoc = field.getDocComment() != null; + boolean newBatch = prev_field == null || !prev_field.getType().equals(field.getType()) || (!hadDoc && field.getDocComment() != null) || (hadDoc && hasDoc && !prev_field.getDocComment().equals(field.getDocComment())); + + // Print field declaration + if ( newBatch ) { + if ( prev_field != null ) + writer.println(";\n"); + + Utils.printDocComment(writer, field); + writer.print("\tpublic static final " + field.getType().toString() + " " + field.getSimpleName() + " = " + field_value_string); + } else + writer.print(",\n\t\t" + field.getSimpleName() + " = " + field_value_string); } public static void generateFields(PrintWriter writer, Collection<FieldDeclaration> fields) { - for (FieldDeclaration field : fields) - generateField(writer, field); + if ( 0 < fields.size() ) { + writer.println(); + FieldDeclaration prev_field = null; + for ( FieldDeclaration field : fields ) { + generateField(writer, field, prev_field); + prev_field = field; + } + writer.println(";"); + } } } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLpointer.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLpointer.java 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLpointer.java 2010-05-27 22:56:29 UTC (rev 3355) @@ -40,4 +40,5 @@ @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLpointer { String value(); // The native pointer type. + boolean canBeNull() default false; // Whether the pointer may be null. } \ 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-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-05-27 22:56:29 UTC (rev 3355) @@ -201,12 +201,12 @@ java_writer.println(); if (is_final) { // Write private constructor to avoid instantiation - java_writer.println("\tprivate " + Utils.getSimpleClassName(d) + "() {"); - java_writer.println("\t}"); + java_writer.println("\tprivate " + Utils.getSimpleClassName(d) + "() {}"); + } + if (d.getMethods().size() > 0 && !context_specific) { java_writer.println(); + java_writer.println("\tstatic native void " + Utils.STUB_INITIALIZER_NAME + "() throws LWJGLException;"); } - if (d.getMethods().size() > 0 && !context_specific) - java_writer.println("\tstatic native void " + Utils.STUB_INITIALIZER_NAME + "() throws LWJGLException;"); JavaMethodsGenerator.generateMethodsJava(env, type_map, java_writer, d, generate_error_checks, context_specific); java_writer.println("}"); java_writer.close(); Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-05-27 22:56:29 UTC (rev 3355) @@ -387,7 +387,10 @@ String auto_parameter_name = auto_type_annotation.value(); ParameterDeclaration auto_target_param = Utils.findParameter(method, auto_parameter_name); TypeInfo auto_target_type_info = typeinfos_instance.get(auto_target_param); - writer.print("(" + auto_parameter_name + ".remaining()"); + if ( auto_type_annotation.canBeNull() ) + writer.print("((" + auto_parameter_name + " == null ? 0 : " + auto_parameter_name + ".remaining())"); + else + writer.print("(" + auto_parameter_name + ".remaining()"); // Shift the remaining if the target parameter is multityped and there's no AutoType to track type boolean shift_remaining = !hasAnyParameterAutoTypeAnnotation(method, auto_target_param) && Utils.isParameterMultiTyped(auto_target_param); if (shift_remaining) { @@ -446,8 +449,13 @@ writer.print(offset == null ? "0" : offset); } else writer.print("0"); - } else if ( param.getAnnotation(GLpointer.class) != null ) { - writer.print(".getPointer()"); + } else { + GLpointer pointer_annotation = param.getAnnotation(GLpointer.class); + if ( pointer_annotation != null ) { + if ( pointer_annotation.canBeNull() ) + writer.print(" == null ? 0 : " + param.getSimpleName()); + writer.print(".getPointer()"); + } } } } Modified: trunk/LWJGL/src/native/common/extgl.h =================================================================== --- trunk/LWJGL/src/native/common/extgl.h 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/native/common/extgl.h 2010-05-27 22:56:29 UTC (rev 3355) @@ -133,6 +133,9 @@ typedef uint64_t GLuint64; typedef struct __GLsync *GLsync; +/* AMD_debug_output callback function pointer. */ +typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam); + /* helper stuff */ /* initializes everything, call this right after the rc is created. the function returns true if successful */ Added: trunk/LWJGL/src/native/common/org_lwjgl_opengl_AMDDebugOutputCallback.c =================================================================== --- trunk/LWJGL/src/native/common/org_lwjgl_opengl_AMDDebugOutputCallback.c (rev 0) +++ trunk/LWJGL/src/native/common/org_lwjgl_opengl_AMDDebugOutputCallback.c 2010-05-27 22:56:29 UTC (rev 3355) @@ -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. + */ + +/** + * JNI implementation of the AMD_debug_output function callback. + * + * @author Spasi + */ + +#include <jni.h> +#include "common_tools.h" +#include "extgl.h" +#include "org_lwjgl_opengl_AMDDebugOutputCallback.h" + +static void APIENTRY debugOutputCallback(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam) { + jclass callback_class; + jmethodID callback_method; + JNIEnv *env = getThreadEnv(); + if (env != NULL && !(*env)->ExceptionOccurred(env)) { + callback_class = (*env)->FindClass(env, "org/lwjgl/opengl/AMDDebugOutputUtil"); + if ( callback_class != NULL ) { + callback_method = (*env)->GetStaticMethodID(env, callback_class, "messageCallback", "(IIILjava/lang/String;Ljava/nio/ByteBuffer;)V"); + if ( callback_method != NULL ) { + (*env)->CallStaticVoidMethod(env, callback_class, callback_method, + (jint)id, + (jint)category, + (jint)severity, + NewStringNativeWithLength(env, message, length), + NULL + ); + } + } + } +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_AMDDebugOutputCallback_getFunctionPointer(JNIEnv *env, jclass clazz) { + return (jlong)(intptr_t)&debugOutputCallback; +} Modified: trunk/LWJGL/src/native/linux/context.c =================================================================== --- trunk/LWJGL/src/native/linux/context.c 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/native/linux/context.c 2010-05-27 22:56:29 UTC (rev 3355) @@ -119,6 +119,7 @@ int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); + int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); @@ -161,7 +162,9 @@ // Assume the caller has checked support for multisample if (samples > 0) { putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); - putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); + putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); // GLX_COVERAGE_SAMPLES_NV if colorSamples > 0 + if ( colorSamples > 0 ) + putAttrib(&attrib_list, GLX_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples); } if (sRGB) { putAttrib(&attrib_list, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB); putAttrib(&attrib_list, True); @@ -199,6 +202,7 @@ int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); + int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); @@ -228,7 +232,9 @@ // Assume the caller has checked support for multisample if (samples > 0) { putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); - putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); + putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); // GLX_COVERAGE_SAMPLES_NV if colorSamples > 0 + if ( colorSamples > 0 ) + putAttrib(&attrib_list, GLX_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples); } if (sRGB) putAttrib(&attrib_list, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB); @@ -289,6 +295,11 @@ throwException(env, "Samples > 0 specified but there's no support for GLX_ARB_multisample"); return false; } + int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); + if (colorSamples > 0 && !extension_flags.GLX_NV_multisample_coverage) { + throwException(env, "Color samples > 0 specified but there's no support for GLX_NV_multisample_coverage"); + return false; + } bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); if (floating_point && !(extension_flags.GLX13 && extension_flags.GLX_ARB_fbconfig_float)) { // We need GLX13 to support floating point throwException(env, "Floating point specified but there's no support for GLX_ARB_fbconfig_float"); Modified: trunk/LWJGL/src/native/linux/extgl_glx.c =================================================================== --- trunk/LWJGL/src/native/linux/extgl_glx.c 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/native/linux/extgl_glx.c 2010-05-27 22:56:29 UTC (rev 3355) @@ -160,6 +160,7 @@ extension_flags->GLX_EXT_fbconfig_packed_float = GLXQueryExtension(disp, screen, "GLX_EXT_fbconfig_packed_float"); extension_flags->GLX_ARB_framebuffer_sRGB = GLXQueryExtension(disp, screen, "GLX_ARB_framebuffer_sRGB") || GLXQueryExtension(disp, screen, "GLX_EXT_framebuffer_sRGB"); extension_flags->GLX_ARB_create_context = GLXQueryExtension(disp, screen, "GLX_ARB_create_context"); + extension_flags->GLX_NV_multisample_coverage = GLXQueryExtension(disp, screen, "GLX_NV_multisample_coverage"); } bool extgl_Open(JNIEnv *env) { Modified: trunk/LWJGL/src/native/linux/extgl_glx.h =================================================================== --- trunk/LWJGL/src/native/linux/extgl_glx.h 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/native/linux/extgl_glx.h 2010-05-27 22:56:29 UTC (rev 3355) @@ -271,6 +271,11 @@ #define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001 #define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 +/* GLX_NV_multisample_coverage */ +#define GLX_COVERAGE_SAMPLES_NV 100001 +#define GLX_COLOR_SAMPLES_NV 0x20B3 + + typedef XID GLXContextID; typedef XID GLXPixmap; typedef XID GLXDrawable; @@ -346,6 +351,7 @@ bool GLX_EXT_fbconfig_packed_float; bool GLX_ARB_framebuffer_sRGB; bool GLX_ARB_create_context; + bool GLX_NV_multisample_coverage; } GLXExtensions; /* Add _ to global symbols to avoid symbol clash with the OpenGL library */ Modified: trunk/LWJGL/src/native/windows/context.c =================================================================== --- trunk/LWJGL/src/native/windows/context.c 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/native/windows/context.c 2010-05-27 22:56:29 UTC (rev 3355) @@ -187,6 +187,7 @@ int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); + int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); @@ -234,7 +235,9 @@ // Assume caller checked extension availability if (samples > 0) { putAttrib(&attrib_list, WGL_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); - putAttrib(&attrib_list, WGL_SAMPLES_ARB); putAttrib(&attrib_list, samples); + putAttrib(&attrib_list, WGL_SAMPLES_ARB); putAttrib(&attrib_list, samples); // WGL_COVERAGE_SAMPLES_NV if colorSamples > 0 + if ( colorSamples > 0 ) + putAttrib(&attrib_list, WGL_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples); } putAttrib(&attrib_list, WGL_ACCUM_BITS_ARB); putAttrib(&attrib_list, accum_bpp); putAttrib(&attrib_list, WGL_ACCUM_ALPHA_BITS_ARB); putAttrib(&attrib_list, accum_alpha); @@ -385,7 +388,7 @@ return findPixelFormatFromBPP(env, hdc, pixel_format, bpp, double_buffer); } -static bool validateAndGetExtensions(JNIEnv *env, WGLExtensions *extensions, HDC dummy_hdc, HGLRC dummy_hglrc, int samples, bool floating_point, bool floating_point_packed, bool sRGB, jobject pixelFormatCaps) { +static bool validateAndGetExtensions(JNIEnv *env, WGLExtensions *extensions, HDC dummy_hdc, HGLRC dummy_hglrc, int samples, int colorSamples, bool floating_point, bool floating_point_packed, bool sRGB, jobject pixelFormatCaps) { if (!wglMakeCurrent(dummy_hdc, dummy_hglrc)) { throwException(env, "Could not bind context to dummy window"); return false; @@ -400,6 +403,10 @@ throwException(env, "No support for WGL_ARB_multisample"); return false; } + if (colorSamples > 0 && !extensions->WGL_NV_multisample_coverage) { + throwException(env, "No support for WGL_NV_multisample_coverage"); + return false; + } /* * Apparently, some drivers don't report WGL_ARB_pixel_format_float * even though GL_ARB_color_buffer_float and WGL_ATI_color_format_float @@ -435,6 +442,7 @@ jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); + int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); bool floating_point_packed = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); @@ -461,7 +469,7 @@ // Save the current HDC and HGLRC to avoid disruption saved_current_hdc = wglGetCurrentDC(); saved_current_hglrc = wglGetCurrentContext(); - if (validateAndGetExtensions(env, &extensions, dummy_hdc, dummy_hglrc, samples, floating_point, floating_point_packed, sRGB, pixelFormatCaps)) { + if (validateAndGetExtensions(env, &extensions, dummy_hdc, dummy_hglrc, samples, colorSamples, floating_point, floating_point_packed, sRGB, pixelFormatCaps)) { pixel_format_id = findPixelFormatARB(env, hdc, &extensions, pixel_format, pixelFormatCaps, use_hdc_bpp, window, pbuffer, double_buffer); } wglMakeCurrent(saved_current_hdc, saved_current_hglrc); Modified: trunk/LWJGL/src/native/windows/extgl_wgl.c =================================================================== --- trunk/LWJGL/src/native/windows/extgl_wgl.c 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/native/windows/extgl_wgl.c 2010-05-27 22:56:29 UTC (rev 3355) @@ -152,6 +152,7 @@ extensions->WGL_ARB_framebuffer_sRGB = WGLQueryExtension(extensions, "WGL_ARB_framebuffer_sRGB") || WGLQueryExtension(extensions, "WGL_EXT_framebuffer_sRGB"); extensions->WGL_EXT_pixel_format_packed_float = WGLQueryExtension(extensions, "WGL_EXT_pixel_format_packed_float"); extensions->WGL_ARB_create_context = WGLQueryExtension(extensions, "WGL_ARB_create_context"); + extensions->WGL_NV_multisample_coverage = WGLQueryExtension(extensions, "WGL_NV_multisample_coverage"); } static void extgl_InitWGLEXTExtensionsString(WGLExtensions *extensions) { Modified: trunk/LWJGL/src/native/windows/extgl_wgl.h =================================================================== --- trunk/LWJGL/src/native/windows/extgl_wgl.h 2010-05-25 06:01:34 UTC (rev 3354) +++ trunk/LWJGL/src/native/windows/extgl_wgl.h 2010-05-27 22:56:29 UTC (rev 3355) @@ -200,6 +200,15 @@ typedef HGLRC (APIENTRY * wglCreateContextAttribsARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList); +/*---------------------------------------------------------------------*/ +/*------------ WGL_NV_multisample_coverage ----------------------------*/ +/*---------------------------------------------------------------------*/ + +#define WGL_COVERAGE_SAMPLES_NV 0x2042 +#define WGL_COLOR_SAMPLES_NV 0x20B9 + +/*---------------------------------------------------------------------*/ + typedef struct { bool WGL_ARB_buffer_region; bool WGL_ARB_extensions_string; @@ -217,6 +226,7 @@ bool WGL_ARB_framebuffer_sRGB; bool WGL_EXT_pixel_format_packed_float; bool WGL_ARB_create_context; + bool WGL_NV_multisample_coverage; wglGetExtensionsStringEXTPROC wglGetExtensionsStringEXT; Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_debug_output.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_debug_output.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_debug_output.java 2010-05-27 22:56:29 UTC (rev 3355) @@ -0,0 +1,87 @@ +/* + * 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; + +@Alias(value = "AMDX_debug_output", postfix = "X") +public interface AMD_debug_output { + + /** Tokens accepted by GetIntegerv: */ + int GL_MAX_DEBUG_MESSAGE_LENGTH_AMD = 0x9143, + GL_MAX_DEBUG_LOGGED_MESSAGES_AMD = 0x9144, + GL_DEBUG_LOGGED_MESSAGES_AMD = 0x9145; + + /** + * Tokens accepted by DebugMessageEnableAMD, GetDebugMessageLogAMD, + * DebugMessageInsertAMD, and DEBUGPROCAMD callback function + * for <severity>: + */ + int GL_DEBUG_SEVERITY_HIGH_AMD = 0x9146, + GL_DEBUG_SEVERITY_MEDIUM_AMD = 0x9147, + GL_DEBUG_SEVERITY_LOW_AMD = 0x9148; + + /** + * Tokens accepted by DebugMessageEnableAMD, GetDebugMessageLogAMD, + * and DEBUGPROCAMD callback function for <category>: + */ + int GL_DEBUG_CATEGORY_API_ERROR_AMD = 0x9149, + GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD = 0x914A, + GL_DEBUG_CATEGORY_DEPRECATION_AMD = 0x914B, + GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD = 0x914C, + GL_DEBUG_CATEGORY_PERFORMANCE_AMD = 0x914D, + GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD = 0x914E, + GL_DEBUG_CATEGORY_APPLICATION_AMD = 0x914F, + GL_DEBUG_CATEGORY_OTHER_AMD = 0x9150; + + void glDebugMessageEnableAMD(@GLenum int category, @GLenum int severity, @AutoSize(value = "ids", canBeNull = true) @GLsizei int count, @Check(canBeNull = true) @Const @GLuint IntBuffer ids, boolean enabled); + + void glDebugMessageInsertAMD(@GLenum int category, @GLenum int severity, @GLuint int id, @AutoSize("buf") @GLsizei int length, @Const @GLchar ByteBuffer buf); + + @Alternate("glDebugMessageInsertAMD") + void glDebugMessageInsertAMD(@GLenum int category, @GLenum int severity, @GLuint int id, @Constant("buf.length()") @GLsizei int length, CharSequence buf); + + void glDebugMessageCallbackAMD(@GLpointer(value = "GLDEBUGPROCAMD", canBeNull = true) AMDDebugOutputCallback callback, @Check(canBeNull = true) @GLvoid ByteBuffer userParam); + + @GLuint + int glGetDebugMessageLogAMD(@GLuint int count, + @AutoSize(value = "messageLog", canBeNull = true) @GLsizei int logSize, + @Check(value = "count", canBeNull = true) @GLenum IntBuffer categories, + @Check(value = "count", canBeNull = true) @GLuint IntBuffer severities, + @Check(value = "count", canBeNull = true) @GLuint IntBuffer ids, + @Check(value = "count", canBeNull = true) @GLsizei IntBuffer lengths, + @Check(canBeNull = true) @OutParameter @GLchar ByteBuffer messageLog); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java 2010-05-27 22:56:29 UTC (rev 3355) @@ -0,0 +1,60 @@ +/* + * 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, +... [truncated message content] |
From: <ma...@us...> - 2010-05-25 06:01:41
|
Revision: 3354 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3354&view=rev Author: matzon Date: 2010-05-25 06:01:34 +0000 (Tue, 25 May 2010) Log Message: ----------- "fixed" usage of generics Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/test/openal/OpenALInfo.java Modified: trunk/LWJGL/src/java/org/lwjgl/test/openal/OpenALInfo.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/openal/OpenALInfo.java 2010-05-24 22:39:06 UTC (rev 3353) +++ trunk/LWJGL/src/java/org/lwjgl/test/openal/OpenALInfo.java 2010-05-25 06:01:34 UTC (rev 3354) @@ -33,6 +33,9 @@ import java.nio.IntBuffer; import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; import java.util.Map.Entry; import org.lwjgl.BufferUtils; @@ -148,7 +151,7 @@ ALC10.alcGetInteger(device, EFX10.ALC_EFX_MAJOR_VERSION, major); ALC10.alcGetInteger(device, EFX10.ALC_EFX_MINOR_VERSION, minor); if(ALC10.alcGetError(device) == ALC10.ALC_NO_ERROR) { - System.out.println(String.format("EFX version: %d.%d",major.get(), minor.get())); + System.out.println("EFX version: " + major.get() + "." + minor.get()); } ALC10.alcGetInteger(device, EFX10.ALC_MAX_AUXILIARY_SENDS, sends); @@ -157,36 +160,44 @@ } System.out.println("Supported filters: "); - HashMap<String, Integer> filters = new HashMap<String, Integer>(); - filters.put("Low-pass", EFX10.AL_FILTER_LOWPASS); - filters.put("High-pass", EFX10.AL_FILTER_HIGHPASS); - filters.put("Band-pass", EFX10.AL_FILTER_BANDPASS); + HashMap filters = new HashMap(); + filters.put("Low-pass", new Integer(EFX10.AL_FILTER_LOWPASS)); + filters.put("High-pass", new Integer(EFX10.AL_FILTER_HIGHPASS)); + filters.put("Band-pass", new Integer(EFX10.AL_FILTER_BANDPASS)); - for(Entry<String, Integer> entry : filters.entrySet()) { - if(EFXUtil.isFilterSupported(entry.getValue())) { - System.out.println(" " + entry.getKey()); + Set entries = filters.entrySet(); + for(Iterator i = entries.iterator(); i.hasNext();) { + Map.Entry entry = (Entry) i.next(); + int value = ((Integer)entry.getValue()).intValue(); + String key = (String) entry.getKey(); + if(EFXUtil.isFilterSupported(value)) { + System.out.println(" " + key); } } System.out.println("Supported effects: "); - HashMap<String, Integer> effects = new HashMap<String, Integer>(); - effects.put("EAX Reverb", EFX10.AL_EFFECT_EAXREVERB); - effects.put("Reverb", EFX10.AL_EFFECT_REVERB); - effects.put("Chorus", EFX10.AL_EFFECT_CHORUS); - effects.put("Distortion", EFX10.AL_EFFECT_DISTORTION); - effects.put("Echo", EFX10.AL_EFFECT_ECHO); - effects.put("Flanger", EFX10.AL_EFFECT_FLANGER); - effects.put("Frequency Shifter", EFX10.AL_EFFECT_FREQUENCY_SHIFTER); - effects.put("Vocal Morpher", EFX10.AL_EFFECT_VOCAL_MORPHER); - effects.put("Pitch Shifter", EFX10.AL_EFFECT_PITCH_SHIFTER); - effects.put("Ring Modulator", EFX10.AL_EFFECT_RING_MODULATOR); - effects.put("Autowah", EFX10.AL_EFFECT_AUTOWAH); - effects.put("Compressor", EFX10.AL_EFFECT_COMPRESSOR); - effects.put("Equalizer", EFX10.AL_EFFECT_EQUALIZER); + HashMap effects = new HashMap(); + effects.put("EAX Reverb", new Integer(EFX10.AL_EFFECT_EAXREVERB)); + effects.put("Reverb", new Integer(EFX10.AL_EFFECT_REVERB)); + effects.put("Chorus", new Integer(EFX10.AL_EFFECT_CHORUS)); + effects.put("Distortion", new Integer(EFX10.AL_EFFECT_DISTORTION)); + effects.put("Echo", new Integer(EFX10.AL_EFFECT_ECHO)); + effects.put("Flanger", new Integer(EFX10.AL_EFFECT_FLANGER)); + effects.put("Frequency Shifter", new Integer(EFX10.AL_EFFECT_FREQUENCY_SHIFTER)); + effects.put("Vocal Morpher", new Integer(EFX10.AL_EFFECT_VOCAL_MORPHER)); + effects.put("Pitch Shifter", new Integer(EFX10.AL_EFFECT_PITCH_SHIFTER)); + effects.put("Ring Modulator", new Integer(EFX10.AL_EFFECT_RING_MODULATOR)); + effects.put("Autowah", new Integer(EFX10.AL_EFFECT_AUTOWAH)); + effects.put("Compressor", new Integer(EFX10.AL_EFFECT_COMPRESSOR)); + effects.put("Equalizer", new Integer(EFX10.AL_EFFECT_EQUALIZER)); - for(Entry<String, Integer> entry : effects.entrySet()) { - if(EFXUtil.isEffectSupported(entry.getValue())) { - System.out.println(" " + entry.getKey()); + entries = filters.entrySet(); + for(Iterator i = entries.iterator(); i.hasNext();) { + Map.Entry entry = (Entry) i.next(); + int value = ((Integer)entry.getValue()).intValue(); + String key = (String) entry.getKey(); + if(EFXUtil.isEffectSupported(value)) { + System.out.println(" " + key); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-05-24 22:39:12
|
Revision: 3353 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3353&view=rev Author: matzon Date: 2010-05-24 22:39:06 +0000 (Mon, 24 May 2010) Log Message: ----------- bump version to 2.5 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-05-24 22:37:11 UTC (rev 3352) +++ trunk/LWJGL/platform_build/build-definitions.xml 2010-05-24 22:39:06 UTC (rev 3353) @@ -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.4.2" /> + <property name="lwjgl.version" value="2.5" /> <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"/> <!-- ================================================================== --> Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2010-05-24 22:37:11 UTC (rev 3352) +++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2010-05-24 22:39:06 UTC (rev 3353) @@ -54,7 +54,7 @@ private static final String JNI_LIBRARY_NAME = "lwjgl"; /** Current version of library */ - private static final String VERSION = "2.4.2"; + private static final String VERSION = "2.5"; /** 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-05-24 22:37:17
|
Revision: 3352 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3352&view=rev Author: matzon Date: 2010-05-24 22:37:11 +0000 (Mon, 24 May 2010) Log Message: ----------- EFX patch by Ciardhubh (missing generator entry) Modified Paths: -------------- trunk/LWJGL/platform_build/build-generator.xml Modified: trunk/LWJGL/platform_build/build-generator.xml =================================================================== --- trunk/LWJGL/platform_build/build-generator.xml 2010-05-24 22:36:07 UTC (rev 3351) +++ trunk/LWJGL/platform_build/build-generator.xml 2010-05-24 22:37:11 UTC (rev 3352) @@ -37,7 +37,7 @@ <arg value="-d"/> <arg path="${lwjgl.src.native}/generated"/> <arg value="-Atypemap=org.lwjgl.util.generator.ALTypeMap"/> - <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java"/> + <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java, org/lwjgl/openal/EFX10.java"/> </apply> </target> @@ -55,7 +55,7 @@ <arg path="${lwjgl.src.native}/generated"/> <arg value="-Atypemap=org.lwjgl.util.generator.ALTypeMap"/> <arg value="-Ageneratechecks"/> - <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java"/> + <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java, org/lwjgl/openal/EFX10.java"/> </apply> </target> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-05-24 22:36:13
|
Revision: 3351 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3351&view=rev Author: matzon Date: 2010-05-24 22:36:07 +0000 (Mon, 24 May 2010) Log Message: ----------- cleanup Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/test/openal/OpenALInfo.java Modified: trunk/LWJGL/src/java/org/lwjgl/test/openal/OpenALInfo.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/openal/OpenALInfo.java 2010-05-24 22:35:28 UTC (rev 3350) +++ trunk/LWJGL/src/java/org/lwjgl/test/openal/OpenALInfo.java 2010-05-24 22:36:07 UTC (rev 3351) @@ -33,8 +33,6 @@ import java.nio.IntBuffer; import java.util.HashMap; -import java.util.Map; -import java.util.Set; import java.util.Map.Entry; import org.lwjgl.BufferUtils; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-05-24 22:35:34
|
Revision: 3350 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3350&view=rev Author: matzon Date: 2010-05-24 22:35:28 +0000 (Mon, 24 May 2010) Log Message: ----------- updates to info app to print efx info Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/test/openal/OpenALInfo.java Modified: trunk/LWJGL/src/java/org/lwjgl/test/openal/OpenALInfo.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/openal/OpenALInfo.java 2010-05-24 22:34:59 UTC (rev 3349) +++ trunk/LWJGL/src/java/org/lwjgl/test/openal/OpenALInfo.java 2010-05-24 22:35:28 UTC (rev 3350) @@ -32,6 +32,10 @@ package org.lwjgl.test.openal; import java.nio.IntBuffer; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; @@ -40,6 +44,8 @@ import org.lwjgl.openal.ALC10; import org.lwjgl.openal.ALC11; import org.lwjgl.openal.ALCdevice; +import org.lwjgl.openal.EFX10; +import org.lwjgl.openal.EFXUtil; /** * @@ -70,6 +76,7 @@ printALCInfo(); printALInfo(); + printEFXInfo(); checkForErrors(); @@ -94,7 +101,7 @@ device = ALC10.alcGetContextsDevice(ALC10.alcGetCurrentContext()); checkForErrors(); - System.out.println("Default device: " + ALC10.alcGetString(device, ALC10.ALC_DEFAULT_DEVICE_SPECIFIER)); + System.out.println("Default playback device: " + ALC10.alcGetString(device, ALC10.ALC_DEFAULT_DEVICE_SPECIFIER)); System.out.println("Default capture device: " + ALC10.alcGetString(device, ALC11.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER)); @@ -130,6 +137,62 @@ checkForErrors(); } + private void printEFXInfo() { + if(!EFXUtil.isEfxSupported()) { + System.out.println("EFX not available"); + return; + } + + ALCdevice device = AL.getDevice(); + IntBuffer major = BufferUtils.createIntBuffer(1); + IntBuffer minor = BufferUtils.createIntBuffer(1); + IntBuffer sends = BufferUtils.createIntBuffer(1); + ALC10.alcGetInteger(device, EFX10.ALC_EFX_MAJOR_VERSION, major); + ALC10.alcGetInteger(device, EFX10.ALC_EFX_MINOR_VERSION, minor); + if(ALC10.alcGetError(device) == ALC10.ALC_NO_ERROR) { + System.out.println(String.format("EFX version: %d.%d",major.get(), minor.get())); + } + + ALC10.alcGetInteger(device, EFX10.ALC_MAX_AUXILIARY_SENDS, sends); + if(ALC10.alcGetError(device) == ALC10.ALC_NO_ERROR) { + System.out.println("Max auxiliary sends: " + sends.get()); + } + + System.out.println("Supported filters: "); + HashMap<String, Integer> filters = new HashMap<String, Integer>(); + filters.put("Low-pass", EFX10.AL_FILTER_LOWPASS); + filters.put("High-pass", EFX10.AL_FILTER_HIGHPASS); + filters.put("Band-pass", EFX10.AL_FILTER_BANDPASS); + + for(Entry<String, Integer> entry : filters.entrySet()) { + if(EFXUtil.isFilterSupported(entry.getValue())) { + System.out.println(" " + entry.getKey()); + } + } + + System.out.println("Supported effects: "); + HashMap<String, Integer> effects = new HashMap<String, Integer>(); + effects.put("EAX Reverb", EFX10.AL_EFFECT_EAXREVERB); + effects.put("Reverb", EFX10.AL_EFFECT_REVERB); + effects.put("Chorus", EFX10.AL_EFFECT_CHORUS); + effects.put("Distortion", EFX10.AL_EFFECT_DISTORTION); + effects.put("Echo", EFX10.AL_EFFECT_ECHO); + effects.put("Flanger", EFX10.AL_EFFECT_FLANGER); + effects.put("Frequency Shifter", EFX10.AL_EFFECT_FREQUENCY_SHIFTER); + effects.put("Vocal Morpher", EFX10.AL_EFFECT_VOCAL_MORPHER); + effects.put("Pitch Shifter", EFX10.AL_EFFECT_PITCH_SHIFTER); + effects.put("Ring Modulator", EFX10.AL_EFFECT_RING_MODULATOR); + effects.put("Autowah", EFX10.AL_EFFECT_AUTOWAH); + effects.put("Compressor", EFX10.AL_EFFECT_COMPRESSOR); + effects.put("Equalizer", EFX10.AL_EFFECT_EQUALIZER); + + for(Entry<String, Integer> entry : effects.entrySet()) { + if(EFXUtil.isEffectSupported(entry.getValue())) { + System.out.println(" " + entry.getKey()); + } + } + } + private void printDevices(int which, String kind) { String[] devices = ALC10.alcGetString(null, which).split("\0"); checkForErrors(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-05-24 22:35:05
|
Revision: 3349 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3349&view=rev Author: matzon Date: 2010-05-24 22:34:59 +0000 (Mon, 24 May 2010) Log Message: ----------- expose isEfxSupported Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/openal/EFXUtil.java Modified: trunk/LWJGL/src/java/org/lwjgl/openal/EFXUtil.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/openal/EFXUtil.java 2010-05-24 21:54:37 UTC (rev 3348) +++ trunk/LWJGL/src/java/org/lwjgl/openal/EFXUtil.java 2010-05-24 22:34:59 UTC (rev 3349) @@ -58,14 +58,11 @@ * @return True if ALC_EXT_EFX is supported, false if not. * @throws OpenALException If OpenAL has not been created yet. */ - private static boolean isEfxSupported() { + public static boolean isEfxSupported() { if (!AL.isCreated()) { throw new OpenALException("OpenAL has not been created."); } - if (ALC10.alcIsExtensionPresent(AL.getDevice(), EFX10.ALC_EXT_EFX_NAME)) { - return true; - } - return false; + return ALC10.alcIsExtensionPresent(AL.getDevice(), EFX10.ALC_EXT_EFX_NAME); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-05-24 21:54:43
|
Revision: 3348 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3348&view=rev Author: matzon Date: 2010-05-24 21:54:37 +0000 (Mon, 24 May 2010) Log Message: ----------- proper resetNativeStubs for other oal-related classes, probably a NOP atm Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/openal/AL.java Modified: trunk/LWJGL/src/java/org/lwjgl/openal/AL.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/openal/AL.java 2010-05-24 21:50:26 UTC (rev 3347) +++ trunk/LWJGL/src/java/org/lwjgl/openal/AL.java 2010-05-24 21:54:37 UTC (rev 3348) @@ -217,8 +217,10 @@ device = null; } resetNativeStubs(AL10.class); + resetNativeStubs(AL11.class); resetNativeStubs(ALC10.class); resetNativeStubs(ALC11.class); + resetNativeStubs(EFX10.class); if (created) nDestroy(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-05-24 21:50:35
|
Revision: 3347 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3347&view=rev Author: matzon Date: 2010-05-24 21:50:26 +0000 (Mon, 24 May 2010) Log Message: ----------- EFX patch by Ciardhubh Modified Paths: -------------- trunk/LWJGL/doc/CREDITS trunk/LWJGL/src/java/org/lwjgl/openal/AL.java trunk/LWJGL/src/java/org/lwjgl/util/generator/FieldsGenerator.java Added Paths: ----------- trunk/LWJGL/src/java/org/lwjgl/openal/EFXUtil.java trunk/LWJGL/src/java/org/lwjgl/test/openal/EFX10Test.java trunk/LWJGL/src/templates/org/lwjgl/openal/EFX10.java Modified: trunk/LWJGL/doc/CREDITS =================================================================== --- trunk/LWJGL/doc/CREDITS 2010-05-24 21:32:23 UTC (rev 3346) +++ trunk/LWJGL/doc/CREDITS 2010-05-24 21:50:26 UTC (rev 3347) @@ -15,6 +15,7 @@ - kappaOne - Simon Felix - Ryan McNally + - Ciardhubh <ciardhubh[at]ciardhubh.de> additional credits goes to: - Joseph I. Valenzuela [OpenAL stuff] Modified: trunk/LWJGL/src/java/org/lwjgl/openal/AL.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/openal/AL.java 2010-05-24 21:32:23 UTC (rev 3346) +++ trunk/LWJGL/src/java/org/lwjgl/openal/AL.java 2010-05-24 21:50:26 UTC (rev 3347) @@ -160,8 +160,9 @@ if(openDevice) { device = ALC10.alcOpenDevice(deviceArguments); - if (device == null) + if (device == null) { throw new LWJGLException("Could not open ALC device"); + } if (contextFrequency == -1) { context = ALC10.alcCreateContext(device, null); @@ -177,7 +178,18 @@ throw e; } - ALC11.initialize(); + ALC11.initialize(); + + // Load EFX10 native stubs if ALC_EXT_EFX is supported. + // Is there any situation where the current device supports ALC_EXT_EFX and one + // later created by the user does not? + // Do we have to call resetNativeStubs(EFX10.class); somewhere? Not done for AL11 + // either. + // This can either be here or in ALC11, since ALC_EXT_EFX indirectly requires AL 1.1 + // for functions like alSource3i. + if (ALC10.alcIsExtensionPresent(device, EFX10.ALC_EXT_EFX_NAME)){ + EFX10.initNativeStubs(); + } } /** Added: trunk/LWJGL/src/java/org/lwjgl/openal/EFXUtil.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/openal/EFXUtil.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/openal/EFXUtil.java 2010-05-24 21:50:26 UTC (rev 3347) @@ -0,0 +1,228 @@ +/* + * 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.openal; + +/** + * Utility class for the OpenAL extension ALC_EXT_EFX. Provides functions to check for the extension + * and support of various effects and filters. + * <p> + * Currently supports ALC_EXT_EFX version 1.0 effects and filters. + * + * @author Ciardhubh <ciardhubh[at]ciardhubh.de> + * @version $Revision$ + * $Id$ + */ +public final class EFXUtil { + + /** Constant for testSupportGeneric to check an effect. */ + private static final int EFFECT = 1111; + /** Constant for testSupportGeneric to check a filter. */ + private static final int FILTER = 2222; + + /** Utility class, hidden contructor. */ + private EFXUtil() { + } + + /** + * Checks if OpenAL implementation is loaded and supports ALC_EXT_EFX. + * + * @return True if ALC_EXT_EFX is supported, false if not. + * @throws OpenALException If OpenAL has not been created yet. + */ + private static boolean isEfxSupported() { + if (!AL.isCreated()) { + throw new OpenALException("OpenAL has not been created."); + } + if (ALC10.alcIsExtensionPresent(AL.getDevice(), EFX10.ALC_EXT_EFX_NAME)) { + return true; + } + return false; + } + + /** + * Tests OpenAL to see whether the given effect type is supported. This is done by creating an + * effect of the given type. If creation succeeds the effect is supported. + * + * @param effectType Type of effect whose support is to be tested, e.g. AL_EFFECT_REVERB. + * @return True if it is supported, false if not. + * @throws OpenALException If the request fails due to an AL_OUT_OF_MEMORY error or OpenAL has + * not been created yet. + * @throws IllegalArgumentException effectType is not a valid effect type. + */ + public static boolean isEffectSupported(final int effectType) { + // Make sure type is a real effect. + switch (effectType) { + case EFX10.AL_EFFECT_NULL: + case EFX10.AL_EFFECT_EAXREVERB: + case EFX10.AL_EFFECT_REVERB: + case EFX10.AL_EFFECT_CHORUS: + case EFX10.AL_EFFECT_DISTORTION: + case EFX10.AL_EFFECT_ECHO: + case EFX10.AL_EFFECT_FLANGER: + case EFX10.AL_EFFECT_FREQUENCY_SHIFTER: + case EFX10.AL_EFFECT_VOCAL_MORPHER: + case EFX10.AL_EFFECT_PITCH_SHIFTER: + case EFX10.AL_EFFECT_RING_MODULATOR: + case EFX10.AL_EFFECT_AUTOWAH: + case EFX10.AL_EFFECT_COMPRESSOR: + case EFX10.AL_EFFECT_EQUALIZER: + break; + default: + throw new IllegalArgumentException("Unknown or invalid effect type: " + effectType); + } + + return testSupportGeneric(EFFECT, effectType); + } + + /** + * Tests OpenAL to see whether the given filter type is supported. This is done by creating a + * filter of the given type. If creation succeeds the filter is supported. + * + * @param filterType Type of filter whose support is to be tested, e.g. AL_FILTER_LOWPASS. + * @return True if it is supported, false if not. + * @throws OpenALException If the request fails due to an AL_OUT_OF_MEMORY error or OpenAL has + * not been created yet. + * @throws IllegalArgumentException filterType is not a valid filter type. + */ + public static boolean isFilterSupported(final int filterType) { + // Make sure type is a real filter. + switch (filterType) { + case EFX10.AL_FILTER_NULL: + case EFX10.AL_FILTER_LOWPASS: + case EFX10.AL_FILTER_HIGHPASS: + case EFX10.AL_FILTER_BANDPASS: + break; + default: + throw new IllegalArgumentException("Unknown or invalid filter type: " + filterType); + } + + return testSupportGeneric(FILTER, filterType); + } + + /** + * Generic test function to see if an EFX object supports a given kind of type. Works for + * effects and filters. + * + * @param objectType Type of object to test. Must be either EFXUtil.EFFECT or EFXUtil.FILTER. + * @param typeValue OpenAL type the object should be tested for support, e.g. AL_FILTER_LOWPASS + * or AL_EFFECT_REVERB. + * @return True if object supports typeValue, false else. + */ + private static boolean testSupportGeneric(final int objectType, final int typeValue) { + // Check for supported objectType. + switch (objectType) { + case EFFECT: + case FILTER: + break; + default: + throw new IllegalArgumentException("Invalid objectType: " + objectType); + } + + boolean supported = false; + if (isEfxSupported()) { + + // Try to create object in order to check AL's response. + AL10.alGetError(); + int genError; + int testObject = 0; + try { + switch (objectType) { // Create object based on type + case EFFECT: + testObject = EFX10.alGenEffects(); + break; + case FILTER: + testObject = EFX10.alGenFilters(); + break; + default: + throw new IllegalArgumentException("Invalid objectType: " + objectType); + } + genError = AL10.alGetError(); + } catch (final OpenALException debugBuildException) { + // Hack because OpenALException hides the original error code (short of parsing the + // error message String which would break if it gets changed). + if (debugBuildException.getMessage().contains("AL_OUT_OF_MEMORY")) { + genError = AL10.AL_OUT_OF_MEMORY; + } else { + genError = AL10.AL_INVALID_OPERATION; + } + } + + if (genError == AL10.AL_NO_ERROR) { + // Successfully created, now try to set type. + AL10.alGetError(); + int setError; + try { + switch (objectType) { // Set based on object type + case EFFECT: + EFX10.alEffecti(testObject, EFX10.AL_EFFECT_TYPE, typeValue); + break; + case FILTER: + EFX10.alFilteri(testObject, EFX10.AL_FILTER_TYPE, typeValue); + break; + default: + throw new IllegalArgumentException("Invalid objectType: " + objectType); + } + setError = AL10.alGetError(); + } catch (final OpenALException debugBuildException) { + // Hack because OpenALException hides the original error code (short of parsing + // the error message String which would break when it gets changed). + setError = AL10.AL_INVALID_VALUE; + } + + if (setError == AL10.AL_NO_ERROR) { + supported = true; + } + + // Cleanup + try { + switch (objectType) { // Set based on object type + case EFFECT: + EFX10.alDeleteEffects(testObject); + break; + case FILTER: + EFX10.alDeleteFilters(testObject); + break; + default: + throw new IllegalArgumentException("Invalid objectType: " + objectType); + } + } catch (final OpenALException debugBuildException) { + // Don't care about cleanup errors. + } + + } else if (genError == AL10.AL_OUT_OF_MEMORY) { + throw new OpenALException(genError); + } + } + + return supported; + } +} Added: trunk/LWJGL/src/java/org/lwjgl/test/openal/EFX10Test.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/openal/EFX10Test.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/test/openal/EFX10Test.java 2010-05-24 21:50:26 UTC (rev 3347) @@ -0,0 +1,464 @@ +/* + * 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.test.openal; + +import java.nio.IntBuffer; + +import org.lwjgl.BufferUtils; +import org.lwjgl.openal.AL; +import org.lwjgl.openal.AL10; +import org.lwjgl.openal.AL11; +import org.lwjgl.openal.ALC10; +import org.lwjgl.openal.ALCcontext; +import org.lwjgl.openal.ALCdevice; +import org.lwjgl.openal.EFX10; +import org.lwjgl.openal.EFXUtil; +import org.lwjgl.util.WaveData; + +/** + * Class with a few examples testing and demonstrating the use of the OpenAL extension ALC_EXT_EFX. + * <p> + * This class is not compatible with the LWJGL debug build (lwjgl-debug.jar), as the debug build + * throws exceptions instead of alGetError checks. The redundant exception handling code was not + * added in order to keep these examples simple. + * + * @author Ciardhubh <ciardhubh[at]ciardhubh.de> + * @version $Revision$ + * $Id$ + */ +public final class EFX10Test { + + public static void main(final String[] args) throws Exception { + silentTests(); + playbackTest(); + efxUtilTest(); + } + + /** + * Loads OpenAL and makes sure ALC_EXT_EFX is supported. + */ + private static void setupEfx() throws Exception { + // Load and create OpenAL + if (!AL.isCreated()) { + AL.create(); + } + // Query for Effect Extension + if (!ALC10.alcIsExtensionPresent(AL.getDevice(), EFX10.ALC_EXT_EFX_NAME)) { + throw new Exception("No ALC_EXT_EFX supported by driver."); + } + System.out.println("ALC_EXT_EFX found."); + } + + /** + * Runs a series of API calls similar to the tutorials in the Effects Extension Guide of the + * OpenAL SDK. Nothing is played in this method. + */ + private static void silentTests() throws Exception { + setupEfx(); + + final ALCdevice device = AL.getDevice(); + + // Create context (only necessary if LWJGL context isn't sufficient, done as example) + final IntBuffer contextAttribList = BufferUtils.createIntBuffer(8); + contextAttribList.put(ALC10.ALC_FREQUENCY); + contextAttribList.put(44100); + contextAttribList.put(ALC10.ALC_REFRESH); + contextAttribList.put(60); + contextAttribList.put(ALC10.ALC_SYNC); + contextAttribList.put(ALC10.ALC_FALSE); + contextAttribList.rewind(); + // ALC_MAX_AUXILIARY_SENDS won't go above compile-time max. Set to compile-time max if + // greater. + contextAttribList.put(EFX10.ALC_MAX_AUXILIARY_SENDS); + contextAttribList.put(2); + final ALCcontext newContext = ALC10.alcCreateContext(device, contextAttribList); + if (newContext == null) { + throw new Exception("Failed to create context."); + } + final int contextCurResult = ALC10.alcMakeContextCurrent(newContext); + if (contextCurResult == ALC10.ALC_FALSE) { + throw new Exception("Failed to make context current."); + } + + // Query EFX ALC values + System.out.println("AL_VERSION: " + AL10.alGetString(AL10.AL_VERSION)); + final IntBuffer buff = BufferUtils.createIntBuffer(1); + ALC10.alcGetInteger(device, EFX10.ALC_EFX_MAJOR_VERSION, buff); + System.out.println("ALC_EFX_MAJOR_VERSION: " + buff.get(0)); + ALC10.alcGetInteger(device, EFX10.ALC_EFX_MINOR_VERSION, buff); + System.out.println("ALC_EFX_MINOR_VERSION: " + buff.get(0)); + ALC10.alcGetInteger(device, EFX10.ALC_MAX_AUXILIARY_SENDS, buff); + final int maxAuxSends = buff.get(0); + System.out.println("ALC_MAX_AUXILIARY_SENDS: " + maxAuxSends); + + + // Try to create 4 Auxiliary Effect Slots + int numAuxSlots = 0; + final int[] auxEffectSlots = new int[4]; // try more to test + AL10.alGetError(); + for (numAuxSlots = 0; numAuxSlots < 4; numAuxSlots++) { + auxEffectSlots[numAuxSlots] = EFX10.alGenAuxiliaryEffectSlots(); + if (AL10.alGetError() != AL10.AL_NO_ERROR) { + break; + } + } + System.out.println("Created " + numAuxSlots + " aux effect slots."); + + // Try to create 2 Effects + int numEffects = 0; + final int[] effects = new int[2]; + for (numEffects = 0; numEffects < 2; numEffects++) { + effects[numEffects] = EFX10.alGenEffects(); + if (AL10.alGetError() != AL10.AL_NO_ERROR) { + break; + } + } + System.out.println("Created " + numEffects + " effects."); + + // Set first Effect Type to Reverb and change Decay Time + AL10.alGetError(); + if (EFX10.alIsEffect(effects[0])) { + EFX10.alEffecti(effects[0], EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_REVERB); + if (AL10.alGetError() != AL10.AL_NO_ERROR) { + System.out.println("Reverb effect not supported."); + } else { + EFX10.alEffectf(effects[0], EFX10.AL_REVERB_DECAY_TIME, 5.0f); + System.out.println("Reverb effect created."); + } + } else { + throw new Exception("First effect not a valid effect."); + } + + // Set second Effect Type to Flanger and change Phase + AL10.alGetError(); + if (EFX10.alIsEffect(effects[1])) { + EFX10.alEffecti(effects[1], EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_FLANGER); + if (AL10.alGetError() != AL10.AL_NO_ERROR) { + System.out.println("Flanger effect not support."); + } else { + EFX10.alEffecti(effects[1], EFX10.AL_FLANGER_PHASE, 180); + System.out.println("Flanger effect created."); + } + } else { + throw new Exception("Second effect not a valid effect."); + } + + // Try to create a Filter + AL10.alGetError(); + final int filter = EFX10.alGenFilters(); + if (AL10.alGetError() != AL10.AL_NO_ERROR) { + throw new Exception("Failed to create filter."); + } + System.out.println("Generated a filter."); + if (EFX10.alIsFilter(filter)) { + // Set Filter type to Low-Pass and set parameters + EFX10.alFilteri(filter, EFX10.AL_FILTER_TYPE, EFX10.AL_FILTER_LOWPASS); + if (AL10.alGetError() != AL10.AL_NO_ERROR) { + System.out.println("Low pass filter not supported."); + } else { + EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAIN, 0.5f); + EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAINHF, 0.5f); + System.out.println("Low pass filter created."); + } + } + + // Attach Effect to Auxiliary Effect Slot + AL10.alGetError(); + EFX10.alAuxiliaryEffectSloti(auxEffectSlots[0], EFX10.AL_EFFECTSLOT_EFFECT, effects[0]); + if (AL10.alGetError() != AL10.AL_NO_ERROR) { + throw new Exception("Failed to attach effect to aux effect slot."); + } + System.out.println("Successfully loaded effect into effect slot."); + + // Configure Source Auxiliary Effect Slot Sends + final int source = AL10.alGenSources(); + // Set Source Send 0 to feed auxEffectSlots[0] without filtering + AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, auxEffectSlots[0], 0, + EFX10.AL_FILTER_NULL); + if (AL10.alGetError() != AL10.AL_NO_ERROR) { + throw new Exception("Failed to configure Source Send 0"); + } + System.out.println("Linked aux effect slot to soutce slot 0"); + // Set Source Send 1 to feed uiEffectSlot[1] with filter filter + AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, auxEffectSlots[1], 1, filter); + if (AL10.alGetError() != AL10.AL_NO_ERROR) { + // e.g. if only 1 send per source is available + throw new Exception("Failed to configure Source Send 1"); + } + System.out.println("Linked aux effect slot to soutce slot 1"); + // Disable Send 0 + AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, EFX10.AL_EFFECTSLOT_NULL, 0, + EFX10.AL_FILTER_NULL); + if (AL10.alGetError() != AL10.AL_NO_ERROR) { + throw new Exception("Failed to disable Source Send 0"); + } + System.out.println("Disabled source send 0"); + // Disable Send 1 + AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, EFX10.AL_EFFECTSLOT_NULL, 1, + EFX10.AL_FILTER_NULL); + if (AL10.alGetError() != AL10.AL_NO_ERROR) { + throw new Exception("Failed to disable Source Send 1"); + } + System.out.println("Disabled source send 1"); + + + // Filter 'source', a generated Source + AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, filter); + if (AL10.alGetError() == AL10.AL_NO_ERROR) { + { + System.out.println("Successfully applied a direct path filter"); + // Remove filter from 'source' + AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, EFX10.AL_FILTER_NULL); + if (AL10.alGetError() == AL10.AL_NO_ERROR) { + System.out.println("Successfully removed direct filter"); + } + } + // Filter the Source send 0 from 'source' to Auxiliary Effect Slot auxEffectSlot[0] + // using Filter uiFilter[0] + AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, auxEffectSlots[0], 0, filter); + if (AL10.alGetError() == AL10.AL_NO_ERROR) { + { + System.out.println("Successfully applied aux send filter"); + // Remove Filter from Source Auxiliary Send + AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, auxEffectSlots[0], 0, + EFX10.AL_FILTER_NULL); + if (AL10.alGetError() == AL10.AL_NO_ERROR) { + System.out.println("Successfully removed filter"); + } + } + } + } + + // Set Source Cone Outer Gain HF value + AL10.alSourcef(source, EFX10.AL_CONE_OUTER_GAINHF, 0.5f); + if (AL10.alGetError() == AL10.AL_NO_ERROR) { + System.out.println("Successfully set cone outside gain filter"); + } + + // Set distance units to be in feet + AL10.alListenerf(EFX10.AL_METERS_PER_UNIT, 0.3f); + if (AL10.alGetError() == AL10.AL_NO_ERROR) { + System.out.println("Successfully set distance units"); + } + + // Cleanup + final IntBuffer auxEffectSlotsBuf = (IntBuffer) BufferUtils.createIntBuffer( + auxEffectSlots.length).put(auxEffectSlots).rewind(); + EFX10.alDeleteAuxiliaryEffectSlots(auxEffectSlotsBuf); + final IntBuffer effectsBuf = (IntBuffer) BufferUtils.createIntBuffer( + effects.length).put(effects).rewind(); + EFX10.alDeleteEffects(effectsBuf); + EFX10.alDeleteFilters(filter); + AL.destroy(); + } + + /** + * Plays a sound with various effects applied to it. + */ + private static void playbackTest() throws Exception { + setupEfx(); + + // Create a source and buffer audio data + final int source = AL10.alGenSources(); + final int buffer = AL10.alGenBuffers(); + WaveData waveFile = WaveData.create(WaveData.class.getClassLoader().getResourceAsStream("Footsteps.wav")); + if (waveFile == null) { + System.out.println("Failed to load Footsteps.wav! Skipping playback test."); + AL.destroy(); + return; + } + AL10.alBufferData(buffer, waveFile.format, waveFile.data, waveFile.samplerate); + waveFile.dispose(); + AL10.alSourcei(source, AL10.AL_BUFFER, buffer); + AL10.alSourcei(source, AL10.AL_LOOPING, AL10.AL_TRUE); + + System.out.println("Playing sound unaffected by EFX ..."); + AL10.alSourcePlay(source); + Thread.sleep(7500); + + // Add reverb effect + final int effectSlot = EFX10.alGenAuxiliaryEffectSlots(); + final int reverbEffect = EFX10.alGenEffects(); + EFX10.alEffecti(reverbEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_REVERB); + EFX10.alEffectf(reverbEffect, EFX10.AL_REVERB_DECAY_TIME, 5.0f); + EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, reverbEffect); + AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0, + EFX10.AL_FILTER_NULL); + + System.out.println("Playing sound with reverb ..."); + AL10.alSourcePlay(source); + Thread.sleep(7500); + + // Add low-pass filter directly to source + final int filter = EFX10.alGenFilters(); + EFX10.alFilteri(filter, EFX10.AL_FILTER_TYPE, EFX10.AL_FILTER_LOWPASS); + EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAIN, 0.5f); + EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAINHF, 0.5f); + AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, filter); + + System.out.println("Playing sound with reverb and direct low pass filter ..."); + AL10.alSourcePlay(source); + Thread.sleep(7500); + AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, EFX10.AL_FILTER_NULL); + + // Add low-pass filter to source send + //AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0, filter); + // + //System.out.println("Playing sound with reverb and aux send low pass filter ..."); + //AL10.alSourcePlay(source); + //Thread.sleep(7500); + + // Cleanup + AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, EFX10.AL_EFFECTSLOT_NULL, 0, + EFX10.AL_FILTER_NULL); + EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, EFX10.AL_EFFECT_NULL); + EFX10.alDeleteEffects(reverbEffect); + EFX10.alDeleteFilters(filter); + + // Echo effect + final int echoEffect = EFX10.alGenEffects(); + EFX10.alEffecti(echoEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_ECHO); + //EFX10.alEffectf(echoEffect, EFX10.AL_ECHO_DELAY, 5.0f); + EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, echoEffect); + AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0, + EFX10.AL_FILTER_NULL); + + System.out.println("Playing sound with echo effect ..."); + AL10.alSourcePlay(source); + Thread.sleep(7500); + + AL.destroy(); + } + + /** + * Checks OpenAL for every EFX 1.0 effect and filter and prints the result to the console. + */ + private static void efxUtilTest() throws Exception { + setupEfx(); + + System.out.println(); + System.out.println("Checking supported effects ..."); + if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_NULL)) { + System.out.println("AL_EFFECT_NULL is supported."); + } else { + System.out.println("AL_EFFECT_NULL is NOT supported."); + } + if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_EAXREVERB)) { + System.out.println("AL_EFFECT_EAXREVERB is supported."); + } else { + System.out.println("AL_EFFECT_EAXREVERB is NOT supported."); + } + if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_REVERB)) { + System.out.println("AL_EFFECT_REVERB is supported."); + } else { + System.out.println("AL_EFFECT_REVERB is NOT supported."); + } + if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_CHORUS)) { + System.out.println("AL_EFFECT_CHORUS is supported."); + } else { + System.out.println("AL_EFFECT_CHORUS is NOT supported."); + } + if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_DISTORTION)) { + System.out.println("AL_EFFECT_DISTORTION is supported."); + } else { + System.out.println("AL_EFFECT_DISTORTION is NOT supported."); + } + if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_ECHO)) { + System.out.println("AL_EFFECT_ECHO is supported."); + } else { + System.out.println("AL_EFFECT_ECHO is NOT supported."); + } + if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_FLANGER)) { + System.out.println("AL_EFFECT_FLANGER is supported."); + } else { + System.out.println("AL_EFFECT_FLANGER is NOT supported."); + } + if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_FREQUENCY_SHIFTER)) { + System.out.println("AL_EFFECT_FREQUENCY_SHIFTER is supported."); + } else { + System.out.println("AL_EFFECT_FREQUENCY_SHIFTER is NOT supported."); + } + if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_VOCAL_MORPHER)) { + System.out.println("AL_EFFECT_VOCAL_MORPHER is supported."); + } else { + System.out.println("AL_EFFECT_VOCAL_MORPHER is NOT supported."); + } + if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_PITCH_SHIFTER)) { + System.out.println("AL_EFFECT_PITCH_SHIFTER is supported."); + } else { + System.out.println("AL_EFFECT_PITCH_SHIFTER is NOT supported."); + } + if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_RING_MODULATOR)) { + System.out.println("AL_EFFECT_RING_MODULATOR is supported."); + } else { + System.out.println("AL_EFFECT_RING_MODULATOR is NOT supported."); + } + if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_AUTOWAH)) { + System.out.println("AL_EFFECT_AUTOWAH is supported."); + } else { + System.out.println("AL_EFFECT_AUTOWAH is NOT supported."); + } + if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_COMPRESSOR)) { + System.out.println("AL_EFFECT_COMPRESSOR is supported."); + } else { + System.out.println("AL_EFFECT_COMPRESSOR is NOT supported."); + } + if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_EQUALIZER)) { + System.out.println("AL_EFFECT_EQUALIZER is supported."); + } else { + System.out.println("AL_EFFECT_EQUALIZER is NOT supported."); + } + + System.out.println(); + System.out.println("Checking supported filters ..."); + if (EFXUtil.isFilterSupported(EFX10.AL_FILTER_NULL)) { + System.out.println("AL_FILTER_NULL is supported."); + } else { + System.out.println("AL_FILTER_NULL is NOT supported."); + } + if (EFXUtil.isFilterSupported(EFX10.AL_FILTER_LOWPASS)) { + System.out.println("AL_FILTER_LOWPASS is supported."); + } else { + System.out.println("AL_FILTER_LOWPASS is NOT supported."); + } + if (EFXUtil.isFilterSupported(EFX10.AL_FILTER_HIGHPASS)) { + System.out.println("AL_FILTER_HIGHPASS is supported."); + } else { + System.out.println("AL_FILTER_HIGHPASS is NOT supported."); + } + if (EFXUtil.isFilterSupported(EFX10.AL_FILTER_BANDPASS)) { + System.out.println("AL_FILTER_BANDPASS is supported."); + } else { + System.out.println("AL_FILTER_BANDPASS is NOT supported."); + } + } +} Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/FieldsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/FieldsGenerator.java 2010-05-24 21:32:23 UTC (rev 3346) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/FieldsGenerator.java 2010-05-24 21:50:26 UTC (rev 3347) @@ -40,34 +40,57 @@ public class FieldsGenerator { private static void validateField(FieldDeclaration field) { - Collection<Modifier> modifiers = field.getModifiers(); - if (modifiers.size() != 3 || !modifiers.contains(Modifier.PUBLIC) || !modifiers.contains(Modifier.STATIC) || - !modifiers.contains(Modifier.FINAL)) - throw new RuntimeException("Field " + field.getSimpleName() + " is not declared public static final"); - TypeMirror field_type = field.getType(); - if (!(field_type instanceof PrimitiveType)) - throw new RuntimeException("Field " + field.getSimpleName() + " is not a primitive type"); - PrimitiveType field_type_prim = (PrimitiveType)field_type; - if (field_type_prim.getKind() != PrimitiveType.Kind.INT && field_type_prim.getKind() != PrimitiveType.Kind.LONG) - throw new RuntimeException("Field " + field.getSimpleName() + " is not of type 'int' or 'long'"); - Object field_value = field.getConstantValue(); - if (field_value == null) - throw new RuntimeException("Field " + field.getSimpleName() + " has no initial value"); + // Check if field is "public static final" + Collection<Modifier> modifiers = field.getModifiers(); + if (modifiers.size() != 3 + || !modifiers.contains(Modifier.PUBLIC) + || !modifiers.contains(Modifier.STATIC) + || !modifiers.contains(Modifier.FINAL)) { + throw new RuntimeException("Field " + field.getSimpleName() + " is not declared public static final"); + } + + // Check suported types (int, long, float, String) + TypeMirror field_type = field.getType(); + if (field_type instanceof PrimitiveType) { + PrimitiveType field_type_prim = (PrimitiveType) field_type; + PrimitiveType.Kind field_kind = field_type_prim.getKind(); + if (field_kind != PrimitiveType.Kind.INT + && field_kind != PrimitiveType.Kind.LONG + && field_kind != PrimitiveType.Kind.FLOAT) { + throw new RuntimeException("Field " + field.getSimpleName() + " is not of type 'int', 'long' or 'float'"); + } + } else if (field_type.toString().equals("java.lang.String")) { + } else { + throw new RuntimeException("Field " + field.getSimpleName() + " is not a primitive type or String"); + } + + Object field_value = field.getConstantValue(); + if (field_value == null) { + throw new RuntimeException("Field " + field.getSimpleName() + " has no initial value"); + } } private static void generateField(PrintWriter writer, FieldDeclaration field) { - validateField(field); + validateField(field); - Object value = field.getConstantValue(); - String field_value_string; - if ( value.getClass().equals(Integer.class) ) - field_value_string = Integer.toHexString((Integer)field.getConstantValue()); - else - field_value_string = Long.toHexString((Long)field.getConstantValue()) + 'l'; + Object value = field.getConstantValue(); + String field_value_string; + Class field_value_class = value.getClass(); + if (field_value_class.equals(Integer.class)) { + field_value_string = "0x" + Integer.toHexString((Integer) field.getConstantValue()); + } else if (field_value_class.equals(Long.class)) { + field_value_string = "0x" + Long.toHexString((Long) field.getConstantValue()) + 'l'; + } else if (field_value_class.equals(Float.class)) { + field_value_string = field.getConstantValue() + "f"; + } else if (field_value_class.equals(String.class)) { + field_value_string = "\"" + field.getConstantValue() + "\""; + } else { + throw new RuntimeException("Field is of unexpected type. This means there is a bug in validateField()."); + } - Utils.printDocComment(writer, field); - // Print field declaration - writer.println("\tpublic static final " + field.getType().toString() + " " + field.getSimpleName() + " = 0x" + field_value_string + ";"); + Utils.printDocComment(writer, field); + // Print field declaration + writer.println("\tpublic static final " + field.getType().toString() + " " + field.getSimpleName() + " = " + field_value_string + ";"); } public static void generateFields(PrintWriter writer, Collection<FieldDeclaration> fields) { Added: trunk/LWJGL/src/templates/org/lwjgl/openal/EFX10.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/openal/EFX10.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/openal/EFX10.java 2010-05-24 21:50:26 UTC (rev 3347) @@ -0,0 +1,738 @@ +/* + * 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.openal; + +import java.nio.FloatBuffer; +import java.nio.IntBuffer; + +import org.lwjgl.util.generator.ALenum; +import org.lwjgl.util.generator.ALsizei; +import org.lwjgl.util.generator.ALuint; +import org.lwjgl.util.generator.ALvoid; +import org.lwjgl.util.generator.Alternate; +import org.lwjgl.util.generator.AutoSize; +import org.lwjgl.util.generator.Check; +import org.lwjgl.util.generator.Const; +import org.lwjgl.util.generator.Constant; +import org.lwjgl.util.generator.Indirect; +import org.lwjgl.util.generator.OutParameter; +import org.lwjgl.util.generator.Result; +import org.lwjgl.util.generator.StripPostfix; + +/** + * Implementation of the OpenAL extension ALC_EXT_EFX (version 1.0). Contains necessary fields, + * methods and a range of supplementary fields containing minimum, maximum and default values of + * the former fields. + * <p> + * On top of regular functions defined in the ALC_EXT_EFX, there are also several convenience + * functions. Namely alGen... and alDelete... which do not take a Java buffer parameter and + * automatically create or delete a single object, without the overhead of using a buffer. + * <p> + * For comments and specification of functions and fields, refer to the "Effects Extension Guide" + * which is part of the OpenAL SDK and can be downloaded from: + * http://connect.creativelabs.com/openal/Downloads/Forms/AllItems.aspx + * + * @author Ciardhubh <ciardhubh[at]ciardhubh.de> + * @version $Revision$ + * $Id$ + */ +public interface EFX10 { + + // ALC properties + String ALC_EXT_EFX_NAME = "ALC_EXT_EFX"; + int ALC_EFX_MAJOR_VERSION = 0x20001; + int ALC_EFX_MINOR_VERSION = 0x20002; + int ALC_MAX_AUXILIARY_SENDS = 0x20003; + + // Listener properties + int AL_METERS_PER_UNIT = 0x20004; + + // Source properties + int AL_DIRECT_FILTER = 0x20005; + int AL_AUXILIARY_SEND_FILTER = 0x20006; + int AL_AIR_ABSORPTION_FACTOR = 0x20007; + int AL_ROOM_ROLLOFF_FACTOR = 0x20008; + int AL_CONE_OUTER_GAINHF = 0x20009; + int AL_DIRECT_FILTER_GAINHF_AUTO = 0x2000A; + int AL_AUXILIARY_SEND_FILTER_GAIN_AUTO = 0x2000B; + int AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO = 0x2000C; + + // Auxiliary effect slot properties + int AL_EFFECTSLOT_EFFECT = 0x0001; + int AL_EFFECTSLOT_GAIN = 0x0002; + int AL_EFFECTSLOT_AUXILIARY_SEND_AUTO = 0x0003; + // NULL auxiliary slot ID to disable a source send + int AL_EFFECTSLOT_NULL = 0x0000; + + // Effect parameters + // Reverb + int AL_REVERB_DENSITY = 0x0001; + int AL_REVERB_DIFFUSION = 0x0002; + int AL_REVERB_GAIN = 0x0003; + int AL_REVERB_GAINHF = 0x0004; + int AL_REVERB_DECAY_TIME = 0x0005; + int AL_REVERB_DECAY_HFRATIO = 0x0006; + int AL_REVERB_REFLECTIONS_GAIN = 0x0007; + int AL_REVERB_REFLECTIONS_DELAY = 0x0008; + int AL_REVERB_LATE_REVERB_GAIN = 0x0009; + int AL_REVERB_LATE_REVERB_DELAY = 0x000A; + int AL_REVERB_AIR_ABSORPTION_GAINHF = 0x000B; + int AL_REVERB_ROOM_ROLLOFF_FACTOR = 0x000C; + int AL_REVERB_DECAY_HFLIMIT = 0x000D; + // EAX Reverb + int AL_EAXREVERB_DENSITY = 0x0001; + int AL_EAXREVERB_DIFFUSION = 0x0002; + int AL_EAXREVERB_GAIN = 0x0003; + int AL_EAXREVERB_GAINHF = 0x0004; + int AL_EAXREVERB_GAINLF = 0x0005; + int AL_EAXREVERB_DECAY_TIME = 0x0006; + int AL_EAXREVERB_DECAY_HFRATIO = 0x0007; + int AL_EAXREVERB_DECAY_LFRATIO = 0x0008; + int AL_EAXREVERB_REFLECTIONS_GAIN = 0x0009; + int AL_EAXREVERB_REFLECTIONS_DELAY = 0x000A; + int AL_EAXREVERB_REFLECTIONS_PAN = 0x000B; + int AL_EAXREVERB_LATE_REVERB_GAIN = 0x000C; + int AL_EAXREVERB_LATE_REVERB_DELAY = 0x000D; + int AL_EAXREVERB_LATE_REVERB_PAN = 0x000E; + int AL_EAXREVERB_ECHO_TIME = 0x000F; + int AL_EAXREVERB_ECHO_DEPTH = 0x0010; + int AL_EAXREVERB_MODULATION_TIME = 0x0011; + int AL_EAXREVERB_MODULATION_DEPTH = 0x0012; + int AL_EAXREVERB_AIR_ABSORPTION_GAINHF = 0x0013; + int AL_EAXREVERB_HFREFERENCE = 0x0014; + int AL_EAXREVERB_LFREFERENCE = 0x0015; + int AL_EAXREVERB_ROOM_ROLLOFF_FACTOR = 0x0016; + int AL_EAXREVERB_DECAY_HFLIMIT = 0x0017; + // Chorus + int AL_CHORUS_WAVEFORM = 0x0001; + int AL_CHORUS_PHASE = 0x0002; + int AL_CHORUS_RATE = 0x0003; + int AL_CHORUS_DEPTH = 0x0004; + int AL_CHORUS_FEEDBACK = 0x0005; + int AL_CHORUS_DELAY = 0x0006; + // Distortion + int AL_DISTORTION_EDGE = 0x0001; + int AL_DISTORTION_GAIN = 0x0002; + int AL_DISTORTION_LOWPASS_CUTOFF = 0x0003; + int AL_DISTORTION_EQCENTER = 0x0004; + int AL_DISTORTION_EQBANDWIDTH = 0x0005; + // Echo + int AL_ECHO_DELAY = 0x0001; + int AL_ECHO_LRDELAY = 0x0002; + int AL_ECHO_DAMPING = 0x0003; + int AL_ECHO_FEEDBACK = 0x0004; + int AL_ECHO_SPREAD = 0x0005; + // Flanger + int AL_FLANGER_WAVEFORM = 0x0001; + int AL_FLANGER_PHASE = 0x0002; + int AL_FLANGER_RATE = 0x0003; + int AL_FLANGER_DEPTH = 0x0004; + int AL_FLANGER_FEEDBACK = 0x0005; + int AL_FLANGER_DELAY = 0x0006; + // Frequency shifter + int AL_FREQUENCY_SHIFTER_FREQUENCY = 0x0001; + int AL_FREQUENCY_SHIFTER_LEFT_DIRECTION = 0x0002; + int AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION = 0x0003; + // Vocal morpher + int AL_VOCAL_MORPHER_PHONEMEA = 0x0001; + int AL_VOCAL_MORPHER_PHONEMEA_COARSE_TUNING = 0x0002; + int AL_VOCAL_MORPHER_PHONEMEB = 0x0003; + int AL_VOCAL_MORPHER_PHONEMEB_COARSE_TUNING = 0x0004; + int AL_VOCAL_MORPHER_WAVEFORM = 0x0005; + int AL_VOCAL_MORPHER_RATE = 0x0006; + // Pitch shifter + int AL_PITCH_SHIFTER_COARSE_TUNE = 0x0001; + int AL_PITCH_SHIFTER_FINE_TUNE = 0x0002; + // Ring modulator + int AL_RING_MODULATOR_FREQUENCY = 0x0001; + int AL_RING_MODULATOR_HIGHPASS_CUTOFF = 0x0002; + int AL_RING_MODULATOR_WAVEFORM = 0x0003; + // Autowah + int AL_AUTOWAH_ATTACK_TIME = 0x0001; + int AL_AUTOWAH_RELEASE_TIME = 0x0002; + int AL_AUTOWAH_RESONANCE = 0x0003; + int AL_AUTOWAH_PEAK_GAIN = 0x0004; + // Compressor + int AL_COMPRESSOR_ONOFF = 0x0001; + // Equalizer + int AL_EQUALIZER_LOW_GAIN = 0x0001; + int AL_EQUALIZER_LOW_CUTOFF = 0x0002; + int AL_EQUALIZER_MID1_GAIN = 0x0003; + int AL_EQUALIZER_MID1_CENTER = 0x0004; + int AL_EQUALIZER_MID1_WIDTH = 0x0005; + int AL_EQUALIZER_MID2_GAIN = 0x0006; + int AL_EQUALIZER_MID2_CENTER = 0x0007; + int AL_EQUALIZER_MID2_WIDTH = 0x0008; + int AL_EQUALIZER_HIGH_GAIN = 0x0009; + int AL_EQUALIZER_HIGH_CUTOFF = 0x000A; + // Effect type + int AL_EFFECT_FIRST_PARAMETER = 0x0000; + int AL_EFFECT_LAST_PARAMETER = 0x8000; + int AL_EFFECT_TYPE = 0x8001; + // Effect types, used with AL_EFFECT_TYPE + int AL_EFFECT_NULL = 0x0000; + int AL_EFFECT_REVERB = 0x0001; + int AL_EFFECT_CHORUS = 0x0002; + int AL_EFFECT_DISTORTION = 0x0003; + int AL_EFFECT_ECHO = 0x0004; + int AL_EFFECT_FLANGER = 0x0005; + int AL_EFFECT_FREQUENCY_SHIFTER = 0x0006; + int AL_EFFECT_VOCAL_MORPHER = 0x0007; + int AL_EFFECT_PITCH_SHIFTER = 0x0008; + int AL_EFFECT_RING_MODULATOR = 0x0009; + int AL_EFFECT_AUTOWAH = 0x000A; + int AL_EFFECT_COMPRESSOR = 0x000B; + int AL_EFFECT_EQUALIZER = 0x000C; + int AL_EFFECT_EAXREVERB = 0x8000; + + // Filter properties + // Lowpass + int AL_LOWPASS_GAIN = 0x0001; + int AL_LOWPASS_GAINHF = 0x0002; + // Highpass + int AL_HIGHPASS_GAIN = 0x0001; + int AL_HIGHPASS_GAINLF = 0x0002; + // Bandpass + int AL_BANDPASS_GAIN = 0x0001; + int AL_BANDPASS_GAINLF = 0x0002; + int AL_BANDPASS_GAINHF = 0x0003; + // Filter type + int AL_FILTER_FIRST_PARAMETER = 0x0000; + int AL_FILTER_LAST_PARAMETER = 0x8000; + int AL_FILTER_TYPE = 0x8001; + // Filter types, used with the AL_FILTER_TYPE property + int AL_FILTER_NULL = 0x0000; + int AL_FILTER_LOWPASS = 0x0001; + int AL_FILTER_HIGHPASS = 0x0002; + int AL_FILTER_BANDPASS = 0x0003; + + // Auxiliary effect slot object functions + @ALvoid + void alGenAuxiliaryEffectSlots(@AutoSize("auxiliaryeffectslots") @ALsizei int n, @OutParameter @ALuint IntBuffer auxiliaryeffectslots); + + @Alternate(value = "alGenAuxiliaryEffectSlots", nativeAlt = true) + @ALvoid + void alGenAuxiliaryEffectSlots2(@Constant("1") @ALsizei int n, @Result @ALuint int auxiliaryeffectslot); + + @ALvoid + void alDeleteAuxiliaryEffectSlots(@AutoSize("auxiliaryeffectslots") @ALsizei int n, @OutParameter @ALuint IntBuffer auxiliaryeffectslots); + + @Alternate(value = "alDeleteAuxiliaryEffectSlots", nativeAlt = true) + @ALvoid + void alDeleteAuxiliaryEffectSlots2(@Constant("1") @ALsizei int n, @Indirect @ALuint int auxiliaryeffectslot); + + boolean alIsAuxiliaryEffectSlot(@ALuint int auxiliaryeffectslot); + + @ALvoid + void alAuxiliaryEffectSloti(@ALuint int auxiliaryeffectslot, @ALenum int param, int value); + + @StripPostfix("values") + @ALvoid + void alAuxiliaryEffectSlotiv(@ALuint int auxiliaryeffectslot, @ALenum int param, @Check("1") @Const IntBuffer values); + + @ALvoid + void alAuxiliaryEffectSlotf(@ALuint int auxiliaryeffectslot, @ALenum int param, float value); + + @StripPostfix("values") + @ALvoid + void alAuxiliaryEffectSlotfv(@ALuint int auxiliaryeffectslot, @ALenum int param, @Check("1") @Const FloatBuffer values); + + @ALvoid + void alGetAuxiliaryEffectSloti(@ALuint int auxiliaryeffectslot, @ALenum int param, @Result int value); + + @StripPostfix("intdata") + @ALvoid + void alGetAuxiliaryEffectSlotiv(@ALuint int auxiliaryeffectslot, @ALenum int param, @OutParameter @Check("1") IntBuffer intdata); + + @ALvoid + void alGetAuxiliaryEffectSlotf(@ALuint int auxiliaryeffectslot, @ALenum int param, @Result float value); + + @StripPostfix("floatdata") + @ALvoid + void alGetAuxiliaryEffectSlotfv(@ALuint int auxiliaryeffectslot, @ALenum int param, @OutParameter @Check("1") FloatBuffer floatdata); + + // Effect object functions + @ALvoid + void alGenEffects(@AutoSize("effects") @ALsizei int n, @OutParameter @ALuint IntBuffer effects); + + @Alternate(value = "alGenEffects", nativeAlt = true) + @ALvoid + void alGenEffects2(@Constant("1") @ALsizei int n, @Result @ALuint int effect); + + @ALvoid + void alDeleteEffects(@AutoSize("effects") @ALsizei int n, @OutParameter @ALuint IntBuffer effects); + + @Alternate(value = "alDeleteEffects", nativeAlt = true) + @ALvoid + void alDeleteEffects2(@Constant("1") @ALsizei int n, @Indirect @ALuint int effect); + + boolean alIsEffect(@ALuint int effect); + + @ALvoid + void alEffecti(@ALuint int effect, @ALenum int param, int value); + + @StripPostfix("values") + @ALvoid + void alEffectiv(@ALuint int effect, @ALenum int param, @Check("1") @Const IntBuffer values); + + @ALvoid + void alEffectf(@ALuint int effect, @ALenum int param, float value); + + @StripPostfix("values") + @ALvoid + void alEffectfv(@ALuint int effect, @ALenum int param, @Check("1") @Const FloatBuffer values); + + @ALvoid + void alGetEffecti(@ALuint int effect, @ALenum int param, @Result int value); + + @StripPostfix("intdata") + @ALvoid + void alGetEffectiv(@ALuint int effect, @ALenum int param, @OutParameter @Check("1") IntBuffer intdata); + + @ALvoid + void alGetEffectf(@ALuint int effect, @ALenum int param, @Result float value); + + @StripPostfix("floatdata") + @ALvoid + void alGetEffectfv(@ALuint int effect, @ALenum int param, @OutParameter @Check("1") FloatBuffer floatdata); + + // Filter object functions + @ALvoid + void alGenFilters(@AutoSize("filters") @ALsizei int n, @OutParameter @ALuint IntBuffer filters); + + @Alternate(value = "alGenFilters", nativeAlt = true) + @ALvoid + void alGenFilters2(@Constant("1") @ALsizei int n, @Result @ALuint int filter); + + @ALvoid + void alDeleteFilters(@AutoSize("filters") @ALsizei int n, @OutParameter @ALuint IntBuffer filters); + + @Alternate(value = "alDeleteFilters", nativeAlt = true) + @ALvoid + void alDeleteFilters2(@Constant("1") @ALsizei int n, @Indirect @ALuint int filter); + + boolean alIsFilter(@ALuint int filter); + + @ALvoid + void alFilteri(@ALuint int filter, @ALenum int param, int value); + + @StripPostfix("values") + @ALvoid + void alFilteriv(@ALuint int filter, @ALenum int param, @Check("1") @Const IntBuffer values); + + @ALvoid + void alFilterf(@ALuint int filter, @ALenum int param, float value); + + @StripPostfix("values") + @ALvoid + void alFilterfv(@ALuint int filter, @ALenum int param, @Check("1") @Const FloatBuffer values); + + @ALvoid + void alGetFilteri(@ALuint int filter, @ALenum int param, @Result int value); + + @StripPostfix("intdata") + @ALvoid + void alGetFilteriv(@ALuint int filter, @ALenum int param, @OutParameter @Check("1") IntBuffer intdata); + + @ALvoid + void alGetFilterf(@ALuint int filter, @ALenum int param, @Result float value); + + @StripPostfix("floatdata") + @ALvoid + void alGetFilterfv(@ALuint int filter, @ALenum int param, @OutParameter @Check("1") FloatBuffer floatdata); + + // Source property value ranges and defaults + float AL_MIN_AIR_ABSORPTION_FACTOR = 0.0f; + float AL_MAX_AIR_ABSORPTION_FACTOR = 10.0f; + float AL_DEFAULT_AIR_ABSORPTION_FACTOR = 0.0f; + float AL_MIN_ROOM_ROLLOFF_FACTOR = 0.0f; + float AL_MAX_ROOM_ROLLOFF_FACTOR = 10.0f; + float AL_DEFAULT_ROOM_ROLLOFF_FACTOR = 0.0f; + float AL_MIN_CONE_OUTER_GAINHF = 0.0f; + float AL_MAX_CONE_OUTER_GAINHF = 1.0f; + float AL_DEFAULT_CONE_OUTER_GAINHF = 1.0f; + int AL_MIN_DIRECT_FILTER_GAINHF_AUTO = AL10.AL_FALSE; + int AL_MAX_DIRECT_FILTER_GAINHF_AUTO = AL10.AL_TRUE; + int AL_DEFAULT_DIRECT_FILTER_GAINHF_AUTO = AL10.AL_TRUE; + int AL_MIN_AUXILIARY_SEND_FILTER_GAIN_AUTO = AL10.AL_FALSE; + int AL_MAX_AUXILIARY_SEND_FILTER_GAIN_AUTO = AL10.AL_TRUE; + int AL_DEFAULT_AUXILIARY_SEND_FILTER_GAIN_AUTO = AL10.AL_TRUE; + int AL_MIN_AUXILIARY_SEND_FILTER_GAINHF_AUTO = AL10.AL_FALSE; + int AL_MAX_AUXILIARY_SEND_FILTER_GAINHF_AUTO = AL10.AL_TRUE; + int AL_DEFAULT_AUXILIARY_SEND_FILTER_GAINHF_AUTO = AL10.AL_TRUE; + + // Listener property value ranges and defaults + float AL_MIN_METERS_PER_UNIT = Float.MIN_VALUE; + float AL_MAX_METERS_PER_UNIT = Float.MAX_VALUE; + float AL_DEFAULT_METERS_PER_UNIT = 1.0f; + + // Effect parameter ranges and defaults + // Reverb + float AL_REVERB_MIN_DENSITY = 0.0f; + float AL_REVERB_MAX_DENSITY = 1.0f; + float AL_REVERB_DEFAULT_DENSITY = 1.0f; + float AL_REVERB_MIN_DIFFUSION = 0.0f; + float AL_REVERB_MAX_DIFFUSION = 1.0f; + float AL_REVERB_DEFAULT_DIFFUSION = 1.0f; + float AL_REVERB_MIN_GAIN = 0.0f; + float AL_REVERB_MAX_GAIN = 1.0f; + float AL_REVERB_DEFAULT_GAIN = 0.32f; + float AL_REVERB_MIN_GAINHF = 0.0f; + float AL_REVERB_MAX_GAINHF = 1.0f; + float AL_REVERB_DEFAULT_GAINHF = 0.89f; + float AL_REVERB_MIN_DECAY_TIME = 0.1f; + float AL_REVERB_MAX_DECAY_TIME = 20.0f; + float AL_REVERB_DEFAULT_DECAY_TIME = 1.49f; + float AL_REVERB_MIN_DECAY_HFRATIO = 0.1f; + float AL_REVERB_MAX_DECAY_HFRATIO = 2.0f; + float AL_REVERB_DEFAULT_DECAY_HFRATIO = 0.83f; + float AL_REVERB_MIN_REFLECTIONS_GAIN = 0.0f; + float AL_REVERB_MAX_REFLECTIONS_GAIN = 3.16f; + float AL_REVERB_DEFAULT_REFLECTIONS_GAIN = 0.05f; + float AL_REVERB_MIN_REFLECTIONS_DELAY = 0.0f; + float AL_REVERB_MAX_REFLECTIONS_DELAY = 0.3f; + float AL_REVERB_DEFAULT_REFLECTIONS_DELAY = 0.007f; + float AL_REVERB_MIN_LATE_REVERB_GAIN = 0.0f; + float AL_REVERB_MAX_LATE_REVERB_GAIN = 10.0f; + float AL_REVERB_DEFAULT_LATE_REVERB_GAIN = 1.26f; + float AL_REVERB_MIN_LATE_REVERB_DELAY = 0.0f; + float AL_REVERB_MAX_LATE_REVERB_DELAY = 0.1f; + float AL_REVERB_DEFAULT_LATE_REVERB_DELAY = 0.011f; + float AL_REVERB_MIN_AIR_ABSORPTION_GAINHF = 0.892f; + float AL_REVERB_MAX_AIR_ABSORPTION_GAINHF = 1.0f; + float AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF = 0.994f; + float AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR = 0.0f; + float AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR = 10.0f; + float AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR = 0.0f; + int AL_REVERB_MIN_DECAY_HFLIMIT = AL10.AL_FALSE; + int AL_REVERB_MAX_DECAY_HFLIMIT = AL10.AL_TRUE; + int AL_REVERB_DEFAULT_DECAY_HFLIMIT = AL10.AL_TRUE; + // EAX reverb + float AL_EAXREVERB_MIN_DENSITY = 0.0f; + float AL_EAXREVERB_MAX_DENSITY = 1.0f; + float AL_EAXREVERB_DEFAULT_DENSITY = 1.0f; + float AL_EAXREVERB_MIN_DIFFUSION = 0.0f; + float AL_EAXREVERB_MAX_DIFFUSION = 1.0f; + float AL_EAXREVERB_DEFAULT_DIFFUSION = 1.0f; + float AL_EAXREVERB_MIN_GAIN = 0.0f; + float AL_EAXREVERB_MAX_GAIN = 1.0f; + float AL_EAXREVERB_DEFAULT_GAIN = 0.32f; + float AL_EAXREVERB_MIN_GAINHF = 0.0f; + float AL_EAXREVERB_MAX_GAINHF = 1.0f; + float AL_EAXREVERB_DEFAULT_GAINHF = 0.89f; + float AL_EAXREVERB_MIN_GAINLF = 0.0f; + float AL_EAXREVERB_MAX_GAINLF = 1.0f; + float AL_EAXREVERB_DEFAULT_GAINLF = 1.0f; + float AL_EAXREVERB_MIN_DECAY_TIME = 0.1f; + float AL_EAXREVERB_MAX_DECAY_TIME = 20.0f; + float AL_EAXREVERB_DEFAULT_DECAY_TIME = 1.49f; + float AL_EAXREVERB_MIN_DECAY_HFRATIO = 0.1f; + float AL_EAXREVERB_MAX_DECAY_HFRATIO = 2.0f; + float AL_EAXREVERB_DEFAULT_DECAY_HFRATIO = 0.83f; + float AL_EAXREVERB_MIN_DECAY_LFRATIO = 0.1f; + float AL_EAXREVERB_MAX_DECAY_LFRATIO = 2.0f; + float AL_EAXREVERB_DEFAULT_DECAY_LFRATIO = 1.0f; + float AL_EAXREVERB_MIN_REFLECTIONS_GAIN = 0.0f; + float AL_EAXREVERB_MAX_REFLECTIONS_GAIN = 3.16f; + float AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN = 0.05f; + float AL_EAXREVERB_MIN_REFLECTIONS_DELAY = 0.0f; + float AL_EAXREVERB_MAX_REFLECTIONS_DELAY = 0.3f; + float AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY = 0.007f; + float AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ = 0.0f; + float AL_EAXREVERB_MIN_LATE_REVERB_GAIN = 0.0f; + float AL_EAXREVERB_MAX_LATE_REVERB_GAIN = 10.0f; + float AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN = 1.26f; + float AL_EAXREVERB_MIN_LATE_REVERB_DELAY = 0.0f; + float AL_EAXREVERB_MAX_LATE_REVERB_DELAY = 0.1f; + float AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY = 0.011f; + float AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ = 0.0f; + float AL_EAXREVERB_MIN_ECHO_TIME = 0.075f; + float AL_EAXREVERB_MAX_ECHO_TIME = 0.25f; + float AL_EAXREVERB_DEFAULT_ECHO_TIME = 0.25f; + float AL_EAXREVERB_MIN_ECHO_DEPTH = 0.0f; + float AL_EAXREVERB_MAX_ECHO_DEPTH = 1.0f; + float AL_EAXREVERB_DEFAULT_ECHO_DEPTH = 0.0f; + float AL_EAXREVERB_MIN_MODULATION_TIME = 0.04f; + float AL_EAXREVERB_MAX_MODULATION_TIME = 4.0f; + float AL_EAXREVERB_DEFAULT_MODULATION_TIME = 0.25f; + float AL_EAXREVERB_MIN_MODULATION_DEPTH = 0.0f; + float AL_EAXREVERB_MAX_MODULATION_DEPTH = 1.0f; + float AL_EAXREVERB_DEFAULT_MODULATION_DEPTH = 0.0f; + float AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF = 0.892f; + float AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF = 1.0f; + float AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF = 0.994f; + float AL_EAXREVERB_MIN_HFREFERENCE = 1000.0f; + float AL_EAXREVERB_MAX_HFREFERENCE = 20000.0f; + float AL_EAXREVERB_DEFAULT_HFREFERENCE = 5000.0f; + float AL_EAXREVERB_MIN_LFREFERENCE = 20.0f; + float AL_EAXREVERB_MAX_LFREFERENCE = 1000.0f; + float AL_EAXREVERB_DEFAULT_LFREFERENCE = 250.0f; + float AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR = 0.0f; + float AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR = 10.0f; + float AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR = 0.0f; + int AL_EAXREVERB_MIN_DECAY_HFLIMIT = AL10.AL_FALSE; + int AL_EAXREVERB_MAX_DECAY_HFLIMIT = AL10.AL_TRUE; + int AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT = AL10.AL_TRUE; + // Chorus + int AL_CHORUS_WAVEFORM_SINUSOID = 0; + int AL_CHORUS_WAVEFORM_TRIANGLE = 1; + int AL_CHORUS_MIN_WAVEFORM = 0; + int AL_CHORUS_MAX_WAVEFORM = 1; + int AL_CHORUS_DEFAULT_WAVEFORM = 1; + int AL_CHORUS_MIN_PHASE = -180; + int AL_CHORUS_MAX_PHASE = 180; + int AL_CHORUS_DEFAULT_PHASE = 90; + float AL_CHORUS_MIN_RATE = 0.0f; + float AL_CHORUS_MAX_RATE = 10.0f; + float AL_CHORUS_DEFAULT_RATE = 1... [truncated message content] |
From: <ma...@us...> - 2010-05-24 21:32:30
|
Revision: 3346 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3346&view=rev Author: matzon Date: 2010-05-24 21:32:23 +0000 (Mon, 24 May 2010) Log Message: ----------- Upgrading to latest OpenAL-Soft (1.12+) Modified Paths: -------------- trunk/LWJGL/libs/linux/libopenal.so trunk/LWJGL/libs/linux/libopenal64.so trunk/LWJGL/libs/solaris/libopenal.so trunk/LWJGL/libs/windows/OpenAL32.dll trunk/LWJGL/libs/windows/OpenAL64.dll Added Paths: ----------- trunk/LWJGL/libs/solaris/libopenal64.so Modified: trunk/LWJGL/libs/linux/libopenal.so =================================================================== (Binary files differ) Modified: trunk/LWJGL/libs/linux/libopenal64.so =================================================================== (Binary files differ) Modified: trunk/LWJGL/libs/solaris/libopenal.so =================================================================== (Binary files differ) Added: trunk/LWJGL/libs/solaris/libopenal64.so =================================================================== (Binary files differ) Property changes on: trunk/LWJGL/libs/solaris/libopenal64.so ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/LWJGL/libs/windows/OpenAL32.dll =================================================================== (Binary files differ) Modified: trunk/LWJGL/libs/windows/OpenAL64.dll =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-05-24 21:09:26
|
Revision: 3345 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3345&view=rev Author: matzon Date: 2010-05-24 21:09:19 +0000 (Mon, 24 May 2010) Log Message: ----------- misc uncommitted jnlp stuff... Modified Paths: -------------- trunk/LWJGL/platform_build/build-webstart.xml Modified: trunk/LWJGL/platform_build/build-webstart.xml =================================================================== --- trunk/LWJGL/platform_build/build-webstart.xml 2010-05-22 16:53:49 UTC (rev 3344) +++ trunk/LWJGL/platform_build/build-webstart.xml 2010-05-24 21:09:19 UTC (rev 3345) @@ -7,7 +7,7 @@ </antcall> </target> - <target name="webstart_demo-release" depends="jars"> + <target name="webstart_demo-release"> <input message="Please type the password for the keystore" addproperty="sign.pwd"/> <antcall target="-webstart_demo"> @@ -25,6 +25,8 @@ <!-- unzip common files --> <unzip src="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.temp}/jnlp/temp" overwrite="true"/> + <copy file="${lwjgl.lib}/lwjgl_test.jar" tofile="${lwjgl.temp}/jnlp/temp/lwjgl-${lwjgl.version}/lwjgl_test.jar"/> + <copy file="${lwjgl.lib}/lwjgl_util.jar" tofile="${lwjgl.temp}/jnlp/temp/lwjgl-${lwjgl.version}/lwjgl_util.jar"/> <!-- move files to unified structure --> <move todir="${lwjgl.temp}/jnlp/temp"> @@ -36,16 +38,55 @@ <!-- move relevant files to root --> <move todir="${lwjgl.temp}/jnlp/" flatten="true"> <fileset dir="${lwjgl.temp}/jnlp/temp"> - <include name="**/**.jar"/> + <include name="**/jinput.jar"/> + <include name="**/lwjgl*.jar"/> </fileset> </move> + <!-- update Trusted-Library --> + <jar destfile="${lwjgl.temp}/jnlp/jinput.jar" update="true"> + <manifest> + <attribute name="Sealed" value="true"/> + <attribute name="Trusted-Library" value="true"/> + </manifest> + </jar> + + <jar destfile="${lwjgl.temp}/jnlp/lwjgl_util.jar" update="true"> + <manifest> + <attribute name="Sealed" value="true"/> + <attribute name="Trusted-Library" value="true"/> + </manifest> + </jar> + <!-- create native jars --> - <jar destfile="${lwjgl.temp}/jnlp/native_windows.jar" basedir="${lwjgl.temp}/jnlp/temp/native/windows"/> - <jar destfile="${lwjgl.temp}/jnlp/native_linux.jar" basedir="${lwjgl.temp}/jnlp/temp/native/linux"/> - <jar destfile="${lwjgl.temp}/jnlp/native_macosx.jar" basedir="${lwjgl.temp}/jnlp/temp/native/macosx"/> - <jar destfile="${lwjgl.temp}/jnlp/native_solaris.jar" basedir="${lwjgl.temp}/jnlp/temp/native/solaris"/> + <jar destfile="${lwjgl.temp}/jnlp/native_windows.jar" basedir="${lwjgl.temp}/jnlp/temp/native/windows"> + <manifest> + <attribute name="Sealed" value="true"/> + <attribute name="Trusted-Library" value="true"/> + </manifest> + </jar> + <jar destfile="${lwjgl.temp}/jnlp/native_linux.jar" basedir="${lwjgl.temp}/jnlp/temp/native/linux"> + <manifest> + <attribute name="Sealed" value="true"/> + <attribute name="Trusted-Library" value="true"/> + </manifest> + </jar> + + <jar destfile="${lwjgl.temp}/jnlp/native_macosx.jar" basedir="${lwjgl.temp}/jnlp/temp/native/macosx"> + <manifest> + <attribute name="Sealed" value="true"/> + <attribute name="Trusted-Library" value="true"/> + </manifest> + </jar> + + <jar destfile="${lwjgl.temp}/jnlp/native_solaris.jar" basedir="${lwjgl.temp}/jnlp/temp/native/solaris"> + <manifest> + <attribute name="Sealed" value="true"/> + <attribute name="Trusted-Library" value="true"/> + </manifest> + </jar> + <!-- create media jar --> <jar destfile="${lwjgl.temp}/jnlp/media.jar" basedir="${lwjgl.res}"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sp...@us...> - 2010-05-22 16:53:55
|
Revision: 3344 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3344&view=rev Author: spasi Date: 2010-05-22 16:53:49 +0000 (Sat, 22 May 2010) Log Message: ----------- Updated ContextAttribs to not default to the core profile for 3.2+ versions. Updated VersionTest (version 20 of ARB_create_context). Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOIndexTest.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/VersionTest.java Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java 2010-05-21 22:55:11 UTC (rev 3343) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java 2010-05-22 16:53:49 UTC (rev 3344) @@ -37,16 +37,16 @@ import java.nio.IntBuffer; /** - * This class represents the context attributes passed to CreateContextAttribs of the XGL_create_context extension. + * This class represents the context attributes passed to CreateContextAttribs of the ARB_create_context and + * ARB_create_context_profile extensions. * These attributes can be used to indicate at context creation which OpenGL interface will be used. This includes the * OpenGL version, the layer plane on which rendering takes place and also optional debug and forward combatibility modes. - * (read the XGL_create_context spec for details) + * (read the ARB_create_context spec for details) * <p/> * Use of this class is optional. If an OpenGL context is created without passing an instance of this class - * (or XGL_create_context is not supported), the old context creation code will be used. Use of ContextAttribs is required - * to create an OpenGL 3.0 or newer context. Support for debug and forward compatible mobes is not guaranteed by the OpenGL - * implementation. Developers may encounter debug contexts being the same as non-debug contexts or forward compatible - * contexts having support for deprecated functionality. + * (or ARB_create_context is not supported), the old context creation code will be used. Support for debug and forward + * compatible mobes is not guaranteed by the OpenGL implementation. Developers may encounter debug contexts being the same + * as non-debug contexts or forward compatible contexts having support for deprecated functionality. * <p/> * If the forwardCompatible * attribute is used, LWJGL will not load the deprecated functionality (as defined in the OpenGL 3.0 specification). This @@ -72,10 +72,10 @@ } public ContextAttribs(final int majorVersion, final int minorVersion) { - if ( majorVersion < 0 || - 3 < majorVersion || + if ( majorVersion < 0 || 4 < majorVersion || minorVersion < 0 || - (majorVersion == 3 && 2 < minorVersion) || + (majorVersion == 4 && 0 < minorVersion) || + (majorVersion == 3 && 3 < minorVersion) || (majorVersion == 2 && 1 < minorVersion) || (majorVersion == 1 && 5 < minorVersion) ) throw new IllegalArgumentException("Invalid OpenGL version specified: " + majorVersion + '.' + minorVersion); @@ -88,7 +88,7 @@ this.debug = false; this.forwardCompatible = false; - this.profileCore = 3 < majorVersion || (majorVersion == 3 && 2 <= minorVersion) ? true : false; + this.profileCore = false; this.profileCompatibility = false; } Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOIndexTest.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOIndexTest.java 2010-05-21 22:55:11 UTC (rev 3343) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOIndexTest.java 2010-05-22 16:53:49 UTC (rev 3344) @@ -179,6 +179,7 @@ mapped_indices_buffer); if ( new_mapped_buffer != mapped_indices_buffer ) mapped_indices_int_buffer = new_mapped_buffer.order(ByteOrder.nativeOrder()).asIntBuffer(); + mapped_indices_buffer = new_mapped_buffer; mapped_float_buffer.rewind(); vertices.rewind(); Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/VersionTest.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/VersionTest.java 2010-05-21 22:55:11 UTC (rev 3343) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/VersionTest.java 2010-05-22 16:53:49 UTC (rev 3344) @@ -29,13 +29,6 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - * Created by LWJGL. - * User: spasi - * Date: 2009-04-04 - * Time: 21:20:24 pm - */ - package org.lwjgl.test.opengl; import org.lwjgl.LWJGLException; @@ -44,6 +37,11 @@ import java.util.StringTokenizer; import java.util.regex.Pattern; +/** + * Tests the ARB_create_context extension through the use of the ContextAttribs class. + * + * @author Spasi + */ public final class VersionTest { private VersionTest() { @@ -110,46 +108,105 @@ System.out.println("\n---------\n"); + System.out.println("Requested " + ca); + final String version = GL11.glGetString(GL11.GL_VERSION); - System.out.print("GL Version requested: " + majorInput + '.' + minorInput); - if ( ca.isProfileCore() ) - System.out.print(" - Core Profile"); - else if ( ca.isProfileCompatibility() ) - System.out.print(" - Compatibility Profile"); - System.out.println("\nGL Version returned : " + version); + boolean deprecated = false; + try { + GL11.glVertex3f(0.0f, 0.0f, 0.0f); + deprecated = true; + } catch (Throwable t) {} final StringTokenizer version_tokenizer = new StringTokenizer(version, ". "); int majorVersion = Integer.parseInt(version_tokenizer.nextToken()); int minorVersion = Integer.parseInt(version_tokenizer.nextToken()); - if ( majorVersion != majorInput || minorVersion != minorInput ) { - if ( majorInput == 1 && minorInput == 0 ) - System.out.println("\tThe maximum supported version has been returned. The driver is well-behaved. :)"); - else if ( majorInput < 3 && majorVersion < 3 ) - System.out.println("\tThe maximum supported version pre-3.0 has been returned. The driver is well-behaved. :)"); - else - System.out.println("\tThe requested version was not returned. The driver is buggy! :("); - } else - System.out.println("\tThe requested version was returned. :)"); + final boolean compatibilityProfile; + final boolean coreProfile; - if ( ca.isProfileCompatibility() && !GLContext.getCapabilities().GL_ARB_compatibility ) - System.out.println("\tThe driver does not support the Compatibility Profile."); + if ( 3 < majorVersion || (majorVersion == 3 && 2 <= minorVersion) ) { + final int profileMask = GL11.glGetInteger(GL32.GL_CONTEXT_PROFILE_MASK); - System.out.println("\n---------\n"); + compatibilityProfile = (profileMask & GL32.GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) != 0; + coreProfile = (profileMask & GL32.GL_CONTEXT_CORE_PROFILE_BIT) != 0; + } else { + compatibilityProfile = false; + coreProfile = false; + } - System.out.println("Debug mode: " + ca.isDebug()); - System.out.println("Forward compatible mode: " + ca.isForwardCompatible()); - System.out.println("ARB_compatibility: " + GLContext.getCapabilities().GL_ARB_compatibility); - try { - GL11.glVertex3f(0.0f, 0.0f, 0.0f); - System.out.println("Deprecated functionality present: " + true); - } catch (Throwable t) { - System.out.println("Deprecated functionality present: " + false); - if ( GLContext.getCapabilities().GL_ARB_compatibility ) { - System.out.println("\tARB_compatibility is present, but LWJGL has enabled pseudo-forward compatible mode."); - } + System.out.println("\nGL_VERSION returned : " + version); + System.out.println("\tCore profile: " + coreProfile); + System.out.println("\tCompatibility profile: " + compatibilityProfile); + System.out.println("ARB_compatibility present: " + GLContext.getCapabilities().GL_ARB_compatibility); + System.out.println("Deprecated functionality present: " + deprecated); + if ( !deprecated && GLContext.getCapabilities().GL_ARB_compatibility ) + System.out.println("\tARB_compatibility is present, but LWJGL has enabled pseudo-forward compatible mode."); + + System.out.println("\n---------"); + + boolean success = false; + boolean check; + if ( majorInput < 3 || minorInput == 0 ) { + System.out.println("\nA version less than or equal to 3.0 is requested, the context\n" + + "returned may implement any of the following versions:"); + + System.out.println("\n1) Any version no less than that requested and no greater than 3.0."); + check = (majorInput < majorVersion || (majorInput == majorVersion && minorInput <= minorVersion)) // Satisfies requested version + && (majorVersion < 3 || (majorVersion == 3 && minorVersion == 0)); // 3.0 or earlier + System.out.println("\t" + check); + success |= check; + + System.out.println("\n2) Version 3.1, if the GL_ARB_compatibility extension is also implemented."); + check = majorVersion == 3 && minorVersion == 1 && GLContext.getCapabilities().GL_ARB_compatibility; + System.out.println("\t" + check); + success |= check; + + System.out.println("\n3) The compatibility profile of version 3.2 or greater."); + check = compatibilityProfile; // No need to check version, profiles are only available with 3.2+. + System.out.println("\t" + check); + success |= check; + + System.out.println("\nTEST " + (success ? "SUCCEEDED" : "FAILED")); + if ( !success && ca.isForwardCompatible() ) + System.out.println("\t(probably because the forward compatible flag was set)"); + } else if ( majorInput == 3 && minorInput == 1 ) { + System.out.println("\nVersion 3.1 is requested, the context returned may implement\n" + + "any of the following versions:"); + + System.out.println("\n1) Version 3.1. The GL_ARB_compatibility extension may or may not\n" + + "be implemented, as determined by the implementation."); + check = majorVersion == 3 && minorVersion == 1; + System.out.println("\t" + check); + success |= check; + + System.out.println("\n2) The core profile of version 3.2 or greater."); + check = coreProfile; // No need to check version, profiles are only available with 3.2+. + System.out.println("\t" + check); + success |= check; + + System.out.println("\nTEST " + (success ? "SUCCEEDED" : "FAILED")); + } else { + System.out.println("\nVersion 3.2 or greater is requested, the context returned may\n" + + "implement any of the following versions:"); + + System.out.println("\n1) The requested profile of the requested version."); + check = majorInput == majorVersion && minorInput == minorVersion + && (!ca.isProfileCompatibility() || compatibilityProfile) + && (!ca.isProfileCore() || coreProfile); + System.out.println("\t" + check); + success |= check; + + System.out.println("\n2) The requested profile of any later version, so long as no\n" + + "features have been removed from that later version and profile."); + check = majorInput < majorVersion || (majorInput == majorVersion && minorInput < minorVersion) + && (!ca.isProfileCompatibility() || compatibilityProfile) + && (!ca.isProfileCore() || coreProfile); + System.out.println("\t" + check); + success |= check; + + System.out.println("\nTEST " + (success ? "SUCCEEDED" : "FAILED")); } } @@ -174,12 +231,14 @@ private static void argsError(final String msg) { System.out.println("\nInvalid arguments error: " + msg); - System.out.println("\nUsage: VersionTest <majorVersion> <minorVersion> {<layer>, 'debug', 'fc'}:\n"); + System.out.println("\nUsage: VersionTest <majorVersion> <minorVersion> {'core'|'compatibility', <layer>, 'debug', 'fc'}:\n"); System.out.println("majorVersion\t- Major OpenGL version."); System.out.println("majorVersion\t- Minor OpenGL version."); + System.out.println("core\t- Sets the Core Profile bit (optional, requires 3.2+)."); + System.out.println("compatibility\t- Sets the Compatibility Profile bit (optional, requires 3.2+)."); System.out.println("layer\t- Layer plane (optional)."); System.out.println("debug\t- Enables debug mode (optional)."); - System.out.println("fc\t- Enables forward compatibility mode (optional)."); + System.out.println("fc\t- Enables forward compatibility mode (optional, requires 3.0+)."); cleanup(); System.exit(-1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-05-21 22:55:17
|
Revision: 3343 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3343&view=rev Author: kappa1 Date: 2010-05-21 22:55:11 +0000 (Fri, 21 May 2010) Log Message: ----------- small cleanup. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2010-05-21 22:26:23 UTC (rev 3342) +++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2010-05-21 22:55:11 UTC (rev 3343) @@ -339,7 +339,6 @@ if (lwjglApplet != null) { lwjglApplet.stop(); } - super.stop(); } /* @@ -352,8 +351,6 @@ progressbar = null; logo = null; - - super.destroy(); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-05-21 22:26:30
|
Revision: 3342 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3342&view=rev Author: kappa1 Date: 2010-05-21 22:26:23 +0000 (Fri, 21 May 2010) Log Message: ----------- XRandr add missing casts Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java 2010-05-21 22:12:57 UTC (rev 3341) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java 2010-05-21 22:26:23 UTC (rev 3342) @@ -97,7 +97,7 @@ screens.put( name, possibles.toArray( new Screen[ possibles.size() ] ) ); - current = ( Screen[] ) currentList.toArray( new Screen[ currentList.size() ] ); + current = (Screen[]) currentList.toArray(new Screen[currentList.size()]); } catch( Throwable e ) { @@ -116,7 +116,7 @@ { populate(); - return current.clone(); + return (Screen[]) current.clone(); } /** @@ -203,7 +203,7 @@ { populate(); // clone the array to prevent held copies being altered - return ( ( Screen[] ) screens.get( name ) ).clone(); + return (Screen[]) ((Screen[]) screens.get(name)).clone(); } private static final Pattern SCREEN_PATTERN1 = @@ -303,7 +303,7 @@ argList.add( xPos + "x" + yPos ); } - @Override + //@Override public String toString() { return name + " " + width + "x" + height + " @ " + xPos + "x" + yPos; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-05-21 22:13:06
|
Revision: 3341 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3341&view=rev Author: kappa1 Date: 2010-05-21 22:12:57 +0000 (Fri, 21 May 2010) Log Message: ----------- Further XRandR fixes, it now catches throwable in populate(), if there are any problems in parsing the xrandr output we revert to LWJGL's regular behaviour. All output now goes to LWJGLUtil.log() instead of the out.println and err.println. Credit to Ryanm for patch. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java 2010-05-20 18:11:47 UTC (rev 3340) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java 2010-05-21 22:12:57 UTC (rev 3341) @@ -1,33 +1,28 @@ /* - * Copyright (c) 2002-2010 LWJGL Project - * All rights reserved. - * + * 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, + * 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. + * 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; @@ -42,60 +37,74 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.lwjgl.LWJGLUtil; + /** * Utility for working with the xrandr commmand-line utility. Assumes * xrandr v1.2 or higher. * * @author ryanm */ -public class XRandR { +public class XRandR +{ + private static Screen[] current; - private static Screen[] current; + private static Map /* <String, Screen[]> */screens; - private static Map /* <String, Screen[]> */screens; - - private static void populate() { - if (screens == null) { + private static void populate() + { + if( screens == null ) + { screens = new HashMap/* <String, Screen[]> */(); // ProcessBuilder pb = new ProcessBuilder( "xrandr", "-q" ); // pb.redirectErrorStream(); - try { + try + { // Process p= pb.start(); - Process p = Runtime.getRuntime().exec(new String[] { "xrandr", "-q"}); + 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())); + BufferedReader br = new BufferedReader( new InputStreamReader( p.getInputStream() ) ); String line; - while ((line = br.readLine()) != null) { + while( ( line = br.readLine() ) != null ) + { line = line.trim(); - String[] sa = line.split("\\s+"); + String[] sa = line.split( "\\s+" ); - if (sa[1].equals("connected")) { + if( sa[ 1 ].equals( "connected" ) ) + { // found a new screen block - if (name != null) { - screens.put(name, possibles.toArray(new Screen[possibles.size()])); + if( name != null ) + { + screens.put( name, possibles.toArray( new Screen[ possibles.size() ] ) ); possibles.clear(); } - name = sa[0]; + name = sa[ 0 ]; // record the current config - parseScreen(currentList, name, sa[2]); - } else if (Pattern.matches("\\d*x\\d*", sa[0])) { + parseScreen( currentList, name, sa[ 2 ] ); + } + else if( Pattern.matches( "\\d*x\\d*", sa[ 0 ] ) ) + { // found a new mode line - parseScreen(possibles, name, sa[0]); + parseScreen( possibles, name, sa[ 0 ] ); } } - screens.put(name, possibles.toArray(new Screen[possibles.size()])); + screens.put( name, possibles.toArray( new Screen[ possibles.size() ] ) ); - current = (Screen[]) currentList.toArray(new Screen[currentList.size()]); - } catch (IOException e) { - e.printStackTrace(); + current = ( Screen[] ) currentList.toArray( new Screen[ currentList.size() ] ); } + catch( Throwable e ) + { + LWJGLUtil.log( "Exception in XRandR.populate(): " + e.getMessage() ); + screens.clear(); + current = new Screen[ 0 ]; + } } } @@ -103,71 +112,86 @@ * @return The current screen configuration, or an empty array if * xrandr is not supported */ - public static Screen[] getConfiguration() { + public static Screen[] getConfiguration() + { populate(); - return (Screen[]) current.clone(); + return current.clone(); } /** * @param screens * The desired screen set, may not be <code>null</code> + * @throws IllegalArgumentException + * if no screens are specified */ - public static void setConfiguration(Screen[]/* ... */screens) { - if (screens.length == 0) { - throw new IllegalArgumentException("Must specify at least one screen"); + 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"); + cmd.add( "xrandr" ); // switch off those in the current set not in the new set - for (int i = 0; i < current.length; i++) { + 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)) { + 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"); + 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); + for( int i = 0; i < screens.length; i++ ) + { + screens[ i ].getArgs( cmd ); } - try { + try + { // ProcessBuilder pb = new ProcessBuilder( cmd ); // pb.redirectErrorStream(); // Process p = pb.start(); - Process p = Runtime.getRuntime().exec((String[]) cmd.toArray(new String[cmd.size()])); + 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())); + BufferedReader br = new BufferedReader( new InputStreamReader( p.getInputStream() ) ); String line; - while ((line = br.readLine()) != null) { - System.out.println(line); + while( ( line = br.readLine() ) != null ) + { + LWJGLUtil.log( "Unexpected output from xrandr process: " + line ); } current = screens; - } catch (IOException e) { - e.printStackTrace(); } - + catch( IOException e ) + { + LWJGLUtil.log( "XRandR exception in setConfiguration(): " + e.getMessage() ); + } } /** * @return the name of connected screens, or an empty array if * xrandr is not supported */ - public static String[] getScreenNames() { + public static String[] getScreenNames() + { populate(); - return (String[]) screens.keySet().toArray(new String[screens.size()]); + return ( String[] ) screens.keySet().toArray( new String[ screens.size() ] ); } /** @@ -175,82 +199,93 @@ * @return the possible resolutions of the named screen, or * <code>null</code> if there is no such screen */ - public static Screen[] getResolutions(String name) { + public static Screen[] getResolutions( String name ) + { populate(); // clone the array to prevent held copies being altered - return (Screen[]) ((Screen[]) screens.get(name)).clone(); + return ( ( Screen[] ) screens.get( name ) ).clone(); } - - private static final Pattern SCREEN_PATTERN1 = Pattern.compile("^(\\d+)x(\\d+)\\+(\\d+)\\+(\\d+)$"); - private static final Pattern SCREEN_PATTERN2 = Pattern.compile("^(\\d+)x(\\d+)$"); - /** - * Parses a screen configuration and adds it to the list if it's valid. - * - * @param list - * the list to add the Screen to if it's valid - * @param name - * the name of this screen + private static final Pattern SCREEN_PATTERN1 = + Pattern.compile( "^(\\d+)x(\\d+)\\+(\\d+)\\+(\\d+)$" ); + + private static final Pattern SCREEN_PATTERN2 = Pattern.compile( "^(\\d+)x(\\d+)$" ); + + /** + * Parses a screen configuration and adds it to the list if it's + * valid. + * + * @param list + * the list to add the Screen to if it's valid + * @param name + * the name of this screen * @param conf * config string, format either widthxheight or * widthxheight+xPos+yPos - */ - private static void parseScreen(List /* <Screen> */ list, String name, String what) { - Matcher m = SCREEN_PATTERN1.matcher(what); - if(!m.matches()) { - m = SCREEN_PATTERN2.matcher(what); - if(!m.matches()) { - System.out.println("Did not match: " + what); - return; - } - } - int width = Integer.parseInt(m.group(1)); - int height = Integer.parseInt(m.group(2)); - int xpos, ypos; - if(m.groupCount() > 3) { - xpos = Integer.parseInt(m.group(3)); - ypos = Integer.parseInt(m.group(4)); - } else { - xpos = 0; - ypos = 0; - } - list.add(new Screen(name, width, height, xpos, ypos)); - } - + */ + private static void parseScreen( List /* <Screen> */list, String name, String what ) + { + Matcher m = SCREEN_PATTERN1.matcher( what ); + if( !m.matches() ) + { + m = SCREEN_PATTERN2.matcher( what ); + if( !m.matches() ) + { + System.out.println( "Did not match: " + what ); + return; + } + } + int width = Integer.parseInt( m.group( 1 ) ); + int height = Integer.parseInt( m.group( 2 ) ); + int xpos, ypos; + if( m.groupCount() > 3 ) + { + xpos = Integer.parseInt( m.group( 3 ) ); + ypos = Integer.parseInt( m.group( 4 ) ); + } + else + { + xpos = 0; + ypos = 0; + } + list.add( new Screen( name, width, height, xpos, ypos ) ); + } + /** * Encapsulates the configuration of a monitor. Resolution is * fixed, position is mutable * * @author ryanm */ - public static class Screen implements Cloneable { - + public static class Screen implements Cloneable + { /** * Name for this output */ - public final String name; + public final String name; /** * Width in pixels */ - public final int width; + public final int width; /** * Height in pixels */ - public final int height; + public final int height; /** * Position on the x-axis, in pixels */ - public int xPos = 0; + public int xPos = 0; /** * Position on the y-axis, in pixels */ - public int yPos = 0; + public int yPos = 0; - private Screen(String name, int width, int height, int xPos, int yPos) { + private Screen( String name, int width, int height, int xPos, int yPos ) + { this.name = name; this.width = width; this.height = height; @@ -258,17 +293,19 @@ this.yPos = yPos; } - 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); + 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() { + @Override + public String toString() + { return name + " " + width + "x" + height + " @ " + xPos + "x" + yPos; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-05-20 18:11:54
|
Revision: 3340 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3340&view=rev Author: kappa1 Date: 2010-05-20 18:11:47 +0000 (Thu, 20 May 2010) Log Message: ----------- XrandR fix for parsing some screen sizes, credit to MatthiasM for providing patch. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java 2010-05-07 17:03:36 UTC (rev 3339) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/XRandR.java 2010-05-20 18:11:47 UTC (rev 3340) @@ -39,6 +39,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.regex.Matcher; import java.util.regex.Pattern; /** @@ -82,10 +83,10 @@ name = sa[0]; // record the current config - currentList.add(new Screen(name, sa[2])); + parseScreen(currentList, name, sa[2]); } else if (Pattern.matches("\\d*x\\d*", sa[0])) { // found a new mode line - possibles.add(new Screen(name, sa[0])); + parseScreen(possibles, name, sa[0]); } } @@ -179,7 +180,43 @@ // clone the array to prevent held copies being altered return (Screen[]) ((Screen[]) screens.get(name)).clone(); } + + private static final Pattern SCREEN_PATTERN1 = Pattern.compile("^(\\d+)x(\\d+)\\+(\\d+)\\+(\\d+)$"); + private static final Pattern SCREEN_PATTERN2 = Pattern.compile("^(\\d+)x(\\d+)$"); + /** + * Parses a screen configuration and adds it to the list if it's valid. + * + * @param list + * the list to add the Screen to if it's valid + * @param name + * the name of this screen + * @param conf + * config string, format either widthxheight or + * widthxheight+xPos+yPos + */ + private static void parseScreen(List /* <Screen> */ list, String name, String what) { + Matcher m = SCREEN_PATTERN1.matcher(what); + if(!m.matches()) { + m = SCREEN_PATTERN2.matcher(what); + if(!m.matches()) { + System.out.println("Did not match: " + what); + return; + } + } + int width = Integer.parseInt(m.group(1)); + int height = Integer.parseInt(m.group(2)); + int xpos, ypos; + if(m.groupCount() > 3) { + xpos = Integer.parseInt(m.group(3)); + ypos = Integer.parseInt(m.group(4)); + } else { + xpos = 0; + ypos = 0; + } + list.add(new Screen(name, width, height, xpos, ypos)); + } + /** * Encapsulates the configuration of a monitor. Resolution is * fixed, position is mutable @@ -213,24 +250,12 @@ */ 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) { + private Screen(String name, int width, int height, int xPos, int yPos) { 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]); - } + this.width = width; + this.height = height; + this.xPos = xPos; + this.yPos = yPos; } private void getArgs(List/* <String> */argList) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sp...@us...> - 2010-05-07 17:03:44
|
Revision: 3339 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3339&view=rev Author: spasi Date: 2010-05-07 17:03:36 +0000 (Fri, 07 May 2010) Log Message: ----------- Fix for OpenAL debug builds. Added alternate methods for NV_fence. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_fence.java Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-05-01 09:19:00 UTC (rev 3338) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2010-05-07 17:03:36 UTC (rev 3339) @@ -166,7 +166,9 @@ return null; } + // DISABLED: We always generate indirect methods. (affects OpenAL only at the time of this change) public static boolean isMethodIndirect(boolean generate_error_checks, boolean context_specific, MethodDeclaration method) { + /* for (ParameterDeclaration param : method.getParameters()) { if (isAddressableType(param.getType()) || getParameterAutoAnnotation(param) != null || param.getAnnotation(Constant.class) != null) @@ -176,6 +178,8 @@ method.getAnnotation(CachedResult.class) != null || (generate_error_checks && method.getAnnotation(NoErrorCheck.class) == null) || context_specific; + */ + return true; } public static String getNativeQualifiedName(String qualified_name) { Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_fence.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_fence.java 2010-05-01 09:19:00 UTC (rev 3338) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_fence.java 2010-05-07 17:03:36 UTC (rev 3339) @@ -42,8 +42,15 @@ void glGenFencesNV(@AutoSize("piFences") @GLsizei int n, @OutParameter @GLuint IntBuffer piFences); + @Alternate("glGenFencesNV") + @GLreturn("piFences") + void glGenFencesNV2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer piFences); + void glDeleteFencesNV(@AutoSize("piFences") @GLsizei int n, @Const @GLuint IntBuffer piFences); + @Alternate("glDeleteFencesNV") + void glDeleteFencesNV(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtils.getBufferInt().put(0, fence), 0", keepParam = true) int fence); + void glSetFenceNV(@GLuint int fence, @GLenum int condition); boolean glTestFenceNV(@GLuint int fence); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sp...@us...> - 2010-05-01 09:19:07
|
Revision: 3338 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3338&view=rev Author: spasi Date: 2010-05-01 09:19:00 +0000 (Sat, 01 May 2010) Log Message: ----------- Fixed PolygonStipple check. Modified Paths: -------------- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java 2010-04-29 17:37:18 UTC (rev 3337) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java 2010-05-01 09:19:00 UTC (rev 3338) @@ -1147,7 +1147,7 @@ String glGetString(int name); @DeprecatedGL - void glGetPolygonStipple(@OutParameter @BufferObject(BufferKind.PackPBO) @Check("1024") @GLubyte ByteBuffer mask); + void glGetPolygonStipple(@OutParameter @BufferObject(BufferKind.PackPBO) @Check("128") @GLubyte ByteBuffer mask); @DeprecatedGL boolean glIsList(@GLuint int list); @@ -1252,7 +1252,7 @@ void glMatrixMode(@GLenum int mode); @DeprecatedGL - void glPolygonStipple(@BufferObject(BufferKind.UnpackPBO) @Check("1024") @Const @GLubyte ByteBuffer mask); + void glPolygonStipple(@BufferObject(BufferKind.UnpackPBO) @Check("128") @Const @GLubyte ByteBuffer mask); void glPolygonOffset(float factor, float units); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |