static implementation - work in progress
This commit is contained in:
parent
315375dee5
commit
4c4d56e583
|
@ -31,8 +31,6 @@
|
|||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
import org.lwjgl.Sys;
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
|
@ -44,106 +42,90 @@ import org.lwjgl.Sys;
|
|||
public class AL extends CoreAL {
|
||||
|
||||
/** ALC instance. */
|
||||
protected ALC alc;
|
||||
protected static ALC alc;
|
||||
|
||||
/** ALCdevice instance. */
|
||||
protected ALCdevice device;
|
||||
protected static ALCdevice device;
|
||||
|
||||
/** Current ALCcontext. */
|
||||
protected ALCcontext context;
|
||||
protected static ALCcontext context;
|
||||
|
||||
/**
|
||||
* String that requests a certain device or device configuration.
|
||||
* If null is specified, the implementation will provide an
|
||||
* implementation specific default. */
|
||||
protected String deviceArguments;
|
||||
protected static String deviceArguments;
|
||||
|
||||
/** Frequency for mixing output buffer, in units of Hz. */
|
||||
protected int contextFrequency = -1;
|
||||
protected static int contextFrequency = -1;
|
||||
|
||||
/** Refresh intervalls, in units of Hz. */
|
||||
protected int contextRefresh = -1;
|
||||
protected static int contextRefresh = -1;
|
||||
|
||||
/** Flag, indicating a synchronous context. */
|
||||
protected int contextSynchronized = ALC.FALSE;
|
||||
protected static int contextSynchronized = ALC.ALC_FALSE;
|
||||
|
||||
/**
|
||||
* Creates an OpenAL instance. The empty constructor will cause OpenAL to
|
||||
* open the default device, and create a context using default values.
|
||||
*/
|
||||
public AL() {
|
||||
}
|
||||
/**
|
||||
* Creates an OpenAL instance. Using this constructor will cause OpenAL to
|
||||
* open the device using supplied device argument, and create a context using the context values
|
||||
* supplied.
|
||||
*
|
||||
* @param deviceArguments Arguments supplied to native device
|
||||
* @param contextFrequency Frequency for mixing output buffer, in units of Hz (Common values include 11025, 22050, and 44100).
|
||||
* @param contextRefresh Refresh intervalls, in units of Hz.
|
||||
* @param contextSynchronized Flag, indicating a synchronous context.*
|
||||
*/
|
||||
public static void create(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized) throws OpenALException {
|
||||
AL.deviceArguments = deviceArguments;
|
||||
AL.contextFrequency = contextFrequency;
|
||||
AL.contextRefresh = contextRefresh;
|
||||
AL.contextSynchronized = contextSynchronized ? ALC.ALC_TRUE : ALC.ALC_FALSE;
|
||||
|
||||
create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an OpenAL instance. Using this constructor will cause OpenAL to
|
||||
* open the device using supplied device argument, and create a context using the context values
|
||||
* supplied.
|
||||
*
|
||||
* @param deviceArguments Arguments supplied to native device
|
||||
* @param contextFrequency Frequency for mixing output buffer, in units of Hz (Common values include 11025, 22050, and 44100).
|
||||
* @param contextRefresh Refresh intervalls, in units of Hz.
|
||||
* @param contextSynchronized Flag, indicating a synchronous context.*
|
||||
*/
|
||||
public AL(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized) {
|
||||
this.deviceArguments = deviceArguments;
|
||||
this.contextFrequency = contextFrequency;
|
||||
this.contextRefresh = contextRefresh;
|
||||
this.contextSynchronized = contextSynchronized ? ALC.TRUE : ALC.FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.lwjgl.openal.BaseAL#create()
|
||||
*/
|
||||
public void create() throws OpenALException {
|
||||
super.create();
|
||||
/**
|
||||
* Creates an OpenAL instance. The empty create will cause OpenAL to
|
||||
* open the default device, and create a context using default values.
|
||||
*/
|
||||
public static void create() throws OpenALException {
|
||||
BaseAL.create();
|
||||
|
||||
ALC.create();
|
||||
|
||||
alc = new ALC(this);
|
||||
alc.create();
|
||||
|
||||
device = alc.openDevice(deviceArguments);
|
||||
device = ALC.alcOpenDevice(deviceArguments);
|
||||
|
||||
//check if doing default values or not
|
||||
if (contextFrequency == -1) {
|
||||
context = alc.createContext(device.device, 0);
|
||||
context = ALC.alcCreateContext(device.device, null);
|
||||
} else {
|
||||
context =
|
||||
alc.createContext(
|
||||
ALC.alcCreateContext(
|
||||
device.device,
|
||||
Sys.getDirectBufferAddress(
|
||||
ALCcontext.createAttributeList(contextFrequency, contextRefresh, contextSynchronized)));
|
||||
ALCcontext.createAttributeList(contextFrequency, contextRefresh, contextSynchronized));
|
||||
}
|
||||
|
||||
alc.makeContextCurrent(context.context);
|
||||
ALC.alcMakeContextCurrent(context.context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exit cleanly by calling destroy.
|
||||
*/
|
||||
public void destroy() {
|
||||
alc.destroyContext(context.context);
|
||||
alc.closeDevice(device.device);
|
||||
alc.destroy();
|
||||
public static void destroy() {
|
||||
ALC.alcDestroyContext(context.context);
|
||||
ALC.alcCloseDevice(device.device);
|
||||
ALC.destroy();
|
||||
|
||||
alc = null;
|
||||
device = null;
|
||||
context = null;
|
||||
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Emergency finalizer!
|
||||
*/
|
||||
protected void finalize() throws Throwable {
|
||||
super.finalize();
|
||||
|
||||
destroy();
|
||||
}
|
||||
deviceArguments = null;
|
||||
|
||||
/**
|
||||
* Retrieves the AL Context class
|
||||
*/
|
||||
public final ALC getALC() {
|
||||
return alc;
|
||||
contextFrequency = -1;
|
||||
contextRefresh = -1;
|
||||
contextSynchronized = ALC.ALC_FALSE;
|
||||
|
||||
BaseAL.destroy();
|
||||
}
|
||||
}
|
|
@ -31,6 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
import java.nio.Buffer;
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
|
@ -44,72 +46,68 @@ public class ALC {
|
|||
/** Has the ALC object been created? */
|
||||
protected static boolean created;
|
||||
|
||||
/** Parent AL instance */
|
||||
protected AL al = null;
|
||||
|
||||
/** Bad value */
|
||||
public static final int INVALID = -1;
|
||||
public static final int ALC_INVALID = -1;
|
||||
|
||||
/** Boolean False */
|
||||
public static final int FALSE = 0;
|
||||
public static final int ALC_FALSE = 0;
|
||||
|
||||
/** Boolean True */
|
||||
public static final int TRUE = 1;
|
||||
public static final int ALC_TRUE = 1;
|
||||
|
||||
/** Errors: No Error */
|
||||
public static final int NO_ERROR = FALSE;
|
||||
public static final int ALC_NO_ERROR = ALC_FALSE;
|
||||
|
||||
public static final int MAJOR_VERSION = 0x1000;
|
||||
public static final int MINOR_VERSION = 0x1001;
|
||||
public static final int ATTRIBUTES_SIZE = 0x1002;
|
||||
public static final int ALL_ATTRIBUTES = 0x1003;
|
||||
public static final int ALC_MAJOR_VERSION = 0x1000;
|
||||
public static final int ALC_MINOR_VERSION = 0x1001;
|
||||
public static final int ALC_ATTRIBUTES_SIZE = 0x1002;
|
||||
public static final int ALC_ALL_ATTRIBUTES = 0x1003;
|
||||
|
||||
public static final int DEFAULT_DEVICE_SPECIFIER = 0x1004;
|
||||
public static final int DEVICE_SPECIFIER = 0x1005;
|
||||
public static final int EXTENSIONS = 0x1006;
|
||||
public static final int ALC_DEFAULT_DEVICE_SPECIFIER = 0x1004;
|
||||
public static final int ALC_DEVICE_SPECIFIER = 0x1005;
|
||||
public static final int ALC_EXTENSIONS = 0x1006;
|
||||
|
||||
public static final int FREQUENCY = 0x1007;
|
||||
public static final int REFRESH = 0x1008;
|
||||
public static final int SYNC = 0x1009;
|
||||
public static final int ALC_FREQUENCY = 0x1007;
|
||||
public static final int ALC_REFRESH = 0x1008;
|
||||
public static final int ALC_SYNC = 0x1009;
|
||||
|
||||
/** The device argument does not name a valid device */
|
||||
public static final int INVALID_DEVICE = 0xA001;
|
||||
public static final int ALC_INVALID_DEVICE = 0xA001;
|
||||
|
||||
/** The context argument does not name a valid context */
|
||||
public static final int INVALID_CONTEXT = 0xA002;
|
||||
public static final int ALC_INVALID_CONTEXT = 0xA002;
|
||||
|
||||
/**
|
||||
* A function was called at inappropriate time, or in an inappropriate way,
|
||||
* causing an illegal state. This can be an incompatible ALenum, object ID,
|
||||
* and/or function.
|
||||
*/
|
||||
public static final int INVALID_ENUM = 0xA003;
|
||||
public static final int ALC_INVALID_ENUM = 0xA003;
|
||||
|
||||
/**
|
||||
* Illegal value passed as an argument to an AL call.
|
||||
* Applies to parameter values, but not to enumerations.
|
||||
*/
|
||||
public static final int INVALID_VALUE = 0xA004;
|
||||
public static final int ALC_INVALID_VALUE = 0xA004;
|
||||
|
||||
/**
|
||||
* A function could not be completed, because there is not enough
|
||||
* memory available.
|
||||
*/
|
||||
public static final int OUT_OF_MEMORY = 0xA005;
|
||||
public static final int ALC_OUT_OF_MEMORY = 0xA005;
|
||||
|
||||
static {
|
||||
initialize();
|
||||
}
|
||||
|
||||
/** Creates a new instance of ALC */
|
||||
protected ALC(AL al) {
|
||||
this.al = al;
|
||||
protected ALC() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to provide any initialization code after creation.
|
||||
*/
|
||||
protected void init() {
|
||||
protected static void init() {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,7 +122,7 @@ public class ALC {
|
|||
*
|
||||
* @throws Exception if a failiure occured in the ALC creation process
|
||||
*/
|
||||
protected void create() throws OpenALException {
|
||||
protected static void create() throws OpenALException {
|
||||
if (created) {
|
||||
return;
|
||||
}
|
||||
|
@ -141,12 +139,12 @@ public class ALC {
|
|||
*
|
||||
* @return true if the ALC creation process succeeded
|
||||
*/
|
||||
protected native boolean nCreate();
|
||||
protected static native boolean nCreate();
|
||||
|
||||
/**
|
||||
* Calls whatever destruction rutines that are needed
|
||||
*/
|
||||
protected void destroy() {
|
||||
protected static void destroy() {
|
||||
if (!created) {
|
||||
return;
|
||||
}
|
||||
|
@ -157,7 +155,7 @@ public class ALC {
|
|||
/**
|
||||
* Native method the destroy the ALC
|
||||
*/
|
||||
protected native void nDestroy();
|
||||
protected static native void nDestroy();
|
||||
|
||||
/**
|
||||
* Returns strings related to the context.
|
||||
|
@ -165,24 +163,24 @@ public class ALC {
|
|||
* @param pname Property to get
|
||||
* @return String property from device
|
||||
*/
|
||||
public String getString(int pname) {
|
||||
return nGetString(al.device.device, pname);
|
||||
public static String alcGetString(int pname) {
|
||||
return nGetString(AL.device.device, pname);
|
||||
}
|
||||
|
||||
native String nGetString(int device, int pname);
|
||||
native static String nGetString(int device, int pname);
|
||||
|
||||
/**
|
||||
* Returns integers related to the context.
|
||||
*
|
||||
* @param pname Property to get
|
||||
* @param size Size of destination buffer provided
|
||||
* @param integerdata address of ByteBuffer to write integers to
|
||||
* @param integerdata ByteBuffer to write integers to
|
||||
*/
|
||||
public void getIntegerv(int pname, int size, int integerdata) {
|
||||
nGetIntegerv(al.device.device, pname, size, integerdata);
|
||||
public static void alcGetIntegerv(int pname, int size, Buffer integerdata) {
|
||||
nGetIntegerv(AL.device.device, pname, size, integerdata);
|
||||
}
|
||||
|
||||
native void nGetIntegerv(int device, int pname, int size, int integerdata);
|
||||
native static void nGetIntegerv(int device, int pname, int size, Buffer integerdata);
|
||||
|
||||
/**
|
||||
* Opens the named device. If null is specied, the implementation will
|
||||
|
@ -191,23 +189,23 @@ public class ALC {
|
|||
* @param devicename name of device to open
|
||||
* @return opened device, or null
|
||||
*/
|
||||
native ALCdevice openDevice(String devicename);
|
||||
native static ALCdevice alcOpenDevice(String devicename);
|
||||
|
||||
/**
|
||||
* Closes the supplied device.
|
||||
*
|
||||
* @param device address of native device to close
|
||||
*/
|
||||
native void closeDevice(int device);
|
||||
native static void alcCloseDevice(int device);
|
||||
|
||||
/**
|
||||
* Creates a context using a specified device.
|
||||
*
|
||||
* @param device address of device to associate context to
|
||||
* @param attrList address of ByteBuffer to read attributes from
|
||||
* @param attrList Buffer to read attributes from
|
||||
* @return New context, or null if creation failed
|
||||
*/
|
||||
native ALCcontext createContext(int device, int attrList);
|
||||
native static ALCcontext alcCreateContext(int device, Buffer attrList);
|
||||
|
||||
/**
|
||||
* Makes the supplied context the current one
|
||||
|
@ -215,23 +213,23 @@ public class ALC {
|
|||
* @param context address of context to make current
|
||||
* @return true if successfull, false if not
|
||||
*/
|
||||
native boolean makeContextCurrent(int context);
|
||||
native static boolean alcMakeContextCurrent(int context);
|
||||
|
||||
/**
|
||||
* Tells a context to begin processing.
|
||||
*/
|
||||
public void processContext() {
|
||||
nProcessContext(al.context.context);
|
||||
public static void alcProcessContext() {
|
||||
nProcessContext(AL.context.context);
|
||||
}
|
||||
|
||||
native void nProcessContext(int context);
|
||||
native static void nProcessContext(int context);
|
||||
|
||||
/**
|
||||
* Gets the current context
|
||||
*
|
||||
* @return Current ALCcontext
|
||||
*/
|
||||
native ALCcontext getCurrentContext();
|
||||
native static ALCcontext alcGetCurrentContext();
|
||||
|
||||
/**
|
||||
* Retrives the device associated with the supplied context
|
||||
|
@ -239,32 +237,32 @@ public class ALC {
|
|||
* @param context address of context to get device for
|
||||
* @param ALCdevice associated with context
|
||||
*/
|
||||
native ALCdevice getContextsDevice(int context);
|
||||
native static ALCdevice alcGetContextsDevice(int context);
|
||||
|
||||
/**
|
||||
* Suspends processing on supplied context
|
||||
*
|
||||
* @param context address of context to suspend
|
||||
*/
|
||||
native void suspendContext(int context);
|
||||
native static void alcSuspendContext(int context);
|
||||
|
||||
/**
|
||||
* Destroys supplied context
|
||||
*
|
||||
* @param context address of context to Destroy
|
||||
*/
|
||||
native void destroyContext(int context);
|
||||
native static void alcDestroyContext(int context);
|
||||
|
||||
/**
|
||||
* Retrieves the current context error state.
|
||||
*
|
||||
* @return Errorcode from ALC statemachine
|
||||
*/
|
||||
public int getError() {
|
||||
return nGetError(al.device.device);
|
||||
public static int alcGetError() {
|
||||
return nGetError(AL.device.device);
|
||||
}
|
||||
|
||||
native int nGetError(int device);
|
||||
native static int nGetError(int device);
|
||||
|
||||
/**
|
||||
* Query if a specified context extension is available.
|
||||
|
@ -272,11 +270,11 @@ public class ALC {
|
|||
* @param extName name of extension to find
|
||||
* @return true if extension is available, false if not
|
||||
*/
|
||||
public boolean isExtensionPresent(String extName) {
|
||||
return nIsExtensionPresent(al.device.device, extName);
|
||||
public static boolean alcIsExtensionPresent(String extName) {
|
||||
return nIsExtensionPresent(AL.device.device, extName);
|
||||
}
|
||||
|
||||
native boolean nIsExtensionPresent(int device, String extName);
|
||||
native static boolean nIsExtensionPresent(int device, String extName);
|
||||
|
||||
/**
|
||||
* retrieves the enum value for a specified enumeration name.
|
||||
|
@ -284,9 +282,9 @@ public class ALC {
|
|||
* @param enumName name of enum to find
|
||||
* @return value of enumeration
|
||||
*/
|
||||
public int getEnumValue(String enumName) {
|
||||
return nGetEnumValue(al.device.device, enumName);
|
||||
public static int alcGetEnumValue(String enumName) {
|
||||
return nGetEnumValue(AL.device.device, enumName);
|
||||
}
|
||||
|
||||
native int nGetEnumValue(int device, String enumName);
|
||||
native static int nGetEnumValue(int device, String enumName);
|
||||
}
|
|
@ -31,6 +31,7 @@
|
|||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
|
@ -42,28 +43,28 @@ import java.nio.ByteOrder;
|
|||
* @author Brian Matzon <brian@matzon.dk>
|
||||
* @version $Revision$
|
||||
*/
|
||||
class ALCcontext {
|
||||
final class ALCcontext {
|
||||
|
||||
/** address of actual context */
|
||||
public final int context;
|
||||
final int context;
|
||||
|
||||
/**
|
||||
* Creates a new instance of ALCcontext
|
||||
*
|
||||
* @param context address of actual context
|
||||
*/
|
||||
public ALCcontext(int context) {
|
||||
ALCcontext(int context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public static ByteBuffer createAttributeList(int contextFrequency, int contextRefresh, int contextSynchronized) {
|
||||
static Buffer createAttributeList(int contextFrequency, int contextRefresh, int contextSynchronized) {
|
||||
ByteBuffer attribList = ByteBuffer.allocateDirect(7*4).order(ByteOrder.nativeOrder());
|
||||
|
||||
attribList.putInt(ALC.FREQUENCY);
|
||||
attribList.putInt(ALC.ALC_FREQUENCY);
|
||||
attribList.putInt(contextFrequency);
|
||||
attribList.putInt(ALC.REFRESH);
|
||||
attribList.putInt(ALC.ALC_REFRESH);
|
||||
attribList.putInt(contextRefresh);
|
||||
attribList.putInt(ALC.SYNC);
|
||||
attribList.putInt(ALC.ALC_SYNC);
|
||||
attribList.putInt(contextSynchronized);
|
||||
attribList.putInt(0); //terminating int
|
||||
|
||||
|
|
|
@ -39,17 +39,17 @@ package org.lwjgl.openal;
|
|||
* @author Brian Matzon <brian@matzon.dk>
|
||||
* @version $Revision$
|
||||
*/
|
||||
class ALCdevice {
|
||||
final class ALCdevice {
|
||||
|
||||
/** address of actual device */
|
||||
public final int device;
|
||||
final int device;
|
||||
|
||||
/**
|
||||
* Creates a new instance of ALCdevice
|
||||
*
|
||||
* @param device address of actual device
|
||||
*/
|
||||
public ALCdevice(int device) {
|
||||
ALCdevice(int device) {
|
||||
this.device = device;
|
||||
}
|
||||
}
|
|
@ -60,7 +60,7 @@ public abstract class BaseAL {
|
|||
/**
|
||||
* Override to provide any initialization code after creation.
|
||||
*/
|
||||
protected void init() throws OpenALException {
|
||||
protected static void init() throws OpenALException {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,7 +75,7 @@ public abstract class BaseAL {
|
|||
*
|
||||
* @throws Exception if a failiure occured in the AL creation process
|
||||
*/
|
||||
public void create() throws OpenALException {
|
||||
public static void create() throws OpenALException {
|
||||
if (created) {
|
||||
return;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public abstract class BaseAL {
|
|||
* @param libname Name of library to search for
|
||||
* @return Absolute path to library if found, otherwise null
|
||||
*/
|
||||
private String getPathFromJWS(String libname) {
|
||||
private static String getPathFromJWS(String libname) {
|
||||
try {
|
||||
|
||||
if(Sys.DEBUG) {
|
||||
|
@ -162,12 +162,12 @@ public abstract class BaseAL {
|
|||
* @param oalPaths Array of strings containing paths to search for OpenAL library
|
||||
* @return true if the AL creation process succeeded
|
||||
*/
|
||||
protected native boolean nCreate(String[] oalPaths);
|
||||
protected static native boolean nCreate(String[] oalPaths);
|
||||
|
||||
/**
|
||||
* Calls whatever destruction rutines that are needed
|
||||
*/
|
||||
public void destroy() {
|
||||
public static void destroy() {
|
||||
if (!created) {
|
||||
return;
|
||||
}
|
||||
|
@ -178,5 +178,5 @@ public abstract class BaseAL {
|
|||
/**
|
||||
* Native method the destroy the AL
|
||||
*/
|
||||
protected native void nDestroy();
|
||||
protected static native void nDestroy();
|
||||
}
|
||||
|
|
|
@ -42,42 +42,42 @@ package org.lwjgl.openal;
|
|||
public interface BaseALConstants {
|
||||
|
||||
/** Bad value */
|
||||
public static final int INVALID = -1;
|
||||
public static final int AL_INVALID = -1;
|
||||
|
||||
/** Disable value */
|
||||
public static final int NONE = 0;
|
||||
public static final int AL_NONE = 0;
|
||||
|
||||
/** Boolean False */
|
||||
public static final int FALSE = 0;
|
||||
public static final int AL_FALSE = 0;
|
||||
|
||||
/** Boolean True */
|
||||
public static final int TRUE = 1;
|
||||
public static final int AL_TRUE = 1;
|
||||
|
||||
/**
|
||||
* Indicate the type of SOURCE.
|
||||
* Sources can be spatialized
|
||||
*/
|
||||
public static final int SOURCE_TYPE = 0x200;
|
||||
public static final int AL_SOURCE_TYPE = 0x200;
|
||||
|
||||
/** Indicate source has absolute coordinates */
|
||||
public static final int SOURCE_ABSOLUTE = 0x201;
|
||||
public static final int AL_SOURCE_ABSOLUTE = 0x201;
|
||||
|
||||
/** Indicate Source has listener relative coordinates */
|
||||
public static final int SOURCE_RELATIVE = 0x202;
|
||||
public static final int AL_SOURCE_RELATIVE = 0x202;
|
||||
|
||||
/**
|
||||
* Directional source, inner cone angle, in degrees
|
||||
* Range: [0-360]
|
||||
* Default: 360
|
||||
*/
|
||||
public static final int CONE_INNER_ANGLE = 0x1001;
|
||||
public static final int AL_CONE_INNER_ANGLE = 0x1001;
|
||||
|
||||
/**
|
||||
* Directional source, outer cone angle, in degrees.
|
||||
* Range: [0-360]
|
||||
* Default: 360
|
||||
*/
|
||||
public static final int CONE_OUTER_ANGLE = 0x1002;
|
||||
public static final int AL_CONE_OUTER_ANGLE = 0x1002;
|
||||
|
||||
/**
|
||||
* Specify the pitch to be applied, either at source,
|
||||
|
@ -85,7 +85,7 @@ public interface BaseALConstants {
|
|||
* Range: [0.5-2.0]
|
||||
* Default: 1.0
|
||||
*/
|
||||
public static final int PITCH = 0x1003;
|
||||
public static final int AL_PITCH = 0x1003;
|
||||
|
||||
/**
|
||||
* Specify the current location in three dimensional space.
|
||||
|
@ -97,13 +97,13 @@ public interface BaseALConstants {
|
|||
* sign on the Z coordinate.
|
||||
* Listener position is always in the world coordinate system.
|
||||
*/
|
||||
public static final int POSITION = 0x1004;
|
||||
public static final int AL_POSITION = 0x1004;
|
||||
|
||||
/** Specify the current direction as forward vector. */
|
||||
public static final int DIRECTION = 0x1005;
|
||||
public static final int AL_DIRECTION = 0x1005;
|
||||
|
||||
/** Specify the current velocity in three dimensional space. */
|
||||
public static final int VELOCITY = 0x1006;
|
||||
public static final int AL_VELOCITY = 0x1006;
|
||||
|
||||
/**
|
||||
* Indicate whether source has to loop infinite.
|
||||
|
@ -111,14 +111,14 @@ public interface BaseALConstants {
|
|||
* Range: [TRUE, FALSE]
|
||||
* Default: FALSE
|
||||
*/
|
||||
public static final int LOOPING = 0x1007;
|
||||
public static final int AL_LOOPING = 0x1007;
|
||||
|
||||
/**
|
||||
* Indicate the buffer to provide sound samples.
|
||||
* Type: ALuint.
|
||||
* Range: any valid Buffer id.
|
||||
*/
|
||||
public static final int BUFFER = 0x1009;
|
||||
public static final int AL_BUFFER = 0x1009;
|
||||
|
||||
/**
|
||||
* Indicate the gain (volume amplification) applied.
|
||||
|
@ -131,28 +131,28 @@ public interface BaseALConstants {
|
|||
* scale; it is interpreted as zero volume - the channel
|
||||
* is effectively disabled.
|
||||
*/
|
||||
public static final int GAIN = 0x100A;
|
||||
public static final int AL_GAIN = 0x100A;
|
||||
|
||||
/**
|
||||
* Indicate minimum source attenuation.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - 1.0]
|
||||
*/
|
||||
public static final int MIN_GAIN = 0x100D;
|
||||
public static final int AL_MIN_GAIN = 0x100D;
|
||||
|
||||
/**
|
||||
* Indicate maximum source attenuation.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - 1.0]
|
||||
*/
|
||||
public static final int MAX_GAIN = 0x100E;
|
||||
public static final int AL_MAX_GAIN = 0x100E;
|
||||
|
||||
/**
|
||||
* Specify the current orientation.
|
||||
* Type: ALfv6 (at/up)
|
||||
* Range: N/A
|
||||
*/
|
||||
public static final int ORIENTATION = 0x100F;
|
||||
public static final int AL_ORIENTATION = 0x100F;
|
||||
|
||||
/* byte offset into source (in canon format). -1 if source
|
||||
* is not playing. Don't set this, get this.
|
||||
|
@ -161,7 +161,7 @@ public interface BaseALConstants {
|
|||
* Range: [0.0 - ]
|
||||
* Default: 1.0
|
||||
*/
|
||||
public static final int REFERENCE_DISTANCE = 0x1020;
|
||||
public static final int AL_REFERENCE_DISTANCE = 0x1020;
|
||||
|
||||
/**
|
||||
* Indicate the rolloff factor for the source.
|
||||
|
@ -169,7 +169,7 @@ public interface BaseALConstants {
|
|||
* Range: [0.0 - ]
|
||||
* Default: 1.0
|
||||
*/
|
||||
public static final int ROLLOFF_FACTOR = 0x1021;
|
||||
public static final int AL_ROLLOFF_FACTOR = 0x1021;
|
||||
|
||||
/**
|
||||
* Indicate the gain (volume amplification) applied.
|
||||
|
@ -182,54 +182,54 @@ public interface BaseALConstants {
|
|||
* scale; it is interpreted as zero volume - the channel
|
||||
* is effectively disabled.
|
||||
*/
|
||||
public static final int CONE_OUTER_GAIN = 0x1022;
|
||||
public static final int AL_CONE_OUTER_GAIN = 0x1022;
|
||||
|
||||
/**
|
||||
* Specify the maximum distance.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - ]
|
||||
*/
|
||||
public static final int MAX_DISTANCE = 0x1023;
|
||||
public static final int AL_MAX_DISTANCE = 0x1023;
|
||||
|
||||
/**
|
||||
* Specify the channel mask. (Creative)
|
||||
* Type: ALuint
|
||||
* Range: [0 - 255]
|
||||
*/
|
||||
public static final int CHANNEL_MASK = 0x3000;
|
||||
public static final int AL_CHANNEL_MASK = 0x3000;
|
||||
|
||||
/** Source state information */
|
||||
public static final int SOURCE_STATE = 0x1010;
|
||||
public static final int AL_SOURCE_STATE = 0x1010;
|
||||
|
||||
/** Source state information */
|
||||
public static final int INITIAL = 0x1011;
|
||||
public static final int AL_INITIAL = 0x1011;
|
||||
|
||||
/** Source state information */
|
||||
public static final int PLAYING = 0x1012;
|
||||
public static final int AL_PLAYING = 0x1012;
|
||||
|
||||
/** Source state information */
|
||||
public static final int PAUSED = 0x1013;
|
||||
public static final int AL_PAUSED = 0x1013;
|
||||
|
||||
/** Source state information */
|
||||
public static final int STOPPED = 0x1014;
|
||||
public static final int AL_STOPPED = 0x1014;
|
||||
|
||||
/** Buffer Queue params */
|
||||
public static final int BUFFERS_QUEUED = 0x1015;
|
||||
public static final int AL_BUFFERS_QUEUED = 0x1015;
|
||||
|
||||
/** Buffer Queue params */
|
||||
public static final int BUFFERS_PROCESSED = 0x1016;
|
||||
public static final int AL_BUFFERS_PROCESSED = 0x1016;
|
||||
|
||||
/** Sound buffers: format specifier. */
|
||||
public static final int FORMAT_MONO8 = 0x1100;
|
||||
public static final int AL_FORMAT_MONO8 = 0x1100;
|
||||
|
||||
/** Sound buffers: format specifier. */
|
||||
public static final int FORMAT_MONO16 = 0x1101;
|
||||
public static final int AL_FORMAT_MONO16 = 0x1101;
|
||||
|
||||
/** Sound buffers: format specifier. */
|
||||
public static final int FORMAT_STEREO8 = 0x1102;
|
||||
public static final int AL_FORMAT_STEREO8 = 0x1102;
|
||||
|
||||
/** Sound buffers: format specifier. */
|
||||
public static final int FORMAT_STEREO16 = 0x1103;
|
||||
public static final int AL_FORMAT_STEREO16 = 0x1103;
|
||||
|
||||
/**
|
||||
* Sound buffers: frequency, in units of Hertz [Hz].
|
||||
|
@ -237,7 +237,7 @@ public interface BaseALConstants {
|
|||
* sample frequency marks the maximum significant
|
||||
* frequency component.
|
||||
*/
|
||||
public static final int FREQUENCY = 0x2001;
|
||||
public static final int AL_FREQUENCY = 0x2001;
|
||||
|
||||
/**
|
||||
* Sound buffers: frequency, in units of Hertz [Hz].
|
||||
|
@ -245,7 +245,7 @@ public interface BaseALConstants {
|
|||
* sample frequency marks the maximum significant
|
||||
* frequency component.
|
||||
*/
|
||||
public static final int BITS = 0x2002;
|
||||
public static final int AL_BITS = 0x2002;
|
||||
|
||||
/**
|
||||
* Sound buffers: frequency, in units of Hertz [Hz].
|
||||
|
@ -253,7 +253,7 @@ public interface BaseALConstants {
|
|||
* sample frequency marks the maximum significant
|
||||
* frequency component.
|
||||
*/
|
||||
public static final int CHANNELS = 0x2003;
|
||||
public static final int AL_CHANNELS = 0x2003;
|
||||
|
||||
/**
|
||||
* Sound buffers: frequency, in units of Hertz [Hz].
|
||||
|
@ -261,7 +261,7 @@ public interface BaseALConstants {
|
|||
* sample frequency marks the maximum significant
|
||||
* frequency component.
|
||||
*/
|
||||
public static final int SIZE = 0x2004;
|
||||
public static final int AL_SIZE = 0x2004;
|
||||
|
||||
/**
|
||||
* Sound buffers: frequency, in units of Hertz [Hz].
|
||||
|
@ -269,43 +269,43 @@ public interface BaseALConstants {
|
|||
* sample frequency marks the maximum significant
|
||||
* frequency component.
|
||||
*/
|
||||
public static final int DATA = 0x2005;
|
||||
public static final int AL_DATA = 0x2005;
|
||||
|
||||
/**
|
||||
* Buffer state.
|
||||
*
|
||||
* Not supported for public use (yet).
|
||||
*/
|
||||
public static final int UNUSED = 0x2010;
|
||||
public static final int AL_UNUSED = 0x2010;
|
||||
|
||||
/**
|
||||
* Buffer state.
|
||||
*
|
||||
* Not supported for public use (yet).
|
||||
*/
|
||||
public static final int PENDING = 0x2011;
|
||||
public static final int AL_PENDING = 0x2011;
|
||||
|
||||
/**
|
||||
* Buffer state.
|
||||
*
|
||||
* Not supported for public use (yet).
|
||||
*/
|
||||
public static final int PROCESSED = 0x2012;
|
||||
public static final int AL_PROCESSED = 0x2012;
|
||||
|
||||
/** Errors: No Error. */
|
||||
public static final int NO_ERROR = FALSE;
|
||||
public static final int AL_NO_ERROR = AL_FALSE;
|
||||
|
||||
/** Illegal name passed as an argument to an AL call. */
|
||||
public static final int INVALID_NAME = 0xA001;
|
||||
public static final int AL_INVALID_NAME = 0xA001;
|
||||
|
||||
/** Illegal enum passed as an argument to an AL call. */
|
||||
public static final int INVALID_ENUM = 0xA002;
|
||||
public static final int AL_INVALID_ENUM = 0xA002;
|
||||
|
||||
/**
|
||||
* Illegal value passed as an argument to an AL call.
|
||||
* Applies to parameter values, but not to enumerations.
|
||||
*/
|
||||
public static final int INVALID_VALUE = 0xA003;
|
||||
public static final int AL_INVALID_VALUE = 0xA003;
|
||||
|
||||
/**
|
||||
* A function was called at inappropriate time,
|
||||
|
@ -313,38 +313,38 @@ public interface BaseALConstants {
|
|||
* This can be an incompatible ALenum, object ID,
|
||||
* and/or function.
|
||||
*/
|
||||
public static final int INVALID_OPERATION = 0xA004;
|
||||
public static final int AL_INVALID_OPERATION = 0xA004;
|
||||
|
||||
/**
|
||||
* A function could not be completed,
|
||||
* because there is not enough memory available.
|
||||
*/
|
||||
public static final int OUT_OF_MEMORY = 0xA005;
|
||||
public static final int AL_OUT_OF_MEMORY = 0xA005;
|
||||
|
||||
/** Context strings: Vendor */
|
||||
public static final int VENDOR = 0xB001;
|
||||
public static final int AL_VENDOR = 0xB001;
|
||||
|
||||
/** Context strings: Version */
|
||||
public static final int VERSION = 0xB002;
|
||||
public static final int AL_VERSION = 0xB002;
|
||||
|
||||
/** Context strings: Renderer */
|
||||
public static final int RENDERER = 0xB003;
|
||||
public static final int AL_RENDERER = 0xB003;
|
||||
|
||||
/** Context strings: Extensions */
|
||||
public static final int EXTENSIONS = 0xB004;
|
||||
public static final int AL_EXTENSIONS = 0xB004;
|
||||
|
||||
/** Doppler scale. Default 1.0 */
|
||||
public static final int DOPPLER_FACTOR = 0xC000;
|
||||
public static final int AL_DOPPLER_FACTOR = 0xC000;
|
||||
|
||||
/** Doppler velocity. Default 1.0 */
|
||||
public static final int DOPPLER_VELOCITY = 0xC001;
|
||||
public static final int AL_DOPPLER_VELOCITY = 0xC001;
|
||||
|
||||
/** Distance model. Default INVERSE_DISTANCE_CLAMPED */
|
||||
public static final int DISTANCE_MODEL = 0xD000;
|
||||
public static final int AL_DISTANCE_MODEL = 0xD000;
|
||||
|
||||
/** Distance model */
|
||||
public static final int INVERSE_DISTANCE = 0xD001;
|
||||
public static final int AL_INVERSE_DISTANCE = 0xD001;
|
||||
|
||||
/** Distance model */
|
||||
public static final int INVERSE_DISTANCE_CLAMPED = 0xD002;
|
||||
public static final int AL_INVERSE_DISTANCE_CLAMPED = 0xD002;
|
||||
}
|
|
@ -31,6 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
import java.nio.Buffer;
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
|
@ -42,24 +44,19 @@ package org.lwjgl.openal;
|
|||
*/
|
||||
public class CoreAL extends BaseAL implements BaseALConstants {
|
||||
|
||||
/** Creates a new instance of CoreAL */
|
||||
public CoreAL() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables a feature of the OpenAL driver.
|
||||
*
|
||||
* @param capability name of a capability to enable
|
||||
*/
|
||||
public native void enable(int capability);
|
||||
public static native void alEnable(int capability);
|
||||
|
||||
/**
|
||||
* Disables a feature of the OpenAL driver.
|
||||
*
|
||||
* @param capability name of a capability to disable
|
||||
*/
|
||||
public native void disable(int capability);
|
||||
public static native void alDisable(int capability);
|
||||
|
||||
/**
|
||||
* Checks if a specific feature is enabled in the OpenAL driver.
|
||||
|
@ -67,7 +64,7 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param capability name of a capability to check
|
||||
* @return true if named feature is enabled
|
||||
*/
|
||||
public native boolean isEnabled(int capability);
|
||||
public static native boolean alIsEnabled(int capability);
|
||||
|
||||
/**
|
||||
* Hinting for implementation
|
||||
|
@ -76,67 +73,67 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param target FIXME
|
||||
* @param mode FIXME
|
||||
*/
|
||||
public native void hint(int target, int mode);
|
||||
public static native void alHint(int target, int mode);
|
||||
|
||||
/**
|
||||
* Returns a boolean OpenAL state.
|
||||
*
|
||||
* @return boolean state described by pname will be returned.
|
||||
*/
|
||||
public native boolean getBoolean(int pname);
|
||||
public static native boolean alGetBoolean(int pname);
|
||||
|
||||
/**
|
||||
* Returns an int OpenAL state.
|
||||
*
|
||||
* @return int state described by pname will be returned.
|
||||
*/
|
||||
public native int getInteger(int pname);
|
||||
public static native int alGetInteger(int pname);
|
||||
|
||||
/**
|
||||
* Returns a float OpenAL state.
|
||||
*
|
||||
* @return float state described by pname will be returned.
|
||||
*/
|
||||
public native float getFloat(int pname);
|
||||
public static native float alGetFloat(int pname);
|
||||
|
||||
/**
|
||||
* Returns a double OpenAL state.
|
||||
*
|
||||
* @return double state described by pname will be returned.
|
||||
*/
|
||||
public native double getDouble(int pname);
|
||||
public static native double alGetDouble(int pname);
|
||||
|
||||
/**
|
||||
* Returns a boolean OpenAL state.
|
||||
*
|
||||
* @param pname state to be queried
|
||||
* @param data address of ByteBuffer to place the booleans in
|
||||
* @param data Buffer to place the booleans in
|
||||
*/
|
||||
public native void getBooleanv(int pname, int data);
|
||||
public static native void alGetBooleanv(int pname, Buffer data);
|
||||
|
||||
/**
|
||||
* Returns an integer OpenAL state.
|
||||
*
|
||||
* @param pname state to be queried
|
||||
* @param data address of ByteBuffer to place the integers in
|
||||
* @param data Buffer to place the integers in
|
||||
*/
|
||||
public native void getIntegerv(int pname, int data);
|
||||
public static native void alGetIntegerv(int pname, Buffer data);
|
||||
|
||||
/**
|
||||
* Returns a floating point OpenAL state.
|
||||
*
|
||||
* @param pname state to be queried
|
||||
* @param data address of ByteBuffer to place the floats in
|
||||
* @param data Buffer to place the floats in
|
||||
*/
|
||||
public native void getFloatv(int pname, int data);
|
||||
public static native void alGetFloatv(int pname, Buffer data);
|
||||
|
||||
/**
|
||||
* Returns a double OpenAL state.
|
||||
*
|
||||
* @param pname state to be queried
|
||||
* @param data address of ByteBuffer to place the floats in
|
||||
* @param data Buffer to place the floats in
|
||||
*/
|
||||
public native void getDoublev(int pname, int data);
|
||||
public static native void alGetDoublev(int pname, Buffer data);
|
||||
|
||||
/**
|
||||
* Retrieve an OpenAL string property.
|
||||
|
@ -144,14 +141,14 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param pname The property to be returned
|
||||
* @return OpenAL String property
|
||||
*/
|
||||
public native String getString(int pname);
|
||||
public static native String alGetString(int pname);
|
||||
|
||||
/**
|
||||
* Retrieve the current error state and then clears the error state.
|
||||
*
|
||||
* @return current error state
|
||||
*/
|
||||
public native int getError();
|
||||
public static native int alGetError();
|
||||
|
||||
/**
|
||||
* Test if a specific extension is available for the OpenAL driver.
|
||||
|
@ -159,7 +156,7 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param fname String describing the desired extension
|
||||
* @return true if extension is available, false if not
|
||||
*/
|
||||
public native boolean isExtensionPresent(String fname);
|
||||
public static native boolean alIsExtensionPresent(String fname);
|
||||
|
||||
/**
|
||||
* Returns the enumeration value of an OpenAL enum described by a string.
|
||||
|
@ -167,7 +164,7 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param ename String describing an OpenAL enum
|
||||
* @return Actual int for the described enumeration name
|
||||
*/
|
||||
public native int getEnumValue(String ename);
|
||||
public static native int alGetEnumValue(String ename);
|
||||
|
||||
/**
|
||||
* Sets an integer property of the listener
|
||||
|
@ -175,7 +172,7 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param pname name of the attribute to be set
|
||||
* @param value value to set the attribute to
|
||||
*/
|
||||
public native void listeneri(int pname, int value);
|
||||
public static native void alListeneri(int pname, int value);
|
||||
|
||||
/**
|
||||
* Sets a floating point property of the listener
|
||||
|
@ -183,60 +180,50 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param pname name of the attribute to be set
|
||||
* @param value floating point value to set the attribute to
|
||||
*/
|
||||
public native void listenerf(int pname, float value);
|
||||
|
||||
/**
|
||||
* Sets a floating point property of the listener
|
||||
*
|
||||
* @param pname name of the attribute to be set
|
||||
* @param v1 value value 1
|
||||
* @param v2 value value 2
|
||||
* @param v3 float value 3
|
||||
*/
|
||||
public native void listener3f(int pname, float v1, float v2, float v3);
|
||||
public static native void alListenerf(int pname, float value);
|
||||
|
||||
/**
|
||||
* Sets a floating point property of the listener
|
||||
*
|
||||
* @param pname name of the attribute to be set
|
||||
* @param v1 value value 1
|
||||
* @param v2 value value 2
|
||||
* @param v3 float value 3
|
||||
*/
|
||||
public static native void alListener3f(int pname, float v1, float v2, float v3);
|
||||
|
||||
|
||||
/**
|
||||
* Sets a floating point vector property of the listener
|
||||
*
|
||||
* @param pname name of the attribute to be set
|
||||
* @param floatdata bytebuffer address to read floats from
|
||||
* @param floatdata Buffer to read floats from
|
||||
*/
|
||||
public native void listenerfv(int pname, int floatdata);
|
||||
public static native void alListenerfv(int pname, Buffer floatdata);
|
||||
|
||||
/**
|
||||
* Gets an integer property of the listener.
|
||||
*
|
||||
* @param pname name of the attribute to be retrieved
|
||||
* @param integerdata bytebuffer address to write integer to
|
||||
* @param integerdata Buffer to write integer to
|
||||
*/
|
||||
public native void getListeneri(int pname, int integerdata);
|
||||
public static native void alGetListeneri(int pname, Buffer integerdata);
|
||||
|
||||
/**
|
||||
* Gets a floating point property of the listener.
|
||||
*
|
||||
* @param pname name of the attribute to be retrieved
|
||||
* @param floatdata bytebuffer address to write float to
|
||||
* @param floatdata Buffer to write float to
|
||||
*/
|
||||
public native void getListenerf(int pname, int floatdata);
|
||||
|
||||
/**
|
||||
* Retrieves a set of three floating point values from a
|
||||
* property of the listener.
|
||||
*
|
||||
* @param pname name of the attribute to be retrieved
|
||||
* @param v1 bytebuffer address to write float 1 to
|
||||
* @param v2 bytebuffer address to write float 2 to
|
||||
* @param v3 bytebuffer address to write float 3 to
|
||||
*/
|
||||
public native void getListener3f(int pname, int v1, int v2, int v3);
|
||||
public static native void alGetListenerf(int pname, Buffer floatdata);
|
||||
|
||||
/**
|
||||
* Retrieves a floating point vector property of the listener.
|
||||
*
|
||||
* @param pname name of the attribute to be retrieved
|
||||
* @param floatdata bytebuffer address to write floats to
|
||||
* @param floatdata Buffer to write floats to
|
||||
*/
|
||||
public native void getListenerfv(int pname, int floatdata);
|
||||
public static native void alGetListenerfv(int pname, Buffer floatdata);
|
||||
|
||||
/**
|
||||
* Generate one or more sources.
|
||||
|
@ -244,7 +231,7 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param n number of sources to generate
|
||||
* @param sources array holding sources
|
||||
*/
|
||||
public native void genSources(int n, int sources);
|
||||
public static native void alGenSources(int n, Buffer sources);
|
||||
|
||||
/**
|
||||
* Delete one or more sources.
|
||||
|
@ -252,7 +239,7 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param n Number of sources to delete
|
||||
* @param source Source array to delete from
|
||||
*/
|
||||
public native void deleteSources(int n, int source);
|
||||
public static native void alDeleteSources(int n, Buffer source);
|
||||
|
||||
/**
|
||||
* Tests if a source is valid.
|
||||
|
@ -260,7 +247,7 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param id id of source to be testes for validity
|
||||
* @return true if id is valid, false if not
|
||||
*/
|
||||
public native boolean isSource(int id);
|
||||
public static native boolean alIsSource(int id);
|
||||
|
||||
/**
|
||||
* Set an integer property of a source.
|
||||
|
@ -269,7 +256,7 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param pname property to set
|
||||
* @param value value of property
|
||||
*/
|
||||
public native void sourcei(int source, int pname, int value);
|
||||
public static native void alSourcei(int source, int pname, int value);
|
||||
|
||||
/**
|
||||
* Set a floating point property of a source.
|
||||
|
@ -278,59 +265,60 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param pname property to set
|
||||
* @param value value of property
|
||||
*/
|
||||
public native void sourcef(int source, int pname, float value);
|
||||
|
||||
/**
|
||||
* Sets a source property requiring three floating point values.
|
||||
*
|
||||
* @param source Source to set property on
|
||||
* @param pname property to set
|
||||
* @param v1 value 1 of property
|
||||
* @param v2 value 2 of property
|
||||
* @param v3 value 3 of property
|
||||
*/
|
||||
public native void source3f(
|
||||
int source,
|
||||
int pname,
|
||||
float v1,
|
||||
float v2,
|
||||
float v3);
|
||||
public static native void alSourcef(int source, int pname, float value);
|
||||
|
||||
/**
|
||||
* Sets a source property requiring three floating point values.
|
||||
*
|
||||
* @param source Source to set property on
|
||||
* @param pname property to set
|
||||
* @param v1 value 1 of property
|
||||
* @param v2 value 2 of property
|
||||
* @param v3 value 3 of property
|
||||
*/
|
||||
public static native void alSource3f(
|
||||
int source,
|
||||
int pname,
|
||||
float v1,
|
||||
float v2,
|
||||
float v3);
|
||||
|
||||
|
||||
/**
|
||||
* Sets a floating point vector property of a source.
|
||||
*
|
||||
* @param source source whichs attribute is being set
|
||||
* @param pname name of the attribute being set
|
||||
* @param floatdata bytebuffer address to read floats from
|
||||
* @param floatdata Buffer to read floats from
|
||||
*/
|
||||
public native void sourcefv(int source, int pname, int floatdata);
|
||||
public static native void alSourcefv(int source, int pname, Buffer floatdata);
|
||||
|
||||
/**
|
||||
* Retrieves an integer property of a source.
|
||||
*
|
||||
* @param source source to get property from
|
||||
* @param pname name of property
|
||||
* @param integerdata bytebuffer address to write integer to
|
||||
* @param integerdata Buffer to write integer to
|
||||
*/
|
||||
public native void getSourcei(int source, int pname, int integerdata);
|
||||
public static native void alGetSourcei(int source, int pname, Buffer integerdata);
|
||||
|
||||
/**
|
||||
* Retrieves a floating point property of a source.
|
||||
*
|
||||
* @param source source to get property from
|
||||
* @param pname name of property
|
||||
* @param floatdata bytebuffer address to write float to
|
||||
* @param floatdata Buffer to write float to
|
||||
*/
|
||||
public native void getSourcef(int source, int pname, int floatdata);
|
||||
public static native void alGetSourcef(int source, int pname, Buffer floatdata);
|
||||
|
||||
/**
|
||||
* Gets a floating point vector property from a Source object.
|
||||
*
|
||||
* @param source Source to get property from
|
||||
* @param pname property to get
|
||||
* @param floatdata bytebuffer address to write floats to
|
||||
* @param floatdata Buffer to write floats to
|
||||
*/
|
||||
public native void getSourcefv(int source, int pname, int floatdata);
|
||||
public static native void alGetSourcefv(int source, int pname, Buffer floatdata);
|
||||
|
||||
/**
|
||||
* Plays a set of sources.
|
||||
|
@ -338,7 +326,7 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param n number of sources to play
|
||||
* @param sources array of sources to play
|
||||
*/
|
||||
public native void sourcePlayv(int n, int sources);
|
||||
public static native void alSourcePlayv(int n, Buffer sources);
|
||||
|
||||
/**
|
||||
* Pauses a set of sources.
|
||||
|
@ -346,7 +334,7 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param n number of sources to pause
|
||||
* @param sources array of sources to pause
|
||||
*/
|
||||
public native void sourcePausev(int n, int sources);
|
||||
public static native void alSourcePausev(int n, Buffer sources);
|
||||
|
||||
/**
|
||||
* Stops a set of sources.
|
||||
|
@ -354,7 +342,7 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param n number of sources to stop
|
||||
* @param sources array of sources to stop
|
||||
*/
|
||||
public native void sourceStopv(int n, int sources);
|
||||
public static native void alSourceStopv(int n, Buffer sources);
|
||||
|
||||
/**
|
||||
* Rewinds a set of sources.
|
||||
|
@ -362,51 +350,51 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param n number of sources to rewind
|
||||
* @param sources array of sources to rewind
|
||||
*/
|
||||
public native void sourceRewindv(int n, int sources);
|
||||
public static native void alSourceRewindv(int n, Buffer sources);
|
||||
|
||||
/**
|
||||
* Play a source.
|
||||
*
|
||||
* @param source Source to play
|
||||
*/
|
||||
public native void sourcePlay(int source);
|
||||
public static native void alSourcePlay(int source);
|
||||
|
||||
/**
|
||||
* Pauses a source.
|
||||
*
|
||||
* @param source Source to pause
|
||||
*/
|
||||
public native void sourcePause(int source);
|
||||
public static native void alSourcePause(int source);
|
||||
|
||||
/**
|
||||
* Stops a source.
|
||||
*
|
||||
* @param source Source to stop
|
||||
*/
|
||||
public native void sourceStop(int source);
|
||||
public static native void alSourceStop(int source);
|
||||
|
||||
/**
|
||||
* Rewinds a source.
|
||||
*
|
||||
* @param source Source to rewind
|
||||
*/
|
||||
public native void sourceRewind(int source);
|
||||
public static native void alSourceRewind(int source);
|
||||
|
||||
/**
|
||||
* Generate one or more buffers.
|
||||
*
|
||||
* @param n number of buffers to generate
|
||||
* @param buffers array holding buffers
|
||||
* @param buffers holding buffers
|
||||
*/
|
||||
public native void genBuffers(int n, int buffers);
|
||||
public static native void alGenBuffers(int n, Buffer buffers);
|
||||
|
||||
/**
|
||||
* Delete one or more buffers.
|
||||
*
|
||||
* @param n Number of buffers to delete
|
||||
* @param buffers Buffer array to delete from
|
||||
* @param buffers Buffer to delete from
|
||||
*/
|
||||
public native void deleteBuffers(int n, int buffers);
|
||||
public static native void alDeleteBuffers(int n, Buffer buffers);
|
||||
|
||||
/**
|
||||
* Tests if buffer is valid.
|
||||
|
@ -414,21 +402,21 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param buffer buffer to be tested for validity
|
||||
* @return true if supplied buffer is valid, false if not
|
||||
*/
|
||||
public native boolean isBuffer(int buffer);
|
||||
public static native boolean alIsBuffer(int buffer);
|
||||
|
||||
/**
|
||||
* Fill a buffer with audio data.
|
||||
*
|
||||
* @param buffer Buffer to fill
|
||||
* @param format format sound data is in
|
||||
* @param data location of data (pointer)
|
||||
* @param ByteBuffer location of data
|
||||
* @param size size of data segment
|
||||
* @param freq frequency of data
|
||||
*/
|
||||
public native void bufferData(
|
||||
public static native void alBufferData(
|
||||
int buffer,
|
||||
int format,
|
||||
int data,
|
||||
Buffer data,
|
||||
int size,
|
||||
int freq);
|
||||
|
||||
|
@ -437,18 +425,18 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
*
|
||||
* @param buffer buffer to get property from
|
||||
* @param pname name of property to retrieve
|
||||
* @param integerdata bytebuffer address to write integer to
|
||||
* @param integerdata Buffer to write integer to
|
||||
*/
|
||||
public native void getBufferi(int buffer, int pname, int integerdata);
|
||||
public static native void alGetBufferi(int buffer, int pname, Buffer integerdata);
|
||||
|
||||
/**
|
||||
* Retrieves a floating point property from a buffer.
|
||||
*
|
||||
* @param buffer buffer to get property from
|
||||
* @param pname name of property to retrieve
|
||||
* @param floatdata bytebuffer address to write float to
|
||||
* @param floatdata Buffer to write float to
|
||||
*/
|
||||
public native void getBufferf(int buffer, int pname, int floatdata);
|
||||
public static native void alGetBufferf(int buffer, int pname, Buffer floatdata);
|
||||
|
||||
/**
|
||||
* Queues a set of buffers on a source.
|
||||
|
@ -457,7 +445,7 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param n number of buffers to be queued
|
||||
* @param buffers buffers to be queued
|
||||
*/
|
||||
public native void sourceQueueBuffers(int source, int n, int buffers);
|
||||
public static native void alSourceQueueBuffers(int source, int n, Buffer buffers);
|
||||
|
||||
/**
|
||||
* Unqueues a set of buffers attached to a source.
|
||||
|
@ -466,26 +454,26 @@ public class CoreAL extends BaseAL implements BaseALConstants {
|
|||
* @param n number of buffers to be unqueued
|
||||
* @param buffers buffers to be unqueued
|
||||
*/
|
||||
public native void sourceUnqueueBuffers(int source, int n, int buffers);
|
||||
public static native void alSourceUnqueueBuffers(int source, int n, Buffer buffers);
|
||||
|
||||
/**
|
||||
* Selects the OpenAL distance model.
|
||||
*
|
||||
* @param value distance model to be set
|
||||
*/
|
||||
public native void distanceModel(int value);
|
||||
public static native void alDistanceModel(int value);
|
||||
|
||||
/**
|
||||
* Selects the OpenAL Doppler factor value.
|
||||
*
|
||||
* @param value Doppler scale value to set
|
||||
*/
|
||||
public native void dopplerFactor(float value);
|
||||
public static native void alDopplerFactor(float value);
|
||||
|
||||
/**
|
||||
* Selects the OpenAL Doppler velocity value.
|
||||
*
|
||||
* @param value Doppler velocity value to set
|
||||
*/
|
||||
public native void dopplerVelocity(float value);
|
||||
public static native void alDopplerVelocity(float value);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public abstract class BaseEAX {
|
|||
/**
|
||||
* Override to provide any initialization code after creation.
|
||||
*/
|
||||
protected void init() {
|
||||
protected static void init() {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,7 +70,7 @@ public abstract class BaseEAX {
|
|||
*
|
||||
* @throws Exception if the EAX extensions couldn't be loaded
|
||||
*/
|
||||
public void create() throws Exception {
|
||||
public static void create() throws Exception {
|
||||
if (created) {
|
||||
return;
|
||||
}
|
||||
|
@ -87,12 +87,12 @@ public abstract class BaseEAX {
|
|||
*
|
||||
* @return true if the EAX extensions could be found
|
||||
*/
|
||||
protected native boolean nCreate();
|
||||
protected static native boolean nCreate();
|
||||
|
||||
/**
|
||||
* "Destroy" the EAX object
|
||||
*/
|
||||
public void destroy() {
|
||||
public static void destroy() {
|
||||
if (!created) {
|
||||
return;
|
||||
}
|
||||
|
@ -100,16 +100,8 @@ public abstract class BaseEAX {
|
|||
nDestroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Finalizer, marked final.
|
||||
*/
|
||||
public void finalize() throws Throwable {
|
||||
super.finalize();
|
||||
destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Native method the destroy the EAX
|
||||
*/
|
||||
protected native void nDestroy();
|
||||
protected static native void nDestroy();
|
||||
}
|
|
@ -40,71 +40,71 @@ package org.lwjgl.openal.eax;
|
|||
* @version $Revision$
|
||||
*/
|
||||
public interface BaseEAXConstants {
|
||||
public static final int ENVIRONMENT_GENERIC = 0;
|
||||
public static final int ENVIRONMENT_PADDEDCELL = 1;
|
||||
public static final int ENVIRONMENT_ROOM = 2;
|
||||
public static final int ENVIRONMENT_BATHROOM = 3;
|
||||
public static final int ENVIRONMENT_LIVINGROOM = 4;
|
||||
public static final int ENVIRONMENT_STONEROOM = 5;
|
||||
public static final int ENVIRONMENT_AUDITORIUM = 6;
|
||||
public static final int ENVIRONMENT_CONCERTHALL = 7;
|
||||
public static final int ENVIRONMENT_CAVE = 8;
|
||||
public static final int ENVIRONMENT_ARENA = 9;
|
||||
public static final int ENVIRONMENT_HANGAR = 10;
|
||||
public static final int ENVIRONMENT_CARPETEDHALLWAY = 11;
|
||||
public static final int ENVIRONMENT_HALLWAY = 12;
|
||||
public static final int ENVIRONMENT_STONECORRIDOR = 13;
|
||||
public static final int ENVIRONMENT_ALLEY = 14;
|
||||
public static final int ENVIRONMENT_FOREST = 15;
|
||||
public static final int ENVIRONMENT_CITY = 16;
|
||||
public static final int ENVIRONMENT_MOUNTAINS = 17;
|
||||
public static final int ENVIRONMENT_QUARRY = 18;
|
||||
public static final int ENVIRONMENT_PLAIN = 19;
|
||||
public static final int ENVIRONMENT_PARKINGLOT = 20;
|
||||
public static final int ENVIRONMENT_SEWERPIPE = 21;
|
||||
public static final int ENVIRONMENT_UNDERWATER = 22;
|
||||
public static final int ENVIRONMENT_DRUGGED = 23;
|
||||
public static final int ENVIRONMENT_DIZZY = 24;
|
||||
public static final int ENVIRONMENT_PSYCHOTIC = 25;
|
||||
public static final int ENVIRONMENT_COUNT = 26;
|
||||
public static final int EAX_ENVIRONMENT_GENERIC = 0;
|
||||
public static final int EAX_ENVIRONMENT_PADDEDCELL = 1;
|
||||
public static final int EAX_ENVIRONMENT_ROOM = 2;
|
||||
public static final int EAX_ENVIRONMENT_BATHROOM = 3;
|
||||
public static final int EAX_ENVIRONMENT_LIVINGROOM = 4;
|
||||
public static final int EAX_ENVIRONMENT_STONEROOM = 5;
|
||||
public static final int EAX_ENVIRONMENT_AUDITORIUM = 6;
|
||||
public static final int EAX_ENVIRONMENT_CONCERTHALL = 7;
|
||||
public static final int EAX_ENVIRONMENT_CAVE = 8;
|
||||
public static final int EAX_ENVIRONMENT_ARENA = 9;
|
||||
public static final int EAX_ENVIRONMENT_HANGAR = 10;
|
||||
public static final int EAX_ENVIRONMENT_CARPETEDHALLWAY = 11;
|
||||
public static final int EAX_ENVIRONMENT_HALLWAY = 12;
|
||||
public static final int EAX_ENVIRONMENT_STONECORRIDOR = 13;
|
||||
public static final int EAX_ENVIRONMENT_ALLEY = 14;
|
||||
public static final int EAX_ENVIRONMENT_FOREST = 15;
|
||||
public static final int EAX_ENVIRONMENT_CITY = 16;
|
||||
public static final int EAX_ENVIRONMENT_MOUNTAINS = 17;
|
||||
public static final int EAX_ENVIRONMENT_QUARRY = 18;
|
||||
public static final int EAX_ENVIRONMENT_PLAIN = 19;
|
||||
public static final int EAX_ENVIRONMENT_PARKINGLOT = 20;
|
||||
public static final int EAX_ENVIRONMENT_SEWERPIPE = 21;
|
||||
public static final int EAX_ENVIRONMENT_UNDERWATER = 22;
|
||||
public static final int EAX_ENVIRONMENT_DRUGGED = 23;
|
||||
public static final int EAX_ENVIRONMENT_DIZZY = 24;
|
||||
public static final int EAX_ENVIRONMENT_PSYCHOTIC = 25;
|
||||
public static final int EAX_ENVIRONMENT_COUNT = 26;
|
||||
|
||||
// Single window material preset
|
||||
public static final int MATERIAL_SINGLEWINDOW = -2800;
|
||||
public static final float MATERIAL_SINGLEWINDOWLF = 0.71f;
|
||||
public static final float MATERIAL_SINGLEWINDOWROOMRATIO = 0.43f;
|
||||
public static final int EAX_MATERIAL_SINGLEWINDOW = -2800;
|
||||
public static final float EAX_MATERIAL_SINGLEWINDOWLF = 0.71f;
|
||||
public static final float EAX_MATERIAL_SINGLEWINDOWROOMRATIO = 0.43f;
|
||||
|
||||
// Double window material preset
|
||||
public static final int MATERIAL_DOUBLEWINDOW = -5000;
|
||||
public static final float MATERIAL_DOUBLEWINDOWHF = 0.40f;
|
||||
public static final float MATERIAL_DOUBLEWINDOWROOMRATIO = 0.24f;
|
||||
public static final int EAX_MATERIAL_DOUBLEWINDOW = -5000;
|
||||
public static final float EAX_MATERIAL_DOUBLEWINDOWHF = 0.40f;
|
||||
public static final float EAX_MATERIAL_DOUBLEWINDOWROOMRATIO = 0.24f;
|
||||
|
||||
// Thin door material preset
|
||||
public static final int MATERIAL_THINDOOR = -1800;
|
||||
public static final float MATERIAL_THINDOORLF = 0.66f;
|
||||
public static final float MATERIAL_THINDOORROOMRATIO = 0.66f;
|
||||
public static final int EAX_MATERIAL_THINDOOR = -1800;
|
||||
public static final float EAX_MATERIAL_THINDOORLF = 0.66f;
|
||||
public static final float EAX_MATERIAL_THINDOORROOMRATIO = 0.66f;
|
||||
|
||||
// Thick door material preset
|
||||
public static final int MATERIAL_THICKDOOR = -4400;
|
||||
public static final float MATERIAL_THICKDOORLF = 0.64f;
|
||||
public static final float MATERIAL_THICKDOORROOMRTATION = 0.27f;
|
||||
public static final int EAX_MATERIAL_THICKDOOR = -4400;
|
||||
public static final float EAX_MATERIAL_THICKDOORLF = 0.64f;
|
||||
public static final float EAX_MATERIAL_THICKDOORROOMRTATION = 0.27f;
|
||||
|
||||
// Wood wall material preset
|
||||
public static final int MATERIAL_WOODWALL = -4000;
|
||||
public static final float MATERIAL_WOODWALLLF = 0.50f;
|
||||
public static final float MATERIAL_WOODWALLROOMRATIO = 0.30f;
|
||||
public static final int EAX_MATERIAL_WOODWALL = -4000;
|
||||
public static final float EAX_MATERIAL_WOODWALLLF = 0.50f;
|
||||
public static final float EAX_MATERIAL_WOODWALLROOMRATIO = 0.30f;
|
||||
|
||||
// Brick wall material preset
|
||||
public static final int MATERIAL_BRICKWALL = -5000;
|
||||
public static final float MATERIAL_BRICKWALLLF = 0.60f;
|
||||
public static final float MATERIAL_BRICKWALLROOMRATIO = 0.24f;
|
||||
public static final int EAX_MATERIAL_BRICKWALL = -5000;
|
||||
public static final float EAX_MATERIAL_BRICKWALLLF = 0.60f;
|
||||
public static final float EAX_MATERIAL_BRICKWALLROOMRATIO = 0.24f;
|
||||
|
||||
// Stone wall material preset
|
||||
public static final int MATERIAL_STONEWALL = -6000;
|
||||
public static final float MATERIAL_STONEWALLLF = 0.68f;
|
||||
public static final float MATERIAL_STONEWALLROOMRATIO = 0.20f;
|
||||
public static final int EAX_MATERIAL_STONEWALL = -6000;
|
||||
public static final float EAX_MATERIAL_STONEWALLLF = 0.68f;
|
||||
public static final float EAX_MATERIAL_STONEWALLROOMRATIO = 0.20f;
|
||||
|
||||
// Curtain material preset
|
||||
public static final int MATERIAL_CURTAIN = -1200;
|
||||
public static final float MATERIAL_CURTAINLF = 0.15f;
|
||||
public static final float MATERIAL_CURTAINROOMRATIO = 1.00f;
|
||||
public static final int EAX_MATERIAL_CURTAIN = -1200;
|
||||
public static final float EAX_MATERIAL_CURTAINLF = 0.15f;
|
||||
public static final float EAX_MATERIAL_CURTAINROOMRATIO = 1.00f;
|
||||
}
|
|
@ -29,7 +29,9 @@
|
|||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.lwjgl.openal.eax;
|
||||
package org.lwjgl.openal.eax;
|
||||
|
||||
import java.nio.Buffer;
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
|
@ -47,27 +49,23 @@ public class CoreEAX extends BaseEAX implements BaseEAXConstants {
|
|||
/** GUID for listener */
|
||||
public static int LISTENER_GUID;
|
||||
|
||||
/** Creates a new instance of CoreEAX */
|
||||
public CoreEAX() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Load extensions
|
||||
*/
|
||||
protected void init() {
|
||||
determineAvailableExtensions();
|
||||
setGUID();
|
||||
protected static void init() {
|
||||
determineAvailableExtensions();
|
||||
setGUID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines available EAX extensions
|
||||
*/
|
||||
protected native void determineAvailableExtensions();
|
||||
protected static native void determineAvailableExtensions();
|
||||
|
||||
/**
|
||||
* Sets the GUID's for the buffer and listener objects
|
||||
*/
|
||||
protected native void setGUID();
|
||||
protected static native void setGUID();
|
||||
|
||||
/**
|
||||
* Retrieves an EAX Value
|
||||
|
@ -75,11 +73,11 @@ public class CoreEAX extends BaseEAX implements BaseEAXConstants {
|
|||
* @param propertySetID adress to the property set GUID of the object being queried (a listener or a source)
|
||||
* @param property property being queried
|
||||
* @param source the source to be queried
|
||||
* @param data address to write value to
|
||||
* @param data Buffer to write value to
|
||||
* @param size size of area being written to
|
||||
* @return OpenAL Error code
|
||||
*/
|
||||
public native int eaxGet(int propertySetID, int property, int source, int data, int size);
|
||||
public static native int eaxGet(int propertySetID, int property, int source, Buffer data, int size);
|
||||
|
||||
/**
|
||||
* Sets an EAX Value
|
||||
|
@ -87,9 +85,9 @@ public class CoreEAX extends BaseEAX implements BaseEAXConstants {
|
|||
* @param propertySetID adress to the property set GUID of the object being queried (a listener or a source)
|
||||
* @param property property being queried
|
||||
* @param source the source to be queried
|
||||
* @param data address to write value to
|
||||
* @param data Buffer to write value to
|
||||
* @param size size of area being written to
|
||||
* @return OpenAL Error code
|
||||
*/
|
||||
public native int eaxSet(int propertySetID, int property, int source, int data, int size);
|
||||
public static native int eaxSet(int propertySetID, int property, int source, Buffer data, int size);
|
||||
}
|
|
@ -40,10 +40,128 @@
|
|||
* @version $Revision$
|
||||
*/
|
||||
public class EAX extends CoreEAX {
|
||||
|
||||
/**
|
||||
* Nothing to se here - please move along
|
||||
*/
|
||||
public EAX() {
|
||||
|
||||
/**
|
||||
* Sets an EAX Value
|
||||
*
|
||||
* @param listener EAXListenerProperties to set values from
|
||||
* @param property property being queried
|
||||
* @param source the source to be queried
|
||||
*/
|
||||
public static void eaxSetProperty(EAXListenerProperties listener, int property, int source) {
|
||||
System.out.println("EAX has been disapled for this release, due to \"issues\" with the implementation");
|
||||
//CoreEAX.eaxSet(CoreEAX.LISTENER_GUID, property, source, listener.eaxListenerProperties, EAXListenerProperties.EAXLISTENERPROPERTIES_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an EAX Value
|
||||
*
|
||||
* @param buffer EAXBufferProperties to set values from
|
||||
* @param property property being queried
|
||||
* @param source the source to be queried
|
||||
*/
|
||||
public static void eaxSetProperty(EAXBufferProperties buffer, int property, int source) {
|
||||
System.out.println("EAX has been disapled for this release, due to \"issues\" with the implementation");
|
||||
//CoreEAX.eaxSet(CoreEAX.BUFFER_GUID, property, source, buffer.eaxBufferProperties, EAX.getSizeOfProperty(CoreEAX.BUFFER_GUID, property));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an EAX Value
|
||||
*
|
||||
* @param listener EAXListenerProperties to set values on
|
||||
* @param property property being queried
|
||||
* @param source the source to be queried
|
||||
*/
|
||||
public static void eaxGetProperty(EAXListenerProperties listener, int property, int source) {
|
||||
System.out.println("EAX has been disapled for this release, due to \"issues\" with the implementation");
|
||||
//CoreEAX.eaxGet(CoreEAX.LISTENER_GUID, property, source, listener.eaxListenerProperties, EAX.getSizeOfProperty(CoreEAX.LISTENER_GUID, property));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an EAX Value
|
||||
*
|
||||
* @param buffer EAXBufferProperties to set values on
|
||||
* @param property property being queried
|
||||
* @param source the source to be queried
|
||||
*/
|
||||
public static void eaxGetProperty(EAXBufferProperties buffer, int property, int source) {
|
||||
System.out.println("EAX has been disapled for this release, due to \"issues\" with the implementation");
|
||||
//CoreEAX.eaxGet(CoreEAX.BUFFER_GUID, property, source, buffer.eaxBufferProperties, EAX.getSizeOfProperty(CoreEAX.BUFFER_GUID, property));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the size of the property
|
||||
*
|
||||
* @param guid Listener or Source guid
|
||||
* @param property Property to determine size of
|
||||
* @return size of property
|
||||
*/
|
||||
private static int getSizeOfProperty(int guid, int property) {
|
||||
if (guid == CoreEAX.LISTENER_GUID) {
|
||||
switch(property) {
|
||||
case EAXListenerProperties.EAXLISTENER_NONE:
|
||||
return 0;
|
||||
|
||||
/* long */
|
||||
case EAXListenerProperties.EAXLISTENER_ROOM:
|
||||
case EAXListenerProperties.EAXLISTENER_ROOMHF:
|
||||
case EAXListenerProperties.EAXLISTENER_REFLECTIONS:
|
||||
case EAXListenerProperties.EAXLISTENER_REVERB:
|
||||
|
||||
/* float */
|
||||
case EAXListenerProperties.EAXLISTENER_ROOMROLLOFFFACTOR:
|
||||
case EAXListenerProperties.EAXLISTENER_DECAYTIME:
|
||||
case EAXListenerProperties.EAXLISTENER_DECAYHFRATIO:
|
||||
case EAXListenerProperties.EAXLISTENER_REFLECTIONSDELAY:
|
||||
case EAXListenerProperties.EAXLISTENER_REVERBDELAY:
|
||||
case EAXListenerProperties.EAXLISTENER_ENVIRONMENTSIZE:
|
||||
case EAXListenerProperties.EAXLISTENER_ENVIRONMENTDIFFUSION:
|
||||
case EAXListenerProperties.EAXLISTENER_AIRABSORPTIONHF:
|
||||
|
||||
/* unsigned long */
|
||||
case EAXListenerProperties.EAXLISTENER_ENVIRONMENT:
|
||||
case EAXListenerProperties.EAXLISTENER_FLAGS:
|
||||
return 4;
|
||||
|
||||
case EAXListenerProperties.EAXLISTENER_ALLPARAMETERS:
|
||||
return EAXListenerProperties.EAXLISTENERPROPERTIES_SIZE;
|
||||
|
||||
default:
|
||||
throw new IllegalArgumentException("No such property '" + property + "'");
|
||||
|
||||
}
|
||||
} else {
|
||||
switch(property) {
|
||||
case EAXBufferProperties.EAXBUFFER_NONE:
|
||||
return 0;
|
||||
|
||||
/* long */
|
||||
case EAXBufferProperties.EAXBUFFER_DIRECT:
|
||||
case EAXBufferProperties.EAXBUFFER_DIRECTHF:
|
||||
case EAXBufferProperties.EAXBUFFER_ROOM:
|
||||
case EAXBufferProperties.EAXBUFFER_ROOMHF:
|
||||
case EAXBufferProperties.EAXBUFFER_OBSTRUCTION:
|
||||
case EAXBufferProperties.EAXBUFFER_OCCLUSION:
|
||||
case EAXBufferProperties.EAXBUFFER_OUTSIDEVOLUMEHF:
|
||||
|
||||
/* float */
|
||||
case EAXBufferProperties.EAXBUFFER_ROOMROLLOFFFACTOR:
|
||||
case EAXBufferProperties.EAXBUFFER_OBSTRUCTIONLFRATIO:
|
||||
case EAXBufferProperties.EAXBUFFER_OCCLUSIONLFRATIO:
|
||||
case EAXBufferProperties.EAXBUFFER_OCCLUSIONROOMRATIO:
|
||||
case EAXBufferProperties.EAXBUFFER_AIRABSORPTIONFACTOR:
|
||||
|
||||
/* unsigned long */
|
||||
case EAXBufferProperties.EAXBUFFER_FLAGS:
|
||||
return 4;
|
||||
|
||||
case EAXBufferProperties.EAXBUFFER_ALLPARAMETERS:
|
||||
return EAXBufferProperties.EAXBUFFERPROPERTIES_SIZE;
|
||||
|
||||
default:
|
||||
throw new IllegalArgumentException("No such property '" + property + "'");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,8 +31,6 @@
|
|||
*/
|
||||
package org.lwjgl.openal.eax;
|
||||
|
||||
import org.lwjgl.Sys;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
|
@ -93,109 +91,106 @@ public class EAXBufferProperties {
|
|||
/** modifies the behavior of properties offset */
|
||||
protected static int flags_offset;
|
||||
|
||||
public static final int NONE = 0;
|
||||
public static final int ALLPARAMETERS = 1;
|
||||
public static final int DIRECT = 2;
|
||||
public static final int DIRECTHF = 3;
|
||||
public static final int ROOM = 4;
|
||||
public static final int ROOMHF = 5;
|
||||
public static final int ROOMROLLOFFFACTOR = 6;
|
||||
public static final int OBSTRUCTION = 7;
|
||||
public static final int OBSTRUCTIONLFRATIO = 8;
|
||||
public static final int OCCLUSION = 9;
|
||||
public static final int OCCLUSIONLFRATIO = 10;
|
||||
public static final int OCCLUSIONROOMRATIO = 11;
|
||||
public static final int OUTSIDEVOLUMEHF = 12;
|
||||
public static final int AIRABSORPTIONFACTOR = 13;
|
||||
public static final int FLAGS = 14;
|
||||
public static final int EAXBUFFER_NONE = 0;
|
||||
public static final int EAXBUFFER_ALLPARAMETERS = 1;
|
||||
public static final int EAXBUFFER_DIRECT = 2;
|
||||
public static final int EAXBUFFER_DIRECTHF = 3;
|
||||
public static final int EAXBUFFER_ROOM = 4;
|
||||
public static final int EAXBUFFER_ROOMHF = 5;
|
||||
public static final int EAXBUFFER_ROOMROLLOFFFACTOR = 6;
|
||||
public static final int EAXBUFFER_OBSTRUCTION = 7;
|
||||
public static final int EAXBUFFER_OBSTRUCTIONLFRATIO = 8;
|
||||
public static final int EAXBUFFER_OCCLUSION = 9;
|
||||
public static final int EAXBUFFER_OCCLUSIONLFRATIO = 10;
|
||||
public static final int EAXBUFFER_OCCLUSIONROOMRATIO = 11;
|
||||
public static final int EAXBUFFER_OUTSIDEVOLUMEHF = 12;
|
||||
public static final int EAXBUFFER_AIRABSORPTIONFACTOR = 13;
|
||||
public static final int EAXBUFFER_FLAGS = 14;
|
||||
|
||||
/** changes take effect immediately */
|
||||
public static final int IMMEDIATE = 0x00000000;
|
||||
public static final int EAXBUFFER_IMMEDIATE = 0x00000000;
|
||||
|
||||
/** changes take effect later */
|
||||
public static final int DEFERRED = 0x80000000;
|
||||
public static final int COMMITDEFERREDSETTINGS = (NONE | IMMEDIATE);
|
||||
public static final int EAXBUFFER_DEFERRED = 0x80000000;
|
||||
public static final int EAXBUFFER_COMMITDEFERREDSETTINGS = (EAXBUFFER_NONE | EAXBUFFER_IMMEDIATE);
|
||||
|
||||
/** affects DSPROPERTY_EAXBUFFER_DIRECTHF */
|
||||
public static final int FLAGS_DIRECTHFAUTO = 0x00000001;
|
||||
public static final int EAXBUFFER_FLAGS_DIRECTHFAUTO = 0x00000001;
|
||||
|
||||
/** affects DSPROPERTY_EAXBUFFER_ROOM */
|
||||
public static final int FLAGS_ROOMAUTO = 0x00000002;
|
||||
public static final int EAXBUFFER_FLAGS_ROOMAUTO = 0x00000002;
|
||||
|
||||
/** affects DSPROPERTY_EAXBUFFER_ROOMHF */
|
||||
public static final int FLAGS_ROOMHFAUTO = 0x00000004;
|
||||
public static final int EAXBUFFER_FLAGS_ROOMHFAUTO = 0x00000004;
|
||||
|
||||
/** reserved future use */
|
||||
public static final int FLAGS_RESERVED = 0xFFFFFFF8;
|
||||
public static final int EAXBUFFER_FLAGS_RESERVED = 0xFFFFFFF8;
|
||||
|
||||
// property ranges and defaults:
|
||||
|
||||
public static final int MINDIRECT = -10000;
|
||||
public static final int MAXDIRECT = 1000;
|
||||
public static final int DEFAULTDIRECT = 0;
|
||||
public static final int EAXBUFFER_MINDIRECT = -10000;
|
||||
public static final int EAXBUFFER_MAXDIRECT = 1000;
|
||||
public static final int EAXBUFFER_DEFAULTDIRECT = 0;
|
||||
|
||||
public static final int MINDIRECTHF = -10000;
|
||||
public static final int MAXDIRECTHF = 0;
|
||||
public static final int DEFAULTDIRECTHF = 0;
|
||||
public static final int EAXBUFFER_MINDIRECTHF = -10000;
|
||||
public static final int EAXBUFFER_MAXDIRECTHF = 0;
|
||||
public static final int EAXBUFFER_DEFAULTDIRECTHF = 0;
|
||||
|
||||
public static final int MINROOM = -10000;
|
||||
public static final int MAXROOM = 1000;
|
||||
public static final int DEFAULTROOM = 0;
|
||||
public static final int EAXBUFFER_MINROOM = -10000;
|
||||
public static final int EAXBUFFER_MAXROOM = 1000;
|
||||
public static final int EAXBUFFER_DEFAULTROOM = 0;
|
||||
|
||||
public static final int MINROOMHF = -10000;
|
||||
public static final int MAXROOMHF = 0;
|
||||
public static final int DEFAULTROOMHF = 0;
|
||||
public static final int EAXBUFFER_MINROOMHF = -10000;
|
||||
public static final int EAXBUFFER_MAXROOMHF = 0;
|
||||
public static final int EAXBUFFER_DEFAULTROOMHF = 0;
|
||||
|
||||
public static final float MINROOMROLLOFFFACTOR = 0.0f;
|
||||
public static final float MAXROOMROLLOFFFACTOR = 10.f;
|
||||
public static final float DEFAULTROOMROLLOFFFACTOR = 0.0f;
|
||||
public static final float EAXBUFFER_MINROOMROLLOFFFACTOR = 0.0f;
|
||||
public static final float EAXBUFFER_MAXROOMROLLOFFFACTOR = 10.f;
|
||||
public static final float EAXBUFFER_DEFAULTROOMROLLOFFFACTOR = 0.0f;
|
||||
|
||||
public static final int MINOBSTRUCTION = -10000;
|
||||
public static final int MAXOBSTRUCTION = 0;
|
||||
public static final int DEFAULTOBSTRUCTION = 0;
|
||||
public static final int EAXBUFFER_MINOBSTRUCTION = -10000;
|
||||
public static final int EAXBUFFER_MAXOBSTRUCTION = 0;
|
||||
public static final int EAXBUFFER_DEFAULTOBSTRUCTION = 0;
|
||||
|
||||
public static final float MINOBSTRUCTIONLFRATIO = 0.0f;
|
||||
public static final float MAXOBSTRUCTIONLFRATIO = 1.0f;
|
||||
public static final float DEFAULTOBSTRUCTIONLFRATIO = 0.0f;
|
||||
public static final float EAXBUFFER_MINOBSTRUCTIONLFRATIO = 0.0f;
|
||||
public static final float EAXBUFFER_MAXOBSTRUCTIONLFRATIO = 1.0f;
|
||||
public static final float EAXBUFFER_DEFAULTOBSTRUCTIONLFRATIO = 0.0f;
|
||||
|
||||
public static final int MINOCCLUSION = -10000;
|
||||
public static final int MAXOCCLUSION = 0;
|
||||
public static final int DEFAULTOCCLUSION = 0;
|
||||
public static final int EAXBUFFER_MINOCCLUSION = -10000;
|
||||
public static final int EAXBUFFER_MAXOCCLUSION = 0;
|
||||
public static final int EAXBUFFER_DEFAULTOCCLUSION = 0;
|
||||
|
||||
public static final float MINOCCLUSIONLFRATIO = 0.0f;
|
||||
public static final float MAXOCCLUSIONLFRATIO = 1.0f;
|
||||
public static final float DEFAULTOCCLUSIONLFRATIO = 0.25f;
|
||||
public static final float EAXBUFFER_MINOCCLUSIONLFRATIO = 0.0f;
|
||||
public static final float EAXBUFFER_MAXOCCLUSIONLFRATIO = 1.0f;
|
||||
public static final float EAXBUFFER_DEFAULTOCCLUSIONLFRATIO = 0.25f;
|
||||
|
||||
public static final float MINOCCLUSIONROOMRATIO = 0.0f;
|
||||
public static final float MAXOCCLUSIONROOMRATIO = 10.0f;
|
||||
public static final float DEFAULTOCCLUSIONROOMRATIO = 0.5f;
|
||||
public static final float EAXBUFFER_MINOCCLUSIONROOMRATIO = 0.0f;
|
||||
public static final float EAXBUFFER_MAXOCCLUSIONROOMRATIO = 10.0f;
|
||||
public static final float EAXBUFFER_DEFAULTOCCLUSIONROOMRATIO = 0.5f;
|
||||
|
||||
public static final int MINOUTSIDEVOLUMEHF = -10000;
|
||||
public static final int MAXOUTSIDEVOLUMEHF = 0;
|
||||
public static final int DEFAULTOUTSIDEVOLUMEHF = 0;
|
||||
public static final int EAXBUFFER_MINOUTSIDEVOLUMEHF = -10000;
|
||||
public static final int EAXBUFFER_MAXOUTSIDEVOLUMEHF = 0;
|
||||
public static final int EAXBUFFER_DEFAULTOUTSIDEVOLUMEHF = 0;
|
||||
|
||||
public static final float MINAIRABSORPTIONFACTOR = 0.0f;
|
||||
public static final float MAXAIRABSORPTIONFACTOR = 10.0f;
|
||||
public static final float DEFAULTAIRABSORPTIONFACTOR = 1.0f;
|
||||
public static final float EAXBUFFER_MINAIRABSORPTIONFACTOR = 0.0f;
|
||||
public static final float EAXBUFFER_MAXAIRABSORPTIONFACTOR = 10.0f;
|
||||
public static final float EAXBUFFER_DEFAULTAIRABSORPTIONFACTOR = 1.0f;
|
||||
|
||||
public static final int DEFAULTFLAGS = (FLAGS_DIRECTHFAUTO |
|
||||
FLAGS_ROOMAUTO |
|
||||
FLAGS_ROOMHFAUTO);
|
||||
public static final int EAXBUFFER_DEFAULTFLAGS = ( EAXBUFFER_FLAGS_DIRECTHFAUTO |
|
||||
EAXBUFFER_FLAGS_ROOMAUTO |
|
||||
EAXBUFFER_FLAGS_ROOMHFAUTO);
|
||||
|
||||
static {
|
||||
System.loadLibrary(org.lwjgl.Sys.getLibraryName());
|
||||
EAXBUFFERPROPERTIES_SIZE = sizeOfEaxBufferProperties();
|
||||
assignOffsets();
|
||||
System.loadLibrary(org.lwjgl.Sys.getLibraryName());
|
||||
EAXBUFFERPROPERTIES_SIZE = sizeOfEaxBufferProperties();
|
||||
assignOffsets();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of EAXBufferProperties
|
||||
*/
|
||||
public EAXBufferProperties() {
|
||||
eaxBufferProperties = ByteBuffer.allocateDirect(EAXBUFFERPROPERTIES_SIZE);
|
||||
eaxBufferProperties.order(ByteOrder.nativeOrder());
|
||||
eaxBufferProperties = ByteBuffer.allocateDirect(EAXBUFFERPROPERTIES_SIZE);
|
||||
eaxBufferProperties.order(ByteOrder.nativeOrder());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retireves the direct path level
|
||||
*
|
||||
|
@ -430,17 +425,10 @@ public class EAXBufferProperties {
|
|||
eaxBufferProperties.putInt(flags_offset, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the address of this EAXBufferProperties
|
||||
*/
|
||||
public int getAddress() {
|
||||
return Sys.getDirectBufferAddress(eaxBufferProperties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the size of the containing ByteBuffer
|
||||
*/
|
||||
public int getSize() {
|
||||
public static int getSize() {
|
||||
return EAXBUFFERPROPERTIES_SIZE;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
*/
|
||||
package org.lwjgl.openal.eax;
|
||||
|
||||
import org.lwjgl.Sys;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
|
@ -94,124 +92,120 @@ public class EAXListenerProperties {
|
|||
/** modifies the behavior of properties offset */
|
||||
protected static int flags_offset;
|
||||
|
||||
public static final int NONE = 0;
|
||||
public static final int ALLPARAMETERS = 1;
|
||||
public static final int ROOM = 2;
|
||||
public static final int ROOMHF = 3;
|
||||
public static final int ROOMROLLOFFFACTOR = 4;
|
||||
public static final int DECAYTIME = 5;
|
||||
public static final int DECAYHFRATIO = 6;
|
||||
public static final int REFLECTIONS = 7;
|
||||
public static final int REFLECTIONSDELAY = 8;
|
||||
public static final int REVERB = 9;
|
||||
public static final int REVERBDELAY = 10;
|
||||
public static final int ENVIRONMENT = 11;
|
||||
public static final int ENVIRONMENTSIZE = 12;
|
||||
public static final int ENVIRONMENTDIFFUSION = 13;
|
||||
public static final int AIRABSORPTIONHF = 14;
|
||||
public static final int FLAGS = 15;
|
||||
public static final int EAXLISTENER_NONE = 0;
|
||||
public static final int EAXLISTENER_ALLPARAMETERS = 1;
|
||||
public static final int EAXLISTENER_ROOM = 2;
|
||||
public static final int EAXLISTENER_ROOMHF = 3;
|
||||
public static final int EAXLISTENER_ROOMROLLOFFFACTOR = 4;
|
||||
public static final int EAXLISTENER_DECAYTIME = 5;
|
||||
public static final int EAXLISTENER_DECAYHFRATIO = 6;
|
||||
public static final int EAXLISTENER_REFLECTIONS = 7;
|
||||
public static final int EAXLISTENER_REFLECTIONSDELAY = 8;
|
||||
public static final int EAXLISTENER_REVERB = 9;
|
||||
public static final int EAXLISTENER_REVERBDELAY = 10;
|
||||
public static final int EAXLISTENER_ENVIRONMENT = 11;
|
||||
public static final int EAXLISTENER_ENVIRONMENTSIZE = 12;
|
||||
public static final int EAXLISTENER_ENVIRONMENTDIFFUSION = 13;
|
||||
public static final int EAXLISTENER_AIRABSORPTIONHF = 14;
|
||||
public static final int EAXLISTENER_FLAGS = 15;
|
||||
|
||||
/** changes take effect immediately */
|
||||
public static final int IMMEDIATE = 0x00000000;
|
||||
public static final int EAXLISTENER_IMMEDIATE = 0x00000000;
|
||||
|
||||
/** changes take effect later */
|
||||
public static final int DEFERRED = 0x80000000;
|
||||
public static final int EAXLISTENER_DEFERRED = 0x80000000;
|
||||
|
||||
public static final int COMMITDEFERREDSETTINGS = (NONE | IMMEDIATE);
|
||||
public static final int EAXLISTENER_COMMITDEFERREDSETTINGS = (EAXLISTENER_NONE | EAXLISTENER_IMMEDIATE);
|
||||
|
||||
/** reverberation decay time */
|
||||
public static final int FLAGS_DECAYTIMESCALE = 0x00000001;
|
||||
public static final int EAXLISTENERFLAGS_DECAYTIMESCALE = 0x00000001;
|
||||
|
||||
/** reflection level */
|
||||
public static final int FLAGS_REFLECTIONSSCALE = 0x00000002;
|
||||
public static final int EAXLISTENERFLAGS_REFLECTIONSSCALE = 0x00000002;
|
||||
|
||||
/** initial reflection delay time */
|
||||
public static final int FLAGS_REFLECTIONSDELAYSCALE = 0x00000004;
|
||||
public static final int EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE = 0x00000004;
|
||||
|
||||
/** reflections level */
|
||||
public static final int FLAGS_REVERBSCALE = 0x00000008;
|
||||
public static final int EAXLISTENERFLAGS_REVERBSCALE = 0x00000008;
|
||||
|
||||
/** late reverberation delay time */
|
||||
public static final int FLAGS_REVERBDELAYSCALE = 0x00000010;
|
||||
public static final int EAXLISTENERFLAGS_REVERBDELAYSCALE = 0x00000010;
|
||||
|
||||
/** This flag limits high-frequency decay time according to air absorption. */
|
||||
public static final int FLAGS_DECAYHFLIMIT = 0x00000020;
|
||||
public static final int EAXLISTENERFLAGS_DECAYHFLIMIT = 0x00000020;
|
||||
|
||||
/** reserved future use */
|
||||
public static final int FLAGS_RESERVED = 0xFFFFFFC0;
|
||||
public static final int EAXLISTENERFLAGS_RESERVED = 0xFFFFFFC0;
|
||||
|
||||
// property ranges and defaults:
|
||||
public static final int MINROOM = -10000;
|
||||
public static final int MAXROOM = 0;
|
||||
public static final int DEFAULTROOM = -1000;
|
||||
public static final int EAXLISTENER_MINROOM = -10000;
|
||||
public static final int EAXLISTENER_MAXROOM = 0;
|
||||
public static final int EAXLISTENER_DEFAULTROOM = -1000;
|
||||
|
||||
public static final int MINROOMHF = -10000;
|
||||
public static final int MAXROOMHF = 0;
|
||||
public static final int DEFAULTROOMHF = -100;
|
||||
public static final int EAXLISTENER_MINROOMHF = -10000;
|
||||
public static final int EAXLISTENER_MAXROOMHF = 0;
|
||||
public static final int EAXLISTENER_DEFAULTROOMHF = -100;
|
||||
|
||||
public static final float MINROOMROLLOFFFACTOR = 0.0f;
|
||||
public static final float MAXROOMROLLOFFFACTOR = 10.0f;
|
||||
public static final float DEFAULTROOMROLLOFFFACTOR = 0.0f;
|
||||
public static final float EAXLISTENER_MINROOMROLLOFFFACTOR = 0.0f;
|
||||
public static final float EAXLISTENER_MAXROOMROLLOFFFACTOR = 10.0f;
|
||||
public static final float EAXLISTENER_DEFAULTROOMROLLOFFFACTOR = 0.0f;
|
||||
|
||||
public static final float MINDECAYTIME = 0.1f;
|
||||
public static final float MAXDECAYTIME = 20.0f;
|
||||
public static final float DEFAULTDECAYTIME = 1.49f;
|
||||
public static final float EAXLISTENER_MINDECAYTIME = 0.1f;
|
||||
public static final float EAXLISTENER_MAXDECAYTIME = 20.0f;
|
||||
public static final float EAXLISTENER_DEFAULTDECAYTIME = 1.49f;
|
||||
|
||||
public static final float MINDECAYHFRATIO = 0.1f;
|
||||
public static final float MAXDECAYHFRATIO = 2.0f;
|
||||
public static final float DEFAULTDECAYHFRATIO = 0.83f;
|
||||
public static final float EAXLISTENER_MINDECAYHFRATIO = 0.1f;
|
||||
public static final float EAXLISTENER_MAXDECAYHFRATIO = 2.0f;
|
||||
public static final float EAXLISTENER_DEFAULTDECAYHFRATIO = 0.83f;
|
||||
|
||||
public static final int MINREFLECTIONS = -10000;
|
||||
public static final int MAXREFLECTIONS = 1000;
|
||||
public static final int DEFAULTREFLECTIONS = -2602;
|
||||
public static final int EAXLISTENER_MINREFLECTIONS = -10000;
|
||||
public static final int EAXLISTENER_MAXREFLECTIONS = 1000;
|
||||
public static final int EAXLISTENER_DEFAULTREFLECTIONS = -2602;
|
||||
|
||||
public static final float MINREFLECTIONSDELAY = 0.0f;
|
||||
public static final float MAXREFLECTIONSDELAY = 0.3f;
|
||||
public static final float DEFAULTREFLECTIONSDELAY = 0.007f;
|
||||
public static final float EAXLISTENER_MINREFLECTIONSDELAY = 0.0f;
|
||||
public static final float EAXLISTENER_MAXREFLECTIONSDELAY = 0.3f;
|
||||
public static final float EAXLISTENER_DEFAULTREFLECTIONSDELAY = 0.007f;
|
||||
|
||||
public static final int MINREVERB = -10000;
|
||||
public static final int MAXREVERB = 2000;
|
||||
public static final int DEFAULTREVERB = 200;
|
||||
public static final int EAXLISTENER_MINREVERB = -10000;
|
||||
public static final int EAXLISTENER_MAXREVERB = 2000;
|
||||
public static final int EAXLISTENER_DEFAULTREVERB = 200;
|
||||
|
||||
public static final float MINREVERBDELAY = 0.0f;
|
||||
public static final float MAXREVERBDELAY = 0.1f;
|
||||
public static final float DEFAULTREVERBDELAY = 0.011f;
|
||||
public static final float EAXLISTENER_MINREVERBDELAY = 0.0f;
|
||||
public static final float EAXLISTENER_MAXREVERBDELAY = 0.1f;
|
||||
public static final float EAXLISTENER_DEFAULTREVERBDELAY = 0.011f;
|
||||
|
||||
public static final int MINENVIRONMENT = 0;
|
||||
public static final int MAXENVIRONMENT = (EAX.ENVIRONMENT_COUNT-1);
|
||||
public static final int DEFAULTENVIRONMENT = EAX.ENVIRONMENT_GENERIC;
|
||||
public static final int EAXLISTENER_MINENVIRONMENT = 0;
|
||||
public static final int EAXLISTENER_MAXENVIRONMENT = (EAX.EAX_ENVIRONMENT_COUNT-1);
|
||||
public static final int EAXLISTENER_DEFAULTENVIRONMENT = EAX.EAX_ENVIRONMENT_GENERIC;
|
||||
|
||||
public static final float MINENVIRONMENTSIZE = 1.0f;
|
||||
public static final float MAXENVIRONMENTSIZE = 100.0f;
|
||||
public static final float DEFAULTENVIRONMENTSIZE = 7.5f;
|
||||
public static final float EAXLISTENER_MINENVIRONMENTSIZE = 1.0f;
|
||||
public static final float EAXLISTENER_MAXENVIRONMENTSIZE = 100.0f;
|
||||
public static final float EAXLISTENER_DEFAULTENVIRONMENTSIZE = 7.5f;
|
||||
|
||||
public static final float MINENVIRONMENTDIFFUSION = 0.0f;
|
||||
public static final float MAXENVIRONMENTDIFFUSION = 1.0f;
|
||||
public static final float DEFAULTENVIRONMENTDIFFUSION = 1.0f;
|
||||
public static final float EAXLISTENER_MINENVIRONMENTDIFFUSION = 0.0f;
|
||||
public static final float EAXLISTENER_MAXENVIRONMENTDIFFUSION = 1.0f;
|
||||
public static final float EAXLISTENER_DEFAULTENVIRONMENTDIFFUSION = 1.0f;
|
||||
|
||||
public static final float MINAIRABSORPTIONHF = -100.0f;
|
||||
public static final float MAXAIRABSORPTIONHF = 0.0f;
|
||||
public static final float DEFAULTAIRABSORPTIONHF = -5.0f;
|
||||
public static final float EAXLISTENER_MINAIRABSORPTIONHF = -100.0f;
|
||||
public static final float EAXLISTENER_MAXAIRABSORPTIONHF = 0.0f;
|
||||
public static final float EAXLISTENER_DEFAULTAIRABSORPTIONHF = -5.0f;
|
||||
|
||||
public static final int DEFAULTFLAGS = (FLAGS_DECAYTIMESCALE |
|
||||
FLAGS_REFLECTIONSSCALE |
|
||||
FLAGS_REFLECTIONSDELAYSCALE |
|
||||
FLAGS_REVERBSCALE |
|
||||
FLAGS_REVERBDELAYSCALE |
|
||||
FLAGS_DECAYHFLIMIT);
|
||||
|
||||
public static final int EAXLISTENER_DEFAULTFLAGS = ( EAXLISTENERFLAGS_DECAYTIMESCALE |
|
||||
EAXLISTENERFLAGS_REFLECTIONSSCALE |
|
||||
EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE |
|
||||
EAXLISTENERFLAGS_REVERBSCALE |
|
||||
EAXLISTENERFLAGS_REVERBDELAYSCALE |
|
||||
EAXLISTENERFLAGS_DECAYHFLIMIT);
|
||||
static {
|
||||
System.loadLibrary(org.lwjgl.Sys.getLibraryName());
|
||||
EAXLISTENERPROPERTIES_SIZE = sizeOfEaxListenerProperties();
|
||||
assignOffsets();
|
||||
System.loadLibrary(org.lwjgl.Sys.getLibraryName());
|
||||
EAXLISTENERPROPERTIES_SIZE = sizeOfEaxListenerProperties();
|
||||
assignOffsets();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of EAXBufferProperties
|
||||
*/
|
||||
public EAXListenerProperties() {
|
||||
eaxListenerProperties = ByteBuffer.allocateDirect(EAXLISTENERPROPERTIES_SIZE);
|
||||
eaxListenerProperties.order(ByteOrder.nativeOrder());
|
||||
eaxListenerProperties = ByteBuffer.allocateDirect(EAXLISTENERPROPERTIES_SIZE);
|
||||
eaxListenerProperties.order(ByteOrder.nativeOrder());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -466,13 +460,6 @@ public class EAXListenerProperties {
|
|||
eaxListenerProperties.putInt(flags_offset, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the address of this EAXBufferProperties
|
||||
*/
|
||||
public int getAddress() {
|
||||
return Sys.getDirectBufferAddress(eaxListenerProperties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the size of the containing ByteBuffer
|
||||
*/
|
||||
|
|
|
@ -52,9 +52,6 @@ public class ControllerCreationTest {
|
|||
/** OpenGL instance */
|
||||
private GL gl;
|
||||
|
||||
/** GLU instance */
|
||||
private GLU glu;
|
||||
|
||||
/** position of quad to draw */
|
||||
private Vector2f position = new Vector2f(320.0f, 240.0f);
|
||||
|
||||
|
@ -65,7 +62,7 @@ public class ControllerCreationTest {
|
|||
public ControllerCreationTest() {
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
private void initialize(boolean fullscreen) {
|
||||
// find first display mode that allows us 640*480*16
|
||||
DisplayMode[] modes = Display.getAvailableDisplayModes();
|
||||
for (int i = 0; i < modes.length; i++) {
|
||||
|
@ -75,18 +72,17 @@ public class ControllerCreationTest {
|
|||
displayMode = modes[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// create display and opengl
|
||||
setupDisplay(false);
|
||||
}
|
||||
|
||||
private void setupDisplay(boolean fullscreen) {
|
||||
}
|
||||
|
||||
try {
|
||||
gl = new GL("ControllerCreationTest", 50, 50, 640, 480, 16, 0, 0, 0);
|
||||
if(fullscreen) {
|
||||
Display.setDisplayMode(displayMode);
|
||||
gl = new GL("MouseCreationTest", 16, 0, 0, 0);
|
||||
} else {
|
||||
gl = new GL("MouseCreationTest", 50, 50, 640, 480, 16, 0, 0, 0);
|
||||
}
|
||||
gl.create();
|
||||
|
||||
glu = new GLU(gl);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.exit(-1);
|
||||
|
@ -94,14 +90,14 @@ public class ControllerCreationTest {
|
|||
|
||||
initializeOpenGL();
|
||||
}
|
||||
|
||||
|
||||
private void initializeOpenGL() {
|
||||
gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glu.ortho2D(0.0, Display.getWidth(), 0, Display.getHeight());
|
||||
GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
GLU.gluOrtho2D(0.0, 640, 0, 480);
|
||||
}
|
||||
|
||||
public void executeTest() {
|
||||
initialize();
|
||||
initialize(false);
|
||||
|
||||
System.out.println("Test ready:\n");
|
||||
|
||||
|
@ -121,7 +117,13 @@ public class ControllerCreationTest {
|
|||
System.out.println("success");
|
||||
|
||||
System.out.print("Entering fullscreen mode...");
|
||||
setupDisplay(true);
|
||||
try {
|
||||
gl.destroy();
|
||||
initialize(true);
|
||||
Display.setDisplayMode(displayMode);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("success");
|
||||
|
||||
|
||||
|
@ -197,24 +199,24 @@ public class ControllerCreationTest {
|
|||
}
|
||||
|
||||
private void render() {
|
||||
gl.clear(GL.COLOR_BUFFER_BIT);
|
||||
GL.glClear(GL.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
gl.pushMatrix();
|
||||
gl.begin(GL.POLYGON);
|
||||
GL.glPushMatrix();
|
||||
GL.glBegin(GL.GL_POLYGON);
|
||||
{
|
||||
gl.color3f(0.0f, 1.0f, 1.0f);
|
||||
gl.vertex2f(position.x + 0.0f, position.y + 0.0f);
|
||||
GL.glColor3f(0.0f, 1.0f, 1.0f);
|
||||
GL.glVertex2f(position.x + 0.0f, position.y + 0.0f);
|
||||
|
||||
gl.color3f(1.0f, 0.0f, 1.0f);
|
||||
gl.vertex2f(position.x + 0.0f, position.y + 30.0f);
|
||||
gl.vertex2f(position.x + 40.0f, position.y + 30.0f);
|
||||
GL.glColor3f(1.0f, 0.0f, 1.0f);
|
||||
GL.glVertex2f(position.x + 0.0f, position.y + 30.0f);
|
||||
GL.glVertex2f(position.x + 40.0f, position.y + 30.0f);
|
||||
|
||||
gl.color3f(1.0f, 1.0f, 0.0f);
|
||||
gl.vertex2f(position.x + 60.0f, position.y + 15.f);
|
||||
gl.vertex2f(position.x + 40.0f, position.y + 0.0f);
|
||||
GL.glColor3f(1.0f, 1.0f, 0.0f);
|
||||
GL.glVertex2f(position.x + 60.0f, position.y + 15.f);
|
||||
GL.glVertex2f(position.x + 40.0f, position.y + 0.0f);
|
||||
}
|
||||
gl.end();
|
||||
gl.popMatrix();
|
||||
GL.glEnd();
|
||||
GL.glPopMatrix();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -80,8 +80,6 @@ public class ControllerTest {
|
|||
try {
|
||||
gl = new GL("ControllerTest", 50, 50, 640, 480, 16, 0, 0, 0);
|
||||
gl.create();
|
||||
|
||||
glu = new GLU(gl);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.exit(-1);
|
||||
|
@ -91,8 +89,8 @@ public class ControllerTest {
|
|||
}
|
||||
|
||||
private void initializeOpenGL() {
|
||||
gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glu.ortho2D(0.0, 640, 0, 480);
|
||||
GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
GLU.gluOrtho2D(0.0, 640, 0, 480);
|
||||
}
|
||||
|
||||
public void executeTest() {
|
||||
|
@ -172,9 +170,9 @@ public class ControllerTest {
|
|||
}
|
||||
|
||||
private void render() {
|
||||
gl.clear(GL.COLOR_BUFFER_BIT);
|
||||
GL.glClear(GL.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
gl.begin(GL.POLYGON);
|
||||
GL.glBegin(GL.GL_POLYGON);
|
||||
{
|
||||
float color = 1.0f;
|
||||
int buttonDown = 0;
|
||||
|
@ -185,15 +183,15 @@ public class ControllerTest {
|
|||
System.out.println("Button " + i + " down");
|
||||
}
|
||||
}
|
||||
gl.color3f(color, color, color);
|
||||
GL.glColor3f(color, color, color);
|
||||
|
||||
gl.vertex2f(position.x + 0.0f, position.y + 0.0f);
|
||||
gl.vertex2f(position.x + 0.0f, position.y + 30.0f);
|
||||
gl.vertex2f(position.x + 40.0f, position.y + 30.0f);
|
||||
gl.vertex2f(position.x + 60.0f, position.y + 15.f);
|
||||
gl.vertex2f(position.x + 40.0f, position.y + 0.0f);
|
||||
GL.glVertex2f(position.x + 0.0f, position.y + 0.0f);
|
||||
GL.glVertex2f(position.x + 0.0f, position.y + 30.0f);
|
||||
GL.glVertex2f(position.x + 40.0f, position.y + 30.0f);
|
||||
GL.glVertex2f(position.x + 60.0f, position.y + 15.f);
|
||||
GL.glVertex2f(position.x + 40.0f, position.y + 0.0f);
|
||||
}
|
||||
gl.end();
|
||||
GL.glEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -85,7 +85,6 @@ public class HWCursorTest {
|
|||
// start of in windowed mode
|
||||
gl = new GL("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
|
||||
gl.create();
|
||||
glu = new GLU(gl);
|
||||
|
||||
glInit();
|
||||
|
||||
|
@ -139,7 +138,7 @@ public class HWCursorTest {
|
|||
try {
|
||||
if ((Mouse.getNativeCursorCaps() | Mouse.CURSOR_ANIMATION) == 0)
|
||||
num_images = 1;
|
||||
cursor = new Cursor(Mouse.getMaxCursorSize(), Mouse.getMaxCursorSize(), Mouse.getMaxCursorSize()/2, Mouse.getMaxCursorSize()/2, num_images, Sys.getDirectBufferAddress(cursor_images), Sys.getDirectBufferAddress(delays));
|
||||
cursor = new Cursor(Mouse.getMaxCursorSize(), Mouse.getMaxCursorSize(), Mouse.getMaxCursorSize()/2, Mouse.getMaxCursorSize()/2, num_images, cursor_images, delays);
|
||||
Mouse.setNativeCursor(cursor);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -186,23 +185,23 @@ public class HWCursorTest {
|
|||
*/
|
||||
private void render() {
|
||||
//clear background
|
||||
gl.clear(GL.COLOR_BUFFER_BIT);
|
||||
GL.glClear(GL.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// draw white quad
|
||||
gl.pushMatrix();
|
||||
GL.glPushMatrix();
|
||||
{
|
||||
gl.translatef(mouse_x, 600 - mouse_y, 0);
|
||||
gl.color3f(1.0f, 1.0f, 1.0f);
|
||||
gl.begin(GL.QUADS);
|
||||
GL.glTranslatef(mouse_x, 600 - mouse_y, 0);
|
||||
GL.glColor3f(1.0f, 1.0f, 1.0f);
|
||||
GL.glBegin(GL.GL_QUADS);
|
||||
{
|
||||
gl.vertex2i(-50, -50);
|
||||
gl.vertex2i(50, -50);
|
||||
gl.vertex2i(50, 50);
|
||||
gl.vertex2i(-50, 50);
|
||||
GL.glVertex2i(-50, -50);
|
||||
GL.glVertex2i(50, -50);
|
||||
GL.glVertex2i(50, 50);
|
||||
GL.glVertex2i(-50, 50);
|
||||
}
|
||||
gl.end();
|
||||
GL.glEnd();
|
||||
}
|
||||
gl.popMatrix();
|
||||
GL.glPopMatrix();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -236,8 +235,7 @@ public class HWCursorTest {
|
|||
Display.setDisplayMode(mode);
|
||||
gl = new GL("Test", mode.bpp, 0, 0, 0);
|
||||
gl.create();
|
||||
glu = new GLU(gl);
|
||||
|
||||
|
||||
glInit();
|
||||
|
||||
Keyboard.create();
|
||||
|
@ -264,7 +262,6 @@ public class HWCursorTest {
|
|||
Display.resetDisplayMode();
|
||||
gl = new GL("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
|
||||
gl.create();
|
||||
glu = new GLU(gl);
|
||||
|
||||
glInit();
|
||||
|
||||
|
@ -336,15 +333,15 @@ public class HWCursorTest {
|
|||
private void glInit() {
|
||||
// Go into orthographic projection mode.
|
||||
gl.determineAvailableExtensions();
|
||||
gl.matrixMode(GL.PROJECTION);
|
||||
gl.loadIdentity();
|
||||
glu.ortho2D(0, mode.width, 0, mode.height);
|
||||
gl.matrixMode(GL.MODELVIEW);
|
||||
gl.loadIdentity();
|
||||
gl.viewport(0, 0, mode.width, mode.height);
|
||||
GL.glMatrixMode(GL.GL_PROJECTION);
|
||||
GL.glLoadIdentity();
|
||||
GLU.gluOrtho2D(0, mode.width, 0, mode.height);
|
||||
GL.glMatrixMode(GL.GL_MODELVIEW);
|
||||
GL.glLoadIdentity();
|
||||
GL.glViewport(0, 0, mode.width, mode.height);
|
||||
|
||||
//set clear color to black
|
||||
gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
//sync frame (only works on windows)
|
||||
if (GL.WGL_EXT_swap_control) {
|
||||
|
|
|
@ -84,7 +84,6 @@ public class KeyboardTest {
|
|||
gl = new GL("KeyboardTest", 50, 50, 640, 480, 16, 0, 0, 0);
|
||||
gl.create();
|
||||
|
||||
glu = new GLU(gl);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.exit(-1);
|
||||
|
@ -94,8 +93,8 @@ public class KeyboardTest {
|
|||
}
|
||||
|
||||
private void initializeOpenGL() {
|
||||
gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glu.ortho2D(0.0, 640, 0, 480);
|
||||
GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
GLU.gluOrtho2D(0.0, 640, 0, 480);
|
||||
}
|
||||
|
||||
public void executeTest() {
|
||||
|
@ -195,21 +194,21 @@ public class KeyboardTest {
|
|||
}
|
||||
|
||||
private void render() {
|
||||
gl.clear(GL.COLOR_BUFFER_BIT);
|
||||
GL.glClear(GL.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
gl.begin(GL.POLYGON);
|
||||
GL.glBegin(GL.GL_POLYGON);
|
||||
{
|
||||
float color = 1.0f;
|
||||
int buttonDown = 0;
|
||||
gl.color3f(color, color, color);
|
||||
GL.glColor3f(color, color, color);
|
||||
|
||||
gl.vertex2f(position.x + 0.0f, position.y + 0.0f);
|
||||
gl.vertex2f(position.x + 0.0f, position.y + 30.0f);
|
||||
gl.vertex2f(position.x + 40.0f, position.y + 30.0f);
|
||||
gl.vertex2f(position.x + 60.0f, position.y + 15.f);
|
||||
gl.vertex2f(position.x + 40.0f, position.y + 0.0f);
|
||||
GL.glVertex2f(position.x + 0.0f, position.y + 0.0f);
|
||||
GL.glVertex2f(position.x + 0.0f, position.y + 30.0f);
|
||||
GL.glVertex2f(position.x + 40.0f, position.y + 30.0f);
|
||||
GL.glVertex2f(position.x + 60.0f, position.y + 15.f);
|
||||
GL.glVertex2f(position.x + 40.0f, position.y + 0.0f);
|
||||
}
|
||||
gl.end();
|
||||
GL.glEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -86,7 +86,6 @@ public class MouseCreationTest {
|
|||
}
|
||||
gl.create();
|
||||
|
||||
glu = new GLU(gl);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.exit(-1);
|
||||
|
@ -96,8 +95,8 @@ public class MouseCreationTest {
|
|||
}
|
||||
|
||||
private void initializeOpenGL() {
|
||||
gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glu.ortho2D(0.0, 640, 0, 480);
|
||||
GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
GLU.gluOrtho2D(0.0, 640, 0, 480);
|
||||
}
|
||||
|
||||
public void executeTest() {
|
||||
|
@ -205,9 +204,9 @@ public class MouseCreationTest {
|
|||
}
|
||||
|
||||
private void render() {
|
||||
gl.clear(GL.COLOR_BUFFER_BIT);
|
||||
GL.glClear(GL.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
gl.begin(GL.POLYGON);
|
||||
GL.glBegin(GL.GL_POLYGON);
|
||||
{
|
||||
float color = 1.0f;
|
||||
int buttonDown = 0;
|
||||
|
@ -218,15 +217,15 @@ public class MouseCreationTest {
|
|||
break;
|
||||
}
|
||||
}
|
||||
gl.color3f(color, color, color);
|
||||
GL.glColor3f(color, color, color);
|
||||
|
||||
gl.vertex2f(position.x + 0.0f, position.y + 0.0f);
|
||||
gl.vertex2f(position.x + 0.0f, position.y + 30.0f);
|
||||
gl.vertex2f(position.x + 40.0f, position.y + 30.0f);
|
||||
gl.vertex2f(position.x + 60.0f, position.y + 15.f);
|
||||
gl.vertex2f(position.x + 40.0f, position.y + 0.0f);
|
||||
GL.glVertex2f(position.x + 0.0f, position.y + 0.0f);
|
||||
GL.glVertex2f(position.x + 0.0f, position.y + 30.0f);
|
||||
GL.glVertex2f(position.x + 40.0f, position.y + 30.0f);
|
||||
GL.glVertex2f(position.x + 60.0f, position.y + 15.f);
|
||||
GL.glVertex2f(position.x + 40.0f, position.y + 0.0f);
|
||||
}
|
||||
gl.end();
|
||||
GL.glEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -81,7 +81,6 @@ public class MouseTest {
|
|||
gl = new GL("MouseTest", 50, 50, 640, 480, 16, 0, 0, 0);
|
||||
gl.create();
|
||||
|
||||
glu = new GLU(gl);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.exit(-1);
|
||||
|
@ -91,8 +90,8 @@ public class MouseTest {
|
|||
}
|
||||
|
||||
private void initializeOpenGL() {
|
||||
gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glu.ortho2D(0.0, 640, 0, 480);
|
||||
GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
GLU.gluOrtho2D(0.0, 640, 0, 480);
|
||||
}
|
||||
|
||||
public void executeTest() {
|
||||
|
@ -159,9 +158,9 @@ public class MouseTest {
|
|||
}
|
||||
|
||||
private void render() {
|
||||
gl.clear(GL.COLOR_BUFFER_BIT);
|
||||
GL.glClear(GL.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
gl.begin(GL.POLYGON);
|
||||
GL.glBegin(GL.GL_POLYGON);
|
||||
{
|
||||
float color = 1.0f;
|
||||
int buttonDown = 0;
|
||||
|
@ -172,15 +171,15 @@ public class MouseTest {
|
|||
break;
|
||||
}
|
||||
}
|
||||
gl.color3f(color, color, color);
|
||||
GL.glColor3f(color, color, color);
|
||||
|
||||
gl.vertex2f(position.x + 0.0f, position.y + 0.0f);
|
||||
gl.vertex2f(position.x + 0.0f, position.y + 30.0f);
|
||||
gl.vertex2f(position.x + 40.0f, position.y + 30.0f);
|
||||
gl.vertex2f(position.x + 60.0f, position.y + 15.f);
|
||||
gl.vertex2f(position.x + 40.0f, position.y + 0.0f);
|
||||
GL.glVertex2f(position.x + 0.0f, position.y + 0.0f);
|
||||
GL.glVertex2f(position.x + 0.0f, position.y + 30.0f);
|
||||
GL.glVertex2f(position.x + 40.0f, position.y + 30.0f);
|
||||
GL.glVertex2f(position.x + 60.0f, position.y + 15.f);
|
||||
GL.glVertex2f(position.x + 40.0f, position.y + 0.0f);
|
||||
}
|
||||
gl.end();
|
||||
GL.glEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
package org.lwjgl.test.openal;
|
||||
|
||||
import org.lwjgl.openal.ALC;
|
||||
import org.lwjgl.Sys;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
@ -46,15 +45,11 @@ import java.nio.IntBuffer;
|
|||
*/
|
||||
public class ALCTest extends BasicTest {
|
||||
|
||||
/** instance of alc */
|
||||
private ALC alc;
|
||||
|
||||
/**
|
||||
* Creates an instance of ALCTest
|
||||
*/
|
||||
public ALCTest() {
|
||||
super();
|
||||
alc = al.getALC();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,34 +57,34 @@ public class ALCTest extends BasicTest {
|
|||
*/
|
||||
protected void execute(String[] args) {
|
||||
//error stuff
|
||||
int lastError = ALC.NO_ERROR;
|
||||
int lastError = ALC.ALC_NO_ERROR;
|
||||
|
||||
//create attribute list for context creation
|
||||
IntBuffer buffer = createIntBuffer(7);
|
||||
|
||||
if ((lastError = alc.getError()) != ALC.NO_ERROR) {
|
||||
System.out.println("ALC Error: " + alc.getString(lastError));
|
||||
if ((lastError = ALC.alcGetError()) != ALC.ALC_NO_ERROR) {
|
||||
System.out.println("ALC Error: " + ALC.alcGetString(lastError));
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
//query
|
||||
System.out.println(
|
||||
"DEFAULT_DEVICE_SPECIFIER: "
|
||||
+ alc.getString(ALC.DEFAULT_DEVICE_SPECIFIER));
|
||||
+ ALC.alcGetString(ALC.ALC_DEFAULT_DEVICE_SPECIFIER));
|
||||
System.out.println(
|
||||
"DEVICE_SPECIFIER: " + alc.getString(ALC.DEVICE_SPECIFIER));
|
||||
System.out.println("EXTENSIONS: " + alc.getString(ALC.EXTENSIONS));
|
||||
"DEVICE_SPECIFIER: " + ALC.alcGetString(ALC.ALC_DEVICE_SPECIFIER));
|
||||
System.out.println("EXTENSIONS: " + ALC.alcGetString(ALC.ALC_EXTENSIONS));
|
||||
|
||||
//mo query
|
||||
buffer.rewind();
|
||||
alc.getIntegerv(
|
||||
ALC.MAJOR_VERSION,
|
||||
ALC.alcGetIntegerv(
|
||||
ALC.ALC_MAJOR_VERSION,
|
||||
4,
|
||||
Sys.getDirectBufferAddress(buffer));
|
||||
alc.getIntegerv(
|
||||
ALC.MINOR_VERSION,
|
||||
buffer);
|
||||
ALC.alcGetIntegerv(
|
||||
ALC.ALC_MINOR_VERSION,
|
||||
4,
|
||||
Sys.getDirectBufferAddress(buffer) + 4);
|
||||
((IntBuffer)buffer.position(4)).slice());
|
||||
|
||||
System.out.println("ALC_MAJOR_VERSION: " + buffer.get(0));
|
||||
System.out.println("ALC_MINOR_VERSION: " + buffer.get(1));
|
||||
|
@ -100,7 +95,7 @@ public class ALCTest extends BasicTest {
|
|||
//get an enumerstion value
|
||||
System.out.println(
|
||||
"Value of ALC_MAJOR_VERSION: "
|
||||
+ alc.getEnumValue("ALC_MAJOR_VERSION"));
|
||||
+ ALC.alcGetEnumValue("ALC_MAJOR_VERSION"));
|
||||
|
||||
alExit();
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,11 +32,11 @@
|
|||
package org.lwjgl.test.openal;
|
||||
|
||||
import org.lwjgl.openal.AL;
|
||||
import org.lwjgl.openal.ALC;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
|
@ -47,55 +47,62 @@ import java.nio.IntBuffer;
|
|||
* @version $Revision$
|
||||
*/
|
||||
public abstract class BasicTest {
|
||||
|
||||
/** OpenAL instance */
|
||||
protected AL al;
|
||||
|
||||
/** OpenALC instance */
|
||||
protected ALC alc;
|
||||
|
||||
/**
|
||||
* Creates an instance of PlayTest
|
||||
*/
|
||||
public BasicTest() {
|
||||
al = new AL();
|
||||
try {
|
||||
al.create();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shutdowns OpenAL
|
||||
*/
|
||||
protected void alExit() {
|
||||
al.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an integer buffer to hold specified ints
|
||||
* - strictly a utility method
|
||||
*
|
||||
* @param size how many int to contain
|
||||
* @return created IntBuffer
|
||||
*/
|
||||
protected IntBuffer createIntBuffer(int size) {
|
||||
ByteBuffer temp = ByteBuffer.allocateDirect(4*size);
|
||||
temp.order(ByteOrder.nativeOrder());
|
||||
|
||||
return temp.asIntBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Exits the test NOW, printing errorcode to stdout
|
||||
*
|
||||
* @param error Error code causing exit
|
||||
*/
|
||||
protected void exit(int error) {
|
||||
System.out.println("OpenAL Error: " + al.getString(error));
|
||||
alExit();
|
||||
System.exit(-1);
|
||||
|
||||
/**
|
||||
* Creates an instance of PlayTest
|
||||
*/
|
||||
public BasicTest() {
|
||||
try {
|
||||
AL.create();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shutdowns OpenAL
|
||||
*/
|
||||
protected void alExit() {
|
||||
AL.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an integer buffer to hold specified ints
|
||||
* - strictly a utility method
|
||||
*
|
||||
* @param size how many int to contain
|
||||
* @return created IntBuffer
|
||||
*/
|
||||
protected IntBuffer createIntBuffer(int size) {
|
||||
ByteBuffer temp = ByteBuffer.allocateDirect(4 * size);
|
||||
temp.order(ByteOrder.nativeOrder());
|
||||
|
||||
return temp.asIntBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a float buffer to hold specified floats
|
||||
* - strictly a utility method
|
||||
*
|
||||
* @param size how many floats to contain
|
||||
* @return created FloatBuffer
|
||||
*/
|
||||
protected FloatBuffer createFloatBuffer(int size) {
|
||||
ByteBuffer temp = ByteBuffer.allocateDirect(4 * size);
|
||||
temp.order(ByteOrder.nativeOrder());
|
||||
|
||||
return temp.asFloatBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Exits the test NOW, printing errorcode to stdout
|
||||
*
|
||||
* @param error Error code causing exit
|
||||
*/
|
||||
protected void exit(int error) {
|
||||
System.out.println("OpenAL Error: " + AL.alGetString(error));
|
||||
alExit();
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
|
@ -54,16 +54,14 @@ public class EAXTest extends BasicTest {
|
|||
* Runs the actual test, using supplied arguments
|
||||
*/
|
||||
protected void execute(String[] args) {
|
||||
EAX eax = new EAX();
|
||||
try {
|
||||
eax.create();
|
||||
System.out.print("Testing EAX support...");
|
||||
EAX.create();
|
||||
System.out.println("supported!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
System.out.println("no supported!");
|
||||
}
|
||||
System.out.print("EAX supported...");
|
||||
|
||||
//no errorchecking from now on, since our context is gone.
|
||||
//shutdown
|
||||
alExit();
|
||||
|
||||
|
|
|
@ -34,10 +34,10 @@ package org.lwjgl.test.openal;
|
|||
import org.lwjgl.openal.AL;
|
||||
import org.lwjgl.openal.eax.*;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.Sys;
|
||||
import org.lwjgl.opengl.GL;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
|
@ -77,11 +77,10 @@ public class MovingSoundTest extends BasicTest {
|
|||
|
||||
|
||||
int lastError;
|
||||
float sourcex = 0.0f, sourcey = 0.0f, sourcez = 0.0f;
|
||||
float listenerx = 0.0f, listenery = 0.0f, listenerz = 0.0f;
|
||||
FloatBuffer sourcePosition = createFloatBuffer(3);
|
||||
FloatBuffer listenerPosition = createFloatBuffer(3);
|
||||
boolean eaxApplied = false;
|
||||
IntBuffer Env = null;
|
||||
EAXBufferProperties eaxBufferProp = null;
|
||||
EAXListenerProperties eaxListenerProp = null;
|
||||
|
||||
//initialize keyboard
|
||||
try {
|
||||
|
@ -96,13 +95,13 @@ public class MovingSoundTest extends BasicTest {
|
|||
IntBuffer sources = createIntBuffer(1);
|
||||
|
||||
// al generate buffers and sources
|
||||
al.genBuffers(1, Sys.getDirectBufferAddress(buffers));
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alGenBuffers(1, buffers);
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
al.genSources(1, Sys.getDirectBufferAddress(sources));
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alGenSources(1, sources);
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
|
@ -110,13 +109,13 @@ public class MovingSoundTest extends BasicTest {
|
|||
WaveData wavefile = WaveData.create(args[0]);
|
||||
|
||||
//copy to buffers
|
||||
al.bufferData(
|
||||
AL.alBufferData(
|
||||
buffers.get(0),
|
||||
wavefile.format,
|
||||
Sys.getDirectBufferAddress(wavefile.data),
|
||||
wavefile.data,
|
||||
wavefile.data.capacity(),
|
||||
wavefile.samplerate);
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
|
@ -124,36 +123,32 @@ public class MovingSoundTest extends BasicTest {
|
|||
wavefile.dispose();
|
||||
|
||||
//set up source input
|
||||
al.sourcei(sources.get(0), AL.BUFFER, buffers.get(0));
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alSourcei(sources.get(0), AL.AL_BUFFER, buffers.get(0));
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
al.sourcef(sources.get(0), AL.REFERENCE_DISTANCE, 1024.0f);
|
||||
al.sourcef(sources.get(0), AL.ROLLOFF_FACTOR, 0.5f);
|
||||
AL.alSourcef(sources.get(0), AL.AL_REFERENCE_DISTANCE, 1024.0f);
|
||||
AL.alSourcef(sources.get(0), AL.AL_ROLLOFF_FACTOR, 0.5f);
|
||||
|
||||
//lets loop the sound
|
||||
al.sourcei(sources.get(0), AL.LOOPING, AL.TRUE);
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alSourcei(sources.get(0), AL.AL_LOOPING, AL.AL_TRUE);
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
//play source 0
|
||||
al.sourcePlay(sources.get(0));
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alSourcePlay(sources.get(0));
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
//setup EAX if possible
|
||||
EAX eax = null;
|
||||
if (al.isExtensionPresent("EAX")) {
|
||||
eax = new EAX();
|
||||
if (AL.alIsExtensionPresent("EAX")) {
|
||||
try {
|
||||
eax.create();
|
||||
Env = createIntBuffer(1);
|
||||
eaxBufferProp = new EAXBufferProperties();
|
||||
EAX.create();
|
||||
eaxListenerProp = new EAXListenerProperties();
|
||||
} catch (Exception e) {
|
||||
eax = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,46 +160,36 @@ public class MovingSoundTest extends BasicTest {
|
|||
Keyboard.poll();
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_LEFT)) {
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
|
||||
listenerx -= MOVEMENT;
|
||||
al.listener3f(AL.POSITION, listenerx, listenery, listenerz);
|
||||
System.out.println("listenerx: " + listenerx);
|
||||
listenerPosition.put(0, listenerPosition.get(0) - MOVEMENT);
|
||||
AL.alListenerfv(AL.AL_POSITION, listenerPosition);
|
||||
System.out.println("listenerx: " + listenerPosition.get(0));
|
||||
} else {
|
||||
sourcex -= MOVEMENT;
|
||||
al.source3f(sources.get(0), AL.POSITION, sourcex, sourcey, sourcez);
|
||||
System.out.println("sourcex: " + sourcex);
|
||||
sourcePosition.put(0, sourcePosition.get(0) - MOVEMENT);
|
||||
AL.alSourcefv(sources.get(0), AL.AL_POSITION, sourcePosition);
|
||||
System.out.println("sourcex: " + sourcePosition.get(0));
|
||||
}
|
||||
}
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) {
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
|
||||
listenerx += MOVEMENT;
|
||||
al.listener3f(AL.POSITION, listenerx, listenery, listenerz);
|
||||
System.out.println("listenerx: " + listenerx);
|
||||
listenerPosition.put(0, listenerPosition.get(0) + MOVEMENT);
|
||||
AL.alListenerfv(AL.AL_POSITION, listenerPosition);
|
||||
System.out.println("listenerx: " + listenerPosition.get(0));
|
||||
} else {
|
||||
sourcex += MOVEMENT;
|
||||
al.source3f(sources.get(0), AL.POSITION, sourcex, sourcey, sourcez);
|
||||
System.out.println("sourcex: " + sourcex);
|
||||
sourcePosition.put(0, sourcePosition.get(0) + MOVEMENT);
|
||||
AL.alSourcefv(sources.get(0), AL.AL_POSITION, sourcePosition);
|
||||
System.out.println("sourcex: " + sourcePosition.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_E)) {
|
||||
if(eax != null) {
|
||||
if(eaxApplied) {
|
||||
Env.put(0, EAX.ENVIRONMENT_GENERIC);
|
||||
eax.eaxSet( EAX.LISTENER_GUID,
|
||||
EAXListenerProperties.ENVIRONMENT,
|
||||
0,
|
||||
Sys.getDirectBufferAddress(Env),
|
||||
4);
|
||||
eaxListenerProp.setEnvironment(EAX.EAX_ENVIRONMENT_GENERIC);
|
||||
EAX.eaxSetProperty(eaxListenerProp, EAXListenerProperties.EAXLISTENER_ENVIRONMENT, 0);
|
||||
} else {
|
||||
Env.put(0, EAX.ENVIRONMENT_HANGAR);
|
||||
eax.eaxSet( EAX.LISTENER_GUID,
|
||||
EAXListenerProperties.ENVIRONMENT,
|
||||
0,
|
||||
Sys.getDirectBufferAddress(Env),
|
||||
4);
|
||||
eaxListenerProp.setEnvironment(EAX.EAX_ENVIRONMENT_HANGAR);
|
||||
EAX.eaxSetProperty(eaxListenerProp, EAXListenerProperties.EAXLISTENER_ENVIRONMENT, 0);
|
||||
}
|
||||
eaxApplied = !eaxApplied;
|
||||
}
|
||||
}
|
||||
|
||||
if(gl.isCloseRequested()) {
|
||||
|
@ -218,19 +203,19 @@ public class MovingSoundTest extends BasicTest {
|
|||
}
|
||||
|
||||
//stop source 0
|
||||
al.sourceStop(sources.get(0));
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alSourceStop(sources.get(0));
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
//delete buffers and sources
|
||||
al.deleteSources(1, Sys.getDirectBufferAddress(sources));
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alDeleteSources(1, sources);
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
al.deleteBuffers(1, Sys.getDirectBufferAddress(buffers));
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alDeleteBuffers(1, buffers);
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,10 +31,7 @@
|
|||
*/
|
||||
package org.lwjgl.test.openal;
|
||||
|
||||
import org.lwjgl.Sys;
|
||||
|
||||
import org.lwjgl.openal.AL;
|
||||
import org.lwjgl.openal.ALC;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
@ -51,22 +48,15 @@ import java.nio.IntBuffer;
|
|||
*/
|
||||
public class OpenALCreationTest {
|
||||
|
||||
/** OpenAL instance */
|
||||
protected AL al;
|
||||
|
||||
/** OpenAL Context instance */
|
||||
protected ALC alc;
|
||||
|
||||
/**
|
||||
* Creates an instance of OpenALCreationTest
|
||||
*/
|
||||
public OpenALCreationTest() {
|
||||
al = new AL();
|
||||
}
|
||||
|
||||
public void alInitialize() {
|
||||
try {
|
||||
al.create();
|
||||
AL.create();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
|
@ -74,7 +64,7 @@ public class OpenALCreationTest {
|
|||
}
|
||||
|
||||
public void alExit() {
|
||||
al.destroy();
|
||||
AL.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -97,7 +87,7 @@ public class OpenALCreationTest {
|
|||
* @param error Error code causing exit
|
||||
*/
|
||||
protected void exit(int error) {
|
||||
System.out.println("OpenAL Error: " + al.getString(error));
|
||||
System.out.println("OpenAL Error: " + AL.alGetString(error));
|
||||
alExit();
|
||||
System.exit(-1);
|
||||
}
|
||||
|
@ -133,7 +123,6 @@ public class OpenALCreationTest {
|
|||
System.out.print("shutdown...");
|
||||
alExit();
|
||||
System.out.println("success");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -147,13 +136,13 @@ public class OpenALCreationTest {
|
|||
IntBuffer sources = createIntBuffer(1);
|
||||
|
||||
// al generate buffers and sources
|
||||
al.genBuffers(1, Sys.getDirectBufferAddress(buffers));
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alGenBuffers(1, buffers);
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
al.genSources(1, Sys.getDirectBufferAddress(sources));
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alGenSources(1, sources);
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
|
@ -161,13 +150,13 @@ public class OpenALCreationTest {
|
|||
WaveData wavefile = WaveData.create("Footsteps.wav");
|
||||
|
||||
//copy to buffers
|
||||
al.bufferData(
|
||||
AL.alBufferData(
|
||||
buffers.get(0),
|
||||
wavefile.format,
|
||||
Sys.getDirectBufferAddress(wavefile.data),
|
||||
wavefile.data,
|
||||
wavefile.data.capacity(),
|
||||
wavefile.samplerate);
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
|
@ -175,20 +164,20 @@ public class OpenALCreationTest {
|
|||
wavefile.dispose();
|
||||
|
||||
//set up source input
|
||||
al.sourcei(sources.get(0), AL.BUFFER, buffers.get(0));
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alSourcei(sources.get(0), AL.AL_BUFFER, buffers.get(0));
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
//lets loop the sound
|
||||
al.sourcei(sources.get(0), AL.LOOPING, AL.TRUE);
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alSourcei(sources.get(0), AL.AL_LOOPING, AL.AL_TRUE);
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
//play source 0
|
||||
al.sourcePlay(sources.get(0));
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alSourcePlay(sources.get(0));
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
|
@ -201,19 +190,19 @@ public class OpenALCreationTest {
|
|||
System.out.println("done");
|
||||
|
||||
//stop source 0
|
||||
al.sourceStop(sources.get(0));
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alSourceStop(sources.get(0));
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
//delete buffers and sources
|
||||
al.deleteSources(1, Sys.getDirectBufferAddress(sources));
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alDeleteSources(1, sources);
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
al.deleteBuffers(1, Sys.getDirectBufferAddress(buffers));
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alDeleteBuffers(1, buffers);
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
*/
|
||||
package org.lwjgl.test.openal;
|
||||
|
||||
import org.lwjgl.Sys;
|
||||
import org.lwjgl.openal.AL;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
@ -70,13 +69,13 @@ public class PlayTest extends BasicTest {
|
|||
IntBuffer sources = createIntBuffer(1);
|
||||
|
||||
// al generate buffers and sources
|
||||
al.genBuffers(1, Sys.getDirectBufferAddress(buffers));
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alGenBuffers(1, buffers);
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
al.genSources(1, Sys.getDirectBufferAddress(sources));
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alGenSources(1, sources);
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
|
@ -84,8 +83,8 @@ public class PlayTest extends BasicTest {
|
|||
WaveData wavefile = WaveData.create(args[0]);
|
||||
|
||||
//copy to buffers
|
||||
al.bufferData(buffers.get(0), wavefile.format, Sys.getDirectBufferAddress(wavefile.data), wavefile.data.capacity(), wavefile.samplerate);
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alBufferData(buffers.get(0), wavefile.format, wavefile.data, wavefile.data.capacity(), wavefile.samplerate);
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
|
@ -93,20 +92,20 @@ public class PlayTest extends BasicTest {
|
|||
wavefile.dispose();
|
||||
|
||||
//set up source input
|
||||
al.sourcei(sources.get(0), AL.BUFFER, buffers.get(0));
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alSourcei(sources.get(0), AL.AL_BUFFER, buffers.get(0));
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
//lets loop the sound
|
||||
al.sourcei(sources.get(0), AL.LOOPING, AL.TRUE);
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alSourcei(sources.get(0), AL.AL_LOOPING, AL.AL_TRUE);
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
//play source 0
|
||||
al.sourcePlay(sources.get(0));
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alSourcePlay(sources.get(0));
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
|
@ -118,19 +117,19 @@ public class PlayTest extends BasicTest {
|
|||
}
|
||||
|
||||
//stop source 0
|
||||
al.sourceStop(sources.get(0));
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alSourceStop(sources.get(0));
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
//delete buffers and sources
|
||||
al.deleteSources(1, Sys.getDirectBufferAddress(sources));
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alDeleteSources(1, sources);
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
al.deleteBuffers(1, Sys.getDirectBufferAddress(buffers));
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alDeleteBuffers(1, buffers);
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
*/
|
||||
package org.lwjgl.test.openal;
|
||||
|
||||
import org.lwjgl.Sys;
|
||||
import org.lwjgl.openal.AL;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
|
@ -74,13 +73,13 @@ public class PlayTestMemory extends BasicTest {
|
|||
IntBuffer sources = createIntBuffer(1);
|
||||
|
||||
// al generate buffers and sources
|
||||
al.genBuffers(1, Sys.getDirectBufferAddress(buffers));
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alGenBuffers(1, buffers);
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
al.genSources(1, Sys.getDirectBufferAddress(sources));
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alGenSources(1, sources);
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
|
@ -96,8 +95,8 @@ public class PlayTestMemory extends BasicTest {
|
|||
|
||||
|
||||
//copy to buffers
|
||||
al.bufferData(buffers.get(0), wavefile.format, Sys.getDirectBufferAddress(wavefile.data), wavefile.data.capacity(), wavefile.samplerate);
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alBufferData(buffers.get(0), wavefile.format, wavefile.data, wavefile.data.capacity(), wavefile.samplerate);
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
|
@ -105,20 +104,20 @@ public class PlayTestMemory extends BasicTest {
|
|||
wavefile.dispose();
|
||||
|
||||
//set up source input
|
||||
al.sourcei(sources.get(0), AL.BUFFER, buffers.get(0));
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alSourcei(sources.get(0), AL.AL_BUFFER, buffers.get(0));
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
//lets loop the sound
|
||||
al.sourcei(sources.get(0), AL.LOOPING, AL.TRUE);
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alSourcei(sources.get(0), AL.AL_LOOPING, AL.AL_TRUE);
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
//play source 0
|
||||
al.sourcePlay(sources.get(0));
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alSourcePlay(sources.get(0));
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
|
@ -130,19 +129,19 @@ public class PlayTestMemory extends BasicTest {
|
|||
}
|
||||
|
||||
//stop source 0
|
||||
al.sourceStop(sources.get(0));
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alSourceStop(sources.get(0));
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
//delete buffers and sources
|
||||
al.deleteSources(1, Sys.getDirectBufferAddress(sources));
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alDeleteSources(1, sources);
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
al.deleteBuffers(1, Sys.getDirectBufferAddress(buffers));
|
||||
if((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
AL.alDeleteBuffers(1, buffers);
|
||||
if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
exit(lastError);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.test.openal;
|
||||
|
||||
import org.lwjgl.Sys;
|
||||
import org.lwjgl.openal.AL;
|
||||
import org.lwjgl.openal.OpenALException;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
@ -71,11 +71,17 @@ public class SourceLimitTest extends BasicTest {
|
|||
}
|
||||
|
||||
System.out.print("Creating " + sourcesToCreate + " in one go...");
|
||||
CreateAllSources();
|
||||
try {
|
||||
CreateAllSources();
|
||||
} catch(OpenALException oale) {
|
||||
}
|
||||
|
||||
|
||||
System.out.print("Creating " + sourcesToCreate + " one at a time...");
|
||||
CreateSourcesStep();
|
||||
|
||||
try {
|
||||
CreateSourcesStep();
|
||||
} catch(Exception e) {
|
||||
}
|
||||
//shutdown
|
||||
alExit();
|
||||
}
|
||||
|
@ -90,14 +96,14 @@ public class SourceLimitTest extends BasicTest {
|
|||
IntBuffer sources = createIntBuffer(sourcesToCreate);
|
||||
|
||||
//Create sourcesToCreate sources in one fell swoop
|
||||
al.genSources(sourcesToCreate, Sys.getDirectBufferAddress(sources));
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
System.out.println("failed to create " + sourcesToCreate + " sources");
|
||||
AL.alGenSources(sourcesToCreate, sources);
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
System.out.println("failed to create " + sourcesToCreate + " sources (" + AL.alGetString(lastError) + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
//delete sources
|
||||
al.deleteSources(sourcesToCreate, Sys.getDirectBufferAddress(sources));
|
||||
AL.alDeleteSources(sourcesToCreate, sources);
|
||||
|
||||
System.out.println("created " + sourcesToCreate + " sources successfully!");
|
||||
}
|
||||
|
@ -110,24 +116,25 @@ public class SourceLimitTest extends BasicTest {
|
|||
int sourcesCreated = 0;
|
||||
|
||||
//make bytbuffer that can hold sourcesToCreate sources
|
||||
IntBuffer sources = createIntBuffer(sourcesToCreate);
|
||||
IntBuffer[] sources = new IntBuffer[sourcesToCreate];
|
||||
|
||||
//create the sources
|
||||
for (int i = 0; i < sourcesToCreate; i++) {
|
||||
al.genSources(1, Sys.getDirectBufferAddress(sources) + (i * 4));
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
for (int i = 0; i <= sourcesToCreate; i++) {
|
||||
sources[i] = createIntBuffer(1);
|
||||
AL.alGenSources(1, sources[i]);
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
System.out.println("failed to create source: " + (i + 1));
|
||||
break;
|
||||
}
|
||||
sourcesCreated++;
|
||||
}
|
||||
|
||||
|
||||
//delete allocated sources
|
||||
for (int i = 0; i < sourcesCreated; i++) {
|
||||
//delete buffers and sources
|
||||
al.deleteSources(1, Sys.getDirectBufferAddress(sources) + (i * 4));
|
||||
if ((lastError = al.getError()) != AL.NO_ERROR) {
|
||||
System.out.println("failed to delete source: " + i);
|
||||
AL.alDeleteSources(1, sources[i]);
|
||||
if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) {
|
||||
System.out.println("failed to delete source: " + i + "(" + AL.alGetString(lastError) + ")");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
*/
|
||||
package org.lwjgl.test.openal;
|
||||
|
||||
import org.lwjgl.Sys;
|
||||
import org.lwjgl.openal.AL;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
@ -80,8 +79,8 @@ public class StressTest extends BasicTest {
|
|||
|
||||
private void createSources() {
|
||||
sources = createIntBuffer(4);
|
||||
al.genSources(4, Sys.getDirectBufferAddress(sources));
|
||||
if (al.getError() != AL.NO_ERROR) {
|
||||
AL.alGenSources(4, sources);
|
||||
if (AL.alGetError() != AL.AL_NO_ERROR) {
|
||||
System.out.println("Unable to create 4 sources");
|
||||
alExit();
|
||||
}
|
||||
|
@ -89,29 +88,29 @@ public class StressTest extends BasicTest {
|
|||
|
||||
private void createBuffers() {
|
||||
buffers = createIntBuffer(10);
|
||||
al.genBuffers(10, Sys.getDirectBufferAddress(buffers));
|
||||
if (al.getError() != AL.NO_ERROR) {
|
||||
AL.alGenBuffers(10, buffers);
|
||||
if (AL.alGetError() != AL.AL_NO_ERROR) {
|
||||
System.out.println("Unable to create 10 buffers");
|
||||
al.deleteSources(4, Sys.getDirectBufferAddress(sources));
|
||||
AL.alDeleteSources(4, sources);
|
||||
alExit();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadSamples() throws Exception {
|
||||
al.getError();
|
||||
AL.alGetError();
|
||||
WaveData data = WaveData.create("ding.wav");
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
al.bufferData(
|
||||
AL.alBufferData(
|
||||
buffers.get(i - 1),
|
||||
data.format,
|
||||
Sys.getDirectBufferAddress(data.data),
|
||||
data.data,
|
||||
data.data.capacity(),
|
||||
data.samplerate);
|
||||
|
||||
if (al.getError() != AL.NO_ERROR) {
|
||||
if (AL.alGetError() != AL.AL_NO_ERROR) {
|
||||
System.out.println("Failed to load " + i + ".wav into buffer");
|
||||
al.deleteSources(4, Sys.getDirectBufferAddress(sources));
|
||||
al.deleteBuffers(10, Sys.getDirectBufferAddress(buffers));
|
||||
AL.alDeleteSources(4, sources);
|
||||
AL.alDeleteBuffers(10, buffers);
|
||||
alExit();
|
||||
}
|
||||
}
|
||||
|
@ -126,11 +125,11 @@ public class StressTest extends BasicTest {
|
|||
long startTime = System.currentTimeMillis();
|
||||
|
||||
//mark background source as looping
|
||||
al.sourcei(sources.get(0), AL.LOOPING, AL.TRUE);
|
||||
AL.alSourcei(sources.get(0), AL.AL_LOOPING, AL.AL_TRUE);
|
||||
|
||||
//play background
|
||||
al.sourcei(sources.get(0), AL.BUFFER, buffers.get(0));
|
||||
al.sourcePlay(sources.get(0));
|
||||
AL.alSourcei(sources.get(0), AL.AL_BUFFER, buffers.get(0));
|
||||
AL.alSourcePlay(sources.get(0));
|
||||
|
||||
while (System.currentTimeMillis() - startTime < (2000)) {
|
||||
|
||||
|
@ -138,22 +137,22 @@ public class StressTest extends BasicTest {
|
|||
System.out.println("random:" + randomBuffer);
|
||||
|
||||
//stop source at slot
|
||||
al.sourceStop(sources.get(nextSlot));
|
||||
if (al.getError() != AL.NO_ERROR) {
|
||||
AL.alSourceStop(sources.get(nextSlot));
|
||||
if (AL.alGetError() != AL.AL_NO_ERROR) {
|
||||
System.out.println("Error stopping source.");
|
||||
}
|
||||
System.out.println("Stopped source: " + nextSlot);
|
||||
|
||||
//link source<->buffer
|
||||
al.sourcei(sources.get(nextSlot), AL.BUFFER, buffers.get(randomBuffer));
|
||||
if (al.getError() != AL.NO_ERROR) {
|
||||
AL.alSourcei(sources.get(nextSlot), AL.AL_BUFFER, buffers.get(randomBuffer));
|
||||
if (AL.alGetError() != AL.AL_NO_ERROR) {
|
||||
System.out.println("Error linking buffer and source.");
|
||||
}
|
||||
System.out.println("linked source " + nextSlot + " with buffer " + randomBuffer);
|
||||
|
||||
//start playing
|
||||
System.out.println("playing source " + nextSlot);
|
||||
al.sourcePlay(sources.get(nextSlot++));
|
||||
AL.alSourcePlay(sources.get(nextSlot++));
|
||||
if (nextSlot == 4) {
|
||||
nextSlot = startSlot;
|
||||
}
|
||||
|
@ -176,7 +175,7 @@ public class StressTest extends BasicTest {
|
|||
|
||||
//stop all sources
|
||||
for (int i = 0; i < 4; i++) {
|
||||
al.sourceStop(sources.get(i));
|
||||
AL.alSourceStop(sources.get(i));
|
||||
System.out.println("Stopping source " + (i+1));
|
||||
}
|
||||
|
||||
|
@ -192,8 +191,8 @@ public class StressTest extends BasicTest {
|
|||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
al.deleteSources(4, Sys.getDirectBufferAddress(sources));
|
||||
al.deleteBuffers(10, Sys.getDirectBufferAddress(buffers));
|
||||
AL.alDeleteSources(4, sources);
|
||||
AL.alDeleteBuffers(10, buffers);
|
||||
}
|
||||
|
||||
private int getRandomBuffer() {
|
||||
|
|
|
@ -129,17 +129,17 @@ public class WaveData {
|
|||
int channels = 0;
|
||||
if (audioformat.getChannels() == 1) {
|
||||
if (audioformat.getSampleSizeInBits() == 8) {
|
||||
channels = AL.FORMAT_MONO8;
|
||||
channels = AL.AL_FORMAT_MONO8;
|
||||
} else if (audioformat.getSampleSizeInBits() == 16) {
|
||||
channels = AL.FORMAT_MONO16;
|
||||
channels = AL.AL_FORMAT_MONO16;
|
||||
} else {
|
||||
assert false : "Illegal sample size";
|
||||
}
|
||||
} else if (audioformat.getChannels() == 2) {
|
||||
if (audioformat.getSampleSizeInBits() == 8) {
|
||||
channels = AL.FORMAT_STEREO8;
|
||||
channels = AL.AL_FORMAT_STEREO8;
|
||||
} else if (audioformat.getSampleSizeInBits() == 16) {
|
||||
channels = AL.FORMAT_STEREO16;
|
||||
channels = AL.AL_FORMAT_STEREO16;
|
||||
} else {
|
||||
assert false : "Illegal sample size";
|
||||
}
|
||||
|
|
|
@ -98,7 +98,6 @@ public class FullScreenWindowedTest {
|
|||
// start of in windowed mode
|
||||
gl = new GL("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
|
||||
gl.create();
|
||||
glu = new GLU(gl);
|
||||
|
||||
glInit();
|
||||
|
||||
|
@ -172,24 +171,24 @@ public class FullScreenWindowedTest {
|
|||
|
||||
private void render() {
|
||||
//clear background
|
||||
gl.clear(GL.COLOR_BUFFER_BIT);
|
||||
GL.glClear(GL.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// draw white quad
|
||||
gl.pushMatrix();
|
||||
GL.glPushMatrix();
|
||||
{
|
||||
gl.translatef(quadPosition.x, quadPosition.y, 0);
|
||||
gl.rotated(angle, 0.0f, 0.0f, 1.0f);
|
||||
gl.color3f(1.0f, 1.0f, 1.0f);
|
||||
gl.begin(GL.QUADS);
|
||||
GL.glTranslatef(quadPosition.x, quadPosition.y, 0);
|
||||
GL.glRotated(angle, 0.0f, 0.0f, 1.0f);
|
||||
GL.glColor3f(1.0f, 1.0f, 1.0f);
|
||||
GL.glBegin(GL.GL_QUADS);
|
||||
{
|
||||
gl.vertex2i(-50, -50);
|
||||
gl.vertex2i(50, -50);
|
||||
gl.vertex2i(50, 50);
|
||||
gl.vertex2i(-50, 50);
|
||||
GL.glVertex2i(-50, -50);
|
||||
GL.glVertex2i(50, -50);
|
||||
GL.glVertex2i(50, 50);
|
||||
GL.glVertex2i(-50, 50);
|
||||
}
|
||||
gl.end();
|
||||
GL.glEnd();
|
||||
}
|
||||
gl.popMatrix();
|
||||
GL.glPopMatrix();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -208,7 +207,6 @@ public class FullScreenWindowedTest {
|
|||
Display.setDisplayMode(mode);
|
||||
gl = new GL("Test", mode.bpp, 0, 0, 0);
|
||||
gl.create();
|
||||
glu = new GLU(gl);
|
||||
|
||||
glInit();
|
||||
|
||||
|
@ -227,7 +225,6 @@ public class FullScreenWindowedTest {
|
|||
Display.resetDisplayMode();
|
||||
gl = new GL("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
|
||||
gl.create();
|
||||
glu = new GLU(gl);
|
||||
|
||||
glInit();
|
||||
|
||||
|
@ -314,15 +311,15 @@ public class FullScreenWindowedTest {
|
|||
private void glInit() {
|
||||
// Go into orthographic projection mode.
|
||||
gl.determineAvailableExtensions();
|
||||
gl.matrixMode(GL.PROJECTION);
|
||||
gl.loadIdentity();
|
||||
glu.ortho2D(0, mode.width, 0, mode.height);
|
||||
gl.matrixMode(GL.MODELVIEW);
|
||||
gl.loadIdentity();
|
||||
gl.viewport(0, 0, mode.width, mode.height);
|
||||
GL.glMatrixMode(GL.GL_PROJECTION);
|
||||
GL.glLoadIdentity();
|
||||
GLU.gluOrtho2D(0, mode.width, 0, mode.height);
|
||||
GL.glMatrixMode(GL.GL_MODELVIEW);
|
||||
GL.glLoadIdentity();
|
||||
GL.glViewport(0, 0, mode.width, mode.height);
|
||||
|
||||
//set clear color to black
|
||||
gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
//sync frame (only works on windows)
|
||||
if (GL.WGL_EXT_swap_control) {
|
||||
|
|
|
@ -73,7 +73,6 @@ public final class Game {
|
|||
}
|
||||
|
||||
public static final GL gl = new GL("LWJGL Game Example", 16, 0, 0,0);
|
||||
public static final GLU glu = new GLU(gl);
|
||||
static {
|
||||
try {
|
||||
gl.create();
|
||||
|
@ -150,17 +149,17 @@ public final class Game {
|
|||
* All rendering is done in here
|
||||
*/
|
||||
private static void render() {
|
||||
gl.clear(GL.COLOR_BUFFER_BIT);
|
||||
gl.pushMatrix();
|
||||
gl.translatef(Display.getWidth() / 2, Display.getHeight() / 2, 0.0f);
|
||||
gl.rotatef(angle, 0, 0, 1.0f);
|
||||
gl.begin(GL.QUADS);
|
||||
gl.vertex2i(-50, -50);
|
||||
gl.vertex2i(50, -50);
|
||||
gl.vertex2i(50, 50);
|
||||
gl.vertex2i(-50, 50);
|
||||
gl.end();
|
||||
gl.popMatrix();
|
||||
GL.glClear(GL.GL_COLOR_BUFFER_BIT);
|
||||
GL.glPushMatrix();
|
||||
GL.glTranslatef(Display.getWidth() / 2, Display.getHeight() / 2, 0.0f);
|
||||
GL.glRotatef(angle, 0, 0, 1.0f);
|
||||
GL.glBegin(GL.GL_QUADS);
|
||||
GL.glVertex2i(-50, -50);
|
||||
GL.glVertex2i(50, -50);
|
||||
GL.glVertex2i(50, 50);
|
||||
GL.glVertex2i(-50, 50);
|
||||
GL.glEnd();
|
||||
GL.glPopMatrix();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -174,16 +173,15 @@ public final class Game {
|
|||
Sys.setProcessPriority(Sys.HIGH_PRIORITY);
|
||||
System.out.println("Timer resolution: " + Sys.getTimerResolution());
|
||||
// Go into orthographic projection mode.
|
||||
gl.matrixMode(GL.PROJECTION);
|
||||
gl.loadIdentity();
|
||||
glu.ortho2D(0, Display.getWidth(), 0, Display.getHeight());
|
||||
gl.matrixMode(GL.MODELVIEW);
|
||||
gl.loadIdentity();
|
||||
gl.viewport(0, 0, Display.getWidth(), Display.getHeight());
|
||||
GL.glMatrixMode(GL.GL_PROJECTION);
|
||||
GL.glLoadIdentity();
|
||||
GLU.gluOrtho2D(0, Display.getWidth(), 0, Display.getHeight());
|
||||
GL.glMatrixMode(GL.GL_MODELVIEW);
|
||||
GL.glLoadIdentity();
|
||||
GL.glViewport(0, 0, Display.getWidth(), Display.getHeight());
|
||||
ByteBuffer num_tex_units_buf = ByteBuffer.allocateDirect(4);
|
||||
num_tex_units_buf.order(ByteOrder.nativeOrder());
|
||||
int buf_addr = Sys.getDirectBufferAddress(num_tex_units_buf);
|
||||
gl.getIntegerv(GL.MAX_TEXTURE_UNITS_ARB, buf_addr);
|
||||
GL.glGetIntegerv(GL.GL_MAX_TEXTURE_UNITS_ARB, num_tex_units_buf.asIntBuffer());
|
||||
System.out.println("Number of texture units: " + num_tex_units_buf.getInt());
|
||||
// Fix the refresh rate to the display frequency.
|
||||
// gl.wglSwapIntervalEXT(1);
|
||||
|
|
|
@ -89,7 +89,6 @@ public class Grass {
|
|||
}
|
||||
|
||||
public static final GL gl = new GL("LWJGL Grass", 50, 50, 640, 480, 16, 0, 0,0);
|
||||
public static final GLU glu = new GLU(gl);
|
||||
|
||||
static {
|
||||
try {
|
||||
|
@ -133,7 +132,7 @@ public class Grass {
|
|||
ByteBuffer byte_buf = ByteBuffer.allocateDirect(4);
|
||||
byte_buf.order(ByteOrder.nativeOrder());
|
||||
System.out.println("Vertex program supported: " + gl.NV_vertex_program);
|
||||
gl.genProgramsNV(1, Sys.getDirectBufferAddress(byte_buf));
|
||||
GL.glGenProgramsNV(1, byte_buf.asIntBuffer());
|
||||
IntBuffer int_buf = byte_buf.asIntBuffer();
|
||||
if (int_buf.get(0) == 0)
|
||||
throw new RuntimeException("Could not allocate new vertex program id!");
|
||||
|
@ -145,11 +144,11 @@ public class Grass {
|
|||
program_buf.rewind();
|
||||
program_buf.put(program);
|
||||
program_buf.rewind();
|
||||
gl.loadProgramNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glLoadProgramNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
program_handle,
|
||||
program_buf.remaining(),
|
||||
Sys.getDirectBufferAddress(program_buf));
|
||||
program_buf);
|
||||
/*gl.getIntegerv(GL.PROGRAM_ERROR_POSITION_NV, Sys.getDirectBufferAddress(int_buf));
|
||||
System.out.println("error position: " + int_buf.get(0));*/
|
||||
|
||||
|
@ -163,31 +162,31 @@ public class Grass {
|
|||
light_buf_f.rewind();
|
||||
light_buf_f.put(LightDiffuse);
|
||||
|
||||
gl.lightfv(
|
||||
GL.LIGHT0,
|
||||
GL.DIFFUSE,
|
||||
Sys.getDirectBufferAddress(light_buf_f));
|
||||
GL.glLightfv(
|
||||
GL.GL_LIGHT0,
|
||||
GL.GL_DIFFUSE,
|
||||
light_buf_f);
|
||||
light_buf_f.rewind();
|
||||
light_buf_f.put(LightPosition);
|
||||
gl.lightfv(
|
||||
GL.LIGHT0,
|
||||
GL.POSITION,
|
||||
Sys.getDirectBufferAddress(light_buf_f));
|
||||
gl.enable(GL.LIGHT0);
|
||||
GL.glLightfv(
|
||||
GL.GL_LIGHT0,
|
||||
GL.GL_POSITION,
|
||||
light_buf_f);
|
||||
GL.glEnable(GL.GL_LIGHT0);
|
||||
|
||||
gl.enable(GL.LIGHTING);
|
||||
GL.glEnable(GL.GL_LIGHTING);
|
||||
|
||||
gl.enable(GL.DEPTH_TEST);
|
||||
GL.glEnable(GL.GL_DEPTH_TEST);
|
||||
|
||||
gl.blendFunc(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA);
|
||||
gl.enable(GL.BLEND);
|
||||
GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL.glEnable(GL.GL_BLEND);
|
||||
|
||||
gl.matrixMode(GL.PROJECTION);
|
||||
glu.perspective(40.0, 1.0, 1.0, 50.0);
|
||||
GL.glMatrixMode(GL.GL_PROJECTION);
|
||||
GLU.gluPerspective(40.0, 1.0, 1.0, 50.0);
|
||||
|
||||
gl.matrixMode(GL.MODELVIEW);
|
||||
GL.glMatrixMode(GL.GL_MODELVIEW);
|
||||
|
||||
glu.lookAt(14.0, 10.0, -16.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
|
||||
GLU.gluLookAt(14.0, 10.0, -16.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
|
||||
|
||||
aslod.angle = 2.6179935f;
|
||||
aslod.value = 0.2f;
|
||||
|
@ -201,7 +200,7 @@ public class Grass {
|
|||
degree *= (0.5 + myrand());
|
||||
|
||||
ptrAnimate(degree);
|
||||
gl.clear(GL.COLOR_BUFFER_BIT | GL.DEPTH_BUFFER_BIT);
|
||||
GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
//ptrDraw();
|
||||
|
||||
|
@ -247,16 +246,16 @@ public class Grass {
|
|||
fRigid = ((fRigid = myrand()) < 0.2f) ? 0.2f : fRigid;
|
||||
|
||||
if (myrand() < 0.3)
|
||||
gl.begin(GL.LINE_STRIP);
|
||||
GL.glBegin(GL.GL_LINE_STRIP);
|
||||
else
|
||||
gl.begin(GL.QUAD_STRIP);
|
||||
GL.glBegin(GL.GL_QUAD_STRIP);
|
||||
|
||||
for (cFaces = 0; cFaces < numFaces; cFaces++) {
|
||||
for (cWidth = frndWidth;
|
||||
cWidth >= -frndWidth;
|
||||
cWidth -= (frndWidth * 2.0f)) {
|
||||
gl.color4f(fX, fRigid, fZ, (float) cFaces / (float) numFaces);
|
||||
gl.vertex3f(
|
||||
GL.glColor4f(fX, fRigid, fZ, (float) cFaces / (float) numFaces);
|
||||
GL.glVertex3f(
|
||||
(float) (((cFaces - 2) * 0.1f)
|
||||
* java.lang.Math.cos(fRotate)
|
||||
+ (cWidth) * java.lang.Math.sin(fRotate)),
|
||||
|
@ -267,7 +266,7 @@ public class Grass {
|
|||
}
|
||||
frndWidth -= fDecWidth;
|
||||
}
|
||||
gl.end();
|
||||
GL.glEnd();
|
||||
|
||||
}
|
||||
|
||||
|
@ -275,112 +274,112 @@ public class Grass {
|
|||
float cI, cJ, fArea;
|
||||
|
||||
fArea = 20.0f;
|
||||
mesh = gl.genLists(1);
|
||||
gl.newList(mesh, GL.COMPILE);
|
||||
mesh = GL.glGenLists(1);
|
||||
GL.glNewList(mesh, GL.GL_COMPILE);
|
||||
for (cI = -fArea / 2; cI < fArea / 2; cI += 0.25f) {
|
||||
for (cJ = -fArea / 2; cJ < fArea / 2; cJ += 0.25f) {
|
||||
genGrass(0.5f, 0.1f, cI, cJ);
|
||||
}
|
||||
}
|
||||
gl.endList();
|
||||
GL.glEndList();
|
||||
|
||||
}
|
||||
|
||||
private static void grsDraw() {
|
||||
gl.enable(GL.VERTEX_PROGRAM_NV);
|
||||
gl.bindProgramNV(GL.VERTEX_PROGRAM_NV, program_handle);
|
||||
gl.trackMatrixNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glEnable(GL.GL_VERTEX_PROGRAM_NV);
|
||||
GL.glBindProgramNV(GL.GL_VERTEX_PROGRAM_NV, program_handle);
|
||||
GL.glTrackMatrixNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
0,
|
||||
GL.MODELVIEW_PROJECTION_NV,
|
||||
GL.IDENTITY_NV);
|
||||
GL.GL_MODELVIEW_PROJECTION_NV,
|
||||
GL.GL_IDENTITY_NV);
|
||||
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
4,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
5,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
6,
|
||||
1.763609f,
|
||||
0.496495f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
7,
|
||||
-0.943599f,
|
||||
3.203737f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
8,
|
||||
4.101107f,
|
||||
0.943413f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
9,
|
||||
-1.218603f,
|
||||
6.259399f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
10,
|
||||
7.214299f,
|
||||
1.352961f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
11,
|
||||
-1.540748f,
|
||||
10.080958f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
12,
|
||||
10.880035f,
|
||||
1.759046f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
13,
|
||||
-1.852705f,
|
||||
14.468674f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
14,
|
||||
14.292879f,
|
||||
1.973329f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
15,
|
||||
-1.973387f,
|
||||
18.506531f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
16,
|
||||
(float) (java.lang.Math.sin(aslod.angle)
|
||||
* (aslod.value + aslod.ripple)),
|
||||
|
@ -389,54 +388,54 @@ public class Grass {
|
|||
* (aslod.value + aslod.ripple)),
|
||||
0.0f);
|
||||
|
||||
gl.programParameter4fNV(GL.VERTEX_PROGRAM_NV, 17, 1.7f, 5f, 2f, 0f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(GL.GL_VERTEX_PROGRAM_NV, 17, 1.7f, 5f, 2f, 0f);
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
18,
|
||||
-0.0187293f,
|
||||
0.074261f,
|
||||
0.2121144f,
|
||||
1.570729f);
|
||||
gl.programParameter4fNV(GL.VERTEX_PROGRAM_NV, 20, 0f, 0.5f, 1f, 0f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(GL.GL_VERTEX_PROGRAM_NV, 20, 0f, 0.5f, 1f, 0f);
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
21,
|
||||
0.25f,
|
||||
-9f,
|
||||
0.75f,
|
||||
0.1591549f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
22,
|
||||
24.9808f,
|
||||
-24.9808f,
|
||||
-60.14581f,
|
||||
60.14581f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
23,
|
||||
85.45379f,
|
||||
-85.45379f,
|
||||
-64.93935f,
|
||||
64.93935f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
24,
|
||||
19.73921f,
|
||||
-19.73921f,
|
||||
-1f,
|
||||
1f);
|
||||
gl.programParameter4fNV(GL.VERTEX_PROGRAM_NV, 25, 0f, 4f, 0f, 0f);
|
||||
gl.programParameter4fNV(
|
||||
GL.VERTEX_PROGRAM_NV,
|
||||
GL.glProgramParameter4fNV(GL.GL_VERTEX_PROGRAM_NV, 25, 0f, 4f, 0f, 0f);
|
||||
GL.glProgramParameter4fNV(
|
||||
GL.GL_VERTEX_PROGRAM_NV,
|
||||
19,
|
||||
1f,
|
||||
3.141593f,
|
||||
0.5f,
|
||||
1f);
|
||||
gl.programParameter4fNV(GL.VERTEX_PROGRAM_NV, 26, 0.7f, 0.4f, 0f, 0f);
|
||||
gl.callList(mesh);
|
||||
gl.disable(GL.VERTEX_PROGRAM_NV);
|
||||
GL.glProgramParameter4fNV(GL.GL_VERTEX_PROGRAM_NV, 26, 0.7f, 0.4f, 0f, 0f);
|
||||
GL.glCallList(mesh);
|
||||
GL.glDisable(GL.GL_VERTEX_PROGRAM_NV);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,6 @@ public class PbufferTest {
|
|||
gl = new GL("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
|
||||
// gl = new GL("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
|
||||
gl.create();
|
||||
glu = new GLU(gl);
|
||||
if ((Pbuffer.getPbufferCaps() & Pbuffer.PBUFFER_SUPPORTED) == 0) {
|
||||
System.out.println("No Pbuffer support!");
|
||||
System.exit(1);
|
||||
|
@ -189,49 +188,49 @@ public class PbufferTest {
|
|||
pbuffer.makeCurrent();
|
||||
// Pbuffer rendering
|
||||
//clear background
|
||||
gl.clear(GL.COLOR_BUFFER_BIT);
|
||||
GL.glClear(GL.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// draw white quad
|
||||
gl.pushMatrix();
|
||||
GL.glPushMatrix();
|
||||
{
|
||||
gl.translatef(quadPosition.x, quadPosition.y, 0);
|
||||
gl.rotated(angle, 0.0f, 0.0f, 1.0f);
|
||||
gl.color3f(1.0f, 1.0f, 1.0f);
|
||||
gl.begin(GL.QUADS);
|
||||
GL.glTranslatef(quadPosition.x, quadPosition.y, 0);
|
||||
GL.glRotated(angle, 0.0f, 0.0f, 1.0f);
|
||||
GL.glColor3f(1.0f, 1.0f, 1.0f);
|
||||
GL.glBegin(GL.GL_QUADS);
|
||||
{
|
||||
gl.vertex2i(-50, -50);
|
||||
gl.vertex2i(50, -50);
|
||||
gl.vertex2i(50, 50);
|
||||
gl.vertex2i(-50, 50);
|
||||
GL.glVertex2i(-50, -50);
|
||||
GL.glVertex2i(50, -50);
|
||||
GL.glVertex2i(50, 50);
|
||||
GL.glVertex2i(-50, 50);
|
||||
}
|
||||
gl.end();
|
||||
GL.glEnd();
|
||||
}
|
||||
gl.popMatrix();
|
||||
gl.copyTexImage2D(GL.TEXTURE_2D, 0, GL.RGB, 0, 0, 256, 256, 0);
|
||||
GL.glPopMatrix();
|
||||
GL.glCopyTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGB, 0, 0, 256, 256, 0);
|
||||
Pbuffer.releaseContext();
|
||||
|
||||
// OpenGL window rendering
|
||||
gl.clear(GL.COLOR_BUFFER_BIT);
|
||||
GL.glClear(GL.GL_COLOR_BUFFER_BIT);
|
||||
// draw white quad
|
||||
gl.pushMatrix();
|
||||
GL.glPushMatrix();
|
||||
{
|
||||
gl.translatef(quadPosition.x, quadPosition.y, 0);
|
||||
gl.rotated(angle, 0.0f, 0.0f, 1.0f);
|
||||
gl.color3f(1.0f, 1.0f, 0.0f);
|
||||
gl.begin(GL.QUADS);
|
||||
GL.glTranslatef(quadPosition.x, quadPosition.y, 0);
|
||||
GL.glRotated(angle, 0.0f, 0.0f, 1.0f);
|
||||
GL.glColor3f(1.0f, 1.0f, 0.0f);
|
||||
GL.glBegin(GL.GL_QUADS);
|
||||
{
|
||||
gl.texCoord2f(0f, 0f);
|
||||
gl.vertex2i(-50, -50);
|
||||
gl.texCoord2f(1f, 0f);
|
||||
gl.vertex2i(50, -50);
|
||||
gl.texCoord2f(1f, 1f);
|
||||
gl.vertex2i(50, 50);
|
||||
gl.texCoord2f(0f, 1f);
|
||||
gl.vertex2i(-50, 50);
|
||||
GL.glTexCoord2f(0f, 0f);
|
||||
GL.glVertex2i(-50, -50);
|
||||
GL.glTexCoord2f(1f, 0f);
|
||||
GL.glVertex2i(50, -50);
|
||||
GL.glTexCoord2f(1f, 1f);
|
||||
GL.glVertex2i(50, 50);
|
||||
GL.glTexCoord2f(0f, 1f);
|
||||
GL.glVertex2i(-50, 50);
|
||||
}
|
||||
gl.end();
|
||||
GL.glEnd();
|
||||
}
|
||||
gl.popMatrix();
|
||||
GL.glPopMatrix();
|
||||
}
|
||||
|
||||
private void initPbuffer() {
|
||||
|
@ -239,7 +238,7 @@ public class PbufferTest {
|
|||
pbuffer = new Pbuffer(256, 256, mode.bpp, 0, 0, 0);
|
||||
pbuffer.makeCurrent();
|
||||
initGLState(256, 256, 0.5f);
|
||||
gl.bindTexture(GL.TEXTURE_2D, tex_handle);
|
||||
GL.glBindTexture(GL.GL_TEXTURE_2D, tex_handle);
|
||||
Pbuffer.releaseContext();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -267,7 +266,6 @@ public class PbufferTest {
|
|||
gl.create();
|
||||
glInit();
|
||||
initPbuffer();
|
||||
glu = new GLU(gl);
|
||||
|
||||
Keyboard.create();
|
||||
} catch (Exception e) {
|
||||
|
@ -289,7 +287,6 @@ public class PbufferTest {
|
|||
gl.create();
|
||||
glInit();
|
||||
initPbuffer();
|
||||
glu = new GLU(gl);
|
||||
|
||||
|
||||
Keyboard.create();
|
||||
|
@ -344,7 +341,7 @@ public class PbufferTest {
|
|||
private void destroyTexture() {
|
||||
IntBuffer buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
|
||||
buffer.put(0, tex_handle);
|
||||
gl.deleteTextures(1, Sys.getDirectBufferAddress(buffer));
|
||||
GL.glDeleteTextures(1, buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -379,15 +376,15 @@ public class PbufferTest {
|
|||
}
|
||||
|
||||
private void initGLState(int width, int height, float color) {
|
||||
gl.matrixMode(GL.PROJECTION);
|
||||
gl.loadIdentity();
|
||||
glu.ortho2D(0, mode.width, 0, mode.height);
|
||||
gl.matrixMode(GL.MODELVIEW);
|
||||
gl.loadIdentity();
|
||||
gl.viewport(0, 0, width, height);
|
||||
GL.glMatrixMode(GL.GL_PROJECTION);
|
||||
GL.glLoadIdentity();
|
||||
GLU.gluOrtho2D(0, mode.width, 0, mode.height);
|
||||
GL.glMatrixMode(GL.GL_MODELVIEW);
|
||||
GL.glLoadIdentity();
|
||||
GL.glViewport(0, 0, width, height);
|
||||
|
||||
//set clear color to black
|
||||
gl.clearColor(color, color, color, 0.0f);
|
||||
GL.glClearColor(color, color, color, 0.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -400,17 +397,17 @@ public class PbufferTest {
|
|||
if (GL.WGL_EXT_swap_control) {
|
||||
GL.wglSwapIntervalEXT(1);
|
||||
}
|
||||
gl.texEnvf(GL.TEXTURE_ENV, GL.TEXTURE_ENV_MODE, GL.REPLACE);
|
||||
gl.enable(GL.TEXTURE_2D);
|
||||
GL.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE);
|
||||
GL.glEnable(GL.GL_TEXTURE_2D);
|
||||
// Create shared texture
|
||||
IntBuffer buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
|
||||
gl.genTextures(1, Sys.getDirectBufferAddress(buffer));
|
||||
GL.glGenTextures(1, buffer);
|
||||
tex_handle = buffer.get(0);
|
||||
gl.bindTexture(GL.TEXTURE_2D, tex_handle);
|
||||
gl.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_WRAP_S, GL.CLAMP);
|
||||
gl.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_WRAP_T, GL.CLAMP);
|
||||
gl.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_MIN_FILTER, GL.LINEAR);
|
||||
gl.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_MAG_FILTER, GL.LINEAR);
|
||||
GL.glBindTexture(GL.GL_TEXTURE_2D, tex_handle);
|
||||
GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP);
|
||||
GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP);
|
||||
GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
|
||||
GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
|
||||
initGLState(mode.width, mode.height, 0f);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue