You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Caspian Rychlik-P. <ci...@us...> - 2002-09-20 16:57:16
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory usw-pr-cvs1:/tmp/cvs-serv17029/src/java/org/lwjgl/opengl Modified Files: GL.java Log Message: Catching up Index: GL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GL.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- GL.java 26 Aug 2002 21:17:55 -0000 1.9 +++ GL.java 20 Sep 2002 16:57:13 -0000 1.10 @@ -1547,7 +1547,7 @@ map.put(fields[i].getName(), fields[i]); } - String exts = wglGetExtensionsStringEXT(); + String exts = getString(EXTENSIONS); StringTokenizer st = new StringTokenizer(exts); while (st.hasMoreTokens()) { String ext = st.nextToken(); @@ -1622,6 +1622,9 @@ exts = wglGetExtensionsStringARB(Display.getHandle()); // Remember - this is an HWND not an HDC, which is what's required else exts = wglGetExtensionsStringEXT(); + + if (exts == null) + return; System.out.println("Available WGL extensions:"); StringTokenizer st = new StringTokenizer(exts); |
From: Caspian Rychlik-P. <ci...@us...> - 2002-09-20 16:53:30
|
Update of /cvsroot/java-game-lib/LWJGL/doc/tutorial In directory usw-pr-cvs1:/tmp/cvs-serv15443/doc/tutorial Modified Files: skeleton_code.html Log Message: Catching up Index: skeleton_code.html CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/doc/tutorial/skeleton_code.html =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/doc/tutorial/skeleton_code.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- skeleton_code.html 25 Aug 2002 10:04:09 -0000 1.2 +++ skeleton_code.html 20 Sep 2002 16:53:25 -0000 1.3 @@ -178,6 +178,7 @@ System.exit(1);<br> }<br> }<br> + public static final GLU glu = new GLU(gl);<br> <br> /** Is the game finished? */<br> private static boolean finished;<br> |
From: Brian M. <ma...@us...> - 2002-09-12 01:42:53
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory usw-pr-cvs1:/tmp/cvs-serv23777 Modified Files: org_lwjgl_opengl_eax_CoreEAX.cpp Log Message: fix: don't do the whole initializing thingy - just assume that OpenAL is initialized fix:: wrong comment fix: changed ifndef to ifdef DOH! Index: org_lwjgl_opengl_eax_CoreEAX.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_eax_CoreEAX.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_eax_CoreEAX.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_opengl_eax_CoreEAX.cpp 2 Sep 2002 13:22:09 -0000 1.1 +++ org_lwjgl_opengl_eax_CoreEAX.cpp 12 Sep 2002 01:42:49 -0000 1.2 @@ -57,30 +57,10 @@ JNIEXPORT void JNICALL Java_org_lwjgl_openal_eax_CoreEAX_determineAvailableExtensions (JNIEnv *env, jobject obj) { #ifdef _WIN32 bool EAXSupported = false; - ALCcontext *Context; - ALCdevice *Device; - - //open device - Device = alcOpenDevice(NULL); - if(Device == NULL) { - ThrowException(env, "Unable to determine EAX Extensions"); - return; - } - //create a context - Context = alcCreateContext(Device, NULL); - if(Context == NULL) { - alcCloseDevice(Device); - ThrowException(env, "Unable to determine EAX Extensions"); - return; - } - - //make current - alcMakeContextCurrent(Context); - if(alGetError() != AL_NO_ERROR) { - alcCloseDevice(Device); - ThrowException(env, "Unable to determine EAX Extensions"); - return; + //check that we have a current context + if(alcGetCurrentContext() == NULL) { + ThrowException(env, "Unable to determine EAX Extensions: No current context"); } //check for extension, and assign if available @@ -90,11 +70,6 @@ EAXSupported = (eaxSet != NULL && eaxGet != NULL); } - //clean up - alcMakeContextCurrent(NULL); - alcDestroyContext(Context); - alcCloseDevice(Device); - //throw exception if no EAX support if(EAXSupported != true) { ThrowException(env, "Unable to determine EAX Extensions"); @@ -130,7 +105,7 @@ #ifdef _WIN32 jint result = (jint) eaxGet((const struct _GUID*)propertySetID, (ALuint) property, (ALuint) source, (ALvoid*) value, (ALuint) size); CHECK_AL_ERROR - + return result; #else return AL_INVALID_OPERATION; @@ -141,11 +116,11 @@ * This function sets an EAX value. * * C Specification: - * ALenum EAXGet(const struct _GUID *propertySetID,ALuint property,ALuint source,ALvoid + * ALenum EAXSet(const struct _GUID *propertySetID,ALuint property,ALuint source,ALvoid * *value,ALuint size); */ JNIEXPORT jint JNICALL Java_org_lwjgl_openal_eax_CoreEAX_eaxSet (JNIEnv *env, jobject obj, jint propertySetID, jint property, jint source, jint value, jint size) { -#ifndef _WIN32 +#ifdef _WIN32 jint result = (jint) eaxSet((const struct _GUID*)propertySetID, (ALuint) property, (ALuint) source, (ALvoid*) value, (ALuint) size); CHECK_AL_ERROR |
From: Brian M. <ma...@us...> - 2002-09-12 01:31:23
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test In directory usw-pr-cvs1:/tmp/cvs-serv20388/org/lwjgl/openal/test Modified Files: ALTest.java Log Message: fix: fixed overflow error Index: ALTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/ALTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/ALTest.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ALTest.java 4 Sep 2002 15:27:24 -0000 1.12 +++ ALTest.java 12 Sep 2002 01:31:20 -0000 1.13 @@ -2238,7 +2238,7 @@ break; case '6': - Room.put(-10000); + Room.put(0, -10000); eax.eaxSet(EAX.LISTENER_GUID, EAXListenerProperties.ROOM | EAXListenerProperties.DEFERRED, 0, Sys.getDirectBufferAddress(Room), 4); if ((error = al.getError()) != AL.NO_ERROR) |
From: Brian M. <ma...@us...> - 2002-09-12 01:26:32
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax In directory usw-pr-cvs1:/tmp/cvs-serv19400/org/lwjgl/openal/eax Modified Files: BaseEAX.java Log Message: add: added finalizer Index: BaseEAX.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax/BaseEAX.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax/BaseEAX.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- BaseEAX.java 2 Sep 2002 13:07:48 -0000 1.1 +++ BaseEAX.java 12 Sep 2002 01:26:27 -0000 1.2 @@ -99,6 +99,17 @@ created = false; nDestroy(); } + + /** + * Finalizer, marked final. To perform specialized cleanup override the + * cleanup() method. + * + * @see #cleanup() + */ + public void finalize() throws Throwable { + super.finalize(); + destroy(); + } /** * Native method the destroy the EAX |
From: Brian M. <ma...@us...> - 2002-09-11 23:58:28
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test In directory usw-pr-cvs1:/tmp/cvs-serv30945/org/lwjgl/openal/test Modified Files: BasicTest.java Log Message: fix: create default device, instead of "" device (which creates a waveout device!) Index: BasicTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/BasicTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/BasicTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- BasicTest.java 3 Sep 2002 18:54:40 -0000 1.3 +++ BasicTest.java 11 Sep 2002 23:58:23 -0000 1.4 @@ -101,7 +101,7 @@ protected void alInitialize() { //get default device - device = alc.openDevice(""); + device = alc.openDevice(null); if(device == null) { throw new RuntimeException("Error creating device"); } |
From: Brian M. <ma...@us...> - 2002-09-11 23:25:40
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test In directory usw-pr-cvs1:/tmp/cvs-serv21415/org/lwjgl/openal/test Modified Files: EAXTest.java Log Message: fix: EAX now requires OpenAL to be initialized PRIOR to calling create Index: EAXTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/EAXTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/EAXTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- EAXTest.java 2 Sep 2002 13:09:20 -0000 1.3 +++ EAXTest.java 11 Sep 2002 23:25:35 -0000 1.4 @@ -32,6 +32,12 @@ package org.lwjgl.openal.test; import org.lwjgl.openal.eax.EAX; +import org.lwjgl.openal.eax.EAXBufferProperties; +import java.nio.IntBuffer; + +import org.lwjgl.Sys; +import org.lwjgl.openal.AL; +import org.lwjgl.openal.ALUTLoadWAVData; /** * $Id$ @@ -54,6 +60,8 @@ * Runs the actual test, using supplied arguments */ protected void execute(String[] args) { + alInitialize(); + EAX eax = new EAX(); try { eax.create(); @@ -61,7 +69,15 @@ e.printStackTrace(); return; } - System.out.println("EAX supported..."); + System.out.print("EAX supported..."); + + //no errorchecking from now on, since our context is gone. + //shutdown + alc.makeContextCurrent(null); + alc.destroyContext(context); + alc.closeDevice(device); + + System.out.println("test done."); } /** |
From: Brian M. <ma...@us...> - 2002-09-11 16:57:08
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax In directory usw-pr-cvs1:/tmp/cvs-serv25888/org/lwjgl/openal/eax Modified Files: EAXListenerProperties.java Log Message: fix: now reading ints instead of longs - buffer overflow, since longs are 64 bit in java Index: EAXListenerProperties.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax/EAXListenerProperties.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax/EAXListenerProperties.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EAXListenerProperties.java 3 Sep 2002 11:17:42 -0000 1.2 +++ EAXListenerProperties.java 11 Sep 2002 16:57:03 -0000 1.3 @@ -219,8 +219,8 @@ * * @return room effect level */ - public long getRoom() { - return eaxListenerProperties.getLong(room_offset); + public int getRoom() { + return eaxListenerProperties.getInt(room_offset); } /** @@ -228,8 +228,8 @@ * * @param room room effect level to set to */ - public void setRoom(long room) { - eaxListenerProperties.putLong(room_offset, room); + public void setRoom(int room) { + eaxListenerProperties.putInt(room_offset, room); } /** @@ -237,8 +237,8 @@ * * @return room effect level at high frequencies */ - public long getRoomHF() { - return eaxListenerProperties.getLong(roomHF_offset); + public int getRoomHF() { + return eaxListenerProperties.getInt(roomHF_offset); } /** @@ -246,8 +246,8 @@ * * @param room room effect level at high frequencies to set to */ - public void setRoomHF(long roomHF) { - eaxListenerProperties.putLong(roomHF_offset, roomHF); + public void setRoomHF(int roomHF) { + eaxListenerProperties.putInt(roomHF_offset, roomHF); } /** @@ -309,8 +309,8 @@ * * @return early reflections level relative to room effect */ - public long getReflections() { - return eaxListenerProperties.getLong(reflections_offset); + public int getReflections() { + return eaxListenerProperties.getInt(reflections_offset); } /** @@ -318,8 +318,8 @@ * * @param reflections early reflections level relative to room effect to set to */ - public void setReflections(long reflections) { - eaxListenerProperties.putLong(reflections_offset, reflections); + public void setReflections(int reflections) { + eaxListenerProperties.putInt(reflections_offset, reflections); } /** @@ -345,8 +345,8 @@ * * @return late reverberation level relative to room effect */ - public long getReverb() { - return eaxListenerProperties.getLong(reverb_offset); + public int getReverb() { + return eaxListenerProperties.getInt(reverb_offset); } /** @@ -354,8 +354,8 @@ * * @param reverb late reverberation level relative to room effect to set to */ - public void setReverb(long reverb) { - eaxListenerProperties.putLong(reverb_offset, reverb); + public void setReverb(int reverb) { + eaxListenerProperties.putInt(reverb_offset, reverb); } /** @@ -381,8 +381,8 @@ * * @return listener properties */ - public long getEnvironment() { - return eaxListenerProperties.getLong(environment_offset); + public int getEnvironment() { + return eaxListenerProperties.getInt(environment_offset); } /** @@ -390,8 +390,8 @@ * * @param environment listener properties to set to */ - public void setEnvironment(long environment) { - eaxListenerProperties.putLong(environment_offset, environment); + public void setEnvironment(int environment) { + eaxListenerProperties.putInt(environment_offset, environment); } /** @@ -453,8 +453,8 @@ * * @return modifier for behavior of properties */ - public long getFlags() { - return eaxListenerProperties.getLong(flags_offset); + public int getFlags() { + return eaxListenerProperties.getInt(flags_offset); } /** @@ -462,8 +462,8 @@ * * @param flags modifier for behavior of properties to set to */ - public void setFlags(long flags) { - eaxListenerProperties.putLong(flags_offset, flags); + public void setFlags(int flags) { + eaxListenerProperties.putInt(flags_offset, flags); } /** |
From: Brian M. <ma...@us...> - 2002-09-11 16:46:30
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax In directory usw-pr-cvs1:/tmp/cvs-serv22911/org/lwjgl/openal/eax Modified Files: EAXBufferProperties.java Log Message: fix: now reading ints instead of longs - buffer overflow, since longs are 64 bit in java Index: EAXBufferProperties.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax/EAXBufferProperties.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax/EAXBufferProperties.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EAXBufferProperties.java 3 Sep 2002 11:17:42 -0000 1.2 +++ EAXBufferProperties.java 11 Sep 2002 16:46:26 -0000 1.3 @@ -40,7 +40,9 @@ /** * $Id$ * - * This class encapsultaes the EAXBUFFERPROPERTIES struct + * This class encapsultaes the EAXBUFFERPROPERTIES struct. Since longs + * are 64 bit in Java and "typically" 32 on other platforms, we cheat by reading an + * int when reading a long field. * * @author Brian Matzon <br...@ma...> * @version $Revision$ @@ -202,8 +204,8 @@ * * @return direct path level */ - public long getDirect() { - return eaxBufferProperties.getLong(direct_offset); + public int getDirect() { + return eaxBufferProperties.getInt(direct_offset); } /** @@ -211,8 +213,8 @@ * * @param direct direct path level to set to */ - public void setDirect(long direct) { - eaxBufferProperties.putLong(direct_offset, direct); + public void setDirect(int direct) { + eaxBufferProperties.putInt(direct_offset, direct); } /** @@ -220,8 +222,8 @@ * * @return direct path level at high frequencies */ - public long getDirectHF() { - return eaxBufferProperties.getLong(directHF_offset); + public int getDirectHF() { + return eaxBufferProperties.getInt(directHF_offset); } /** @@ -229,8 +231,8 @@ * * @param direct direct path level at high frequencies to set to */ - public void setDirectHF(long directHF) { - eaxBufferProperties.putLong(directHF_offset, directHF); + public void setDirectHF(int directHF) { + eaxBufferProperties.putInt(directHF_offset, directHF); } /** @@ -238,8 +240,8 @@ * * @return room effect level */ - public long getRoom() { - return eaxBufferProperties.getLong(room_offset); + public int getRoom() { + return eaxBufferProperties.getInt(room_offset); } /** @@ -247,8 +249,8 @@ * * @param room room effect level to set to */ - public void setRoom(long room) { - eaxBufferProperties.putLong(room_offset, room); + public void setRoom(int room) { + eaxBufferProperties.putInt(room_offset, room); } /** @@ -256,8 +258,8 @@ * * @return room effect level at high frequencies */ - public long getRoomHF() { - return eaxBufferProperties.getLong(roomHF_offset); + public int getRoomHF() { + return eaxBufferProperties.getInt(roomHF_offset); } /** @@ -265,8 +267,8 @@ * * @param room room effect level at high frequencies to set to */ - public void setRoomHF(long roomHF) { - eaxBufferProperties.putLong(roomHF_offset, roomHF); + public void setRoomHF(int roomHF) { + eaxBufferProperties.putInt(roomHF_offset, roomHF); } /** @@ -292,8 +294,8 @@ * * @return main obstruction control (attenuation at high frequencies) */ - public long getObstruction() { - return eaxBufferProperties.getLong(obstruction_offset); + public int getObstruction() { + return eaxBufferProperties.getInt(obstruction_offset); } /** @@ -301,8 +303,8 @@ * * @param obstruction main obstruction control (attenuation at high frequencies) to set to */ - public void setObstruction(long obstruction) { - eaxBufferProperties.putLong(obstruction_offset, obstruction); + public void setObstruction(int obstruction) { + eaxBufferProperties.putInt(obstruction_offset, obstruction); } /** @@ -328,8 +330,8 @@ * * @return main occlusion control (attenuation at high frequencies) */ - public long getOcclusion() { - return eaxBufferProperties.getLong(occlusion_offset); + public int getOcclusion() { + return eaxBufferProperties.getInt(occlusion_offset); } /** @@ -337,8 +339,8 @@ * * @param occlusion main occlusion control (attenuation at high frequencies) to set to */ - public void setOcclusion(long occlusion) { - eaxBufferProperties.putLong(occlusion_offset, occlusion); + public void setOcclusion(int occlusion) { + eaxBufferProperties.putInt(occlusion_offset, occlusion); } /** @@ -382,8 +384,8 @@ * * @return OutsideVolumeHF */ - public long getOutsideVolumeHF() { - return eaxBufferProperties.getLong(outsideVolumeHF_offset); + public int getOutsideVolumeHF() { + return eaxBufferProperties.getInt(outsideVolumeHF_offset); } /** @@ -391,8 +393,8 @@ * * @param outsideVolumeHF OutsideVolumeHF to set to */ - public void setOutsideVolumeHF(long outsideVolumeHF) { - eaxBufferProperties.putLong(outsideVolumeHF_offset, outsideVolumeHF); + public void setOutsideVolumeHF(int outsideVolumeHF) { + eaxBufferProperties.putInt(outsideVolumeHF_offset, outsideVolumeHF); } /** @@ -418,8 +420,8 @@ * * @return modifier for behavior of properties */ - public long getFlags() { - return eaxBufferProperties.getLong(flags_offset); + public int getFlags() { + return eaxBufferProperties.getInt(flags_offset); } /** @@ -427,8 +429,8 @@ * * @param flags modifier for behavior of properties to set to */ - public void setFlags(long flags) { - eaxBufferProperties.putLong(flags_offset, flags); + public void setFlags(int flags) { + eaxBufferProperties.putInt(flags_offset, flags); } /** |
From: Brian M. <ma...@us...> - 2002-09-10 14:35:48
|
Update of /cvsroot/java-game-lib/LWJGL/doc In directory usw-pr-cvs1:/tmp/cvs-serv20136/doc Modified Files: CREDITS Log Message: add: Added Gregory Pierce to credits list Index: CREDITS CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/doc/CREDITS =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/doc/CREDITS,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- CREDITS 2 Sep 2002 09:51:59 -0000 1.1 +++ CREDITS 10 Sep 2002 14:35:41 -0000 1.2 @@ -3,6 +3,7 @@ - Brian Matzon <br...@ma...> - Niels Jørgensen <nj...@ni...> - Tristan Campbell <tr...@ha...> + - Gregory Pierce <gre...@ya...> additional credits goes to: - Joseph I. Valenzuela [OpenAL] |
From: Brian M. <ma...@us...> - 2002-09-09 16:41:42
|
Update of /cvsroot/java-game-lib/LWJGL/doc In directory usw-pr-cvs1:/tmp/cvs-serv29338a Added Files: openal_c-to-java.html Removed Files: openal_c-to-java.txt Log Message: mod: changed text file to html, so that it can be included on website --- NEW FILE: openal_c-to-java.html --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/doc/openal_c-to-java.html <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>OpenAL Tutoral</title> <meta http-equiv="content-type" content="text/html; charset=windows-1252"> <meta name="author" content="Brian Matzon"> <meta name="description" content="Basic sound using OpenAL"> </head> <body> <h1 align="center">Array Conversion<br> <font size="-1">(by Brian Matzon <<a href="mailto:br...@ma...">br...@ma...</a>>)</font><br> </h1> <b>1.0 About this document</b><br> This document describes the typical rules for converting arrays often used in C/C++ OpenAL (and indeed OpenGL too) code.<br> It is not bullet proof, but should handle most cases.<br> <br> <b>1.1 Array to ByteBuffer<br> </b>When using an array of some data type in C/C++ you will typically convert that<br> to the corresponding ByteBuffer type. ie:<p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt>ALfloat floatv[3];</tt></p> <p>becomes</p> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> FloatBuffer floatv = createFloatBuffer(3);</tt></p> <p>In this example, <tt>createFloatBuffer</tt> is this utility method:</p> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> public FloatBuffer createFloatBuffer(int size) {<br> //allocate bytebuffer, using 4 bytes per float<br> ByteBuffer temp = ByteBuffer.allocateDirect(4*size);<br> temp.order(ByteOrder.nativeOrder());<br> <br> return temp.asFloatBuffer();<br> }</tt></p> <p> <b>1.2 Examples</b><br> Using the above FloatBuffer, you would typically use it like this (examples taken from altest.c/ALTest.java):</p> <p> <b>1.2.1 Example 1</b></p> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> alGetListenerfv(AL_POSITION, floatv);</tt></p> <p> becomes</p> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> al.getListenerfv(AL.POSITION, Sys.getDirectBufferAddress(floatv));</tt></p> <p><b>1.2.2 Example 2</b></p> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> if (floatv[0] != 100.0)) {</tt></p> <p>becomes:</p> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> if (floatv.get(0) != 100.0f) {</tt></p> <p><b>1.2.3 Example 3</b></p> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> alGetListener3f(AL_POSITION, &floatv[0], <br> &floatv[1], <br> &floatv[2]);</tt></p> <p>becomes</p> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> al.getListener3f(AL.POSITION, Sys.getDirectBufferAddress(floatv), <br> Sys.getDirectBufferAddress(floatv) + 4, <br> Sys.getDirectBufferAddress(floatv) + 8);</tt></p> <p>the last case is a bit special, since we start of by getting the base address of the buffer, and then add the datatype size to the base address<br> to get the address of that specific index. This is just how it has to be in Java.</p> </body> </html> --- openal_c-to-java.txt DELETED --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/doc/openal_c-to-java.txt |
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory usw-pr-cvs1:/tmp/cvs-serv11929 Modified Files: MatrixOpCommon.cpp MatrixOpCommon.h org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.cpp Log Message: Cleaned up the code, all test cases I have sent at it work. check current compatibility at: http://www.happypedestrian.com/lwjgl/matrixop.html Index: MatrixOpCommon.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/MatrixOpCommon.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/MatrixOpCommon.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- MatrixOpCommon.cpp 7 Sep 2002 19:52:01 -0000 1.2 +++ MatrixOpCommon.cpp 8 Sep 2002 23:57:33 -0000 1.3 @@ -70,7 +70,7 @@ } -SrcMatrix::SrcMatrix ( jint addr, jint s, +MatrixSrc::MatrixSrc ( jint addr, jint s, jint w, jint h, jint e, jboolean t): Matrix(addr, s, e), @@ -102,16 +102,16 @@ if (elements == 1) { - // fool the nextRecord function into returning a value + // fool the nextMatrix function into returning a value elements = 2; - nextRecord(); + nextMatrix(); elements = 1; } } -SrcMatrix::~SrcMatrix() +MatrixSrc::~MatrixSrc() { - //cout << "SrcMatrix destructor \n"; + //cout << "MatrixSrc destructor \n"; delete [] record; @@ -119,7 +119,7 @@ delete [] transpose_record; } -float * SrcMatrix::nextRecord() +float * MatrixSrc::nextMatrix() { if (elements > 1) { @@ -159,7 +159,7 @@ return current_record_ptr; } -DstMatrix::DstMatrix (jint addr, jint s, jint w, jint h, jint e, jboolean t): +MatrixDst::MatrixDst (jint addr, jint s, jint w, jint h, jint e, jboolean t): Matrix(addr, s, e) { width = w; @@ -181,9 +181,9 @@ record_offset = address - stride; } -DstMatrix::~DstMatrix() +MatrixDst::~MatrixDst() { - //cout << "DstMatrix destructor \n"; + //cout << "MatrixDst destructor \n"; delete [] record; if (transpose_record != 0) @@ -206,7 +206,7 @@ } } -void DstMatrix::configureBuffer(SrcMatrix & a, SrcMatrix & b) +void MatrixDst::configureBuffer(MatrixSrc & a, MatrixSrc & b) { @@ -226,7 +226,7 @@ createBuffer(); } -void DstMatrix::configureBuffer(SrcMatrix & a) +void MatrixDst::configureBuffer(MatrixSrc & a) { if (identicalDataSpaces(a)) record_buffered = JNI_TRUE; @@ -234,14 +234,14 @@ createBuffer(); } -void DstMatrix::createBuffer() +void MatrixDst::createBuffer() { data_buffered = JNI_TRUE; buffer = new char[ elements * stride ]; record_offset = buffer - stride; } -float * DstMatrix::nextRecord() +float * MatrixDst::nextMatrix() { record_offset = &record_offset[stride]; @@ -258,7 +258,7 @@ } -void DstMatrix::writeRecord() +void MatrixDst::writeComplete() { if (last_record_in_temp) { Index: MatrixOpCommon.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/MatrixOpCommon.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/MatrixOpCommon.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- MatrixOpCommon.h 28 Aug 2002 16:45:24 -0000 1.1 +++ MatrixOpCommon.h 8 Sep 2002 23:57:33 -0000 1.2 @@ -43,7 +43,7 @@ // Src Matrix ////////////////////////////////////////////////////////////////////////////////////// -class SrcMatrix: public Matrix +class MatrixSrc: public Matrix { private: char * record_offset; // the offset of this record in memory @@ -51,41 +51,46 @@ float * record; // temporary storage to store a fully aligned and transposed // copy of the record, if the one in memory is not so float * current_record_ptr; // the address of the memory containing the record last - // returned by the nextRecord() function + // returned by the nextMatrix() function jint record_size; // the total floats in each record public: - SrcMatrix ( jint address, jint stride, jint width, jint height, jint elements, jboolean transpose); + MatrixSrc ( jint address, jint stride, jint width, jint height, jint elements, jboolean transpose); + ~MatrixSrc(); + void rewind() { record_offset = address; } - float * nextRecord(); - ~SrcMatrix(); + float * nextMatrix(); + }; /////////////////////////////////////////////////////////////////////////////////////// // Dst Matrix ////////////////////////////////////////////////////////////////////////////////////// -class DstMatrix: public Matrix +class MatrixDst: public Matrix { - char * record_offset; // the offset of the record in memory - - jboolean data_buffered; // if all of the data has to be buffered - char * buffer; // a buffer used when data_buffered - - jboolean last_record_in_temp; - jboolean record_buffered; // if only a single record is buffered - float * record; // to store data if source is unaligned + private: + char * record_offset; // the offset of the record in memory - jint record_size; + jboolean data_buffered; // if all of the data has to be buffered + char * buffer; // a buffer used when data_buffered + + jboolean last_record_in_temp; + jboolean record_buffered; // if only a single record is buffered + float * record; // to store data if source is unaligned + + jint record_size; + void createBuffer(); public: - DstMatrix (jint address, jint stride, jint width, jint height, jint elements, jboolean transpose); - void configureBuffer(SrcMatrix & a, SrcMatrix & b); - void configureBuffer(SrcMatrix & a); - void createBuffer(); - float * nextRecord(); - void writeRecord(); - ~DstMatrix(); + MatrixDst (jint address, jint stride, jint width, jint height, jint elements, jboolean transpose); + ~MatrixDst(); + void configureBuffer(MatrixSrc & a, MatrixSrc & b); + void configureBuffer(MatrixSrc & a); + + float * nextMatrix(); + void writeComplete(); + }; Index: org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.cpp 28 Aug 2002 16:45:24 -0000 1.2 +++ org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.cpp 8 Sep 2002 23:57:33 -0000 1.3 @@ -68,32 +68,33 @@ jboolean transposeDest ) { - SrcMatrix left (leftSourceAddress, leftSourceStride, + MatrixSrc left (leftSourceAddress, leftSourceStride, leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource); - SrcMatrix right (rightSourceAddress, leftSourceStride, + MatrixSrc right (rightSourceAddress, leftSourceStride, rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource); - DstMatrix dest (destAddress, destStride, + MatrixDst dest (destAddress, destStride, left.width, left.height, left.elements * right.elements, transposeDest); dest.configureBuffer(left, right); - float * leftRecord, * rightRecord, * destRecord; + float * leftMatrix, * rightMatrix, * destMatrix; left.rewind(); for (int i = 0; i < left.elements; i++) { - leftRecord = left.nextRecord(); + leftMatrix = left.nextMatrix(); right.rewind(); for (int j = 0; j < right.elements; j++) { - rightRecord = right.nextRecord(); - destRecord = dest.nextRecord(); + rightMatrix = right.nextMatrix(); + destMatrix = dest.nextMatrix(); - for (int k = (dest.width * dest.height) - 1; k >= 0; k--) - destRecord[k] = leftRecord[k] + rightRecord[k]; + int k = dest.width * dest.height; + while (k--) + destMatrix[k] = leftMatrix[k] + rightMatrix[k]; - dest.writeRecord(); + dest.writeComplete(); } } Index: org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe.cpp 28 Aug 2002 16:45:24 -0000 1.2 +++ org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe.cpp 8 Sep 2002 23:57:33 -0000 1.3 @@ -68,33 +68,33 @@ jboolean transposeDest ) { - SrcMatrix left (leftSourceAddress, leftSourceStride, + MatrixSrc left (leftSourceAddress, leftSourceStride, leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource); - SrcMatrix right (rightSourceAddress, leftSourceStride, + MatrixSrc right (rightSourceAddress, leftSourceStride, rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource); - DstMatrix dest (destAddress, destStride, + MatrixDst dest (destAddress, destStride, left.width, left.height, left.elements * right.elements, transposeDest); - float * leftRecord, * rightRecord, * destRecord; + float * leftMatrix, * rightMatrix, * destMatrix; left.rewind(); for (int i = 0; i < leftElements; i++) { - leftRecord = left.nextRecord(); + leftMatrix = left.nextMatrix(); right.rewind(); for (int j = 0; j < rightElements; j++) { - rightRecord = right.nextRecord(); - destRecord = dest.nextRecord(); + rightMatrix = right.nextMatrix(); + destMatrix = dest.nextMatrix(); - for (int k = (leftSourceWidth * rightSourceWidth) - 1; k >= 0; k--) - destRecord[k] = leftRecord[k] + rightRecord[k]; + int k = dest.width * dest.height; + while (k--) + destMatrix[k] = leftMatrix[k] + rightMatrix[k]; - dest.writeRecord(); + dest.writeComplete(); } } - } Index: org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect.cpp 28 Aug 2002 16:45:24 -0000 1.2 +++ org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect.cpp 8 Sep 2002 23:57:33 -0000 1.3 @@ -68,21 +68,22 @@ transposeDest = false; } - SrcMatrix source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); - DstMatrix dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest); + MatrixSrc source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); + MatrixDst dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest); dest.configureBuffer(source); - float * sourceRecord, * destRecord; + float * srcMatrix, * destMatrix; + int matrixByteCount = source.width*source.height*sizeof(jfloat); for (int i = 0; i < source.elements; i++) { - sourceRecord = source.nextRecord(); - destRecord = dest.nextRecord(); + srcMatrix = source.nextMatrix(); + destMatrix = dest.nextMatrix(); // just do a straight memory copy - memcpy(destRecord, sourceRecord, source.width*source.height*sizeof(jfloat)); - dest.writeRecord(); + memcpy(destMatrix, srcMatrix, matrixByteCount); + dest.writeComplete(); } } Index: org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe.cpp 28 Aug 2002 16:45:24 -0000 1.2 +++ org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe.cpp 8 Sep 2002 23:57:33 -0000 1.3 @@ -69,18 +69,19 @@ transposeDest = false; } - SrcMatrix source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); - DstMatrix dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest); + MatrixSrc source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); + MatrixDst dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest); - float * sourceRecord, * destRecord; + float * srcMatrix, * destMatrix; + int matrixByteCount = source.width*source.height*sizeof(jfloat); for (int i = 0; i < source.elements; i++) { - sourceRecord = source.nextRecord(); - destRecord = dest.nextRecord(); + srcMatrix = source.nextMatrix(); + destMatrix = dest.nextMatrix(); // just do a straight memory copy - memcpy(destRecord, sourceRecord, source.width * source.height * sizeof(jfloat)); - dest.writeRecord(); + memcpy(destMatrix, srcMatrix, matrixByteCount); + dest.writeComplete(); } } Index: org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp 7 Sep 2002 19:52:01 -0000 1.3 +++ org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp 8 Sep 2002 23:57:33 -0000 1.4 @@ -65,25 +65,25 @@ // We are under the assumption that sourceWidth == sourceHeight and the matrix // defined within is invertable - SrcMatrix source (sourceAddress, sourceStride, + MatrixSrc source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); - DstMatrix dest (destAddress, destStride, + MatrixDst dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest); dest.configureBuffer(source); - float * sourceRecord, * destRecord; + float * srcMatrix, * destMatrix; int temp_side = source.width-1; float temp_matrix [temp_side*temp_side]; for (int i = 0; i < source.elements; i++) { - sourceRecord = source.nextRecord(); - destRecord = dest.nextRecord(); + srcMatrix = source.nextMatrix(); + destMatrix = dest.nextMatrix(); // calculate the determinant - float det = determinant(sourceRecord, source.width); + float det = determinant(srcMatrix, source.width); #ifdef _DEBUG printf("Determinant: %f\n", det); @@ -108,10 +108,10 @@ for (int row = 0; row < source.height; row++) { // get the sub matrix - subMatrix(sourceRecord, source.width, temp_matrix, col, row); + subMatrix(srcMatrix, source.width, temp_matrix, col, row); // transpose the result - destRecord[col + row * source.height] + destMatrix[col + row * source.height] = (sign / det) * determinant(temp_matrix, temp_side); // swap signs @@ -119,6 +119,6 @@ } } - dest.writeRecord(); + dest.writeComplete(); } } Index: org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp 7 Sep 2002 19:52:01 -0000 1.3 +++ org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp 8 Sep 2002 23:57:33 -0000 1.4 @@ -71,23 +71,23 @@ // We are under the assumption that sourceWidth == sourceHeight and the matrix // defined within is invertable - SrcMatrix source (sourceAddress, sourceStride, + MatrixSrc source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); - DstMatrix dest (destAddress, destStride, + MatrixDst dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest); - float * sourceRecord, * destRecord; + float * srcMatrix, * destMatrix; int temp_side = source.width-1; float temp_matrix [temp_side*temp_side]; for (int i = 0; i < source.elements; i++) { - sourceRecord = source.nextRecord(); - destRecord = dest.nextRecord(); + srcMatrix = source.nextMatrix(); + destMatrix = dest.nextMatrix(); // calculate the determinant - float det = determinant(sourceRecord, source.width); + float det = determinant(srcMatrix, source.width); #ifdef _DEBUG printf("Determinant: %f\n", det); @@ -112,10 +112,10 @@ for (int row = 0; row < source.height; row++) { // get the sub matrix - subMatrix(sourceRecord, source.width, temp_matrix, col, row); + subMatrix(srcMatrix, source.width, temp_matrix, col, row); // transpose the result - destRecord[col + row * source.height] + destMatrix[col + row * source.height] = (sign / det) * determinant(temp_matrix, temp_side); // swap signs @@ -123,6 +123,6 @@ } } - dest.writeRecord(); + dest.writeComplete(); } } Index: org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp 7 Sep 2002 19:52:01 -0000 1.3 +++ org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp 8 Sep 2002 23:57:33 -0000 1.4 @@ -77,16 +77,16 @@ } - SrcMatrix left (leftSourceAddress, leftSourceStride, + MatrixSrc left (leftSourceAddress, leftSourceStride, leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource); - SrcMatrix right (rightSourceAddress, leftSourceStride, + MatrixSrc right (rightSourceAddress, leftSourceStride, rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource); - DstMatrix dest (destAddress, destStride, + MatrixDst dest (destAddress, destStride, right.width, left.height, left.elements * right.elements, transposeDest); dest.configureBuffer(left, right); - float * leftRecord, * rightRecord, * destRecord; + float * leftMatrix, * rightMatrix, * destMatrix; // check out discussions envolving ordering @@ -94,17 +94,17 @@ left.rewind(); for (int i = 0; i < left.elements; i++) { - leftRecord = left.nextRecord(); + leftMatrix = left.nextMatrix(); right.rewind(); for (int j = 0; j < right.elements; j++) { - rightRecord = right.nextRecord(); - destRecord = dest.nextRecord(); + rightMatrix = right.nextMatrix(); + destMatrix = dest.nextMatrix(); // zero the elements of the destination matrix for (int d = 0; d < dest.width * dest.height; d++) - destRecord[d] = 0; + destMatrix[d] = 0; // loop through each column of the right matrix int rightCell = 0; @@ -119,16 +119,16 @@ { for (int leftRow = 0; leftRow < left.height; leftRow++) { - destRecord[leftRow] += rightRecord[rightCell] * leftRecord[leftCell++]; + destMatrix[leftRow] += rightMatrix[rightCell] * leftMatrix[leftCell++]; } rightCell ++ ; } - //rightRecord = &rightRecord[right.height]; - destRecord = &destRecord[dest.height]; + //rightMatrix = &rightMatrix[right.height]; + destMatrix = &destMatrix[dest.height]; } - dest.writeRecord(); + dest.writeComplete(); } } } Index: org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp 7 Sep 2002 19:52:01 -0000 1.3 +++ org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp 8 Sep 2002 23:57:33 -0000 1.4 @@ -79,14 +79,14 @@ } - SrcMatrix left (leftSourceAddress, leftSourceStride, + MatrixSrc left (leftSourceAddress, leftSourceStride, leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource); - SrcMatrix right (rightSourceAddress, leftSourceStride, + MatrixSrc right (rightSourceAddress, leftSourceStride, rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource); - DstMatrix dest (destAddress, destStride, + MatrixDst dest (destAddress, destStride, right.width, left.height, left.elements * right.elements, transposeDest); - float * leftRecord, * rightRecord, * destRecord; + float * leftMatrix, * rightMatrix, * destMatrix; // check out discussions envolving ordering @@ -94,17 +94,17 @@ left.rewind(); for (int i = 0; i < left.elements; i++) { - leftRecord = left.nextRecord(); + leftMatrix = left.nextMatrix(); right.rewind(); for (int j = 0; j < right.elements; j++) { - rightRecord = right.nextRecord(); - destRecord = dest.nextRecord(); + rightMatrix = right.nextMatrix(); + destMatrix = dest.nextMatrix(); // zero the elements of the destination matrix for (int d = 0; d < dest.width * dest.height; d++) - destRecord[d] = 0; + destMatrix[d] = 0; // loop through each column of the right matrix int rightCell = 0; @@ -119,16 +119,16 @@ { for (int leftRow = 0; leftRow < left.height; leftRow++) { - destRecord[leftRow] += rightRecord[rightCell] * leftRecord[leftCell++]; + destMatrix[leftRow] += rightMatrix[rightCell] * leftMatrix[leftCell++]; } rightCell ++ ; } - //rightRecord = &rightRecord[right.height]; - destRecord = &destRecord[dest.height]; + //rightMatrix = &rightMatrix[right.height]; + destMatrix = &destMatrix[dest.height]; } - dest.writeRecord(); + dest.writeComplete(); } } Index: org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect.cpp 28 Aug 2002 16:45:24 -0000 1.2 +++ org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect.cpp 8 Sep 2002 23:57:33 -0000 1.3 @@ -62,25 +62,26 @@ jboolean transposeDest ) { - SrcMatrix source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); - DstMatrix dest (destAddress, destStride, source.width, source.height, numElements, transposeDest); + MatrixSrc source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); + MatrixDst dest (destAddress, destStride, source.width, source.height, numElements, transposeDest); dest.configureBuffer(source); - int * sourceRecord, * destRecord; + int * srcMatrix, * destMatrix; for (int i = 0; i < source.elements; i++) { - sourceRecord = (int *) source.nextRecord(); - destRecord = (int *) dest.nextRecord(); + srcMatrix = (int *) source.nextMatrix(); + destMatrix = (int *) dest.nextMatrix(); // we can cheat and use the less expensive xor // to switch the sign bit of the float // single precision format 1 - sign 8 - exponent (excess 127) 23 - mantisa - for (int j = 0; j < sourceWidth*sourceHeight; j++) - destRecord[j] = sourceRecord[j] ^ 0x80000000; + int j = source.width*source.height; + while (j--) + destMatrix[j] = srcMatrix[j] ^ 0x80000000; - dest.writeRecord(); + dest.writeComplete(); } } Index: org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe.cpp 28 Aug 2002 16:45:24 -0000 1.2 +++ org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe.cpp 8 Sep 2002 23:57:33 -0000 1.3 @@ -62,23 +62,24 @@ jboolean transposeDest ) { - SrcMatrix source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); - DstMatrix dest (destAddress, destStride, source.width, source.height, numElements, transposeDest); + MatrixSrc source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); + MatrixDst dest (destAddress, destStride, source.width, source.height, numElements, transposeDest); - int * sourceRecord, * destRecord; + int * srcMatrix, * destMatrix; for (int i = 0; i < source.elements; i++) { - sourceRecord = (int *) source.nextRecord(); - destRecord = (int *) dest.nextRecord(); + srcMatrix = (int *) source.nextMatrix(); + destMatrix = (int *) dest.nextMatrix(); // we can cheat and use the less expensive xor // to switch the sign bit of the float // single precision format 1 - sign 8 - exponent (excess 127) 23 - mantisa - for (int j = 0; j < sourceWidth*sourceHeight; j++) - destRecord[j] = sourceRecord[j] ^ 0x80000000; + int j = source.width*source.height; + while (j--) + destMatrix[j] = srcMatrix[j] ^ 0x80000000; - dest.writeRecord(); + dest.writeComplete(); } } Index: org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect.cpp 29 Aug 2002 21:40:44 -0000 1.3 +++ org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect.cpp 8 Sep 2002 23:57:33 -0000 1.4 @@ -66,31 +66,32 @@ jboolean transposeDest ) { - SrcMatrix source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); - DstMatrix dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest); + MatrixSrc source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); + MatrixDst dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest); dest.configureBuffer(source); - float * sourceRecord, * destRecord; + float * srcMatrix, * destMatrix; float magnitude, magnitude_squared; - int i, j; + int i, j, matrixFloatCount = source.width * source.height; for (i = 0; i < source.elements; i++) { - magnitude_squared = 0; - sourceRecord = source.nextRecord(); - destRecord = dest.nextRecord(); + srcMatrix = source.nextMatrix(); + destMatrix = dest.nextMatrix(); - for (j = 0 ; j < sourceWidth*sourceHeight; j++) - magnitude_squared += sourceRecord[j] * sourceRecord[j]; + j = matrixFloatCount; + while (j--) + magnitude_squared += srcMatrix[j] * srcMatrix[j]; magnitude = (float) sqrt((double) magnitude_squared); - for (j = 0; j < sourceWidth*sourceHeight; j++) - destRecord[j] = sourceRecord[j] / magnitude; + j = matrixFloatCount; + while (j--) + destMatrix[j] = srcMatrix[j] / magnitude; - dest.writeRecord(); + dest.writeComplete(); } } Index: org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe.cpp 29 Aug 2002 21:40:44 -0000 1.3 +++ org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe.cpp 8 Sep 2002 23:57:33 -0000 1.4 @@ -66,29 +66,30 @@ jboolean transposeDest ) { - SrcMatrix source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); - DstMatrix dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest); + MatrixSrc source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); + MatrixDst dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest); - float * sourceRecord, * destRecord; + float * srcMatrix, * destMatrix; float magnitude, magnitude_squared; - int i, j; + int i, j, matrixFloatCount = source.width * source.height; for (i = 0; i < source.elements; i++) { - magnitude_squared = 0; - sourceRecord = source.nextRecord(); - destRecord = dest.nextRecord(); + srcMatrix = source.nextMatrix(); + destMatrix = dest.nextMatrix(); - for (j = 0 ; j < sourceWidth*sourceHeight; j++) - magnitude_squared += sourceRecord[j] * sourceRecord[j]; + j = matrixFloatCount; + while (j--) + magnitude_squared += srcMatrix[j] * srcMatrix[j]; magnitude = (float) sqrt((double) magnitude_squared); - for (j = 0; j < sourceWidth*sourceHeight; j++) - destRecord[j] = sourceRecord[j] / magnitude; + j = matrixFloatCount; + while (j--) + destMatrix[j] = srcMatrix[j] / magnitude; - dest.writeRecord(); + dest.writeComplete(); } } Index: org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect.cpp 28 Aug 2002 16:45:24 -0000 1.2 +++ org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect.cpp 8 Sep 2002 23:57:33 -0000 1.3 @@ -75,32 +75,33 @@ transposeDest = !transposeDest; } - SrcMatrix left (leftSourceAddress, leftSourceStride, + MatrixSrc left (leftSourceAddress, leftSourceStride, leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource); - SrcMatrix right (rightSourceAddress, leftSourceStride, + MatrixSrc right (rightSourceAddress, leftSourceStride, rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource); - DstMatrix dest (destAddress, destStride, + MatrixDst dest (destAddress, destStride, left.width, left.height, left.elements * right.elements, transposeDest); dest.configureBuffer(left, right); - float * leftRecord, * rightRecord, * destRecord; + float * leftMatrix, * rightMatrix, * destMatrix; left.rewind(); for (int i = 0; i < left.elements; i++) { - leftRecord = left.nextRecord(); + leftMatrix = left.nextMatrix(); right.rewind(); for (int j = 0; j < right.elements; j++) { - rightRecord = right.nextRecord(); - destRecord = dest.nextRecord(); + rightMatrix = right.nextMatrix(); + destMatrix = dest.nextMatrix(); - for (int k = (left.width * left.height) - 1; k >= 0; k--) - destRecord[k] = leftRecord[k] - rightRecord[k]; + int k = dest.width * dest.height; + while (k--) + destMatrix[k] = leftMatrix[k] - rightMatrix[k]; - dest.writeRecord(); + dest.writeComplete(); } } } Index: org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.cpp 28 Aug 2002 16:45:24 -0000 1.2 +++ org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.cpp 8 Sep 2002 23:57:33 -0000 1.3 @@ -76,30 +76,31 @@ transposeDest = !transposeDest; } - SrcMatrix left (leftSourceAddress, leftSourceStride, + MatrixSrc left (leftSourceAddress, leftSourceStride, leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource); - SrcMatrix right (rightSourceAddress, leftSourceStride, + MatrixSrc right (rightSourceAddress, leftSourceStride, rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource); - DstMatrix dest (destAddress, destStride, + MatrixDst dest (destAddress, destStride, left.width, left.height, left.elements * right.elements, transposeDest); - float * leftRecord, * rightRecord, * destRecord; + float * leftMatrix, * rightMatrix, * destMatrix; left.rewind(); for (int i = 0; i < left.elements; i++) { - leftRecord = left.nextRecord(); + leftMatrix = left.nextMatrix(); right.rewind(); for (int j = 0; j < right.elements; j++) { - rightRecord = right.nextRecord(); - destRecord = dest.nextRecord(); + rightMatrix = right.nextMatrix(); + destMatrix = dest.nextMatrix(); - for (int k = (left.width * left.height) - 1; k >= 0; k--) - destRecord[k] = leftRecord[k] - rightRecord[k]; + int k = dest.width * dest.height; + while (k--) + destMatrix[k] = leftMatrix[k] - rightMatrix[k]; - dest.writeRecord(); + dest.writeComplete(); } } } |
From: Gregory P. <gre...@us...> - 2002-09-08 06:20:22
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory usw-pr-cvs1:/tmp/cvs-serv6403 Added Files: RenderingContext.cpp Log Message: RenderingContext - OpenGL context --- NEW FILE: RenderingContext.cpp --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/RenderingContext.cpp /* * RenderingContext.cpp * lwjgl * * Created by Gregory Pierce on Wed Sep 04 2002. * Copyright (c) 2002 __MyCompanyName__. All rights reserved. * */ #include "RenderingContext.h" RenderingContext::RenderingContext() { } RenderingContext::~RenderingContext() { } /* ** OpenGL Setup */ //GetWindowPort(win) bool RenderingContext::setupAGL( AGLDrawable pAGLDrawable ) { AGLPixelFormat fmt; GLboolean ok; GLint attrib[] = { AGL_RGBA, AGL_NONE }; /* Choose an rgb pixel format */ fmt = aglChoosePixelFormat(NULL, 0, attrib); if(fmt == NULL) { return false; } /* Create an AGL context */ aglContext = aglCreateContext(fmt, NULL); if(aglContext == NULL) { return false; } /* Attach the window to the context */ ok = aglSetDrawable(aglContext, pAGLDrawable ); if(!ok) { return false; } /* Make the context the current context */ ok = aglSetCurrentContext(aglContext); if(!ok) { return false; } /* Pixel format is no longer needed */ aglDestroyPixelFormat(fmt); return true; } void RenderingContext::destroy(void) { cleanupAGL(); // cleanup the window // DisposeWindow( windowPtr ); } /* ** OpenGL Cleanup */ void RenderingContext::cleanupAGL() { aglSetCurrentContext(NULL); aglSetDrawable(aglContext, NULL); aglDestroyContext(aglContext); } |
From: Gregory P. <gre...@us...> - 2002-09-08 06:20:06
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory usw-pr-cvs1:/tmp/cvs-serv6309 Added Files: RenderingContext.h Log Message: RenderingContext - OpenGL context --- NEW FILE: RenderingContext.h --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/RenderingContext.h /* * RenderingContext.h * lwjgl * * Created by Gregory Pierce on Wed Sep 04 2002. * Copyright (c) 2002 __MyCompanyName__. All rights reserved. * */ #pragma once #include <Carbon/Carbon.h> #include <AGL/agl.h> #include <DrawSprocket/DrawSprocket.h> class RenderingContext { AGLContext aglContext; Rect rect; WindowPtr windowPtr; public: RenderingContext(); ~RenderingContext(); void RenderingContext::cleanupAGL(void); void RenderingContext::destroy(void); bool RenderingContext::setupAGL( AGLDrawable pAGLDrawable ); }; |
From: Gregory P. <gre...@us...> - 2002-09-08 06:19:25
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory usw-pr-cvs1:/tmp/cvs-serv6167 Modified Files: org_lwjgl_Display.cpp Log Message: Updated to use RenderingContext Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_Display.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_Display.cpp 3 Sep 2002 05:53:05 -0000 1.2 +++ org_lwjgl_Display.cpp 8 Sep 2002 06:19:21 -0000 1.3 @@ -32,13 +32,12 @@ #include <Carbon/Carbon.h> #include <AGL/agl.h> #include <OpenGL/gl.h> +#include <JavaVM/jni.h> +#include "RenderingContext.h" #include "org_lwjgl_Display.h" - -AGLContext ctx; -Rect rect; -WindotPtr win; +RenderingContext * renderingContext; /* @@ -63,36 +62,37 @@ #ifdef _DEBUG printf("Creating display: size %dx%d %dhz %dbpp...\n", width, height, freq, bpp); #endif + renderingContext = new RenderingContext(); + + InitCursor(); + + + Rect rect; + SetRect( &rect, 0, 0, width, height ); + + WindowPtr windowPtr = NewCWindow( NULL, &rect, "Lightweight Java Gaming Library", true, kWindowShadowDialogProc, (WindowPtr) -1L, true, 0L ); - InitCursor(); - - SetRect( &rect, 0, 0, width, height ); - win = NewCWindow( NULL, &rect, "Lightweight Java Gaming Library", true, kWindowShadowDialogProc, (WindowPtr) -1L, true, 0L ); - - SetPortWindowPort( win ); - - if ( win==null ) - { - printf("Failed to create a window\n"); - return 1; - } - - ShowWindow( win ); + SetPortWindowPort( windowPtr ); - /* Setup the OpenGL context */ - GLint attrib[] = { AGL_RGBA, AGL_NONE }; + if ( windowPtr == NULL ) + { + printf("Failed to create a window\n"); + return 1; + } - ctx = setupAGL( attrib, (AGLDrawable) win); - if(ctx == NULL) - { - return JNI_FALSE; - } - + ShowWindow( windowPtr ); +/* + pAGLContext = setupAGL( attrib, (AGLDrawable) windowPtr); + if(ctx == NULL) + { + return 1; + } +*/ - jfieldID fid_handle = env->GetStaticFieldID(clazz, "handle", "I"); - env->SetStaticIntField(clazz, fid_handle, (jint) win); + jfieldID fid_handle = env->GetStaticFieldID(clazz, "handle", "I"); + env->SetStaticIntField(clazz, fid_handle, (jint) windowPtr ); - return JNI_TRUE; + return 0; } /* @@ -103,13 +103,10 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Display_nDestroy (JNIEnv * env, jclass clazz) { - // cleanup the AGL context - // - cleanupAGL( ctx ); - - // cleanup the window - // - DisposeWindow( win ); + // cleanup the AGL context + // + renderingContext->destroy(); + #ifdef _DEBUG printf("Destroyed display\n"); @@ -117,55 +114,4 @@ } -/* -** OpenGL Setup -*/ -static AGLContext setupAGL( GLint* attrib, AGLDrawable win) -{ - AGLPixelFormat fmt; - AGLContext ctx; - GLboolean ok; - - /* Choose an rgb pixel format */ - fmt = aglChoosePixelFormat(NULL, 0, attrib); - if(fmt == NULL) - { - return NULL; - } - - /* Create an AGL context */ - ctx = aglCreateContext(fmt, NULL); - if(ctx == NULL) - { - return NULL; - } - - /* Attach the window to the context */ - ok = aglSetDrawable(ctx, GetWindowPort(win) ); - if(!ok) - { - return NULL; - } - - /* Make the context the current context */ - ok = aglSetCurrentContext(ctx); - if(!ok) - { - return NULL; - } - - /* Pixel format is no longer needed */ - aglDestroyPixelFormat(fmt); - - return ctx; -} -/* -** OpenGL Cleanup -*/ -static void cleanupAGL(AGLContext ctx) -{ - aglSetCurrentContext(NULL); - aglSetDrawable(ctx, NULL); - aglDestroyContext(ctx); -} |
From: Tristan C. <ex...@us...> - 2002-09-07 19:52:05
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory usw-pr-cvs1:/tmp/cvs-serv4341 Modified Files: org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp MatrixOpCommon.cpp Log Message: Recent Testing: Mul and Inv work for 3x3 matrix, more testing coming check www.happypedestrian.com/lwjgl/matrixop.html for current status Index: org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp 28 Aug 2002 16:45:24 -0000 1.2 +++ org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp 7 Sep 2002 19:52:01 -0000 1.3 @@ -77,25 +77,41 @@ int temp_side = source.width-1; float temp_matrix [temp_side*temp_side]; - for (int i = 0; i < source.elements; i++) + for (int i = 0; i < source.elements; i++) { sourceRecord = source.nextRecord(); destRecord = dest.nextRecord(); - float det = determinant(sourceRecord, sourceWidth); + // calculate the determinant + float det = determinant(sourceRecord, source.width); + +#ifdef _DEBUG + printf("Determinant: %f\n", det); +#endif + float sign; - for (int c = 0; c < source.width; c++) + for (int col = 0; col < source.width; col++) { - sign = (c & 1) ? 1.0f : -1.0f; + /* + Maintain sign: + + + - + - ... + - + - + .. + + - + - .. + - + - + .. + : : : : \ + */ + + sign = (col & 1) ? -1.0f : 1.0f; - for (int r = 0; r < source.width; r++) + for (int row = 0; row < source.height; row++) { // get the sub matrix - subMatrix(sourceRecord, source.width, temp_matrix, c, r); + subMatrix(sourceRecord, source.width, temp_matrix, col, row); // transpose the result - destRecord[r + c * source.width] + destRecord[col + row * source.height] = (sign / det) * determinant(temp_matrix, temp_side); // swap signs Index: org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp 28 Aug 2002 16:45:24 -0000 1.2 +++ org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp 7 Sep 2002 19:52:01 -0000 1.3 @@ -38,12 +38,16 @@ * @author cix_foo <ci...@us...> * @version $Revision$ */ + + +#ifdef _DEBUG +#include <stdio.h> +#endif #include <windows.h> #include "org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.h" #include "MatrixOpCommon.h" - /* * Class: org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe * Method: execute @@ -82,20 +86,36 @@ sourceRecord = source.nextRecord(); destRecord = dest.nextRecord(); - float det = determinant(sourceRecord, sourceWidth); + // calculate the determinant + float det = determinant(sourceRecord, source.width); + +#ifdef _DEBUG + printf("Determinant: %f\n", det); +#endif + float sign; - for (int c = 0; c < source.width; c++) + for (int col = 0; col < source.width; col++) { - sign = (c & 1) ? 1.0f : -1.0f; + /* + Maintain sign: + + + - + - ... + - + - + .. + + - + - .. + - + - + .. + : : : : \ + */ + + sign = (col & 1) ? -1.0f : 1.0f; - for (int r = 0; r < source.width; r++) + for (int row = 0; row < source.height; row++) { // get the sub matrix - subMatrix(sourceRecord, source.width, temp_matrix, c, r); + subMatrix(sourceRecord, source.width, temp_matrix, col, row); // transpose the result - destRecord[r + c * source.width] + destRecord[col + row * source.height] = (sign / det) * determinant(temp_matrix, temp_side); // swap signs Index: org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp 28 Aug 2002 16:45:24 -0000 1.2 +++ org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp 7 Sep 2002 19:52:01 -0000 1.3 @@ -91,33 +91,45 @@ // check out discussions envolving ordering - left.rewind(); - for (int i = 0; i < leftElements; i++) + left.rewind(); + for (int i = 0; i < left.elements; i++) { leftRecord = left.nextRecord(); right.rewind(); - for (int j = 0; j < rightElements; j++) + for (int j = 0; j < right.elements; j++) { rightRecord = right.nextRecord(); destRecord = dest.nextRecord(); - memset(destRecord, 0, dest.width * dest.height * sizeof(jfloat)); + // zero the elements of the destination matrix + for (int d = 0; d < dest.width * dest.height; d++) + destRecord[d] = 0; + // loop through each column of the right matrix + int rightCell = 0; for (int rightCol = 0; rightCol < right.width; rightCol++) { - for (int leftIndex = 0; leftIndex < left.width*left.height; leftIndex++) + // [RxC] * [RxC] + // dest has same height as left + // dest has same width as right + + int leftCell = 0; + for (int leftCol = 0; leftCol < left.width; leftCol++) { - destRecord[i % dest.height] += leftRecord[i] * rightRecord[i / leftSourceHeight]; + for (int leftRow = 0; leftRow < left.height; leftRow++) + { + destRecord[leftRow] += rightRecord[rightCell] * leftRecord[leftCell++]; + } + rightCell ++ ; } - rightRecord = &rightRecord[right.height]; + //rightRecord = &rightRecord[right.height]; destRecord = &destRecord[dest.height]; } dest.writeRecord(); } - } - + } } Index: org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp 28 Aug 2002 16:45:24 -0000 1.2 +++ org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp 7 Sep 2002 19:52:01 -0000 1.3 @@ -39,6 +39,7 @@ * @version $Revision$ */ + #include <windows.h> #include "org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.h" #include "MatrixOpCommon.h" @@ -91,26 +92,39 @@ left.rewind(); - for (int i = 0; i < leftElements; i++) + for (int i = 0; i < left.elements; i++) { leftRecord = left.nextRecord(); right.rewind(); - for (int j = 0; j < rightElements; j++) + for (int j = 0; j < right.elements; j++) { rightRecord = right.nextRecord(); destRecord = dest.nextRecord(); - memset(destRecord, 0, dest.width * dest.height * sizeof(jfloat)); + // zero the elements of the destination matrix + for (int d = 0; d < dest.width * dest.height; d++) + destRecord[d] = 0; + // loop through each column of the right matrix + int rightCell = 0; for (int rightCol = 0; rightCol < right.width; rightCol++) { - for (int leftIndex = 0; leftIndex < left.width*left.height; leftIndex++) + // [RxC] * [RxC] + // dest has same height as left + // dest has same width as right + + int leftCell = 0; + for (int leftCol = 0; leftCol < left.width; leftCol++) { - destRecord[i % dest.height] += leftRecord[i] * rightRecord[i / leftSourceHeight]; + for (int leftRow = 0; leftRow < left.height; leftRow++) + { + destRecord[leftRow] += rightRecord[rightCell] * leftRecord[leftCell++]; + } + rightCell ++ ; } - rightRecord = &rightRecord[right.height]; + //rightRecord = &rightRecord[right.height]; destRecord = &destRecord[dest.height]; } Index: MatrixOpCommon.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/MatrixOpCommon.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/MatrixOpCommon.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- MatrixOpCommon.cpp 28 Aug 2002 16:45:24 -0000 1.1 +++ MatrixOpCommon.cpp 7 Sep 2002 19:52:01 -0000 1.2 @@ -288,14 +288,21 @@ void subMatrix (const float * src, int side, float * dst , int col_omit, int row_omit) { int index = 0; + int src_index = 0; for (int c = 0; c < side; c++) { - if (c == col_omit) continue; + if (c == col_omit) + { src_index += side; + continue; + } for (int r = 0; r < side; r++) { - if (r == row_omit) continue; - dst[index++] = src[r + c * side]; + if (r == row_omit) + { src_index++; + continue; + } + dst[index++] = src[src_index++]; } } } @@ -311,20 +318,21 @@ det = matrix[0] * matrix[3] - matrix[2] * matrix[1]; else { - int temp_side = side - 1; - float temp_matrix [temp_side * temp_side]; - float sign = 1; + int temp_side = side - 1; // the dimensions of the sub matrix + float temp_matrix [temp_side * temp_side]; // hold a sub matrix of this matrix + bool sign_pos = 1; // the sign is positive - for (int i = 0; i < side; i++) + for (int row = 0; row < side; row++) { - // get a sub matrix by eliminating the ith row and the 0th column - subMatrix(matrix, side, temp_matrix, 0, i); + // get a sub matrix by eliminating the 0th col and the specified row + subMatrix(matrix, side, temp_matrix, 0, row); // add to the determinant sign * [a]i0 * [M]i0 - det += sign * matrix[i] * determinant (temp_matrix, temp_side); + det += ((sign_pos) ? matrix[row] : + -matrix[row]) * determinant (temp_matrix, temp_side); // alternate the sign - sign = (sign == 1) ? -1 : 1; + sign_pos ^= 1; } } |
From: Caspian Rychlik-P. <ci...@us...> - 2002-09-06 23:58:36
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input In directory usw-pr-cvs1:/tmp/cvs-serv6385/src/java/org/lwjgl/input Modified Files: Keyboard.java Log Message: Fixed various bugs Index: Keyboard.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/input/Keyboard.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Keyboard.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Keyboard.java 28 Aug 2002 21:58:14 -0000 1.9 +++ Keyboard.java 6 Sep 2002 23:58:33 -0000 1.10 @@ -204,8 +204,8 @@ 'p', '[', ']', - '*', - '*', + 0, + 0, 'a', 's', 'd', @@ -218,7 +218,7 @@ ';', '\'', '#', - '*', + 0, '\\', 'z', 'x', @@ -230,9 +230,9 @@ ',', '.', '/', - '*', - '*', - '*', + 0, + 0, + 0, ' ' }; private static final char shiftMap[] = { @@ -250,8 +250,8 @@ ')', '_', '+', - '*', - '*', + 0, + 0, 'Q', 'W', 'E', @@ -459,7 +459,7 @@ assert readBuffer != null : "Keyboard buffering has not been enabled."; if (readBuffer.hasRemaining()) { - key = readBuffer.get(); + key = readBuffer.get() & 0xFF; state = readBuffer.get() != 0; return true; } else |
From: Brian M. <ma...@us...> - 2002-09-06 23:36:51
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory usw-pr-cvs1:/tmp/cvs-serv552 Modified Files: org_lwjgl_openal_ALC.cpp org_lwjgl_openal_CoreAL.cpp Log Message: rem: getProcAddress removed, since it serves no purpose for Java programmers Index: org_lwjgl_openal_ALC.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_openal_ALC.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_openal_ALC.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- org_lwjgl_openal_ALC.cpp 3 Sep 2002 19:24:57 -0000 1.8 +++ org_lwjgl_openal_ALC.cpp 6 Sep 2002 23:36:48 -0000 1.9 @@ -358,29 +358,6 @@ } /** - * This function retrieves the address of a specified context extension function. - * - * C Specification: - * ALvoid * alcGetProcAddress(ALCdevice *device, ALubyte *funcName); - */ -JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_getProcAddress (JNIEnv *env, jobject obj, jobject device, jstring funcName) { - /* get device address */ - jclass device_class = env->GetObjectClass(device); - jfieldID device_field = env->GetFieldID(device_class, "device", "I"); - jint deviceaddress = env->GetIntField(device, device_field); - - /* get extension */ - ALubyte* functionname = (ALubyte*) (env->GetStringUTFChars(funcName, 0)); - - jint result = (jint) alcGetProcAddress((ALCdevice*) deviceaddress, functionname); - - env->ReleaseStringUTFChars((jstring)functionname, 0); - - CHECK_ALC_ERROR - return result; -} - -/** * This function retrieves the enum value for a specified enumeration name. * * C Specification: Index: org_lwjgl_openal_CoreAL.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_openal_CoreAL.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_openal_CoreAL.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- org_lwjgl_openal_CoreAL.cpp 29 Aug 2002 01:09:22 -0000 1.4 +++ org_lwjgl_openal_CoreAL.cpp 6 Sep 2002 23:36:48 -0000 1.5 @@ -230,21 +230,6 @@ return result; } -/** - * This function returns the address of an OpenAL extension function. - * - * C Specification: - * ALvoid * alGetProcAddress(ALubyte *funcName); - */ -JNIEXPORT jint JNICALL Java_org_lwjgl_openal_CoreAL_getProcAddress (JNIEnv *env, jobject obj, jstring fname) { - ALubyte* functionname = (ALubyte*) (env->GetStringUTFChars(fname, 0)); - jint result = (jint) alGetProcAddress(functionname); - env->ReleaseStringUTFChars((jstring)functionname, 0); - - CHECK_AL_ERROR - return result; -} - /** * This function returns the enumeration value of an OpenAL enum described by a string. * |
From: Brian M. <ma...@us...> - 2002-09-06 23:36:36
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory usw-pr-cvs1:/tmp/cvs-serv490 Modified Files: org_lwjgl_openal_ALC.h org_lwjgl_openal_CoreAL.h Log Message: rem: getProcAddress removed, since it serves no purpose for Java programmers Index: org_lwjgl_openal_ALC.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_openal_ALC.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_openal_ALC.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_openal_ALC.h 3 Sep 2002 19:24:10 -0000 1.2 +++ org_lwjgl_openal_ALC.h 6 Sep 2002 23:36:34 -0000 1.3 @@ -129,14 +129,6 @@ /* * Class: org_lwjgl_openal_ALC - * Method: getProcAddress - * Signature: (Lorg/lwjgl/openal/ALCdevice;Ljava/lang/String;)I - */ -JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_getProcAddress - (JNIEnv *, jobject, jobject, jstring); - -/* - * Class: org_lwjgl_openal_ALC * Method: getEnumValue * Signature: (Lorg/lwjgl/openal/ALCdevice;Ljava/lang/String;)I */ Index: org_lwjgl_openal_CoreAL.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_openal_CoreAL.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_openal_CoreAL.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- org_lwjgl_openal_CoreAL.h 29 Aug 2002 01:09:48 -0000 1.6 +++ org_lwjgl_openal_CoreAL.h 6 Sep 2002 23:36:34 -0000 1.7 @@ -161,14 +161,6 @@ /* * Class: org_lwjgl_openal_CoreAL - * Method: getProcAddress - * Signature: (Ljava/lang/String;)I - */ -JNIEXPORT jint JNICALL Java_org_lwjgl_openal_CoreAL_getProcAddress - (JNIEnv *, jobject, jstring); - -/* - * Class: org_lwjgl_openal_CoreAL * Method: getEnumValue * Signature: (Ljava/lang/String;)I */ |
From: Brian M. <ma...@us...> - 2002-09-06 23:35:59
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal In directory usw-pr-cvs1:/tmp/cvs-serv316 Modified Files: ALC.java CoreAL.java Log Message: rem: getProcAddress removed, since it serves no purpose for Java programmers Index: ALC.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/ALC.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/ALC.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ALC.java 3 Sep 2002 18:54:40 -0000 1.4 +++ ALC.java 6 Sep 2002 23:35:54 -0000 1.5 @@ -261,15 +261,6 @@ public native boolean isExtensionPresent(ALCdevice device, String extName); /** - * Retrieves the address of a specified context extension function. - * - * @param device device to query - * @param extName name of extension to find - * @return address of function - */ - public native int getProcAddress(ALCdevice device, String extName); - - /** * retrieves the enum value for a specified enumeration name. * * @param device Device to query Index: CoreAL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/CoreAL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/CoreAL.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- CoreAL.java 29 Aug 2002 01:11:03 -0000 1.8 +++ CoreAL.java 6 Sep 2002 23:35:55 -0000 1.9 @@ -165,14 +165,6 @@ public native boolean isExtensionPresent(String fname); /** - * Returns the address of an OpenAL extension function. - * - * @param fname String containing the function name - * @return int specifying offset of extension - */ - public native int getProcAddress(String fname); - - /** * Returns the enumeration value of an OpenAL enum described by a string. * * @param ename String describing an OpenAL enum |
From: Brian M. <ma...@us...> - 2002-09-05 15:46:47
|
Update of /cvsroot/java-game-lib/LWJGL/doc/tutorial In directory usw-pr-cvs1:/tmp/cvs-serv22587 Removed Files: OpenAL_Tutoral.html Log Message: renamed OpenAL_Tutoral to openal_basics --- OpenAL_Tutoral.html DELETED --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/doc/tutorial/OpenAL_Tutoral.html |
From: Brian M. <ma...@us...> - 2002-09-05 15:46:24
|
Update of /cvsroot/java-game-lib/LWJGL/doc/tutorial In directory usw-pr-cvs1:/tmp/cvs-serv22376 Added Files: openal_basics.html Log Message: renamed OpenAL_Tutoral to openal_basics --- NEW FILE: openal_basics.html --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/doc/tutorial/openal_basics.html <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>OpenAL Tutoral</title> <meta http-equiv="content-type" content="text/html; charset=windows-1252"> <meta name="author" content="Brian Matzon"> <meta name="description" content="Basic sound using OpenAL"> </head> <body> <h1 align="center">OpenAL Tutorial<br> <font size="-1">(by Brian Matzon <<a href="mailto:br...@ma...">br...@ma...</a>>)</font><br> </h1> <b>1.0 OpenAL Basics</b><br> Before embarking on our little OpenAL adventure, some tools are needed.<br> <br> <b>1.0.1 Ingredients</b><br> Head on over to Creatives <a href="http://developer.creative.com/scripts/DC_D&H_Games-Downloads.asp?opt=2">site</a> and snag a copy of the OpenAL specification along with a copy of the Programmers reference.<br> If you haven't already done so, get a copy of the OpenAL runtime environment too (and install it).<br> <br> <b>1.1 OpenAL theory</b><br> Uhm... I'm not going to write this... In all honesty reading the specification would be a good thing before continuing - but it isn't required...<br> <br> <b>1.2 Basic setup</b><br> Lets start out by creating a skeleton class for some very basic sound. We'll start of by creating the required OpenAL objects<br> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt>import org.lwjgl.openal.AL;<br> import org.lwjgl.openal.ALC;<br> import org.lwjgl.openal.ALCcontext;<br> import org.lwjgl.openal.ALCdevice;<br> import org.lwjgl.openal.ALUT;<code></code><br> <br> public class PlayTest {<br> <br> /** OpenAL instance */<br> protected AL al;<br> <br> /** OpenAL Context instance */<br> protected ALC alc;<br> <br> /** OpenAL Util library instance */<br> protected ALUT alut;<br> <br> /** OpenAL context */<br> protected ALCcontext context;<br> <br> /** OpenAL device */<br> protected ALCdevice device; <br> <br> /**<br> * Creates an instance of PlayTest<br> */<br> public PlayTest() {<br> try {<br> </tt> <tt> al = new AL();<br> alc = new ALC();<br> alut = new ALUT();<br> <br> al.create();<br> alc.create();<br> alut.create();<br> } catch (Exception e) {<br> e.printStackTrace();<br> }</tt><tt><br> }<br> }</tt><code></code></p> We need instances of the following classes:<br> <ul> <li><tt>AL </tt>- basic source, buffer and listener interaction</li> <li><tt>ALC </tt>- context and device creatiuon</li> <li><tt>ALUT </tt>- OpenAL utility class</li> </ul> <b>1.3 OpenAL initialization</b><br> Now that we have created a basic class containing instances of the relevant OpenAL classes, lets start of by initializing OpenAL - that is create a device and a context:<br> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"> <tt> /**<br> * Initializes OpenAL<br> */<br> protected void alInitialize() { <br> //get default device<br> device = alc.openDevice(null);<br> <br> //create context (no attributes specified)<br> context = alc.createContext(device, 0);<br> <br> //make context current<br> alc.makeContextCurrent(context);<br> }</tt><code><br> </code></p> Start of by opening a device using the <tt>openDevice </tt>method. <tt>openDevice </tt>takes a <tt>String </tt>as argument, containing the name of the device to open. If no name is supplied, the default device will be used (OpenAL currently doesn't support enumeration of devices available).<br> <br> Having opened a device, create a context to that device using <tt>createContext</tt>. <tt>createContext</tt> takes two arguments: device to use and a list of attributes (see specification for list of attributes). Since we're going by default context, we just specify <tt>0</tt> for attributes.<br> <br> Finish of by making the created context current. Do this by calling <tt>makeContextCurrent</tt>, supplying just created context as argument.<br> <p><b>1.4 Buffer and Source creation</b><br> Now that we have opened a device and gotten a context, we need to create two things to actually get some sound. We need to create a buffer to hold sounddata, and a source that is to play the sounddata.<br> Lets start of by creating one source, and one buffer:</p> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> //create one IntBuffer as buffer and one as source<br> IntBuffer buffers = createIntBuffer(1);<br> IntBuffer sources = createIntBuffer(1);<br> <br> //generate buffers and sources<br> al.genBuffers(1, Sys.getDirectBufferAddress(buffers));<br> al.genSources(1, Sys.getDirectBufferAddress(sources));</tt></p> <p>There, all set for actually loading some sounddata into the buffer.<br> </p> <b>1.5 Loading sounddata and setting up a buffer</b><br> Now that we have a buffer, we need to load some sound data into this buffer. This is done using the <tt>al.bufferData</tt> method. In our example we will cheat a bit, by using the <tt>ALUT </tt>method <tt>loadWAVFile</tt> to load a wave file, and copy this into the buffer:<br> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> //load wave data<br> ALUTLoadWAVData file = alut.loadWAVFile("myfile.wav");<br> <br> //copy to buffer<br> al.bufferData(buffers.get(0), file.format, file.data, file.size, file.freq);<br> <br> //unload file again<br> alut.unloadWAV(file.format, file.data, file.size, file.freq); <br> </tt></p> Having loaded the data, we pass it to <tt>bufferData</tt>. Once the buffer has been filled with sounddata, we unload it from the system using <tt>alut.unloadWAV</tt>. Don't worry about deleting it this soon - the sounddata has been <b>copied</b> to the buffer.<br> <br> <b>1.6 Associating sources and buffers</b><br> To associate a source to a buffer we set the integer BUFFER attribute on the source, and assign it a value of the buffer to play:<br> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> //set up source input<br> al.sourcei(sources.get(0), AL.BUFFER, buffers.get(0));</tt><tt><br> </tt></p> <b>1.7 Setting source properties</b><br> Having set up the source, it is time to set some attributes on the source - there are many that can be set, but in this example we only set the looping attribute to true by doing the following:<br> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> //loop source<br> al.sourcei(sources.get(0), AL.LOOPING, AL.TRUE);</tt><tt><br> </tt></p> <b>1.8 Sound...<br> </b>There, ready to play the sound, do this using the <tt>sourcePlay </tt>method of the <tt>AL </tt>class. to stop and pause use <tt>sourcePause </tt>and <tt>sourceStop </tt>respectively, and supply the source to affect:<br> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> //play source 0<br> al.sourcePlay(sources.get(0));<br> <br> //wait 5 secs<br> try {<br> System.out.println("Waiting 5 seconds for sound to complete");<br> Thread.sleep(5000);<br> } catch (InterruptedException inte) {<br> }<br> <br> //stop source 0<br> al.sourceStop(sources.get(0));</tt></p> <b>1.9 Cleaning up<br> </b>Having had loads of fun playing a sound (!), it is now time to do some house chores. We need to clean up what we have created, this amounts to:<br> - deleting source and buffer<br> - deleting context<br> - closing devce<br> as is shown here:<b><br> </b> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> //delete buffers and sources<br> al.deleteSources(1, Sys.getDirectBufferAddress(sources));<br> al.deleteBuffers(1, Sys.getDirectBufferAddress(buffers));<br> <br> //shutdown<br> alc.makeContextCurrent(null);<br> alc.destroyContext(context);<br> alc.closeDevice(device);</tt></p> There, all set. Now you should be able to play some basic sound!<br> This tutorial is rather short, and the above examples feature no error checking. For the complete source code, look at:<br> <tt>org.lwjgl.openal.BasicTest</tt> in the repository.<br> </body> </html> |
From: Brian M. <ma...@us...> - 2002-09-05 15:43:37
|
Update of /cvsroot/java-game-lib/LWJGL/doc/tutorial In directory usw-pr-cvs1:/tmp/cvs-serv20548 Added Files: intro.html Removed Files: index.html Log Message: renamed index.html to intro.html --- NEW FILE: intro.html --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/doc/tutorial/intro.html <html> <head> <meta http-equiv="Content-Language" content="en-gb"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>Lightweight Java Game Library Tutorial Index</title> <style> <!-- .document_title { text-align: Center; font-size: 24pt; letter-spacing: 4 } .code_snippet { font-family: Courier New } --> </style> </head> <body> <p class="document_title">Lightweight Java Game Library</p> <p class="document_title">Tutorial</p> <p align="center">Written by Caspian Rychlik-Prince</p> <p align="center">Please direct comments, errata, and flames to the author at <a href="mailto:ci...@us...">ci...@us...</a></p> <p align="center">Last modified <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->23 August 2002<!--webbot bot="Timestamp" endspan i-checksum="31308" --> </p> <p> </p> <p><a name="Introduction">1.0 Introduction</a></p> <p>The Lightweight Java Game Library (LWJGL) is a solution aimed directly at professional and amateur Java programmers alike to enable commercial quality games to be written in Java. This tutorial is nonetheless aimed at <i>experienced </i>programmers and won't be explaining some obvious techniques. Currently the LWJGL supports only the Win32 platform, and JDK1.4. </p> <p>LWJGL is not meant to make writing games particularly <i>easy;</i> it is primarily an <i>enabling technology </i>which allows developers to get at resources that are simply otherwise unavailable or poorly implemented on the existing Java platform. We anticipate that the LWJGL will, through evolution and extension, become the foundation for more complete game libraries and "game engines" as they have popularly become known, and hide some of the new evils we have had to expose in the APIs.</p> <p>2.0 Contents</p> <p> </p> <p>3.0 Aims & Design</p> <p>Because the LWJGL API is not meant to be a fully featured game engine it has been ruthlessly pruned of all non-essential code. Its ultimate philosophy is that it provides the <i>bare minimum</i> of API functionality which will let a game programmer produce games in Java without having to write native code in order to get <i>performance </i>or <i>access some hardware feature not exposed by Java 2</i>. We settled on using two other open technologies as our major foundations, namely OpenGL and OpenAL for graphics and sound respectively.</p> <p>A sub-requirement of the LWJGL is that it be freed Java programmers from the requirement to ship a whole JRE with their games. Currently the Sun licensing terms dictate that J2SE be shipped in its entirety, even for the tiniest of demos. As this could easily triple the size of a demo and discourage end users with configuration issues we have made it a primary concern that games written using LWJGL can be compiled into completely standalone native binary executables by compilers such as GNU's GCJ and Excelsior's JET. We have done this by implementing the library in such a way that <i>no dependencies </i>on Sun's proprietry JRE binaries are present in the library.</p> <p>The final aim of LWJGL is to make the library available for Win32 systems above all others, for that is what most commercial programmers need.</p> <p>Linuxians and Macophiles do not despair! There's nothing inherently non-portable about the LWJGL - we just don't have the time and expertise to do it yet. But it will happen.</p> <p>3.1 General API</p> <p>The general API gives us the foundations of game programming: we have a Display class, for initialising the display and querying its available modes; we have a Math class to provide us with some floating point maths functions (rather than the double-precision ones provided by Java), and matrix batch operations; and a Sys class, which gives us our <i>most useful gaming functions:</i> the ability to get the address of a direct byte buffer so we can cache it on the Java side of the JNI barrier, and hence access all those lovely hardware calls we need for performance; and the ability to use the system's <i>hires timer</i>, which is so critical for animation timing. In addition we can also create a direct byte buffer at <i>any address in memory.</i></p> <p>The Evil Of Pointers And What It Means For Security</p> <p>Yes, we have exposed <i>pointers</i> to Java programmers. Yes, you can write to just about any bit of memory you so please, and cause untold havoc. You can break things. You can bypass security constraints and exploit the dreaded <i>buffer vuln.</i></p> <p>But <i>why?</i> Because without pointers, all those nice easy native API calls would suddenly become complex and behave slightly differently to their C counterparts, and require us to pass direct ByteBuffers to JNI for every call. This requires that every single call which takes a pointer calls the JNI method GetDirectBufferAddress every time, which is an unnecessary overhead.</p> <p>The implications for security are simple and final: your game can <b>no longer be considered secure</b> and part of the Java security model. This puts it in exactly the same boat as any other application on the user's system. This also means you will not be able to use it in applets or with Webstart without getting your code signed and trusted. LWJGL itself will not be signed nor trusted; you are expected to deliver it bundled in with every application you ship and verify that your entire distribution is safe.</p> <p>We feel that our target developer, the commercial game developer, should not be concerned with this issue as the status quo is merely maintained from the old ways of programming with any other language; and used wisely, your exposure to pointers is unlikely to cause you any problems.</p> <p>If you are concerned about security, or wish to write games which will run as applets or from Webstart, or would rather have a full game library which takes care of things for you, you don't want to use LWJGL at all - it's that simple! What you need is Sun's Java Gaming Profile, or Java3D. If you feel a need to argue, you're using LWJGL for the wrong reasons.</p> <p>3.2 Graphics</p> <p>Graphics is based on the latest OpenGL1.4, and all the extensions we could implement that might be vaguely useful for games programmers. These include <i>all</i> of Nvidia's and ATI's proprietry extensions, and <i>all</i> the ARB extensions, and most of the EXT extensions, as well as numerous other miscellaneous ones.</p> <p>For Windows programmers, our primary target, the WGL extensions are present.</p> <p>All OpenGL functions that take pointers are passed ints. These pointers can be obtained from direct ByteBuffers using the Sys.getDirectBufferAddress() method. There are a very few native methods that return pointers as ints as well. Be sure to read the caveat about using pointers in Java!</p> <p>3.3 Sounds</p> <p>Sound is based on the latest OpenAL1.0 specification, which comes with but one extension, EAX, for interesting environmental effects. The LWJGL binary distribution includes the OpenAL .dlls for Win32.</p> <p>3.4 Input</p> <p>Input can be a complicated topic. A user can have all sorts of strange fancy force-feedback hardware installed on their systems, with scrolly knobs and twistgrips and bristling with many buttons. However, the vast majority of gamers have just a keyboard and a mouse; some of them have analogue joysticks too, and some of them have a gamepad attached from some console or other. For our first cut of the input library we've just kept it all rather simple, and decided that there is but one of each of these devices, and that force feedback and multiple potentiometers is a feature we may add another time.</p> <p>So in the interests of keeping things simple, the four input classes - Keyboard, Mouse, Gamepad and Joystick - are all static, and can all be polled once per game loop iteration to determine where they've moved since you last looked and what buttons are down at the time. The Gamepad and Keyboard may additionally support <i>buffering</i> which is a more reliable way of detecting rapid changes of state which may occur rather more quickly than your framerate.</p> <p>3.5 Maths</p> <p>Java's maths performance leaves much to be desired, particularly with respect to bulk operations for 3D rendering engines. The main problem is that the existing maths libraries use double precision when single precision is entirely adequate for most realtime games programming; and that no clever processor-specific optimisations can be done because the Hotspot compiler is simply not supplied enough semantic context to understand that it could use some special SIMD instruction to achieve the effect you desire in a fraction of the cycles. Furthermore, all maths in Java is done in Java - and once you've computed the results you usually have to subsequently copy them into a buffer to pass to a native rendering method in OpenGL anyway.</p> <p>The Math class provides two <i>totally generic</i> vector operators for unary and binary vector operations performed on direct ByteBuffers containing packed floating point vectors. The idea is to set up the source(s) of the operations and then perform a single call to JNI to perform a <i>highly optimised operation</i> on the whole lot in one go. The JNI code is specially optimised for the common cases in 3d games programming to use processor-specific instructions and take advantage, where feasible, of memory caching architecture. And the end result is placed directly back in memory, ready to simply send as a pointer direct to OpenGL or some other API.</p> <p>In addition we provide implementations of common Vector and Matrix sizes similar to those provided by the javax.vecmath package, but ours are <i>open source</i> and available without downloading the whole of Java3D.</p> <p> </p> </body> </html> --- index.html DELETED --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/doc/tutorial/index.html |
From: Brian M. <ma...@us...> - 2002-09-04 15:27:31
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test In directory usw-pr-cvs1:/tmp/cvs-serv19540/org/lwjgl/openal/test Modified Files: ALTest.java Log Message: rem: removed some debug Index: ALTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/ALTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/ALTest.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ALTest.java 3 Sep 2002 18:08:52 -0000 1.11 +++ ALTest.java 4 Sep 2002 15:27:24 -0000 1.12 @@ -1177,9 +1177,6 @@ for (i = -100; i < 100; i++) { al.listener3f(AL.POSITION, (float) -i, 0.0f, 0.0f); delay_ms(100); - - al.getListenerfv(AL.POSITION, Sys.getDirectBufferAddress(tempFVect)); - System.out.print("Position: " + tempFVect.get(0) + ", " + tempFVect.get(1) + ", " + tempFVect.get(2) + "\n"); } al.listener3f(AL.POSITION, 0.0f, 0.0f, 0.0f); al.sourceStop(testSources.get(0)); |
From: Brian M. <ma...@us...> - 2002-09-03 21:25:07
|
Update of /cvsroot/java-game-lib/LWJGL/doc/tutorial In directory usw-pr-cvs1:/tmp/cvs-serv30248 Added Files: OpenAL_Tutoral.html Log Message: initial import of tutorial --- NEW FILE: OpenAL_Tutoral.html --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/doc/tutorial/OpenAL_Tutoral.html <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>OpenAL Tutoral</title> <meta http-equiv="content-type" content="text/html; charset=windows-1252"> <meta name="author" content="Brian Matzon"> <meta name="description" content="Basic sound using OpenAL"> </head> <body> <h1 align="center">OpenAL Tutorial<br> <font size="-1">(by Brian Matzon <<a href="mailto:br...@ma...">br...@ma...</a>>)</font><br> </h1> <b>1.0 OpenAL Basics</b><br> Before embarking on our little OpenAL adventure, some tools are needed.<br> <br> <b>1.0.1 Ingredients</b><br> Head on over to Creatives <a href="http://developer.creative.com/scripts/DC_D&H_Games-Downloads.asp?opt=2">site</a> and snag a copy of the OpenAL specification along with a copy of the Programmers reference.<br> If you haven't already done so, get a copy of the OpenAL runtime environment too (and install it).<br> <br> <b>1.1 OpenAL theory</b><br> Uhm... I'm not going to write this... In all honesty reading the specification would be a good thing before continuing - but it isn't required...<br> <br> <b>1.2 Basic setup</b><br> Lets start out by creating a skeleton class for some very basic sound. We'll start of by creating the required OpenAL objects<br> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt>import org.lwjgl.openal.AL;<br> import org.lwjgl.openal.ALC;<br> import org.lwjgl.openal.ALCcontext;<br> import org.lwjgl.openal.ALCdevice;<br> import org.lwjgl.openal.ALUT;<code></code><br> <br> public class PlayTest {<br> <br> /** OpenAL instance */<br> protected AL al;<br> <br> /** OpenAL Context instance */<br> protected ALC alc;<br> <br> /** OpenAL Util library instance */<br> protected ALUT alut;<br> <br> /** OpenAL context */<br> protected ALCcontext context;<br> <br> /** OpenAL device */<br> protected ALCdevice device; <br> <br> /**<br> * Creates an instance of PlayTest<br> */<br> public PlayTest() {<br> try {<br> </tt> <tt> al = new AL();<br> alc = new ALC();<br> alut = new ALUT();<br> <br> al.create();<br> alc.create();<br> alut.create();<br> } catch (Exception e) {<br> e.printStackTrace();<br> }</tt><tt><br> }<br> }</tt><code></code></p> We need instances of the following classes:<br> <ul> <li><tt>AL </tt>- basic source, buffer and listener interaction</li> <li><tt>ALC </tt>- context and device creatiuon</li> <li><tt>ALUT </tt>- OpenAL utility class</li> </ul> <b>1.3 OpenAL initialization</b><br> Now that we have created a basic class containing instances of the relevant OpenAL classes, lets start of by initializing OpenAL - that is create a device and a context:<br> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"> <tt> /**<br> * Initializes OpenAL<br> */<br> protected void alInitialize() { <br> //get default device<br> device = alc.openDevice(null);<br> <br> //create context (no attributes specified)<br> context = alc.createContext(device, 0);<br> <br> //make context current<br> alc.makeContextCurrent(context);<br> }</tt><code><br> </code></p> Start of by opening a device using the <tt>openDevice </tt>method. <tt>openDevice </tt>takes a <tt>String </tt>as argument, containing the name of the device to open. If no name is supplied, the default device will be used (OpenAL currently doesn't support enumeration of devices available).<br> <br> Having opened a device, create a context to that device using <tt>createContext</tt>. <tt>createContext</tt> takes two arguments: device to use and a list of attributes (see specification for list of attributes). Since we're going by default context, we just specify <tt>0</tt> for attributes.<br> <br> Finish of by making the created context current. Do this by calling <tt>makeContextCurrent</tt>, supplying just created context as argument.<br> <p><b>1.4 Buffer and Source creation</b><br> Now that we have opened a device and gotten a context, we need to create two things to actually get some sound. We need to create a buffer to hold sounddata, and a source that is to play the sounddata.<br> Lets start of by creating one source, and one buffer:</p> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> //create one IntBuffer as buffer and one as source<br> IntBuffer buffers = createIntBuffer(1);<br> IntBuffer sources = createIntBuffer(1);<br> <br> //generate buffers and sources<br> al.genBuffers(1, Sys.getDirectBufferAddress(buffers));<br> al.genSources(1, Sys.getDirectBufferAddress(sources));</tt></p> <p>There, all set for actually loading some sounddata into the buffer.<br> </p> <b>1.5 Loading sounddata and setting up a buffer</b><br> Now that we have a buffer, we need to load some sound data into this buffer. This is done using the <tt>al.bufferData</tt> method. In our example we will cheat a bit, by using the <tt>ALUT </tt>method <tt>loadWAVFile</tt> to load a wave file, and copy this into the buffer:<br> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> //load wave data<br> ALUTLoadWAVData file = alut.loadWAVFile("myfile.wav");<br> <br> //copy to buffer<br> al.bufferData(buffers.get(0), file.format, file.data, file.size, file.freq);<br> <br> //unload file again<br> alut.unloadWAV(file.format, file.data, file.size, file.freq); <br> </tt></p> Having loaded the data, we pass it to <tt>bufferData</tt>. Once the buffer has been filled with sounddata, we unload it from the system using <tt>alut.unloadWAV</tt>. Don't worry about deleting it this soon - the sounddata has been <b>copied</b> to the buffer.<br> <br> <b>1.6 Associating sources and buffers</b><br> To associate a source to a buffer we set the integer BUFFER attribute on the source, and assign it a value of the buffer to play:<br> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> //set up source input<br> al.sourcei(sources.get(0), AL.BUFFER, buffers.get(0));</tt><tt><br> </tt></p> <b>1.7 Setting source properties</b><br> Having set up the source, it is time to set some attributes on the source - there are many that can be set, but in this example we only set the looping attribute to true by doing the following:<br> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> //loop source<br> al.sourcei(sources.get(0), AL.LOOPING, AL.TRUE);</tt><tt><br> </tt></p> <b>1.8 Sound...<br> </b>There, ready to play the sound, do this using the <tt>sourcePlay </tt>method of the <tt>AL </tt>class. to stop and pause use <tt>sourcePause </tt>and <tt>sourceStop </tt>respectively, and supply the source to affect:<br> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> //play source 0<br> al.sourcePlay(sources.get(0));<br> <br> //wait 5 secs<br> try {<br> System.out.println("Waiting 5 seconds for sound to complete");<br> Thread.sleep(5000);<br> } catch (InterruptedException inte) {<br> }<br> <br> //stop source 0<br> al.sourceStop(sources.get(0));</tt></p> <b>1.9 Cleaning up<br> </b>Having had loads of fun playing a sound (!), it is now time to do some house chores. We need to clean up what we have created, this amounts to:<br> - deleting source and buffer<br> - deleting context<br> - closing devce<br> as is shown here:<b><br> </b> <p style="border-style: solid; border-width: 1px; padding: 3px; background-color: rgb(255,255,204);"><tt> //delete buffers and sources<br> al.deleteSources(1, Sys.getDirectBufferAddress(sources));<br> al.deleteBuffers(1, Sys.getDirectBufferAddress(buffers));<br> <br> //shutdown<br> alc.makeContextCurrent(null);<br> alc.destroyContext(context);<br> alc.closeDevice(device);</tt></p> There, all set. Now you should be able to play some basic sound!<br> This tutorial is rather short, and the above examples feature no error checking. For the complete source code, look at:<br> <tt>org.lwjgl.openal.BasicTest</tt> in the repository.<br> </body> </html> |