lwjgl-2.7.1/0000700000175000017500000000000011543426510011707 5ustar zero79zero79lwjgl-2.7.1/platform_build/0000755000175000017500000000000011543426511014725 5ustar zero79zero79lwjgl-2.7.1/platform_build/build-applet.xml0000644000175000017500000001437111543426510020036 0ustar zero79zero79 lwjgl-2.7.1/platform_build/build-definitions.xml0000644000175000017500000001567011543426510021067 0ustar zero79zero79 lwjgl-2.7.1/platform_build/build-maven.xml0000644000175000017500000001434711543426510017662 0ustar zero79zero79 Lightweight Java Game Toolkit]]> Copyright © 2002-2010 lwjgl.org. All Rights Reserved.]]> Lightweight Java Game Toolkit]]> Copyright © 2002-2010 lwjgl.org. All Rights Reserved.]]> Lightweight Java Game Toolkit]]> Copyright © 2002-2010 lwjgl.org. All Rights Reserved.]]> lwjgl-2.7.1/platform_build/build-webstart.xml0000644000175000017500000002160311543426510020400 0ustar zero79zero79 lwjgl-2.7.1/platform_build/build-generator.xml0000644000175000017500000002633511543426510020542 0ustar zero79zero79 lwjgl-2.7.1/platform_build/linux_ant/0000755000175000017500000000000011543426510016725 5ustar zero79zero79lwjgl-2.7.1/platform_build/linux_ant/build.xml0000644000175000017500000001071111543426510020546 0ustar zero79zero79 lwjgl-2.7.1/platform_build/mingw_ant/0000755000175000017500000000000011543426510016707 5ustar zero79zero79lwjgl-2.7.1/platform_build/mingw_ant/build.xml0000644000175000017500000000432211543426510020531 0ustar zero79zero79 EXPORTS JAWT_GetAWT lwjgl-2.7.1/platform_build/windows_ant/0000755000175000017500000000000011543426510017260 5ustar zero79zero79lwjgl-2.7.1/platform_build/windows_ant/build.xml0000644000175000017500000000411511543426510021102 0ustar zero79zero79 lwjgl-2.7.1/platform_build/macosx_ant/0000755000175000017500000000000011543426510017060 5ustar zero79zero79lwjgl-2.7.1/platform_build/macosx_ant/build.xml0000644000175000017500000001040011543426510020674 0ustar zero79zero79 lwjgl-2.7.1/platform_build/macosx_ant/build-symbol-list0000644000175000017500000000020011543426510022346 0ustar zero79zero79#!/bin/sh nm -g "$1"/*.o | grep "Java_" | cut -d ' ' -f3 | cut -c 1- nm -g "$1"/*.o | grep "JNI_" | cut -d ' ' -f3 | cut -c 1- lwjgl-2.7.1/build.xml0000644000175000017500000005161711543426510013554 0ustar zero79zero79 Build aborted by user. lwjgl.java.windows.version = ${lwjgl.java.windows.version} lwjgl.native.windows.version = ${lwjgl.native.windows.version} lwjgl.java.linux.version = ${lwjgl.java.linux.version} lwjgl.native.linux.version = ${lwjgl.native.linux.version} lwjgl.java.macosx.version = ${lwjgl.java.macosx.version} lwjgl.native.macosx.version = ${lwjgl.native.macosx.version} Lightweight Java Game Toolkit]]> Copyright © 2002-2009 lwjgl.org. All Rights Reserved.]]> lwjgl-2.7.1/src/0000755000175000017500000000000011523636776012527 5ustar zero79zero79lwjgl-2.7.1/src/java/0000755000175000017500000000000011523635574013443 5ustar zero79zero79lwjgl-2.7.1/src/java/org/0000755000175000017500000000000011523635574014232 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/0000755000175000017500000000000011543426510015337 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/opencl/0000755000175000017500000000000011543426510016617 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLChecks.java0000644000175000017500000002104311543426510021101 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.LWJGLUtil; import org.lwjgl.PointerBuffer; import java.nio.ByteBuffer; import static org.lwjgl.opencl.CL10.*; import static org.lwjgl.opencl.CL11.*; /** * Utility class that provides runtime checks for OpenCL method calls. * TODO: Revisit this when Java 7.0 is released, there will be new Buffer API with 64bit indices/sizes. * * @author Spasi */ final class CLChecks { private CLChecks() { } /** * Calculates the number of bytes in the specified cl_mem buffer rectangle region. * * @param origin the host origin * @param region the rectangle region * @param row_pitch the host row pitch * @param slice_pitch the host slice pitch * * @return the region size in bytes */ static int calculateBufferRectSize(final PointerBuffer origin, final PointerBuffer region, long row_pitch, long slice_pitch) { if ( !LWJGLUtil.CHECKS ) return 0; final long x = origin.get(0); final long y = origin.get(1); final long z = origin.get(2); if ( LWJGLUtil.DEBUG && (x < 0 || y < 0 || z < 0) ) throw new IllegalArgumentException("Invalid cl_mem host origin: " + x + ", " + y + ", " + z); final long w = region.get(0); final long h = region.get(1); final long d = region.get(2); if ( LWJGLUtil.DEBUG && (w < 1 || h < 1 || d < 1) ) throw new IllegalArgumentException("Invalid cl_mem rectangle region dimensions: " + w + " x " + h + " x " + d); if ( row_pitch == 0 ) row_pitch = w; else if ( LWJGLUtil.DEBUG && row_pitch < w ) throw new IllegalArgumentException("Invalid host row pitch specified: " + row_pitch); if ( slice_pitch == 0 ) slice_pitch = row_pitch * h; else if ( LWJGLUtil.DEBUG && slice_pitch < (row_pitch * h) ) throw new IllegalArgumentException("Invalid host slice pitch specified: " + slice_pitch); return (int)((z * slice_pitch + y * row_pitch + x) + (w * h * d)); } /** * Calculates the number of bytes in the specified cl_mem image region. * This implementation assumes 1 byte per element, because we cannot the * image type. * * @param region the image region * @param row_pitch the row pitch * @param slice_pitch the slice pitch * * @return the region size in bytes */ static int calculateImageSize(final PointerBuffer region, long row_pitch, long slice_pitch) { if ( !LWJGLUtil.CHECKS ) return 0; final long w = region.get(0); final long h = region.get(1); final long d = region.get(2); if ( LWJGLUtil.DEBUG && (w < 1 || h < 1 || d < 1) ) throw new IllegalArgumentException("Invalid cl_mem image region dimensions: " + w + " x " + h + " x " + d); if ( row_pitch == 0 ) row_pitch = w; else if ( LWJGLUtil.DEBUG && row_pitch < w ) throw new IllegalArgumentException("Invalid row pitch specified: " + row_pitch); if ( slice_pitch == 0 ) slice_pitch = row_pitch * h; else if ( LWJGLUtil.DEBUG && slice_pitch < (row_pitch * h) ) throw new IllegalArgumentException("Invalid slice pitch specified: " + slice_pitch); return (int)(slice_pitch * d); } /** * Calculates the number of bytes in the specified 2D image. * * @param format the cl_image_format struct * @param w the image width * @param h the image height * @param row_pitch the image row pitch * * @return the 2D image size in bytes */ static int calculateImage2DSize(final ByteBuffer format, final long w, final long h, long row_pitch) { if ( !LWJGLUtil.CHECKS ) return 0; if ( LWJGLUtil.DEBUG && (w < 1 || h < 1) ) throw new IllegalArgumentException("Invalid 2D image dimensions: " + w + " x " + h); final int elementSize = getElementSize(format); if ( row_pitch == 0 ) row_pitch = w * elementSize; else if ( LWJGLUtil.DEBUG && ((row_pitch < w * elementSize) || (row_pitch % elementSize != 0)) ) throw new IllegalArgumentException("Invalid image_row_pitch specified: " + row_pitch); return (int)(row_pitch * h); } /** * Calculates the number of bytes in the specified 3D image. * * @param format the cl_image_format struct * @param w the image width * @param h the image height * @param d the image depth * @param row_pitch the image row pitch * @param slice_pitch the image slice pitch * * @return the 3D image size in bytes */ static int calculateImage3DSize(final ByteBuffer format, final long w, final long h, final long d, long row_pitch, long slice_pitch) { if ( !LWJGLUtil.CHECKS ) return 0; if ( LWJGLUtil.DEBUG && (w < 1 || h < 1 || d < 2) ) throw new IllegalArgumentException("Invalid 3D image dimensions: " + w + " x " + h + " x " + d); final int elementSize = getElementSize(format); if ( row_pitch == 0 ) row_pitch = w * elementSize; else if ( LWJGLUtil.DEBUG && ((row_pitch < w * elementSize) || (row_pitch % elementSize != 0)) ) throw new IllegalArgumentException("Invalid image_row_pitch specified: " + row_pitch); if ( slice_pitch == 0 ) slice_pitch = row_pitch * h; else if ( LWJGLUtil.DEBUG && ((row_pitch < row_pitch * h) || (slice_pitch % row_pitch != 0)) ) throw new IllegalArgumentException("Invalid image_slice_pitch specified: " + row_pitch); return (int)(slice_pitch * d); } /** * Returns the number of bytes per element for the specified image format. * * @param format a cl_image_format struct. * * @return the number of bytes per image element */ private static int getElementSize(final ByteBuffer format) { final int channelOrder = format.getInt(format.position() + 0); final int channelType = format.getInt(format.position() + 4); return getChannelCount(channelOrder) * getChannelSize(channelType); } /** * Returns the number of channels in the specified cl_channel_order. * * @param channelOrder the cl_channel_order * * @return the number of channels */ private static int getChannelCount(final int channelOrder) { switch ( channelOrder ) { case CL_R: case CL_A: case CL_INTENSITY: case CL_LUMINANCE: case CL_Rx: return 1; case CL_RG: case CL_RA: case CL_RGx: return 2; case CL_RGB: case CL_RGBx: return 3; case CL_RGBA: case CL_BGRA: case CL_ARGB: return 4; default: throw new IllegalArgumentException("Invalid cl_channel_order specified: " + LWJGLUtil.toHexString(channelOrder)); } } /** * Returns the number of bytes in the specified cl_channel_type. * * @param channelType the cl_channel_type * * @return the number of bytes */ private static int getChannelSize(final int channelType) { switch ( channelType ) { case CL_SNORM_INT8: case CL_UNORM_INT8: case CL_SIGNED_INT8: case CL_UNSIGNED_INT8: return 1; case CL_SNORM_INT16: case CL_UNORM_INT16: case CL_UNORM_SHORT_565: case CL_UNORM_SHORT_555: case CL_SIGNED_INT16: case CL_UNSIGNED_INT16: case CL_HALF_FLOAT: return 2; case CL_UNORM_INT_101010: case CL_SIGNED_INT32: case CL_UNSIGNED_INT32: case CL_FLOAT: return 4; default: throw new IllegalArgumentException("Invalid cl_channel_type specified: " + LWJGLUtil.toHexString(channelType)); } } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLDevice.java0000644000175000017500000001274611543426510021112 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.PointerBuffer; /** * This class is a wrapper around a cl_device_id pointer. * * @author Spasi */ public final class CLDevice extends CLObjectChild { private static final InfoUtil util = CLPlatform.getInfoUtilInstance(CLDevice.class, "CL_DEVICE_UTIL"); private final CLPlatform platform; private final CLObjectRegistry subCLDevices; private Object caps; CLDevice(final long pointer, final CLPlatform platform) { this(pointer, null, platform); } /** * EXT_device_fission constructor. * * @param pointer the sub-device pointer * @param parent the parent CLDevice */ CLDevice(final long pointer, final CLDevice parent) { this(pointer, parent, parent.getPlatform()); } CLDevice(final long pointer, final CLDevice parent, final CLPlatform platform) { super(pointer, parent); if ( isValid() ) { this.platform = platform; platform.getCLDeviceRegistry().registerObject(this); this.subCLDevices = new CLObjectRegistry(); if ( parent != null ) parent.subCLDevices.registerObject(this); } else { this.platform = null; this.subCLDevices = null; } } public CLPlatform getPlatform() { return platform; } /** * Returns a sub-device of this device. * * @param id the sub-device object id * * @return the CLDevice object */ public CLDevice getSubCLDevice(final long id) { return subCLDevices.getObject(id); } // ---------------[ UTILITY METHODS ]--------------- /** * Returns the value of the specified String parameter. * * @param param_name the parameter * * @return the parameter value */ public String getInfoString(int param_name) { return util.getInfoString(this, param_name); } /** * Returns the integer value of the specified parameter. * * @param param_name the parameter * * @return the parameter value */ public int getInfoInt(int param_name) { return util.getInfoInt(this, param_name); } /** * Returns the boolean value of the specified parameter. * * @param param_name the parameter * * @return the parameter value */ public boolean getInfoBoolean(int param_name) { return util.getInfoInt(this, param_name) != 0; } /** * Returns the size_t value of the specified parameter. * * @param param_name the parameter * * @return the parameter value */ public long getInfoSize(int param_name) { return util.getInfoSize(this, param_name); } /** * Returns an array of size_t values of the specified parameter. * * @param param_name the parameter * * @return the parameter values */ public long[] getInfoSizeArray(int param_name) { return util.getInfoSizeArray(this, param_name); } /** * Returns the long value of the specified parameter. Can be used * for both cl_ulong and cl_bitfield parameters. * * @param param_name the parameter * * @return the parameter value */ public long getInfoLong(int param_name) { return util.getInfoLong(this, param_name); } // -------[ IMPLEMENTATION STUFF BELOW ]------- void setCapabilities(final Object caps) { this.caps = caps; } Object getCapabilities() { return caps; } int retain() { if ( getParent() == null ) return getReferenceCount(); // NO-OP, root devices cannot be retained return super.retain(); } int release() { if ( getParent() == null ) return getReferenceCount(); // NO-OP, root devices cannot be released try { return super.release(); } finally { if ( !isValid() ) getParent().subCLDevices.unregisterObject(this); } } CLObjectRegistry getSubCLDeviceRegistry() { return subCLDevices; } /** * Called from clCreateSubDevicesEXT to register new sub-devices. * * @param devices a buffer containing CLDevice pointers. */ void registerSubCLDevices(final PointerBuffer devices) { for ( int i = devices.position(); i < devices.limit(); i++ ) { final long pointer = devices.get(i); if ( pointer != 0 ) new CLDevice(pointer, this); } } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLCallback.java0000644000175000017500000000376511543426510021410 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.PointerWrapperAbstract; /** * Base class for OpenCL callback objects. * * @author Spasi */ abstract class CLCallback extends PointerWrapperAbstract { private final boolean custom; protected CLCallback(final long pointer) { this(pointer, false); } protected CLCallback(final long pointer, final boolean custom) { super(pointer); this.custom = custom; } final boolean isCustom() { return custom; } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/Util.java0000644000175000017500000000506411543426510020404 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.LWJGLUtil; import java.lang.reflect.Field; import java.util.Map; /** * Utility methods for OpenCL * * @author Spasi */ public final class Util { /** Maps OpenCL error token values to their String representations. */ private static final Map CL_ERROR_TOKENS = LWJGLUtil.getClassTokens(new LWJGLUtil.TokenFilter() { public boolean accept(final Field field, final int value) { return value < 0; // Currently, all OpenCL errors have negative values. } }, null, CL10.class, CL11.class, KHRGLSharing.class, KHRICD.class, APPLEGLSharing.class, EXTDeviceFission.class); private Util() { } public static void checkCLError(final int errcode) { if ( errcode != CL10.CL_SUCCESS ) throwCLError(errcode); } private static void throwCLError(final int errcode) { String errname = CL_ERROR_TOKENS.get(errcode); if ( errname == null ) errname = "UNKNOWN"; throw new OpenCLException("Error Code: " + errname + " (" + LWJGLUtil.toHexString(errcode) + ")"); } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/InfoUtilFactory.java0000644000175000017500000005635311543426510022557 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.*; import org.lwjgl.opencl.api.CLBufferRegion; import org.lwjgl.opencl.api.CLImageFormat; import org.lwjgl.opencl.api.Filter; import org.lwjgl.opengl.Drawable; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.ArrayList; import java.util.List; import static org.lwjgl.opencl.CL10.*; import static org.lwjgl.opencl.CL10GL.*; import static org.lwjgl.opencl.CL11.*; /** * This class contains concrete InfoUtil implementations for our CLObject * class. The public CLObject classes are grabbing these via reflection, * so that they can be compiled for the generator. * * @author Spasi */ final class InfoUtilFactory { private InfoUtilFactory() {} static final InfoUtil CL_COMMAND_QUEUE_UTIL = new InfoUtilAbstract() { protected int getInfo(final CLCommandQueue object, final int param_name, final ByteBuffer param_value, final PointerBuffer param_value_size_ret) { return clGetCommandQueueInfo(object, param_name, param_value, null); } }; static final CLContext.CLContextUtil CL_CONTEXT_UTIL = new CLContextUtil(); private static final class CLContextUtil extends InfoUtilAbstract implements CLContext.CLContextUtil { protected int getInfo(final CLContext context, final int param_name, final ByteBuffer param_value, final PointerBuffer param_value_size_ret) { return clGetContextInfo(context, param_name, param_value, param_value_size_ret); } public List getInfoDevices(final CLContext context) { context.checkValid(); final int num_devices; if ( CLCapabilities.getPlatformCapabilities(context.getParent()).OpenCL11 ) num_devices = getInfoInt(context, CL_CONTEXT_NUM_DEVICES); else { final PointerBuffer size_ret = APIUtil.getBufferPointer(); clGetContextInfo(context, CL_CONTEXT_DEVICES, null, size_ret); num_devices = (int)(size_ret.get(0) / PointerBuffer.getPointerSize()); } final PointerBuffer deviceIDs = APIUtil.getBufferPointer(num_devices); clGetContextInfo(context, CL_CONTEXT_DEVICES, deviceIDs.getBuffer(), null); final List devices = new ArrayList(num_devices); for ( int i = 0; i < num_devices; i++ ) devices.add(context.getParent().getCLDevice(deviceIDs.get(i))); return devices.size() == 0 ? null : devices; } /** Custom clCreateContext implementation (reuses APIUtil.getBufferPointer) */ public CLContext create(final CLPlatform platform, final List devices, final CLContextCallback pfn_notify, final Drawable share_drawable, IntBuffer errcode_ret) throws LWJGLException { final int propertyCount = 2 + (share_drawable == null ? 0 : 4) + 1; final PointerBuffer properties = APIUtil.getBufferPointer(propertyCount + devices.size()); properties.put(CL_CONTEXT_PLATFORM).put(platform); if ( share_drawable != null ) share_drawable.setCLSharingProperties(properties); properties.put(0); properties.position(propertyCount); // Make sure we're at the right offset, setCLSharingProperties might not use all 4 positions. for ( CLDevice device : devices ) properties.put(device); final long function_pointer = CLCapabilities.clCreateContext; BufferChecks.checkFunctionAddress(function_pointer); if ( errcode_ret != null ) BufferChecks.checkBuffer(errcode_ret, 1); else if ( LWJGLUtil.DEBUG ) errcode_ret = APIUtil.getBufferInt(); final long user_data = pfn_notify == null || pfn_notify.isCustom() ? 0 : CallbackUtil.createGlobalRef(pfn_notify); CLContext __result = null; try { __result = new CLContext(nclCreateContext(properties.getBuffer(), 0, devices.size(), properties.getBuffer(), propertyCount * PointerBuffer.getPointerSize(), pfn_notify == null ? 0 : pfn_notify.getPointer(), user_data, errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), platform); if ( LWJGLUtil.DEBUG ) Util.checkCLError(errcode_ret.get(0)); return __result; } finally { CallbackUtil.registerCallback(__result, user_data); } } public CLContext createFromType(final CLPlatform platform, final long device_type, final CLContextCallback pfn_notify, final Drawable share_drawable, final IntBuffer errcode_ret) throws LWJGLException { final int propertyCount = 2 + (share_drawable == null ? 0 : 4) + 1; final PointerBuffer properties = APIUtil.getBufferPointer(propertyCount); properties.put(CL_CONTEXT_PLATFORM).put(platform); if ( share_drawable != null ) share_drawable.setCLSharingProperties(properties); properties.put(0); properties.flip(); return clCreateContextFromType(properties, device_type, pfn_notify, errcode_ret); } public List getSupportedImageFormats(final CLContext context, final long flags, final int image_type, final Filter filter) { final IntBuffer numBuffer = APIUtil.getBufferInt(); clGetSupportedImageFormats(context, flags, image_type, null, numBuffer); final int num_image_formats = numBuffer.get(0); if ( num_image_formats == 0 ) return null; final ByteBuffer formatBuffer = BufferUtils.createByteBuffer(num_image_formats * CLImageFormat.STRUCT_SIZE); clGetSupportedImageFormats(context, flags, image_type, formatBuffer, null); final List formats = new ArrayList(num_image_formats); for ( int i = 0; i < num_image_formats; i++ ) { final int offset = num_image_formats * CLImageFormat.STRUCT_SIZE; final CLImageFormat format = new CLImageFormat( formatBuffer.getInt(offset), formatBuffer.getInt(offset + 4) ); if ( filter == null || filter.accept(format) ) formats.add(format); } return formats.size() == 0 ? null : formats; } } static final InfoUtil CL_DEVICE_UTIL = new CLDeviceUtil(); private static final class CLDeviceUtil extends InfoUtilAbstract { protected int getInfo(final CLDevice device, final int param_name, final ByteBuffer param_value, final PointerBuffer param_value_size_ret) { return clGetDeviceInfo(device, param_name, param_value, param_value_size_ret); } protected int getInfoSizeArraySize(final CLDevice device, final int param_name) { switch ( param_name ) { case CL_DEVICE_MAX_WORK_ITEM_SIZES: return getInfoInt(device, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS); default: throw new IllegalArgumentException("Unsupported parameter: " + LWJGLUtil.toHexString(param_name)); } } } static final CLEvent.CLEventUtil CL_EVENT_UTIL = new CLEventUtil(); private static final class CLEventUtil extends InfoUtilAbstract implements CLEvent.CLEventUtil { protected int getInfo(final CLEvent event, final int param_name, final ByteBuffer param_value, final PointerBuffer param_value_size_ret) { return clGetEventInfo(event, param_name, param_value, param_value_size_ret); } public long getProfilingInfoLong(final CLEvent event, final int param_name) { event.checkValid(); final ByteBuffer buffer = APIUtil.getBufferByte(8); clGetEventProfilingInfo(event, param_name, buffer, null); return buffer.getLong(0); } } static final CLKernel.CLKernelUtil CL_KERNEL_UTIL = new CLKernelUtil(); private static final class CLKernelUtil extends InfoUtilAbstract implements CLKernel.CLKernelUtil { public void setArg(final CLKernel kernel, final int index, final byte value) { clSetKernelArg(kernel, index, 1, APIUtil.getBufferByte(1).put(0, value)); } public void setArg(final CLKernel kernel, final int index, final short value) { clSetKernelArg(kernel, index, 2, APIUtil.getBufferShort().put(0, value)); } public void setArg(final CLKernel kernel, final int index, final int value) { clSetKernelArg(kernel, index, 4, APIUtil.getBufferInt().put(0, value)); } public void setArg(final CLKernel kernel, final int index, final long value) { clSetKernelArg(kernel, index, 8, APIUtil.getBufferLong().put(0, value)); } public void setArg(final CLKernel kernel, final int index, final float value) { clSetKernelArg(kernel, index, 4, APIUtil.getBufferFloat().put(0, value)); } public void setArg(final CLKernel kernel, final int index, final double value) { clSetKernelArg(kernel, index, 8, APIUtil.getBufferDouble().put(0, value)); } public void setArg(final CLKernel kernel, final int index, final CLObject value) { clSetKernelArg(kernel, index, value); } public void setArgSize(final CLKernel kernel, final int index, final long size) { clSetKernelArg(kernel, index, size); } protected int getInfo(final CLKernel kernel, final int param_name, final ByteBuffer param_value, final PointerBuffer param_value_size_ret) { return clGetKernelInfo(kernel, param_name, param_value, param_value_size_ret); } public long getWorkGroupInfoSize(final CLKernel kernel, final CLDevice device, final int param_name) { device.checkValid(); final PointerBuffer buffer = APIUtil.getBufferPointer(); clGetKernelWorkGroupInfo(kernel, device, param_name, buffer.getBuffer(), null); return buffer.get(0); } public long[] getWorkGroupInfoSizeArray(final CLKernel kernel, final CLDevice device, final int param_name) { device.checkValid(); final int size; switch ( param_name ) { case CL_KERNEL_WORK_GROUP_SIZE: size = 3; break; default: throw new IllegalArgumentException("Unsupported parameter: " + LWJGLUtil.toHexString(param_name)); } final PointerBuffer buffer = APIUtil.getBufferPointer(size); clGetKernelWorkGroupInfo(kernel, device, param_name, buffer.getBuffer(), null); final long[] array = new long[size]; for ( int i = 0; i < size; i++ ) array[i] = buffer.get(i); return array; } public long getWorkGroupInfoLong(final CLKernel kernel, final CLDevice device, final int param_name) { device.checkValid(); final ByteBuffer buffer = APIUtil.getBufferByte(8); clGetKernelWorkGroupInfo(kernel, device, param_name, buffer, null); return buffer.getLong(0); } } static final CLMem.CLMemUtil CL_MEM_UTIL = new CLMemUtil(); private static final class CLMemUtil extends InfoUtilAbstract implements CLMem.CLMemUtil { protected int getInfo(final CLMem mem, final int param_name, final ByteBuffer param_value, final PointerBuffer param_value_size_ret) { return clGetMemObjectInfo(mem, param_name, param_value, param_value_size_ret); } public CLMem createImage2D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_row_pitch, final Buffer host_ptr, IntBuffer errcode_ret) { final ByteBuffer formatBuffer = APIUtil.getBufferByte(2 * 4); formatBuffer.putInt(0, image_format.getChannelOrder()); formatBuffer.putInt(4, image_format.getChannelType()); final long function_pointer = CLCapabilities.clCreateImage2D; BufferChecks.checkFunctionAddress(function_pointer); if ( errcode_ret != null ) BufferChecks.checkBuffer(errcode_ret, 1); else if ( LWJGLUtil.DEBUG ) errcode_ret = APIUtil.getBufferInt(); CLMem __result = new CLMem(nclCreateImage2D(context.getPointer(), flags, formatBuffer, 0, image_width, image_height, image_row_pitch, host_ptr, host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage2DSize(formatBuffer, image_width, image_height, image_row_pitch)) : 0, errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), context); if ( LWJGLUtil.DEBUG ) Util.checkCLError(errcode_ret.get(0)); return __result; } public CLMem createImage3D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_depth, final long image_row_pitch, final long image_slice_pitch, final Buffer host_ptr, IntBuffer errcode_ret) { final ByteBuffer formatBuffer = APIUtil.getBufferByte(2 * 4); formatBuffer.putInt(0, image_format.getChannelOrder()); formatBuffer.putInt(4, image_format.getChannelType()); final long function_pointer = CLCapabilities.clCreateImage3D; BufferChecks.checkFunctionAddress(function_pointer); if ( errcode_ret != null ) BufferChecks.checkBuffer(errcode_ret, 1); else if ( LWJGLUtil.DEBUG ) errcode_ret = APIUtil.getBufferInt(); CLMem __result = new CLMem(nclCreateImage3D(context.getPointer(), flags, formatBuffer, 0, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr, host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage3DSize(formatBuffer, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch)) : 0, errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), context); if ( LWJGLUtil.DEBUG ) Util.checkCLError(errcode_ret.get(0)); return __result; } public CLMem createSubBuffer(final CLMem mem, final long flags, final int buffer_create_type, final CLBufferRegion buffer_create_info, final IntBuffer errcode_ret) { final PointerBuffer infoBuffer = APIUtil.getBufferPointer(2); infoBuffer.put(buffer_create_info.getOrigin()); infoBuffer.put(buffer_create_info.getSize()); return clCreateSubBuffer(mem, flags, buffer_create_type, infoBuffer.getBuffer(), errcode_ret); } public ByteBuffer getInfoHostBuffer(final CLMem mem) { mem.checkValid(); if ( LWJGLUtil.DEBUG ) { final long mem_flags = getInfoLong(mem, CL_MEM_FLAGS); if ( (mem_flags & CL_MEM_USE_HOST_PTR) != CL_MEM_USE_HOST_PTR ) throw new IllegalArgumentException("The specified CLMem object does not use host memory."); } final long size = getInfoSize(mem, CL_MEM_SIZE); if ( size == 0 ) return null; final long address = getInfoSize(mem, CL_MEM_HOST_PTR); return CL.getHostBuffer(address, (int)size); } public long getImageInfoSize(final CLMem mem, final int param_name) { mem.checkValid(); final PointerBuffer buffer = APIUtil.getBufferPointer(); clGetImageInfo(mem, param_name, buffer.getBuffer(), null); return buffer.get(0); } public CLImageFormat getImageInfoFormat(final CLMem mem) { mem.checkValid(); final ByteBuffer format = APIUtil.getBufferByte(2 * 4); clGetImageInfo(mem, CL_IMAGE_FORMAT, format, null); return new CLImageFormat(format.getInt(0), format.getInt(4)); } public int getImageInfoFormat(final CLMem mem, final int index) { mem.checkValid(); final ByteBuffer format = APIUtil.getBufferByte(2 * 4); clGetImageInfo(mem, CL_IMAGE_FORMAT, format, null); return format.getInt(index << 2); } public int getGLObjectType(final CLMem mem) { mem.checkValid(); final IntBuffer buffer = APIUtil.getBufferInt(); clGetGLObjectInfo(mem, buffer, null); return buffer.get(0); } public int getGLObjectName(final CLMem mem) { mem.checkValid(); final IntBuffer buffer = APIUtil.getBufferInt(); clGetGLObjectInfo(mem, null, buffer); return buffer.get(0); } public int getGLTextureInfoInt(final CLMem mem, final int param_name) { mem.checkValid(); final ByteBuffer buffer = APIUtil.getBufferByte(4); clGetGLTextureInfo(mem, param_name, buffer, null); return buffer.getInt(0); } } static final CLPlatform.CLPlatformUtil CL_PLATFORM_UTIL = new CLPlatformUtil(); private static final class CLPlatformUtil extends InfoUtilAbstract implements CLPlatform.CLPlatformUtil { protected int getInfo(final CLPlatform platform, final int param_name, final ByteBuffer param_value, final PointerBuffer param_value_size_ret) { return clGetPlatformInfo(platform, param_name, param_value, param_value_size_ret); } public List getPlatforms(final Filter filter) { final IntBuffer numBuffer = APIUtil.getBufferInt(); clGetPlatformIDs(null, numBuffer); final int num_platforms = numBuffer.get(0); if ( num_platforms == 0 ) return null; final PointerBuffer platformIDs = APIUtil.getBufferPointer(num_platforms); clGetPlatformIDs(platformIDs, null); final List platforms = new ArrayList(num_platforms); for ( int i = 0; i < num_platforms; i++ ) { final CLPlatform platform = CLPlatform.getCLPlatform(platformIDs.get(i)); if ( filter == null || filter.accept(platform) ) platforms.add(platform); } return platforms.size() == 0 ? null : platforms; } public List getDevices(final CLPlatform platform, final int device_type, final Filter filter) { platform.checkValid(); final IntBuffer numBuffer = APIUtil.getBufferInt(); clGetDeviceIDs(platform, device_type, null, numBuffer); final int num_devices = numBuffer.get(0); if ( num_devices == 0 ) return null; final PointerBuffer deviceIDs = APIUtil.getBufferPointer(num_devices); clGetDeviceIDs(platform, device_type, deviceIDs, null); final List devices = new ArrayList(num_devices); for ( int i = 0; i < num_devices; i++ ) { final CLDevice device = platform.getCLDevice(deviceIDs.get(i)); if ( filter == null || filter.accept(device) ) devices.add(device); } return devices.size() == 0 ? null : devices; } } static final CLProgram.CLProgramUtil CL_PROGRAM_UTIL = new CLProgramUtil(); private static final class CLProgramUtil extends InfoUtilAbstract implements CLProgram.CLProgramUtil { protected int getInfo(final CLProgram program, final int param_name, final ByteBuffer param_value, final PointerBuffer param_value_size_ret) { return clGetProgramInfo(program, param_name, param_value, param_value_size_ret); } protected int getInfoSizeArraySize(final CLProgram program, final int param_name) { switch ( param_name ) { case CL_PROGRAM_BINARY_SIZES: return getInfoInt(program, CL_PROGRAM_NUM_DEVICES); default: throw new IllegalArgumentException("Unsupported parameter: " + LWJGLUtil.toHexString(param_name)); } } public CLKernel[] createKernelsInProgram(final CLProgram program) { final IntBuffer numBuffer = APIUtil.getBufferInt(); clCreateKernelsInProgram(program, null, numBuffer); final int num_kernels = numBuffer.get(0); if ( num_kernels == 0 ) return null; final PointerBuffer kernelIDs = APIUtil.getBufferPointer(num_kernels); clCreateKernelsInProgram(program, kernelIDs, null); final CLKernel[] kernels = new CLKernel[num_kernels]; for ( int i = 0; i < num_kernels; i++ ) kernels[i] = program.getCLKernel(kernelIDs.get(i)); return kernels; } public CLDevice[] getInfoDevices(final CLProgram program) { program.checkValid(); final int size = getInfoInt(program, CL_PROGRAM_NUM_DEVICES); final PointerBuffer buffer = APIUtil.getBufferPointer(size); clGetProgramInfo(program, CL_PROGRAM_DEVICES, buffer.getBuffer(), null); final CLPlatform platform = program.getParent().getParent(); final CLDevice[] array = new CLDevice[size]; for ( int i = 0; i < size; i++ ) array[i] = platform.getCLDevice(buffer.get(i)); return array; } public ByteBuffer getInfoBinaries(final CLProgram program, ByteBuffer target) { program.checkValid(); final PointerBuffer sizes = getSizesBuffer(program, CL_PROGRAM_BINARY_SIZES); int totalSize = 0; for ( int i = 0; i < sizes.limit(); i++ ) totalSize += sizes.get(i); if ( target == null ) target = BufferUtils.createByteBuffer(totalSize); else if ( LWJGLUtil.DEBUG ) BufferChecks.checkBuffer(target, totalSize); clGetProgramInfo(program, sizes, target, null); return target; } public ByteBuffer[] getInfoBinaries(final CLProgram program, ByteBuffer[] target) { program.checkValid(); if ( target == null ) { final PointerBuffer sizes = getSizesBuffer(program, CL_PROGRAM_BINARY_SIZES); target = new ByteBuffer[sizes.remaining()]; for ( int i = 0; i < sizes.remaining(); i++ ) target[i] = BufferUtils.createByteBuffer((int)sizes.get(0)); } else if ( LWJGLUtil.DEBUG ) { final PointerBuffer sizes = getSizesBuffer(program, CL_PROGRAM_BINARY_SIZES); if ( target.length < sizes.remaining() ) throw new IllegalArgumentException("The target array is not big enough: " + sizes.remaining() + " buffers are required."); for ( int i = 0; i < target.length; i++ ) BufferChecks.checkBuffer(target[i], (int)sizes.get(i)); } clGetProgramInfo(program, target, null); return target; } public String getBuildInfoString(final CLProgram program, final CLDevice device, final int param_name) { program.checkValid(); final int bytes = getBuildSizeRet(program, device, param_name); if ( bytes <= 1 ) return null; final ByteBuffer buffer = APIUtil.getBufferByte(bytes); clGetProgramBuildInfo(program, device, param_name, buffer, null); buffer.limit(bytes - 1); // Exclude null-termination return APIUtil.getString(buffer); } public int getBuildInfoInt(final CLProgram program, final CLDevice device, final int param_name) { program.checkValid(); final ByteBuffer buffer = APIUtil.getBufferByte(4); clGetProgramBuildInfo(program, device, param_name, buffer, null); return buffer.getInt(0); } private static int getBuildSizeRet(final CLProgram program, final CLDevice device, final int param_name) { final PointerBuffer bytes = APIUtil.getBufferPointer(); final int errcode = clGetProgramBuildInfo(program, device, param_name, null, bytes); if ( errcode != CL_SUCCESS ) throw new IllegalArgumentException("Invalid parameter specified: " + LWJGLUtil.toHexString(param_name)); return (int)bytes.get(0); } } static final InfoUtil CL_SAMPLER_UTIL = new InfoUtilAbstract() { protected int getInfo(final CLSampler sampler, final int param_name, final ByteBuffer param_value, final PointerBuffer param_value_size_ret) { return clGetSamplerInfo(sampler, param_name, param_value, param_value_size_ret); } }; }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLCommandQueue.java0000644000175000017500000000663011543426510022271 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.PointerBuffer; /** * This class is a wrapper around a cl_command_queue pointer. * * @author Spasi */ public final class CLCommandQueue extends CLObjectChild { private static final InfoUtil util = CLPlatform.getInfoUtilInstance(CLCommandQueue.class, "CL_COMMAND_QUEUE_UTIL"); private final CLDevice device; private final CLObjectRegistry clEvents; CLCommandQueue(final long pointer, final CLContext context, final CLDevice device) { super(pointer, context); if ( isValid() ) { this.device = device; this.clEvents = new CLObjectRegistryGlobal(CLContext.clEventsGlobal); context.getCLCommandQueueRegistry().registerObject(this); } else { this.device = null; this.clEvents = null; } } public CLDevice getCLDevice() { return device; } /** * Returns a CLEvent associated with this command-queue. * * @param id the event object id * * @return the CLEvent object */ public CLEvent getCLEvent(final long id) { return clEvents.getObject(id); } // ---------------[ UTILITY METHODS ]--------------- /** * Returns the integer value of the specified parameter. * * @param param_name the parameter * * @return the parameter value */ public int getInfoInt(int param_name) { return util.getInfoInt(this, param_name); } // -------[ IMPLEMENTATION STUFF BELOW ]------- CLObjectRegistry getCLEventRegistry() { return clEvents; } /** * Called from OpenCL methods that generate CLEvents. * * @param event a buffer containing a CLEvent pointer. */ void registerCLEvent(final PointerBuffer event) { if ( event != null ) new CLEvent(event.get(event.position()), this); } int release() { try { return super.release(); } finally { if ( !isValid() ) getParent().getCLCommandQueueRegistry().unregisterObject(this); } } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLEventCallback.java0000644000175000017500000000436211543426510022404 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; /** * Instances of this class can be used to receive OpenCL memory object destruction notifications. * * @author Spasi */ public abstract class CLEventCallback extends CLCallback { protected CLEventCallback() { super(CallbackUtil.getEventCallback()); } /** * Called from native code. * * @param event_address the CLEvent object pointer */ private void handleMessage(long event_address, int event_command_exec_status) { handleMessage(CLContext.getCLEventGlobal(event_address), event_command_exec_status); } /** * The callback method. * * @param event the CLEvent object */ protected abstract void handleMessage(CLEvent event, int event_command_exec_status); }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLObjectChild.java0000644000175000017500000000413611543426510022057 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.LWJGLUtil; /** * Base class for all CLObjects that are associated with a parent CLObject. * * @author Spasi */ abstract class CLObjectChild

extends CLObjectRetainable { private final P parent; protected CLObjectChild(final long pointer, final P parent) { super(pointer); if ( LWJGLUtil.DEBUG && parent != null && !parent.isValid() ) throw new IllegalStateException("The parent specified is not a valid CL object."); this.parent = parent; } public P getParent() { return parent; } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLContext.java0000644000175000017500000002343411543426510021333 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.LWJGLException; import org.lwjgl.opencl.api.CLImageFormat; import org.lwjgl.opencl.api.Filter; import org.lwjgl.opengl.Drawable; import java.nio.IntBuffer; import java.util.List; /** * This class is a wrapper around a cl_context pointer. * * @author Spasi */ public final class CLContext extends CLObjectChild { private static final CLContextUtil util = (CLContextUtil)CLPlatform.getInfoUtilInstance(CLContext.class, "CL_CONTEXT_UTIL"); private final CLObjectRegistry clCommandQueues; private final CLObjectRegistry clMems; private final CLObjectRegistry clSamplers; private final CLObjectRegistry clPrograms; private final CLObjectRegistry clEvents; /** Global registry for build callbacks. */ static final FastLongMap clProgramsGlobal = new FastLongMap(); /** Global registry for event callbacks. */ static final FastLongMap clEventsGlobal = new FastLongMap(); CLContext(final long pointer, final CLPlatform platform) { super(pointer, platform); // We do not need to register the context with the platform, // there is no API that returns cl_context, except clCreateContext. if ( isValid() ) { clCommandQueues = new CLObjectRegistry(); clMems = new CLObjectRegistry(); clSamplers = new CLObjectRegistry(); clPrograms = new CLObjectRegistryGlobal(clProgramsGlobal); clEvents = new CLObjectRegistryGlobal(clEventsGlobal); } else { clCommandQueues = null; clMems = null; clSamplers = null; clPrograms = null; clEvents = null; } } /** * Returns a CLCommandQueue associated with this context. * * @param id the command queue object id * * @return the CLCommandQueue object */ public CLCommandQueue getCLCommandQueue(final long id) { return clCommandQueues.getObject(id); } /** * Returns a CLMem associated with this context. * * @param id the memory object id * * @return the CLMem object */ public CLMem getCLMem(final long id) { return clMems.getObject(id); } /** * Returns a CLSampler associated with this context. * * @param id the sampler object id * * @return the CLSampler object */ public CLSampler getCLSampler(final long id) { return clSamplers.getObject(id); } /** * Returns a CLProgram associated with this context. * * @param id the program object id * * @return the CLProgram object */ public CLProgram getCLProgram(final long id) { return clPrograms.getObject(id); } /** * Returns a user CLEvent associated with this context. * * @param id the event object id * * @return the CLEvent object */ public CLEvent getCLEvent(final long id) { return clEvents.getObject(id); } // ---------------[ UTILITY METHODS ]--------------- /** * Creates a new CLContext. * * @param platform the platform to use * @param devices the devices to use * @param errcode_ret the error code result * * @return the new CLContext * * @throws LWJGLException if an exception occurs while creating the context */ public static CLContext create(final CLPlatform platform, final List devices, final IntBuffer errcode_ret) throws LWJGLException { return create(platform, devices, null, null, errcode_ret); } /** * Creates a new CLContext. * * @param platform the platform to use * @param devices the devices to use * @param pfn_notify the context callback function * @param errcode_ret the error code result * * @return the new CLContext * * @throws LWJGLException if an exception occurs while creating the context */ public static CLContext create(final CLPlatform platform, final List devices, final CLContextCallback pfn_notify, final IntBuffer errcode_ret) throws LWJGLException { return create(platform, devices, pfn_notify, null, errcode_ret); } /** * Creates a new CLContext. * * @param platform the platform to use * @param devices the devices to use * @param share_drawable the OpenGL drawable to share objects with * @param errcode_ret the error code result * * @return the new CLContext * * @throws LWJGLException if an exception occurs while creating the context */ public static CLContext create(final CLPlatform platform, final List devices, final CLContextCallback pfn_notify, final Drawable share_drawable, final IntBuffer errcode_ret) throws LWJGLException { return util.create(platform, devices, pfn_notify, share_drawable, errcode_ret); } /** * Creates a new CLContext. * * @param platform the platform to use * @param device_type the device type to use * @param errcode_ret the error code result * * @return the new CLContext * * @throws LWJGLException if an exception occurs while creating the context */ public static CLContext createFromType(final CLPlatform platform, final long device_type, final IntBuffer errcode_ret) throws LWJGLException { return util.createFromType(platform, device_type, null, null, errcode_ret); } /** * Creates a new CLContext. * * @param platform the platform to use * @param device_type the device type to use * @param pfn_notify the context callback function * @param errcode_ret the error code result * * @return the new CLContext * * @throws LWJGLException if an exception occurs while creating the context */ public static CLContext createFromType(final CLPlatform platform, final long device_type, final CLContextCallback pfn_notify, final IntBuffer errcode_ret) throws LWJGLException { return util.createFromType(platform, device_type, pfn_notify, null, errcode_ret); } /** * Creates a new CLContext. * * @param platform the platform to use * @param device_type the device type to use * @param share_drawable the OpenGL drawable to share objects with * @param errcode_ret the error code result * * @return the new CLContext * * @throws LWJGLException if an exception occurs while creating the context */ public static CLContext createFromType(final CLPlatform platform, final long device_type, final CLContextCallback pfn_notify, final Drawable share_drawable, final IntBuffer errcode_ret) throws LWJGLException { return util.createFromType(platform, device_type, pfn_notify, share_drawable, errcode_ret); } /** * Returns the integer value of the specified parameter. * * @param param_name the parameter * * @return the parameter value */ public int getInfoInt(int param_name) { return util.getInfoInt(this, param_name); } /** * Returns the list of devices in context. * * @return the list of devices */ public List getInfoDevices() { return util.getInfoDevices(this); } public List getSupportedImageFormats(final long flags, final int image_type) { return getSupportedImageFormats(flags, image_type, null); } public List getSupportedImageFormats(final long flags, final int image_type, final Filter filter) { return util.getSupportedImageFormats(this, flags, image_type, filter); } /** CLContext utility methods interface. */ interface CLContextUtil extends InfoUtil { List getInfoDevices(CLContext context); CLContext create(CLPlatform platform, List devices, CLContextCallback pfn_notify, Drawable share_drawable, IntBuffer errcode_ret) throws LWJGLException; CLContext createFromType(CLPlatform platform, long device_type, CLContextCallback pfn_notify, Drawable share_drawable, IntBuffer errcode_ret) throws LWJGLException; List getSupportedImageFormats(CLContext context, final long flags, final int image_type, Filter filter); } // -------[ IMPLEMENTATION STUFF BELOW ]------- CLObjectRegistry getCLCommandQueueRegistry() { return clCommandQueues; } CLObjectRegistry getCLMemRegistry() { return clMems; } CLObjectRegistry getCLSamplerRegistry() { return clSamplers; } CLObjectRegistry getCLProgramRegistry() { return clPrograms; } CLObjectRegistry getCLEventRegistry() { return clEvents; } static CLProgram getCLProgramGlobal(final long id) { return clProgramsGlobal.get(id); } static CLEvent getCLEventGlobal(final long id) { return clEventsGlobal.get(id); } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/OpenCLException.java0000644000175000017500000000370411543426510022465 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; public class OpenCLException extends RuntimeException { private static final long serialVersionUID = 1L; public OpenCLException() { super(); } public OpenCLException(final String message) { super(message); } public OpenCLException(final String message, final Throwable cause) { super(message, cause); } public OpenCLException(final Throwable cause) { super(cause); } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLNativeKernel.java0000644000175000017500000000461311543426510022274 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import java.nio.ByteBuffer; /** * Instances of this class can be used to execute native kernels. clEnqueueNativeKernel will build * the its arguments automatically, in a way that allows execute to receive an array * of ByteBuffers, pointing to cl_mem objects in global memory. The ByteBuffer objects should not * be used outside the handleMessage method. * * @author Spasi * @see CL10#clEnqueueNativeKernel * @see #execute(java.nio.ByteBuffer[]) */ public abstract class CLNativeKernel extends CLCallback { protected CLNativeKernel() { super(CallbackUtil.getNativeKernelCallback()); } /** * Implement this method to execute an action on cl_mem objects in global memory. * * @param memobjs an array of ByteBuffers pointing to cl_mem global memory. */ protected abstract void execute(ByteBuffer[] memobjs); }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLObjectRetainable.java0000644000175000017500000000442211543426510023100 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; /** * Base class for all retainable OpenCL objects. * * @author Spasi */ abstract class CLObjectRetainable extends CLObject { private int refCount; protected CLObjectRetainable(final long pointer) { super(pointer); if ( super.isValid() ) this.refCount = 1; } public final int getReferenceCount() { return refCount; } public final boolean isValid() { return refCount > 0; } int retain() { checkValid(); //System.out.println(getClass().getSimpleName() + " REF COUNT: " + pointer + " - " + (refCount + 1)); return ++refCount; } int release() { checkValid(); //System.out.println(getClass().getSimpleName() + " REF COUNT: " + pointer + " - " + (refCount - 1)); return --refCount; } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLMemObjectDestructorCallback.java0000644000175000017500000000401011543426510025235 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; /** * Instances of this class can be used to receive OpenCL memory object destruction notifications. * * @author Spasi */ public abstract class CLMemObjectDestructorCallback extends CLCallback { protected CLMemObjectDestructorCallback() { super(CallbackUtil.getMemObjectDestructorCallback()); } /** * The callback method. * * @param memobj id of the CLMem object that was destroyed */ protected abstract void handleMessage(long memobj); }lwjgl-2.7.1/src/java/org/lwjgl/opencl/InfoUtil.java0000644000175000017500000000374211543426510021221 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; /** * Base interface for information utility classes. * * @author Spasi */ interface InfoUtil { int getInfoInt(final T object, final int param_name); long getInfoSize(final T object, final int param_name); long[] getInfoSizeArray(final T object, final int param_name); long getInfoLong(final T object, final int param_name); String getInfoString(final T object, final int param_name); }lwjgl-2.7.1/src/java/org/lwjgl/opencl/api/0000755000175000017500000000000011543426510017370 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/opencl/api/CLImageFormat.java0000644000175000017500000000414111543426510022645 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl.api; /** * Simple container for cl_image_format struct values. * * @author Spasi */ public final class CLImageFormat { /** The cl_image_format struct size in bytes. */ public static final int STRUCT_SIZE = 2 * 4; private final int channelOrder; private final int channelType; public CLImageFormat(final int channelOrder, final int channelType) { this.channelOrder = channelOrder; this.channelType = channelType; } public int getChannelOrder() { return channelOrder; } public int getChannelType() { return channelType; } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/api/Filter.java0000644000175000017500000000352311543426510021463 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl.api; /** * Simple filter interface. * * @author Spasi */ public interface Filter { /** * Returns true if the specified object passes the filter. * * @param object the object to test * * @return true if the object is accepted */ boolean accept(T object); }lwjgl-2.7.1/src/java/org/lwjgl/opencl/api/CLBufferRegion.java0000644000175000017500000000412511543426510023031 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl.api; import org.lwjgl.PointerBuffer; /** * Simple container for cl_buffer_region struct values. * * @author Spasi */ public final class CLBufferRegion { /** The cl_buffer_region struct size in bytes. */ public static final int STRUCT_SIZE = 2 * PointerBuffer.getPointerSize(); private final int origin; private final int size; public CLBufferRegion(final int origin, final int size) { this.origin = origin; this.size = size; } public int getOrigin() { return origin; } public int getSize() { return size; } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/APIUtil.java0000644000175000017500000003751511543426510020744 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLUtil; import org.lwjgl.PointerBuffer; import org.lwjgl.opencl.FastLongMap.Entry; import java.nio.*; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; import static org.lwjgl.opencl.APPLEGLSharing.*; import static org.lwjgl.opencl.CL10.*; import static org.lwjgl.opencl.EXTDeviceFission.*; import static org.lwjgl.opencl.KHRGLSharing.*; /** * Utility class for OpenCL API calls. * * @author spasi */ final class APIUtil { private static final int INITIAL_BUFFER_SIZE = 256; private static final int INITIAL_LENGTHS_SIZE = 4; private static final int BUFFERS_SIZE = 32; private static final ThreadLocal arrayTL = new ThreadLocal() { protected char[] initialValue() { return new char[INITIAL_BUFFER_SIZE]; } }; private static final ThreadLocal bufferByteTL = new ThreadLocal() { protected ByteBuffer initialValue() { return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); } }; private static final ThreadLocal bufferPointerTL = new ThreadLocal() { protected PointerBuffer initialValue() { return BufferUtils.createPointerBuffer(INITIAL_BUFFER_SIZE); } }; private static final ThreadLocal lengthsTL = new ThreadLocal() { protected PointerBuffer initialValue() { return BufferUtils.createPointerBuffer(INITIAL_LENGTHS_SIZE); } }; private static final ThreadLocal buffersTL = new ThreadLocal() { protected Buffers initialValue() { return new Buffers(); } }; private APIUtil() { } private static char[] getArray(final int size) { char[] array = arrayTL.get(); if ( array.length < size ) { int sizeNew = array.length << 1; while ( sizeNew < size ) sizeNew <<= 1; array = new char[size]; arrayTL.set(array); } return array; } static ByteBuffer getBufferByte(final int size) { ByteBuffer buffer = bufferByteTL.get(); if ( buffer.capacity() < size ) { int sizeNew = buffer.capacity() << 1; while ( sizeNew < size ) sizeNew <<= 1; buffer = BufferUtils.createByteBuffer(size); bufferByteTL.set(buffer); } else buffer.clear(); return buffer; } private static ByteBuffer getBufferByteOffset(final int size) { ByteBuffer buffer = bufferByteTL.get(); if ( buffer.capacity() < size ) { int sizeNew = buffer.capacity() << 1; while ( sizeNew < size ) sizeNew <<= 1; final ByteBuffer bufferNew = BufferUtils.createByteBuffer(size); bufferNew.put(buffer); bufferByteTL.set(buffer = bufferNew); } else { buffer.position(buffer.limit()); buffer.limit(buffer.capacity()); } return buffer; } static PointerBuffer getBufferPointer(final int size) { PointerBuffer buffer = bufferPointerTL.get(); if ( buffer.capacity() < size ) { int sizeNew = buffer.capacity() << 1; while ( sizeNew < size ) sizeNew <<= 1; buffer = BufferUtils.createPointerBuffer(size); bufferPointerTL.set(buffer); } else buffer.clear(); return buffer; } static ShortBuffer getBufferShort() { return buffersTL.get().shorts; } static IntBuffer getBufferInt() { return buffersTL.get().ints; } static IntBuffer getBufferIntDebug() { return buffersTL.get().intsDebug; } static LongBuffer getBufferLong() { return buffersTL.get().longs; } static FloatBuffer getBufferFloat() { return buffersTL.get().floats; } static DoubleBuffer getBufferDouble() { return buffersTL.get().doubles; } static PointerBuffer getBufferPointer() { return buffersTL.get().pointers; } static PointerBuffer getLengths() { return getLengths(1); } static PointerBuffer getLengths(final int size) { PointerBuffer lengths = lengthsTL.get(); if ( lengths.capacity() < size ) { int sizeNew = lengths.capacity(); while ( sizeNew < size ) sizeNew <<= 1; lengths = BufferUtils.createPointerBuffer(size); lengthsTL.set(lengths); } else lengths.clear(); return lengths; } /** * Simple ASCII encoding. * * @param buffer The target buffer * @param string The source string */ private static ByteBuffer encode(final ByteBuffer buffer, final CharSequence string) { for ( int i = 0; i < string.length(); i++ ) { final char c = string.charAt(i); if ( LWJGLUtil.DEBUG && 0x80 <= c ) // Silently ignore and map to 0x1A. buffer.put((byte)0x1A); else buffer.put((byte)c); } return buffer; } /** * Reads a byte string from the specified buffer. * * @param buffer * * @return the buffer as a String. */ static String getString(final ByteBuffer buffer) { final int length = buffer.remaining(); final char[] charArray = getArray(length); for ( int i = buffer.position(); i < buffer.limit(); i++ ) charArray[i - buffer.position()] = (char)buffer.get(i); return new String(charArray, 0, length); } /** * Returns a buffer containing the specified string as bytes. * * @param string * * @return the String as a ByteBuffer */ static ByteBuffer getBuffer(final CharSequence string) { final ByteBuffer buffer = encode(getBufferByte(string.length()), string); buffer.flip(); return buffer; } /** * Returns a buffer containing the specified string as bytes, starting at the specified offset. * * @param string * * @return the String as a ByteBuffer */ static ByteBuffer getBuffer(final CharSequence string, final int offset) { final ByteBuffer buffer = encode(getBufferByteOffset(offset + string.length()), string); buffer.flip(); return buffer; } /** * Returns a buffer containing the specified string as bytes, including null-termination. * * @param string * * @return the String as a ByteBuffer */ static ByteBuffer getBufferNT(final CharSequence string) { final ByteBuffer buffer = encode(getBufferByte(string.length() + 1), string); buffer.put((byte)0); buffer.flip(); return buffer; } static int getTotalLength(final CharSequence[] strings) { int length = 0; for ( CharSequence string : strings ) length += string.length(); return length; } /** * Returns a buffer containing the specified strings as bytes. * * @param strings * * @return the Strings as a ByteBuffer */ static ByteBuffer getBuffer(final CharSequence[] strings) { final ByteBuffer buffer = getBufferByte(getTotalLength(strings)); for ( CharSequence string : strings ) encode(buffer, string); buffer.flip(); return buffer; } /** * Returns a buffer containing the specified strings as bytes, including null-termination. * * @param strings * * @return the Strings as a ByteBuffer */ static ByteBuffer getBufferNT(final CharSequence[] strings) { final ByteBuffer buffer = getBufferByte(getTotalLength(strings) + strings.length); for ( CharSequence string : strings ) { encode(buffer, string); buffer.put((byte)0); } buffer.flip(); return buffer; } /** * Returns a buffer containing the lengths of the specified strings. * * @param strings * * @return the String lengths in a PointerBuffer */ static PointerBuffer getLengths(final CharSequence[] strings) { PointerBuffer buffer = getLengths(strings.length); for ( CharSequence string : strings ) buffer.put(string.length()); buffer.flip(); return buffer; } /** * Returns a buffer containing the lengths of the specified buffers. * * @param buffers the buffer array * * @return the buffer lengths in a PointerBuffer */ static PointerBuffer getLengths(final ByteBuffer[] buffers) { PointerBuffer lengths = getLengths(buffers.length); for ( ByteBuffer buffer : buffers ) lengths.put(buffer.remaining()); lengths.flip(); return lengths; } static int getSize(final PointerBuffer lengths) { long size = 0; for ( int i = lengths.position(); i < lengths.limit(); i++ ) size += lengths.get(i); return (int)size; } private static class Buffers { final ShortBuffer shorts; final IntBuffer ints; final IntBuffer intsDebug; final LongBuffer longs; final FloatBuffer floats; final DoubleBuffer doubles; final PointerBuffer pointers; Buffers() { shorts = BufferUtils.createShortBuffer(BUFFERS_SIZE); ints = BufferUtils.createIntBuffer(BUFFERS_SIZE); intsDebug = BufferUtils.createIntBuffer(1); longs = BufferUtils.createLongBuffer(BUFFERS_SIZE); floats = BufferUtils.createFloatBuffer(BUFFERS_SIZE); doubles = BufferUtils.createDoubleBuffer(BUFFERS_SIZE); pointers = BufferUtils.createPointerBuffer(BUFFERS_SIZE); } } /* ------------------------------------------------------------------------ --------------------------------------------------------------------------- OPENCL API UTILITIES BELOW --------------------------------------------------------------------------- ------------------------------------------------------------------------ */ static Set getExtensions(final String extensionList) { final Set extensions = new HashSet(); if ( extensionList != null ) { final StringTokenizer tokenizer = new StringTokenizer(extensionList); while ( tokenizer.hasMoreTokens() ) extensions.add(tokenizer.nextToken()); } return extensions; } static boolean isDevicesParam(final int param_name) { switch ( param_name ) { case CL_CONTEXT_DEVICES: case CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR: case CL_DEVICES_FOR_GL_CONTEXT_KHR: case CL_CGL_DEVICE_FOR_CURRENT_VIRTUAL_SCREEN_APPLE: case CL_CGL_DEVICES_FOR_SUPPORTED_VIRTUAL_SCREENS_APPLE: return true; } return false; } static CLPlatform getCLPlatform(final PointerBuffer properties) { long platformID = 0; final int keys = properties.remaining() / 2; for ( int k = 0; k < keys; k++ ) { final long key = properties.get(k << 1); if ( key == 0 ) break; if ( key == CL_CONTEXT_PLATFORM ) { platformID = properties.get((k << 1) + 1); break; } } if ( platformID == 0 ) throw new IllegalArgumentException("Could not find CL_CONTEXT_PLATFORM in cl_context_properties."); final CLPlatform platform = CLPlatform.getCLPlatform(platformID); if ( platform == null ) throw new IllegalStateException("Could not find a valid CLPlatform. Make sure clGetPlatformIDs has been used before."); return platform; } static ByteBuffer getNativeKernelArgs(final long user_func_ref, final CLMem[] clMems, final long[] sizes) { final ByteBuffer args = getBufferByte(8 + 4 + (clMems == null ? 0 : clMems.length * (4 + PointerBuffer.getPointerSize()))); args.putLong(0, user_func_ref); if ( clMems == null ) args.putInt(8, 0); else { args.putInt(8, clMems.length); int byteIndex = 12; for ( int i = 0; i < clMems.length; i++ ) { if ( LWJGLUtil.DEBUG && !clMems[i].isValid() ) throw new IllegalArgumentException("An invalid CLMem object was specified."); args.putInt(byteIndex, (int)sizes[i]); // CLMem size byteIndex += (4 + PointerBuffer.getPointerSize()); // Skip size and make room for the pointer } } return args; } // ------------------------------------------------------------------------------------ /** * Releases all sub-devices created from the specified CLDevice. * * @param device the CLDevice to clear */ static void releaseObjects(final CLDevice device) { // Release objects only if we're about to hit 0. if ( device.getReferenceCount() > 1 ) return; releaseObjects(device.getSubCLDeviceRegistry(), DESTRUCTOR_CLSubDevice); } /** * Releases all objects contained in the specified CLContext. * * @param context the CLContext to clear */ static void releaseObjects(final CLContext context) { // Release objects only if we're about to hit 0. if ( context.getReferenceCount() > 1 ) return; releaseObjects(context.getCLEventRegistry(), DESTRUCTOR_CLEvent); releaseObjects(context.getCLProgramRegistry(), DESTRUCTOR_CLProgram); releaseObjects(context.getCLSamplerRegistry(), DESTRUCTOR_CLSampler); releaseObjects(context.getCLMemRegistry(), DESTRUCTOR_CLMem); releaseObjects(context.getCLCommandQueueRegistry(), DESTRUCTOR_CLCommandQueue); } /** * Releases all objects contained in the specified CLProgram. * * @param program the CLProgram to clear */ static void releaseObjects(final CLProgram program) { // Release objects only if we're about to hit 0. if ( program.getReferenceCount() > 1 ) return; releaseObjects(program.getCLKernelRegistry(), DESTRUCTOR_CLKernel); } /** * Releases all objects contained in the specified CLCommandQueue. * * @param queue the CLCommandQueue to clear */ static void releaseObjects(final CLCommandQueue queue) { // Release objects only if we're about to hit 0. if ( queue.getReferenceCount() > 1 ) return; releaseObjects(queue.getCLEventRegistry(), DESTRUCTOR_CLEvent); } private static void releaseObjects(final CLObjectRegistry registry, final ObjectDestructor destructor) { if ( registry.isEmpty() ) return; for ( Entry entry : registry.getAll() ) { final T object = entry.value; while ( object.isValid() ) destructor.release(object); } } private static final ObjectDestructor DESTRUCTOR_CLSubDevice = new ObjectDestructor() { public void release(final CLDevice object) { clReleaseDeviceEXT(object); } }; private static final ObjectDestructor DESTRUCTOR_CLMem = new ObjectDestructor() { public void release(final CLMem object) { clReleaseMemObject(object); } }; private static final ObjectDestructor DESTRUCTOR_CLCommandQueue = new ObjectDestructor() { public void release(final CLCommandQueue object) { clReleaseCommandQueue(object); } }; private static final ObjectDestructor DESTRUCTOR_CLSampler = new ObjectDestructor() { public void release(final CLSampler object) { clReleaseSampler(object); } }; private static final ObjectDestructor DESTRUCTOR_CLProgram = new ObjectDestructor() { public void release(final CLProgram object) { clReleaseProgram(object); } }; private static final ObjectDestructor DESTRUCTOR_CLKernel = new ObjectDestructor() { public void release(final CLKernel object) { clReleaseKernel(object); } }; private static final ObjectDestructor DESTRUCTOR_CLEvent = new ObjectDestructor() { public void release(final CLEvent object) { clReleaseEvent(object); } }; private interface ObjectDestructor { void release(T object); } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CL.java0000644000175000017500000001115011543426510017756 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.Sys; import java.nio.ByteBuffer; /** * LWJGL users must use this class to initialize OpenCL * before using any other class in the org.lwjgl.opencl package. * * @author Spasi */ public final class CL { private static boolean created; static { Sys.initialize(); } private CL() { } /** * Native method to create CL instance * * @param oclPaths Array of strings containing paths to search for OpenCL library */ private static native void nCreate(String oclPaths) throws LWJGLException; /** * Native method to create CL instance from the Mac OS X 10.4 OpenCL framework. * It is only defined in the Mac OS X native library. */ private static native void nCreateDefault() throws LWJGLException; /** Native method the destroy the CL */ private static native void nDestroy(); /** @return true if CL has been created */ public static boolean isCreated() { return created; } public static void create() throws LWJGLException { if ( created ) return; //throw new IllegalStateException("OpenCL has already been created."); final String libname; final String[] library_names; switch ( LWJGLUtil.getPlatform() ) { case LWJGLUtil.PLATFORM_WINDOWS: libname = "OpenCL"; library_names = new String[] { "OpenCL.dll" }; break; case LWJGLUtil.PLATFORM_LINUX: libname = "OpenCL"; library_names = new String[] { "libOpenCL64.so", "libOpenCL.so" }; // TODO: Fix this break; case LWJGLUtil.PLATFORM_MACOSX: libname = "OpenCL"; library_names = new String[] { "OpenCL.dylib" }; // TODO: Fix this break; default: throw new LWJGLException("Unknown platform: " + LWJGLUtil.getPlatform()); } final String[] oclPaths = LWJGLUtil.getLibraryPaths(libname, library_names, CL.class.getClassLoader()); LWJGLUtil.log("Found " + oclPaths.length + " OpenCL paths"); for ( String oclPath : oclPaths ) { try { nCreate(oclPath); created = true; break; } catch (LWJGLException e) { LWJGLUtil.log("Failed to load " + oclPath + ": " + e.getMessage()); } } if ( !created && LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX ) { // Try to load OpenCL from the framework instead nCreateDefault(); created = true; } if ( !created ) throw new LWJGLException("Could not locate OpenCL library."); if ( !CLCapabilities.OpenCL10 ) throw new RuntimeException("OpenCL 1.0 not supported."); } public static void destroy() { } /** * Helper method to get a pointer to a named function with aliases in the OpenCL library. * * @param aliases the function name aliases. * * @return the function pointer address */ static long getFunctionAddress(String[] aliases) { for ( String aliase : aliases ) { long address = getFunctionAddress(aliase); if ( address != 0 ) return address; } return 0; } static native long getFunctionAddress(String name); static native ByteBuffer getHostBuffer(final long address, final int size); private static native void resetNativeStubs(Class clazz); }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLMem.java0000644000175000017500000002157111543426510020425 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.opencl.api.CLBufferRegion; import org.lwjgl.opencl.api.CLImageFormat; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; /** * This class is a wrapper around a cl_mem pointer. * * @author Spasi */ public final class CLMem extends CLObjectChild { private static final CLMemUtil util = (CLMemUtil)CLPlatform.getInfoUtilInstance(CLMem.class, "CL_MEM_UTIL"); CLMem(final long pointer, final CLContext context) { super(pointer, context); if ( isValid() ) context.getCLMemRegistry().registerObject(this); } // ---------------[ UTILITY METHODS ]--------------- /** * Creates a new 2D image object. * * @param context the context on which to create the image object * @param flags the memory object flags * @param image_format the image format * @param image_width the image width * @param image_height the image height * @param image_row_pitch the image row pitch * @param host_ptr the host buffer from which to read image data (optional) * @param errcode_ret the error code result * * @return the new CLMem object */ public static CLMem createImage2D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_row_pitch, final Buffer host_ptr, final IntBuffer errcode_ret) { return util.createImage2D(context, flags, image_format, image_width, image_height, image_row_pitch, host_ptr, errcode_ret); } /** * Creates a new 3D image object. * * @param context the context on which to create the image object * @param flags the memory object flags * @param image_format the image format * @param image_width the image width * @param image_height the image height * @param image_depth the image depth * @param image_row_pitch the image row pitch * @param image_slice_pitch the image slice pitch * @param host_ptr the host buffer from which to read image data (optional) * @param errcode_ret the error code result * * @return the new CLMem object */ public static CLMem createImage3D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_depth, final long image_row_pitch, final long image_slice_pitch, final Buffer host_ptr, final IntBuffer errcode_ret) { return util.createImage3D(context, flags, image_format, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr, errcode_ret); } public CLMem createSubBuffer(final long flags, final int buffer_create_type, final CLBufferRegion buffer_create_info, final IntBuffer errcode_ret) { return util.createSubBuffer(this, flags, buffer_create_type, buffer_create_info, errcode_ret); } /** * Returns the integer value of the specified parameter. * * @param param_name the parameter * * @return the parameter value */ public int getInfoInt(int param_name) { return util.getInfoInt(this, param_name); } /** * Returns the size_t value of the specified parameter. * * @param param_name the parameter * * @return the parameter value */ public long getInfoSize(int param_name) { return util.getInfoSize(this, param_name); } /** * Returns the long value of the specified parameter. Can be used * for both cl_ulong and cl_bitfield parameters. * * @param param_name the parameter * * @return the parameter value */ public long getInfoLong(int param_name) { return util.getInfoLong(this, param_name); } /** * Returns a direct ByteBuffer instance that points to the host * memory that backs this CLMem object. Applicable only to CLMem * objects that were created with the CL_MEM_USE_HOST_PTR flag. * * @return the host memory ByteBuffer */ public ByteBuffer getInfoHostBuffer() { return util.getInfoHostBuffer(this); } // clGetImageInfo methods /** * Returns the size_t value of the specified parameter. Applicable to image objects only. * * @param param_name the parameter * * @return the parameter value */ public long getImageInfoSize(int param_name) { return util.getImageInfoSize(this, param_name); } /** * Returns the image format. Applicable to image objects only. * * @return the parameter value */ public CLImageFormat getImageFormat() { return util.getImageInfoFormat(this); } /** * Returns the image channel order. Applicable to image objects only. * * @return the parameter value */ public int getImageChannelOrder() { return util.getImageInfoFormat(this, 0); } /** * Returns the image channel type. Applicable to image objects only. * * @return the parameter value */ public int getImageChannelType() { return util.getImageInfoFormat(this, 1); } // clGetGLObjectInfo methods /** * Returns the GL object type. Applicable to CLMem objects * that have been created GL objects only. * * @return the parameter value */ public int getGLObjectType() { return util.getGLObjectType(this); } /** * Returns the GL object name. Applicable to CLMem objects * that have been created GL objects only. * * @return the parameter value */ public int getGLObjectName() { return util.getGLObjectName(this); } // clGetGLTextureInfo methods /** * Returns the int value of the specified parameter. Applicable to CLMem objects * that have been created by GL textures only. * * @param param_name the parameter * * @return the parameter value */ public int getGLTextureInfoInt(int param_name) { return util.getGLTextureInfoInt(this, param_name); } /** CLMem utility methods interface. */ interface CLMemUtil extends InfoUtil { CLMem createImage2D(CLContext context, long flags, CLImageFormat image_format, long image_width, long image_height, long image_row_pitch, Buffer host_ptr, IntBuffer errcode_ret); CLMem createImage3D(CLContext context, long flags, CLImageFormat image_format, long image_width, long image_height, long image_depth, long image_row_pitch, long image_slice_pitch, Buffer host_ptr, IntBuffer errcode_ret); CLMem createSubBuffer(CLMem mem, long flags, int buffer_create_type, CLBufferRegion buffer_create_info, IntBuffer errcode_ret); ByteBuffer getInfoHostBuffer(CLMem mem); long getImageInfoSize(CLMem mem, int param_name); CLImageFormat getImageInfoFormat(CLMem mem); int getImageInfoFormat(CLMem mem, int index); int getGLObjectType(CLMem mem); int getGLObjectName(CLMem mem); int getGLTextureInfoInt(CLMem mem, int param_name); } // -------[ IMPLEMENTATION STUFF BELOW ]------- /** * Sub-buffer factory. clCreateSubBuffer may return an existing CLMem. * * @param pointer the sub-buffer id * @param context the context in which the sub-buffer was created * * @return the CLMem that represents the sub-buffer */ static CLMem create(final long pointer, final CLContext context) { CLMem clMem = context.getCLMemRegistry().getObject(pointer); if ( clMem == null ) clMem = new CLMem(pointer, context); else clMem.retain(); return clMem; } int release() { try { return super.release(); } finally { if ( !isValid() ) getParent().getCLMemRegistry().unregisterObject(this); } } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLEvent.java0000644000175000017500000000730311543426510020765 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; /** * This class is a wrapper around a cl_mem pointer. * * @author Spasi */ public final class CLEvent extends CLObjectChild { private static final CLEventUtil util = (CLEventUtil)CLPlatform.getInfoUtilInstance(CLEvent.class, "CL_EVENT_UTIL"); private final CLCommandQueue queue; CLEvent(final long pointer, final CLContext context) { this(pointer, context, null); } CLEvent(final long pointer, final CLCommandQueue queue) { this(pointer, queue.getParent(), queue); } CLEvent(final long pointer, final CLContext context, final CLCommandQueue queue) { super(pointer, context); if ( isValid() ) { this.queue = queue; if ( queue == null ) context.getCLEventRegistry().registerObject(this); else queue.getCLEventRegistry().registerObject(this); } else this.queue = null; } /** * Returns the command-queue associated with this event. For * user events this method returns null. * * @return the command-queue or null if this is a user event */ public CLCommandQueue getCLCommandQueue() { return queue; } // ---------------[ UTILITY METHODS ]--------------- /** * Returns the integer value of the specified parameter. * * @param param_name the parameter * * @return the parameter value */ public int getInfoInt(final int param_name) { return util.getInfoInt(this, param_name); } // clGetEventProfilingInfo methods /** * Returns the long value of the specified parameter. Can be used * for both cl_ulong and cl_bitfield parameters. * * @param param_name the parameter * * @return the parameter value */ public long getProfilingInfoLong(int param_name) { return util.getProfilingInfoLong(this, param_name); } /** CLEvent utility methods interface. */ interface CLEventUtil extends InfoUtil { long getProfilingInfoLong(CLEvent event, int param_name); } // -------[ IMPLEMENTATION STUFF BELOW ]------- int release() { try { return super.release(); } finally { if ( !isValid() ) { if ( queue == null ) getParent().getCLEventRegistry().unregisterObject(this); else queue.getCLEventRegistry().unregisterObject(this); } } } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/InfoUtilAbstract.java0000644000175000017500000001033211543426510022676 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.LWJGLUtil; import org.lwjgl.PointerBuffer; import java.nio.ByteBuffer; import static org.lwjgl.opencl.CL10.*; /** * Base implementation of information utility classes. * * @author Spasi */ abstract class InfoUtilAbstract implements InfoUtil { protected InfoUtilAbstract() { } protected abstract int getInfo(T object, int param_name, ByteBuffer param_value, PointerBuffer param_value_size_ret); // Optional protected int getInfoSizeArraySize(final T object, final int param_name) { throw new UnsupportedOperationException(); } protected PointerBuffer getSizesBuffer(final T object, final int param_name) { final int size = getInfoSizeArraySize(object, param_name); final PointerBuffer buffer = APIUtil.getBufferPointer(size); buffer.limit(size); getInfo(object, param_name, buffer.getBuffer(), null); return buffer; } public int getInfoInt(final T object, final int param_name) { object.checkValid(); final ByteBuffer buffer = APIUtil.getBufferByte(4); getInfo(object, param_name, buffer, null); return buffer.getInt(0); } public long getInfoSize(final T object, final int param_name) { object.checkValid(); final PointerBuffer buffer = APIUtil.getBufferPointer(); getInfo(object, param_name, buffer.getBuffer(), null); return buffer.get(0); } public long[] getInfoSizeArray(final T object, final int param_name) { object.checkValid(); final int size = getInfoSizeArraySize(object, param_name); final PointerBuffer buffer = APIUtil.getBufferPointer(size); getInfo(object, param_name, buffer.getBuffer(), null); final long[] array = new long[size]; for ( int i = 0; i < size; i++ ) array[i] = buffer.get(i); return array; } public long getInfoLong(final T object, final int param_name) { object.checkValid(); final ByteBuffer buffer = APIUtil.getBufferByte(8); getInfo(object, param_name, buffer, null); return buffer.getLong(0); } public String getInfoString(final T object, final int param_name) { object.checkValid(); final int bytes = getSizeRet(object, param_name); if ( bytes <= 1 ) return null; final ByteBuffer buffer = APIUtil.getBufferByte(bytes); getInfo(object, param_name, buffer, null); buffer.limit(bytes - 1); // Exclude null-termination return APIUtil.getString(buffer); } protected final int getSizeRet(final T object, final int param_name) { final PointerBuffer bytes = APIUtil.getBufferPointer(); final int errcode = getInfo(object, param_name, null, bytes); if ( errcode != CL_SUCCESS ) throw new IllegalArgumentException("Invalid parameter specified: " + LWJGLUtil.toHexString(param_name)); return (int)bytes.get(0); } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLObject.java0000644000175000017500000000353311543426510021113 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.PointerWrapperAbstract; /** * Base class for all OpenCL objects. * * @author Spasi */ abstract class CLObject extends PointerWrapperAbstract { protected CLObject(final long pointer) { super(pointer); } final long getPointerUnsafe() { return pointer; } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CallbackUtil.java0000644000175000017500000001506411543426510022022 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import java.util.HashMap; import java.util.Map; /** * Utility class that handles OpenCL API callbacks. * * @author Spasi */ final class CallbackUtil { private static final Map contextUserData = new HashMap(); private CallbackUtil() {} /** * Creates a new global reference to the specified Object. * * @param obj the Object * * @return the GlobalRef memory address or 0 if the Object is null. */ static long createGlobalRef(final Object obj) { return obj == null ? 0 : ncreateGlobalRef(obj); } /** * Creates a new global reference to the specified Object. * * @param obj the Object * * @return the GlobalRef memory address. */ private static native long ncreateGlobalRef(Object obj); /** * Deletes a global reference. * * @param ref the GlobalRef memory address. */ private static native void deleteGlobalRef(long ref); /** * Deletes the global reference represented by user_data if an OpenCL error occured. * * @param errcode the error code * @param user_data the GlobalRef memory address */ static void checkCallback(final int errcode, final long user_data) { if ( errcode != 0x0 && user_data != 0 ) deleteGlobalRef(user_data); } /* [ Context callback functionality ] This is a little weird, so here's an explanation of what's happening for future reference: Before making the clCreateContext call we create a global reference to the CLContextCallback object (using JNI's NewGlobalRef function). We pass that global reference to the user_data parameter of clCreateContext. If clCreateContext returns anything but CL_SUCCESS, we immediately destroy the global reference to avoid the memory leak. If the new context was created successfully, we associate the context with the global reference in the contextUserData HashMap. On a future call to clReleaseContext, we clear that association and destroy the global reference (if the reference count is 0). */ /** * Returns the memory address of the native function we pass to clCreateContext(FromType). * * @return the callback function address */ static native long getContextCallback(); /** * Associates the specified CLContext with the specified global reference. If the context * is invalid, the global reference is deleted. NO-OP if user_data is 0. * * @param context the CLContext to register * @param user_data the global reference pointer */ static void registerCallback(final CLContext context, final long user_data) { if ( context.getPointerUnsafe() == 0 ) { if ( user_data != 0 ) deleteGlobalRef(user_data); return; } if ( user_data != 0 ) contextUserData.put(context, user_data); } /** * Decrements the specified context's reference count, clears its association * with a CLContextCallback object if it exists and deletes the corresponding * global reference. * * @param context the CLContext to unregister */ static void unregisterCallback(final CLContext context) { if ( context.release() > 0 ) return; final Long user_data = contextUserData.remove(context); if ( user_data != null ) deleteGlobalRef(user_data); } /* [ Other callback functionality ] The other callbacks are simpler. We create the GlobalRef before passing the callback, we delete it when we receive the callback call. */ /** * Returns the memory address of the native function we pass to clSetMemObjectDestructorCallback. * * @return the callback function address */ static native long getMemObjectDestructorCallback(); /** * Returns the memory address of the native function we pass to clBuildProgram. * * @return the callback function address */ static native long getBuildProgramCallback(); /** * Returns the memory address of the native function we pass to clEnqueueNativeKernel. * * @return the callback function address */ static native long getNativeKernelCallback(); /** * Returns the memory address of the native function we pass to clSetEventCallback. * * @return the callback function address */ static native long getEventCallback(); /** * Returns the memory address of the native function we pass to clCreateContext(FromType), * when APPLEContextLoggingUtil.SYSTEM_LOG_CALLBACK is used. * * @return the callback function address * * @see APPLEContextLoggingUtil#SYSTEM_LOG_CALLBACK */ static native long getLogMessageToSystemLogAPPLE(); /** * Returns the memory address of the native function we pass to clCreateContext(FromType), * when APPLEContextLoggingUtil.STD_OUT_CALLBACK is used. * * @return the callback function address * * @see APPLEContextLoggingUtil#STD_OUT_CALLBACK */ static native long getLogMessageToStdoutAPPLE(); /** * Returns the memory address of the native function we pass to clCreateContext(FromType), * when APPLEContextLoggingUtil.STD_ERR_CALLBACK is used. * * @return the callback function address * * @see APPLEContextLoggingUtil#STD_ERR_CALLBACK */ static native long getLogMessageToStderrAPPLE(); }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLFunctionAddress.java0000644000175000017500000000351311543426510022776 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.PointerWrapperAbstract; /** * This class is a wrapper around an OpenCL extension function pointer. * * @author Spasi */ final class CLFunctionAddress extends PointerWrapperAbstract { CLFunctionAddress(final long pointer) { super(pointer); } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLKernel.java0000644000175000017500000001602511543426510021125 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; /** * This class is a wrapper around a cl_kernel pointer. * * @author Spasi */ public final class CLKernel extends CLObjectChild { private static final CLKernelUtil util = (CLKernelUtil)CLPlatform.getInfoUtilInstance(CLKernel.class, "CL_KERNEL_UTIL"); CLKernel(final long pointer, final CLProgram program) { super(pointer, program); if ( isValid() ) program.getCLKernelRegistry().registerObject(this); } // ---------------[ UTILITY METHODS ]--------------- // clSetKernelArg methods /** * Sets a kernel argument at the specified index to the specified * byte value. * * @param index the argument index * @param value the argument value * * @return this CLKernel object */ public CLKernel setArg(final int index, final byte value) { util.setArg(this, index, value); return this; } /** * Sets a kernel argument at the specified index to the specified * byte value. * * @param index the argument index * @param value the argument value * * @return this CLKernel object */ public CLKernel setArg(final int index, final short value) { util.setArg(this, index, value); return this; } /** * Sets a kernel argument at the specified index to the specified * int value. * * @param index the argument index * @param value the argument value * * @return this CLKernel object */ public CLKernel setArg(final int index, final int value) { util.setArg(this, index, value); return this; } /** * Sets a kernel argument at the specified index to the specified * long value. * * @param index the argument index * @param value the argument value * * @return this CLKernel object */ public CLKernel setArg(final int index, final long value) { util.setArg(this, index, value); return this; } /** * Sets a kernel argument at the specified index to the specified * float value. * * @param index the argument index * @param value the argument value * * @return this CLKernel object */ public CLKernel setArg(final int index, final float value) { util.setArg(this, index, value); return this; } /** * Sets a kernel argument at the specified index to the specified * double value. * * @param index the argument index * @param value the argument value * * @return this CLKernel object */ public CLKernel setArg(final int index, final double value) { util.setArg(this, index, value); return this; } /** * Sets a kernel argument at the specified index to the specified * pointer value. * * @param index the argument index * @param value the argument value * * @return this CLKernel object */ public CLKernel setArg(final int index, final CLObject value) { util.setArg(this, index, value); return this; } /** * Sets the size of a __local kernel argument at the specified index. * * @param index the argument index * @param size the argument size * * @return this CLKernel object */ public CLKernel setArgSize(final int index, final long size) { util.setArgSize(this, index, size); return this; } // clGetKernelInfo methods /** * Returns the String value of the specified parameter. * * @param param_name the parameter * * @return the parameter value */ public String getInfoString(final int param_name) { return util.getInfoString(this, param_name); } /** * Returns the integer value of the specified parameter. * * @param param_name the parameter * * @return the parameter value */ public int getInfoInt(final int param_name) { return util.getInfoInt(this, param_name); } // clGetKernelWorkGroupInfo methods /** * Returns the size_t value of the specified parameter. * * @param param_name the parameter * * @return the parameter value */ public long getWorkGroupInfoSize(final CLDevice device, int param_name) { return util.getWorkGroupInfoSize(this, device, param_name); } /** * Returns an array of size_t values of the specified parameter. * * @param param_name the parameter * * @return the parameter values */ public long[] getWorkGroupInfoSizeArray(final CLDevice device, int param_name) { return util.getWorkGroupInfoSizeArray(this, device, param_name); } /** * Returns the long value of the specified parameter. Can be used * for both cl_ulong and cl_bitfield parameters. * * @param param_name the parameter * * @return the parameter value */ public long getWorkGroupInfoLong(final CLDevice device, int param_name) { return util.getWorkGroupInfoLong(this, device, param_name); } /** CLKernel utility methods interface. */ interface CLKernelUtil extends InfoUtil { void setArg(CLKernel kernel, int index, byte value); void setArg(CLKernel kernel, int index, short value); void setArg(CLKernel kernel, int index, int value); void setArg(CLKernel kernel, int index, long value); void setArg(CLKernel kernel, int index, float value); void setArg(CLKernel kernel, int index, double value); void setArg(CLKernel kernel, int index, CLObject pointer); void setArgSize(CLKernel kernel, int index, long size); long getWorkGroupInfoSize(CLKernel kernel, CLDevice device, int param_name); long[] getWorkGroupInfoSizeArray(CLKernel kernel, CLDevice device, int param_name); long getWorkGroupInfoLong(CLKernel kernel, CLDevice device, int param_name); } // -------[ IMPLEMENTATION STUFF BELOW ]------- int release() { try { return super.release(); } finally { if ( !isValid() ) getParent().getCLKernelRegistry().unregisterObject(this); } } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLObjectRegistryGlobal.java0000644000175000017500000000425211543426510023764 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; /** * A CLObject registry that also registers/unregisters objects to/from a global registry. * * @author Spasi */ final class CLObjectRegistryGlobal extends CLObjectRegistry { private final FastLongMap globalRegistry; CLObjectRegistryGlobal(final FastLongMap globalRegistry) { this.globalRegistry = globalRegistry; } void registerObject(final T object) { super.registerObject(object); globalRegistry.put(object.getPointer(), object); } void unregisterObject(final T object) { super.unregisterObject(object); globalRegistry.remove(object.getPointerUnsafe()); } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLBuildProgramCallback.java0000644000175000017500000000430311543426510023705 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; /** * Instances of this class can be used to receive OpenCL program build notifications. * * @author Spasi */ public abstract class CLBuildProgramCallback extends CLCallback { protected CLBuildProgramCallback() { super(CallbackUtil.getBuildProgramCallback()); } /** * Called from native code. * * @param program_address the CLProgram object pointer */ private void handleMessage(long program_address) { handleMessage(CLContext.getCLProgramGlobal(program_address)); } /** * The callback method. * * @param program the CLProgram object that was built */ protected abstract void handleMessage(CLProgram program); }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLObjectRegistry.java0000644000175000017500000000211511543426510022637 0ustar zero79zero79package org.lwjgl.opencl; import org.lwjgl.LWJGLUtil; /** * A CLObjectChild container. * * @author Spasi */ class CLObjectRegistry { private FastLongMap registry; CLObjectRegistry() { } final boolean isEmpty() { return registry == null || registry.isEmpty(); } final T getObject(final long id) { return registry == null ? null : registry.get(id); } final boolean hasObject(final long id) { return registry != null && registry.containsKey(id); } final Iterable> getAll() { return registry; } void registerObject(final T object) { final FastLongMap map = getMap(); final Long key = object.getPointer(); if ( LWJGLUtil.DEBUG && map.containsKey(key) ) throw new IllegalStateException("Duplicate object found: " + object.getClass() + " - " + key); getMap().put(object.getPointer(), object); } void unregisterObject(final T object) { getMap().remove(object.getPointerUnsafe()); } private FastLongMap getMap() { if ( registry == null ) registry = new FastLongMap(); return registry; } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLContextCallback.java0000644000175000017500000000475711543426510022757 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.PointerWrapperAbstract; import java.nio.ByteBuffer; /** * Instances of this class can be used to receive OpenCL context error notifications. * * @author Spasi */ public abstract class CLContextCallback extends PointerWrapperAbstract { private final boolean custom; protected CLContextCallback() { super(CallbackUtil.getContextCallback()); custom = false; } /** * This constructor allows non-LWJGL implementations. * * @param pointer */ protected CLContextCallback(final long pointer) { super(pointer); if ( pointer == 0 ) throw new RuntimeException("Invalid callback function pointer specified."); custom = true; } final boolean isCustom() { return custom; } /** * The callback method. * * @param errinfo the error description * @param private_info optional error data (may be null) */ protected abstract void handleMessage(String errinfo, ByteBuffer private_info); }lwjgl-2.7.1/src/java/org/lwjgl/opencl/APPLEContextLoggingUtil.java0000644000175000017500000000607311543426510024043 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import java.nio.ByteBuffer; /** * Utility class that provides CLContextCallback implementations that use * the APPLE_ContextLoggingFunctions callback functions. *

* TODO: Test this class * * @author Spasi */ public final class APPLEContextLoggingUtil { /** Sends all log messages to the Apple System Logger. */ public static final CLContextCallback SYSTEM_LOG_CALLBACK; /** Sends all log messages to the file descriptor stdout. */ public static final CLContextCallback STD_OUT_CALLBACK; /** Sends all log messages to the file descriptor stderr. */ public static final CLContextCallback STD_ERR_CALLBACK; static { if ( CLCapabilities.CL_APPLE_ContextLoggingFunctions ) { SYSTEM_LOG_CALLBACK = new CLContextCallback(CallbackUtil.getLogMessageToSystemLogAPPLE()) { protected void handleMessage(final String errinfo, final ByteBuffer private_info) { throw new UnsupportedOperationException(); } }; STD_OUT_CALLBACK = new CLContextCallback(CallbackUtil.getLogMessageToStdoutAPPLE()) { protected void handleMessage(final String errinfo, final ByteBuffer private_info) { throw new UnsupportedOperationException(); } }; STD_ERR_CALLBACK = new CLContextCallback(CallbackUtil.getLogMessageToStderrAPPLE()) { protected void handleMessage(final String errinfo, final ByteBuffer private_info) { throw new UnsupportedOperationException(); } }; } else { SYSTEM_LOG_CALLBACK = null; STD_OUT_CALLBACK = null; STD_ERR_CALLBACK = null; } } private APPLEContextLoggingUtil() {} }lwjgl-2.7.1/src/java/org/lwjgl/opencl/FastLongMap.java0000644000175000017500000001271611543426510021644 0ustar zero79zero79/* * Copyright 2002-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the * License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ package org.lwjgl.opencl; import java.util.Iterator; /** * A hash map using primitive longs as keys rather than objects. * * @author Justin Couch * @author Alex Chaffee (alex@apache.org) * @author Stephen Colebourne * @author Nathan Sweet */ final class FastLongMap implements Iterable> { private Entry[] table; private int size, mask, capacity, threshold; /** Same as: FastLongMap(16, 0.75f); */ FastLongMap() { this(16, 0.75f); } /** Same as: FastLongMap(initialCapacity, 0.75f); */ FastLongMap(int initialCapacity) { this(initialCapacity, 0.75f); } FastLongMap(int initialCapacity, float loadFactor) { if ( initialCapacity > 1 << 30 ) throw new IllegalArgumentException("initialCapacity is too large."); if ( initialCapacity < 0 ) throw new IllegalArgumentException("initialCapacity must be greater than zero."); if ( loadFactor <= 0 ) throw new IllegalArgumentException("initialCapacity must be greater than zero."); capacity = 1; while ( capacity < initialCapacity ) capacity <<= 1; this.threshold = (int)(capacity * loadFactor); this.table = new Entry[capacity]; this.mask = capacity - 1; } private int index(final long key) { return index(key, mask); } private static int index(final long key, final int mask) { final int hash = (int)(key ^ (key >>> 32)); return hash & mask; } public V put(long key, V value) { final Entry[] table = this.table; int index = index(key); // Check if key already exists. for ( Entry e = table[index]; e != null; e = e.next ) { if ( e.key != key ) continue; V oldValue = e.value; e.value = value; return oldValue; } table[index] = new Entry(key, value, table[index]); if ( size++ >= threshold ) rehash(table); return null; } private void rehash(final Entry[] table) { final int newCapacity = 2 * capacity; final int newMask = newCapacity - 1; final Entry[] newTable = new Entry[newCapacity]; for ( int i = 0, index; i < table.length; i++ ) { Entry e = table[i]; if ( e == null ) continue; do { final Entry next = e.next; index = index(e.key, newMask); e.next = newTable[index]; newTable[index] = e; e = next; } while ( e != null ); } this.table = newTable; capacity = newCapacity; mask = newMask; threshold *= 2; } public V get(long key) { final int index = index(key); for ( Entry e = table[index]; e != null; e = e.next ) if ( e.key == key ) return e.value; return null; } public boolean containsValue(Object value) { final Entry[] table = this.table; for ( int i = table.length - 1; i >= 0; i-- ) for ( Entry e = table[i]; e != null; e = e.next ) if ( e.value.equals(value) ) return true; return false; } public boolean containsKey(long key) { final int index = index(key); for ( Entry e = table[index]; e != null; e = e.next ) if ( e.key == key ) return true; return false; } public V remove(long key) { final int index = index(key); Entry prev = table[index]; Entry e = prev; while ( e != null ) { Entry next = e.next; if ( e.key == key ) { size--; if ( prev == e ) table[index] = next; else prev.next = next; return e.value; } prev = e; e = next; } return null; } public int size() { return size; } public boolean isEmpty() { return size == 0; } public void clear() { final Entry[] table = this.table; for ( int index = table.length - 1; index >= 0; index-- ) table[index] = null; size = 0; } public EntryIterator iterator() { return new EntryIterator(); } public class EntryIterator implements Iterator> { private int nextIndex; private Entry current; EntryIterator() { reset(); } public void reset() { current = null; // Find first bucket. final Entry[] table = FastLongMap.this.table; int i; for ( i = table.length - 1; i >= 0; i-- ) if ( table[i] != null ) break; nextIndex = i; } public boolean hasNext() { if ( nextIndex >= 0 ) return true; Entry e = current; return e != null && e.next != null; } public Entry next() { // Next entry in current bucket. Entry e = current; if ( e != null ) { e = e.next; if ( e != null ) { current = e; return e; } } // Use the bucket at nextIndex and find the next nextIndex. final Entry[] table = FastLongMap.this.table; int i = nextIndex; e = current = table[i]; while ( --i >= 0 ) if ( table[i] != null ) break; nextIndex = i; return e; } public void remove() { FastLongMap.this.remove(current.key); } } static final class Entry { final long key; T value; Entry next; Entry(long key, T value, Entry next) { this.key = key; this.value = value; this.next = next; } public long getKey() { return key; } public T getValue() { return value; } } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLPlatform.java0000644000175000017500000001613611543426510021474 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.PointerBuffer; import org.lwjgl.opencl.api.Filter; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.List; import static java.lang.Math.*; /** * This class is a wrapper around a cl_platform_id pointer. * * @author Spasi */ public final class CLPlatform extends CLObject { private static final CLPlatformUtil util = (CLPlatformUtil)getInfoUtilInstance(CLPlatform.class, "CL_PLATFORM_UTIL"); private static final FastLongMap clPlatforms = new FastLongMap(); private final CLObjectRegistry clDevices; /** Global registry for build callbacks. */ static final FastLongMap clDevicesGlobal = new FastLongMap(); private Object caps; CLPlatform(final long pointer) { super(pointer); if ( isValid() ) { clPlatforms.put(pointer, this); clDevices = new CLObjectRegistryGlobal(clDevicesGlobal); } else clDevices = null; } /** * Returns a CLPlatform with the specified id. * * @param id the platform object id * * @return the CLPlatform object */ public static CLPlatform getCLPlatform(final long id) { return clPlatforms.get(id); } /** * Returns a CLDevice that is available on this platform. * * @param id the device object id * * @return the CLDevice object */ public CLDevice getCLDevice(final long id) { return clDevices.getObject(id); } // ---------------[ UTILITY METHODS ]--------------- @SuppressWarnings("unchecked") static InfoUtil getInfoUtilInstance(final Class clazz, final String fieldName) { InfoUtil instance = null; try { final Class infoUtil = Class.forName("org.lwjgl.opencl.InfoUtilFactory"); instance = (InfoUtil)infoUtil.getDeclaredField(fieldName).get(null); } catch (Exception e) { // Ignore } return instance; } /** * Returns a list of all the available platforms. * * @return the available platforms */ public static List getPlatforms() { return getPlatforms(null); } /** * Returns a list of the available platforms, filtered by the specified filter. * * @param filter the platform filter * * @return the available platforms */ public static List getPlatforms(final Filter filter) { return util.getPlatforms(filter); } /** * Returns the String value of the specified parameter. * * @param param_name the parameter * * @return the parameter value */ public String getInfoString(int param_name) { return util.getInfoString(this, param_name); } /** * Returns a list of the available devices on this platform that * match the specified type. * * @param device_type the device type * * @return the available devices */ public List getDevices(final int device_type) { return getDevices(device_type, null); } /** * Returns a list of the available devices on this platform that * match the specified type, filtered by the specified filter. * * @param device_type the device type * @param filter the device filter * * @return the available devices */ public List getDevices(final int device_type, final Filter filter) { return util.getDevices(this, device_type, filter); } /** CLPlatform utility methods interface. */ interface CLPlatformUtil extends InfoUtil { List getPlatforms(Filter filter); List getDevices(CLPlatform platform, int device_type, final Filter filter); } // -------[ IMPLEMENTATION STUFF BELOW ]------- void setCapabilities(final Object caps) { this.caps = caps; } Object getCapabilities() { return caps; } /** * Called from clGetPlatformIDs to register new platforms. * * @param platforms a buffer containing CLPlatform pointers. */ static void registerCLPlatforms(final PointerBuffer platforms, final IntBuffer num_platforms) { if ( platforms == null ) return; final int pos = platforms.position(); final int count = min(num_platforms.get(0), platforms.remaining()); // We can't depend on .remaining() for ( int i = 0; i < count; i++ ) { final long id = platforms.get(pos + i); if ( !clPlatforms.containsKey(id) ) new CLPlatform(id); } } CLObjectRegistry getCLDeviceRegistry() { return clDevices; } static CLDevice getCLDeviceGlobal(final long id) { return clDevicesGlobal.get(id); } /** * Called from clGetDeviceIDs to register new devices. * * @param devices a buffer containing CLDevice pointers. */ void registerCLDevices(final PointerBuffer devices, final IntBuffer num_devices) { final int pos = devices.position(); final int count = min(num_devices.get(num_devices.position()), devices.remaining()); // We can't depend on .remaining() for ( int i = 0; i < count; i++ ) { final long id = devices.get(pos + i); if ( !clDevices.hasObject(id) ) new CLDevice(id, this); } } /** * Called from clGetContextInfo to register new devices. * * @param devices a buffer containing CLDevice pointers. */ void registerCLDevices(final ByteBuffer devices, final PointerBuffer num_devices) { final int pos = devices.position(); final int count = min((int)num_devices.get(num_devices.position()), devices.remaining()) / PointerBuffer.getPointerSize(); // We can't depend on .remaining() for ( int i = 0; i < count; i++ ) { final int offset = pos + (i * PointerBuffer.getPointerSize()); final long id = PointerBuffer.is64Bit() ? devices.getLong(offset) : devices.getInt(offset); if ( !clDevices.hasObject(id) ) new CLDevice(id, this); } } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLSampler.java0000644000175000017500000000540411543426510021307 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; /** * This class is a wrapper around a cl_sampler pointer. * * @author Spasi */ public final class CLSampler extends CLObjectChild { private static final InfoUtil util = CLPlatform.getInfoUtilInstance(CLSampler.class, "CL_SAMPLER_UTIL"); CLSampler(final long pointer, final CLContext context) { super(pointer, context); if ( isValid() ) context.getCLSamplerRegistry().registerObject(this); } // ---------------[ UTILITY METHODS ]--------------- /** * Returns the integer value of the specified parameter. * * @param param_name the parameter * * @return the parameter value */ public int getInfoInt(int param_name) { return util.getInfoInt(this, param_name); } /** * Returns the long value of the specified parameter. Can be used * for both cl_ulong and cl_bitfield parameters. * * @param param_name the parameter * * @return the parameter value */ public long getInfoLong(int param_name) { return util.getInfoLong(this, param_name); } // -------[ IMPLEMENTATION STUFF BELOW ]------- int release() { try { return super.release(); } finally { if ( !isValid() ) getParent().getCLSamplerRegistry().unregisterObject(this); } } }lwjgl-2.7.1/src/java/org/lwjgl/opencl/CLProgram.java0000644000175000017500000001454711543426510021323 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.PointerBuffer; import java.nio.ByteBuffer; /** * This class is a wrapper around a cl_program pointer. * * @author Spasi */ public final class CLProgram extends CLObjectChild { private static final CLProgramUtil util = (CLProgramUtil)CLPlatform.getInfoUtilInstance(CLProgram.class, "CL_PROGRAM_UTIL"); private final CLObjectRegistry clKernels; CLProgram(final long pointer, final CLContext context) { super(pointer, context); if ( isValid() ) { context.getCLProgramRegistry().registerObject(this); clKernels = new CLObjectRegistry(); } else clKernels = null; } /** * Returns a CLKernel associated with this program. * * @param id the kernel id * * @return the CLKernel object */ public CLKernel getCLKernel(final long id) { return clKernels.getObject(id); } // ---------------[ UTILITY METHODS ]--------------- /** * Creates kernel objects for all kernels functions in this program. * * @return a CLKernel array */ public CLKernel[] createKernelsInProgram() { return util.createKernelsInProgram(this); } /** * Returns the String value of the specified parameter. * * @param param_name the parameter * * @return the parameter value */ public String getInfoString(final int param_name) { return util.getInfoString(this, param_name); } /** * Returns the integer value of the specified parameter. * * @param param_name the parameter * * @return the parameter value */ public int getInfoInt(final int param_name) { return util.getInfoInt(this, param_name); } /** * Returns an array of size_t values of the specified parameter. * * @param param_name the parameter * * @return the parameter values */ public long[] getInfoSizeArray(final int param_name) { return util.getInfoSizeArray(this, param_name); } /** * Returns an array of CLDevices associated with this program. * * @return the array of devices */ public CLDevice[] getInfoDevices() { return util.getInfoDevices(this); } /** * Returns the program binaries for all devices associated with program, * written sequentially in the target ByteBuffer. If the target * parameter is null, a new ByteBuffer will be allocated. If not, the * target ByteBuffer must be big enough to hold the program binaries, as * returned by CL_PROGRAM_BINARY_SIZES. * * @param target the target ByteBuffer array. * * @return the array of devices */ public ByteBuffer getInfoBinaries(final ByteBuffer target) { return util.getInfoBinaries(this, target); } /** * Returns the program binaries for all devices associated with program, * as a ByteBuffer array. If the target parameter is null, * a new ByteBuffer array will be allocated. If not, the target ByteBuffers * must be big enough to hold the program binaries, as returned by * CL_PROGRAM_BINARY_SIZES. * * @param target the target ByteBuffer array. * * @return the array of devices */ public ByteBuffer[] getInfoBinaries(final ByteBuffer[] target) { return util.getInfoBinaries(this, target); } // clGetProgramBuildInfo methods /** * Returns the String value of the specified parameter. * * @param param_name the parameter * * @return the parameter value */ public String getBuildInfoString(final CLDevice device, final int param_name) { return util.getBuildInfoString(this, device, param_name); } /** * Returns the integer value of the specified parameter. * * @param param_name the parameter * * @return the parameter value */ public int getBuildInfoInt(final CLDevice device, final int param_name) { return util.getBuildInfoInt(this, device, param_name); } /** CLProgram utility methods interface. */ interface CLProgramUtil extends InfoUtil { CLKernel[] createKernelsInProgram(CLProgram program); CLDevice[] getInfoDevices(CLProgram program); ByteBuffer getInfoBinaries(CLProgram program, ByteBuffer target); ByteBuffer[] getInfoBinaries(CLProgram program, ByteBuffer[] target); String getBuildInfoString(CLProgram program, final CLDevice device, int param_name); int getBuildInfoInt(CLProgram program, final CLDevice device, int param_name); } // -------[ IMPLEMENTATION STUFF BELOW ]------- CLObjectRegistry getCLKernelRegistry() { return clKernels; } /** * Called from clCreateKernelsInProgram to register new CLKernels. * * @param kernels a buffer containing CLKernel pointers. */ void registerCLKernels(final PointerBuffer kernels) { for ( int i = kernels.position(); i < kernels.limit(); i++ ) { final long pointer = kernels.get(i); if ( pointer != 0 ) new CLKernel(pointer, this); } } int release() { try { return super.release(); } finally { if ( !isValid() ) getParent().getCLProgramRegistry().unregisterObject(this); } } }lwjgl-2.7.1/src/java/org/lwjgl/LWJGLException.java0000644000175000017500000000457011543426510020746 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl; /** *

* This exception is supplied to make exception handling more generic for LWJGL * specific exceptions *

* * @author Brian Matzon * @version $Revision: 2983 $ * $Id: LWJGLException.java 2983 2008-04-07 18:36:09Z matzon $ */ public class LWJGLException extends Exception { private static final long serialVersionUID = 1L; /** * Plain c'tor */ public LWJGLException() { super(); } /** * Creates a new LWJGLException * * @param msg * String identifier for exception */ public LWJGLException(String msg) { super(msg); } /** * @param message * @param cause */ public LWJGLException(String message, Throwable cause) { super(message, cause); } /** * @param cause */ public LWJGLException(Throwable cause) { super(cause); } } lwjgl-2.7.1/src/java/org/lwjgl/PointerWrapper.java0000644000175000017500000000331211543426510021162 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl; /** * A common interface for classes that wrap pointer addresses. * * @author Spasi */ public interface PointerWrapper { long getPointer(); }lwjgl-2.7.1/src/java/org/lwjgl/examples/0000755000175000017500000000000011543426510017155 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/examples/Game.java0000644000175000017500000001246211543426510020676 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.examples; import org.lwjgl.Sys; import org.lwjgl.input.Keyboard; import org.lwjgl.openal.AL; import org.lwjgl.opengl.Display; import static org.lwjgl.opengl.GL11.*; /** * * This is a very basic skeleton to init a game and run it. * * @author $Author: spasi $ * @version $Revision: 3418 $ * $Id: Game.java 3418 2010-09-28 21:11:35Z spasi $ */ public class Game { /** Game title */ public static final String GAME_TITLE = "My Game"; /** Desired frame time */ private static final int FRAMERATE = 60; /** Exit the game */ private static boolean finished; /** A rotating square! */ private static float angle; /** * No constructor needed - this class is static */ private Game() {} /** * Application init * @param args Commandline args */ public static void main(String[] args) { try { init(); run(); } catch (Exception e) { e.printStackTrace(System.err); Sys.alert(GAME_TITLE, "An error occured and the game will exit."); } finally { cleanup(); } System.exit(0); } /** * Initialise the game * @throws Exception if init fails */ private static void init() throws Exception { // Create a fullscreen window with 1:1 orthographic 2D projection, and with // mouse, keyboard, and gamepad inputs. Display.setTitle(GAME_TITLE); Display.setFullscreen(true); // Enable vsync if we can Display.setVSyncEnabled(true); Display.create(); // Start up the sound system AL.create(); // TODO: Load in your textures etc here // Put the window into orthographic projection mode with 1:1 pixel ratio. // We haven't used GLU here to do this to avoid an unnecessary dependency. glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, Display.getDisplayMode().getWidth(), 0.0, Display.getDisplayMode().getHeight(), -1.0, 1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight()); } /** * Runs the game (the "main loop") */ private static void run() { while (!finished) { // Always call Window.update(), all the time Display.update(); if (Display.isCloseRequested()) { // Check for O/S close requests finished = true; } else if (Display.isActive()) { // The window is in the foreground, so we should play the game logic(); render(); Display.sync(FRAMERATE); } else { // The window is not in the foreground, so we can allow other stuff to run and // infrequently update try { Thread.sleep(100); } catch (InterruptedException e) { } logic(); if (Display.isVisible() || Display.isDirty()) { // Only bother rendering if the window is visible or dirty render(); } } } } /** * Do any game-specific cleanup */ private static void cleanup() { // TODO: save anything you want to disk here // Stop the sound AL.destroy(); // Close the window Display.destroy(); } /** * Do all calculations, handle input, etc. */ private static void logic() { // Example input handler: we'll check for the ESC key and finish the game instantly when it's pressed if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) { finished = true; } // TODO: all your game logic goes here. angle += 2.0f % 360; } /** * Render the current frame */ private static void render() { glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); // TODO: all your rendering goes here glClear(GL_COLOR_BUFFER_BIT); glPushMatrix(); glTranslatef(Display.getDisplayMode().getWidth() / 2, Display.getDisplayMode().getHeight() / 2, 0.0f); glRotatef(angle, 0, 0, 1.0f); glBegin(GL_QUADS); glVertex2i(-50, -50); glVertex2i(50, -50); glVertex2i(50, 50); glVertex2i(-50, 50); glEnd(); glPopMatrix(); } } lwjgl-2.7.1/src/java/org/lwjgl/examples/spaceinvaders/0000755000175000017500000000000011543426510022004 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/examples/spaceinvaders/Entity.java0000644000175000017500000001243111543426510024124 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.examples.spaceinvaders; import java.awt.Rectangle; /** * An entity represents any element that appears in the game. The * entity is responsible for resolving collisions and movement * based on a set of properties defined either by subclass or externally. * * Note that doubles are used for positions. This may seem strange * given that pixels locations are integers. However, using double means * that an entity can move a partial pixel. It doesn't of course mean that * they will be display half way through a pixel but allows us not lose * accuracy as we move. * * @author Kevin Glass */ public abstract class Entity { /** The current x location of this entity */ protected float x; /** The current y location of this entity */ protected float y; /** The sprite that represents this entity */ protected Sprite sprite; /** The current speed of this entity horizontally (pixels/sec) */ protected float dx; /** The current speed of this entity vertically (pixels/sec) */ protected float dy; /** The rectangle used for this entity during collisions resolution */ private Rectangle me = new Rectangle(); /** The rectangle used for other entities during collision resolution */ private Rectangle him = new Rectangle(); /** * Construct a entity based on a sprite image and a location. * * @param sprite The reference to the image to be displayed for this entity * @param x The initial x location of this entity * @param y The initial y location of this entity */ protected Entity(Sprite sprite, int x, int y) { this.sprite = sprite; this.x = x; this.y = y; } /** * Request that this entity move itself based on a certain ammount * of time passing. * * @param delta The ammount of time that has passed in milliseconds */ public void move(long delta) { // update the location of the entity based on move speeds x += (delta * dx) / 1000; y += (delta * dy) / 1000; } /** * Set the horizontal speed of this entity * * @param dx The horizontal speed of this entity (pixels/sec) */ public void setHorizontalMovement(float dx) { this.dx = dx; } /** * Set the vertical speed of this entity * * @param dy The vertical speed of this entity (pixels/sec) */ public void setVerticalMovement(float dy) { this.dy = dy; } /** * Get the horizontal speed of this entity * * @return The horizontal speed of this entity (pixels/sec) */ public float getHorizontalMovement() { return dx; } /** * Get the vertical speed of this entity * * @return The vertical speed of this entity (pixels/sec) */ public float getVerticalMovement() { return dy; } /** * Draw this entity to the graphics context provided */ public void draw() { sprite.draw((int) x, (int) y); } /** * Do the logic associated with this entity. This method * will be called periodically based on game events */ public void doLogic() { } /** * Get the x location of this entity * * @return The x location of this entity */ public int getX() { return (int) x; } /** * Get the y location of this entity * * @return The y location of this entity */ public int getY() { return (int) y; } /** * Check if this entity collised with another. * * @param other The other entity to check collision against * @return True if the entities collide with each other */ public boolean collidesWith(Entity other) { me.setBounds((int) x, (int) y, sprite.getWidth(), sprite.getHeight()); him.setBounds((int) other.x, (int) other.y, other.sprite.getWidth(), other.sprite.getHeight()); return me.intersects(him); } /** * Notification that this entity collided with another. * * @param other The entity with which this entity collided. */ public abstract void collidedWith(Entity other); }lwjgl-2.7.1/src/java/org/lwjgl/examples/spaceinvaders/Texture.java0000644000175000017500000001110311543426510024303 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.examples.spaceinvaders; import static org.lwjgl.opengl.GL11.*; /** * A texture to be bound within OpenGL. This object is responsible for * keeping track of a given OpenGL texture and for calculating the * texturing mapping coordinates of the full image. * * Since textures need to be powers of 2 the actual texture may be * considerably bigged that the source image and hence the texture * mapping coordinates need to be adjusted to matchup drawing the * sprite against the texture. * * @author Kevin Glass * @author Brian Matzon */ public class Texture { /** The GL target type */ private int target; /** The GL texture ID */ private int textureID; /** The height of the image */ private int height; /** The width of the image */ private int width; /** The width of the texture */ private int texWidth; /** The height of the texture */ private int texHeight; /** The ratio of the width of the image to the texture */ private float widthRatio; /** The ratio of the height of the image to the texture */ private float heightRatio; /** * Create a new texture * * @param target The GL target * @param textureID The GL texture ID */ public Texture(int target, int textureID) { this.target = target; this.textureID = textureID; } /** * Bind the specified GL context to a texture */ public void bind() { glBindTexture(target, textureID); } /** * Set the height of the image * * @param height The height of the image */ public void setHeight(int height) { this.height = height; setHeight(); } /** * Set the width of the image * * @param width The width of the image */ public void setWidth(int width) { this.width = width; setWidth(); } /** * Get the height of the original image * * @return The height of the original image */ public int getImageHeight() { return height; } /** * Get the width of the original image * * @return The width of the original image */ public int getImageWidth() { return width; } /** * Get the height of the physical texture * * @return The height of physical texture */ public float getHeight() { return heightRatio; } /** * Get the width of the physical texture * * @return The width of physical texture */ public float getWidth() { return widthRatio; } /** * Set the height of this texture * * @param texHeight The height of the texture */ public void setTextureHeight(int texHeight) { this.texHeight = texHeight; setHeight(); } /** * Set the width of this texture * * @param texWidth The width of the texture */ public void setTextureWidth(int texWidth) { this.texWidth = texWidth; setWidth(); } /** * Set the height of the texture. This will update the * ratio also. */ private void setHeight() { if (texHeight != 0) { heightRatio = ((float) height) / texHeight; } } /** * Set the width of the texture. This will update the * ratio also. */ private void setWidth() { if (texWidth != 0) { widthRatio = ((float) width) / texWidth; } } }lwjgl-2.7.1/src/java/org/lwjgl/examples/spaceinvaders/Game.java0000644000175000017500000004240611543426510023526 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.examples.spaceinvaders; import java.util.ArrayList; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import static org.lwjgl.opengl.GL11.*; /** * The main hook of our game. This class with both act as a manager * for the display and central mediator for the game logic. * * Display management will consist of a loop that cycles round all * entities in the game asking them to move and then drawing them * in the appropriate place. With the help of an inner class it * will also allow the player to control the main ship. * * As a mediator it will be informed when entities within our game * detect events (e.g. alient killed, played died) and will take * appropriate game actions. * *

* NOTE:
* This game is a LWJGLized implementation of the Space Invaders game by Kevin * Glass. The original implementation is renderer agnostic and supports other * OpenGL implementations as well as Java2D. This version has been made specific * for LWJGL, and has added input control as well as sound (which the original doesn't, * at the time of writing). * You can find the original article here:
* http://www.cokeandcode.com *

* * @author Kevin Glass * @author Brian Matzon */ public class Game { /** The normal title of the window */ private String WINDOW_TITLE = "Space Invaders 104 (for LWJGL)"; /** The width of the game display area */ private int width = 800; /** The height of the game display area */ private int height = 600; /** The loader responsible for converting images into OpenGL textures */ private TextureLoader textureLoader; /** The list of all the entities that exist in our game */ private ArrayList entities = new ArrayList(); /** The list of entities that need to be removed from the game this loop */ private ArrayList removeList = new ArrayList(); /** The entity representing the player */ private ShipEntity ship; /** List of shots */ private ShotEntity[] shots; /** The message to display which waiting for a key press */ private Sprite message; /** The sprite containing the "Press Any Key" message */ private Sprite pressAnyKey; /** The sprite containing the "You win!" message */ private Sprite youWin; /** The sprite containing the "You lose!" message */ private Sprite gotYou; /** Last shot index */ private int shotIndex; /** The speed at which the player's ship should move (pixels/sec) */ private float moveSpeed = 300; /** The time at which last fired a shot */ private long lastFire; /** The interval between our players shot (ms) */ private long firingInterval = 500; /** The number of aliens left on the screen */ private int alienCount; /** True if we're holding up game play until a key has been pressed */ private boolean waitingForKeyPress = true; /** True if game logic needs to be applied this loop, normally as a result of a game event */ private boolean logicRequiredThisLoop; /** The time at which the last rendering looped started from the point of view of the game logic */ private long lastLoopTime = getTime(); /** True if the fire key has been released */ private boolean fireHasBeenReleased; /** The time since the last record of fps */ private long lastFpsTime; /** The recorded fps */ private int fps; private static long timerTicksPerSecond = Sys.getTimerResolution(); /** True if the game is currently "running", i.e. the game loop is looping */ public static boolean gameRunning = true; /** SoundManager to make sound with */ private SoundManager soundManager; /** Whether we're running in fullscreen mode */ private boolean fullscreen; /** ID of shot effect */ private int SOUND_SHOT; /** ID of hit effect */ private int SOUND_HIT; /** ID of start sound */ private int SOUND_START; /** ID of win sound */ private int SOUND_WIN; /** ID of loose sound */ private int SOUND_LOOSE; /** Mouse movement on x axis */ private int mouseX; /** Is this an application or applet */ private static boolean isApplication; /** * Construct our game and set it running. * @param fullscreen * */ public Game(boolean fullscreen) { this.fullscreen = fullscreen; initialize(); } /** * Get the high resolution time in milliseconds * * @return The high resolution time in milliseconds */ public static long getTime() { // we get the "timer ticks" from the high resolution timer // multiply by 1000 so our end result is in milliseconds // then divide by the number of ticks in a second giving // us a nice clear time in milliseconds return (Sys.getTime() * 1000) / timerTicksPerSecond; } /** * Sleep for a fixed number of milliseconds. * * @param duration The amount of time in milliseconds to sleep for */ public static void sleep(long duration) { try { Thread.sleep((duration * timerTicksPerSecond) / 1000); } catch (InterruptedException inte) { } } /** * Intialise the common elements for the game */ public void initialize() { // initialize the window beforehand try { setDisplayMode(); Display.setTitle(WINDOW_TITLE); Display.setFullscreen(fullscreen); Display.create(); // grab the mouse, dont want that hideous cursor when we're playing! if (isApplication) { Mouse.setGrabbed(true); } // enable textures since we're going to use these for our sprites glEnable(GL_TEXTURE_2D); // disable the OpenGL depth test since we're rendering 2D graphics glDisable(GL_DEPTH_TEST); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, width, height, 0, -1, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glViewport(0, 0, width, height); textureLoader = new TextureLoader(); // create our sound manager, and initialize it with 7 channels // 1 channel for sounds, 6 for effects - this should be enough // since we have a most 4 shots on screen at any one time, which leaves // us with 2 channels for explosions. soundManager = new SoundManager(); soundManager.initialize(8); // load our sound data SOUND_SHOT = soundManager.addSound("shot.wav"); SOUND_HIT = soundManager.addSound("hit.wav"); SOUND_START = soundManager.addSound("start.wav"); SOUND_WIN = soundManager.addSound("win.wav"); SOUND_LOOSE = soundManager.addSound("loose.wav"); } catch (LWJGLException le) { System.out.println("Game exiting - exception in initialization:"); le.printStackTrace(); Game.gameRunning = false; return; } // get our sprites gotYou = getSprite("gotyou.gif"); pressAnyKey = getSprite("pressanykey.gif"); youWin = getSprite("youwin.gif"); message = pressAnyKey; // setup 5 shots shots = new ShotEntity[5]; for (int i = 0; i < shots.length; i++) { shots[i] = new ShotEntity(this, "shot.gif", 0, 0); } // setup the initial game state startGame(); } /** * Sets the display mode for fullscreen mode */ private boolean setDisplayMode() { try { // get modes DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(width, height, -1, -1, -1, -1, 60, 60); org.lwjgl.util.Display.setDisplayMode(dm, new String[] { "width=" + width, "height=" + height, "freq=" + 60, "bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel() }); return true; } catch (Exception e) { e.printStackTrace(); System.out.println("Unable to enter fullscreen, continuing in windowed mode"); } return false; } /** * Start a fresh game, this should clear out any old data and * create a new set. */ private void startGame() { // clear out any existing entities and intialise a new set entities.clear(); initEntities(); } /** * Initialise the starting state of the entities (ship and aliens). Each * entitiy will be added to the overall list of entities in the game. */ private void initEntities() { // create the player ship and place it roughly in the center of the screen ship = new ShipEntity(this, "ship.gif", 370, 550); entities.add(ship); // create a block of aliens (5 rows, by 12 aliens, spaced evenly) alienCount = 0; for (int row = 0; row < 5; row++) { for (int x = 0; x < 12; x++) { Entity alien = new AlienEntity(this, 100 + (x * 50), (50) + row * 30); entities.add(alien); alienCount++; } } } /** * Notification from a game entity that the logic of the game * should be run at the next opportunity (normally as a result of some * game event) */ public void updateLogic() { logicRequiredThisLoop = true; } /** * Remove an entity from the game. The entity removed will * no longer move or be drawn. * * @param entity The entity that should be removed */ public void removeEntity(Entity entity) { removeList.add(entity); } /** * Notification that the player has died. */ public void notifyDeath() { if (!waitingForKeyPress) { soundManager.playSound(SOUND_LOOSE); } message = gotYou; waitingForKeyPress = true; } /** * Notification that the player has won since all the aliens * are dead. */ public void notifyWin() { message = youWin; waitingForKeyPress = true; soundManager.playSound(SOUND_WIN); } /** * Notification that an alien has been killed */ public void notifyAlienKilled() { // reduce the alient count, if there are none left, the player has won! alienCount--; if (alienCount == 0) { notifyWin(); } // if there are still some aliens left then they all need to get faster, so // speed up all the existing aliens for ( Entity entity : entities ) { if ( entity instanceof AlienEntity ) { // speed up by 2% entity.setHorizontalMovement(entity.getHorizontalMovement() * 1.02f); } } soundManager.playEffect(SOUND_HIT); } /** * Attempt to fire a shot from the player. Its called "try" * since we must first check that the player can fire at this * point, i.e. has he/she waited long enough between shots */ public void tryToFire() { // check that we have waiting long enough to fire if (System.currentTimeMillis() - lastFire < firingInterval) { return; } // if we waited long enough, create the shot entity, and record the time. lastFire = System.currentTimeMillis(); ShotEntity shot = shots[shotIndex++ % shots.length]; shot.reinitialize(ship.getX() + 10, ship.getY() - 30); entities.add(shot); soundManager.playEffect(SOUND_SHOT); } /** * Run the main game loop. This method keeps rendering the scene * and requesting that the callback update its screen. */ private void gameLoop() { while (Game.gameRunning) { // clear screen glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // let subsystem paint frameRendering(); // update window contents Display.update(); } // clean up soundManager.destroy(); Display.destroy(); } /** * Notification that a frame is being rendered. Responsible for * running game logic and rendering the scene. */ public void frameRendering() { //SystemTimer.sleep(lastLoopTime+10-SystemTimer.getTime()); Display.sync(60); // work out how long its been since the last update, this // will be used to calculate how far the entities should // move this loop long delta = getTime() - lastLoopTime; lastLoopTime = getTime(); lastFpsTime += delta; fps++; // update our FPS counter if a second has passed if (lastFpsTime >= 1000) { Display.setTitle(WINDOW_TITLE + " (FPS: " + fps + ")"); lastFpsTime = 0; fps = 0; } // cycle round asking each entity to move itself if (!waitingForKeyPress && !soundManager.isPlayingSound()) { for ( Entity entity : entities ) { entity.move(delta); } } // cycle round drawing all the entities we have in the game for ( Entity entity : entities ) { entity.draw(); } // brute force collisions, compare every entity against // every other entity. If any of them collide notify // both entities that the collision has occured for (int p = 0; p < entities.size(); p++) { for (int s = p + 1; s < entities.size(); s++) { Entity me = entities.get(p); Entity him = entities.get(s); if (me.collidesWith(him)) { me.collidedWith(him); him.collidedWith(me); } } } // remove any entity that has been marked for clear up entities.removeAll(removeList); removeList.clear(); // if a game event has indicated that game logic should // be resolved, cycle round every entity requesting that // their personal logic should be considered. if (logicRequiredThisLoop) { for ( Entity entity : entities ) { entity.doLogic(); } logicRequiredThisLoop = false; } // if we're waiting for an "any key" press then draw the // current message if (waitingForKeyPress) { message.draw(325, 250); } // resolve the movemfent of the ship. First assume the ship // isn't moving. If either cursor key is pressed then // update the movement appropraitely ship.setHorizontalMovement(0); // get mouse movement on x axis. We need to get it now, since // we can only call getDX ONCE! - secondary calls will yield 0, since // there haven't been any movement since last call. mouseX = Mouse.getDX(); // we delegate input checking to submethod since we want to check // for keyboard, mouse & controller boolean leftPressed = hasInput(Keyboard.KEY_LEFT); boolean rightPressed = hasInput(Keyboard.KEY_RIGHT); boolean firePressed = hasInput(Keyboard.KEY_SPACE); if (!waitingForKeyPress && !soundManager.isPlayingSound()) { if ((leftPressed) && (!rightPressed)) { ship.setHorizontalMovement(-moveSpeed); } else if ((rightPressed) && (!leftPressed)) { ship.setHorizontalMovement(moveSpeed); } // if we're pressing fire, attempt to fire if (firePressed) { tryToFire(); } } else { if (!firePressed) { fireHasBeenReleased = true; } if ((firePressed) && (fireHasBeenReleased) && !soundManager.isPlayingSound()) { waitingForKeyPress = false; fireHasBeenReleased = false; startGame(); soundManager.playSound(SOUND_START); } } // if escape has been pressed, stop the game if ((Display.isCloseRequested() || Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) && isApplication) { Game.gameRunning = false; } } /** * @param direction * @return */ private boolean hasInput(int direction) { switch(direction) { case Keyboard.KEY_LEFT: return Keyboard.isKeyDown(Keyboard.KEY_LEFT) || mouseX < 0; case Keyboard.KEY_RIGHT: return Keyboard.isKeyDown(Keyboard.KEY_RIGHT) || mouseX > 0; case Keyboard.KEY_SPACE: return Keyboard.isKeyDown(Keyboard.KEY_SPACE) || Mouse.isButtonDown(0); } return false; } /** * The entry point into the game. We'll simply create an * instance of class which will start the display and game * loop. * * @param argv The arguments that are passed into our game */ public static void main(String argv[]) { isApplication = true; System.out.println("Use -fullscreen for fullscreen mode"); new Game((argv.length > 0 && "-fullscreen".equalsIgnoreCase(argv[0]))).execute(); System.exit(0); } /** * */ public void execute() { gameLoop(); } /** * Create or get a sprite which displays the image that is pointed * to in the classpath by "ref" * * @param ref A reference to the image to load * @return A sprite that can be drawn onto the current graphics context. */ public Sprite getSprite(String ref) { return new Sprite(textureLoader, ref); } } lwjgl-2.7.1/src/java/org/lwjgl/examples/spaceinvaders/Sprite.java0000644000175000017500000000725311543426510024124 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.examples.spaceinvaders; import java.io.IOException; import static org.lwjgl.opengl.GL11.*; /** * Implementation of sprite that uses an OpenGL quad and a texture * to render a given image to the screen. * * @author Kevin Glass * @author Brian Matzon */ public class Sprite { /** The texture that stores the image for this sprite */ private Texture texture; /** The width in pixels of this sprite */ private int width; /** The height in pixels of this sprite */ private int height; /** * Create a new sprite from a specified image. * * @param loader the texture loader to use * @param ref A reference to the image on which this sprite should be based */ public Sprite(TextureLoader loader, String ref) { try { texture = loader.getTexture("spaceinvaders/" + ref); width = texture.getImageWidth(); height = texture.getImageHeight(); } catch (IOException ioe) { ioe.printStackTrace(); System.exit(-1); } } /** * Get the width of this sprite in pixels * * @return The width of this sprite in pixels */ public int getWidth() { return texture.getImageWidth(); } /** * Get the height of this sprite in pixels * * @return The height of this sprite in pixels */ public int getHeight() { return texture.getImageHeight(); } /** * Draw the sprite at the specified location * * @param x The x location at which to draw this sprite * @param y The y location at which to draw this sprite */ public void draw(int x, int y) { // store the current model matrix glPushMatrix(); // bind to the appropriate texture for this sprite texture.bind(); // translate to the right location and prepare to draw glTranslatef(x, y, 0); // draw a quad textured to match the sprite glBegin(GL_QUADS); { glTexCoord2f(0, 0); glVertex2f(0, 0); glTexCoord2f(0, texture.getHeight()); glVertex2f(0, height); glTexCoord2f(texture.getWidth(), texture.getHeight()); glVertex2f(width, height); glTexCoord2f(texture.getWidth(), 0); glVertex2f(width, 0); } glEnd(); // restore the model view matrix to prevent contamination glPopMatrix(); } }lwjgl-2.7.1/src/java/org/lwjgl/examples/spaceinvaders/TextureLoader.java0000644000175000017500000002445411543426510025447 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.examples.spaceinvaders; import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import java.awt.color.ColorSpace; import java.awt.image.BufferedImage; import java.awt.image.ColorModel; import java.awt.image.ComponentColorModel; import java.awt.image.DataBuffer; import java.awt.image.DataBufferByte; import java.awt.image.Raster; import java.awt.image.WritableRaster; import java.io.IOException; import java.net.URL; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; import java.util.HashMap; import java.util.Hashtable; import javax.swing.ImageIcon; import org.lwjgl.BufferUtils; import static org.lwjgl.opengl.GL11.*; /** * A utility class to load textures for OpenGL. This source is based * on a texture that can be found in the Java Gaming (www.javagaming.org) * Wiki. It has been simplified slightly for explicit 2D graphics use. * * OpenGL uses a particular image format. Since the images that are * loaded from disk may not match this format this loader introduces * a intermediate image which the source image is copied into. In turn, * this image is used as source for the OpenGL texture. * * @author Kevin Glass * @author Brian Matzon */ public class TextureLoader { /** The table of textures that have been loaded in this loader */ private HashMap table = new HashMap(); /** The colour model including alpha for the GL image */ private ColorModel glAlphaColorModel; /** The colour model for the GL image */ private ColorModel glColorModel; /** Scratch buffer for texture ID's */ private IntBuffer textureIDBuffer = BufferUtils.createIntBuffer(1); /** * Create a new texture loader based on the game panel */ public TextureLoader() { glAlphaColorModel = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[] {8,8,8,8}, true, false, ComponentColorModel.TRANSLUCENT, DataBuffer.TYPE_BYTE); glColorModel = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[] {8,8,8,0}, false, false, ComponentColorModel.OPAQUE, DataBuffer.TYPE_BYTE); } /** * Create a new texture ID * * @return A new texture ID */ private int createTextureID() { glGenTextures(textureIDBuffer); return textureIDBuffer.get(0); } /** * Load a texture * * @param resourceName The location of the resource to load * @return The loaded texture * @throws IOException Indicates a failure to access the resource */ public Texture getTexture(String resourceName) throws IOException { Texture tex = table.get(resourceName); if (tex != null) { return tex; } tex = getTexture(resourceName, GL_TEXTURE_2D, // target GL_RGBA, // dst pixel format GL_LINEAR, // min filter (unused) GL_LINEAR); table.put(resourceName,tex); return tex; } /** * Load a texture into OpenGL from a image reference on * disk. * * @param resourceName The location of the resource to load * @param target The GL target to load the texture against * @param dstPixelFormat The pixel format of the screen * @param minFilter The minimising filter * @param magFilter The magnification filter * @return The loaded texture * @throws IOException Indicates a failure to access the resource */ public Texture getTexture(String resourceName, int target, int dstPixelFormat, int minFilter, int magFilter) throws IOException { int srcPixelFormat; // create the texture ID for this texture int textureID = createTextureID(); Texture texture = new Texture(target,textureID); // bind this texture glBindTexture(target, textureID); BufferedImage bufferedImage = loadImage(resourceName); texture.setWidth(bufferedImage.getWidth()); texture.setHeight(bufferedImage.getHeight()); if (bufferedImage.getColorModel().hasAlpha()) { srcPixelFormat = GL_RGBA; } else { srcPixelFormat = GL_RGB; } // convert that image into a byte buffer of texture data ByteBuffer textureBuffer = convertImageData(bufferedImage,texture); if (target == GL_TEXTURE_2D) { glTexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilter); glTexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilter); } // produce a texture from the byte buffer glTexImage2D(target, 0, dstPixelFormat, get2Fold(bufferedImage.getWidth()), get2Fold(bufferedImage.getHeight()), 0, srcPixelFormat, GL_UNSIGNED_BYTE, textureBuffer ); return texture; } /** * Get the closest greater power of 2 to the fold number * * @param fold The target number * @return The power of 2 */ private static int get2Fold(int fold) { int ret = 2; while (ret < fold) { ret *= 2; } return ret; } /** * Convert the buffered image to a texture * * @param bufferedImage The image to convert to a texture * @param texture The texture to store the data into * @return A buffer containing the data */ private ByteBuffer convertImageData(BufferedImage bufferedImage,Texture texture) { ByteBuffer imageBuffer; WritableRaster raster; BufferedImage texImage; int texWidth = 2; int texHeight = 2; // find the closest power of 2 for the width and height // of the produced texture while (texWidth < bufferedImage.getWidth()) { texWidth *= 2; } while (texHeight < bufferedImage.getHeight()) { texHeight *= 2; } texture.setTextureHeight(texHeight); texture.setTextureWidth(texWidth); // create a raster that can be used by OpenGL as a source // for a texture if (bufferedImage.getColorModel().hasAlpha()) { raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,texWidth,texHeight,4,null); texImage = new BufferedImage(glAlphaColorModel,raster,false,new Hashtable()); } else { raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,texWidth,texHeight,3,null); texImage = new BufferedImage(glColorModel,raster,false,new Hashtable()); } // copy the source image into the produced image Graphics g = texImage.getGraphics(); g.setColor(new Color(0f,0f,0f,0f)); g.fillRect(0,0,texWidth,texHeight); g.drawImage(bufferedImage,0,0,null); // build a byte buffer from the temporary image // that be used by OpenGL to produce a texture. byte[] data = ((DataBufferByte) texImage.getRaster().getDataBuffer()).getData(); imageBuffer = ByteBuffer.allocateDirect(data.length); imageBuffer.order(ByteOrder.nativeOrder()); imageBuffer.put(data, 0, data.length); imageBuffer.flip(); return imageBuffer; } /** * Load a given resource as a buffered image * * @param ref The location of the resource to load * @return The loaded buffered image * @throws IOException Indicates a failure to find a resource */ private BufferedImage loadImage(String ref) throws IOException { URL url = TextureLoader.class.getClassLoader().getResource(ref); if (url == null) { throw new IOException("Cannot find: " + ref); } // due to an issue with ImageIO and mixed signed code // we are now using good oldfashioned ImageIcon to load // images and the paint it on top of a new BufferedImage Image img = new ImageIcon(url).getImage(); BufferedImage bufferedImage = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB); Graphics g = bufferedImage.getGraphics(); g.drawImage(img, 0, 0, null); g.dispose(); return bufferedImage; } } lwjgl-2.7.1/src/java/org/lwjgl/examples/spaceinvaders/GameApplet.java0000644000175000017500000000445711543426510024700 0ustar zero79zero79package org.lwjgl.examples.spaceinvaders; import java.applet.Applet; import java.awt.BorderLayout; import java.awt.Canvas; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.Display; public class GameApplet extends Applet { /** The Canvas where the LWJGL Display is added */ Canvas display_parent; /** Thread which runs the main game loop */ Thread gameThread; /** The Game instance */ Game game; /** * Once the Canvas is created its add notify method will call this method to * start the LWJGL Display and game loop in another thread. */ public void startLWJGL() { gameThread = new Thread() { public void run() { try { Display.setParent(display_parent); } catch (LWJGLException e) { e.printStackTrace(); } // start game game = new Game(false); game.execute(); } }; gameThread.start(); } /** * Tell game loop to stop running, after which the LWJGL Display will be destoryed. * The main thread will wait for the Display.destroy() to complete */ private void stopLWJGL() { Game.gameRunning = false; try { gameThread.join(); } catch (InterruptedException e) { e.printStackTrace(); } } public void start() { } public void stop() { } /** * Applet Destroy method will remove the canvas, before canvas is destroyed it will notify * stopLWJGL() to stop main game loop and to destroy the Display */ public void destroy() { remove(display_parent); super.destroy(); System.out.println("Clear up"); } /** * initialise applet by adding a canvas to it, this canvas will start the LWJGL Display and game loop * in another thread. It will also stop the game loop and destroy the display on canvas removal when * applet is destroyed. */ public void init() { setLayout(new BorderLayout()); try { display_parent = new Canvas() { public void addNotify() { super.addNotify(); startLWJGL(); } public void removeNotify() { stopLWJGL(); super.removeNotify(); } }; display_parent.setSize(getWidth(),getHeight()); add(display_parent); display_parent.setFocusable(true); display_parent.requestFocus(); display_parent.setIgnoreRepaint(true); setVisible(true); } catch (Exception e) { System.err.println(e); throw new RuntimeException("Unable to create display"); } } }lwjgl-2.7.1/src/java/org/lwjgl/examples/spaceinvaders/AlienEntity.java0000644000175000017500000001144111543426510025075 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.examples.spaceinvaders; /** * An entity which represents one of our space invader aliens. * * @author Kevin Glass * @author Brian Matzon */ public class AlienEntity extends Entity { /** Movement made downwards when a border is hit */ private static final int DOWNWARD_MOVEMENT = 10; /** Border at which player dies */ private static final int BOTTOM_BORDER = 570; /** Right border at which to shift direction */ private static final int RIGHT_BORDER = 750; /** Left border at which to shift direction */ private static final int LEFT_BORDER = 10; /** The speed at which the alient moves horizontally */ private float moveSpeed = 75; /** The game in which the entity exists */ private Game game; /** The animation frames */ private Sprite[] frames = new Sprite[4]; /** The time since the last frame change took place */ private long lastFrameChange; /** The frame duration in milliseconds, i.e. how long any given frame of animation lasts */ private long frameDuration = 250; /** The current frame of animation being displayed */ private int frameNumber; /** * Create a new alien entity * * @param game The game in which this entity is being created * @param x The intial x location of this alien * @param y The intial y location of this alient */ public AlienEntity(Game game, int x, int y) { super(game.getSprite("alien.gif"), x, y); // setup the animatin frames frames[0] = sprite; frames[1] = game.getSprite("alien2.gif"); frames[2] = sprite; frames[3] = game.getSprite("alien3.gif"); this.game = game; dx = -moveSpeed; } /** * Request that this alien moved based on time elapsed * * @param delta The time that has elapsed since last move */ public void move(long delta) { // since the move tells us how much time has passed // by we can use it to drive the animation, however // its the not the prettiest solution lastFrameChange += delta; // if we need to change the frame, update the frame number // and flip over the sprite in use if (lastFrameChange > frameDuration) { // reset our frame change time counter lastFrameChange = 0; // update the frame frameNumber++; if (frameNumber >= frames.length) { frameNumber = 0; } sprite = frames[frameNumber]; } // if we have reached the left hand side of the screen and // are moving left then request a logic update if ((dx < 0) && (x < LEFT_BORDER)) { game.updateLogic(); } // and vice vesa, if we have reached the right hand side of // the screen and are moving right, request a logic update if ((dx > 0) && (x > RIGHT_BORDER)) { game.updateLogic(); } // proceed with normal move super.move(delta); } /** * Update the game logic related to aliens */ public void doLogic() { // swap over horizontal movement and move down the // screen a bit dx = -dx; y += DOWNWARD_MOVEMENT; // if we've reached the bottom of the screen then the player // dies if (y > BOTTOM_BORDER) { game.notifyDeath(); } } /** * Notification that this alien has collided with another entity * * @param other The other entity */ public void collidedWith(Entity other) { // collisions with aliens are handled elsewhere } }lwjgl-2.7.1/src/java/org/lwjgl/examples/spaceinvaders/ShotEntity.java0000644000175000017500000000706211543426510024766 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.examples.spaceinvaders; /** * An entity representing a shot fired by the player's ship * * @author Kevin Glass * @author Brian Matzon */ public class ShotEntity extends Entity { /** Top border at which shots are outside */ private static final int TOP_BORDER = -100; /** The vertical speed at which the players shot moves */ private float moveSpeed = -300; /** The game in which this entity exists */ private Game game; /** True if this shot has been "used", i.e. its hit something */ private boolean used; /** * Create a new shot from the player * * @param game The game in which the shot has been created * @param sprite The sprite representing this shot * @param x The initial x location of the shot * @param y The initial y location of the shot */ public ShotEntity(Game game, String sprite, int x, int y) { super(game.getSprite(sprite), x, y); this.game = game; dy = moveSpeed; } /** * Reinitializes this entity, for reuse * * @param x new x coordinate * @param y new y coordinate */ public void reinitialize(int x, int y) { this.x = x; this.y = y; used = false; } /** * Request that this shot moved based on time elapsed * * @param delta The time that has elapsed since last move */ public void move(long delta) { // proceed with normal move super.move(delta); // if we shot off the screen, remove ourselfs if (y < TOP_BORDER) { game.removeEntity(this); } } /** * Notification that this shot has collided with another * entity * * @param other The other entity with which we've collided */ public void collidedWith(Entity other) { // prevents double kills, if we've already hit something, // don't collide if (used) { return; } // if we've hit an alien, kill it! if (other instanceof AlienEntity) { // remove the affected entities game.removeEntity(this); game.removeEntity(other); // notify the game that the alien has been killed game.notifyAlienKilled(); used = true; } } }lwjgl-2.7.1/src/java/org/lwjgl/examples/spaceinvaders/SoundManager.java0000644000175000017500000001310611543426510025233 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.examples.spaceinvaders; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.openal.AL; import org.lwjgl.openal.AL10; import org.lwjgl.util.WaveData; /** *

* Simple sound manager for OpenAL using n sources accessed in * a round robin schedule. Source n is reserved for a single buffer and checking for * whether it's playing. *

* @author Brian Matzon * @version $Revision: 3418 $ * $Id: SoundManager.java 3418 2010-09-28 21:11:35Z spasi $ */ public class SoundManager { /** We support at most 256 buffers*/ private int[] buffers = new int[256]; /** Number of sources is limited tby user (and hardware) */ private int[] sources; /** Our internal scratch buffer */ private IntBuffer scratchBuffer = BufferUtils.createIntBuffer(256); /** Whether we're running in no sound mode */ private boolean soundOutput; /** Current index in our buffers */ private int bufferIndex; /** Current index in our source list */ private int sourceIndex; /** * Creates a new SoundManager */ public SoundManager() { } /** * Plays a sound effect * @param buffer Buffer index to play gotten from addSound */ public void playEffect(int buffer) { if(soundOutput) { // make sure we never choose last channel, since it is used for special sounds int channel = sources[(sourceIndex++ % (sources.length-1))]; // link buffer and source, and play it AL10.alSourcei(channel, AL10.AL_BUFFER, buffers[buffer]); AL10.alSourcePlay(channel); } } /** * Plays a sound on last source * @param buffer Buffer index to play gotten from addSound */ public void playSound(int buffer) { if(soundOutput) { AL10.alSourcei(sources[sources.length-1], AL10.AL_BUFFER, buffers[buffer]); AL10.alSourcePlay(sources[sources.length-1]); } } /** * Whether a sound is playing on last source * @return true if a source is playing right now on source n */ public boolean isPlayingSound() { return AL10.alGetSourcei(sources[sources.length-1], AL10.AL_SOURCE_STATE) == AL10.AL_PLAYING; } /** * Initializes the SoundManager * * @param channels Number of channels to create */ public void initialize(int channels) { try { AL.create(); // allocate sources scratchBuffer.limit(channels); AL10.alGenSources(scratchBuffer); scratchBuffer.rewind(); scratchBuffer.get(sources = new int[channels]); // could we allocate all channels? if(AL10.alGetError() != AL10.AL_NO_ERROR) { throw new LWJGLException("Unable to allocate " + channels + " sources"); } // we have sound soundOutput = true; } catch (LWJGLException le) { le.printStackTrace(); System.out.println("Sound disabled"); } } /** * Adds a sound to the Sound Managers pool * * @param path Path to file to load * @return index into SoundManagers buffer list */ public int addSound(String path) { // Generate 1 buffer entry scratchBuffer.rewind().position(0).limit(1); AL10.alGenBuffers(scratchBuffer); buffers[bufferIndex] = scratchBuffer.get(0); // load wave data from buffer WaveData wavefile = WaveData.create("spaceinvaders/" + path); // copy to buffers AL10.alBufferData(buffers[bufferIndex], wavefile.format, wavefile.data, wavefile.samplerate); // unload file again wavefile.dispose(); // return index for this sound return bufferIndex++; } /** * Destroy this SoundManager */ public void destroy() { if(soundOutput) { // stop playing sounds scratchBuffer.position(0).limit(sources.length); scratchBuffer.put(sources).flip(); AL10.alSourceStop(scratchBuffer); // destroy sources AL10.alDeleteSources(scratchBuffer); // destroy buffers scratchBuffer.position(0).limit(bufferIndex); scratchBuffer.put(buffers, 0, bufferIndex).flip(); AL10.alDeleteBuffers(scratchBuffer); // destory OpenAL AL.destroy(); } } } lwjgl-2.7.1/src/java/org/lwjgl/examples/spaceinvaders/ShipEntity.java0000644000175000017500000000640611543426510024755 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.examples.spaceinvaders; /** * The entity that represents the players ship * * @author Kevin Glass * @author Brian Matzon */ public class ShipEntity extends Entity { /** Right border at which to disallow further movement */ private static final int RIGHT_BORDER = 750; /** Left border at which to disallow further movement */ private static final int LEFT_BORDER = 10; /** The game in which the ship exists */ private Game game; /** * Create a new entity to represent the players ship * * @param game The game in which the ship is being created * @param ref The reference to the sprite to show for the ship * @param x The initial x location of the player's ship * @param y The initial y location of the player's ship */ public ShipEntity(Game game,String ref,int x,int y) { super(game.getSprite(ref), x, y); this.game = game; } /** * Request that the ship move itself based on an elapsed ammount of * time * * @param delta The time that has elapsed since last move (ms) */ public void move(long delta) { // if we're moving left and have reached the left hand side // of the screen, don't move if ((dx < 0) && (x < LEFT_BORDER)) { return; } // if we're moving right and have reached the right hand side // of the screen, don't move if ((dx > 0) && (x > RIGHT_BORDER)) { return; } super.move(delta); } /** * Notification that the player's ship has collided with something * * @param other The entity with which the ship has collided */ public void collidedWith(Entity other) { // if its an alien, notify the game that the player // is dead if (other instanceof AlienEntity) { game.notifyDeath(); } } }lwjgl-2.7.1/src/java/org/lwjgl/openal/0000755000175000017500000000000011543426510016615 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/openal/Util.java0000644000175000017500000000554411543426510020405 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.openal; /** * Simple utility class for checking AL/ALC errors * * @author cix_foo * @author Brian Matzon * @version $Revision: 2983 $ */ public final class Util { /** No c'tor */ private Util() { } /** * Checks for any ALC errors and throws an unchecked exception on errors * @param device Device for which to check ALC errors */ public static void checkALCError(ALCdevice device) { int err = ALC10.alcGetError(device); if (err != ALC10.ALC_NO_ERROR) throw new OpenALException(ALC10.alcGetString(AL.getDevice(), err)); } /** * Checks for any AL errors and throws an unchecked exception on errors */ public static void checkALError() { int err = AL10.alGetError(); if (err != AL10.AL_NO_ERROR) throw new OpenALException(err); } /** * Checks for a valid device * @param device ALCdevice to check the validity of */ public static void checkALCValidDevice(ALCdevice device) { if(!device.isValid()) { throw new OpenALException("Invalid device: " + device); } } /** * Checks for a valid context * @param context ALCcontext to check the validity of */ public static void checkALCValidContext(ALCcontext context) { if(!context.isValid()) { throw new OpenALException("Invalid context: " + context); } } } lwjgl-2.7.1/src/java/org/lwjgl/openal/EFXUtil.java0000644000175000017500000002216411543426510020745 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.openal; import static org.lwjgl.openal.AL10.*; import static org.lwjgl.openal.EFX10.*; /** * Utility class for the OpenAL extension ALC_EXT_EFX. Provides functions to check for the extension * and support of various effects and filters. *

* Currently supports ALC_EXT_EFX version 1.0 effects and filters. * * @author Ciardhubh * @version $Revision$ * $Id$ */ public final class EFXUtil { /** Constant for testSupportGeneric to check an effect. */ private static final int EFFECT = 1111; /** Constant for testSupportGeneric to check a filter. */ private static final int FILTER = 2222; /** Utility class, hidden contructor. */ private EFXUtil() { } /** * Checks if OpenAL implementation is loaded and supports ALC_EXT_EFX. * * @return True if ALC_EXT_EFX is supported, false if not. * @throws OpenALException If OpenAL has not been created yet. */ public static boolean isEfxSupported() { if (!AL.isCreated()) { throw new OpenALException("OpenAL has not been created."); } return ALC10.alcIsExtensionPresent(AL.getDevice(), ALC_EXT_EFX_NAME); } /** * Tests OpenAL to see whether the given effect type is supported. This is done by creating an * effect of the given type. If creation succeeds the effect is supported. * * @param effectType Type of effect whose support is to be tested, e.g. AL_EFFECT_REVERB. * @return True if it is supported, false if not. * @throws OpenALException If the request fails due to an AL_OUT_OF_MEMORY error or OpenAL has * not been created yet. * @throws IllegalArgumentException effectType is not a valid effect type. */ public static boolean isEffectSupported(final int effectType) { // Make sure type is a real effect. switch (effectType) { case AL_EFFECT_NULL: case AL_EFFECT_EAXREVERB: case AL_EFFECT_REVERB: case AL_EFFECT_CHORUS: case AL_EFFECT_DISTORTION: case AL_EFFECT_ECHO: case AL_EFFECT_FLANGER: case AL_EFFECT_FREQUENCY_SHIFTER: case AL_EFFECT_VOCAL_MORPHER: case AL_EFFECT_PITCH_SHIFTER: case AL_EFFECT_RING_MODULATOR: case AL_EFFECT_AUTOWAH: case AL_EFFECT_COMPRESSOR: case AL_EFFECT_EQUALIZER: break; default: throw new IllegalArgumentException("Unknown or invalid effect type: " + effectType); } return testSupportGeneric(EFFECT, effectType); } /** * Tests OpenAL to see whether the given filter type is supported. This is done by creating a * filter of the given type. If creation succeeds the filter is supported. * * @param filterType Type of filter whose support is to be tested, e.g. AL_FILTER_LOWPASS. * @return True if it is supported, false if not. * @throws OpenALException If the request fails due to an AL_OUT_OF_MEMORY error or OpenAL has * not been created yet. * @throws IllegalArgumentException filterType is not a valid filter type. */ public static boolean isFilterSupported(final int filterType) { // Make sure type is a real filter. switch (filterType) { case AL_FILTER_NULL: case AL_FILTER_LOWPASS: case AL_FILTER_HIGHPASS: case AL_FILTER_BANDPASS: break; default: throw new IllegalArgumentException("Unknown or invalid filter type: " + filterType); } return testSupportGeneric(FILTER, filterType); } /** * Generic test function to see if an EFX object supports a given kind of type. Works for * effects and filters. * * @param objectType Type of object to test. Must be either EFXUtil.EFFECT or EFXUtil.FILTER. * @param typeValue OpenAL type the object should be tested for support, e.g. AL_FILTER_LOWPASS * or AL_EFFECT_REVERB. * @return True if object supports typeValue, false else. */ private static boolean testSupportGeneric(final int objectType, final int typeValue) { // Check for supported objectType. switch (objectType) { case EFFECT: case FILTER: break; default: throw new IllegalArgumentException("Invalid objectType: " + objectType); } boolean supported = false; if (isEfxSupported()) { // Try to create object in order to check AL's response. alGetError(); int genError; int testObject = 0; try { switch (objectType) { // Create object based on type case EFFECT: testObject = alGenEffects(); break; case FILTER: testObject = alGenFilters(); break; default: throw new IllegalArgumentException("Invalid objectType: " + objectType); } genError = alGetError(); } catch (final OpenALException debugBuildException) { // Hack because OpenALException hides the original error code (short of parsing the // error message String which would break if it gets changed). if (debugBuildException.getMessage().contains("AL_OUT_OF_MEMORY")) { genError = AL_OUT_OF_MEMORY; } else { genError = AL_INVALID_OPERATION; } } if (genError == AL_NO_ERROR) { // Successfully created, now try to set type. alGetError(); int setError; try { switch (objectType) { // Set based on object type case EFFECT: alEffecti(testObject, AL_EFFECT_TYPE, typeValue); break; case FILTER: alFilteri(testObject, AL_FILTER_TYPE, typeValue); break; default: throw new IllegalArgumentException("Invalid objectType: " + objectType); } setError = alGetError(); } catch (final OpenALException debugBuildException) { // Hack because OpenALException hides the original error code (short of parsing // the error message String which would break when it gets changed). setError = AL_INVALID_VALUE; } if (setError == AL_NO_ERROR) { supported = true; } // Cleanup try { switch (objectType) { // Set based on object type case EFFECT: alDeleteEffects(testObject); break; case FILTER: alDeleteFilters(testObject); break; default: throw new IllegalArgumentException("Invalid objectType: " + objectType); } } catch (final OpenALException debugBuildException) { // Don't care about cleanup errors. } } else if (genError == AL_OUT_OF_MEMORY) { throw new OpenALException(genError); } } return supported; } } lwjgl-2.7.1/src/java/org/lwjgl/openal/ALC11.java0000644000175000017500000002050511543426510020223 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.openal; import java.nio.ByteBuffer; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; /** *

* The ALC11 class implements features in OpenAL 1.1, specifically * ALC methods and properties. *

* * @author Brian Matzon * @see ALC10 * @version $Revision: 2286 $ * $Id: ALC.java 2286 2006-03-23 19:32:21 +0000 (to, 23 mar 2006) matzon $ */ public final class ALC11 { public static final int ALC_DEFAULT_ALL_DEVICES_SPECIFIER = 0x1012; public static final int ALC_ALL_DEVICES_SPECIFIER = 0x1013; public static final int ALC_CAPTURE_DEVICE_SPECIFIER = 0x310; public static final int ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER = 0x311; public static final int ALC_CAPTURE_SAMPLES = 0x312; public static final int ALC_MONO_SOURCES = 0x1010; public static final int ALC_STEREO_SOURCES = 0x1011; /** * The alcCaptureOpenDevice function allows the application to connect to a capture * device. To obtain a list of all available capture devices, use getCaptureDevices a list of all * capture devices will be returned. Retrieving ALC_CAPTURE_DEVICE_SPECIFIER with a valid capture device specified will result * in the name of that device being returned as a single string. * * If the function returns null, then no sound driver/device has been found, or the * requested format could not be fulfilled. * The "deviceName" argument is a string that requests a certain device or * device configuration. If null is specified, the implementation will provide an * implementation specific default. The "frequency" and "format" arguments specify the format that * audio data will be presented to the application, and match the values that can be passed to * alBufferData. The implementation is expected to convert and resample to this format on * behalf of the application. The "buffersize" argument specifies the number of sample frames * to buffer in the AL, for example, requesting a format of AL_FORMAT_STEREO16 and * a buffer size of 1024 would require the AL to store up to 1024 * 4 bytes of audio data. * Note that the implementation may use a larger buffer than requested if it needs to, but the * implementation will set up a buffer of at least the requested size. * Specifying a compressed or extension-supplied format may result in failure, even if the * extension is supplied for rendering. * * LWJGL SPECIFIC: the actual created device is managed internally in lwjgl * * @param devicename Name of device to open for capture * @param frequency Frequency of samples to capture * @param format Format of samples to capture * @param buffersize Size of buffer to capture to * @return ALCdevice if it was possible to open a device */ public static ALCdevice alcCaptureOpenDevice(String devicename, int frequency, int format, int buffersize) { long device_address = nalcCaptureOpenDevice(devicename, frequency, format, buffersize); if(device_address != 0) { ALCdevice device = new ALCdevice(device_address); synchronized (ALC10.devices) { ALC10.devices.put(device_address, device); } return device; } return null; } static native long nalcCaptureOpenDevice( String devicename, int frequency, int format, int buffersize); /** * The alcCaptureCloseDevice function allows the application to disconnect from a capture * device. * * The return code will be true or false, indicating success or failure. If * the device is null or invalid, an ALC_INVALID_DEVICE error will be generated. * Once closed, a capture device is invalid. * @return true if device was successfully closed */ public static boolean alcCaptureCloseDevice(ALCdevice device) { boolean result = nalcCaptureCloseDevice(ALC10.getDevice(device)); synchronized (ALC10.devices) { device.setInvalid(); ALC10.devices.remove(new Long(device.device)); } return result; } static native boolean nalcCaptureCloseDevice(long device); /** * Once a capture device has been opened via alcCaptureOpenDevice, it is made to start * recording audio via the alcCaptureStart entry point: * * Once started, the device will record audio to an internal ring buffer, the size of which was * specified when opening the device. * The application may query the capture device to discover how much data is currently * available via the alcGetInteger with the ALC_CAPTURE_SAMPLES token. This will * report the number of sample frames currently available. */ public static void alcCaptureStart(ALCdevice device) { nalcCaptureStart(ALC10.getDevice(device)); } static native void nalcCaptureStart(long device); /** * If the application doesn't need to capture more audio for an amount of time, they can halt * the device without closing it via the alcCaptureStop entry point. * The implementation is encouraged to optimize for this case. The amount of audio * samples available after restarting a stopped capture device is reset to zero. The * application does not need to stop the capture device to read from it. */ public static void alcCaptureStop(ALCdevice device) { nalcCaptureStop(ALC10.getDevice(device)); } static native void nalcCaptureStop(long device); /** * When the application feels there are enough samples available to process, it can obtain * them from the AL via the alcCaptureSamples entry point. * * The "buffer" argument specifies an application-allocated buffer that can contain at least * "samples" sample frames. The implementation may defer conversion and resampling until * this point. Requesting more sample frames than are currently available is an error. * * @param buffer Buffer to store samples in * @param samples Number of samples to request */ public static void alcCaptureSamples(ALCdevice device, ByteBuffer buffer, int samples ) { nalcCaptureSamples(ALC10.getDevice(device), buffer, buffer.position(), samples); } static native void nalcCaptureSamples(long device, ByteBuffer buffer, int position, int samples ); static native void initNativeStubs() throws LWJGLException; /** * Initializes ALC11, including any extensions * @return true if initialization was successfull */ static boolean initialize() { try { IntBuffer ib = BufferUtils.createIntBuffer(2); ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MAJOR_VERSION, ib); ib.position(1); ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MINOR_VERSION, ib); int major = ib.get(0); int minor = ib.get(1); // checking for version 1.x+ if(major >= 1) { // checking for version 1.1+ if(major > 1 || minor >= 1) { ALC11.initNativeStubs(); AL11.initNativeStubs(); } } } catch (LWJGLException le) { LWJGLUtil.log("failed to initialize ALC11: " + le); return false; } return true; } } lwjgl-2.7.1/src/java/org/lwjgl/openal/AL.java0000644000175000017500000001736111543426510017764 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.openal; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.Sys; /** *

* The AL class implements the actual creation code for linking to the native library * OpenAL. *

* * @author Brian Matzon * @version $Revision: 3418 $ * $Id: AL.java 3418 2010-09-28 21:11:35Z spasi $ */ public final class AL { /** ALCdevice instance. */ static ALCdevice device; /** Current ALCcontext. */ static ALCcontext context; /** Have we been created? */ private static boolean created; static { Sys.initialize(); } private AL() { } /** * Native method to create AL instance * * @param oalPath Path to search for OpenAL library */ private static native void nCreate(String oalPath) throws LWJGLException; /** * Native method to create AL instance from the Mac OS X 10.4 OpenAL framework. * It is only defined in the Mac OS X native library. */ private static native void nCreateDefault() throws LWJGLException; /** * Native method the destroy the AL */ private static native void nDestroy(); /** * @return true if AL has been created */ public static boolean isCreated() { return created; } /** * 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 LWJGLException { create(deviceArguments, contextFrequency, contextRefresh, contextSynchronized, true); } /** * @param openDevice Whether to automatically open the device * @see #create(String, int, int, boolean) */ public static void create(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized, boolean openDevice) throws LWJGLException { if (created) throw new IllegalStateException("Only one OpenAL context may be instantiated at any one time."); String libname; String[] library_names; switch (LWJGLUtil.getPlatform()) { case LWJGLUtil.PLATFORM_WINDOWS: libname = "OpenAL32"; library_names = new String[]{"OpenAL64.dll", "OpenAL32.dll"}; break; case LWJGLUtil.PLATFORM_LINUX: libname = "openal"; library_names = new String[]{"libopenal64.so", "libopenal.so", "libopenal.so.0"}; break; case LWJGLUtil.PLATFORM_MACOSX: libname = "openal"; library_names = new String[]{"openal.dylib"}; break; default: throw new LWJGLException("Unknown platform: " + LWJGLUtil.getPlatform()); } String[] oalPaths = LWJGLUtil.getLibraryPaths(libname, library_names, AL.class.getClassLoader()); LWJGLUtil.log("Found " + oalPaths.length + " OpenAL paths"); for ( String oalPath : oalPaths ) { try { nCreate(oalPath); created = true; init(deviceArguments, contextFrequency, contextRefresh, contextSynchronized, openDevice); break; } catch (LWJGLException e) { LWJGLUtil.log("Failed to load " + oalPath + ": " + e.getMessage()); } } if (!created && LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX) { // Try to load OpenAL from the framework instead nCreateDefault(); created = true; init(deviceArguments, contextFrequency, contextRefresh, contextSynchronized, openDevice); } if (!created) throw new LWJGLException("Could not locate OpenAL library."); } private static void init(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized, boolean openDevice) throws LWJGLException { try { AL10.initNativeStubs(); ALC10.initNativeStubs(); if(openDevice) { device = ALC10.alcOpenDevice(deviceArguments); if (device == null) { throw new LWJGLException("Could not open ALC device"); } if (contextFrequency == -1) { context = ALC10.alcCreateContext(device, null); } else { context = ALC10.alcCreateContext(device, ALCcontext.createAttributeList(contextFrequency, contextRefresh, contextSynchronized ? ALC10.ALC_TRUE : ALC10.ALC_FALSE)); } ALC10.alcMakeContextCurrent(context); } } catch (LWJGLException e) { destroy(); throw e; } ALC11.initialize(); // Load EFX10 native stubs if ALC_EXT_EFX is supported. // Is there any situation where the current device supports ALC_EXT_EFX and one // later created by the user does not? // Do we have to call resetNativeStubs(EFX10.class); somewhere? Not done for AL11 // either. // This can either be here or in ALC11, since ALC_EXT_EFX indirectly requires AL 1.1 // for functions like alSource3i. if (ALC10.alcIsExtensionPresent(device, EFX10.ALC_EXT_EFX_NAME)){ EFX10.initNativeStubs(); } } /** * Creates an OpenAL instance. The empty create will cause OpenAL to * open the default device, and create a context using default values. * This method used to use default values that the OpenAL implementation * chose but this produces unexpected results on some systems; so now * it defaults to 44100Hz mixing @ 60Hz refresh. */ public static void create() throws LWJGLException { create(null, 44100, 60, false); } /** * Exit cleanly by calling destroy. */ public static void destroy() { if (context != null) { ALC10.alcMakeContextCurrent(null); ALC10.alcDestroyContext(context); context = null; } if (device != null) { boolean result = ALC10.alcCloseDevice(device); device = null; } resetNativeStubs(AL10.class); resetNativeStubs(AL11.class); resetNativeStubs(ALC10.class); resetNativeStubs(ALC11.class); resetNativeStubs(EFX10.class); if (created) nDestroy(); created = false; } private static native void resetNativeStubs(Class clazz); /** * @return handle to the default AL context. */ public static ALCcontext getContext() { return context; } /** * @return handle to the default AL device. */ public static ALCdevice getDevice() { return device; } } lwjgl-2.7.1/src/java/org/lwjgl/openal/ALCdevice.java0000644000175000017500000000747111543426510021250 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.openal; import java.util.HashMap; import java.util.Iterator; /** * The ALCdevice class represents a device opened in OpenAL space. * * ALC introduces the notion of a Device. A Device can be, depending on the * implementation, a hardware device, or a daemon/OS service/actual server. This * mechanism also permits different drivers (and hardware) to coexist within the same * system, as well as allowing several applications to share system resources for audio, * including a single hardware output device. The details are left to the implementation, * which has to map the available backends to unique device specifiers. * * @author Brian Matzon * @version $Revision: 3418 $ * $Id: ALCdevice.java 3418 2010-09-28 21:11:35Z spasi $ */ public final class ALCdevice { /** Address of actual device */ final long device; /** Whether this device is valid */ private boolean valid; /** List of contexts belonging to the device */ private final HashMap contexts = new HashMap(); /** * Creates a new instance of ALCdevice * * @param device address of actual device */ ALCdevice(long device) { this.device = device; this.valid = true; } /* * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object device) { if(device instanceof ALCdevice) { return ((ALCdevice)device).device == this.device; } return super.equals(device); } /** * Adds a context to the device * * @param context context to add to the list of contexts for this device */ void addContext(ALCcontext context) { synchronized (contexts) { contexts.put(context.context, context); } } /** * Remove context associated with device * * @param context Context to disassociate with device */ void removeContext(ALCcontext context) { synchronized (contexts) { contexts.remove(context.context); } } /** * Marks this device and all of its contexts invalid */ void setInvalid() { valid = false; synchronized (contexts) { for ( ALCcontext context : contexts.values() ) context.setInvalid(); } contexts.clear(); } /** * @return true if this device is still valid */ public boolean isValid() { return valid; } } lwjgl-2.7.1/src/java/org/lwjgl/openal/OpenALException.java0000644000175000017500000000516511543426510022464 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.openal; /** *
* Thrown by the debug build library of the LWJGL if any OpenAL operation * causes an error. * * @author Brian Matzon * @version $Revision: 2983 $ * $Id: OpenALException.java 2983 2008-04-07 18:36:09Z matzon $ */ public class OpenALException extends RuntimeException { private static final long serialVersionUID = 1L; /** * Constructor for OpenALException. */ public OpenALException() { super(); } /** * Constructor that takes an AL error number */ public OpenALException(int error_code) { super("OpenAL error: " + AL10.alGetString(error_code) + " (" + error_code + ")"); } /** * Constructor for OpenALException. * @param message */ public OpenALException(String message) { super(message); } /** * Constructor for OpenALException. * @param message * @param cause */ public OpenALException(String message, Throwable cause) { super(message, cause); } /** * Constructor for OpenALException. * @param cause */ public OpenALException(Throwable cause) { super(cause); } } lwjgl-2.7.1/src/java/org/lwjgl/openal/ALCcontext.java0000644000175000017500000000730011543426510021464 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.openal; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; /** * The ALCcontext class represents a context opened in OpenAL space. * * All operations of the AL core API affect a current AL context. Within the scope of AL, * the ALC is implied - it is not visible as a handle or function parameter. Only one AL * Context per process can be current at a time. Applications maintaining multiple AL * Contexts, whether threaded or not, have to set the current context accordingly. * Applications can have multiple threads that share one more or contexts. In other words, * AL and ALC are threadsafe. * * @author Brian Matzon * @version $Revision: 3418 $ * $Id: ALCcontext.java 3418 2010-09-28 21:11:35Z spasi $ */ public final class ALCcontext { /** Address of actual context */ final long context; /** Whether this context is valid */ private boolean valid; /** * Creates a new instance of ALCcontext * * @param context address of actual context */ ALCcontext(long context) { this.context = context; this.valid = true; } /* * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object context) { if(context instanceof ALCcontext) { return ((ALCcontext)context).context == this.context; } return super.equals(context); } /** * Creates an attribute list in a ByteBuffer * @param contextFrequency Frequency to add * @param contextRefresh Refresh rate to add * @param contextSynchronized Whether to synchronize the context * @return */ static IntBuffer createAttributeList(int contextFrequency, int contextRefresh, int contextSynchronized) { IntBuffer attribList = BufferUtils.createIntBuffer(7); attribList.put(ALC10.ALC_FREQUENCY); attribList.put(contextFrequency); attribList.put(ALC10.ALC_REFRESH); attribList.put(contextRefresh); attribList.put(ALC10.ALC_SYNC); attribList.put(contextSynchronized); attribList.put(0); //terminating int return attribList; } /** * Marks this context as invalid * */ void setInvalid() { valid = false; } /** * @return true if this context is still valid */ public boolean isValid() { return valid; } } lwjgl-2.7.1/src/java/org/lwjgl/openal/ALC10.java0000644000175000017500000004123011543426510020220 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.openal; import java.nio.Buffer; import java.nio.IntBuffer; import java.util.HashMap; import org.lwjgl.BufferChecks; import org.lwjgl.LWJGLException; /** * *

* ALC introduces the notion of a Device. A Device can be, depending on the * implementation, a hardware device, or a daemon/OS service/actual server. This * mechanism also permits different drivers (and hardware) to coexist within the same * system, as well as allowing several applications to share system resources for audio, * including a single hardware output device. The details are left to the * implementation, which has to map the available backends to unique device * specifiers (represented as strings). *

* * @author Brian Matzon * @version $Revision: 2286 $ * $Id: ALC.java 2286 2006-03-23 19:32:21 +0000 (to, 23 mar 2006) matzon $ */ public final class ALC10 { /** List of active contexts */ static final HashMap contexts = new HashMap(); /** List of active devices */ static final HashMap devices = new HashMap(); /** Bad value */ public static final int ALC_INVALID = 0; /** Boolean False */ public static final int ALC_FALSE = 0; /** Boolean True */ public static final int ALC_TRUE = 1; /** Errors: No Error */ public static final int ALC_NO_ERROR = ALC_FALSE; /** Major version query. */ public static final int ALC_MAJOR_VERSION = 0x1000; /** Minor version query. */ public static final int ALC_MINOR_VERSION = 0x1001; /** * The size required for the zero-terminated attributes list, for the current context. **/ public static final int ALC_ATTRIBUTES_SIZE = 0x1002; /** * Expects a destination of ALC_CURRENT_ATTRIBUTES_SIZE, * and provides the attribute list for the current context of the specified device. */ public static final int ALC_ALL_ATTRIBUTES = 0x1003; /** The specifier string for the default device */ public static final int ALC_DEFAULT_DEVICE_SPECIFIER = 0x1004; /** The specifier string for the device */ public static final int ALC_DEVICE_SPECIFIER = 0x1005; /** The extensions string for diagnostics and printing */ public static final int ALC_EXTENSIONS = 0x1006; /** Frequency for mixing output buffer, in units of Hz. */ public static final int ALC_FREQUENCY = 0x1007; /** Refresh intervalls, in units of Hz. */ public static final int ALC_REFRESH = 0x1008; /** Flag, indicating a synchronous context. */ public static final int ALC_SYNC = 0x1009; /** The device argument does not name a valid device */ public static final int ALC_INVALID_DEVICE = 0xA001; /** The context argument does not name a valid context */ 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 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 ALC_INVALID_VALUE = 0xA004; /** * A function could not be completed, because there is not enough * memory available. */ public static final int ALC_OUT_OF_MEMORY = 0xA005; static native void initNativeStubs() throws LWJGLException; /** * The application can obtain certain strings from ALC. * * ALC_DEFAULT_DEVICE_SPECIFIER - The specifer string for the default device * ALC_DEVICE_SPECIFIER - The specifer string for the device * ALC_EXTENSIONS - The extensions string for diagnostics and printing. * * In addition, printable error message strings are provided for all valid error tokens, * including ALC_NO_ERROR,ALC_INVALID_DEVICE, ALC_INVALID_CONTEXT, * ALC_INVALID_ENUM, ALC_INVALID_VALUE. * * @param pname Property to get * @return String property from device */ public static String alcGetString(ALCdevice device, int pname) { String result; result = nalcGetString(getDevice(device), pname); Util.checkALCError(device); return result; } static native String nalcGetString(long device, int pname); /** * The application can query ALC for information using an integer query function. * For some tokens, null is a legal deviceHandle. In other cases, specifying a null * device will generate an ALC_INVALID_DEVICE error. The application has to * specify the size of the destination buffer provided. A null destination or a zero * size parameter will cause ALC to ignore the query. * * ALC_MAJOR_VERSION - Major version query. * ALC_MINOR_VERSION - Minor version query. * ALC_ATTRIBUTES_SIZE - The size required for the zero-terminated attributes list, * for the current context. null is an invalid device. null (no current context * for the specified device) is legal. * ALC_ALL_ATTRIBUTES - Expects a destination of ALC_CURRENT_ATTRIBUTES_SIZE, * and provides the attribute list for the current context of the specified device. * null is an invalid device. null (no current context for the specified device) * will return the default attributes defined by the specified device. * * @param pname Property to get * @param integerdata ByteBuffer to write integers to */ public static void alcGetInteger(ALCdevice device, int pname, IntBuffer integerdata) { BufferChecks.checkDirect(integerdata); nalcGetIntegerv(getDevice(device), pname, integerdata.remaining(), integerdata, integerdata.position()); Util.checkALCError(device); } static native void nalcGetIntegerv(long device, int pname, int size, Buffer integerdata, int offset); /** * The alcOpenDevice function allows the application (i.e. the client program) to * connect to a device (i.e. the server). * * If the function returns null, then no sound driver/device has been found. The * argument is a null terminated string that requests a certain device or device * configuration. If null is specified, the implementation will provide an * implementation specific default. * * @param devicename name of device to open * @return opened device, or null */ public static ALCdevice alcOpenDevice(String devicename) { long device_address = nalcOpenDevice(devicename); if(device_address != 0) { ALCdevice device = new ALCdevice(device_address); synchronized (ALC10.devices) { devices.put(device_address, device); } return device; } return null; } static native long nalcOpenDevice(String devicename); /** * The alcCloseDevice function allows the application (i.e. the client program) to * disconnect from a device (i.e. the server). * * If deviceHandle is null or invalid, an ALC_INVALID_DEVICE error will be * generated. Once closed, a deviceHandle is invalid. * * @param device address of native device to close */ public static boolean alcCloseDevice(ALCdevice device) { boolean result = nalcCloseDevice(getDevice(device)); synchronized (devices) { device.setInvalid(); devices.remove(new Long(device.device)); } return result; } static native boolean nalcCloseDevice(long device); /** * A context is created using alcCreateContext. The device parameter has to be a valid * device. The attribute list can be null, or a zero terminated list of integer pairs * composed of valid ALC attribute tokens and requested values. * * Context creation will fail if the application requests attributes that, by themselves, * can not be provided. Context creation will fail if the combination of specified * attributes can not be provided. Context creation will fail if a specified attribute, or * the combination of attributes, does not match the default values for unspecified * attributes. * * @param device address of device to associate context to * @param attrList Buffer to read attributes from * @return New context, or null if creation failed */ public static ALCcontext alcCreateContext(ALCdevice device, IntBuffer attrList) { long context_address = nalcCreateContext(getDevice(device), attrList); Util.checkALCError(device); if(context_address != 0) { ALCcontext context = new ALCcontext(context_address); synchronized (ALC10.contexts) { contexts.put(context_address, context); device.addContext(context); } return context; } return null; } static native long nalcCreateContext(long device, IntBuffer attrList); /** * To make a Context current with respect to AL Operation (state changes by issueing * commands), alcMakeContextCurrent is used. The context parameter can be null * or a valid context pointer. The operation will apply to the device that the context * was created for. * * For each OS process (usually this means for each application), only one context can * be current at any given time. All AL commands apply to the current context. * Commands that affect objects shared among contexts (e.g. buffers) have side effects * on other contexts. * * @param context address of context to make current * @return true if successfull, false if not */ public static int alcMakeContextCurrent(ALCcontext context) { return nalcMakeContextCurrent(getContext(context)); } static native int nalcMakeContextCurrent(long context); /** * The current context is the only context accessible to state changes by AL commands * (aside from state changes affecting shared objects). However, multiple contexts can * be processed at the same time. To indicate that a context should be processed (i.e. * that internal execution state like offset increments are supposed to be performed), * the application has to use alcProcessContext. * * Repeated calls to alcProcessContext are legal, and do not affect a context that is * already marked as processing. The default state of a context created by * alcCreateContext is that it is not marked as processing. */ public static void alcProcessContext(ALCcontext context) { nalcProcessContext(getContext(context)); } static native void nalcProcessContext(long context); /** * The application can query for, and obtain an handle to, the current context for the * application. If there is no current context, null is returned. * * @return Current ALCcontext */ public static ALCcontext alcGetCurrentContext() { ALCcontext context = null; long context_address = nalcGetCurrentContext(); if(context_address != 0) { synchronized (ALC10.contexts) { context = ALC10.contexts.get(context_address); } } return context; } static native long nalcGetCurrentContext(); /** * The application can query for, and obtain an handle to, the device of a given context. * * @param context address of context to get device for */ public static ALCdevice alcGetContextsDevice(ALCcontext context) { ALCdevice device = null; long device_address = nalcGetContextsDevice(getContext(context)); if (device_address != 0) { synchronized (ALC10.devices) { device = ALC10.devices.get(device_address); } } return device; } static native long nalcGetContextsDevice(long context); /** * The application can suspend any context from processing (including the current * one). To indicate that a context should be suspended from processing (i.e. that * internal execution state like offset increments is not supposed to be changed), the * application has to use alcSuspendContext. * * Repeated calls to alcSuspendContext are legal, and do not affect a context that is * already marked as suspended. The default state of a context created by * alcCreateContext is that it is marked as suspended. * * @param context address of context to suspend */ public static void alcSuspendContext(ALCcontext context) { nalcSuspendContext(getContext(context)); } static native void nalcSuspendContext(long context); /** * The correct way to destroy a context is to first release it using alcMakeCurrent and * null. Applications should not attempt to destroy a current context. * * @param context address of context to Destroy */ public static void alcDestroyContext(ALCcontext context) { synchronized(ALC10.contexts) { ALCdevice device = alcGetContextsDevice(context); nalcDestroyContext(getContext(context)); device.removeContext(context); context.setInvalid(); } } static native void nalcDestroyContext(long context); /** * ALC uses the same conventions and mechanisms as AL for error handling. In * particular, ALC does not use conventions derived from X11 (GLX) or Windows * (WGL). The alcGetError function can be used to query ALC errors. * * Error conditions are specific to the device. * * ALC_NO_ERROR - The device handle or specifier does name an accessible driver/server. * ALC_INVALID_DEVICE - The Context argument does not name a valid context. * ALC_INVALID_CONTEXT - The Context argument does not name a valid context. * ALC_INVALID_ENUM - A token used is not valid, or not applicable. * ALC_INVALID_VALUE - An value (e.g. attribute) is not valid, or not applicable. * * @return Errorcode from ALC statemachine */ public static int alcGetError(ALCdevice device) { return nalcGetError(getDevice(device)); } static native int nalcGetError(long device); /** * Verify that a given extension is available for the current context and the device it * is associated with. * A null name argument returns ALC_FALSE, as do invalid and unsupported string * tokens. * * @param extName name of extension to find * @return true if extension is available, false if not */ public static boolean alcIsExtensionPresent(ALCdevice device, String extName) { boolean result = nalcIsExtensionPresent(getDevice(device), extName); Util.checkALCError(device); return result; } static native boolean nalcIsExtensionPresent(long device, String extName); /** * Enumeration/token values are device independend, but tokens defined for * extensions might not be present for a given device. But only the tokens defined * by the AL core are guaranteed. Availability of extension tokens dependends on the ALC extension. * * Specifying a null name parameter will cause an ALC_INVALID_VALUE error. * * @param enumName name of enum to find * @return value of enumeration */ public static int alcGetEnumValue(ALCdevice device, String enumName) { int result = nalcGetEnumValue(getDevice(device), enumName); Util.checkALCError(device); return result; } static native int nalcGetEnumValue(long device, String enumName); static long getDevice(ALCdevice device) { if(device != null) { Util.checkALCValidDevice(device); return device.device; } return 0L; } static long getContext(ALCcontext context) { if(context != null) { Util.checkALCValidContext(context); return context.context; } return 0L; } } lwjgl-2.7.1/src/java/org/lwjgl/util/0000755000175000017500000000000011543426510016314 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/util/ReadableColor.java0000644000175000017500000000744211543426510021664 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util; import java.nio.ByteBuffer; /** * Readonly interface for Colors * @author $Author: spasi $ * @version $Revision: 3418 $ * $Id: ReadableColor.java 3418 2010-09-28 21:11:35Z spasi $ */ public interface ReadableColor { /** * Return the red component (0..255) * @return int */ int getRed(); /** * Return the red component (0..255) * @return int */ int getGreen(); /** * Return the red component (0..255) * @return int */ int getBlue(); /** * Return the red component (0..255) * @return int */ int getAlpha(); /** * Return the red component * @return int */ byte getRedByte(); /** * Return the red component * @return int */ byte getGreenByte(); /** * Return the red component * @return int */ byte getBlueByte(); /** * Return the red component * @return int */ byte getAlphaByte(); /** * Write the RGBA color directly out to a ByteBuffer * @param dest the buffer to write to */ void writeRGBA(ByteBuffer dest); /** * Write the RGB color directly out to a ByteBuffer * @param dest the buffer to write to */ void writeRGB(ByteBuffer dest); /** * Write the ABGR color directly out to a ByteBuffer * @param dest the buffer to write to */ void writeABGR(ByteBuffer dest); /** * Write the BGR color directly out to a ByteBuffer * @param dest the buffer to write to */ void writeBGR(ByteBuffer dest); /** * Write the BGRA color directly out to a ByteBuffer * @param dest the buffer to write to */ void writeBGRA(ByteBuffer dest); /** * Write the ARGB color directly out to a ByteBuffer * @param dest the buffer to write to */ void writeARGB(ByteBuffer dest); /* * Some standard colors */ ReadableColor RED = new Color(255, 0, 0); ReadableColor ORANGE = new Color(255, 128, 0); ReadableColor YELLOW = new Color(255, 255, 0); ReadableColor GREEN = new Color(0, 255, 0); ReadableColor CYAN = new Color(0, 255, 255); ReadableColor BLUE = new Color(0, 0, 255); ReadableColor PURPLE = new Color(255, 0, 255); ReadableColor WHITE = new Color(255, 255, 255); ReadableColor BLACK = new Color(0, 0, 0); ReadableColor LTGREY = new Color(192, 192, 192); ReadableColor DKGREY = new Color(64, 64, 64); ReadableColor GREY = new Color(128, 128, 128); } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/0000755000175000017500000000000011543426510017103 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/util/glu/Cylinder.java0000644000175000017500000001421511543426510021522 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.glu; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; /** * Cylinder.java * * * Created 23-dec-2003 * @author Erik Duijs */ public class Cylinder extends Quadric { /** * Constructor for Cylinder. */ public Cylinder() { super(); } /** * draws a cylinder oriented along the z axis. The base of the * cylinder is placed at z = 0, and the top at z=height. Like a sphere, a * cylinder is subdivided around the z axis into slices, and along the z axis * into stacks. * * Note that if topRadius is set to zero, then this routine will generate a * cone. * * If the orientation is set to GLU.OUTSIDE (with glu.quadricOrientation), then * any generated normals point away from the z axis. Otherwise, they point * toward the z axis. * * If texturing is turned on (with glu.quadricTexture), then texture * coordinates are generated so that t ranges linearly from 0.0 at z = 0 to * 1.0 at z = height, and s ranges from 0.0 at the +y axis, to 0.25 at the +x * axis, to 0.5 at the -y axis, to 0.75 at the -x axis, and back to 1.0 at the * +y axis. * * @param baseRadius Specifies the radius of the cylinder at z = 0. * @param topRadius Specifies the radius of the cylinder at z = height. * @param height Specifies the height of the cylinder. * @param slices Specifies the number of subdivisions around the z axis. * @param stacks Specifies the number of subdivisions along the z axis. */ public void draw(float baseRadius, float topRadius, float height, int slices, int stacks) { float da, r, dr, dz; float x, y, z, nz, nsign; int i, j; if (super.orientation == GLU_INSIDE) { nsign = -1.0f; } else { nsign = 1.0f; } da = 2.0f * PI / slices; dr = (topRadius - baseRadius) / stacks; dz = height / stacks; nz = (baseRadius - topRadius) / height; // Z component of normal vectors if (super.drawStyle == GLU_POINT) { glBegin(GL_POINTS); for (i = 0; i < slices; i++) { x = cos((i * da)); y = sin((i * da)); normal3f(x * nsign, y * nsign, nz * nsign); z = 0.0f; r = baseRadius; for (j = 0; j <= stacks; j++) { glVertex3f((x * r), (y * r), z); z += dz; r += dr; } } glEnd(); } else if (super.drawStyle == GLU_LINE || super.drawStyle == GLU_SILHOUETTE) { // Draw rings if (super.drawStyle == GLU_LINE) { z = 0.0f; r = baseRadius; for (j = 0; j <= stacks; j++) { glBegin(GL_LINE_LOOP); for (i = 0; i < slices; i++) { x = cos((i * da)); y = sin((i * da)); normal3f(x * nsign, y * nsign, nz * nsign); glVertex3f((x * r), (y * r), z); } glEnd(); z += dz; r += dr; } } else { // draw one ring at each end if (baseRadius != 0.0) { glBegin(GL_LINE_LOOP); for (i = 0; i < slices; i++) { x = cos((i * da)); y = sin((i * da)); normal3f(x * nsign, y * nsign, nz * nsign); glVertex3f((x * baseRadius), (y * baseRadius), 0.0f); } glEnd(); glBegin(GL_LINE_LOOP); for (i = 0; i < slices; i++) { x = cos((i * da)); y = sin((i * da)); normal3f(x * nsign, y * nsign, nz * nsign); glVertex3f((x * topRadius), (y * topRadius), height); } glEnd(); } } // draw length lines glBegin(GL_LINES); for (i = 0; i < slices; i++) { x = cos((i * da)); y = sin((i * da)); normal3f(x * nsign, y * nsign, nz * nsign); glVertex3f((x * baseRadius), (y * baseRadius), 0.0f); glVertex3f((x * topRadius), (y * topRadius), (height)); } glEnd(); } else if (super.drawStyle == GLU_FILL) { float ds = 1.0f / slices; float dt = 1.0f / stacks; float t = 0.0f; z = 0.0f; r = baseRadius; for (j = 0; j < stacks; j++) { float s = 0.0f; glBegin(GL_QUAD_STRIP); for (i = 0; i <= slices; i++) { if (i == slices) { x = sin(0.0f); y = cos(0.0f); } else { x = sin((i * da)); y = cos((i * da)); } if (nsign == 1.0f) { normal3f((x * nsign), (y * nsign), (nz * nsign)); TXTR_COORD(s, t); glVertex3f((x * r), (y * r), z); normal3f((x * nsign), (y * nsign), (nz * nsign)); TXTR_COORD(s, t + dt); glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz)); } else { normal3f(x * nsign, y * nsign, nz * nsign); TXTR_COORD(s, t); glVertex3f((x * r), (y * r), z); normal3f(x * nsign, y * nsign, nz * nsign); TXTR_COORD(s, t + dt); glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz)); } s += ds; } // for slices glEnd(); r += dr; t += dt; z += dz; } // for stacks } } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/Util.java0000644000175000017500000001165011543426510020666 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.glu; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL12.*; /** * Util.java *

*

* Created 7-jan-2004 * * @author Erik Duijs */ public class Util { /** * temp IntBuffer of one for getting an int from some GL functions */ private static IntBuffer scratch = BufferUtils.createIntBuffer(16); /** * Return ceiling of integer division * * @param a * @param b * * @return int */ protected static int ceil(int a, int b) { return (a % b == 0 ? a / b : a / b + 1); } /** * Normalize vector * * @param v * * @return float[] */ protected static float[] normalize(float[] v) { float r; r = (float)Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); if ( r == 0.0 ) return v; r = 1.0f / r; v[0] *= r; v[1] *= r; v[2] *= r; return v; } /** * Calculate cross-product * * @param v1 * @param v2 * @param result */ protected static void cross(float[] v1, float[] v2, float[] result) { result[0] = v1[1] * v2[2] - v1[2] * v2[1]; result[1] = v1[2] * v2[0] - v1[0] * v2[2]; result[2] = v1[0] * v2[1] - v1[1] * v2[0]; } /** * Method compPerPix. * * @param format * * @return int */ protected static int compPerPix(int format) { /* Determine number of components per pixel */ switch ( format ) { case GL_COLOR_INDEX: case GL_STENCIL_INDEX: case GL_DEPTH_COMPONENT: case GL_RED: case GL_GREEN: case GL_BLUE: case GL_ALPHA: case GL_LUMINANCE: return 1; case GL_LUMINANCE_ALPHA: return 2; case GL_RGB: case GL_BGR: return 3; case GL_RGBA: case GL_BGRA: return 4; default : return -1; } } /** * Method nearestPower. *

* Compute the nearest power of 2 number. This algorithm is a little strange, but it works quite well. * * @param value * * @return int */ protected static int nearestPower(int value) { int i; i = 1; /* Error! */ if ( value == 0 ) return -1; for ( ; ; ) { if ( value == 1 ) { return i; } else if ( value == 3 ) { return i << 2; } value >>= 1; i <<= 1; } } /** * Method bytesPerPixel. * * @param format * @param type * * @return int */ protected static int bytesPerPixel(int format, int type) { int n, m; switch ( format ) { case GL_COLOR_INDEX: case GL_STENCIL_INDEX: case GL_DEPTH_COMPONENT: case GL_RED: case GL_GREEN: case GL_BLUE: case GL_ALPHA: case GL_LUMINANCE: n = 1; break; case GL_LUMINANCE_ALPHA: n = 2; break; case GL_RGB: case GL_BGR: n = 3; break; case GL_RGBA: case GL_BGRA: n = 4; break; default : n = 0; } switch ( type ) { case GL_UNSIGNED_BYTE: m = 1; break; case GL_BYTE: m = 1; break; case GL_BITMAP: m = 1; break; case GL_UNSIGNED_SHORT: m = 2; break; case GL_SHORT: m = 2; break; case GL_UNSIGNED_INT: m = 4; break; case GL_INT: m = 4; break; case GL_FLOAT: m = 4; break; default : m = 0; } return n * m; } /** * Convenience method for returning an int, rather than getting it out of a buffer yourself. * * @param what * * @return int */ protected static int glGetIntegerv(int what) { scratch.rewind(); glGetInteger(what, scratch); return scratch.get(); } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/Registry.java0000644000175000017500000000532511543426510021563 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.glu; import static org.lwjgl.util.glu.GLU.*; /** * Registry.java * * * Created 11-jan-2004 * @author Erik Duijs */ public class Registry extends Util { private static final String versionString = "1.3"; private static final String extensionString = "GLU_EXT_nurbs_tessellator " + "GLU_EXT_object_space_tess "; /** * Method gluGetString * @param name * @return String */ public static String gluGetString(int name) { if (name == GLU_VERSION) { return versionString; } else if (name == GLU_EXTENSIONS) { return extensionString; } return null; } /** * Method gluCheckExtension * * @param extName is an extension name. * @param extString is a string of extensions separated by blank(s). There may or * may not be leading or trailing blank(s) in extString. * This works in cases of extensions being prefixes of another like * GL_EXT_texture and GL_EXT_texture3D. * @return boolean true if extName is found otherwise it returns false. */ public static boolean gluCheckExtension(String extName, String extString) { if (extString == null || extName == null) return false; return extString.indexOf(extName) != -1; } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/Disk.java0000644000175000017500000001375511543426510020653 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.glu; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; /** * Disk.java * * * Created 23-dec-2003 * @author Erik Duijs */ public class Disk extends Quadric { /** * Constructor for Disk. */ public Disk() { super(); } /** * renders a disk on the z = 0 plane. The disk has a radius of * outerRadius, and contains a concentric circular hole with a radius of * innerRadius. If innerRadius is 0, then no hole is generated. The disk is * subdivided around the z axis into slices (like pizza slices), and also * about the z axis into rings (as specified by slices and loops, * respectively). * * With respect to orientation, the +z side of the disk is considered to be * "outside" (see glu.quadricOrientation). This means that if the orientation * is set to GLU.OUTSIDE, then any normals generated point along the +z axis. * Otherwise, they point along the -z axis. * * If texturing is turned on (with glu.quadricTexture), texture coordinates are * generated linearly such that where r=outerRadius, the value at (r, 0, 0) is * (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), and at * (0, -r, 0) it is (0.5, 0). */ public void draw(float innerRadius, float outerRadius, int slices, int loops) { float da, dr; /* Normal vectors */ if (super.normals != GLU_NONE) { if (super.orientation == GLU_OUTSIDE) { glNormal3f(0.0f, 0.0f, +1.0f); } else { glNormal3f(0.0f, 0.0f, -1.0f); } } da = 2.0f * PI / slices; dr = (outerRadius - innerRadius) / loops; switch (super.drawStyle) { case GLU_FILL: { /* texture of a gluDisk is a cut out of the texture unit square * x, y in [-outerRadius, +outerRadius]; s, t in [0, 1] * (linear mapping) */ float dtc = 2.0f * outerRadius; float sa, ca; float r1 = innerRadius; int l; for (l = 0; l < loops; l++) { float r2 = r1 + dr; if (super.orientation == GLU_OUTSIDE) { int s; glBegin(GL_QUAD_STRIP); for (s = 0; s <= slices; s++) { float a; if (s == slices) a = 0.0f; else a = s * da; sa = sin(a); ca = cos(a); TXTR_COORD(0.5f + sa * r2 / dtc, 0.5f + ca * r2 / dtc); glVertex2f(r2 * sa, r2 * ca); TXTR_COORD(0.5f + sa * r1 / dtc, 0.5f + ca * r1 / dtc); glVertex2f(r1 * sa, r1 * ca); } glEnd(); } else { int s; glBegin(GL_QUAD_STRIP); for (s = slices; s >= 0; s--) { float a; if (s == slices) a = 0.0f; else a = s * da; sa = sin(a); ca = cos(a); TXTR_COORD(0.5f - sa * r2 / dtc, 0.5f + ca * r2 / dtc); glVertex2f(r2 * sa, r2 * ca); TXTR_COORD(0.5f - sa * r1 / dtc, 0.5f + ca * r1 / dtc); glVertex2f(r1 * sa, r1 * ca); } glEnd(); } r1 = r2; } break; } case GLU_LINE: { int l, s; /* draw loops */ for (l = 0; l <= loops; l++) { float r = innerRadius + l * dr; glBegin(GL_LINE_LOOP); for (s = 0; s < slices; s++) { float a = s * da; glVertex2f(r * sin(a), r * cos(a)); } glEnd(); } /* draw spokes */ for (s = 0; s < slices; s++) { float a = s * da; float x = sin(a); float y = cos(a); glBegin(GL_LINE_STRIP); for (l = 0; l <= loops; l++) { float r = innerRadius + l * dr; glVertex2f(r * x, r * y); } glEnd(); } break; } case GLU_POINT: { int s; glBegin(GL_POINTS); for (s = 0; s < slices; s++) { float a = s * da; float x = sin(a); float y = cos(a); int l; for (l = 0; l <= loops; l++) { float r = innerRadius * l * dr; glVertex2f(r * x, r * y); } } glEnd(); break; } case GLU_SILHOUETTE: { if (innerRadius != 0.0) { float a; glBegin(GL_LINE_LOOP); for (a = 0.0f; a < 2.0 * PI; a += da) { float x = innerRadius * sin(a); float y = innerRadius * cos(a); glVertex2f(x, y); } glEnd(); } { float a; glBegin(GL_LINE_LOOP); for (a = 0; a < 2.0f * PI; a += da) { float x = outerRadius * sin(a); float y = outerRadius * cos(a); glVertex2f(x, y); } glEnd(); } break; } default: return; } } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/GLUtessellatorCallback.java0000644000175000017500000004024111543426510024275 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu; /** * GLUtessellatorCallback interface provides methods that the user will * override to define the callbacks for a tessellation object. * * @author Eric Veach, July 1994 * @author Java Port: Pepijn Van Eeckhoudt, July 2003 * @author Java Port: Nathan Parker Burg, August 2003 */ public interface GLUtessellatorCallback { /** * The begin callback method is invoked like * {@link javax.media.opengl.GL#glBegin glBegin} to indicate the start of a * (triangle) primitive. The method takes a single argument of type int. If * the GLU_TESS_BOUNDARY_ONLY property is set to GL_FALSE, then * the argument is set to either GL_TRIANGLE_FAN, * GL_TRIANGLE_STRIP, or GL_TRIANGLES. If the * GLU_TESS_BOUNDARY_ONLY property is set to GL_TRUE, then the * argument will be set to GL_LINE_LOOP. * * @param type * Specifics the type of begin/end pair being defined. The following * values are valid: GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP, * GL_TRIANGLES or GL_LINE_LOOP. * * @see GLU#gluTessCallback gluTessCallback * @see #end end * @see #begin begin */ void begin(int type); /** * The same as the {@link #begin begin} callback method except that * it takes an additional reference argument. This reference is * identical to the opaque reference provided when {@link * GLU#gluTessBeginPolygon gluTessBeginPolygon} was called. * * @param type * Specifics the type of begin/end pair being defined. The following * values are valid: GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP, * GL_TRIANGLES or GL_LINE_LOOP. * @param polygonData * Specifics a reference to user-defined data. * * @see GLU#gluTessCallback gluTessCallback * @see #endData endData * @see #begin begin */ void beginData(int type, Object polygonData); /** * The edgeFlag callback method is similar to * {@link javax.media.opengl.GL#glEdgeFlag glEdgeFlag}. The method takes * a single boolean boundaryEdge that indicates which edges lie on the * polygon boundary. If the boundaryEdge is GL_TRUE, then each vertex * that follows begins an edge that lies on the polygon boundary, that is, * an edge that separates an interior region from an exterior one. If the * boundaryEdge is GL_FALSE, then each vertex that follows begins an * edge that lies in the polygon interior. The edge flag callback (if * defined) is invoked before the first vertex callback.

* * Since triangle fans and triangle strips do not support edge flags, the * begin callback is not called with GL_TRIANGLE_FAN or * GL_TRIANGLE_STRIP if a non-null edge flag callback is provided. * (If the callback is initialized to null, there is no impact on * performance). Instead, the fans and strips are converted to independent * triangles. * * @param boundaryEdge * Specifics which edges lie on the polygon boundary. * * @see GLU#gluTessCallback gluTessCallback * @see #edgeFlagData edgeFlagData */ void edgeFlag(boolean boundaryEdge); /** * The same as the {@link #edgeFlag edgeFlage} callback method * except that it takes an additional reference argument. This * reference is identical to the opaque reference provided when * {@link GLU#gluTessBeginPolygon gluTessBeginPolygon} was called. * * @param boundaryEdge * Specifics which edges lie on the polygon boundary. * @param polygonData * Specifics a reference to user-defined data. * * @see GLU#gluTessCallback gluTessCallback * @see #edgeFlag edgeFlag */ void edgeFlagData(boolean boundaryEdge, Object polygonData); /** * The vertex callback method is invoked between the {@link * #begin begin} and {@link #end end} callback methods. It is * similar to {@link javax.media.opengl.GL#glVertex3f glVertex3f}, * and it defines the vertices of the triangles created by the * tessellation process. The method takes a reference as its only * argument. This reference is identical to the opaque reference * provided by the user when the vertex was described (see {@link * GLU#gluTessVertex gluTessVertex}). * * @param vertexData * Specifics a reference to the vertices of the triangles created * byt the tessellatin process. * * @see GLU#gluTessCallback gluTessCallback * @see #vertexData vertexData */ void vertex(Object vertexData); /** * The same as the {@link #vertex vertex} callback method except * that it takes an additional reference argument. This reference is * identical to the opaque reference provided when {@link * GLU#gluTessBeginPolygon gluTessBeginPolygon} was called. * * @param vertexData * Specifics a reference to the vertices of the triangles created * byt the tessellatin process. * @param polygonData * Specifics a reference to user-defined data. * * @see GLU#gluTessCallback gluTessCallback * @see #vertex vertex */ void vertexData(Object vertexData, Object polygonData); /** * The end callback serves the same purpose as * {@link javax.media.opengl.GL#glEnd glEnd}. It indicates the end of a * primitive and it takes no arguments. * * @see GLU#gluTessCallback gluTessCallback * @see #begin begin * @see #endData endData */ void end(); /** * The same as the {@link #end end} callback method except that it * takes an additional reference argument. This reference is * identical to the opaque reference provided when {@link * GLU#gluTessBeginPolygon gluTessBeginPolygon} was called. * * @param polygonData * Specifics a reference to user-defined data. * * @see GLU#gluTessCallback gluTessCallback * @see #beginData beginData * @see #end end */ void endData(Object polygonData); /** * The combine callback method is called to create a new vertex when * the tessellation detects an intersection, or wishes to merge features. The * method takes four arguments: an array of three elements each of type * double, an array of four references, an array of four elements each of * type float, and a reference to a reference.

* * The vertex is defined as a linear combination of up to four existing * vertices, stored in data. The coefficients of the linear combination * are given by weight; these weights always add up to 1. All vertex * pointers are valid even when some of the weights are 0. coords gives * the location of the new vertex.

* * The user must allocate another vertex, interpolate parameters using * data and weight, and return the new vertex pointer in * outData. This handle is supplied during rendering callbacks. The * user is responsible for freeing the memory some time after * {@link GLU#gluTessEndPolygon gluTessEndPolygon} is * called.

* * For example, if the polygon lies in an arbitrary plane in 3-space, and a * color is associated with each vertex, the GLU_TESS_COMBINE * callback might look like this: * *

   *         void myCombine(double[] coords, Object[] data,
   *                        float[] weight, Object[] outData)
   *         {
   *            MyVertex newVertex = new MyVertex();
   *
   *            newVertex.x = coords[0];
   *            newVertex.y = coords[1];
   *            newVertex.z = coords[2];
   *            newVertex.r = weight[0]*data[0].r +
   *                          weight[1]*data[1].r +
   *                          weight[2]*data[2].r +
   *                          weight[3]*data[3].r;
   *            newVertex.g = weight[0]*data[0].g +
   *                          weight[1]*data[1].g +
   *                          weight[2]*data[2].g +
   *                          weight[3]*data[3].g;
   *            newVertex.b = weight[0]*data[0].b +
   *                          weight[1]*data[1].b +
   *                          weight[2]*data[2].b +
   *                          weight[3]*data[3].b;
   *            newVertex.a = weight[0]*data[0].a +
   *                          weight[1]*data[1].a +
   *                          weight[2]*data[2].a +
   *                          weight[3]*data[3].a;
   *            outData = newVertex;
   *         }
* * @param coords * Specifics the location of the new vertex. * @param data * Specifics the vertices used to create the new vertex. * @param weight * Specifics the weights used to create the new vertex. * @param outData * Reference user the put the coodinates of the new vertex. * * @see GLU#gluTessCallback gluTessCallback * @see #combineData combineData */ void combine(double[] coords, Object[] data, float[] weight, Object[] outData); /** * The same as the {@link #combine combine} callback method except * that it takes an additional reference argument. This reference is * identical to the opaque reference provided when {@link * GLU#gluTessBeginPolygon gluTessBeginPolygon} was called. * * @param coords * Specifics the location of the new vertex. * @param data * Specifics the vertices used to create the new vertex. * @param weight * Specifics the weights used to create the new vertex. * @param outData * Reference user the put the coodinates of the new vertex. * @param polygonData * Specifics a reference to user-defined data. * * @see GLU#gluTessCallback gluTessCallback * @see #combine combine */ void combineData(double[] coords, Object[] data, float[] weight, Object[] outData, Object polygonData); /** * The error callback method is called when an error is encountered. * The one argument is of type int; it indicates the specific error that * occurred and will be set to one of GLU_TESS_MISSING_BEGIN_POLYGON, * GLU_TESS_MISSING_END_POLYGON, GLU_TESS_MISSING_BEGIN_CONTOUR, * GLU_TESS_MISSING_END_CONTOUR, GLU_TESS_COORD_TOO_LARGE, * GLU_TESS_NEED_COMBINE_CALLBACK or GLU_OUT_OF_MEMORY. * Character strings describing these errors can be retrieved with the * {@link GLU#gluErrorString gluErrorString} call.

* * The GLU library will recover from the first four errors by inserting the * missing call(s). GLU_TESS_COORD_TOO_LARGE indicates that some * vertex coordinate exceeded the predefined constant * GLU_TESS_MAX_COORD in absolute value, and that the value has been * clamped. (Coordinate values must be small enough so that two can be * multiplied together without overflow.) * GLU_TESS_NEED_COMBINE_CALLBACK indicates that the tessellation * detected an intersection between two edges in the input data, and the * GLU_TESS_COMBINE or GLU_TESS_COMBINE_DATA callback was not * provided. No output is generated. GLU_OUT_OF_MEMORY indicates that * there is not enough memory so no output is generated. * * @param errnum * Specifics the error number code. * * @see GLU#gluTessCallback gluTessCallback * @see #errorData errorData */ void error(int errnum); /** * The same as the {@link #error error} callback method except that * it takes an additional reference argument. This reference is * identical to the opaque reference provided when {@link * GLU#gluTessBeginPolygon gluTessBeginPolygon} was called. * * @param errnum * Specifics the error number code. * @param polygonData * Specifics a reference to user-defined data. * * @see GLU#gluTessCallback gluTessCallback * @see #error error */ void errorData(int errnum, Object polygonData); //void mesh(com.sun.opengl.impl.tessellator.GLUmesh mesh); } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/MipMap.java0000644000175000017500000002203211543426510021130 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.glu; import java.nio.ByteBuffer; import org.lwjgl.BufferUtils; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; /** * MipMap.java * * * Created 11-jan-2004 * @author Erik Duijs */ public class MipMap extends Util { /** * Method gluBuild2DMipmaps * * @param target * @param components * @param width * @param height * @param format * @param type * @param data * @return int */ public static int gluBuild2DMipmaps(final int target, final int components, final int width, final int height, final int format, final int type, final ByteBuffer data) { if ( width < 1 || height < 1 ) return GLU_INVALID_VALUE; final int bpp = bytesPerPixel(format, type); if ( bpp == 0 ) return GLU_INVALID_ENUM; final int maxSize = glGetIntegerv(GL_MAX_TEXTURE_SIZE); int w = nearestPower(width); if ( w > maxSize ) w = maxSize; int h = nearestPower(height); if ( h > maxSize ) h = maxSize; // Get current glPixelStore state PixelStoreState pss = new PixelStoreState(); // set pixel packing glPixelStorei(GL_PACK_ROW_LENGTH, 0); glPixelStorei(GL_PACK_ALIGNMENT, 1); glPixelStorei(GL_PACK_SKIP_ROWS, 0); glPixelStorei(GL_PACK_SKIP_PIXELS, 0); ByteBuffer image; int retVal = 0; boolean done = false; if ( w != width || h != height ) { // must rescale image to get "top" mipmap texture image image = BufferUtils.createByteBuffer((w + 4) * h * bpp); int error = gluScaleImage(format, width, height, type, data, w, h, type, image); if ( error != 0 ) { retVal = error; done = true; } /* set pixel unpacking */ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); } else { image = data; } ByteBuffer bufferA = null; ByteBuffer bufferB = null; int level = 0; while ( !done ) { if (image != data) { /* set pixel unpacking */ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); } glTexImage2D(target, level, components, w, h, 0, format, type, image); if ( w == 1 && h == 1 ) break; final int newW = (w < 2) ? 1 : w >> 1; final int newH = (h < 2) ? 1 : h >> 1; final ByteBuffer newImage; if ( bufferA == null ) newImage = (bufferA = BufferUtils.createByteBuffer((newW + 4) * newH * bpp)); else if ( bufferB == null ) newImage = (bufferB = BufferUtils.createByteBuffer((newW + 4) * newH * bpp)); else newImage = bufferB; int error = gluScaleImage(format, w, h, type, image, newW, newH, type, newImage); if ( error != 0 ) { retVal = error; done = true; } image = newImage; if ( bufferB != null ) bufferB = bufferA; w = newW; h = newH; level++; } // Restore original glPixelStore state pss.save(); return retVal; } /** * Method gluScaleImage. * @param format * @param widthIn * @param heightIn * @param typein * @param dataIn * @param widthOut * @param heightOut * @param typeOut * @param dataOut * @return int */ public static int gluScaleImage(int format, int widthIn, int heightIn, int typein, ByteBuffer dataIn, int widthOut, int heightOut, int typeOut, ByteBuffer dataOut) { final int components = compPerPix(format); if ( components == -1 ) return GLU_INVALID_ENUM; int i, j, k; float[] tempIn, tempOut; float sx, sy; int sizein, sizeout; int rowstride, rowlen; // temp image data tempIn = new float[widthIn * heightIn * components]; tempOut = new float[widthOut * heightOut * components]; // Determine bytes per input type switch ( typein ) { case GL_UNSIGNED_BYTE: sizein = 1; break; case GL_FLOAT: sizein = 4; break; default: return GL_INVALID_ENUM; } // Determine bytes per output type switch ( typeOut ) { case GL_UNSIGNED_BYTE: sizeout = 1; break; case GL_FLOAT: sizeout = 4; break; default: return GL_INVALID_ENUM; } // Get glPixelStore state PixelStoreState pss = new PixelStoreState(); //Unpack the pixel data and convert to floating point if ( pss.unpackRowLength > 0 ) rowlen = pss.unpackRowLength; else rowlen = widthIn; if ( sizein >= pss.unpackAlignment ) rowstride = components * rowlen; else rowstride = pss.unpackAlignment / sizein * ceil(components * rowlen * sizein, pss.unpackAlignment); switch ( typein ) { case GL_UNSIGNED_BYTE: k = 0; dataIn.rewind(); for ( i = 0; i < heightIn; i++ ) { int ubptr = i * rowstride + pss.unpackSkipRows * rowstride + pss.unpackSkipPixels * components; for ( j = 0; j < widthIn * components; j++ ) { tempIn[k++] = dataIn.get(ubptr++) & 0xff; } } break; case GL_FLOAT: k = 0; dataIn.rewind(); for ( i = 0; i < heightIn; i++ ) { int fptr = 4 * (i * rowstride + pss.unpackSkipRows * rowstride + pss.unpackSkipPixels * components); for ( j = 0; j < widthIn * components; j++ ) { tempIn[k++] = dataIn.getFloat(fptr); fptr += 4; } } break; default: return GLU_INVALID_ENUM; } // Do scaling sx = (float)widthIn / (float)widthOut; sy = (float)heightIn / (float)heightOut; float[] c = new float[components]; int src, dst; for ( int iy = 0; iy < heightOut; iy++ ) { for ( int ix = 0; ix < widthOut; ix++ ) { int x0 = (int)(ix * sx); int x1 = (int)((ix + 1) * sx); int y0 = (int)(iy * sy); int y1 = (int)((iy + 1) * sy); int readPix = 0; // reset weighted pixel for ( int ic = 0; ic < components; ic++ ) { c[ic] = 0; } // create weighted pixel for ( int ix0 = x0; ix0 < x1; ix0++ ) { for ( int iy0 = y0; iy0 < y1; iy0++ ) { src = (iy0 * widthIn + ix0) * components; for ( int ic = 0; ic < components; ic++ ) { c[ic] += tempIn[src + ic]; } readPix++; } } // store weighted pixel dst = (iy * widthOut + ix) * components; if ( readPix == 0 ) { // Image is sized up, caused by non power of two texture as input src = (y0 * widthIn + x0) * components; for ( int ic = 0; ic < components; ic++ ) { tempOut[dst++] = tempIn[src + ic]; } } else { // sized down for ( k = 0; k < components; k++ ) { tempOut[dst++] = c[k] / readPix; } } } } // Convert temp output if ( pss.packRowLength > 0 ) rowlen = pss.packRowLength; else rowlen = widthOut; if ( sizeout >= pss.packAlignment ) rowstride = components * rowlen; else rowstride = pss.packAlignment / sizeout * ceil(components * rowlen * sizeout, pss.packAlignment); switch ( typeOut ) { case GL_UNSIGNED_BYTE: k = 0; for ( i = 0; i < heightOut; i++ ) { int ubptr = i * rowstride + pss.packSkipRows * rowstride + pss.packSkipPixels * components; for ( j = 0; j < widthOut * components; j++ ) { dataOut.put(ubptr++, (byte)tempOut[k++]); } } break; case GL_FLOAT: k = 0; for ( i = 0; i < heightOut; i++ ) { int fptr = 4 * (i * rowstride + pss.unpackSkipRows * rowstride + pss.unpackSkipPixels * components); for ( j = 0; j < widthOut * components; j++ ) { dataOut.putFloat(fptr, tempOut[k++]); fptr += 4; } } break; default: return GLU_INVALID_ENUM; } return 0; } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/GLUtessellatorCallbackAdapter.java0000644000175000017500000001301511543426510025575 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu; /** * The GLUtessellatorCallbackAdapter provides a default implementation of * {@link GLUtessellatorCallback GLUtessellatorCallback} * with empty callback methods. This class can be extended to provide user * defined callback methods. * * @author Eric Veach, July 1994 * @author Java Port: Pepijn Van Eechhoudt, July 2003 * @author Java Port: Nathan Parker Burg, August 2003 */ public class GLUtessellatorCallbackAdapter implements GLUtessellatorCallback { public void begin(int type) {} public void edgeFlag(boolean boundaryEdge) {} public void vertex(Object vertexData) {} public void end() {} // public void mesh(com.sun.opengl.impl.tessellator.GLUmesh mesh) {} public void error(int errnum) {} public void combine(double[] coords, Object[] data, float[] weight, Object[] outData) {} public void beginData(int type, Object polygonData) {} public void edgeFlagData(boolean boundaryEdge, Object polygonData) {} public void vertexData(Object vertexData, Object polygonData) {} public void endData(Object polygonData) {} public void errorData(int errnum, Object polygonData) {} public void combineData(double[] coords, Object[] data, float[] weight, Object[] outData, Object polygonData) {} } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/GLUtessellator.java0000644000175000017500000000452411543426510022664 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.glu; public interface GLUtessellator { void gluDeleteTess(); void gluTessProperty(int which, double value); /* Returns tessellator property */ void gluGetTessProperty(int which, double[] value, int value_offset); /* gluGetTessProperty() */ void gluTessNormal(double x, double y, double z); void gluTessCallback(int which, GLUtessellatorCallback aCallback); void gluTessVertex(double[] coords, int coords_offset, Object vertexData); void gluTessBeginPolygon(Object data); void gluTessBeginContour(); void gluTessEndContour(); void gluTessEndPolygon(); /*******************************************************/ /* Obsolete calls -- for backward compatibility */ void gluBeginPolygon(); /*ARGSUSED*/ void gluNextContour(int type); void gluEndPolygon(); }lwjgl-2.7.1/src/java/org/lwjgl/util/glu/Project.java0000644000175000017500000002421511543426510021360 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.glu; import java.nio.FloatBuffer; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.opengl.GL11; import static org.lwjgl.opengl.GL11.*; /** * Project.java *

*

* Created 11-jan-2004 * * @author Erik Duijs */ public class Project extends Util { private static final float[] IDENTITY_MATRIX = new float[] { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; private static final FloatBuffer matrix = BufferUtils.createFloatBuffer(16); private static final FloatBuffer finalMatrix = BufferUtils.createFloatBuffer(16); private static final FloatBuffer tempMatrix = BufferUtils.createFloatBuffer(16); private static final float[] in = new float[4]; private static final float[] out = new float[4]; private static final float[] forward = new float[3]; private static final float[] side = new float[3]; private static final float[] up = new float[3]; /** * Make matrix an identity matrix */ private static void __gluMakeIdentityf(FloatBuffer m) { int oldPos = m.position(); m.put(IDENTITY_MATRIX); m.position(oldPos); } /** * Method __gluMultMatrixVecf * * @param finalMatrix * @param in * @param out */ private static void __gluMultMatrixVecf(FloatBuffer m, float[] in, float[] out) { for (int i = 0; i < 4; i++) { out[i] = in[0] * m.get(m.position() + 0*4 + i) + in[1] * m.get(m.position() + 1*4 + i) + in[2] * m.get(m.position() + 2*4 + i) + in[3] * m.get(m.position() + 3*4 + i); } } /** * @param src * @param inverse * * @return */ private static boolean __gluInvertMatrixf(FloatBuffer src, FloatBuffer inverse) { int i, j, k, swap; float t; FloatBuffer temp = Project.tempMatrix; for (i = 0; i < 16; i++) { temp.put(i, src.get(i + src.position())); } __gluMakeIdentityf(inverse); for (i = 0; i < 4; i++) { /* * * Look for largest element in column */ swap = i; for (j = i + 1; j < 4; j++) { /* * if (fabs(temp[j][i]) > fabs(temp[i][i])) { swap = j; */ if (Math.abs(temp.get(j*4 + i)) > Math.abs(temp.get(i* 4 + i))) { swap = j; } } if (swap != i) { /* * * Swap rows. */ for (k = 0; k < 4; k++) { t = temp.get(i*4 + k); temp.put(i*4 + k, temp.get(swap*4 + k)); temp.put(swap*4 + k, t); t = inverse.get(i*4 + k); inverse.put(i*4 + k, inverse.get(swap*4 + k)); //inverse.put((i << 2) + k, inverse.get((swap << 2) + k)); inverse.put(swap*4 + k, t); //inverse.put((swap << 2) + k, t); } } if (temp.get(i*4 + i) == 0) { /* * * No non-zero pivot. The matrix is singular, which shouldn't * * happen. This means the user gave us a bad matrix. */ return false; } t = temp.get(i*4 + i); for (k = 0; k < 4; k++) { temp.put(i*4 + k, temp.get(i*4 + k)/t); inverse.put(i*4 + k, inverse.get(i*4 + k)/t); } for (j = 0; j < 4; j++) { if (j != i) { t = temp.get(j*4 + i); for (k = 0; k < 4; k++) { temp.put(j*4 + k, temp.get(j*4 + k) - temp.get(i*4 + k) * t); inverse.put(j*4 + k, inverse.get(j*4 + k) - inverse.get(i*4 + k) * t); /*inverse.put( (j << 2) + k, inverse.get((j << 2) + k) - inverse.get((i << 2) + k) * t);*/ } } } } return true; } /** * @param a * @param b * @param r */ private static void __gluMultMatricesf(FloatBuffer a, FloatBuffer b, FloatBuffer r) { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { r.put(r.position() + i*4 + j, a.get(a.position() + i*4 + 0) * b.get(b.position() + 0*4 + j) + a.get(a.position() + i*4 + 1) * b.get(b.position() + 1*4 + j) + a.get(a.position() + i*4 + 2) * b.get(b.position() + 2*4 + j) + a.get(a.position() + i*4 + 3) * b.get(b.position() + 3*4 + j)); } } } /** * Method gluPerspective. * * @param fovy * @param aspect * @param zNear * @param zFar */ public static void gluPerspective(float fovy, float aspect, float zNear, float zFar) { float sine, cotangent, deltaZ; float radians = fovy / 2 * GLU.PI / 180; deltaZ = zFar - zNear; sine = (float) Math.sin(radians); if ((deltaZ == 0) || (sine == 0) || (aspect == 0)) { return; } cotangent = (float) Math.cos(radians) / sine; __gluMakeIdentityf(matrix); matrix.put(0 * 4 + 0, cotangent / aspect); matrix.put(1 * 4 + 1, cotangent); matrix.put(2 * 4 + 2, - (zFar + zNear) / deltaZ); matrix.put(2 * 4 + 3, -1); matrix.put(3 * 4 + 2, -2 * zNear * zFar / deltaZ); matrix.put(3 * 4 + 3, 0); glMultMatrix(matrix); } /** * Method gluLookAt * * @param eyex * @param eyey * @param eyez * @param centerx * @param centery * @param centerz * @param upx * @param upy * @param upz */ public static void gluLookAt( float eyex, float eyey, float eyez, float centerx, float centery, float centerz, float upx, float upy, float upz) { float[] forward = Project.forward; float[] side = Project.side; float[] up = Project.up; forward[0] = centerx - eyex; forward[1] = centery - eyey; forward[2] = centerz - eyez; up[0] = upx; up[1] = upy; up[2] = upz; normalize(forward); /* Side = forward x up */ cross(forward, up, side); normalize(side); /* Recompute up as: up = side x forward */ cross(side, forward, up); __gluMakeIdentityf(matrix); matrix.put(0 * 4 + 0, side[0]); matrix.put(1 * 4 + 0, side[1]); matrix.put(2 * 4 + 0, side[2]); matrix.put(0 * 4 + 1, up[0]); matrix.put(1 * 4 + 1, up[1]); matrix.put(2 * 4 + 1, up[2]); matrix.put(0 * 4 + 2, -forward[0]); matrix.put(1 * 4 + 2, -forward[1]); matrix.put(2 * 4 + 2, -forward[2]); glMultMatrix(matrix); glTranslatef(-eyex, -eyey, -eyez); } /** * Method gluProject * * @param objx * @param objy * @param objz * @param modelMatrix * @param projMatrix * @param viewport * @param win_pos */ public static boolean gluProject( float objx, float objy, float objz, FloatBuffer modelMatrix, FloatBuffer projMatrix, IntBuffer viewport, FloatBuffer win_pos) { float[] in = Project.in; float[] out = Project.out; in[0] = objx; in[1] = objy; in[2] = objz; in[3] = 1.0f; __gluMultMatrixVecf(modelMatrix, in, out); __gluMultMatrixVecf(projMatrix, out, in); if (in[3] == 0.0) return false; in[3] = (1.0f / in[3]) * 0.5f; // Map x, y and z to range 0-1 in[0] = in[0] * in[3] + 0.5f; in[1] = in[1] * in[3] + 0.5f; in[2] = in[2] * in[3] + 0.5f; // Map x,y to viewport win_pos.put(0, in[0] * viewport.get(viewport.position() + 2) + viewport.get(viewport.position() + 0)); win_pos.put(1, in[1] * viewport.get(viewport.position() + 3) + viewport.get(viewport.position() + 1)); win_pos.put(2, in[2]); return true; } /** * Method gluUnproject * * @param winx * @param winy * @param winz * @param modelMatrix * @param projMatrix * @param viewport * @param obj_pos */ public static boolean gluUnProject( float winx, float winy, float winz, FloatBuffer modelMatrix, FloatBuffer projMatrix, IntBuffer viewport, FloatBuffer obj_pos) { float[] in = Project.in; float[] out = Project.out; __gluMultMatricesf(modelMatrix, projMatrix, finalMatrix); if (!__gluInvertMatrixf(finalMatrix, finalMatrix)) return false; in[0] = winx; in[1] = winy; in[2] = winz; in[3] = 1.0f; // Map x and y from window coordinates in[0] = (in[0] - viewport.get(viewport.position() + 0)) / viewport.get(viewport.position() + 2); in[1] = (in[1] - viewport.get(viewport.position() + 1)) / viewport.get(viewport.position() + 3); // Map to range -1 to 1 in[0] = in[0] * 2 - 1; in[1] = in[1] * 2 - 1; in[2] = in[2] * 2 - 1; __gluMultMatrixVecf(finalMatrix, in, out); if (out[3] == 0.0) return false; out[3] = 1.0f / out[3]; obj_pos.put(obj_pos.position() + 0, out[0] * out[3]); obj_pos.put(obj_pos.position() + 1, out[1] * out[3]); obj_pos.put(obj_pos.position() + 2, out[2] * out[3]); return true; } /** * Method gluPickMatrix * * @param x * @param y * @param deltaX * @param deltaY * @param viewport */ public static void gluPickMatrix( float x, float y, float deltaX, float deltaY, IntBuffer viewport) { if (deltaX <= 0 || deltaY <= 0) { return; } /* Translate and scale the picked region to the entire window */ glTranslatef( (viewport.get(viewport.position() + 2) - 2 * (x - viewport.get(viewport.position() + 0))) / deltaX, (viewport.get(viewport.position() + 3) - 2 * (y - viewport.get(viewport.position() + 1))) / deltaY, 0); glScalef(viewport.get(viewport.position() + 2) / deltaX, viewport.get(viewport.position() + 3) / deltaY, 1.0f); } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/PartialDisk.java0000644000175000017500000002432511543426510022163 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.glu; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; /** * PartialDisk.java * * * Created 23-dec-2003 * * @author Erik Duijs */ public class PartialDisk extends Quadric { private static final int CACHE_SIZE = 240; /** * Constructor for PartialDisk. */ public PartialDisk() { super(); } /** * renders a partial disk on the z=0 plane. A partial disk is similar to a * full disk, except that only the subset of the disk from startAngle * through startAngle + sweepAngle is included (where 0 degrees is along * the +y axis, 90 degrees along the +x axis, 180 along the -y axis, and * 270 along the -x axis). * * The partial disk has a radius of outerRadius, and contains a concentric * circular hole with a radius of innerRadius. If innerRadius is zero, then * no hole is generated. The partial disk is subdivided around the z axis * into slices (like pizza slices), and also about the z axis into rings * (as specified by slices and loops, respectively). * * With respect to orientation, the +z side of the partial disk is * considered to be outside (see gluQuadricOrientation). This means that if * the orientation is set to GLU.GLU_OUTSIDE, then any normals generated point * along the +z axis. Otherwise, they point along the -z axis. * * If texturing is turned on (with gluQuadricTexture), texture coordinates * are generated linearly such that where r=outerRadius, the value at (r, 0, 0) * is (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), * and at (0, -r, 0) it is (0.5, 0). */ public void draw( float innerRadius, float outerRadius, int slices, int loops, float startAngle, float sweepAngle) { int i, j; float[] sinCache = new float[CACHE_SIZE]; float[] cosCache = new float[CACHE_SIZE]; float angle; float sintemp, costemp; float deltaRadius; float radiusLow, radiusHigh; float texLow = 0, texHigh = 0; float angleOffset; int slices2; int finish; if (slices >= CACHE_SIZE) slices = CACHE_SIZE - 1; if (slices < 2 || loops < 1 || outerRadius <= 0.0f || innerRadius < 0.0f || innerRadius > outerRadius) { //gluQuadricError(qobj, GLU.GLU_INVALID_VALUE); System.err.println("PartialDisk: GLU_INVALID_VALUE"); return; } if (sweepAngle < -360.0f) sweepAngle = 360.0f; if (sweepAngle > 360.0f) sweepAngle = 360.0f; if (sweepAngle < 0) { startAngle += sweepAngle; sweepAngle = -sweepAngle; } if (sweepAngle == 360.0f) { slices2 = slices; } else { slices2 = slices + 1; } /* Compute length (needed for normal calculations) */ deltaRadius = outerRadius - innerRadius; /* Cache is the vertex locations cache */ angleOffset = startAngle / 180.0f * PI; for (i = 0; i <= slices; i++) { angle = angleOffset + ((PI * sweepAngle) / 180.0f) * i / slices; sinCache[i] = sin(angle); cosCache[i] = cos(angle); } if (sweepAngle == 360.0f) { sinCache[slices] = sinCache[0]; cosCache[slices] = cosCache[0]; } switch (super.normals) { case GLU_FLAT : case GLU_SMOOTH : if (super.orientation == GLU_OUTSIDE) { glNormal3f(0.0f, 0.0f, 1.0f); } else { glNormal3f(0.0f, 0.0f, -1.0f); } break; default : case GLU_NONE : break; } switch (super.drawStyle) { case GLU_FILL : if (innerRadius == .0f) { finish = loops - 1; /* Triangle strip for inner polygons */ glBegin(GL_TRIANGLE_FAN); if (super.textureFlag) { glTexCoord2f(0.5f, 0.5f); } glVertex3f(0.0f, 0.0f, 0.0f); radiusLow = outerRadius - deltaRadius * ((float) (loops - 1) / loops); if (super.textureFlag) { texLow = radiusLow / outerRadius / 2; } if (super.orientation == GLU_OUTSIDE) { for (i = slices; i >= 0; i--) { if (super.textureFlag) { glTexCoord2f( texLow * sinCache[i] + 0.5f, texLow * cosCache[i] + 0.5f); } glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); } } else { for (i = 0; i <= slices; i++) { if (super.textureFlag) { glTexCoord2f( texLow * sinCache[i] + 0.5f, texLow * cosCache[i] + 0.5f); } glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); } } glEnd(); } else { finish = loops; } for (j = 0; j < finish; j++) { radiusLow = outerRadius - deltaRadius * ((float) j / loops); radiusHigh = outerRadius - deltaRadius * ((float) (j + 1) / loops); if (super.textureFlag) { texLow = radiusLow / outerRadius / 2; texHigh = radiusHigh / outerRadius / 2; } glBegin(GL_QUAD_STRIP); for (i = 0; i <= slices; i++) { if (super.orientation == GLU_OUTSIDE) { if (super.textureFlag) { glTexCoord2f( texLow * sinCache[i] + 0.5f, texLow * cosCache[i] + 0.5f); } glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); if (super.textureFlag) { glTexCoord2f( texHigh * sinCache[i] + 0.5f, texHigh * cosCache[i] + 0.5f); } glVertex3f( radiusHigh * sinCache[i], radiusHigh * cosCache[i], 0.0f); } else { if (super.textureFlag) { glTexCoord2f( texHigh * sinCache[i] + 0.5f, texHigh * cosCache[i] + 0.5f); } glVertex3f( radiusHigh * sinCache[i], radiusHigh * cosCache[i], 0.0f); if (super.textureFlag) { glTexCoord2f( texLow * sinCache[i] + 0.5f, texLow * cosCache[i] + 0.5f); } glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); } } glEnd(); } break; case GLU_POINT : glBegin(GL_POINTS); for (i = 0; i < slices2; i++) { sintemp = sinCache[i]; costemp = cosCache[i]; for (j = 0; j <= loops; j++) { radiusLow = outerRadius - deltaRadius * ((float) j / loops); if (super.textureFlag) { texLow = radiusLow / outerRadius / 2; glTexCoord2f( texLow * sinCache[i] + 0.5f, texLow * cosCache[i] + 0.5f); } glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0f); } } glEnd(); break; case GLU_LINE : if (innerRadius == outerRadius) { glBegin(GL_LINE_STRIP); for (i = 0; i <= slices; i++) { if (super.textureFlag) { glTexCoord2f(sinCache[i] / 2 + 0.5f, cosCache[i] / 2 + 0.5f); } glVertex3f(innerRadius * sinCache[i], innerRadius * cosCache[i], 0.0f); } glEnd(); break; } for (j = 0; j <= loops; j++) { radiusLow = outerRadius - deltaRadius * ((float) j / loops); if (super.textureFlag) { texLow = radiusLow / outerRadius / 2; } glBegin(GL_LINE_STRIP); for (i = 0; i <= slices; i++) { if (super.textureFlag) { glTexCoord2f( texLow * sinCache[i] + 0.5f, texLow * cosCache[i] + 0.5f); } glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); } glEnd(); } for (i = 0; i < slices2; i++) { sintemp = sinCache[i]; costemp = cosCache[i]; glBegin(GL_LINE_STRIP); for (j = 0; j <= loops; j++) { radiusLow = outerRadius - deltaRadius * ((float) j / loops); if (super.textureFlag) { texLow = radiusLow / outerRadius / 2; } if (super.textureFlag) { glTexCoord2f( texLow * sinCache[i] + 0.5f, texLow * cosCache[i] + 0.5f); } glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0f); } glEnd(); } break; case GLU_SILHOUETTE : if (sweepAngle < 360.0f) { for (i = 0; i <= slices; i += slices) { sintemp = sinCache[i]; costemp = cosCache[i]; glBegin(GL_LINE_STRIP); for (j = 0; j <= loops; j++) { radiusLow = outerRadius - deltaRadius * ((float) j / loops); if (super.textureFlag) { texLow = radiusLow / outerRadius / 2; glTexCoord2f( texLow * sinCache[i] + 0.5f, texLow * cosCache[i] + 0.5f); } glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0f); } glEnd(); } } for (j = 0; j <= loops; j += loops) { radiusLow = outerRadius - deltaRadius * ((float) j / loops); if (super.textureFlag) { texLow = radiusLow / outerRadius / 2; } glBegin(GL_LINE_STRIP); for (i = 0; i <= slices; i++) { if (super.textureFlag) { glTexCoord2f( texLow * sinCache[i] + 0.5f, texLow * cosCache[i] + 0.5f); } glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); } glEnd(); if (innerRadius == outerRadius) break; } break; default : break; } } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/0000755000175000017500000000000011543426510021611 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/PriorityQSort.java0000644000175000017500000002477011543426510025300 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; class PriorityQSort extends PriorityQ { PriorityQHeap heap; Object[] keys; // JAVA: 'order' contains indices into the keys array. // This simulates the indirect pointers used in the original C code // (from Frank Suykens, Luciad.com). int[] order; int size, max; boolean initialized; PriorityQ.Leq leq; PriorityQSort(PriorityQ.Leq leq) { heap = new PriorityQHeap(leq); keys = new Object[PriorityQ.INIT_SIZE]; size = 0; max = PriorityQ.INIT_SIZE; initialized = false; this.leq = leq; } /* really __gl_pqSortDeletePriorityQ */ void pqDeletePriorityQ() { if (heap != null) heap.pqDeletePriorityQ(); order = null; keys = null; } private static boolean LT(PriorityQ.Leq leq, Object x, Object y) { return (!PriorityQHeap.LEQ(leq, y, x)); } private static boolean GT(PriorityQ.Leq leq, Object x, Object y) { return (!PriorityQHeap.LEQ(leq, x, y)); } private static void Swap(int[] array, int a, int b) { if (true) { int tmp = array[a]; array[a] = array[b]; array[b] = tmp; } else { } } private static class Stack { int p, r; } /* really __gl_pqSortInit */ boolean pqInit() { int p, r, i, j; int piv; Stack[] stack = new Stack[50]; for (int k = 0; k < stack.length; k++) { stack[k] = new Stack(); } int top = 0; int seed = 2016473283; /* Create an array of indirect pointers to the keys, so that we * the handles we have returned are still valid. */ order = new int[size + 1]; /* the previous line is a patch to compensate for the fact that IBM */ /* machines return a null on a malloc of zero bytes (unlike SGI), */ /* so we have to put in this defense to guard against a memory */ /* fault four lines down. from fossum@austin.ibm.com. */ p = 0; r = size - 1; for (piv = 0, i = p; i <= r; ++piv, ++i) { // indirect pointers: keep an index into the keys array, not a direct pointer to its contents order[i] = piv; } /* Sort the indirect pointers in descending order, * using randomized Quicksort */ stack[top].p = p; stack[top].r = r; ++top; while (--top >= 0) { p = stack[top].p; r = stack[top].r; while (r > p + 10) { seed = Math.abs( seed * 1539415821 + 1 ); i = p + seed % (r - p + 1); piv = order[i]; order[i] = order[p]; order[p] = piv; i = p - 1; j = r + 1; do { do { ++i; } while (GT(leq, keys[order[i]], keys[piv])); do { --j; } while (LT(leq, keys[order[j]], keys[piv])); Swap(order, i, j); } while (i < j); Swap(order, i, j); /* Undo last swap */ if (i - p < r - j) { stack[top].p = j + 1; stack[top].r = r; ++top; r = i - 1; } else { stack[top].p = p; stack[top].r = i - 1; ++top; p = j + 1; } } /* Insertion sort small lists */ for (i = p + 1; i <= r; ++i) { piv = order[i]; for (j = i; j > p && LT(leq, keys[order[j - 1]], keys[piv]); --j) { order[j] = order[j - 1]; } order[j] = piv; } } max = size; initialized = true; heap.pqInit(); /* always succeeds */ /* #ifndef NDEBUG p = order; r = p + size - 1; for (i = p; i < r; ++i) { Assertion.doAssert(LEQ( * * (i + 1), **i )); } #endif*/ return true; } /* really __gl_pqSortInsert */ /* returns LONG_MAX iff out of memory */ int pqInsert(Object keyNew) { int curr; if (initialized) { return heap.pqInsert(keyNew); } curr = size; if (++size >= max) { Object[] saveKey = keys; /* If the heap overflows, double its size. */ max <<= 1; // pq->keys = (PQHeapKey *)memRealloc( pq->keys,(size_t)(pq->max * sizeof( pq->keys[0] ))); Object[] pqKeys = new Object[max]; System.arraycopy( keys, 0, pqKeys, 0, keys.length ); keys = pqKeys; if (keys == null) { keys = saveKey; /* restore ptr to free upon return */ return Integer.MAX_VALUE; } } assert curr != Integer.MAX_VALUE; keys[curr] = keyNew; /* Negative handles index the sorted array. */ return -(curr + 1); } /* really __gl_pqSortExtractMin */ Object pqExtractMin() { Object sortMin, heapMin; if (size == 0) { return heap.pqExtractMin(); } sortMin = keys[order[size - 1]]; if (!heap.pqIsEmpty()) { heapMin = heap.pqMinimum(); if (LEQ(leq, heapMin, sortMin)) { return heap.pqExtractMin(); } } do { --size; } while (size > 0 && keys[order[size - 1]] == null); return sortMin; } /* really __gl_pqSortMinimum */ Object pqMinimum() { Object sortMin, heapMin; if (size == 0) { return heap.pqMinimum(); } sortMin = keys[order[size - 1]]; if (!heap.pqIsEmpty()) { heapMin = heap.pqMinimum(); if (PriorityQHeap.LEQ(leq, heapMin, sortMin)) { return heapMin; } } return sortMin; } /* really __gl_pqSortIsEmpty */ boolean pqIsEmpty() { return (size == 0) && heap.pqIsEmpty(); } /* really __gl_pqSortDelete */ void pqDelete(int curr) { if (curr >= 0) { heap.pqDelete(curr); return; } curr = -(curr + 1); assert curr < max && keys[curr] != null; keys[curr] = null; while (size > 0 && keys[order[size - 1]] == null) { --size; } } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/GLUmesh.java0000644000175000017500000001077611543426510023773 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; class GLUmesh { GLUvertex vHead = new GLUvertex(); /* dummy header for vertex list */ GLUface fHead = new GLUface(); /* dummy header for face list */ GLUhalfEdge eHead = new GLUhalfEdge(true); /* dummy header for edge list */ GLUhalfEdge eHeadSym = new GLUhalfEdge(false); /* and its symmetric counterpart */ } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/GLUhalfEdge.java0000644000175000017500000001154411543426510024530 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; class GLUhalfEdge { public GLUhalfEdge next; /* doubly-linked list (prev==Sym->next) */ public GLUhalfEdge Sym; /* same edge, opposite direction */ public GLUhalfEdge Onext; /* next edge CCW around origin */ public GLUhalfEdge Lnext; /* next edge CCW around left face */ public GLUvertex Org; /* origin vertex (Overtex too long) */ public GLUface Lface; /* left face */ /* Internal data (keep hidden) */ public ActiveRegion activeRegion; /* a region with this upper edge (sweep.c) */ public int winding; /* change in winding number when crossing */ public boolean first; GLUhalfEdge(boolean first) { this.first = first; } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/TessMono.java0000644000175000017500000002447711543426510024241 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; class TessMono { /* __gl_meshTessellateMonoRegion( face ) tessellates a monotone region * (what else would it do??) The region must consist of a single * loop of half-edges (see mesh.h) oriented CCW. "Monotone" in this * case means that any vertical line intersects the interior of the * region in a single interval. * * Tessellation consists of adding interior edges (actually pairs of * half-edges), to split the region into non-overlapping triangles. * * The basic idea is explained in Preparata and Shamos (which I don''t * have handy right now), although their implementation is more * complicated than this one. The are two edge chains, an upper chain * and a lower chain. We process all vertices from both chains in order, * from right to left. * * The algorithm ensures that the following invariant holds after each * vertex is processed: the untessellated region consists of two * chains, where one chain (say the upper) is a single edge, and * the other chain is concave. The left vertex of the single edge * is always to the left of all vertices in the concave chain. * * Each step consists of adding the rightmost unprocessed vertex to one * of the two chains, and forming a fan of triangles from the rightmost * of two chain endpoints. Determining whether we can add each triangle * to the fan is a simple orientation test. By making the fan as large * as possible, we restore the invariant (check it yourself). */ static boolean __gl_meshTessellateMonoRegion(GLUface face) { GLUhalfEdge up, lo; /* All edges are oriented CCW around the boundary of the region. * First, find the half-edge whose origin vertex is rightmost. * Since the sweep goes from left to right, face->anEdge should * be close to the edge we want. */ up = face.anEdge; assert (up.Lnext != up && up.Lnext.Lnext != up); for (; Geom.VertLeq(up.Sym.Org, up.Org); up = up.Onext.Sym) ; for (; Geom.VertLeq(up.Org, up.Sym.Org); up = up.Lnext) ; lo = up.Onext.Sym; while (up.Lnext != lo) { if (Geom.VertLeq(up.Sym.Org, lo.Org)) { /* up.Sym.Org is on the left. It is safe to form triangles from lo.Org. * The EdgeGoesLeft test guarantees progress even when some triangles * are CW, given that the upper and lower chains are truly monotone. */ while (lo.Lnext != up && (Geom.EdgeGoesLeft(lo.Lnext) || Geom.EdgeSign(lo.Org, lo.Sym.Org, lo.Lnext.Sym.Org) <= 0)) { GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); if (tempHalfEdge == null) return false; lo = tempHalfEdge.Sym; } lo = lo.Onext.Sym; } else { /* lo.Org is on the left. We can make CCW triangles from up.Sym.Org. */ while (lo.Lnext != up && (Geom.EdgeGoesRight(up.Onext.Sym) || Geom.EdgeSign(up.Sym.Org, up.Org, up.Onext.Sym.Org) >= 0)) { GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(up, up.Onext.Sym); if (tempHalfEdge == null) return false; up = tempHalfEdge.Sym; } up = up.Lnext; } } /* Now lo.Org == up.Sym.Org == the leftmost vertex. The remaining region * can be tessellated in a fan from this leftmost vertex. */ assert (lo.Lnext != up); while (lo.Lnext.Lnext != up) { GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); if (tempHalfEdge == null) return false; lo = tempHalfEdge.Sym; } return true; } /* __gl_meshTessellateInterior( mesh ) tessellates each region of * the mesh which is marked "inside" the polygon. Each such region * must be monotone. */ public static boolean __gl_meshTessellateInterior(GLUmesh mesh) { GLUface f, next; /*LINTED*/ for (f = mesh.fHead.next; f != mesh.fHead; f = next) { /* Make sure we don''t try to tessellate the new triangles. */ next = f.next; if (f.inside) { if (!__gl_meshTessellateMonoRegion(f)) return false; } } return true; } /* __gl_meshDiscardExterior( mesh ) zaps (ie. sets to NULL) all faces * which are not marked "inside" the polygon. Since further mesh operations * on NULL faces are not allowed, the main purpose is to clean up the * mesh so that exterior loops are not represented in the data structure. */ public static void __gl_meshDiscardExterior(GLUmesh mesh) { GLUface f, next; /*LINTED*/ for (f = mesh.fHead.next; f != mesh.fHead; f = next) { /* Since f will be destroyed, save its next pointer. */ next = f.next; if (!f.inside) { Mesh.__gl_meshZapFace(f); } } } // private static final int MARKED_FOR_DELETION = 0x7fffffff; /* __gl_meshSetWindingNumber( mesh, value, keepOnlyBoundary ) resets the * winding numbers on all edges so that regions marked "inside" the * polygon have a winding number of "value", and regions outside * have a winding number of 0. * * If keepOnlyBoundary is TRUE, it also deletes all edges which do not * separate an interior region from an exterior one. */ public static boolean __gl_meshSetWindingNumber(GLUmesh mesh, int value, boolean keepOnlyBoundary) { GLUhalfEdge e, eNext; for (e = mesh.eHead.next; e != mesh.eHead; e = eNext) { eNext = e.next; if (e.Sym.Lface.inside != e.Lface.inside) { /* This is a boundary edge (one side is interior, one is exterior). */ e.winding = (e.Lface.inside) ? value : -value; } else { /* Both regions are interior, or both are exterior. */ if (!keepOnlyBoundary) { e.winding = 0; } else { if (!Mesh.__gl_meshDelete(e)) return false; } } } return true; } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/GLUface.java0000644000175000017500000001124111543426510023721 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; class GLUface { public GLUface next; /* next face (never NULL) */ public GLUface prev; /* previous face (never NULL) */ public GLUhalfEdge anEdge; /* a half edge with this left face */ public Object data; /* room for client's data */ /* Internal data (keep hidden) */ public GLUface trail; /* "stack" for conversion to strips */ public boolean marked; /* flag for conversion to strips */ public boolean inside; /* this face is in the polygon interior */ } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/Normal.java0000644000175000017500000002666211543426510023720 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; import org.lwjgl.util.glu.GLU; class Normal { private Normal() { } static boolean SLANTED_SWEEP; static double S_UNIT_X; /* Pre-normalized */ static double S_UNIT_Y; private static final boolean TRUE_PROJECT = false; static { if (SLANTED_SWEEP) { /* The "feature merging" is not intended to be complete. There are * special cases where edges are nearly parallel to the sweep line * which are not implemented. The algorithm should still behave * robustly (ie. produce a reasonable tesselation) in the presence * of such edges, however it may miss features which could have been * merged. We could minimize this effect by choosing the sweep line * direction to be something unusual (ie. not parallel to one of the * coordinate axes). */ S_UNIT_X = 0.50941539564955385; /* Pre-normalized */ S_UNIT_Y = 0.86052074622010633; } else { S_UNIT_X = 1.0; S_UNIT_Y = 0.0; } } private static double Dot(double[] u, double[] v) { return (u[0] * v[0] + u[1] * v[1] + u[2] * v[2]); } static void Normalize(double[] v) { double len = v[0] * v[0] + v[1] * v[1] + v[2] * v[2]; assert (len > 0); len = Math.sqrt(len); v[0] /= len; v[1] /= len; v[2] /= len; } static int LongAxis(double[] v) { int i = 0; if (Math.abs(v[1]) > Math.abs(v[0])) { i = 1; } if (Math.abs(v[2]) > Math.abs(v[i])) { i = 2; } return i; } static void ComputeNormal(GLUtessellatorImpl tess, double[] norm) { GLUvertex v, v1, v2; double c, tLen2, maxLen2; double[] maxVal, minVal, d1, d2, tNorm; GLUvertex[] maxVert, minVert; GLUvertex vHead = tess.mesh.vHead; int i; maxVal = new double[3]; minVal = new double[3]; minVert = new GLUvertex[3]; maxVert = new GLUvertex[3]; d1 = new double[3]; d2 = new double[3]; tNorm = new double[3]; maxVal[0] = maxVal[1] = maxVal[2] = -2 * GLU.TESS_MAX_COORD; minVal[0] = minVal[1] = minVal[2] = 2 * GLU.TESS_MAX_COORD; for (v = vHead.next; v != vHead; v = v.next) { for (i = 0; i < 3; ++i) { c = v.coords[i]; if (c < minVal[i]) { minVal[i] = c; minVert[i] = v; } if (c > maxVal[i]) { maxVal[i] = c; maxVert[i] = v; } } } /* Find two vertices separated by at least 1/sqrt(3) of the maximum * distance between any two vertices */ i = 0; if (maxVal[1] - minVal[1] > maxVal[0] - minVal[0]) { i = 1; } if (maxVal[2] - minVal[2] > maxVal[i] - minVal[i]) { i = 2; } if (minVal[i] >= maxVal[i]) { /* All vertices are the same -- normal doesn't matter */ norm[0] = 0; norm[1] = 0; norm[2] = 1; return; } /* Look for a third vertex which forms the triangle with maximum area * (Length of normal == twice the triangle area) */ maxLen2 = 0; v1 = minVert[i]; v2 = maxVert[i]; d1[0] = v1.coords[0] - v2.coords[0]; d1[1] = v1.coords[1] - v2.coords[1]; d1[2] = v1.coords[2] - v2.coords[2]; for (v = vHead.next; v != vHead; v = v.next) { d2[0] = v.coords[0] - v2.coords[0]; d2[1] = v.coords[1] - v2.coords[1]; d2[2] = v.coords[2] - v2.coords[2]; tNorm[0] = d1[1] * d2[2] - d1[2] * d2[1]; tNorm[1] = d1[2] * d2[0] - d1[0] * d2[2]; tNorm[2] = d1[0] * d2[1] - d1[1] * d2[0]; tLen2 = tNorm[0] * tNorm[0] + tNorm[1] * tNorm[1] + tNorm[2] * tNorm[2]; if (tLen2 > maxLen2) { maxLen2 = tLen2; norm[0] = tNorm[0]; norm[1] = tNorm[1]; norm[2] = tNorm[2]; } } if (maxLen2 <= 0) { /* All points lie on a single line -- any decent normal will do */ norm[0] = norm[1] = norm[2] = 0; norm[LongAxis(d1)] = 1; } } static void CheckOrientation(GLUtessellatorImpl tess) { double area; GLUface f, fHead = tess.mesh.fHead; GLUvertex v, vHead = tess.mesh.vHead; GLUhalfEdge e; /* When we compute the normal automatically, we choose the orientation * so that the the sum of the signed areas of all contours is non-negative. */ area = 0; for (f = fHead.next; f != fHead; f = f.next) { e = f.anEdge; if (e.winding <= 0) continue; do { area += (e.Org.s - e.Sym.Org.s) * (e.Org.t + e.Sym.Org.t); e = e.Lnext; } while (e != f.anEdge); } if (area < 0) { /* Reverse the orientation by flipping all the t-coordinates */ for (v = vHead.next; v != vHead; v = v.next) { v.t = -v.t; } tess.tUnit[0] = -tess.tUnit[0]; tess.tUnit[1] = -tess.tUnit[1]; tess.tUnit[2] = -tess.tUnit[2]; } } /* Determine the polygon normal and project vertices onto the plane * of the polygon. */ public static void __gl_projectPolygon(GLUtessellatorImpl tess) { GLUvertex v, vHead = tess.mesh.vHead; double w; double[] norm = new double[3]; double[] sUnit, tUnit; int i; boolean computedNormal = false; norm[0] = tess.normal[0]; norm[1] = tess.normal[1]; norm[2] = tess.normal[2]; if (norm[0] == 0 && norm[1] == 0 && norm[2] == 0) { ComputeNormal(tess, norm); computedNormal = true; } sUnit = tess.sUnit; tUnit = tess.tUnit; i = LongAxis(norm); if (TRUE_PROJECT) { /* Choose the initial sUnit vector to be approximately perpendicular * to the normal. */ Normalize(norm); sUnit[i] = 0; sUnit[(i + 1) % 3] = S_UNIT_X; sUnit[(i + 2) % 3] = S_UNIT_Y; /* Now make it exactly perpendicular */ w = Dot(sUnit, norm); sUnit[0] -= w * norm[0]; sUnit[1] -= w * norm[1]; sUnit[2] -= w * norm[2]; Normalize(sUnit); /* Choose tUnit so that (sUnit,tUnit,norm) form a right-handed frame */ tUnit[0] = norm[1] * sUnit[2] - norm[2] * sUnit[1]; tUnit[1] = norm[2] * sUnit[0] - norm[0] * sUnit[2]; tUnit[2] = norm[0] * sUnit[1] - norm[1] * sUnit[0]; Normalize(tUnit); } else { /* Project perpendicular to a coordinate axis -- better numerically */ sUnit[i] = 0; sUnit[(i + 1) % 3] = S_UNIT_X; sUnit[(i + 2) % 3] = S_UNIT_Y; tUnit[i] = 0; tUnit[(i + 1) % 3] = (norm[i] > 0) ? -S_UNIT_Y : S_UNIT_Y; tUnit[(i + 2) % 3] = (norm[i] > 0) ? S_UNIT_X : -S_UNIT_X; } /* Project the vertices onto the sweep plane */ for (v = vHead.next; v != vHead; v = v.next) { v.s = Dot(v.coords, sUnit); v.t = Dot(v.coords, tUnit); } if (computedNormal) { CheckOrientation(tess); } } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/Dict.java0000644000175000017500000001413511543426510023343 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; class Dict { DictNode head; Object frame; DictLeq leq; private Dict() { } static Dict dictNewDict(Object frame, DictLeq leq) { Dict dict = new Dict(); dict.head = new DictNode(); dict.head.key = null; dict.head.next = dict.head; dict.head.prev = dict.head; dict.frame = frame; dict.leq = leq; return dict; } static void dictDeleteDict(Dict dict) { dict.head = null; dict.frame = null; dict.leq = null; } static DictNode dictInsert(Dict dict, Object key) { return dictInsertBefore(dict, dict.head, key); } static DictNode dictInsertBefore(Dict dict, DictNode node, Object key) { do { node = node.prev; } while (node.key != null && !dict.leq.leq(dict.frame, node.key, key)); DictNode newNode = new DictNode(); newNode.key = key; newNode.next = node.next; node.next.prev = newNode; newNode.prev = node; node.next = newNode; return newNode; } static Object dictKey(DictNode aNode) { return aNode.key; } static DictNode dictSucc(DictNode aNode) { return aNode.next; } static DictNode dictPred(DictNode aNode) { return aNode.prev; } static DictNode dictMin(Dict aDict) { return aDict.head.next; } static DictNode dictMax(Dict aDict) { return aDict.head.prev; } static void dictDelete(Dict dict, DictNode node) { node.next.prev = node.prev; node.prev.next = node.next; } static DictNode dictSearch(Dict dict, Object key) { DictNode node = dict.head; do { node = node.next; } while (node.key != null && !(dict.leq.leq(dict.frame, key, node.key))); return node; } public interface DictLeq { boolean leq(Object frame, Object key1, Object key2); } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/PriorityQ.java0000644000175000017500000001227611543426510024426 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; abstract class PriorityQ { public static final int INIT_SIZE = 32; public static class PQnode { int handle; } public static class PQhandleElem { Object key; int node; } public interface Leq { boolean leq(Object key1, Object key2); } // #ifdef FOR_TRITE_TEST_PROGRAM // private static boolean LEQ(PriorityQCommon.Leq leq, Object x,Object y) { // return pq.leq.leq(x,y); // } // #else /* Violates modularity, but a little faster */ // #include "geom.h" public static boolean LEQ(Leq leq, Object x, Object y) { return Geom.VertLeq((GLUvertex) x, (GLUvertex) y); } static PriorityQ pqNewPriorityQ(Leq leq) { return new PriorityQSort(leq); } abstract void pqDeletePriorityQ(); abstract boolean pqInit(); abstract int pqInsert(Object keyNew); abstract Object pqExtractMin(); abstract void pqDelete(int hCurr); abstract Object pqMinimum(); abstract boolean pqIsEmpty(); // #endif } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/Sweep.java0000644000175000017500000016246211543426510023552 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; import static org.lwjgl.util.glu.GLU.*; class Sweep { private Sweep() { } // #ifdef FOR_TRITE_TEST_PROGRAM // extern void DebugEvent( GLUtessellator *tess ); // #else private static void DebugEvent(GLUtessellatorImpl tess) { } // #endif /* * Invariants for the Edge Dictionary. * - each pair of adjacent edges e2=Succ(e1) satisfies EdgeLeq(e1,e2) * at any valid location of the sweep event * - if EdgeLeq(e2,e1) as well (at any valid sweep event), then e1 and e2 * share a common endpoint * - for each e, e.Dst has been processed, but not e.Org * - each edge e satisfies VertLeq(e.Dst,event) && VertLeq(event,e.Org) * where "event" is the current sweep line event. * - no edge e has zero length * * Invariants for the Mesh (the processed portion). * - the portion of the mesh left of the sweep line is a planar graph, * ie. there is *some* way to embed it in the plane * - no processed edge has zero length * - no two processed vertices have identical coordinates * - each "inside" region is monotone, ie. can be broken into two chains * of monotonically increasing vertices according to VertLeq(v1,v2) * - a non-invariant: these chains may intersect (very slightly) * * Invariants for the Sweep. * - if none of the edges incident to the event vertex have an activeRegion * (ie. none of these edges are in the edge dictionary), then the vertex * has only right-going edges. * - if an edge is marked "fixUpperEdge" (it is a temporary edge introduced * by ConnectRightVertex), then it is the only right-going edge from * its associated vertex. (This says that these edges exist only * when it is necessary.) */ /* When we merge two edges into one, we need to compute the combined * winding of the new edge. */ private static void AddWinding(GLUhalfEdge eDst, GLUhalfEdge eSrc) { eDst.winding += eSrc.winding; eDst.Sym.winding += eSrc.Sym.winding; } private static ActiveRegion RegionBelow(ActiveRegion r) { return ((ActiveRegion) Dict.dictKey(Dict.dictPred(r.nodeUp))); } private static ActiveRegion RegionAbove(ActiveRegion r) { return ((ActiveRegion) Dict.dictKey(Dict.dictSucc(r.nodeUp))); } static boolean EdgeLeq(GLUtessellatorImpl tess, ActiveRegion reg1, ActiveRegion reg2) /* * Both edges must be directed from right to left (this is the canonical * direction for the upper edge of each region). * * The strategy is to evaluate a "t" value for each edge at the * current sweep line position, given by tess.event. The calculations * are designed to be very stable, but of course they are not perfect. * * Special case: if both edge destinations are at the sweep event, * we sort the edges by slope (they would otherwise compare equally). */ { GLUvertex event = tess.event; GLUhalfEdge e1, e2; double t1, t2; e1 = reg1.eUp; e2 = reg2.eUp; if (e1.Sym.Org == event) { if (e2.Sym.Org == event) { /* Two edges right of the sweep line which meet at the sweep event. * Sort them by slope. */ if (Geom.VertLeq(e1.Org, e2.Org)) { return Geom.EdgeSign(e2.Sym.Org, e1.Org, e2.Org) <= 0; } return Geom.EdgeSign(e1.Sym.Org, e2.Org, e1.Org) >= 0; } return Geom.EdgeSign(e2.Sym.Org, event, e2.Org) <= 0; } if (e2.Sym.Org == event) { return Geom.EdgeSign(e1.Sym.Org, event, e1.Org) >= 0; } /* General case - compute signed distance *from* e1, e2 to event */ t1 = Geom.EdgeEval(e1.Sym.Org, event, e1.Org); t2 = Geom.EdgeEval(e2.Sym.Org, event, e2.Org); return (t1 >= t2); } static void DeleteRegion(GLUtessellatorImpl tess, ActiveRegion reg) { if (reg.fixUpperEdge) { /* It was created with zero winding number, so it better be * deleted with zero winding number (ie. it better not get merged * with a real edge). */ assert (reg.eUp.winding == 0); } reg.eUp.activeRegion = null; Dict.dictDelete(tess.dict, reg.nodeUp); /* __gl_dictListDelete */ } static boolean FixUpperEdge(ActiveRegion reg, GLUhalfEdge newEdge) /* * Replace an upper edge which needs fixing (see ConnectRightVertex). */ { assert (reg.fixUpperEdge); if (!Mesh.__gl_meshDelete(reg.eUp)) return false; reg.fixUpperEdge = false; reg.eUp = newEdge; newEdge.activeRegion = reg; return true; } static ActiveRegion TopLeftRegion(ActiveRegion reg) { GLUvertex org = reg.eUp.Org; GLUhalfEdge e; /* Find the region above the uppermost edge with the same origin */ do { reg = RegionAbove(reg); } while (reg.eUp.Org == org); /* If the edge above was a temporary edge introduced by ConnectRightVertex, * now is the time to fix it. */ if (reg.fixUpperEdge) { e = Mesh.__gl_meshConnect(RegionBelow(reg).eUp.Sym, reg.eUp.Lnext); if (e == null) return null; if (!FixUpperEdge(reg, e)) return null; reg = RegionAbove(reg); } return reg; } static ActiveRegion TopRightRegion(ActiveRegion reg) { GLUvertex dst = reg.eUp.Sym.Org; /* Find the region above the uppermost edge with the same destination */ do { reg = RegionAbove(reg); } while (reg.eUp.Sym.Org == dst); return reg; } static ActiveRegion AddRegionBelow(GLUtessellatorImpl tess, ActiveRegion regAbove, GLUhalfEdge eNewUp) /* * Add a new active region to the sweep line, *somewhere* below "regAbove" * (according to where the new edge belongs in the sweep-line dictionary). * The upper edge of the new region will be "eNewUp". * Winding number and "inside" flag are not updated. */ { ActiveRegion regNew = new ActiveRegion(); if (regNew == null) throw new RuntimeException(); regNew.eUp = eNewUp; /* __gl_dictListInsertBefore */ regNew.nodeUp = Dict.dictInsertBefore(tess.dict, regAbove.nodeUp, regNew); if (regNew.nodeUp == null) throw new RuntimeException(); regNew.fixUpperEdge = false; regNew.sentinel = false; regNew.dirty = false; eNewUp.activeRegion = regNew; return regNew; } static boolean IsWindingInside(GLUtessellatorImpl tess, int n) { switch (tess.windingRule) { case GLU_TESS_WINDING_ODD: return (n & 1) != 0; case GLU_TESS_WINDING_NONZERO: return (n != 0); case GLU_TESS_WINDING_POSITIVE: return (n > 0); case GLU_TESS_WINDING_NEGATIVE: return (n < 0); case GLU_TESS_WINDING_ABS_GEQ_TWO: return (n >= 2) || (n <= -2); } /*LINTED*/ // assert (false); throw new InternalError(); /*NOTREACHED*/ } static void ComputeWinding(GLUtessellatorImpl tess, ActiveRegion reg) { reg.windingNumber = RegionAbove(reg).windingNumber + reg.eUp.winding; reg.inside = IsWindingInside(tess, reg.windingNumber); } static void FinishRegion(GLUtessellatorImpl tess, ActiveRegion reg) /* * Delete a region from the sweep line. This happens when the upper * and lower chains of a region meet (at a vertex on the sweep line). * The "inside" flag is copied to the appropriate mesh face (we could * not do this before -- since the structure of the mesh is always * changing, this face may not have even existed until now). */ { GLUhalfEdge e = reg.eUp; GLUface f = e.Lface; f.inside = reg.inside; f.anEdge = e; /* optimization for __gl_meshTessellateMonoRegion() */ DeleteRegion(tess, reg); } static GLUhalfEdge FinishLeftRegions(GLUtessellatorImpl tess, ActiveRegion regFirst, ActiveRegion regLast) /* * We are given a vertex with one or more left-going edges. All affected * edges should be in the edge dictionary. Starting at regFirst.eUp, * we walk down deleting all regions where both edges have the same * origin vOrg. At the same time we copy the "inside" flag from the * active region to the face, since at this point each face will belong * to at most one region (this was not necessarily true until this point * in the sweep). The walk stops at the region above regLast; if regLast * is null we walk as far as possible. At the same time we relink the * mesh if necessary, so that the ordering of edges around vOrg is the * same as in the dictionary. */ { ActiveRegion reg, regPrev; GLUhalfEdge e, ePrev; regPrev = regFirst; ePrev = regFirst.eUp; while (regPrev != regLast) { regPrev.fixUpperEdge = false; /* placement was OK */ reg = RegionBelow(regPrev); e = reg.eUp; if (e.Org != ePrev.Org) { if (!reg.fixUpperEdge) { /* Remove the last left-going edge. Even though there are no further * edges in the dictionary with this origin, there may be further * such edges in the mesh (if we are adding left edges to a vertex * that has already been processed). Thus it is important to call * FinishRegion rather than just DeleteRegion. */ FinishRegion(tess, regPrev); break; } /* If the edge below was a temporary edge introduced by * ConnectRightVertex, now is the time to fix it. */ e = Mesh.__gl_meshConnect(ePrev.Onext.Sym, e.Sym); if (e == null) throw new RuntimeException(); if (!FixUpperEdge(reg, e)) throw new RuntimeException(); } /* Relink edges so that ePrev.Onext == e */ if (ePrev.Onext != e) { if (!Mesh.__gl_meshSplice(e.Sym.Lnext, e)) throw new RuntimeException(); if (!Mesh.__gl_meshSplice(ePrev, e)) throw new RuntimeException(); } FinishRegion(tess, regPrev); /* may change reg.eUp */ ePrev = reg.eUp; regPrev = reg; } return ePrev; } static void AddRightEdges(GLUtessellatorImpl tess, ActiveRegion regUp, GLUhalfEdge eFirst, GLUhalfEdge eLast, GLUhalfEdge eTopLeft, boolean cleanUp) /* * Purpose: insert right-going edges into the edge dictionary, and update * winding numbers and mesh connectivity appropriately. All right-going * edges share a common origin vOrg. Edges are inserted CCW starting at * eFirst; the last edge inserted is eLast.Sym.Lnext. If vOrg has any * left-going edges already processed, then eTopLeft must be the edge * such that an imaginary upward vertical segment from vOrg would be * contained between eTopLeft.Sym.Lnext and eTopLeft; otherwise eTopLeft * should be null. */ { ActiveRegion reg, regPrev; GLUhalfEdge e, ePrev; boolean firstTime = true; /* Insert the new right-going edges in the dictionary */ e = eFirst; do { assert (Geom.VertLeq(e.Org, e.Sym.Org)); AddRegionBelow(tess, regUp, e.Sym); e = e.Onext; } while (e != eLast); /* Walk *all* right-going edges from e.Org, in the dictionary order, * updating the winding numbers of each region, and re-linking the mesh * edges to match the dictionary ordering (if necessary). */ if (eTopLeft == null) { eTopLeft = RegionBelow(regUp).eUp.Sym.Onext; } regPrev = regUp; ePrev = eTopLeft; for (; ;) { reg = RegionBelow(regPrev); e = reg.eUp.Sym; if (e.Org != ePrev.Org) break; if (e.Onext != ePrev) { /* Unlink e from its current position, and relink below ePrev */ if (!Mesh.__gl_meshSplice(e.Sym.Lnext, e)) throw new RuntimeException(); if (!Mesh.__gl_meshSplice(ePrev.Sym.Lnext, e)) throw new RuntimeException(); } /* Compute the winding number and "inside" flag for the new regions */ reg.windingNumber = regPrev.windingNumber - e.winding; reg.inside = IsWindingInside(tess, reg.windingNumber); /* Check for two outgoing edges with same slope -- process these * before any intersection tests (see example in __gl_computeInterior). */ regPrev.dirty = true; if (!firstTime && CheckForRightSplice(tess, regPrev)) { AddWinding(e, ePrev); DeleteRegion(tess, regPrev); if (!Mesh.__gl_meshDelete(ePrev)) throw new RuntimeException(); } firstTime = false; regPrev = reg; ePrev = e; } regPrev.dirty = true; assert (regPrev.windingNumber - e.winding == reg.windingNumber); if (cleanUp) { /* Check for intersections between newly adjacent edges. */ WalkDirtyRegions(tess, regPrev); } } static void CallCombine(GLUtessellatorImpl tess, GLUvertex isect, Object[] data, float[] weights, boolean needed) { double[] coords = new double[3]; /* Copy coord data in case the callback changes it. */ coords[0] = isect.coords[0]; coords[1] = isect.coords[1]; coords[2] = isect.coords[2]; Object[] outData = new Object[1]; tess.callCombineOrCombineData(coords, data, weights, outData); isect.data = outData[0]; if (isect.data == null) { if (!needed) { isect.data = data[0]; } else if (!tess.fatalError) { /* The only way fatal error is when two edges are found to intersect, * but the user has not provided the callback necessary to handle * generated intersection points. */ tess.callErrorOrErrorData(GLU_TESS_NEED_COMBINE_CALLBACK); tess.fatalError = true; } } } static void SpliceMergeVertices(GLUtessellatorImpl tess, GLUhalfEdge e1, GLUhalfEdge e2) /* * Two vertices with idential coordinates are combined into one. * e1.Org is kept, while e2.Org is discarded. */ { Object[] data = new Object[4]; float[] weights = new float[]{0.5f, 0.5f, 0.0f, 0.0f}; data[0] = e1.Org.data; data[1] = e2.Org.data; CallCombine(tess, e1.Org, data, weights, false); if (!Mesh.__gl_meshSplice(e1, e2)) throw new RuntimeException(); } static void VertexWeights(GLUvertex isect, GLUvertex org, GLUvertex dst, float[] weights) /* * Find some weights which describe how the intersection vertex is * a linear combination of "org" and "dest". Each of the two edges * which generated "isect" is allocated 50% of the weight; each edge * splits the weight between its org and dst according to the * relative distance to "isect". */ { double t1 = Geom.VertL1dist(org, isect); double t2 = Geom.VertL1dist(dst, isect); weights[0] = (float) (0.5 * t2 / (t1 + t2)); weights[1] = (float) (0.5 * t1 / (t1 + t2)); isect.coords[0] += weights[0] * org.coords[0] + weights[1] * dst.coords[0]; isect.coords[1] += weights[0] * org.coords[1] + weights[1] * dst.coords[1]; isect.coords[2] += weights[0] * org.coords[2] + weights[1] * dst.coords[2]; } static void GetIntersectData(GLUtessellatorImpl tess, GLUvertex isect, GLUvertex orgUp, GLUvertex dstUp, GLUvertex orgLo, GLUvertex dstLo) /* * We've computed a new intersection point, now we need a "data" pointer * from the user so that we can refer to this new vertex in the * rendering callbacks. */ { Object[] data = new Object[4]; float[] weights = new float[4]; float[] weights1 = new float[2]; float[] weights2 = new float[2]; data[0] = orgUp.data; data[1] = dstUp.data; data[2] = orgLo.data; data[3] = dstLo.data; isect.coords[0] = isect.coords[1] = isect.coords[2] = 0; VertexWeights(isect, orgUp, dstUp, weights1); VertexWeights(isect, orgLo, dstLo, weights2); System.arraycopy(weights1, 0, weights, 0, 2); System.arraycopy(weights2, 0, weights, 2, 2); CallCombine(tess, isect, data, weights, true); } static boolean CheckForRightSplice(GLUtessellatorImpl tess, ActiveRegion regUp) /* * Check the upper and lower edge of "regUp", to make sure that the * eUp.Org is above eLo, or eLo.Org is below eUp (depending on which * origin is leftmost). * * The main purpose is to splice right-going edges with the same * dest vertex and nearly identical slopes (ie. we can't distinguish * the slopes numerically). However the splicing can also help us * to recover from numerical errors. For example, suppose at one * point we checked eUp and eLo, and decided that eUp.Org is barely * above eLo. Then later, we split eLo into two edges (eg. from * a splice operation like this one). This can change the result of * our test so that now eUp.Org is incident to eLo, or barely below it. * We must correct this condition to maintain the dictionary invariants. * * One possibility is to check these edges for intersection again * (ie. CheckForIntersect). This is what we do if possible. However * CheckForIntersect requires that tess.event lies between eUp and eLo, * so that it has something to fall back on when the intersection * calculation gives us an unusable answer. So, for those cases where * we can't check for intersection, this routine fixes the problem * by just splicing the offending vertex into the other edge. * This is a guaranteed solution, no matter how degenerate things get. * Basically this is a combinatorial solution to a numerical problem. */ { ActiveRegion regLo = RegionBelow(regUp); GLUhalfEdge eUp = regUp.eUp; GLUhalfEdge eLo = regLo.eUp; if (Geom.VertLeq(eUp.Org, eLo.Org)) { if (Geom.EdgeSign(eLo.Sym.Org, eUp.Org, eLo.Org) > 0) return false; /* eUp.Org appears to be below eLo */ if (!Geom.VertEq(eUp.Org, eLo.Org)) { /* Splice eUp.Org into eLo */ if (Mesh.__gl_meshSplitEdge(eLo.Sym) == null) throw new RuntimeException(); if (!Mesh.__gl_meshSplice(eUp, eLo.Sym.Lnext)) throw new RuntimeException(); regUp.dirty = regLo.dirty = true; } else if (eUp.Org != eLo.Org) { /* merge the two vertices, discarding eUp.Org */ tess.pq.pqDelete(eUp.Org.pqHandle); /* __gl_pqSortDelete */ SpliceMergeVertices(tess, eLo.Sym.Lnext, eUp); } } else { if (Geom.EdgeSign(eUp.Sym.Org, eLo.Org, eUp.Org) < 0) return false; /* eLo.Org appears to be above eUp, so splice eLo.Org into eUp */ RegionAbove(regUp).dirty = regUp.dirty = true; if (Mesh.__gl_meshSplitEdge(eUp.Sym) == null) throw new RuntimeException(); if (!Mesh.__gl_meshSplice(eLo.Sym.Lnext, eUp)) throw new RuntimeException(); } return true; } static boolean CheckForLeftSplice(GLUtessellatorImpl tess, ActiveRegion regUp) /* * Check the upper and lower edge of "regUp", to make sure that the * eUp.Sym.Org is above eLo, or eLo.Sym.Org is below eUp (depending on which * destination is rightmost). * * Theoretically, this should always be true. However, splitting an edge * into two pieces can change the results of previous tests. For example, * suppose at one point we checked eUp and eLo, and decided that eUp.Sym.Org * is barely above eLo. Then later, we split eLo into two edges (eg. from * a splice operation like this one). This can change the result of * the test so that now eUp.Sym.Org is incident to eLo, or barely below it. * We must correct this condition to maintain the dictionary invariants * (otherwise new edges might get inserted in the wrong place in the * dictionary, and bad stuff will happen). * * We fix the problem by just splicing the offending vertex into the * other edge. */ { ActiveRegion regLo = RegionBelow(regUp); GLUhalfEdge eUp = regUp.eUp; GLUhalfEdge eLo = regLo.eUp; GLUhalfEdge e; assert (!Geom.VertEq(eUp.Sym.Org, eLo.Sym.Org)); if (Geom.VertLeq(eUp.Sym.Org, eLo.Sym.Org)) { if (Geom.EdgeSign(eUp.Sym.Org, eLo.Sym.Org, eUp.Org) < 0) return false; /* eLo.Sym.Org is above eUp, so splice eLo.Sym.Org into eUp */ RegionAbove(regUp).dirty = regUp.dirty = true; e = Mesh.__gl_meshSplitEdge(eUp); if (e == null) throw new RuntimeException(); if (!Mesh.__gl_meshSplice(eLo.Sym, e)) throw new RuntimeException(); e.Lface.inside = regUp.inside; } else { if (Geom.EdgeSign(eLo.Sym.Org, eUp.Sym.Org, eLo.Org) > 0) return false; /* eUp.Sym.Org is below eLo, so splice eUp.Sym.Org into eLo */ regUp.dirty = regLo.dirty = true; e = Mesh.__gl_meshSplitEdge(eLo); if (e == null) throw new RuntimeException(); if (!Mesh.__gl_meshSplice(eUp.Lnext, eLo.Sym)) throw new RuntimeException(); e.Sym.Lface.inside = regUp.inside; } return true; } static boolean CheckForIntersect(GLUtessellatorImpl tess, ActiveRegion regUp) /* * Check the upper and lower edges of the given region to see if * they intersect. If so, create the intersection and add it * to the data structures. * * Returns true if adding the new intersection resulted in a recursive * call to AddRightEdges(); in this case all "dirty" regions have been * checked for intersections, and possibly regUp has been deleted. */ { ActiveRegion regLo = RegionBelow(regUp); GLUhalfEdge eUp = regUp.eUp; GLUhalfEdge eLo = regLo.eUp; GLUvertex orgUp = eUp.Org; GLUvertex orgLo = eLo.Org; GLUvertex dstUp = eUp.Sym.Org; GLUvertex dstLo = eLo.Sym.Org; double tMinUp, tMaxLo; GLUvertex isect = new GLUvertex(); GLUvertex orgMin; GLUhalfEdge e; assert (!Geom.VertEq(dstLo, dstUp)); assert (Geom.EdgeSign(dstUp, tess.event, orgUp) <= 0); assert (Geom.EdgeSign(dstLo, tess.event, orgLo) >= 0); assert (orgUp != tess.event && orgLo != tess.event); assert (!regUp.fixUpperEdge && !regLo.fixUpperEdge); if (orgUp == orgLo) return false; /* right endpoints are the same */ tMinUp = Math.min(orgUp.t, dstUp.t); tMaxLo = Math.max(orgLo.t, dstLo.t); if (tMinUp > tMaxLo) return false; /* t ranges do not overlap */ if (Geom.VertLeq(orgUp, orgLo)) { if (Geom.EdgeSign(dstLo, orgUp, orgLo) > 0) return false; } else { if (Geom.EdgeSign(dstUp, orgLo, orgUp) < 0) return false; } /* At this point the edges intersect, at least marginally */ DebugEvent(tess); Geom.EdgeIntersect(dstUp, orgUp, dstLo, orgLo, isect); /* The following properties are guaranteed: */ assert (Math.min(orgUp.t, dstUp.t) <= isect.t); assert (isect.t <= Math.max(orgLo.t, dstLo.t)); assert (Math.min(dstLo.s, dstUp.s) <= isect.s); assert (isect.s <= Math.max(orgLo.s, orgUp.s)); if (Geom.VertLeq(isect, tess.event)) { /* The intersection point lies slightly to the left of the sweep line, * so move it until it''s slightly to the right of the sweep line. * (If we had perfect numerical precision, this would never happen * in the first place). The easiest and safest thing to do is * replace the intersection by tess.event. */ isect.s = tess.event.s; isect.t = tess.event.t; } /* Similarly, if the computed intersection lies to the right of the * rightmost origin (which should rarely happen), it can cause * unbelievable inefficiency on sufficiently degenerate inputs. * (If you have the test program, try running test54.d with the * "X zoom" option turned on). */ orgMin = Geom.VertLeq(orgUp, orgLo) ? orgUp : orgLo; if (Geom.VertLeq(orgMin, isect)) { isect.s = orgMin.s; isect.t = orgMin.t; } if (Geom.VertEq(isect, orgUp) || Geom.VertEq(isect, orgLo)) { /* Easy case -- intersection at one of the right endpoints */ CheckForRightSplice(tess, regUp); return false; } if ((!Geom.VertEq(dstUp, tess.event) && Geom.EdgeSign(dstUp, tess.event, isect) >= 0) || (!Geom.VertEq(dstLo, tess.event) && Geom.EdgeSign(dstLo, tess.event, isect) <= 0)) { /* Very unusual -- the new upper or lower edge would pass on the * wrong side of the sweep event, or through it. This can happen * due to very small numerical errors in the intersection calculation. */ if (dstLo == tess.event) { /* Splice dstLo into eUp, and process the new region(s) */ if (Mesh.__gl_meshSplitEdge(eUp.Sym) == null) throw new RuntimeException(); if (!Mesh.__gl_meshSplice(eLo.Sym, eUp)) throw new RuntimeException(); regUp = TopLeftRegion(regUp); if (regUp == null) throw new RuntimeException(); eUp = RegionBelow(regUp).eUp; FinishLeftRegions(tess, RegionBelow(regUp), regLo); AddRightEdges(tess, regUp, eUp.Sym.Lnext, eUp, eUp, true); return true; } if (dstUp == tess.event) { /* Splice dstUp into eLo, and process the new region(s) */ if (Mesh.__gl_meshSplitEdge(eLo.Sym) == null) throw new RuntimeException(); if (!Mesh.__gl_meshSplice(eUp.Lnext, eLo.Sym.Lnext)) throw new RuntimeException(); regLo = regUp; regUp = TopRightRegion(regUp); e = RegionBelow(regUp).eUp.Sym.Onext; regLo.eUp = eLo.Sym.Lnext; eLo = FinishLeftRegions(tess, regLo, null); AddRightEdges(tess, regUp, eLo.Onext, eUp.Sym.Onext, e, true); return true; } /* Special case: called from ConnectRightVertex. If either * edge passes on the wrong side of tess.event, split it * (and wait for ConnectRightVertex to splice it appropriately). */ if (Geom.EdgeSign(dstUp, tess.event, isect) >= 0) { RegionAbove(regUp).dirty = regUp.dirty = true; if (Mesh.__gl_meshSplitEdge(eUp.Sym) == null) throw new RuntimeException(); eUp.Org.s = tess.event.s; eUp.Org.t = tess.event.t; } if (Geom.EdgeSign(dstLo, tess.event, isect) <= 0) { regUp.dirty = regLo.dirty = true; if (Mesh.__gl_meshSplitEdge(eLo.Sym) == null) throw new RuntimeException(); eLo.Org.s = tess.event.s; eLo.Org.t = tess.event.t; } /* leave the rest for ConnectRightVertex */ return false; } /* General case -- split both edges, splice into new vertex. * When we do the splice operation, the order of the arguments is * arbitrary as far as correctness goes. However, when the operation * creates a new face, the work done is proportional to the size of * the new face. We expect the faces in the processed part of * the mesh (ie. eUp.Lface) to be smaller than the faces in the * unprocessed original contours (which will be eLo.Sym.Lnext.Lface). */ if (Mesh.__gl_meshSplitEdge(eUp.Sym) == null) throw new RuntimeException(); if (Mesh.__gl_meshSplitEdge(eLo.Sym) == null) throw new RuntimeException(); if (!Mesh.__gl_meshSplice(eLo.Sym.Lnext, eUp)) throw new RuntimeException(); eUp.Org.s = isect.s; eUp.Org.t = isect.t; eUp.Org.pqHandle = tess.pq.pqInsert(eUp.Org); /* __gl_pqSortInsert */ if (eUp.Org.pqHandle == Long.MAX_VALUE) { tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */ tess.pq = null; throw new RuntimeException(); } GetIntersectData(tess, eUp.Org, orgUp, dstUp, orgLo, dstLo); RegionAbove(regUp).dirty = regUp.dirty = regLo.dirty = true; return false; } static void WalkDirtyRegions(GLUtessellatorImpl tess, ActiveRegion regUp) /* * When the upper or lower edge of any region changes, the region is * marked "dirty". This routine walks through all the dirty regions * and makes sure that the dictionary invariants are satisfied * (see the comments at the beginning of this file). Of course * new dirty regions can be created as we make changes to restore * the invariants. */ { ActiveRegion regLo = RegionBelow(regUp); GLUhalfEdge eUp, eLo; for (; ;) { /* Find the lowest dirty region (we walk from the bottom up). */ while (regLo.dirty) { regUp = regLo; regLo = RegionBelow(regLo); } if (!regUp.dirty) { regLo = regUp; regUp = RegionAbove(regUp); if (regUp == null || !regUp.dirty) { /* We've walked all the dirty regions */ return; } } regUp.dirty = false; eUp = regUp.eUp; eLo = regLo.eUp; if (eUp.Sym.Org != eLo.Sym.Org) { /* Check that the edge ordering is obeyed at the Dst vertices. */ if (CheckForLeftSplice(tess, regUp)) { /* If the upper or lower edge was marked fixUpperEdge, then * we no longer need it (since these edges are needed only for * vertices which otherwise have no right-going edges). */ if (regLo.fixUpperEdge) { DeleteRegion(tess, regLo); if (!Mesh.__gl_meshDelete(eLo)) throw new RuntimeException(); regLo = RegionBelow(regUp); eLo = regLo.eUp; } else if (regUp.fixUpperEdge) { DeleteRegion(tess, regUp); if (!Mesh.__gl_meshDelete(eUp)) throw new RuntimeException(); regUp = RegionAbove(regLo); eUp = regUp.eUp; } } } if (eUp.Org != eLo.Org) { if (eUp.Sym.Org != eLo.Sym.Org && !regUp.fixUpperEdge && !regLo.fixUpperEdge && (eUp.Sym.Org == tess.event || eLo.Sym.Org == tess.event)) { /* When all else fails in CheckForIntersect(), it uses tess.event * as the intersection location. To make this possible, it requires * that tess.event lie between the upper and lower edges, and also * that neither of these is marked fixUpperEdge (since in the worst * case it might splice one of these edges into tess.event, and * violate the invariant that fixable edges are the only right-going * edge from their associated vertex). */ if (CheckForIntersect(tess, regUp)) { /* WalkDirtyRegions() was called recursively; we're done */ return; } } else { /* Even though we can't use CheckForIntersect(), the Org vertices * may violate the dictionary edge ordering. Check and correct this. */ CheckForRightSplice(tess, regUp); } } if (eUp.Org == eLo.Org && eUp.Sym.Org == eLo.Sym.Org) { /* A degenerate loop consisting of only two edges -- delete it. */ AddWinding(eLo, eUp); DeleteRegion(tess, regUp); if (!Mesh.__gl_meshDelete(eUp)) throw new RuntimeException(); regUp = RegionAbove(regLo); } } } static void ConnectRightVertex(GLUtessellatorImpl tess, ActiveRegion regUp, GLUhalfEdge eBottomLeft) /* * Purpose: connect a "right" vertex vEvent (one where all edges go left) * to the unprocessed portion of the mesh. Since there are no right-going * edges, two regions (one above vEvent and one below) are being merged * into one. "regUp" is the upper of these two regions. * * There are two reasons for doing this (adding a right-going edge): * - if the two regions being merged are "inside", we must add an edge * to keep them separated (the combined region would not be monotone). * - in any case, we must leave some record of vEvent in the dictionary, * so that we can merge vEvent with features that we have not seen yet. * For example, maybe there is a vertical edge which passes just to * the right of vEvent; we would like to splice vEvent into this edge. * * However, we don't want to connect vEvent to just any vertex. We don''t * want the new edge to cross any other edges; otherwise we will create * intersection vertices even when the input data had no self-intersections. * (This is a bad thing; if the user's input data has no intersections, * we don't want to generate any false intersections ourselves.) * * Our eventual goal is to connect vEvent to the leftmost unprocessed * vertex of the combined region (the union of regUp and regLo). * But because of unseen vertices with all right-going edges, and also * new vertices which may be created by edge intersections, we don''t * know where that leftmost unprocessed vertex is. In the meantime, we * connect vEvent to the closest vertex of either chain, and mark the region * as "fixUpperEdge". This flag says to delete and reconnect this edge * to the next processed vertex on the boundary of the combined region. * Quite possibly the vertex we connected to will turn out to be the * closest one, in which case we won''t need to make any changes. */ { GLUhalfEdge eNew; GLUhalfEdge eTopLeft = eBottomLeft.Onext; ActiveRegion regLo = RegionBelow(regUp); GLUhalfEdge eUp = regUp.eUp; GLUhalfEdge eLo = regLo.eUp; boolean degenerate = false; if (eUp.Sym.Org != eLo.Sym.Org) { CheckForIntersect(tess, regUp); } /* Possible new degeneracies: upper or lower edge of regUp may pass * through vEvent, or may coincide with new intersection vertex */ if (Geom.VertEq(eUp.Org, tess.event)) { if (!Mesh.__gl_meshSplice(eTopLeft.Sym.Lnext, eUp)) throw new RuntimeException(); regUp = TopLeftRegion(regUp); if (regUp == null) throw new RuntimeException(); eTopLeft = RegionBelow(regUp).eUp; FinishLeftRegions(tess, RegionBelow(regUp), regLo); degenerate = true; } if (Geom.VertEq(eLo.Org, tess.event)) { if (!Mesh.__gl_meshSplice(eBottomLeft, eLo.Sym.Lnext)) throw new RuntimeException(); eBottomLeft = FinishLeftRegions(tess, regLo, null); degenerate = true; } if (degenerate) { AddRightEdges(tess, regUp, eBottomLeft.Onext, eTopLeft, eTopLeft, true); return; } /* Non-degenerate situation -- need to add a temporary, fixable edge. * Connect to the closer of eLo.Org, eUp.Org. */ if (Geom.VertLeq(eLo.Org, eUp.Org)) { eNew = eLo.Sym.Lnext; } else { eNew = eUp; } eNew = Mesh.__gl_meshConnect(eBottomLeft.Onext.Sym, eNew); if (eNew == null) throw new RuntimeException(); /* Prevent cleanup, otherwise eNew might disappear before we've even * had a chance to mark it as a temporary edge. */ AddRightEdges(tess, regUp, eNew, eNew.Onext, eNew.Onext, false); eNew.Sym.activeRegion.fixUpperEdge = true; WalkDirtyRegions(tess, regUp); } /* Because vertices at exactly the same location are merged together * before we process the sweep event, some degenerate cases can't occur. * However if someone eventually makes the modifications required to * merge features which are close together, the cases below marked * TOLERANCE_NONZERO will be useful. They were debugged before the * code to merge identical vertices in the main loop was added. */ private static final boolean TOLERANCE_NONZERO = false; static void ConnectLeftDegenerate(GLUtessellatorImpl tess, ActiveRegion regUp, GLUvertex vEvent) /* * The event vertex lies exacty on an already-processed edge or vertex. * Adding the new vertex involves splicing it into the already-processed * part of the mesh. */ { GLUhalfEdge e, eTopLeft, eTopRight, eLast; ActiveRegion reg; e = regUp.eUp; if (Geom.VertEq(e.Org, vEvent)) { /* e.Org is an unprocessed vertex - just combine them, and wait * for e.Org to be pulled from the queue */ assert (TOLERANCE_NONZERO); SpliceMergeVertices(tess, e, vEvent.anEdge); return; } if (!Geom.VertEq(e.Sym.Org, vEvent)) { /* General case -- splice vEvent into edge e which passes through it */ if (Mesh.__gl_meshSplitEdge(e.Sym) == null) throw new RuntimeException(); if (regUp.fixUpperEdge) { /* This edge was fixable -- delete unused portion of original edge */ if (!Mesh.__gl_meshDelete(e.Onext)) throw new RuntimeException(); regUp.fixUpperEdge = false; } if (!Mesh.__gl_meshSplice(vEvent.anEdge, e)) throw new RuntimeException(); SweepEvent(tess, vEvent); /* recurse */ return; } /* vEvent coincides with e.Sym.Org, which has already been processed. * Splice in the additional right-going edges. */ assert (TOLERANCE_NONZERO); regUp = TopRightRegion(regUp); reg = RegionBelow(regUp); eTopRight = reg.eUp.Sym; eTopLeft = eLast = eTopRight.Onext; if (reg.fixUpperEdge) { /* Here e.Sym.Org has only a single fixable edge going right. * We can delete it since now we have some real right-going edges. */ assert (eTopLeft != eTopRight); /* there are some left edges too */ DeleteRegion(tess, reg); if (!Mesh.__gl_meshDelete(eTopRight)) throw new RuntimeException(); eTopRight = eTopLeft.Sym.Lnext; } if (!Mesh.__gl_meshSplice(vEvent.anEdge, eTopRight)) throw new RuntimeException(); if (!Geom.EdgeGoesLeft(eTopLeft)) { /* e.Sym.Org had no left-going edges -- indicate this to AddRightEdges() */ eTopLeft = null; } AddRightEdges(tess, regUp, eTopRight.Onext, eLast, eTopLeft, true); } static void ConnectLeftVertex(GLUtessellatorImpl tess, GLUvertex vEvent) /* * Purpose: connect a "left" vertex (one where both edges go right) * to the processed portion of the mesh. Let R be the active region * containing vEvent, and let U and L be the upper and lower edge * chains of R. There are two possibilities: * * - the normal case: split R into two regions, by connecting vEvent to * the rightmost vertex of U or L lying to the left of the sweep line * * - the degenerate case: if vEvent is close enough to U or L, we * merge vEvent into that edge chain. The subcases are: * - merging with the rightmost vertex of U or L * - merging with the active edge of U or L * - merging with an already-processed portion of U or L */ { ActiveRegion regUp, regLo, reg; GLUhalfEdge eUp, eLo, eNew; ActiveRegion tmp = new ActiveRegion(); /* assert ( vEvent.anEdge.Onext.Onext == vEvent.anEdge ); */ /* Get a pointer to the active region containing vEvent */ tmp.eUp = vEvent.anEdge.Sym; /* __GL_DICTLISTKEY */ /* __gl_dictListSearch */ regUp = (ActiveRegion) Dict.dictKey(Dict.dictSearch(tess.dict, tmp)); regLo = RegionBelow(regUp); eUp = regUp.eUp; eLo = regLo.eUp; /* Try merging with U or L first */ if (Geom.EdgeSign(eUp.Sym.Org, vEvent, eUp.Org) == 0) { ConnectLeftDegenerate(tess, regUp, vEvent); return; } /* Connect vEvent to rightmost processed vertex of either chain. * e.Sym.Org is the vertex that we will connect to vEvent. */ reg = Geom.VertLeq(eLo.Sym.Org, eUp.Sym.Org) ? regUp : regLo; if (regUp.inside || reg.fixUpperEdge) { if (reg == regUp) { eNew = Mesh.__gl_meshConnect(vEvent.anEdge.Sym, eUp.Lnext); if (eNew == null) throw new RuntimeException(); } else { GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(eLo.Sym.Onext.Sym, vEvent.anEdge); if (tempHalfEdge == null) throw new RuntimeException(); eNew = tempHalfEdge.Sym; } if (reg.fixUpperEdge) { if (!FixUpperEdge(reg, eNew)) throw new RuntimeException(); } else { ComputeWinding(tess, AddRegionBelow(tess, regUp, eNew)); } SweepEvent(tess, vEvent); } else { /* The new vertex is in a region which does not belong to the polygon. * We don''t need to connect this vertex to the rest of the mesh. */ AddRightEdges(tess, regUp, vEvent.anEdge, vEvent.anEdge, null, true); } } static void SweepEvent(GLUtessellatorImpl tess, GLUvertex vEvent) /* * Does everything necessary when the sweep line crosses a vertex. * Updates the mesh and the edge dictionary. */ { ActiveRegion regUp, reg; GLUhalfEdge e, eTopLeft, eBottomLeft; tess.event = vEvent; /* for access in EdgeLeq() */ DebugEvent(tess); /* Check if this vertex is the right endpoint of an edge that is * already in the dictionary. In this case we don't need to waste * time searching for the location to insert new edges. */ e = vEvent.anEdge; while (e.activeRegion == null) { e = e.Onext; if (e == vEvent.anEdge) { /* All edges go right -- not incident to any processed edges */ ConnectLeftVertex(tess, vEvent); return; } } /* Processing consists of two phases: first we "finish" all the * active regions where both the upper and lower edges terminate * at vEvent (ie. vEvent is closing off these regions). * We mark these faces "inside" or "outside" the polygon according * to their winding number, and delete the edges from the dictionary. * This takes care of all the left-going edges from vEvent. */ regUp = TopLeftRegion(e.activeRegion); if (regUp == null) throw new RuntimeException(); reg = RegionBelow(regUp); eTopLeft = reg.eUp; eBottomLeft = FinishLeftRegions(tess, reg, null); /* Next we process all the right-going edges from vEvent. This * involves adding the edges to the dictionary, and creating the * associated "active regions" which record information about the * regions between adjacent dictionary edges. */ if (eBottomLeft.Onext == eTopLeft) { /* No right-going edges -- add a temporary "fixable" edge */ ConnectRightVertex(tess, regUp, eBottomLeft); } else { AddRightEdges(tess, regUp, eBottomLeft.Onext, eTopLeft, eTopLeft, true); } } /* Make the sentinel coordinates big enough that they will never be * merged with real input features. (Even with the largest possible * input contour and the maximum tolerance of 1.0, no merging will be * done with coordinates larger than 3 * GLU_TESS_MAX_COORD). */ private static final double SENTINEL_COORD = (4.0 * GLU_TESS_MAX_COORD); static void AddSentinel(GLUtessellatorImpl tess, double t) /* * We add two sentinel edges above and below all other edges, * to avoid special cases at the top and bottom. */ { GLUhalfEdge e; ActiveRegion reg = new ActiveRegion(); if (reg == null) throw new RuntimeException(); e = Mesh.__gl_meshMakeEdge(tess.mesh); if (e == null) throw new RuntimeException(); e.Org.s = SENTINEL_COORD; e.Org.t = t; e.Sym.Org.s = -SENTINEL_COORD; e.Sym.Org.t = t; tess.event = e.Sym.Org; /* initialize it */ reg.eUp = e; reg.windingNumber = 0; reg.inside = false; reg.fixUpperEdge = false; reg.sentinel = true; reg.dirty = false; reg.nodeUp = Dict.dictInsert(tess.dict, reg); /* __gl_dictListInsertBefore */ if (reg.nodeUp == null) throw new RuntimeException(); } static void InitEdgeDict(final GLUtessellatorImpl tess) /* * We maintain an ordering of edge intersections with the sweep line. * This order is maintained in a dynamic dictionary. */ { /* __gl_dictListNewDict */ tess.dict = Dict.dictNewDict(tess, new Dict.DictLeq() { public boolean leq(Object frame, Object key1, Object key2) { return EdgeLeq(tess, (ActiveRegion) key1, (ActiveRegion) key2); } }); if (tess.dict == null) throw new RuntimeException(); AddSentinel(tess, -SENTINEL_COORD); AddSentinel(tess, SENTINEL_COORD); } static void DoneEdgeDict(GLUtessellatorImpl tess) { ActiveRegion reg; int fixedEdges = 0; /* __GL_DICTLISTKEY */ /* __GL_DICTLISTMIN */ while ((reg = (ActiveRegion) Dict.dictKey(Dict.dictMin(tess.dict))) != null) { /* * At the end of all processing, the dictionary should contain * only the two sentinel edges, plus at most one "fixable" edge * created by ConnectRightVertex(). */ if (!reg.sentinel) { assert (reg.fixUpperEdge); assert (++fixedEdges == 1); } assert (reg.windingNumber == 0); DeleteRegion(tess, reg); /* __gl_meshDelete( reg.eUp );*/ } Dict.dictDeleteDict(tess.dict); /* __gl_dictListDeleteDict */ } static void RemoveDegenerateEdges(GLUtessellatorImpl tess) /* * Remove zero-length edges, and contours with fewer than 3 vertices. */ { GLUhalfEdge e, eNext, eLnext; GLUhalfEdge eHead = tess.mesh.eHead; /*LINTED*/ for (e = eHead.next; e != eHead; e = eNext) { eNext = e.next; eLnext = e.Lnext; if (Geom.VertEq(e.Org, e.Sym.Org) && e.Lnext.Lnext != e) { /* Zero-length edge, contour has at least 3 edges */ SpliceMergeVertices(tess, eLnext, e); /* deletes e.Org */ if (!Mesh.__gl_meshDelete(e)) throw new RuntimeException(); /* e is a self-loop */ e = eLnext; eLnext = e.Lnext; } if (eLnext.Lnext == e) { /* Degenerate contour (one or two edges) */ if (eLnext != e) { if (eLnext == eNext || eLnext == eNext.Sym) { eNext = eNext.next; } if (!Mesh.__gl_meshDelete(eLnext)) throw new RuntimeException(); } if (e == eNext || e == eNext.Sym) { eNext = eNext.next; } if (!Mesh.__gl_meshDelete(e)) throw new RuntimeException(); } } } static boolean InitPriorityQ(GLUtessellatorImpl tess) /* * Insert all vertices into the priority queue which determines the * order in which vertices cross the sweep line. */ { PriorityQ pq; GLUvertex v, vHead; /* __gl_pqSortNewPriorityQ */ pq = tess.pq = PriorityQ.pqNewPriorityQ(new PriorityQ.Leq() { public boolean leq(Object key1, Object key2) { return Geom.VertLeq(((GLUvertex) key1), (GLUvertex) key2); } }); if (pq == null) return false; vHead = tess.mesh.vHead; for (v = vHead.next; v != vHead; v = v.next) { v.pqHandle = pq.pqInsert(v); /* __gl_pqSortInsert */ if (v.pqHandle == Long.MAX_VALUE) break; } if (v != vHead || !pq.pqInit()) { /* __gl_pqSortInit */ tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */ tess.pq = null; return false; } return true; } static void DonePriorityQ(GLUtessellatorImpl tess) { tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */ } static boolean RemoveDegenerateFaces(GLUmesh mesh) /* * Delete any degenerate faces with only two edges. WalkDirtyRegions() * will catch almost all of these, but it won't catch degenerate faces * produced by splice operations on already-processed edges. * The two places this can happen are in FinishLeftRegions(), when * we splice in a "temporary" edge produced by ConnectRightVertex(), * and in CheckForLeftSplice(), where we splice already-processed * edges to ensure that our dictionary invariants are not violated * by numerical errors. * * In both these cases it is *very* dangerous to delete the offending * edge at the time, since one of the routines further up the stack * will sometimes be keeping a pointer to that edge. */ { GLUface f, fNext; GLUhalfEdge e; /*LINTED*/ for (f = mesh.fHead.next; f != mesh.fHead; f = fNext) { fNext = f.next; e = f.anEdge; assert (e.Lnext != e); if (e.Lnext.Lnext == e) { /* A face with only two edges */ AddWinding(e.Onext, e); if (!Mesh.__gl_meshDelete(e)) return false; } } return true; } public static boolean __gl_computeInterior(GLUtessellatorImpl tess) /* * __gl_computeInterior( tess ) computes the planar arrangement specified * by the given contours, and further subdivides this arrangement * into regions. Each region is marked "inside" if it belongs * to the polygon, according to the rule given by tess.windingRule. * Each interior region is guaranteed be monotone. */ { GLUvertex v, vNext; tess.fatalError = false; /* Each vertex defines an event for our sweep line. Start by inserting * all the vertices in a priority queue. Events are processed in * lexicographic order, ie. * * e1 < e2 iff e1.x < e2.x || (e1.x == e2.x && e1.y < e2.y) */ RemoveDegenerateEdges(tess); if (!InitPriorityQ(tess)) return false; /* if error */ InitEdgeDict(tess); /* __gl_pqSortExtractMin */ while ((v = (GLUvertex) tess.pq.pqExtractMin()) != null) { for (; ;) { vNext = (GLUvertex) tess.pq.pqMinimum(); /* __gl_pqSortMinimum */ if (vNext == null || !Geom.VertEq(vNext, v)) break; /* Merge together all vertices at exactly the same location. * This is more efficient than processing them one at a time, * simplifies the code (see ConnectLeftDegenerate), and is also * important for correct handling of certain degenerate cases. * For example, suppose there are two identical edges A and B * that belong to different contours (so without this code they would * be processed by separate sweep events). Suppose another edge C * crosses A and B from above. When A is processed, we split it * at its intersection point with C. However this also splits C, * so when we insert B we may compute a slightly different * intersection point. This might leave two edges with a small * gap between them. This kind of error is especially obvious * when using boundary extraction (GLU_TESS_BOUNDARY_ONLY). */ vNext = (GLUvertex) tess.pq.pqExtractMin(); /* __gl_pqSortExtractMin*/ SpliceMergeVertices(tess, v.anEdge, vNext.anEdge); } SweepEvent(tess, v); } /* Set tess.event for debugging purposes */ /* __GL_DICTLISTKEY */ /* __GL_DICTLISTMIN */ tess.event = ((ActiveRegion) Dict.dictKey(Dict.dictMin(tess.dict))).eUp.Org; DebugEvent(tess); DoneEdgeDict(tess); DonePriorityQ(tess); if (!RemoveDegenerateFaces(tess.mesh)) return false; Mesh.__gl_meshCheckMesh(tess.mesh); return true; } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/CachedVertex.java0000644000175000017500000001041511543426510025022 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; class CachedVertex { public double[] coords = new double[3]; public Object data; } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/DictNode.java0000644000175000017500000001037311543426510024151 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; class DictNode { Object key; DictNode next; DictNode prev; } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/Mesh.java0000644000175000017500000006323011543426510023354 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; class Mesh { private Mesh() { } /************************ Utility Routines ************************/ /* MakeEdge creates a new pair of half-edges which form their own loop. * No vertex or face structures are allocated, but these must be assigned * before the current edge operation is completed. */ static GLUhalfEdge MakeEdge(GLUhalfEdge eNext) { GLUhalfEdge e; GLUhalfEdge eSym; GLUhalfEdge ePrev; // EdgePair * pair = (EdgePair *) // memAlloc(sizeof(EdgePair)); // if (pair == NULL) return NULL; // // e = &pair - > e; e = new GLUhalfEdge(true); // eSym = &pair - > eSym; eSym = new GLUhalfEdge(false); /* Make sure eNext points to the first edge of the edge pair */ if (!eNext.first) { eNext = eNext.Sym; } /* Insert in circular doubly-linked list before eNext. * Note that the prev pointer is stored in Sym->next. */ ePrev = eNext.Sym.next; eSym.next = ePrev; ePrev.Sym.next = e; e.next = eNext; eNext.Sym.next = eSym; e.Sym = eSym; e.Onext = e; e.Lnext = eSym; e.Org = null; e.Lface = null; e.winding = 0; e.activeRegion = null; eSym.Sym = e; eSym.Onext = eSym; eSym.Lnext = e; eSym.Org = null; eSym.Lface = null; eSym.winding = 0; eSym.activeRegion = null; return e; } /* Splice( a, b ) is best described by the Guibas/Stolfi paper or the * CS348a notes (see mesh.h). Basically it modifies the mesh so that * a->Onext and b->Onext are exchanged. This can have various effects * depending on whether a and b belong to different face or vertex rings. * For more explanation see __gl_meshSplice() below. */ static void Splice(GLUhalfEdge a, GLUhalfEdge b) { GLUhalfEdge aOnext = a.Onext; GLUhalfEdge bOnext = b.Onext; aOnext.Sym.Lnext = b; bOnext.Sym.Lnext = a; a.Onext = bOnext; b.Onext = aOnext; } /* MakeVertex( newVertex, eOrig, vNext ) attaches a new vertex and makes it the * origin of all edges in the vertex loop to which eOrig belongs. "vNext" gives * a place to insert the new vertex in the global vertex list. We insert * the new vertex *before* vNext so that algorithms which walk the vertex * list will not see the newly created vertices. */ static void MakeVertex(GLUvertex newVertex, GLUhalfEdge eOrig, GLUvertex vNext) { GLUhalfEdge e; GLUvertex vPrev; GLUvertex vNew = newVertex; assert (vNew != null); /* insert in circular doubly-linked list before vNext */ vPrev = vNext.prev; vNew.prev = vPrev; vPrev.next = vNew; vNew.next = vNext; vNext.prev = vNew; vNew.anEdge = eOrig; vNew.data = null; /* leave coords, s, t undefined */ /* fix other edges on this vertex loop */ e = eOrig; do { e.Org = vNew; e = e.Onext; } while (e != eOrig); } /* MakeFace( newFace, eOrig, fNext ) attaches a new face and makes it the left * face of all edges in the face loop to which eOrig belongs. "fNext" gives * a place to insert the new face in the global face list. We insert * the new face *before* fNext so that algorithms which walk the face * list will not see the newly created faces. */ static void MakeFace(GLUface newFace, GLUhalfEdge eOrig, GLUface fNext) { GLUhalfEdge e; GLUface fPrev; GLUface fNew = newFace; assert (fNew != null); /* insert in circular doubly-linked list before fNext */ fPrev = fNext.prev; fNew.prev = fPrev; fPrev.next = fNew; fNew.next = fNext; fNext.prev = fNew; fNew.anEdge = eOrig; fNew.data = null; fNew.trail = null; fNew.marked = false; /* The new face is marked "inside" if the old one was. This is a * convenience for the common case where a face has been split in two. */ fNew.inside = fNext.inside; /* fix other edges on this face loop */ e = eOrig; do { e.Lface = fNew; e = e.Lnext; } while (e != eOrig); } /* KillEdge( eDel ) destroys an edge (the half-edges eDel and eDel->Sym), * and removes from the global edge list. */ static void KillEdge(GLUhalfEdge eDel) { GLUhalfEdge ePrev, eNext; /* Half-edges are allocated in pairs, see EdgePair above */ if (!eDel.first) { eDel = eDel.Sym; } /* delete from circular doubly-linked list */ eNext = eDel.next; ePrev = eDel.Sym.next; eNext.Sym.next = ePrev; ePrev.Sym.next = eNext; } /* KillVertex( vDel ) destroys a vertex and removes it from the global * vertex list. It updates the vertex loop to point to a given new vertex. */ static void KillVertex(GLUvertex vDel, GLUvertex newOrg) { GLUhalfEdge e, eStart = vDel.anEdge; GLUvertex vPrev, vNext; /* change the origin of all affected edges */ e = eStart; do { e.Org = newOrg; e = e.Onext; } while (e != eStart); /* delete from circular doubly-linked list */ vPrev = vDel.prev; vNext = vDel.next; vNext.prev = vPrev; vPrev.next = vNext; } /* KillFace( fDel ) destroys a face and removes it from the global face * list. It updates the face loop to point to a given new face. */ static void KillFace(GLUface fDel, GLUface newLface) { GLUhalfEdge e, eStart = fDel.anEdge; GLUface fPrev, fNext; /* change the left face of all affected edges */ e = eStart; do { e.Lface = newLface; e = e.Lnext; } while (e != eStart); /* delete from circular doubly-linked list */ fPrev = fDel.prev; fNext = fDel.next; fNext.prev = fPrev; fPrev.next = fNext; } /****************** Basic Edge Operations **********************/ /* __gl_meshMakeEdge creates one edge, two vertices, and a loop (face). * The loop consists of the two new half-edges. */ public static GLUhalfEdge __gl_meshMakeEdge(GLUmesh mesh) { GLUvertex newVertex1 = new GLUvertex(); GLUvertex newVertex2 = new GLUvertex(); GLUface newFace = new GLUface(); GLUhalfEdge e; e = MakeEdge(mesh.eHead); if (e == null) return null; MakeVertex(newVertex1, e, mesh.vHead); MakeVertex(newVertex2, e.Sym, mesh.vHead); MakeFace(newFace, e, mesh.fHead); return e; } /* __gl_meshSplice( eOrg, eDst ) is the basic operation for changing the * mesh connectivity and topology. It changes the mesh so that * eOrg->Onext <- OLD( eDst->Onext ) * eDst->Onext <- OLD( eOrg->Onext ) * where OLD(...) means the value before the meshSplice operation. * * This can have two effects on the vertex structure: * - if eOrg->Org != eDst->Org, the two vertices are merged together * - if eOrg->Org == eDst->Org, the origin is split into two vertices * In both cases, eDst->Org is changed and eOrg->Org is untouched. * * Similarly (and independently) for the face structure, * - if eOrg->Lface == eDst->Lface, one loop is split into two * - if eOrg->Lface != eDst->Lface, two distinct loops are joined into one * In both cases, eDst->Lface is changed and eOrg->Lface is unaffected. * * Some special cases: * If eDst == eOrg, the operation has no effect. * If eDst == eOrg->Lnext, the new face will have a single edge. * If eDst == eOrg->Lprev, the old face will have a single edge. * If eDst == eOrg->Onext, the new vertex will have a single edge. * If eDst == eOrg->Oprev, the old vertex will have a single edge. */ public static boolean __gl_meshSplice(GLUhalfEdge eOrg, GLUhalfEdge eDst) { boolean joiningLoops = false; boolean joiningVertices = false; if (eOrg == eDst) return true; if (eDst.Org != eOrg.Org) { /* We are merging two disjoint vertices -- destroy eDst->Org */ joiningVertices = true; KillVertex(eDst.Org, eOrg.Org); } if (eDst.Lface != eOrg.Lface) { /* We are connecting two disjoint loops -- destroy eDst.Lface */ joiningLoops = true; KillFace(eDst.Lface, eOrg.Lface); } /* Change the edge structure */ Splice(eDst, eOrg); if (!joiningVertices) { GLUvertex newVertex = new GLUvertex(); /* We split one vertex into two -- the new vertex is eDst.Org. * Make sure the old vertex points to a valid half-edge. */ MakeVertex(newVertex, eDst, eOrg.Org); eOrg.Org.anEdge = eOrg; } if (!joiningLoops) { GLUface newFace = new GLUface(); /* We split one loop into two -- the new loop is eDst.Lface. * Make sure the old face points to a valid half-edge. */ MakeFace(newFace, eDst, eOrg.Lface); eOrg.Lface.anEdge = eOrg; } return true; } /* __gl_meshDelete( eDel ) removes the edge eDel. There are several cases: * if (eDel.Lface != eDel.Rface), we join two loops into one; the loop * eDel.Lface is deleted. Otherwise, we are splitting one loop into two; * the newly created loop will contain eDel.Dst. If the deletion of eDel * would create isolated vertices, those are deleted as well. * * This function could be implemented as two calls to __gl_meshSplice * plus a few calls to memFree, but this would allocate and delete * unnecessary vertices and faces. */ static boolean __gl_meshDelete(GLUhalfEdge eDel) { GLUhalfEdge eDelSym = eDel.Sym; boolean joiningLoops = false; /* First step: disconnect the origin vertex eDel.Org. We make all * changes to get a consistent mesh in this "intermediate" state. */ if (eDel.Lface != eDel.Sym.Lface) { /* We are joining two loops into one -- remove the left face */ joiningLoops = true; KillFace(eDel.Lface, eDel.Sym.Lface); } if (eDel.Onext == eDel) { KillVertex(eDel.Org, null); } else { /* Make sure that eDel.Org and eDel.Sym.Lface point to valid half-edges */ eDel.Sym.Lface.anEdge = eDel.Sym.Lnext; eDel.Org.anEdge = eDel.Onext; Splice(eDel, eDel.Sym.Lnext); if (!joiningLoops) { GLUface newFace = new GLUface(); /* We are splitting one loop into two -- create a new loop for eDel. */ MakeFace(newFace, eDel, eDel.Lface); } } /* Claim: the mesh is now in a consistent state, except that eDel.Org * may have been deleted. Now we disconnect eDel.Dst. */ if (eDelSym.Onext == eDelSym) { KillVertex(eDelSym.Org, null); KillFace(eDelSym.Lface, null); } else { /* Make sure that eDel.Dst and eDel.Lface point to valid half-edges */ eDel.Lface.anEdge = eDelSym.Sym.Lnext; eDelSym.Org.anEdge = eDelSym.Onext; Splice(eDelSym, eDelSym.Sym.Lnext); } /* Any isolated vertices or faces have already been freed. */ KillEdge(eDel); return true; } /******************** Other Edge Operations **********************/ /* All these routines can be implemented with the basic edge * operations above. They are provided for convenience and efficiency. */ /* __gl_meshAddEdgeVertex( eOrg ) creates a new edge eNew such that * eNew == eOrg.Lnext, and eNew.Dst is a newly created vertex. * eOrg and eNew will have the same left face. */ static GLUhalfEdge __gl_meshAddEdgeVertex(GLUhalfEdge eOrg) { GLUhalfEdge eNewSym; GLUhalfEdge eNew = MakeEdge(eOrg); eNewSym = eNew.Sym; /* Connect the new edge appropriately */ Splice(eNew, eOrg.Lnext); /* Set the vertex and face information */ eNew.Org = eOrg.Sym.Org; { GLUvertex newVertex = new GLUvertex(); MakeVertex(newVertex, eNewSym, eNew.Org); } eNew.Lface = eNewSym.Lface = eOrg.Lface; return eNew; } /* __gl_meshSplitEdge( eOrg ) splits eOrg into two edges eOrg and eNew, * such that eNew == eOrg.Lnext. The new vertex is eOrg.Sym.Org == eNew.Org. * eOrg and eNew will have the same left face. */ public static GLUhalfEdge __gl_meshSplitEdge(GLUhalfEdge eOrg) { GLUhalfEdge eNew; GLUhalfEdge tempHalfEdge = __gl_meshAddEdgeVertex(eOrg); eNew = tempHalfEdge.Sym; /* Disconnect eOrg from eOrg.Sym.Org and connect it to eNew.Org */ Splice(eOrg.Sym, eOrg.Sym.Sym.Lnext); Splice(eOrg.Sym, eNew); /* Set the vertex and face information */ eOrg.Sym.Org = eNew.Org; eNew.Sym.Org.anEdge = eNew.Sym; /* may have pointed to eOrg.Sym */ eNew.Sym.Lface = eOrg.Sym.Lface; eNew.winding = eOrg.winding; /* copy old winding information */ eNew.Sym.winding = eOrg.Sym.winding; return eNew; } /* __gl_meshConnect( eOrg, eDst ) creates a new edge from eOrg.Sym.Org * to eDst.Org, and returns the corresponding half-edge eNew. * If eOrg.Lface == eDst.Lface, this splits one loop into two, * and the newly created loop is eNew.Lface. Otherwise, two disjoint * loops are merged into one, and the loop eDst.Lface is destroyed. * * If (eOrg == eDst), the new face will have only two edges. * If (eOrg.Lnext == eDst), the old face is reduced to a single edge. * If (eOrg.Lnext.Lnext == eDst), the old face is reduced to two edges. */ static GLUhalfEdge __gl_meshConnect(GLUhalfEdge eOrg, GLUhalfEdge eDst) { GLUhalfEdge eNewSym; boolean joiningLoops = false; GLUhalfEdge eNew = MakeEdge(eOrg); eNewSym = eNew.Sym; if (eDst.Lface != eOrg.Lface) { /* We are connecting two disjoint loops -- destroy eDst.Lface */ joiningLoops = true; KillFace(eDst.Lface, eOrg.Lface); } /* Connect the new edge appropriately */ Splice(eNew, eOrg.Lnext); Splice(eNewSym, eDst); /* Set the vertex and face information */ eNew.Org = eOrg.Sym.Org; eNewSym.Org = eDst.Org; eNew.Lface = eNewSym.Lface = eOrg.Lface; /* Make sure the old face points to a valid half-edge */ eOrg.Lface.anEdge = eNewSym; if (!joiningLoops) { GLUface newFace = new GLUface(); /* We split one loop into two -- the new loop is eNew.Lface */ MakeFace(newFace, eNew, eOrg.Lface); } return eNew; } /******************** Other Operations **********************/ /* __gl_meshZapFace( fZap ) destroys a face and removes it from the * global face list. All edges of fZap will have a null pointer as their * left face. Any edges which also have a null pointer as their right face * are deleted entirely (along with any isolated vertices this produces). * An entire mesh can be deleted by zapping its faces, one at a time, * in any order. Zapped faces cannot be used in further mesh operations! */ static void __gl_meshZapFace(GLUface fZap) { GLUhalfEdge eStart = fZap.anEdge; GLUhalfEdge e, eNext, eSym; GLUface fPrev, fNext; /* walk around face, deleting edges whose right face is also null */ eNext = eStart.Lnext; do { e = eNext; eNext = e.Lnext; e.Lface = null; if (e.Sym.Lface == null) { /* delete the edge -- see __gl_MeshDelete above */ if (e.Onext == e) { KillVertex(e.Org, null); } else { /* Make sure that e.Org points to a valid half-edge */ e.Org.anEdge = e.Onext; Splice(e, e.Sym.Lnext); } eSym = e.Sym; if (eSym.Onext == eSym) { KillVertex(eSym.Org, null); } else { /* Make sure that eSym.Org points to a valid half-edge */ eSym.Org.anEdge = eSym.Onext; Splice(eSym, eSym.Sym.Lnext); } KillEdge(e); } } while (e != eStart); /* delete from circular doubly-linked list */ fPrev = fZap.prev; fNext = fZap.next; fNext.prev = fPrev; fPrev.next = fNext; } /* __gl_meshNewMesh() creates a new mesh with no edges, no vertices, * and no loops (what we usually call a "face"). */ public static GLUmesh __gl_meshNewMesh() { GLUvertex v; GLUface f; GLUhalfEdge e; GLUhalfEdge eSym; GLUmesh mesh = new GLUmesh(); v = mesh.vHead; f = mesh.fHead; e = mesh.eHead; eSym = mesh.eHeadSym; v.next = v.prev = v; v.anEdge = null; v.data = null; f.next = f.prev = f; f.anEdge = null; f.data = null; f.trail = null; f.marked = false; f.inside = false; e.next = e; e.Sym = eSym; e.Onext = null; e.Lnext = null; e.Org = null; e.Lface = null; e.winding = 0; e.activeRegion = null; eSym.next = eSym; eSym.Sym = e; eSym.Onext = null; eSym.Lnext = null; eSym.Org = null; eSym.Lface = null; eSym.winding = 0; eSym.activeRegion = null; return mesh; } /* __gl_meshUnion( mesh1, mesh2 ) forms the union of all structures in * both meshes, and returns the new mesh (the old meshes are destroyed). */ static GLUmesh __gl_meshUnion(GLUmesh mesh1, GLUmesh mesh2) { GLUface f1 = mesh1.fHead; GLUvertex v1 = mesh1.vHead; GLUhalfEdge e1 = mesh1.eHead; GLUface f2 = mesh2.fHead; GLUvertex v2 = mesh2.vHead; GLUhalfEdge e2 = mesh2.eHead; /* Add the faces, vertices, and edges of mesh2 to those of mesh1 */ if (f2.next != f2) { f1.prev.next = f2.next; f2.next.prev = f1.prev; f2.prev.next = f1; f1.prev = f2.prev; } if (v2.next != v2) { v1.prev.next = v2.next; v2.next.prev = v1.prev; v2.prev.next = v1; v1.prev = v2.prev; } if (e2.next != e2) { e1.Sym.next.Sym.next = e2.next; e2.next.Sym.next = e1.Sym.next; e2.Sym.next.Sym.next = e1; e1.Sym.next = e2.Sym.next; } return mesh1; } /* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. */ static void __gl_meshDeleteMeshZap(GLUmesh mesh) { GLUface fHead = mesh.fHead; while (fHead.next != fHead) { __gl_meshZapFace(fHead.next); } assert (mesh.vHead.next == mesh.vHead); } /* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. */ public static void __gl_meshDeleteMesh(GLUmesh mesh) { GLUface f, fNext; GLUvertex v, vNext; GLUhalfEdge e, eNext; for (f = mesh.fHead.next; f != mesh.fHead; f = fNext) { fNext = f.next; } for (v = mesh.vHead.next; v != mesh.vHead; v = vNext) { vNext = v.next; } for (e = mesh.eHead.next; e != mesh.eHead; e = eNext) { /* One call frees both e and e.Sym (see EdgePair above) */ eNext = e.next; } } /* __gl_meshCheckMesh( mesh ) checks a mesh for self-consistency. */ public static void __gl_meshCheckMesh(GLUmesh mesh) { GLUface fHead = mesh.fHead; GLUvertex vHead = mesh.vHead; GLUhalfEdge eHead = mesh.eHead; GLUface f, fPrev; GLUvertex v, vPrev; GLUhalfEdge e, ePrev; fPrev = fHead; for (fPrev = fHead; (f = fPrev.next) != fHead; fPrev = f) { assert (f.prev == fPrev); e = f.anEdge; do { assert (e.Sym != e); assert (e.Sym.Sym == e); assert (e.Lnext.Onext.Sym == e); assert (e.Onext.Sym.Lnext == e); assert (e.Lface == f); e = e.Lnext; } while (e != f.anEdge); } assert (f.prev == fPrev && f.anEdge == null && f.data == null); vPrev = vHead; for (vPrev = vHead; (v = vPrev.next) != vHead; vPrev = v) { assert (v.prev == vPrev); e = v.anEdge; do { assert (e.Sym != e); assert (e.Sym.Sym == e); assert (e.Lnext.Onext.Sym == e); assert (e.Onext.Sym.Lnext == e); assert (e.Org == v); e = e.Onext; } while (e != v.anEdge); } assert (v.prev == vPrev && v.anEdge == null && v.data == null); ePrev = eHead; for (ePrev = eHead; (e = ePrev.next) != eHead; ePrev = e) { assert (e.Sym.next == ePrev.Sym); assert (e.Sym != e); assert (e.Sym.Sym == e); assert (e.Org != null); assert (e.Sym.Org != null); assert (e.Lnext.Onext.Sym == e); assert (e.Onext.Sym.Lnext == e); } assert (e.Sym.next == ePrev.Sym && e.Sym == mesh.eHeadSym && e.Sym.Sym == e && e.Org == null && e.Sym.Org == null && e.Lface == null && e.Sym.Lface == null); } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/ActiveRegion.java0000644000175000017500000001173511543426510025042 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; class ActiveRegion { GLUhalfEdge eUp; /* upper edge, directed right to left */ DictNode nodeUp; /* dictionary node corresponding to eUp */ int windingNumber; /* used to determine which regions are * inside the polygon */ boolean inside; /* is this region inside the polygon? */ boolean sentinel; /* marks fake edges at t = +/-infinity */ boolean dirty; /* marks regions where the upper or lower * edge has changed, but we haven't checked * whether they intersect yet */ boolean fixUpperEdge; /* marks temporary edges introduced when * we process a "right vertex" (one without * any edges leaving to the right) */ } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/Render.java0000644000175000017500000005334011543426510023700 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; class Render { private static final boolean USE_OPTIMIZED_CODE_PATH = false; private Render() { } private static final RenderFan renderFan = new RenderFan(); private static final RenderStrip renderStrip = new RenderStrip(); private static final RenderTriangle renderTriangle = new RenderTriangle(); /* This structure remembers the information we need about a primitive * to be able to render it later, once we have determined which * primitive is able to use the most triangles. */ private static class FaceCount { private FaceCount() { } private FaceCount(long size, GLUhalfEdge eStart, renderCallBack render) { this.size = size; this.eStart = eStart; this.render = render; } long size; /* number of triangles used */ GLUhalfEdge eStart; /* edge where this primitive starts */ renderCallBack render; }; private interface renderCallBack { void render(GLUtessellatorImpl tess, GLUhalfEdge e, long size); } /************************ Strips and Fans decomposition ******************/ /* __gl_renderMesh( tess, mesh ) takes a mesh and breaks it into triangle * fans, strips, and separate triangles. A substantial effort is made * to use as few rendering primitives as possible (ie. to make the fans * and strips as large as possible). * * The rendering output is provided as callbacks (see the api). */ public static void __gl_renderMesh(GLUtessellatorImpl tess, GLUmesh mesh) { GLUface f; /* Make a list of separate triangles so we can render them all at once */ tess.lonelyTriList = null; for (f = mesh.fHead.next; f != mesh.fHead; f = f.next) { f.marked = false; } for (f = mesh.fHead.next; f != mesh.fHead; f = f.next) { /* We examine all faces in an arbitrary order. Whenever we find * an unprocessed face F, we output a group of faces including F * whose size is maximum. */ if (f.inside && !f.marked) { RenderMaximumFaceGroup(tess, f); assert (f.marked); } } if (tess.lonelyTriList != null) { RenderLonelyTriangles(tess, tess.lonelyTriList); tess.lonelyTriList = null; } } static void RenderMaximumFaceGroup(GLUtessellatorImpl tess, GLUface fOrig) { /* We want to find the largest triangle fan or strip of unmarked faces * which includes the given face fOrig. There are 3 possible fans * passing through fOrig (one centered at each vertex), and 3 possible * strips (one for each CCW permutation of the vertices). Our strategy * is to try all of these, and take the primitive which uses the most * triangles (a greedy approach). */ GLUhalfEdge e = fOrig.anEdge; FaceCount max = new FaceCount(); FaceCount newFace; max.size = 1; max.eStart = e; max.render = renderTriangle; if (!tess.flagBoundary) { newFace = MaximumFan(e); if (newFace.size > max.size) { max = newFace; } newFace = MaximumFan(e.Lnext); if (newFace.size > max.size) { max = newFace; } newFace = MaximumFan(e.Onext.Sym); if (newFace.size > max.size) { max = newFace; } newFace = MaximumStrip(e); if (newFace.size > max.size) { max = newFace; } newFace = MaximumStrip(e.Lnext); if (newFace.size > max.size) { max = newFace; } newFace = MaximumStrip(e.Onext.Sym); if (newFace.size > max.size) { max = newFace; } } max.render.render(tess, max.eStart, max.size); } /* Macros which keep track of faces we have marked temporarily, and allow * us to backtrack when necessary. With triangle fans, this is not * really necessary, since the only awkward case is a loop of triangles * around a single origin vertex. However with strips the situation is * more complicated, and we need a general tracking method like the * one here. */ private static boolean Marked(GLUface f) { return !f.inside || f.marked; } private static GLUface AddToTrail(GLUface f, GLUface t) { f.trail = t; f.marked = true; return f; } private static void FreeTrail(GLUface t) { if (true) { while (t != null) { t.marked = false; t = t.trail; } } else { /* absorb trailing semicolon */ } } static FaceCount MaximumFan(GLUhalfEdge eOrig) { /* eOrig.Lface is the face we want to render. We want to find the size * of a maximal fan around eOrig.Org. To do this we just walk around * the origin vertex as far as possible in both directions. */ FaceCount newFace = new FaceCount(0, null, renderFan); GLUface trail = null; GLUhalfEdge e; for (e = eOrig; !Marked(e.Lface); e = e.Onext) { trail = AddToTrail(e.Lface, trail); ++newFace.size; } for (e = eOrig; !Marked(e.Sym.Lface); e = e.Sym.Lnext) { trail = AddToTrail(e.Sym.Lface, trail); ++newFace.size; } newFace.eStart = e; /*LINTED*/ FreeTrail(trail); return newFace; } private static boolean IsEven(long n) { return (n & 0x1L) == 0; } static FaceCount MaximumStrip(GLUhalfEdge eOrig) { /* Here we are looking for a maximal strip that contains the vertices * eOrig.Org, eOrig.Dst, eOrig.Lnext.Dst (in that order or the * reverse, such that all triangles are oriented CCW). * * Again we walk forward and backward as far as possible. However for * strips there is a twist: to get CCW orientations, there must be * an *even* number of triangles in the strip on one side of eOrig. * We walk the strip starting on a side with an even number of triangles; * if both side have an odd number, we are forced to shorten one side. */ FaceCount newFace = new FaceCount(0, null, renderStrip); long headSize = 0, tailSize = 0; GLUface trail = null; GLUhalfEdge e, eTail, eHead; for (e = eOrig; !Marked(e.Lface); ++tailSize, e = e.Onext) { trail = AddToTrail(e.Lface, trail); ++tailSize; e = e.Lnext.Sym; if (Marked(e.Lface)) break; trail = AddToTrail(e.Lface, trail); } eTail = e; for (e = eOrig; !Marked(e.Sym.Lface); ++headSize, e = e.Sym.Onext.Sym) { trail = AddToTrail(e.Sym.Lface, trail); ++headSize; e = e.Sym.Lnext; if (Marked(e.Sym.Lface)) break; trail = AddToTrail(e.Sym.Lface, trail); } eHead = e; newFace.size = tailSize + headSize; if (IsEven(tailSize)) { newFace.eStart = eTail.Sym; } else if (IsEven(headSize)) { newFace.eStart = eHead; } else { /* Both sides have odd length, we must shorten one of them. In fact, * we must start from eHead to guarantee inclusion of eOrig.Lface. */ --newFace.size; newFace.eStart = eHead.Onext; } /*LINTED*/ FreeTrail(trail); return newFace; } private static class RenderTriangle implements renderCallBack { public void render(GLUtessellatorImpl tess, GLUhalfEdge e, long size) { /* Just add the triangle to a triangle list, so we can render all * the separate triangles at once. */ assert (size == 1); tess.lonelyTriList = AddToTrail(e.Lface, tess.lonelyTriList); } } static void RenderLonelyTriangles(GLUtessellatorImpl tess, GLUface f) { /* Now we render all the separate triangles which could not be * grouped into a triangle fan or strip. */ GLUhalfEdge e; int newState; int edgeState = -1; /* force edge state output for first vertex */ tess.callBeginOrBeginData(GL_TRIANGLES); for (; f != null; f = f.trail) { /* Loop once for each edge (there will always be 3 edges) */ e = f.anEdge; do { if (tess.flagBoundary) { /* Set the "edge state" to true just before we output the * first vertex of each edge on the polygon boundary. */ newState = (!e.Sym.Lface.inside) ? 1 : 0; if (edgeState != newState) { edgeState = newState; tess.callEdgeFlagOrEdgeFlagData( edgeState != 0); } } tess.callVertexOrVertexData( e.Org.data); e = e.Lnext; } while (e != f.anEdge); } tess.callEndOrEndData(); } private static class RenderFan implements renderCallBack { public void render(GLUtessellatorImpl tess, GLUhalfEdge e, long size) { /* Render as many CCW triangles as possible in a fan starting from * edge "e". The fan *should* contain exactly "size" triangles * (otherwise we've goofed up somewhere). */ tess.callBeginOrBeginData(GL_TRIANGLE_FAN); tess.callVertexOrVertexData( e.Org.data); tess.callVertexOrVertexData( e.Sym.Org.data); while (!Marked(e.Lface)) { e.Lface.marked = true; --size; e = e.Onext; tess.callVertexOrVertexData( e.Sym.Org.data); } assert (size == 0); tess.callEndOrEndData(); } } private static class RenderStrip implements renderCallBack { public void render(GLUtessellatorImpl tess, GLUhalfEdge e, long size) { /* Render as many CCW triangles as possible in a strip starting from * edge "e". The strip *should* contain exactly "size" triangles * (otherwise we've goofed up somewhere). */ tess.callBeginOrBeginData(GL_TRIANGLE_STRIP); tess.callVertexOrVertexData( e.Org.data); tess.callVertexOrVertexData( e.Sym.Org.data); while (!Marked(e.Lface)) { e.Lface.marked = true; --size; e = e.Lnext.Sym; tess.callVertexOrVertexData( e.Org.data); if (Marked(e.Lface)) break; e.Lface.marked = true; --size; e = e.Onext; tess.callVertexOrVertexData( e.Sym.Org.data); } assert (size == 0); tess.callEndOrEndData(); } } /************************ Boundary contour decomposition ******************/ /* __gl_renderBoundary( tess, mesh ) takes a mesh, and outputs one * contour for each face marked "inside". The rendering output is * provided as callbacks (see the api). */ public static void __gl_renderBoundary(GLUtessellatorImpl tess, GLUmesh mesh) { GLUface f; GLUhalfEdge e; for (f = mesh.fHead.next; f != mesh.fHead; f = f.next) { if (f.inside) { tess.callBeginOrBeginData(GL_LINE_LOOP); e = f.anEdge; do { tess.callVertexOrVertexData( e.Org.data); e = e.Lnext; } while (e != f.anEdge); tess.callEndOrEndData(); } } } /************************ Quick-and-dirty decomposition ******************/ private static final int SIGN_INCONSISTENT = 2; static int ComputeNormal(GLUtessellatorImpl tess, double[] norm, boolean check) /* * If check==false, we compute the polygon normal and place it in norm[]. * If check==true, we check that each triangle in the fan from v0 has a * consistent orientation with respect to norm[]. If triangles are * consistently oriented CCW, return 1; if CW, return -1; if all triangles * are degenerate return 0; otherwise (no consistent orientation) return * SIGN_INCONSISTENT. */ { CachedVertex[] v = tess.cache; // CachedVertex vn = v0 + tess.cacheCount; int vn = tess.cacheCount; // CachedVertex vc; int vc; double dot, xc, yc, zc, xp, yp, zp; double[] n = new double[3]; int sign = 0; /* Find the polygon normal. It is important to get a reasonable * normal even when the polygon is self-intersecting (eg. a bowtie). * Otherwise, the computed normal could be very tiny, but perpendicular * to the true plane of the polygon due to numerical noise. Then all * the triangles would appear to be degenerate and we would incorrectly * decompose the polygon as a fan (or simply not render it at all). * * We use a sum-of-triangles normal algorithm rather than the more * efficient sum-of-trapezoids method (used in CheckOrientation() * in normal.c). This lets us explicitly reverse the signed area * of some triangles to get a reasonable normal in the self-intersecting * case. */ if (!check) { norm[0] = norm[1] = norm[2] = 0.0; } vc = 1; xc = v[vc].coords[0] - v[0].coords[0]; yc = v[vc].coords[1] - v[0].coords[1]; zc = v[vc].coords[2] - v[0].coords[2]; while (++vc < vn) { xp = xc; yp = yc; zp = zc; xc = v[vc].coords[0] - v[0].coords[0]; yc = v[vc].coords[1] - v[0].coords[1]; zc = v[vc].coords[2] - v[0].coords[2]; /* Compute (vp - v0) cross (vc - v0) */ n[0] = yp * zc - zp * yc; n[1] = zp * xc - xp * zc; n[2] = xp * yc - yp * xc; dot = n[0] * norm[0] + n[1] * norm[1] + n[2] * norm[2]; if (!check) { /* Reverse the contribution of back-facing triangles to get * a reasonable normal for self-intersecting polygons (see above) */ if (dot >= 0) { norm[0] += n[0]; norm[1] += n[1]; norm[2] += n[2]; } else { norm[0] -= n[0]; norm[1] -= n[1]; norm[2] -= n[2]; } } else if (dot != 0) { /* Check the new orientation for consistency with previous triangles */ if (dot > 0) { if (sign < 0) return SIGN_INCONSISTENT; sign = 1; } else { if (sign > 0) return SIGN_INCONSISTENT; sign = -1; } } } return sign; } /* __gl_renderCache( tess ) takes a single contour and tries to render it * as a triangle fan. This handles convex polygons, as well as some * non-convex polygons if we get lucky. * * Returns true if the polygon was successfully rendered. The rendering * output is provided as callbacks (see the api). */ public static boolean __gl_renderCache(GLUtessellatorImpl tess) { CachedVertex[] v = tess.cache; // CachedVertex vn = v0 + tess.cacheCount; int vn = tess.cacheCount; // CachedVertex vc; int vc; double[] norm = new double[3]; int sign; if (tess.cacheCount < 3) { /* Degenerate contour -- no output */ return true; } norm[0] = tess.normal[0]; norm[1] = tess.normal[1]; norm[2] = tess.normal[2]; if (norm[0] == 0 && norm[1] == 0 && norm[2] == 0) { ComputeNormal( tess, norm, false); } sign = ComputeNormal( tess, norm, true); if (sign == SIGN_INCONSISTENT) { /* Fan triangles did not have a consistent orientation */ return false; } if (sign == 0) { /* All triangles were degenerate */ return true; } if ( !USE_OPTIMIZED_CODE_PATH ) { return false; } else { /* Make sure we do the right thing for each winding rule */ switch (tess.windingRule) { case GLU_TESS_WINDING_ODD: case GLU_TESS_WINDING_NONZERO: break; case GLU_TESS_WINDING_POSITIVE: if (sign < 0) return true; break; case GLU_TESS_WINDING_NEGATIVE: if (sign > 0) return true; break; case GLU_TESS_WINDING_ABS_GEQ_TWO: return true; } tess.callBeginOrBeginData( tess.boundaryOnly ? GL_LINE_LOOP : (tess.cacheCount > 3) ? GL_TRIANGLE_FAN : GL_TRIANGLES); tess.callVertexOrVertexData( v[0].data); if (sign > 0) { for (vc = 1; vc < vn; ++vc) { tess.callVertexOrVertexData( v[vc].data); } } else { for (vc = vn - 1; vc > 0; --vc) { tess.callVertexOrVertexData( v[vc].data); } } tess.callEndOrEndData(); return true; } } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/PriorityQHeap.java0000644000175000017500000002373211543426510025223 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; class PriorityQHeap extends PriorityQ { PriorityQ.PQnode[] nodes; PriorityQ.PQhandleElem[] handles; int size, max; int freeList; boolean initialized; PriorityQ.Leq leq; /* really __gl_pqHeapNewPriorityQ */ PriorityQHeap(PriorityQ.Leq leq) { size = 0; max = PriorityQ.INIT_SIZE; nodes = new PriorityQ.PQnode[PriorityQ.INIT_SIZE + 1]; for (int i = 0; i < nodes.length; i++) { nodes[i] = new PQnode(); } handles = new PriorityQ.PQhandleElem[PriorityQ.INIT_SIZE + 1]; for (int i = 0; i < handles.length; i++) { handles[i] = new PQhandleElem(); } initialized = false; freeList = 0; this.leq = leq; nodes[1].handle = 1; /* so that Minimum() returns NULL */ handles[1].key = null; } /* really __gl_pqHeapDeletePriorityQ */ void pqDeletePriorityQ() { handles = null; nodes = null; } void FloatDown(int curr) { PriorityQ.PQnode[] n = nodes; PriorityQ.PQhandleElem[] h = handles; int hCurr, hChild; int child; hCurr = n[curr].handle; for (; ;) { child = curr << 1; if (child < size && LEQ(leq, h[n[child + 1].handle].key, h[n[child].handle].key)) { ++child; } assert (child <= max); hChild = n[child].handle; if (child > size || LEQ(leq, h[hCurr].key, h[hChild].key)) { n[curr].handle = hCurr; h[hCurr].node = curr; break; } n[curr].handle = hChild; h[hChild].node = curr; curr = child; } } void FloatUp(int curr) { PriorityQ.PQnode[] n = nodes; PriorityQ.PQhandleElem[] h = handles; int hCurr, hParent; int parent; hCurr = n[curr].handle; for (; ;) { parent = curr >> 1; hParent = n[parent].handle; if (parent == 0 || LEQ(leq, h[hParent].key, h[hCurr].key)) { n[curr].handle = hCurr; h[hCurr].node = curr; break; } n[curr].handle = hParent; h[hParent].node = curr; curr = parent; } } /* really __gl_pqHeapInit */ boolean pqInit() { int i; /* This method of building a heap is O(n), rather than O(n lg n). */ for (i = size; i >= 1; --i) { FloatDown(i); } initialized = true; return true; } /* really __gl_pqHeapInsert */ /* returns LONG_MAX iff out of memory */ int pqInsert(Object keyNew) { int curr; int free; curr = ++size; if ((curr * 2) > max) { PriorityQ.PQnode[] saveNodes = nodes; PriorityQ.PQhandleElem[] saveHandles = handles; /* If the heap overflows, double its size. */ max <<= 1; // pq->nodes = (PQnode *)memRealloc( pq->nodes, (size_t) ((pq->max + 1) * sizeof( pq->nodes[0] ))); PriorityQ.PQnode[] pqNodes = new PriorityQ.PQnode[max + 1]; System.arraycopy( nodes, 0, pqNodes, 0, nodes.length ); for (int i = nodes.length; i < pqNodes.length; i++) { pqNodes[i] = new PQnode(); } nodes = pqNodes; if (nodes == null) { nodes = saveNodes; /* restore ptr to free upon return */ return Integer.MAX_VALUE; } // pq->handles = (PQhandleElem *)memRealloc( pq->handles,(size_t)((pq->max + 1) * sizeof( pq->handles[0] ))); PriorityQ.PQhandleElem[] pqHandles = new PriorityQ.PQhandleElem[max + 1]; System.arraycopy( handles, 0, pqHandles, 0, handles.length ); for (int i = handles.length; i < pqHandles.length; i++) { pqHandles[i] = new PQhandleElem(); } handles = pqHandles; if (handles == null) { handles = saveHandles; /* restore ptr to free upon return */ return Integer.MAX_VALUE; } } if (freeList == 0) { free = curr; } else { free = freeList; freeList = handles[free].node; } nodes[curr].handle = free; handles[free].node = curr; handles[free].key = keyNew; if (initialized) { FloatUp(curr); } assert (free != Integer.MAX_VALUE); return free; } /* really __gl_pqHeapExtractMin */ Object pqExtractMin() { PriorityQ.PQnode[] n = nodes; PriorityQ.PQhandleElem[] h = handles; int hMin = n[1].handle; Object min = h[hMin].key; if (size > 0) { n[1].handle = n[size].handle; h[n[1].handle].node = 1; h[hMin].key = null; h[hMin].node = freeList; freeList = hMin; if (--size > 0) { FloatDown(1); } } return min; } /* really __gl_pqHeapDelete */ void pqDelete(int hCurr) { PriorityQ.PQnode[] n = nodes; PriorityQ.PQhandleElem[] h = handles; int curr; assert (hCurr >= 1 && hCurr <= max && h[hCurr].key != null); curr = h[hCurr].node; n[curr].handle = n[size].handle; h[n[curr].handle].node = curr; if (curr <= --size) { if (curr <= 1 || LEQ(leq, h[n[curr >> 1].handle].key, h[n[curr].handle].key)) { FloatDown(curr); } else { FloatUp(curr); } } h[hCurr].key = null; h[hCurr].node = freeList; freeList = hCurr; } Object pqMinimum() { return handles[nodes[1].handle].key; } boolean pqIsEmpty() { return size == 0; } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/GLUtessellatorImpl.java0000644000175000017500000005666511543426510026231 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; import org.lwjgl.util.glu.GLUtessellator; import org.lwjgl.util.glu.GLUtessellatorCallback; import org.lwjgl.util.glu.GLUtessellatorCallbackAdapter; import static org.lwjgl.util.glu.GLU.*; public class GLUtessellatorImpl implements GLUtessellator { public static final int TESS_MAX_CACHE = 100; private int state; /* what begin/end calls have we seen? */ private GLUhalfEdge lastEdge; /* lastEdge->Org is the most recent vertex */ GLUmesh mesh; /* stores the input contours, and eventually the tessellation itself */ /*** state needed for projecting onto the sweep plane ***/ double[] normal = new double[3]; /* user-specified normal (if provided) */ double[] sUnit = new double[3]; /* unit vector in s-direction (debugging) */ double[] tUnit = new double[3]; /* unit vector in t-direction (debugging) */ /*** state needed for the line sweep ***/ private double relTolerance; /* tolerance for merging features */ int windingRule; /* rule for determining polygon interior */ boolean fatalError; /* fatal error: needed combine callback */ Dict dict; /* edge dictionary for sweep line */ PriorityQ pq; /* priority queue of vertex events */ GLUvertex event; /* current sweep event being processed */ /*** state needed for rendering callbacks (see render.c) ***/ boolean flagBoundary; /* mark boundary edges (use EdgeFlag) */ boolean boundaryOnly; /* Extract contours, not triangles */ GLUface lonelyTriList; /* list of triangles which could not be rendered as strips or fans */ /*** state needed to cache single-contour polygons for renderCache() */ private boolean flushCacheOnNextVertex; /* empty cache on next vertex() call */ int cacheCount; /* number of cached vertices */ CachedVertex[] cache = new CachedVertex[TESS_MAX_CACHE]; /* the vertex data */ /*** rendering callbacks that also pass polygon data ***/ private Object polygonData; /* client data for current polygon */ private GLUtessellatorCallback callBegin; private GLUtessellatorCallback callEdgeFlag; private GLUtessellatorCallback callVertex; private GLUtessellatorCallback callEnd; // private GLUtessellatorCallback callMesh; private GLUtessellatorCallback callError; private GLUtessellatorCallback callCombine; private GLUtessellatorCallback callBeginData; private GLUtessellatorCallback callEdgeFlagData; private GLUtessellatorCallback callVertexData; private GLUtessellatorCallback callEndData; // private GLUtessellatorCallback callMeshData; private GLUtessellatorCallback callErrorData; private GLUtessellatorCallback callCombineData; private static final double GLU_TESS_DEFAULT_TOLERANCE = 0.0; // private static final int GLU_TESS_MESH = 100112; /* void (*)(GLUmesh *mesh) */ private static GLUtessellatorCallback NULL_CB = new GLUtessellatorCallbackAdapter(); // #define MAX_FAST_ALLOC (MAX(sizeof(EdgePair), \ // MAX(sizeof(GLUvertex),sizeof(GLUface)))) public GLUtessellatorImpl() { state = TessState.T_DORMANT; normal[0] = 0; normal[1] = 0; normal[2] = 0; relTolerance = GLU_TESS_DEFAULT_TOLERANCE; windingRule = GLU_TESS_WINDING_ODD; flagBoundary = false; boundaryOnly = false; callBegin = NULL_CB; callEdgeFlag = NULL_CB; callVertex = NULL_CB; callEnd = NULL_CB; callError = NULL_CB; callCombine = NULL_CB; // callMesh = NULL_CB; callBeginData = NULL_CB; callEdgeFlagData = NULL_CB; callVertexData = NULL_CB; callEndData = NULL_CB; callErrorData = NULL_CB; callCombineData = NULL_CB; polygonData = null; for (int i = 0; i < cache.length; i++) { cache[i] = new CachedVertex(); } } public static GLUtessellator gluNewTess() { return new GLUtessellatorImpl(); } private void makeDormant() { /* Return the tessellator to its original dormant state. */ if (mesh != null) { Mesh.__gl_meshDeleteMesh(mesh); } state = TessState.T_DORMANT; lastEdge = null; mesh = null; } private void requireState(int newState) { if (state != newState) gotoState(newState); } private void gotoState(int newState) { while (state != newState) { /* We change the current state one level at a time, to get to * the desired state. */ if (state < newState) { if (state == TessState.T_DORMANT) { callErrorOrErrorData(GLU_TESS_MISSING_BEGIN_POLYGON); gluTessBeginPolygon(null); } else if (state == TessState.T_IN_POLYGON) { callErrorOrErrorData(GLU_TESS_MISSING_BEGIN_CONTOUR); gluTessBeginContour(); } } else { if (state == TessState.T_IN_CONTOUR) { callErrorOrErrorData(GLU_TESS_MISSING_END_CONTOUR); gluTessEndContour(); } else if (state == TessState.T_IN_POLYGON) { callErrorOrErrorData(GLU_TESS_MISSING_END_POLYGON); /* gluTessEndPolygon( tess ) is too much work! */ makeDormant(); } } } } public void gluDeleteTess() { requireState(TessState.T_DORMANT); } public void gluTessProperty(int which, double value) { switch (which) { case GLU_TESS_TOLERANCE: if (value < 0.0 || value > 1.0) break; relTolerance = value; return; case GLU_TESS_WINDING_RULE: int windingRule = (int) value; if (windingRule != value) break; /* not an integer */ switch (windingRule) { case GLU_TESS_WINDING_ODD: case GLU_TESS_WINDING_NONZERO: case GLU_TESS_WINDING_POSITIVE: case GLU_TESS_WINDING_NEGATIVE: case GLU_TESS_WINDING_ABS_GEQ_TWO: this.windingRule = windingRule; return; default: break; } case GLU_TESS_BOUNDARY_ONLY: boundaryOnly = (value != 0); return; default: callErrorOrErrorData(GLU_INVALID_ENUM); return; } callErrorOrErrorData(GLU_INVALID_VALUE); } /* Returns tessellator property */ public void gluGetTessProperty(int which, double[] value, int value_offset) { switch (which) { case GLU_TESS_TOLERANCE: /* tolerance should be in range [0..1] */ assert (0.0 <= relTolerance && relTolerance <= 1.0); value[value_offset] = relTolerance; break; case GLU_TESS_WINDING_RULE: assert (windingRule == GLU_TESS_WINDING_ODD || windingRule == GLU_TESS_WINDING_NONZERO || windingRule == GLU_TESS_WINDING_POSITIVE || windingRule == GLU_TESS_WINDING_NEGATIVE || windingRule == GLU_TESS_WINDING_ABS_GEQ_TWO); value[value_offset] = windingRule; break; case GLU_TESS_BOUNDARY_ONLY: assert (boundaryOnly == true || boundaryOnly == false); value[value_offset] = boundaryOnly ? 1 : 0; break; default: value[value_offset] = 0.0; callErrorOrErrorData(GLU_INVALID_ENUM); break; } } /* gluGetTessProperty() */ public void gluTessNormal(double x, double y, double z) { normal[0] = x; normal[1] = y; normal[2] = z; } public void gluTessCallback(int which, GLUtessellatorCallback aCallback) { switch (which) { case GLU_TESS_BEGIN: callBegin = aCallback == null ? NULL_CB : aCallback; return; case GLU_TESS_BEGIN_DATA: callBeginData = aCallback == null ? NULL_CB : aCallback; return; case GLU_TESS_EDGE_FLAG: callEdgeFlag = aCallback == null ? NULL_CB : aCallback; /* If the client wants boundary edges to be flagged, * we render everything as separate triangles (no strips or fans). */ flagBoundary = aCallback != null; return; case GLU_TESS_EDGE_FLAG_DATA: callEdgeFlagData = callBegin = aCallback == null ? NULL_CB : aCallback; /* If the client wants boundary edges to be flagged, * we render everything as separate triangles (no strips or fans). */ flagBoundary = (aCallback != null); return; case GLU_TESS_VERTEX: callVertex = aCallback == null ? NULL_CB : aCallback; return; case GLU_TESS_VERTEX_DATA: callVertexData = aCallback == null ? NULL_CB : aCallback; return; case GLU_TESS_END: callEnd = aCallback == null ? NULL_CB : aCallback; return; case GLU_TESS_END_DATA: callEndData = aCallback == null ? NULL_CB : aCallback; return; case GLU_TESS_ERROR: callError = aCallback == null ? NULL_CB : aCallback; return; case GLU_TESS_ERROR_DATA: callErrorData = aCallback == null ? NULL_CB : aCallback; return; case GLU_TESS_COMBINE: callCombine = aCallback == null ? NULL_CB : aCallback; return; case GLU_TESS_COMBINE_DATA: callCombineData = aCallback == null ? NULL_CB : aCallback; return; // case GLU_TESS_MESH: // callMesh = aCallback == null ? NULL_CB : aCallback; // return; default: callErrorOrErrorData(GLU_INVALID_ENUM); return; } } private boolean addVertex(double[] coords, Object vertexData) { GLUhalfEdge e; e = lastEdge; if (e == null) { /* Make a self-loop (one vertex, one edge). */ e = Mesh.__gl_meshMakeEdge(mesh); if (e == null) return false; if (!Mesh.__gl_meshSplice(e, e.Sym)) return false; } else { /* Create a new vertex and edge which immediately follow e * in the ordering around the left face. */ if (Mesh.__gl_meshSplitEdge(e) == null) return false; e = e.Lnext; } /* The new vertex is now e.Org. */ e.Org.data = vertexData; e.Org.coords[0] = coords[0]; e.Org.coords[1] = coords[1]; e.Org.coords[2] = coords[2]; /* The winding of an edge says how the winding number changes as we * cross from the edge''s right face to its left face. We add the * vertices in such an order that a CCW contour will add +1 to * the winding number of the region inside the contour. */ e.winding = 1; e.Sym.winding = -1; lastEdge = e; return true; } private void cacheVertex(double[] coords, Object vertexData) { if (cache[cacheCount] == null) { cache[cacheCount] = new CachedVertex(); } CachedVertex v = cache[cacheCount]; v.data = vertexData; v.coords[0] = coords[0]; v.coords[1] = coords[1]; v.coords[2] = coords[2]; ++cacheCount; } private boolean flushCache() { CachedVertex[] v = cache; mesh = Mesh.__gl_meshNewMesh(); if (mesh == null) return false; for (int i = 0; i < cacheCount; i++) { CachedVertex vertex = v[i]; if (!addVertex(vertex.coords, vertex.data)) return false; } cacheCount = 0; flushCacheOnNextVertex = false; return true; } public void gluTessVertex(double[] coords, int coords_offset, Object vertexData) { int i; boolean tooLarge = false; double x; double[] clamped = new double[3]; requireState(TessState.T_IN_CONTOUR); if (flushCacheOnNextVertex) { if (!flushCache()) { callErrorOrErrorData(GLU_OUT_OF_MEMORY); return; } lastEdge = null; } for (i = 0; i < 3; ++i) { x = coords[i+coords_offset]; if (x < -GLU_TESS_MAX_COORD) { x = -GLU_TESS_MAX_COORD; tooLarge = true; } if (x > GLU_TESS_MAX_COORD) { x = GLU_TESS_MAX_COORD; tooLarge = true; } clamped[i] = x; } if (tooLarge) { callErrorOrErrorData(GLU_TESS_COORD_TOO_LARGE); } if (mesh == null) { if (cacheCount < TESS_MAX_CACHE) { cacheVertex(clamped, vertexData); return; } if (!flushCache()) { callErrorOrErrorData(GLU_OUT_OF_MEMORY); return; } } if (!addVertex(clamped, vertexData)) { callErrorOrErrorData(GLU_OUT_OF_MEMORY); } } public void gluTessBeginPolygon(Object data) { requireState(TessState.T_DORMANT); state = TessState.T_IN_POLYGON; cacheCount = 0; flushCacheOnNextVertex = false; mesh = null; polygonData = data; } public void gluTessBeginContour() { requireState(TessState.T_IN_POLYGON); state = TessState.T_IN_CONTOUR; lastEdge = null; if (cacheCount > 0) { /* Just set a flag so we don't get confused by empty contours * -- these can be generated accidentally with the obsolete * NextContour() interface. */ flushCacheOnNextVertex = true; } } public void gluTessEndContour() { requireState(TessState.T_IN_CONTOUR); state = TessState.T_IN_POLYGON; } public void gluTessEndPolygon() { GLUmesh mesh; try { requireState(TessState.T_IN_POLYGON); state = TessState.T_DORMANT; if (this.mesh == null) { if (!flagBoundary /*&& callMesh == NULL_CB*/) { /* Try some special code to make the easy cases go quickly * (eg. convex polygons). This code does NOT handle multiple contours, * intersections, edge flags, and of course it does not generate * an explicit mesh either. */ if (Render.__gl_renderCache(this)) { polygonData = null; return; } } if (!flushCache()) throw new RuntimeException(); /* could've used a label*/ } /* Determine the polygon normal and project vertices onto the plane * of the polygon. */ Normal.__gl_projectPolygon(this); /* __gl_computeInterior( tess ) computes the planar arrangement specified * by the given contours, and further subdivides this arrangement * into regions. Each region is marked "inside" if it belongs * to the polygon, according to the rule given by windingRule. * Each interior region is guaranteed be monotone. */ if (!Sweep.__gl_computeInterior(this)) { throw new RuntimeException(); /* could've used a label */ } mesh = this.mesh; if (!fatalError) { boolean rc = true; /* If the user wants only the boundary contours, we throw away all edges * except those which separate the interior from the exterior. * Otherwise we tessellate all the regions marked "inside". */ if (boundaryOnly) { rc = TessMono.__gl_meshSetWindingNumber(mesh, 1, true); } else { rc = TessMono.__gl_meshTessellateInterior(mesh); } if (!rc) throw new RuntimeException(); /* could've used a label */ Mesh.__gl_meshCheckMesh(mesh); if (callBegin != NULL_CB || callEnd != NULL_CB || callVertex != NULL_CB || callEdgeFlag != NULL_CB || callBeginData != NULL_CB || callEndData != NULL_CB || callVertexData != NULL_CB || callEdgeFlagData != NULL_CB) { if (boundaryOnly) { Render.__gl_renderBoundary(this, mesh); /* output boundary contours */ } else { Render.__gl_renderMesh(this, mesh); /* output strips and fans */ } } // if (callMesh != NULL_CB) { // ///* Throw away the exterior faces, so that all faces are interior. // * This way the user doesn't have to check the "inside" flag, // * and we don't need to even reveal its existence. It also leaves // * the freedom for an implementation to not generate the exterior // * faces in the first place. // */ // TessMono.__gl_meshDiscardExterior(mesh); // callMesh.mesh(mesh); /* user wants the mesh itself */ // mesh = null; // polygonData = null; // return; // } } Mesh.__gl_meshDeleteMesh(mesh); polygonData = null; mesh = null; } catch (Exception e) { e.printStackTrace(); callErrorOrErrorData(GLU_OUT_OF_MEMORY); } } /*******************************************************/ /* Obsolete calls -- for backward compatibility */ public void gluBeginPolygon() { gluTessBeginPolygon(null); gluTessBeginContour(); } /*ARGSUSED*/ public void gluNextContour(int type) { gluTessEndContour(); gluTessBeginContour(); } public void gluEndPolygon() { gluTessEndContour(); gluTessEndPolygon(); } void callBeginOrBeginData(int a) { if (callBeginData != NULL_CB) callBeginData.beginData(a, polygonData); else callBegin.begin(a); } void callVertexOrVertexData(Object a) { if (callVertexData != NULL_CB) callVertexData.vertexData(a, polygonData); else callVertex.vertex(a); } void callEdgeFlagOrEdgeFlagData(boolean a) { if (callEdgeFlagData != NULL_CB) callEdgeFlagData.edgeFlagData(a, polygonData); else callEdgeFlag.edgeFlag(a); } void callEndOrEndData() { if (callEndData != NULL_CB) callEndData.endData(polygonData); else callEnd.end(); } void callCombineOrCombineData(double[] coords, Object[] vertexData, float[] weights, Object[] outData) { if (callCombineData != NULL_CB) callCombineData.combineData(coords, vertexData, weights, outData, polygonData); else callCombine.combine(coords, vertexData, weights, outData); } void callErrorOrErrorData(int a) { if (callErrorData != NULL_CB) callErrorData.errorData(a, polygonData); else callError.error(a); } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/TessState.java0000644000175000017500000001051511543426510024375 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; class TessState { public static final int T_DORMANT = 0; public static final int T_IN_POLYGON = 1; public static final int T_IN_CONTOUR = 2; } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/Geom.java0000644000175000017500000003106411543426510023347 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; class Geom { private Geom() { } /* Given three vertices u,v,w such that VertLeq(u,v) && VertLeq(v,w), * evaluates the t-coord of the edge uw at the s-coord of the vertex v. * Returns v->t - (uw)(v->s), ie. the signed distance from uw to v. * If uw is vertical (and thus passes thru v), the result is zero. * * The calculation is extremely accurate and stable, even when v * is very close to u or w. In particular if we set v->t = 0 and * let r be the negated result (this evaluates (uw)(v->s)), then * r is guaranteed to satisfy MIN(u->t,w->t) <= r <= MAX(u->t,w->t). */ static double EdgeEval(GLUvertex u, GLUvertex v, GLUvertex w) { double gapL, gapR; assert (VertLeq(u, v) && VertLeq(v, w)); gapL = v.s - u.s; gapR = w.s - v.s; if (gapL + gapR > 0) { if (gapL < gapR) { return (v.t - u.t) + (u.t - w.t) * (gapL / (gapL + gapR)); } else { return (v.t - w.t) + (w.t - u.t) * (gapR / (gapL + gapR)); } } /* vertical line */ return 0; } static double EdgeSign(GLUvertex u, GLUvertex v, GLUvertex w) { double gapL, gapR; assert (VertLeq(u, v) && VertLeq(v, w)); gapL = v.s - u.s; gapR = w.s - v.s; if (gapL + gapR > 0) { return (v.t - w.t) * gapL + (v.t - u.t) * gapR; } /* vertical line */ return 0; } /*********************************************************************** * Define versions of EdgeSign, EdgeEval with s and t transposed. */ static double TransEval(GLUvertex u, GLUvertex v, GLUvertex w) { /* Given three vertices u,v,w such that TransLeq(u,v) && TransLeq(v,w), * evaluates the t-coord of the edge uw at the s-coord of the vertex v. * Returns v->s - (uw)(v->t), ie. the signed distance from uw to v. * If uw is vertical (and thus passes thru v), the result is zero. * * The calculation is extremely accurate and stable, even when v * is very close to u or w. In particular if we set v->s = 0 and * let r be the negated result (this evaluates (uw)(v->t)), then * r is guaranteed to satisfy MIN(u->s,w->s) <= r <= MAX(u->s,w->s). */ double gapL, gapR; assert (TransLeq(u, v) && TransLeq(v, w)); gapL = v.t - u.t; gapR = w.t - v.t; if (gapL + gapR > 0) { if (gapL < gapR) { return (v.s - u.s) + (u.s - w.s) * (gapL / (gapL + gapR)); } else { return (v.s - w.s) + (w.s - u.s) * (gapR / (gapL + gapR)); } } /* vertical line */ return 0; } static double TransSign(GLUvertex u, GLUvertex v, GLUvertex w) { /* Returns a number whose sign matches TransEval(u,v,w) but which * is cheaper to evaluate. Returns > 0, == 0 , or < 0 * as v is above, on, or below the edge uw. */ double gapL, gapR; assert (TransLeq(u, v) && TransLeq(v, w)); gapL = v.t - u.t; gapR = w.t - v.t; if (gapL + gapR > 0) { return (v.s - w.s) * gapL + (v.s - u.s) * gapR; } /* vertical line */ return 0; } static boolean VertCCW(GLUvertex u, GLUvertex v, GLUvertex w) { /* For almost-degenerate situations, the results are not reliable. * Unless the floating-point arithmetic can be performed without * rounding errors, *any* implementation will give incorrect results * on some degenerate inputs, so the client must have some way to * handle this situation. */ return (u.s * (v.t - w.t) + v.s * (w.t - u.t) + w.s * (u.t - v.t)) >= 0; } /* Given parameters a,x,b,y returns the value (b*x+a*y)/(a+b), * or (x+y)/2 if a==b==0. It requires that a,b >= 0, and enforces * this in the rare case that one argument is slightly negative. * The implementation is extremely stable numerically. * In particular it guarantees that the result r satisfies * MIN(x,y) <= r <= MAX(x,y), and the results are very accurate * even when a and b differ greatly in magnitude. */ static double Interpolate(double a, double x, double b, double y) { a = (a < 0) ? 0 : a; b = (b < 0) ? 0 : b; if (a <= b) { if (b == 0) { return (x + y) / 2.0; } else { return (x + (y - x) * (a / (a + b))); } } else { return (y + (x - y) * (b / (a + b))); } } static void EdgeIntersect(GLUvertex o1, GLUvertex d1, GLUvertex o2, GLUvertex d2, GLUvertex v) /* Given edges (o1,d1) and (o2,d2), compute their point of intersection. * The computed point is guaranteed to lie in the intersection of the * bounding rectangles defined by each edge. */ { double z1, z2; /* This is certainly not the most efficient way to find the intersection * of two line segments, but it is very numerically stable. * * Strategy: find the two middle vertices in the VertLeq ordering, * and interpolate the intersection s-value from these. Then repeat * using the TransLeq ordering to find the intersection t-value. */ if (!VertLeq(o1, d1)) { GLUvertex temp = o1; o1 = d1; d1 = temp; } if (!VertLeq(o2, d2)) { GLUvertex temp = o2; o2 = d2; d2 = temp; } if (!VertLeq(o1, o2)) { GLUvertex temp = o1; o1 = o2; o2 = temp; temp = d1; d1 = d2; d2 = temp; } if (!VertLeq(o2, d1)) { /* Technically, no intersection -- do our best */ v.s = (o2.s + d1.s) / 2.0; } else if (VertLeq(d1, d2)) { /* Interpolate between o2 and d1 */ z1 = EdgeEval(o1, o2, d1); z2 = EdgeEval(o2, d1, d2); if (z1 + z2 < 0) { z1 = -z1; z2 = -z2; } v.s = Interpolate(z1, o2.s, z2, d1.s); } else { /* Interpolate between o2 and d2 */ z1 = EdgeSign(o1, o2, d1); z2 = -EdgeSign(o1, d2, d1); if (z1 + z2 < 0) { z1 = -z1; z2 = -z2; } v.s = Interpolate(z1, o2.s, z2, d2.s); } /* Now repeat the process for t */ if (!TransLeq(o1, d1)) { GLUvertex temp = o1; o1 = d1; d1 = temp; } if (!TransLeq(o2, d2)) { GLUvertex temp = o2; o2 = d2; d2 = temp; } if (!TransLeq(o1, o2)) { GLUvertex temp = o2; o2 = o1; o1 = temp; temp = d2; d2 = d1; d1 = temp; } if (!TransLeq(o2, d1)) { /* Technically, no intersection -- do our best */ v.t = (o2.t + d1.t) / 2.0; } else if (TransLeq(d1, d2)) { /* Interpolate between o2 and d1 */ z1 = TransEval(o1, o2, d1); z2 = TransEval(o2, d1, d2); if (z1 + z2 < 0) { z1 = -z1; z2 = -z2; } v.t = Interpolate(z1, o2.t, z2, d1.t); } else { /* Interpolate between o2 and d2 */ z1 = TransSign(o1, o2, d1); z2 = -TransSign(o1, d2, d1); if (z1 + z2 < 0) { z1 = -z1; z2 = -z2; } v.t = Interpolate(z1, o2.t, z2, d2.t); } } static boolean VertEq(GLUvertex u, GLUvertex v) { return u.s == v.s && u.t == v.t; } static boolean VertLeq(GLUvertex u, GLUvertex v) { return u.s < v.s || (u.s == v.s && u.t <= v.t); } /* Versions of VertLeq, EdgeSign, EdgeEval with s and t transposed. */ static boolean TransLeq(GLUvertex u, GLUvertex v) { return u.t < v.t || (u.t == v.t && u.s <= v.s); } static boolean EdgeGoesLeft(GLUhalfEdge e) { return VertLeq(e.Sym.Org, e.Org); } static boolean EdgeGoesRight(GLUhalfEdge e) { return VertLeq(e.Org, e.Sym.Org); } static double VertL1dist(GLUvertex u, GLUvertex v) { return Math.abs(u.s - v.s) + Math.abs(u.t - v.t); } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/tessellation/GLUvertex.java0000644000175000017500000001124211543426510024341 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Portions Copyright (C) 2003-2006 Sun Microsystems, Inc. * All rights reserved. */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section ** 3.2(3) of the SGI License, Sun is distributing the Covered Code to ** you under an alternative license ("Alternative License"). This ** Alternative License includes all of the provisions of the SGI License ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** ** Author: Eric Veach, July 1994 ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ package org.lwjgl.util.glu.tessellation; class GLUvertex { public GLUvertex next; /* next vertex (never NULL) */ public GLUvertex prev; /* previous vertex (never NULL) */ public GLUhalfEdge anEdge; /* a half-edge with this origin */ public Object data; /* client's data */ /* Internal data (keep hidden) */ public double[] coords = new double[3]; /* vertex location in 3D */ public double s, t; /* projection onto the sweep plane */ public int pqHandle; /* to allow deletion from priority queue */ } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/Quadric.java0000644000175000017500000001240611543426510021341 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.glu; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; /** * Quadric.java * * * Created 22-dec-2003 * @author Erik Duijs */ public class Quadric { protected int drawStyle; protected int orientation; protected boolean textureFlag; protected int normals; /** * Constructor for Quadric. */ public Quadric() { super(); drawStyle = GLU_FILL; orientation = GLU_OUTSIDE; textureFlag = false; normals = GLU_SMOOTH; } /** * Call glNormal3f after scaling normal to unit length. * * @param x * @param y * @param z */ protected void normal3f(float x, float y, float z) { float mag; mag = (float)Math.sqrt(x * x + y * y + z * z); if (mag > 0.00001F) { x /= mag; y /= mag; z /= mag; } glNormal3f(x, y, z); } /** * specifies the draw style for quadrics. * * The legal values are as follows: * * GLU.FILL: Quadrics are rendered with polygon primitives. The polygons * are drawn in a counterclockwise fashion with respect to * their normals (as defined with glu.quadricOrientation). * * GLU.LINE: Quadrics are rendered as a set of lines. * * GLU.SILHOUETTE: Quadrics are rendered as a set of lines, except that edges * separating coplanar faces will not be drawn. * * GLU.POINT: Quadrics are rendered as a set of points. * * @param drawStyle The drawStyle to set */ public void setDrawStyle(int drawStyle) { this.drawStyle = drawStyle; } /** * specifies what kind of normals are desired for quadrics. * The legal values are as follows: * * GLU.NONE: No normals are generated. * * GLU.FLAT: One normal is generated for every facet of a quadric. * * GLU.SMOOTH: One normal is generated for every vertex of a quadric. This * is the default. * * @param normals The normals to set */ public void setNormals(int normals) { this.normals = normals; } /** * specifies what kind of orientation is desired for. * The orientation values are as follows: * * GLU.OUTSIDE: Quadrics are drawn with normals pointing outward. * * GLU.INSIDE: Normals point inward. The default is GLU.OUTSIDE. * * Note that the interpretation of outward and inward depends on the quadric * being drawn. * * @param orientation The orientation to set */ public void setOrientation(int orientation) { this.orientation = orientation; } /** * specifies if texture coordinates should be generated for * quadrics rendered with qobj. If the value of textureCoords is true, * then texture coordinates are generated, and if textureCoords is false, * they are not.. The default is false. * * The manner in which texture coordinates are generated depends upon the * specific quadric rendered. * * @param textureFlag The textureFlag to set */ public void setTextureFlag(boolean textureFlag) { this.textureFlag = textureFlag; } /** * Returns the drawStyle. * @return int */ public int getDrawStyle() { return drawStyle; } /** * Returns the normals. * @return int */ public int getNormals() { return normals; } /** * Returns the orientation. * @return int */ public int getOrientation() { return orientation; } /** * Returns the textureFlag. * @return boolean */ public boolean getTextureFlag() { return textureFlag; } protected void TXTR_COORD(float x, float y) { if (textureFlag) glTexCoord2f(x,y); } protected float sin(float r) { return (float)Math.sin(r); } protected float cos(float r) { return (float)Math.cos(r); } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/Sphere.java0000644000175000017500000001507211543426510021201 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.glu; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; /** * Sphere.java * * * Created 23-dec-2003 * @author Erik Duijs */ public class Sphere extends Quadric { /** * Constructor */ public Sphere() { super(); } /** * draws a sphere of the given radius centered around the origin. * The sphere is subdivided around the z axis into slices and along the z axis * into stacks (similar to lines of longitude and latitude). * * If the orientation is set to GLU.OUTSIDE (with glu.quadricOrientation), then * any normals generated point away from the center of the sphere. Otherwise, * they point toward the center of the sphere. * If texturing is turned on (with glu.quadricTexture), then texture * coordinates are generated so that t ranges from 0.0 at z=-radius to 1.0 at * z=radius (t increases linearly along longitudinal lines), and s ranges from * 0.0 at the +y axis, to 0.25 at the +x axis, to 0.5 at the -y axis, to 0.75 * at the -x axis, and back to 1.0 at the +y axis. */ public void draw(float radius, int slices, int stacks) { // TODO float rho, drho, theta, dtheta; float x, y, z; float s, t, ds, dt; int i, j, imin, imax; boolean normals; float nsign; normals = super.normals != GLU_NONE; if (super.orientation == GLU_INSIDE) { nsign = -1.0f; } else { nsign = 1.0f; } drho = PI / stacks; dtheta = 2.0f * PI / slices; if (super.drawStyle == GLU_FILL) { if (!super.textureFlag) { // draw +Z end as a triangle fan glBegin(GL_TRIANGLE_FAN); glNormal3f(0.0f, 0.0f, 1.0f); glVertex3f(0.0f, 0.0f, nsign * radius); for (j = 0; j <= slices; j++) { theta = (j == slices) ? 0.0f : j * dtheta; x = -sin(theta) * sin(drho); y = cos(theta) * sin(drho); z = nsign * cos(drho); if (normals) { glNormal3f(x * nsign, y * nsign, z * nsign); } glVertex3f(x * radius, y * radius, z * radius); } glEnd(); } ds = 1.0f / slices; dt = 1.0f / stacks; t = 1.0f; // because loop now runs from 0 if (super.textureFlag) { imin = 0; imax = stacks; } else { imin = 1; imax = stacks - 1; } // draw intermediate stacks as quad strips for (i = imin; i < imax; i++) { rho = i * drho; glBegin(GL_QUAD_STRIP); s = 0.0f; for (j = 0; j <= slices; j++) { theta = (j == slices) ? 0.0f : j * dtheta; x = -sin(theta) * sin(rho); y = cos(theta) * sin(rho); z = nsign * cos(rho); if (normals) { glNormal3f(x * nsign, y * nsign, z * nsign); } TXTR_COORD(s, t); glVertex3f(x * radius, y * radius, z * radius); x = -sin(theta) * sin(rho + drho); y = cos(theta) * sin(rho + drho); z = nsign * cos(rho + drho); if (normals) { glNormal3f(x * nsign, y * nsign, z * nsign); } TXTR_COORD(s, t - dt); s += ds; glVertex3f(x * radius, y * radius, z * radius); } glEnd(); t -= dt; } if (!super.textureFlag) { // draw -Z end as a triangle fan glBegin(GL_TRIANGLE_FAN); glNormal3f(0.0f, 0.0f, -1.0f); glVertex3f(0.0f, 0.0f, -radius * nsign); rho = PI - drho; s = 1.0f; for (j = slices; j >= 0; j--) { theta = (j == slices) ? 0.0f : j * dtheta; x = -sin(theta) * sin(rho); y = cos(theta) * sin(rho); z = nsign * cos(rho); if (normals) glNormal3f(x * nsign, y * nsign, z * nsign); s -= ds; glVertex3f(x * radius, y * radius, z * radius); } glEnd(); } } else if ( super.drawStyle == GLU_LINE || super.drawStyle == GLU_SILHOUETTE) { // draw stack lines for (i = 1; i < stacks; i++) { // stack line at i==stacks-1 was missing here rho = i * drho; glBegin(GL_LINE_LOOP); for (j = 0; j < slices; j++) { theta = j * dtheta; x = cos(theta) * sin(rho); y = sin(theta) * sin(rho); z = cos(rho); if (normals) glNormal3f(x * nsign, y * nsign, z * nsign); glVertex3f(x * radius, y * radius, z * radius); } glEnd(); } // draw slice lines for (j = 0; j < slices; j++) { theta = j * dtheta; glBegin(GL_LINE_STRIP); for (i = 0; i <= stacks; i++) { rho = i * drho; x = cos(theta) * sin(rho); y = sin(theta) * sin(rho); z = cos(rho); if (normals) glNormal3f(x * nsign, y * nsign, z * nsign); glVertex3f(x * radius, y * radius, z * radius); } glEnd(); } } else if (super.drawStyle == GLU_POINT) { // top and bottom-most points glBegin(GL_POINTS); if (normals) glNormal3f(0.0f, 0.0f, nsign); glVertex3f(0.0f, 0.0f, radius); if (normals) glNormal3f(0.0f, 0.0f, -nsign); glVertex3f(0.0f, 0.0f, -radius); // loop over stacks for (i = 1; i < stacks - 1; i++) { rho = i * drho; for (j = 0; j < slices; j++) { theta = j * dtheta; x = cos(theta) * sin(rho); y = sin(theta) * sin(rho); z = cos(rho); if (normals) glNormal3f(x * nsign, y * nsign, z * nsign); glVertex3f(x * radius, y * radius, z * radius); } } glEnd(); } } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/GLU.java0000644000175000017500000003524111543426510020402 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.glu; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; import org.lwjgl.opengl.Util; import org.lwjgl.util.glu.tessellation.GLUtessellatorImpl; import static org.lwjgl.opengl.GL11.*; /** * GLU.java * * * Created 23-dec-2003 * @author Erik Duijs */ public class GLU { static final float PI = (float)Math.PI; /* Errors: (return value 0 = no error) */ public static final int GLU_INVALID_ENUM = 100900; public static final int GLU_INVALID_VALUE = 100901; public static final int GLU_OUT_OF_MEMORY = 100902; public static final int GLU_INCOMPATIBLE_GL_VERSION = 100903; /* StringName */ public static final int GLU_VERSION = 100800; public static final int GLU_EXTENSIONS = 100801; /* Boolean */ public static final boolean GLU_TRUE = true; public static final boolean GLU_FALSE = false; /**** Quadric constants ****/ /* QuadricNormal */ public static final int GLU_SMOOTH = 100000; public static final int GLU_FLAT = 100001; public static final int GLU_NONE = 100002; /* QuadricDrawStyle */ public static final int GLU_POINT = 100010; public static final int GLU_LINE = 100011; public static final int GLU_FILL = 100012; public static final int GLU_SILHOUETTE = 100013; /* QuadricOrientation */ public static final int GLU_OUTSIDE = 100020; public static final int GLU_INSIDE = 100021; /* Callback types: */ /* ERROR = 100103 */ /**** Tesselation constants ****/ public static final double GLU_TESS_MAX_COORD = 1.0e150; public static final double TESS_MAX_COORD = 1.0e150; /* TessProperty */ public static final int GLU_TESS_WINDING_RULE = 100140; public static final int GLU_TESS_BOUNDARY_ONLY = 100141; public static final int GLU_TESS_TOLERANCE = 100142; /* TessWinding */ public static final int GLU_TESS_WINDING_ODD = 100130; public static final int GLU_TESS_WINDING_NONZERO = 100131; public static final int GLU_TESS_WINDING_POSITIVE = 100132; public static final int GLU_TESS_WINDING_NEGATIVE = 100133; public static final int GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; /* TessCallback */ public static final int GLU_TESS_BEGIN = 100100; /* void (CALLBACK*)(GLenum type) */ public static final int GLU_TESS_VERTEX = 100101; /* void (CALLBACK*)(void *data) */ public static final int GLU_TESS_END = 100102; /* void (CALLBACK*)(void) */ public static final int GLU_TESS_ERROR = 100103; /* void (CALLBACK*)(GLenum errno) */ public static final int GLU_TESS_EDGE_FLAG = 100104; /* void (CALLBACK*)(GLboolean boundaryEdge) */ public static final int GLU_TESS_COMBINE = 100105; /* void (CALLBACK*)(GLdouble coords[3], void *data[4], GLfloat weight[4], void **dataOut) */ public static final int GLU_TESS_BEGIN_DATA = 100106; /* void (CALLBACK*)(GLenum type, void *polygon_data) */ public static final int GLU_TESS_VERTEX_DATA = 100107; /* void (CALLBACK*)(void *data, void *polygon_data) */ public static final int GLU_TESS_END_DATA = 100108; /* void (CALLBACK*)(void *polygon_data) */ public static final int GLU_TESS_ERROR_DATA = 100109; /* void (CALLBACK*)(GLenum errno, void *polygon_data) */ public static final int GLU_TESS_EDGE_FLAG_DATA = 100110; /* void (CALLBACK*)(GLboolean boundaryEdge, void *polygon_data) */ public static final int GLU_TESS_COMBINE_DATA = 100111; /* void (CALLBACK*)(GLdouble coords[3], void *data[4], GLfloat weight[4], void **dataOut, void *polygon_data) */ /* TessError */ public static final int GLU_TESS_ERROR1 = 100151; public static final int GLU_TESS_ERROR2 = 100152; public static final int GLU_TESS_ERROR3 = 100153; public static final int GLU_TESS_ERROR4 = 100154; public static final int GLU_TESS_ERROR5 = 100155; public static final int GLU_TESS_ERROR6 = 100156; public static final int GLU_TESS_ERROR7 = 100157; public static final int GLU_TESS_ERROR8 = 100158; public static final int GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1; public static final int GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2; public static final int GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3; public static final int GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4; public static final int GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5; public static final int GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6; /**** NURBS constants ****/ /* NurbsProperty */ public static final int GLU_AUTO_LOAD_MATRIX = 100200; public static final int GLU_CULLING = 100201; public static final int GLU_SAMPLING_TOLERANCE = 100203; public static final int GLU_DISPLAY_MODE = 100204; public static final int GLU_PARAMETRIC_TOLERANCE = 100202; public static final int GLU_SAMPLING_METHOD = 100205; public static final int GLU_U_STEP = 100206; public static final int GLU_V_STEP = 100207; /* NurbsSampling */ public static final int GLU_PATH_LENGTH = 100215; public static final int GLU_PARAMETRIC_ERROR = 100216; public static final int GLU_DOMAIN_DISTANCE = 100217; /* NurbsTrim */ public static final int GLU_MAP1_TRIM_2 = 100210; public static final int GLU_MAP1_TRIM_3 = 100211; /* NurbsDisplay */ /* FILL = 100012 */ public static final int GLU_OUTLINE_POLYGON = 100240; public static final int GLU_OUTLINE_PATCH = 100241; /* NurbsCallback */ /* ERROR = 100103 */ /* NurbsErrors */ public static final int GLU_NURBS_ERROR1 = 100251; public static final int GLU_NURBS_ERROR2 = 100252; public static final int GLU_NURBS_ERROR3 = 100253; public static final int GLU_NURBS_ERROR4 = 100254; public static final int GLU_NURBS_ERROR5 = 100255; public static final int GLU_NURBS_ERROR6 = 100256; public static final int GLU_NURBS_ERROR7 = 100257; public static final int GLU_NURBS_ERROR8 = 100258; public static final int GLU_NURBS_ERROR9 = 100259; public static final int GLU_NURBS_ERROR10 = 100260; public static final int GLU_NURBS_ERROR11 = 100261; public static final int GLU_NURBS_ERROR12 = 100262; public static final int GLU_NURBS_ERROR13 = 100263; public static final int GLU_NURBS_ERROR14 = 100264; public static final int GLU_NURBS_ERROR15 = 100265; public static final int GLU_NURBS_ERROR16 = 100266; public static final int GLU_NURBS_ERROR17 = 100267; public static final int GLU_NURBS_ERROR18 = 100268; public static final int GLU_NURBS_ERROR19 = 100269; public static final int GLU_NURBS_ERROR20 = 100270; public static final int GLU_NURBS_ERROR21 = 100271; public static final int GLU_NURBS_ERROR22 = 100272; public static final int GLU_NURBS_ERROR23 = 100273; public static final int GLU_NURBS_ERROR24 = 100274; public static final int GLU_NURBS_ERROR25 = 100275; public static final int GLU_NURBS_ERROR26 = 100276; public static final int GLU_NURBS_ERROR27 = 100277; public static final int GLU_NURBS_ERROR28 = 100278; public static final int GLU_NURBS_ERROR29 = 100279; public static final int GLU_NURBS_ERROR30 = 100280; public static final int GLU_NURBS_ERROR31 = 100281; public static final int GLU_NURBS_ERROR32 = 100282; public static final int GLU_NURBS_ERROR33 = 100283; public static final int GLU_NURBS_ERROR34 = 100284; public static final int GLU_NURBS_ERROR35 = 100285; public static final int GLU_NURBS_ERROR36 = 100286; public static final int GLU_NURBS_ERROR37 = 100287; /* Contours types -- obsolete! */ public static final int GLU_CW = 100120; public static final int GLU_CCW = 100121; public static final int GLU_INTERIOR = 100122; public static final int GLU_EXTERIOR = 100123; public static final int GLU_UNKNOWN = 100124; /* Names without "TESS_" prefix */ public static final int GLU_BEGIN = GLU_TESS_BEGIN; public static final int GLU_VERTEX = GLU_TESS_VERTEX; public static final int GLU_END = GLU_TESS_END; public static final int GLU_ERROR = GLU_TESS_ERROR; public static final int GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG; /** * Method gluLookAt * @param eyex * @param eyey * @param eyez * @param centerx * @param centery * @param centerz * @param upx * @param upy * @param upz */ public static void gluLookAt( float eyex, float eyey, float eyez, float centerx, float centery, float centerz, float upx, float upy, float upz) { Project.gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz); } /** * Method gluOrtho2D * @param left * @param right * @param bottom * @param top */ public static void gluOrtho2D( float left, float right, float bottom, float top) { glOrtho(left, right, bottom, top, -1.0, 1.0); } /** * Method gluPerspective * @param fovy * @param aspect * @param zNear * @param zFar */ public static void gluPerspective( float fovy, float aspect, float zNear, float zFar) { Project.gluPerspective(fovy, aspect, zNear, zFar); } /** * Method gluProject * @param objx * @param objy * @param objz * @param modelMatrix * @param projMatrix * @param viewport * @param win_pos */ public static boolean gluProject(float objx, float objy, float objz, FloatBuffer modelMatrix, FloatBuffer projMatrix, IntBuffer viewport, FloatBuffer win_pos) { return Project.gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, win_pos); } /** * Method gluUnproject * @param winx * @param winy * @param winz * @param modelMatrix * @param projMatrix * @param viewport * @param obj_pos */ public static boolean gluUnProject(float winx, float winy, float winz, FloatBuffer modelMatrix, FloatBuffer projMatrix, IntBuffer viewport, FloatBuffer obj_pos) { return Project.gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, obj_pos); } /** * Method gluPickMatrix * @param x * @param y * @param width * @param height * @param viewport */ public static void gluPickMatrix( float x, float y, float width, float height, IntBuffer viewport) { Project.gluPickMatrix(x, y, width, height, viewport); } /** * Method gluGetString. * @param name * @return String */ public static String gluGetString(int name) { return Registry.gluGetString(name); } /** * Method gluCheckExtension. * @param extName * @param extString * @return boolean */ public static boolean gluCheckExtension(String extName, String extString) { return Registry.gluCheckExtension(extName, extString); } /** * Method gluBuild2DMipmaps * @param target * @param components * @param width * @param height * @param format * @param type * @param data * @return int */ public static int gluBuild2DMipmaps( int target, int components, int width, int height, int format, int type, ByteBuffer data) { return MipMap.gluBuild2DMipmaps(target, components, width, height, format, type, data); } /** * Method gluScaleImage. * @param format * @param widthIn * @param heightIn * @param typeIn * @param dataIn * @param widthOut * @param heightOut * @param typeOut * @param dataOut * @return int */ public static int gluScaleImage( int format, int widthIn, int heightIn, int typeIn, ByteBuffer dataIn, int widthOut, int heightOut, int typeOut, ByteBuffer dataOut) { return MipMap.gluScaleImage(format, widthIn, heightIn, typeIn, dataIn, widthOut, heightOut, typeOut, dataOut); } public static String gluErrorString(int error_code) { switch (error_code) { case GLU_INVALID_ENUM: return "Invalid enum (glu)"; case GLU_INVALID_VALUE: return "Invalid value (glu)"; case GLU_OUT_OF_MEMORY: return "Out of memory (glu)"; default: return Util.translateGLErrorString(error_code); } } public static GLUtessellator gluNewTess() { return new GLUtessellatorImpl(); } } lwjgl-2.7.1/src/java/org/lwjgl/util/glu/PixelStoreState.java0000644000175000017500000000567011543426510023055 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.glu; import static org.lwjgl.opengl.GL11.*; /** * PixelStoreState.java * * * Created 11-jan-2004 * @author Erik Duijs */ class PixelStoreState extends Util { public int unpackRowLength; public int unpackAlignment; public int unpackSkipRows; public int unpackSkipPixels; public int packRowLength; public int packAlignment; public int packSkipRows; public int packSkipPixels; /** * Constructor for PixelStoreState. */ PixelStoreState() { super(); load(); } public void load() { unpackRowLength = glGetIntegerv(GL_UNPACK_ROW_LENGTH); unpackAlignment = glGetIntegerv(GL_UNPACK_ALIGNMENT); unpackSkipRows = glGetIntegerv(GL_UNPACK_SKIP_ROWS); unpackSkipPixels = glGetIntegerv(GL_UNPACK_SKIP_PIXELS); packRowLength = glGetIntegerv(GL_PACK_ROW_LENGTH); packAlignment = glGetIntegerv(GL_PACK_ALIGNMENT); packSkipRows = glGetIntegerv(GL_PACK_SKIP_ROWS); packSkipPixels = glGetIntegerv(GL_PACK_SKIP_PIXELS); } public void save() { glPixelStorei(GL_UNPACK_ROW_LENGTH, unpackRowLength); glPixelStorei(GL_UNPACK_ALIGNMENT, unpackAlignment); glPixelStorei(GL_UNPACK_SKIP_ROWS, unpackSkipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, unpackSkipPixels); glPixelStorei(GL_PACK_ROW_LENGTH, packRowLength); glPixelStorei(GL_PACK_ALIGNMENT, packAlignment); glPixelStorei(GL_PACK_SKIP_ROWS, packSkipRows); glPixelStorei(GL_PACK_SKIP_PIXELS, packSkipPixels); } } lwjgl-2.7.1/src/java/org/lwjgl/util/applet/0000755000175000017500000000000011543426510017601 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/util/applet/AppletLoader.java0000644000175000017500000015006211543426510023024 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.applet; import java.applet.Applet; import java.applet.AppletStub; import java.awt.BorderLayout; import java.awt.Color; import java.awt.EventQueue; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Image; import java.awt.MediaTracker; import java.awt.image.ImageObserver; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FilePermission; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.net.HttpURLConnection; import java.net.JarURLConnection; import java.net.SocketPermission; import java.net.URL; import java.net.URLClassLoader; import java.net.URLConnection; import java.security.AccessControlException; import java.security.AccessController; import java.security.CodeSource; import java.security.PermissionCollection; import java.security.PrivilegedExceptionAction; import java.security.SecureClassLoader; import java.security.cert.Certificate; import java.util.Enumeration; import java.util.HashMap; import java.util.StringTokenizer; import java.util.Vector; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.JarOutputStream; import java.util.jar.Pack200; import java.util.zip.GZIPInputStream; import sun.security.util.SecurityConstants; /** *

* The AppletLoader enables deployment of LWJGL to applets in an easy * and polished way. The loader will display a configurable logo and progressbar * while the relevant jars (generic and native) are downloaded from a specified source. *

*

* The downloaded jars are extracted to the users temporary directory - and if enabled, cached for * faster loading in future uses. *

*

* The following applet parameters are required: *

    *
  • al_main - [String] Full package and class the applet to instantiate and display when loaded.
  • *
  • al_logo - [String Path of of the logo resource to paint while loading.
  • *
  • al_progressbar - [String] Path of the progressbar resource to paint on top of the logo, width clipped by percentage.
  • *
  • al_jars - [String] Comma seperated list of jars to download.
  • *
  • al_windows - [String] Jar containing native files for windows.
  • *
  • al_linux - [String] Jar containing native files for linux.
  • *
  • al_mac - [String] Jar containing native files for mac.
  • *
  • al_solaris - [String] Jar containing native files for solaris.
  • *
  • al_freebsd - [String] Jar containing native files for freebsd.
  • *
*

*

* Additionally the following parameters can be supplied to tweak the behaviour of the AppletLoader. *

    *
  • al_version - [int or float] Version of deployment. If this is specified, the jars will be cached and * reused if the version matches. If version doesn't match all of the files are reloaded.
  • *
  • al_cache - [boolean] Whether to use cache system. Default: true.
  • *
  • al_debug - [boolean] Whether to enable debug mode. Default: false.
  • *
  • al_prepend_host - [boolean] Whether to limit caching to this domain, disable if your applet is hosted on multple domains and needs to share the cache. Default: true.
  • *
      *
    • al_windows64 - [String] If specified it will be used instead of al_windows on 64bit windows systems.
    • *
    • al_windows32 - [String] If specifed it will be used instead of al_windows on 32bit windows systems.
    • *
    • al_linux64 - [String] If specifed it will be used instead of al_linux on 64bit linux systems.
    • *
    • al_linux32 - [String] If specifed it will be used instead of al_linux on 32bit linux systems.
    • *
        *
      • boxbgcolor - [String] any String AWT color ("red", "blue", etc), RGB (0-255) or hex formated color (#RRGGBB) to use as background. Default: #ffffff.
      • *
      • boxfgcolor - [String] any String AWT color ("red", "blue", etc), RGB (0-255) or hex formated color (#RRGGBB) to use as foreground. Default: #000000.
      • *
      *

      * @author kappaOne * @author Brian Matzon * @version $Revision$ * $Id$ */ public class AppletLoader extends Applet implements Runnable, AppletStub { /** initializing */ public static final int STATE_INIT = 1; /** determining which packages that are required */ public static final int STATE_DETERMINING_PACKAGES = 2; /** checking for already downloaded files */ public static final int STATE_CHECKING_CACHE = 3; /** downloading packages */ public static final int STATE_DOWNLOADING = 4; /** extracting packages */ public static final int STATE_EXTRACTING_PACKAGES = 5; /** updating the classpath */ public static final int STATE_UPDATING_CLASSPATH = 6; /** switching to real applet */ public static final int STATE_SWITCHING_APPLET = 7; /** initializing real applet */ public static final int STATE_INITIALIZE_REAL_APPLET = 8; /** stating real applet */ public static final int STATE_START_REAL_APPLET = 9; /** done */ public static final int STATE_DONE = 10; /** used to calculate length of progress bar */ protected int percentage; /** current size of download in bytes */ protected int currentSizeDownload; /** total size of download in bytes */ protected int totalSizeDownload; /** current size of extracted in bytes */ protected int currentSizeExtract; /** total size of extracted in bytes */ protected int totalSizeExtract; /** logo to be shown while loading */ protected Image logo, logoBuffer; /** progressbar to render while loading */ protected Image progressbar, progressbarBuffer; /** offscreen image used */ protected Image offscreen; /** set to true while painting is done */ protected boolean painting; /** background color of applet */ protected Color bgColor = Color.white; /** color to write foreground in */ protected Color fgColor = Color.black; /** urls of the jars to download */ protected URL[] urlList; /** classLoader used to add downloaded jars to the classpath */ protected ClassLoader classLoader; /** actual thread that does the loading */ protected Thread loaderThread; /** animation thread that renders our load screen while loading */ protected Thread animationThread; /** applet to load after all downloads are complete */ protected Applet lwjglApplet; /** whether a fatal error occured */ protected boolean fatalError; /** whether we're running in debug mode */ protected boolean debugMode; /** whether to prepend host to cache path */ protected boolean prependHost; /** Used to store file names with lastModified time */ protected HashMap filesLastModified; /** Sizes of files to download */ protected int[] fileSizes; /** Number of native jars */ protected int nativeJarCount; /** whether to use caching system, only download files that have changed */ protected boolean cacheEnabled; /** String to display as a subtask */ protected String subtaskMessage = ""; /** state of applet loader */ protected volatile int state = STATE_INIT; /** whether lzma is supported */ protected boolean lzmaSupported; /** whether pack200 is supported */ protected boolean pack200Supported; /** generic error message to display on error */ protected String[] genericErrorMessage = { "An error occured while loading the applet.", "Please contact support to resolve this issue.", ""}; /** whether a certificate refused error occured */ protected boolean certificateRefused; /** error message to display if user refuses to accept certicate*/ protected String[] certificateRefusedMessage = { "Permissions for Applet Refused.", "Please accept the permissions dialog to allow", "the applet to continue the loading process."}; /** have natives been loaded by another instance of this applet */ protected static boolean natives_loaded; /* * @see java.applet.Applet#init() */ public void init() { setState(STATE_INIT); // sanity check String[] requiredArgs = {"al_main", "al_logo", "al_progressbar", "al_jars"}; for ( String requiredArg : requiredArgs ) { if ( getParameter(requiredArg) == null ) { fatalErrorOccured("missing required applet parameter: " + requiredArg, null); return; } } // whether to use cache system cacheEnabled = getBooleanParameter("al_cache", true); // whether to run in debug mode debugMode = getBooleanParameter("al_debug", false); // whether to prepend host to cache path prependHost = getBooleanParameter("al_prepend_host", true); // get colors of applet bgColor = getColor("boxbgcolor", Color.white); setBackground(bgColor); fgColor = getColor("boxfgcolor", Color.black); // load logos, if value is "" then skip if (getParameter("al_logo").length() > 0) { logo = getImage(getParameter("al_logo")); } if (getParameter("al_progressbar").length() > 0) { progressbar = getImage(getParameter("al_progressbar")); } // check for lzma support try { Class.forName("LZMA.LzmaInputStream"); lzmaSupported = true; } catch (Throwable e) { /* no lzma support */ } // check pack200 support try { java.util.jar.Pack200.class.getSimpleName(); pack200Supported = true; } catch (Throwable e) { /* no pack200 support */ } } /** * Generates a stacktrace in the form of a string * @param exception Exception to make stacktrace of * @return Stacktrace of exception in the form of a string */ private static String generateStacktrace(Exception exception) { Writer result = new StringWriter(); PrintWriter printWriter = new PrintWriter(result); exception.printStackTrace(printWriter); return result.toString(); } /* * @see java.applet.Applet#start() */ public void start() { if (lwjglApplet != null) { lwjglApplet.start(); } else { if(loaderThread == null && !fatalError) { loaderThread = new Thread(this); loaderThread.setName("AppletLoader.loaderThread"); loaderThread.start(); animationThread = new Thread() { public void run() { while(loaderThread != null) { repaint(); AppletLoader.this.sleep(100); } animationThread = null; } }; animationThread.setName("AppletLoader.animationthread"); animationThread.start(); } } } /* * @see java.applet.Applet#stop() */ public void stop() { if (lwjglApplet != null) { lwjglApplet.stop(); } } /* * @see java.applet.Applet#destroy() */ public void destroy() { if (lwjglApplet != null) { lwjglApplet.destroy(); } } /** * Clean up resources */ protected void cleanUp() { progressbar = null; logo = null; logoBuffer = null; progressbarBuffer = null; offscreen = null; } /** * Retrieves the applet that has been loaded. Useful for liveconnect. */ public Applet getApplet() { return lwjglApplet; } /** * Transfers the call of AppletResize from the stub to the lwjglApplet. */ public void appletResize(int width, int height) { resize(width, height); } /* * @see java.awt.Container#update(java.awt.Graphics) */ public final void update(Graphics g) { paint(g); } /* * @see java.awt.Container#paint(java.awt.Graphics) */ public void paint(Graphics g) { // don't paint loader if applet loaded if(state == STATE_DONE) { cleanUp(); // clean up resources return; } // create offscreen if missing if (offscreen == null) { offscreen = createImage(getWidth(), getHeight()); // create buffers for animated gifs if (logo != null) { logoBuffer = createImage(logo.getWidth(null), logo.getHeight(null)); // add image observer, it will notify when next animated gif frame is ready offscreen.getGraphics().drawImage(logo, 0, 0, this); // in case image is not animated fill image buffer once imageUpdate(logo, ImageObserver.FRAMEBITS, 0, 0, 0, 0); } if (progressbar != null) { progressbarBuffer = createImage(progressbar.getWidth(null), progressbar.getHeight(null)); // add image observer, it will notify when next animated gif frame is ready offscreen.getGraphics().drawImage(progressbar, 0, 0, this); // in case image is not animated fill image buffer once imageUpdate(progressbar, ImageObserver.FRAMEBITS, 0, 0, 0, 0); } } // draw everything onto an image before drawing to avoid flicker Graphics og = offscreen.getGraphics(); FontMetrics fm = og.getFontMetrics(); // clear background color og.setColor(bgColor); og.fillRect(0, 0, offscreen.getWidth(null), offscreen.getHeight(null)); og.setColor(fgColor); String message = getDescriptionForState(); // if we had a failure of some sort, notify the user if (fatalError) { String[] errorMessage = (certificateRefused) ? certificateRefusedMessage : genericErrorMessage; for(int i=0; i 0) { messageX = (offscreen.getWidth(null) - fm.stringWidth(subtaskMessage)) / 2; og.drawString(subtaskMessage, messageX, messageY+20); } // draw loading bar, clipping it depending on percentage done if (progressbar != null) { int barSize = (progressbar.getWidth(null) * percentage) / 100; og.clipRect(x-progressbar.getWidth(null)/2, 0, barSize, offscreen.getHeight(null)); og.drawImage(progressbarBuffer, x-progressbar.getWidth(null)/2, y-progressbar.getHeight(null)/2, this); } painting = false; } og.dispose(); // finally draw it all centred g.drawImage(offscreen, (getWidth() - offscreen.getWidth(null))/2, (getHeight() - offscreen.getHeight(null))/2, null); } /** * When an animated gif frame is ready to be drawn the ImageObserver * will call this method. * * The Image frame is copied into a buffer, which is then drawn. * This is done to prevent image tearing on gif animations. */ public boolean imageUpdate(Image img, int flag, int x, int y, int width, int height) { // finish with this ImageObserver if (state == STATE_DONE) return false; // if image frame is ready to be drawn and is currently not being painted if (flag == ImageObserver.FRAMEBITS && !painting) { Image buffer; // select which buffer to fill if (img == logo) buffer = logoBuffer; else buffer = progressbarBuffer; Graphics g = buffer.getGraphics(); // clear background on buffer g.setColor(bgColor); g.fillRect(0, 0, buffer.getWidth(null), buffer.getHeight(null)); // buffer background is cleared, so draw logo under progressbar if (img == progressbar && logo != null) { g.drawImage(logoBuffer, progressbar.getWidth(null)/2-logo.getWidth(null)/2, progressbar.getHeight(null)/2-logo.getHeight(null)/2, null); } g.drawImage(img, 0, 0, this); g.dispose(); repaint(); } return true; } /** * @return string describing the state of the loader */ protected String getDescriptionForState() { switch (state) { case STATE_INIT: return "Initializing loader"; case STATE_DETERMINING_PACKAGES: return "Determining packages to load"; case STATE_CHECKING_CACHE: return "Calculating download size"; case STATE_DOWNLOADING: return "Downloading packages"; case STATE_EXTRACTING_PACKAGES: return "Extracting downloaded packages"; case STATE_UPDATING_CLASSPATH: return "Updating classpath"; case STATE_SWITCHING_APPLET: return "Switching applet"; case STATE_INITIALIZE_REAL_APPLET: return "Initializing real applet"; case STATE_START_REAL_APPLET: return "Starting real applet"; case STATE_DONE: return "Done loading"; default: return "unknown state"; } } /** * Trims the passed file string based on the available capabilities * @param file string of files to be trimmed * @return trimmed string based on capabilities of client */ protected String trimExtensionByCapabilities(String file) { if (!pack200Supported) { file = file.replaceAll(".pack", ""); } if (!lzmaSupported) { file = file.replaceAll(".lzma", ""); } return file; } /** * Reads list of jars to download and adds the urls to urlList * also finds out which OS you are on and adds appropriate native * jar to the urlList */ protected void loadJarURLs() throws Exception { setState(STATE_DETERMINING_PACKAGES); // jars to load String jarList = getParameter("al_jars"); String nativeJarList = null; String osName = System.getProperty("os.name"); if (osName.startsWith("Win")) { // check if arch specific natives have been specified if (System.getProperty("os.arch").endsWith("64")) { nativeJarList = getParameter("al_windows64"); } else { nativeJarList = getParameter("al_windows32"); } if (nativeJarList == null) { nativeJarList = getParameter("al_windows"); } } else if (osName.startsWith("Linux")) { // check if arch specific natives have been specified if (System.getProperty("os.arch").endsWith("64")) { nativeJarList = getParameter("al_linux64"); } else { nativeJarList = getParameter("al_linux32"); } if (nativeJarList == null) { nativeJarList = getParameter("al_linux"); } } else if (osName.startsWith("Mac") || osName.startsWith("Darwin")) { nativeJarList = getParameter("al_mac"); } else if (osName.startsWith("Solaris") || osName.startsWith("SunOS")) { nativeJarList = getParameter("al_solaris"); } else if (osName.startsWith("FreeBSD")) { nativeJarList = getParameter("al_freebsd"); } else { fatalErrorOccured("OS (" + osName + ") not supported", null); return; } if (nativeJarList == null) { fatalErrorOccured("no lwjgl natives files found", null); return; } jarList = trimExtensionByCapabilities(jarList); StringTokenizer jars = new StringTokenizer(jarList, ", "); nativeJarList = trimExtensionByCapabilities(nativeJarList); StringTokenizer nativeJars = new StringTokenizer(nativeJarList, ", "); int jarCount = jars.countTokens(); nativeJarCount = nativeJars.countTokens(); urlList = new URL[jarCount+nativeJarCount]; URL path = getCodeBase(); // set jars urls for (int i = 0; i < jarCount; i++) { urlList[i] = new URL(path, jars.nextToken()); } for (int i = jarCount; i < jarCount+nativeJarCount; i++) { urlList[i] = new URL(path, nativeJars.nextToken()); } } /** * 4 steps * * 1) check version of applet and decide whether to download jars * 2) download the jars * 3) extract natives * 4) add to jars to class path * 5) switch applets */ public void run() { setState(STATE_CHECKING_CACHE); percentage = 5; try { debug_sleep(2000); // parse the urls for the jars into the url list loadJarURLs(); // get path where applet will be stored String path = AccessController.doPrivileged(new PrivilegedExceptionAction() { public String run() throws Exception { // we append the code base to avoid naming collisions with al_title String codebase = ""; if(prependHost) { codebase = getCodeBase().getHost(); if(codebase == null || codebase.length() == 0) { codebase = "localhost"; } codebase += File.separator; } return getCacheDir() + File.separator + codebase + getParameter("al_title") + File.separator; } }); File dir = new File(path); // create directory if (!dir.exists()) { dir.mkdirs(); } File versionFile = new File(dir, "version"); // if specified applet version already available don't download anything boolean versionAvailable = false; // version of applet String version = getParameter("al_version"); float latestVersion = 0; // if applet version specifed, check if you have latest version of applet if (version != null) { latestVersion = Float.parseFloat(version); // if version file exists if (versionFile.exists()) { // compare to new version if (latestVersion != readVersionFile(versionFile)) { versionAvailable = true; percentage = 90; if(debugMode) { System.out.println("Loading Cached Applet Version " + latestVersion); } debug_sleep(2000); } } } // if jars not available or need updating download them if (!versionAvailable) { // get jars file sizes and check cache getJarInfo(dir); // 5-15% // downloads jars from the server downloadJars(path); // 15-55% // Extract Pack and LZMA files extractJars(path); // 55-65% // Extracts Native Files extractNatives(path); // 65-85% // save version information once jars downloaded successfully if (version != null) { percentage = 90; writeVersionFile(versionFile, latestVersion); } // save file names with last modified info once downloaded successfully writeCacheFile(new File(dir, "cache"), filesLastModified); } // add the downloaded jars and natives to classpath updateClassPath(path); // set lwjgl properties setLWJGLProperties(); // make applet switch on EDT as an AWT/Swing permission dialog could be called EventQueue.invokeAndWait(new Runnable() { public void run() { try { switchApplet(); } catch (Exception e) { fatalErrorOccured("This occurred while '" + getDescriptionForState() + "'", e); } setState(STATE_DONE); repaint(); } }); } catch (AccessControlException ace) { fatalErrorOccured(ace.getMessage(), ace); certificateRefused = true; } catch (Exception e) { fatalErrorOccured("This occurred while '" + getDescriptionForState() + "'", e); } finally { loaderThread = null; } } /** * Parses the java_arguments list and sets lwjgl specific * properties accordingly, before the launch. */ protected void setLWJGLProperties() { String lwjglArguments = getParameter("lwjgl_arguments"); if(lwjglArguments != null && lwjglArguments.length() > 0) { int start = lwjglArguments.indexOf("-Dorg.lwjgl"); while(start != -1) { int end = lwjglArguments.indexOf(" ", start); if(end == -1) { end = lwjglArguments.length(); } String[] keyValue = lwjglArguments.substring(start+2, end).split("="); System.setProperty(keyValue[0], keyValue[1]); if(debugMode) { System.out.println("Setting property " + keyValue[0] + " to " + keyValue[1]); } start = lwjglArguments.indexOf("-Dorg.lwjgl", end); } } } /** * get path to the lwjgl cache directory * * @return path to the lwjgl cache directory */ protected String getCacheDir() { String cacheDir = System.getProperty("deployment.user.cachedir"); if (cacheDir == null || System.getProperty("os.name").startsWith("Win")) { cacheDir = System.getProperty("java.io.tmpdir"); } return cacheDir + File.separator + "lwjglcache"; } /** * read the current version file * * @param file the file to read * @return the version value of saved file * @throws Exception if it fails to read value */ protected float readVersionFile(File file) throws Exception { DataInputStream dis = new DataInputStream(new FileInputStream(file)); float version = dis.readFloat(); dis.close(); return version; } /** * write out version file of applet * * @param file the file to write out to * @param version the version of the applet as a float * @throws Exception if it fails to write file */ protected void writeVersionFile(File file, float version) throws Exception { DataOutputStream dos = new DataOutputStream(new FileOutputStream(file)); dos.writeFloat(version); dos.close(); } /** * read the current cache file * * @param file the file to read * @return the hashmap containing the files names and lastModified times * @throws Exception if it fails to read hashmap */ @SuppressWarnings("unchecked") protected HashMap readCacheFile(File file) throws Exception { ObjectInputStream dis = new ObjectInputStream(new FileInputStream(file)); HashMap hashMap = (HashMap)dis.readObject(); dis.close(); return hashMap; } /** * write out cache file of applet * * @param file the file to write out to * @param filesLastModified the hashmap containing files names and lastModified times * @throws Exception if it fails to write file */ protected void writeCacheFile(File file, HashMap filesLastModified) throws Exception { ObjectOutputStream dos = new ObjectOutputStream(new FileOutputStream(file)); dos.writeObject(filesLastModified); dos.close(); } /** * Edits the ClassPath at runtime to include the jars * that have just been downloaded and then adds the * lwjgl natives folder property. * * @param path location where applet is stored * @throws Exception if it fails to add classpath */ protected void updateClassPath(final String path) throws Exception { setState(STATE_UPDATING_CLASSPATH); percentage = 95; URL[] urls = new URL[urlList.length]; for (int i = 0; i < urlList.length; i++) { urls[i] = new URL("file:" + path + getJarName(urlList[i])); } // add downloaded jars to the classpath with required permissions classLoader = new URLClassLoader(urls) { protected PermissionCollection getPermissions (CodeSource codesource) { PermissionCollection perms = null; try { // getPermissions from original classloader is important as it checks for signed jars and shows any security dialogs needed Method method = SecureClassLoader.class.getDeclaredMethod("getPermissions", new Class[] { CodeSource.class }); method.setAccessible(true); perms = (PermissionCollection)method.invoke(getClass().getClassLoader(), new Object[] {codesource}); String host = getCodeBase().getHost(); if (host != null && (host.length() > 0)) { // add permission for downloaded jars to access host they were from perms.add(new SocketPermission(host, SecurityConstants.SOCKET_CONNECT_ACCEPT_ACTION)); } else if ( "file".equals(codesource.getLocation().getProtocol()) ) { // if running locally add file permission String path = codesource.getLocation().getFile().replace('/', File.separatorChar); perms.add(new FilePermission(path, SecurityConstants.FILE_READ_ACTION)); } } catch (Exception e) { e.printStackTrace(); } return perms; } // allow non lwjgl native to be found from cache directory protected String findLibrary (String libname) { return path + "natives" + File.separator + System.mapLibraryName(libname); } }; debug_sleep(2000); // unload natives loaded by a previous instance of this lwjgl applet unloadNatives(path); // add natives files path to native class path System.setProperty("org.lwjgl.librarypath", path + "natives"); // Make sure jinput knows about the new path too System.setProperty("net.java.games.input.librarypath", path + "natives"); // set the library path, useful for non lwjgl natives System.setProperty("java.library.path", path + "natives"); // mark natives as loaded natives_loaded = true; } /** * Unload natives loaded by a different classloader. * * Due to limitations of the jvm, native files can only * be loaded once and only be used by the classloader * they were loaded from. * * Due to the way applets on plugin1 work, one jvm must * be used for all applets. We need to use multiple * classloaders in the same jvm due to LWJGL's static * nature. In order to solve this we simply remove the * natives from a previous classloader allowing a new * classloader to use those natives in the same jvm. * * This method will only attempt to unload natives from a * previous classloader if it detects that the natives have * been loaded in the same jvm. * * @param nativePath directory where natives are stored */ private void unloadNatives(String nativePath) { // check whether natives have been loaded into this jvm if (!natives_loaded) { return; } try { Field field = ClassLoader.class.getDeclaredField("loadedLibraryNames"); field.setAccessible(true); Vector libs = (Vector) field.get(getClass().getClassLoader()); String path = new File(nativePath).getCanonicalPath(); for (int i = 0; i < libs.size(); i++) { String s = (String) libs.get(i); // if a native from the nativePath directory is loaded, unload it if (s.startsWith(path)) { libs.remove(i); i--; } } } catch (Exception e) { e.printStackTrace(); } } /** * replace the current applet with the lwjgl applet * using AppletStub and initialise and start it */ protected void switchApplet() throws Exception { setState(STATE_SWITCHING_APPLET); percentage = 100; debug_sleep(2000); Class appletClass = classLoader.loadClass(getParameter("al_main")); lwjglApplet = (Applet) appletClass.newInstance(); lwjglApplet.setStub(this); lwjglApplet.setSize(getWidth(), getHeight()); setLayout(new BorderLayout()); add(lwjglApplet); validate(); setState(STATE_INITIALIZE_REAL_APPLET); lwjglApplet.init(); setState(STATE_START_REAL_APPLET); lwjglApplet.start(); } /** * This method will get the files sizes of the files to download. * It wil further get the lastModified time of files * and save it in a hashmap, if cache is enabled it will mark * those files that have not changed since last download to not * redownloaded. * * @param dir - location to read cache file from * @throws Exception - if fails to get infomation */ protected void getJarInfo(File dir) throws Exception { filesLastModified = new HashMap(); // store file sizes and mark which files not to download fileSizes = new int[urlList.length]; URLConnection urlconnection; File cacheFile = new File(dir, "cache"); // if cache file exists, load it if (cacheFile.exists()) { filesLastModified = readCacheFile(cacheFile); } // calculate total size of jars to download for (int i = 0; i < urlList.length; i++) { urlconnection = urlList[i].openConnection(); urlconnection.setDefaultUseCaches(false); if (urlconnection instanceof HttpURLConnection) { ((HttpURLConnection) urlconnection).setRequestMethod("HEAD"); } fileSizes[i] = urlconnection.getContentLength(); long lastModified = urlconnection.getLastModified(); String fileName = getFileName(urlList[i]); if (cacheEnabled && lastModified != 0 && filesLastModified.containsKey(fileName)) { long savedLastModified = filesLastModified.get(fileName); // if lastModifed time is the same, don't redownload if (savedLastModified == lastModified) { fileSizes[i] = -2; // mark it to not redownload } } if (fileSizes[i] >= 0) { totalSizeDownload += fileSizes[i]; } // put key and value in the hashmap filesLastModified.put(fileName, lastModified); // update progress bar percentage = 5 + (int)(10 * i/(float)urlList.length); } } /** * Will download the jars from the server using the list of urls * in urlList, while at the same time updating progress bar * * @param path location of the directory to save to * @throws Exception if download fails */ protected void downloadJars(String path) throws Exception { setState(STATE_DOWNLOADING); URLConnection urlconnection; int initialPercentage = percentage = 15; // download each jar byte buffer[] = new byte[65536]; for (int i = 0; i < urlList.length; i++) { // skip file if marked as -2 (already downloaded and not changed) if (fileSizes[i] == -2) continue; int unsuccessfulAttempts = 0; int maxUnsuccessfulAttempts = 3; boolean downloadFile = true; // download the jar a max of 3 times while(downloadFile) { downloadFile = false; debug_sleep(2000); urlconnection = urlList[i].openConnection(); if (urlconnection instanceof HttpURLConnection) { urlconnection.setRequestProperty("Cache-Control", "no-cache"); urlconnection.connect(); } String currentFile = getFileName(urlList[i]); InputStream inputstream = getJarInputStream(currentFile, urlconnection); FileOutputStream fos = new FileOutputStream(path + currentFile); int bufferSize; long downloadStartTime = System.currentTimeMillis(); int downloadedAmount = 0; int fileSize = 0; String downloadSpeedMessage = ""; while ((bufferSize = inputstream.read(buffer, 0, buffer.length)) != -1) { debug_sleep(10); fos.write(buffer, 0, bufferSize); currentSizeDownload += bufferSize; fileSize += bufferSize; percentage = initialPercentage + ((currentSizeDownload * 45) / totalSizeDownload); subtaskMessage = "Retrieving: " + currentFile + " " + ((currentSizeDownload * 100) / totalSizeDownload) + "%"; downloadedAmount += bufferSize; long timeLapse = System.currentTimeMillis() - downloadStartTime; // update only if a second or more has passed if (timeLapse >= 1000) { // get kb/s, nice that bytes/millis is same as kilobytes/seconds float downloadSpeed = (float) downloadedAmount / timeLapse; // round to two decimal places downloadSpeed = ((int)(downloadSpeed*100))/100f; // set current speed message downloadSpeedMessage = " - " + downloadSpeed + " KB/sec"; // reset downloaded amount downloadedAmount = 0; // reset start time downloadStartTime = System.currentTimeMillis(); } subtaskMessage += downloadSpeedMessage; } inputstream.close(); fos.close(); // download complete, verify if it was successful if (urlconnection instanceof HttpURLConnection) { if (fileSize == fileSizes[i]) { // successful download } else if (fileSizes[i] <= 0) { // If contentLength for fileSizes[i] <= 0, we don't know if the download // is complete. We're going to guess the download is complete. } else { unsuccessfulAttempts++; // download failed try again if (unsuccessfulAttempts < maxUnsuccessfulAttempts) { downloadFile = true; currentSizeDownload -= fileSize; // reset progress bar } else { // retry attempts exhasted, download failed throw new Exception("failed to download " + currentFile); } } } } } subtaskMessage = ""; } /** * Retrieves a jar files input stream. This method exists primarily to fix an Opera hang in getInputStream * @param urlconnection connection to get input stream from * @return InputStream or null if not possible */ protected InputStream getJarInputStream(final String currentFile, final URLConnection urlconnection) throws Exception { final InputStream[] is = new InputStream[1]; // try to get the input stream 3 times. // Wait at most 5 seconds before interrupting the thread for (int j = 0; j < 3 && is[0] == null; j++) { Thread t = new Thread() { public void run() { try { is[0] = urlconnection.getInputStream(); } catch (IOException e) { /* ignored */ } } }; t.setName("JarInputStreamThread"); t.start(); int iterationCount = 0; while(is[0] == null && iterationCount++ < 5) { try { t.join(1000); } catch (InterruptedException inte) { /* ignored */ } } if(is[0] == null) { try { t.interrupt(); t.join(); } catch (InterruptedException inte) { /* ignored */ } } } if(is[0] == null) { throw new Exception("Unable to get input stream for " + currentFile); } return is[0]; } /** * Extract LZMA File * @param in Input path to pack file * @param out output path to resulting file * @throws Exception if any errors occur */ protected void extractLZMA(String in, String out) throws Exception { File f = new File(in); FileInputStream fileInputHandle = new FileInputStream(f); // use reflection to avoid hard dependency Class clazz = Class.forName( "LZMA.LzmaInputStream" ); Constructor constructor = clazz.getDeclaredConstructor(InputStream.class); InputStream inputHandle = (InputStream) constructor.newInstance(fileInputHandle); OutputStream outputHandle; outputHandle = new FileOutputStream(out); byte [] buffer = new byte [1<<14]; int ret = inputHandle.read(buffer); while (ret >= 1) { outputHandle.write(buffer,0,ret); ret = inputHandle.read(buffer); } inputHandle.close(); outputHandle.close(); outputHandle = null; inputHandle = null; // delete LZMA file, as it is no longer needed f.delete(); } /** * Extract GZip File * @param in Input path to pack file * @param out output path to resulting file * @throws Exception if any errors occur */ protected void extractGZip(String in, String out) throws Exception { File f = new File(in); FileInputStream fileInputHandle = new FileInputStream(f); InputStream inputHandle = new GZIPInputStream(fileInputHandle); OutputStream outputHandle; outputHandle = new FileOutputStream(out); byte [] buffer = new byte [1<<14]; int ret = inputHandle.read(buffer); while (ret >= 1) { outputHandle.write(buffer,0,ret); ret = inputHandle.read(buffer); } inputHandle.close(); outputHandle.close(); outputHandle = null; inputHandle = null; // delete GZip file, as it is no longer needed f.delete(); } /** * Extract Pack File * @param in Input path to pack file * @param out output path to resulting file * @throws Exception if any errors occur */ protected void extractPack(String in, String out) throws Exception { File f = new File(in); FileOutputStream fostream = new FileOutputStream(out); JarOutputStream jostream = new JarOutputStream(fostream); Pack200.Unpacker unpacker = Pack200.newUnpacker(); unpacker.unpack(f, jostream); jostream.close(); // delete pack file as its no longer needed f.delete(); } /** * Extract all jars from any lzma/gz/pack files * * @param path output path * @throws Exception if any errors occur */ protected void extractJars(String path) throws Exception { setState(STATE_EXTRACTING_PACKAGES); float increment = (float) 10.0 / urlList.length; // extract all gz, lzma, pack.gz and pack.lzma files for (int i = 0; i < urlList.length; i++) { // if file has not changed, skip it if (fileSizes[i] == -2) continue; percentage = 55 + (int) (increment * (i+1)); String filename = getFileName(urlList[i]); if (filename.endsWith(".pack.lzma")) { subtaskMessage = "Extracting: " + filename + " to " + filename.replaceAll(".lzma", ""); debug_sleep(1000); extractLZMA(path + filename, path + filename.replaceAll(".lzma", "")); subtaskMessage = "Extracting: " + filename.replaceAll(".lzma", "") + " to " + filename.replaceAll(".pack.lzma", ""); debug_sleep(1000); extractPack(path + filename.replaceAll(".lzma", ""), path + filename.replaceAll(".pack.lzma", "")); } else if (filename.endsWith(".pack.gz")) { subtaskMessage = "Extracting: " + filename + " to " + filename.replaceAll(".gz", ""); debug_sleep(1000); extractGZip(path + filename, path + filename.replaceAll(".gz", "")); subtaskMessage = "Extracting: " + filename.replaceAll(".gz", "") + " to " + filename.replaceAll(".pack.gz", ""); debug_sleep(1000); extractPack(path + filename.replaceAll(".gz", ""), path + filename.replaceAll(".pack.gz", "")); } else if (filename.endsWith(".pack")) { subtaskMessage = "Extracting: " + filename + " to " + filename.replace(".pack", ""); debug_sleep(1000); extractPack(path + filename, path + filename.replace(".pack", "")); } else if (filename.endsWith(".lzma")) { subtaskMessage = "Extracting: " + filename + " to " + filename.replace(".lzma", ""); debug_sleep(1000); extractLZMA(path + filename, path + filename.replace(".lzma", "")); } else if (filename.endsWith(".gz")) { subtaskMessage = "Extracting: " + filename + " to " + filename.replace(".gz", ""); debug_sleep(1000); extractGZip(path + filename, path + filename.replace(".gz", "")); } } } /** * This method will extract all file from the native jar and extract them * to the subdirectory called "natives" in the local path, will also check * to see if the native jar files is signed properly * * @param path base folder containing all downloaded jars * @throws Exception if it fails to extract files */ protected void extractNatives(String path) throws Exception { setState(STATE_EXTRACTING_PACKAGES); float percentageParts = 20f/nativeJarCount; // parts for each native jar from 20% // create native folder File nativeFolder = new File(path + "natives"); if (!nativeFolder.exists()) { nativeFolder.mkdir(); } // get the current certificate to compare against native files Certificate[] certificate = AppletLoader.class.getProtectionDomain().getCodeSource().getCertificates(); // workaround for bug where cached applet loader does not have certificates!? if (certificate == null) { URL location = AppletLoader.class.getProtectionDomain().getCodeSource().getLocation(); // manually load the certificate JarURLConnection jurl = (JarURLConnection) (new URL("jar:" + location.toString() + "!/org/lwjgl/util/applet/AppletLoader.class").openConnection()); jurl.setDefaultUseCaches(true); certificate = jurl.getCertificates(); } for (int i = urlList.length - nativeJarCount; i < urlList.length; i++) { // if a new native jar was not downloaded, no extracting needed if (fileSizes[i] == -2) { continue; } // get name of jar file with natives from urlList String nativeJar = getJarName(urlList[i]); // open jar file JarFile jarFile = new JarFile(path + nativeJar, true); // get list of files in jar Enumeration entities = jarFile.entries(); totalSizeExtract = 0; int jarNum = i - (urlList.length - nativeJarCount); // used for progressbar // calculate the size of the files to extract for progress bar while (entities.hasMoreElements()) { JarEntry entry = (JarEntry) entities.nextElement(); // skip directories and anything in directories // conveniently ignores the manifest if (entry.isDirectory() || entry.getName().indexOf('/') != -1) { continue; } totalSizeExtract += entry.getSize(); } currentSizeExtract = 0; // reset point to begining by getting list of file again entities = jarFile.entries(); // extract all files from the jar while (entities.hasMoreElements()) { JarEntry entry = (JarEntry) entities.nextElement(); // skip directories and anything in directories // conveniently ignores the manifest if (entry.isDirectory() || entry.getName().indexOf('/') != -1) { continue; } // check if native file already exists if so delete it to make room for new one // useful when using the reload button on the browser File f = new File(path + "natives" + File.separator + entry.getName()); if (f.exists()) { if (!f.delete()) { continue; // unable to delete file, it is in use, skip extracting it } } debug_sleep(1000); InputStream in = jarFile.getInputStream(jarFile.getEntry(entry.getName())); OutputStream out = new FileOutputStream(path + "natives" + File.separator + entry.getName()); int bufferSize; byte buffer[] = new byte[65536]; while ((bufferSize = in.read(buffer, 0, buffer.length)) != -1) { debug_sleep(10); out.write(buffer, 0, bufferSize); currentSizeExtract += bufferSize; // update progress bar percentage = 65 + (int)(percentageParts * (jarNum + currentSizeExtract/(float)totalSizeExtract)); subtaskMessage = "Extracting: " + entry.getName() + " " + ((currentSizeExtract * 100) / totalSizeExtract) + "%"; } // validate if the certificate for native file is correct validateCertificateChain(certificate, entry.getCertificates()); in.close(); out.close(); } subtaskMessage = ""; jarFile.close(); // delete native jar as it is no longer needed File f = new File(path + nativeJar); f.delete(); } } /** * Validates the certificate chain for a single file * * @param ownCerts Chain of certificates to check against * @param native_certs Chain of certificates to check */ protected static void validateCertificateChain(Certificate[] ownCerts, Certificate[] native_certs) throws Exception { if (native_certs == null) throw new Exception("Unable to validate certificate chain. Native entry did not have a certificate chain at all"); if (ownCerts.length != native_certs.length) throw new Exception("Unable to validate certificate chain. Chain differs in length [" + ownCerts.length + " vs " + native_certs.length + "]"); for (int i = 0; i < ownCerts.length; i++) { if (!ownCerts[i].equals(native_certs[i])) { throw new Exception("Certificate mismatch: " + ownCerts[i] + " != " + native_certs[i]); } } } /** * Get Image from path provided * * @param s location of the image * @return the Image file */ protected Image getImage(String s) { Image image = null; try { image = getImage(new URL(getCodeBase(), s)); } catch (Exception e) { /* */ } // if image failed to load, try another method if (image == null) { image = getImage(Thread.currentThread().getContextClassLoader().getResource(s)); } // if image loaded sucessfully return it if (image != null) { return image; } // show error as image could not be loaded fatalErrorOccured("Unable to load logo and progressbar images", null); return null; } /** * Get Image from path provided * * @param url location of the image * @return the Image file */ public Image getImage(URL url) { try { Image image = super.getImage(url); // wait for image to load MediaTracker tracker = new MediaTracker(this); tracker.addImage(image, 0); tracker.waitForAll(); // if no errors return image if (!tracker.isErrorAny()) { return image; } } catch (Exception e) { /* */ } return null; } /** * Get jar name from URL. * * @param url Get jar file name from this url * @return file name as string */ protected String getJarName(URL url) { String fileName = url.getFile(); if (fileName.endsWith(".pack.lzma")) { fileName = fileName.replaceAll(".pack.lzma", ""); } else if (fileName.endsWith(".pack.gz")) { fileName = fileName.replaceAll(".pack.gz", ""); } else if (fileName.endsWith(".pack")) { fileName = fileName.replaceAll(".pack", ""); } else if (fileName.endsWith(".lzma")) { fileName = fileName.replaceAll(".lzma", ""); } else if (fileName.endsWith(".gz")) { fileName = fileName.replaceAll(".gz", ""); } return fileName.substring(fileName.lastIndexOf('/') + 1); } /** * Get file name portion of URL. * * @param url Get file name from this url * @return file name as string */ protected String getFileName(URL url) { String fileName = url.getFile(); return fileName.substring(fileName.lastIndexOf('/') + 1); } /** * Retrieves the color * * @param param Color to load * @param defaultColor Default color to use if no color to load * @return Color to use */ protected Color getColor(String param, Color defaultColor) { String color = getParameter(param); if (color == null) return defaultColor; // Check if RGB format if (color.indexOf(",") != -1) { StringTokenizer st = new StringTokenizer(color, ","); // We've got three components for the color try { return new Color(Integer.parseInt(st.nextToken().trim()), Integer.parseInt(st.nextToken().trim()), Integer.parseInt(st.nextToken().trim())); } catch (Exception e) { // failed to parse return defaultColor; } } // Check & decode if the color is in hexadecimal color format (i.e. #808000) try { return Color.decode(color); } catch (NumberFormatException e) { // ignore exception } // Get the color by name if it exists try { return (Color)Color.class.getField(color).get(null); } catch (Exception e) { return defaultColor; } } /** * Retrieves the boolean value for the applet * @param name Name of parameter * @param defaultValue default value to return if no such parameter * @return value of parameter or defaultValue */ protected boolean getBooleanParameter(String name, boolean defaultValue) { String parameter = getParameter(name); if(parameter != null) { return Boolean.parseBoolean(parameter); } return defaultValue; } /** * Sets the state of the loaded and prints some debug information * * @param error Error message to print */ protected void fatalErrorOccured(String error, Exception e) { fatalError = true; genericErrorMessage[genericErrorMessage.length-1] = error; System.out.println(error); if(e != null) { System.out.println(e.getMessage()); System.out.println(generateStacktrace(e)); } repaint(); } /** * set the state of applet loader * @param new state of applet loader * */ protected void setState(int state) { this.state = state; if(debugMode) { System.out.println(getDescriptionForState()); } } /** * Utility method for sleeping * Will only really sleep if debug has been enabled * @param ms milliseconds to sleep */ protected void debug_sleep(long ms) { if(debugMode) { sleep(ms); } } /** * Utility method for sleeping * @param ms milliseconds to sleep */ protected void sleep(long ms) { try { Thread.sleep(ms); } catch (Exception e) { /* ignored */ } } }lwjgl-2.7.1/src/java/org/lwjgl/util/Color.java0000644000175000017500000002466711543426510020254 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util; import java.io.Serializable; import java.nio.ByteBuffer; /** * A mutable Color class * @author $Author: matzon $ * @version $Revision: 2983 $ * $Id: Color.java 2983 2008-04-07 18:36:09Z matzon $ */ public final class Color implements ReadableColor, Serializable, WritableColor { static final long serialVersionUID = 1L; /** Color components, publicly accessible */ private byte red, green, blue, alpha; /** * Constructor for Color. */ public Color() { this(0, 0, 0, 255); } /** * Constructor for Color. Alpha defaults to 255. */ public Color(int r, int g, int b) { this(r, g, b, 255); } /** * Constructor for Color. Alpha defaults to 255. */ public Color(byte r, byte g, byte b) { this(r, g, b, (byte) 255); } /** * Constructor for Color. */ public Color(int r, int g, int b, int a) { set(r, g, b, a); } /** * Constructor for Color. */ public Color(byte r, byte g, byte b, byte a) { set(r, g, b, a); } /** * Constructor for Color */ public Color(ReadableColor c) { setColor(c); } /** * Set a color */ public void set(int r, int g, int b, int a) { red = (byte) r; green = (byte) g; blue = (byte) b; alpha = (byte) a; } /** * Set a color */ public void set(byte r, byte g, byte b, byte a) { this.red = r; this.green = g; this.blue = b; this.alpha = a; } /** * Set a color */ public void set(int r, int g, int b) { set(r, g, b, 255); } /** * Set a color */ public void set(byte r, byte g, byte b) { set(r, g, b, (byte) 255); } /** * Accessor */ public int getRed() { return red & 0xFF; } /** * Accessor */ public int getGreen() { return green & 0xFF; } /** * Accessor */ public int getBlue() { return blue & 0xFF; } /** * Accessor */ public int getAlpha() { return alpha & 0xFF; } /** * Set the Red component */ public void setRed(int red) { this.red = (byte) red; } /** * Set the Green component */ public void setGreen(int green) { this.green = (byte) green; } /** * Set the Blue component */ public void setBlue(int blue) { this.blue = (byte) blue; } /** * Set the Alpha component */ public void setAlpha(int alpha) { this.alpha = (byte) alpha; } /** * Set the Red component */ public void setRed(byte red) { this.red = red; } /** * Set the Green component */ public void setGreen(byte green) { this.green = green; } /** * Set the Blue component */ public void setBlue(byte blue) { this.blue = blue; } /** * Set the Alpha component */ public void setAlpha(byte alpha) { this.alpha = alpha; } /** * Stringify */ public String toString() { return "Color [" + getRed() + ", " + getGreen() + ", " + getBlue() + ", " + getAlpha() + "]"; } /** * Equals */ public boolean equals(Object o) { return (o != null) && (o instanceof ReadableColor) && (((ReadableColor) o).getRed() == this.getRed()) && (((ReadableColor) o).getGreen() == this.getGreen()) && (((ReadableColor) o).getBlue() == this.getBlue()) && (((ReadableColor) o).getAlpha() == this.getAlpha()); } /** * Hashcode */ public int hashCode() { return (red << 24) | (green << 16) | (blue << 8) | alpha; } /* (Overrides) * @see com.shavenpuppy.jglib.ReadableColor#getAlphaByte() */ public byte getAlphaByte() { return alpha; } /* (Overrides) * @see com.shavenpuppy.jglib.ReadableColor#getBlueByte() */ public byte getBlueByte() { return blue; } /* (Overrides) * @see com.shavenpuppy.jglib.ReadableColor#getGreenByte() */ public byte getGreenByte() { return green; } /* (Overrides) * @see com.shavenpuppy.jglib.ReadableColor#getRedByte() */ public byte getRedByte() { return red; } /* (Overrides) * @see com.shavenpuppy.jglib.ReadableColor#writeRGBA(java.nio.ByteBuffer) */ public void writeRGBA(ByteBuffer dest) { dest.put(red); dest.put(green); dest.put(blue); dest.put(alpha); } /* (Overrides) * @see com.shavenpuppy.jglib.ReadableColor#writeRGB(java.nio.ByteBuffer) */ public void writeRGB(ByteBuffer dest) { dest.put(red); dest.put(green); dest.put(blue); } /* (Overrides) * @see com.shavenpuppy.jglib.ReadableColor#writeABGR(java.nio.ByteBuffer) */ public void writeABGR(ByteBuffer dest) { dest.put(alpha); dest.put(blue); dest.put(green); dest.put(red); } /* (Overrides) * @see com.shavenpuppy.jglib.ReadableColor#writeARGB(java.nio.ByteBuffer) */ public void writeARGB(ByteBuffer dest) { dest.put(alpha); dest.put(red); dest.put(green); dest.put(blue); } /* (Overrides) * @see com.shavenpuppy.jglib.ReadableColor#writeBGR(java.nio.ByteBuffer) */ public void writeBGR(ByteBuffer dest) { dest.put(blue); dest.put(green); dest.put(red); } /* (Overrides) * @see com.shavenpuppy.jglib.ReadableColor#writeBGRA(java.nio.ByteBuffer) */ public void writeBGRA(ByteBuffer dest) { dest.put(blue); dest.put(green); dest.put(red); dest.put(alpha); } /** * Read a color from a byte buffer * @param src The source buffer */ public void readRGBA(ByteBuffer src) { red = src.get(); green = src.get(); blue = src.get(); alpha = src.get(); } /** * Read a color from a byte buffer * @param src The source buffer */ public void readRGB(ByteBuffer src) { red = src.get(); green = src.get(); blue = src.get(); } /** * Read a color from a byte buffer * @param src The source buffer */ public void readARGB(ByteBuffer src) { alpha = src.get(); red = src.get(); green = src.get(); blue = src.get(); } /** * Read a color from a byte buffer * @param src The source buffer */ public void readBGRA(ByteBuffer src) { blue = src.get(); green = src.get(); red = src.get(); alpha = src.get(); } /** * Read a color from a byte buffer * @param src The source buffer */ public void readBGR(ByteBuffer src) { blue = src.get(); green = src.get(); red = src.get(); } /** * Read a color from a byte buffer * @param src The source buffer */ public void readABGR(ByteBuffer src) { alpha = src.get(); blue = src.get(); green = src.get(); red = src.get(); } /** * Set this color's color by copying another color * @param src The source color */ public void setColor(ReadableColor src) { red = src.getRedByte(); green = src.getGreenByte(); blue = src.getBlueByte(); alpha = src.getAlphaByte(); } /** * HSB to RGB conversion, pinched from java.awt.Color. * @param hue (0..1.0f) * @param saturation (0..1.0f) * @param brightness (0..1.0f) */ public void fromHSB(float hue, float saturation, float brightness) { if (saturation == 0.0F) { red = green = blue = (byte) (brightness * 255F + 0.5F); } else { float f3 = (hue - (float) Math.floor(hue)) * 6F; float f4 = f3 - (float) Math.floor(f3); float f5 = brightness * (1.0F - saturation); float f6 = brightness * (1.0F - saturation * f4); float f7 = brightness * (1.0F - saturation * (1.0F - f4)); switch ((int) f3) { case 0 : red = (byte) (brightness * 255F + 0.5F); green = (byte) (f7 * 255F + 0.5F); blue = (byte) (f5 * 255F + 0.5F); break; case 1 : red = (byte) (f6 * 255F + 0.5F); green = (byte) (brightness * 255F + 0.5F); blue = (byte) (f5 * 255F + 0.5F); break; case 2 : red = (byte) (f5 * 255F + 0.5F); green = (byte) (brightness * 255F + 0.5F); blue = (byte) (f7 * 255F + 0.5F); break; case 3 : red = (byte) (f5 * 255F + 0.5F); green = (byte) (f6 * 255F + 0.5F); blue = (byte) (brightness * 255F + 0.5F); break; case 4 : red = (byte) (f7 * 255F + 0.5F); green = (byte) (f5 * 255F + 0.5F); blue = (byte) (brightness * 255F + 0.5F); break; case 5 : red = (byte) (brightness * 255F + 0.5F); green = (byte) (f5 * 255F + 0.5F); blue = (byte) (f6 * 255F + 0.5F); break; } } } /** * RGB to HSB conversion, pinched from java.awt.Color. * The HSB value is returned in dest[] if dest[] is supplied. * Values range from 0..1 * @param dest Destination floats, or null * @return dest, or a new float array */ public float[] toHSB(float dest[]) { int r = getRed(); int g = getGreen(); int b = getBlue(); if (dest == null) dest = new float[3]; int l = r <= g ? g : r; if (b > l) l = b; int i1 = r >= g ? g : r; if (b < i1) i1 = b; float brightness = l / 255F; float saturation; if (l != 0) saturation = (float) (l - i1) / (float) l; else saturation = 0.0F; float hue; if (saturation == 0.0F) { hue = 0.0F; } else { float f3 = (float) (l - r) / (float) (l - i1); float f4 = (float) (l - g) / (float) (l - i1); float f5 = (float) (l - b) / (float) (l - i1); if (r == l) hue = f5 - f4; else if (g == l) hue = (2.0F + f3) - f5; else hue = (4F + f4) - f3; hue /= 6F; if (hue < 0.0F) hue++; } dest[0] = hue; dest[1] = saturation; dest[2] = brightness; return dest; } } lwjgl-2.7.1/src/java/org/lwjgl/util/Dimension.java0000644000175000017500000001025411543426510021106 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util; import java.io.Serializable; /** * A 2D integer Dimension class, which looks remarkably like an AWT one. * @author $Author: matzon $ * @version $Revision: 2983 $ * $Id: Dimension.java 2983 2008-04-07 18:36:09Z matzon $ */ public final class Dimension implements Serializable, ReadableDimension, WritableDimension { static final long serialVersionUID = 1L; /** The dimensions! */ private int width, height; /** * Constructor for Dimension. */ public Dimension() { super(); } /** * Constructor for Dimension. */ public Dimension(int w, int h) { this.width = w; this.height = h; } /** * Constructor for Dimension. */ public Dimension(ReadableDimension d) { setSize(d); } public void setSize(int w, int h) { this.width = w; this.height = h; } public void setSize(ReadableDimension d) { this.width = d.getWidth(); this.height = d.getHeight(); } /* (Overrides) * @see com.shavenpuppy.jglib.ReadableDimension#getSize(com.shavenpuppy.jglib.Dimension) */ public void getSize(WritableDimension dest) { dest.setSize(this); } /** * Checks whether two dimension objects have equal values. */ public boolean equals(Object obj) { if (obj instanceof ReadableDimension) { ReadableDimension d = (ReadableDimension) obj; return (width == d.getWidth()) && (height == d.getHeight()); } return false; } /** * Returns the hash code for this Dimension. * * @return a hash code for this Dimension */ public int hashCode() { int sum = width + height; return sum * (sum + 1) / 2 + width; } /** * Returns a string representation of the values of this * Dimension object's height and * width fields. This method is intended to be used only * for debugging purposes, and the content and format of the returned * string may vary between implementations. The returned string may be * empty but may not be null. * * @return a string representation of this Dimension * object */ public String toString() { return getClass().getName() + "[width=" + width + ",height=" + height + "]"; } /** * Gets the height. * @return Returns a int */ public int getHeight() { return height; } /** * Sets the height. * @param height The height to set */ public void setHeight(int height) { this.height = height; } /** * Gets the width. * @return Returns a int */ public int getWidth() { return width; } /** * Sets the width. * @param width The width to set */ public void setWidth(int width) { this.width = width; } } lwjgl-2.7.1/src/java/org/lwjgl/util/input/0000755000175000017500000000000011543426510017453 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/util/input/ControllerAdapter.java0000644000175000017500000001733711543426510023755 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.input; import org.lwjgl.input.Controller; /** * Adapter for the Controller interface. It can be used as placeholder * Controller, which doesn't do anything (eg if Controllers.create() fails and * you don't want to take care of that). * * @author Onyx, Aho and all the other aliases... */ public class ControllerAdapter implements Controller { /** * Get the name assigned to this controller. * * @return The name assigned to this controller */ public String getName() { return "Dummy Controller"; } /** * Get the index of this controller in the collection * * @return The index of this controller in the collection */ public int getIndex() { return 0; //-1 maybe? } /** * Retrieve the number of buttons available on this controller * * @return The number of butotns available on this controller */ public int getButtonCount() { return 0; } /** * Get the name of the specified button. Be warned, often this is as * exciting as "Button X" * * @param index The index of the button whose name should be retrieved * @return The name of the button requested */ public String getButtonName(int index) { return "button n/a"; } /** * Check if a button is currently pressed * * @param index The button to check * @return True if the button is currently pressed */ public boolean isButtonPressed(int index) { return false; } /** * Poll the controller for new data. This will also update events */ public void poll() { } /** * Get the X-Axis value of the POV on this controller * * @return The X-Axis value of the POV on this controller */ public float getPovX() { return 0f; } /** * Get the Y-Axis value of the POV on this controller * * @return The Y-Axis value of the POV on this controller */ public float getPovY() { return 0f; } /** * Get the dead zone for a specified axis * * @param index The index of the axis for which to retrieve the dead zone * @return The dead zone for the specified axis */ public float getDeadZone(int index) { return 0f; } /** * Set the dead zone for the specified axis * * @param index The index of hte axis for which to set the dead zone * @param zone The dead zone to use for the specified axis */ public void setDeadZone(int index, float zone) { } /** * Retrieve the number of axes available on this controller. * * @return The number of axes available on this controller. */ public int getAxisCount() { return 0; } /** * Get the name that's given to the specified axis * * @param index The index of the axis whose name should be retrieved * @return The name of the specified axis. */ public String getAxisName(int index) { return "axis n/a"; } /** * Retrieve the value thats currently available on a specified axis. The * value will always be between 1.0 and -1.0 and will calibrate as values * are passed read. It may be useful to get the player to wiggle the * joystick from side to side to get the calibration right. * * @param index The index of axis to be read * @return The value from the specified axis. */ public float getAxisValue(int index) { return 0f; } /** * Get the value from the X axis if there is one. If no X axis is defined a * zero value will be returned. * * @return The value from the X axis */ public float getXAxisValue() { return 0f; } /** * Get the dead zone for the X axis. * * @return The dead zone for the X axis */ public float getXAxisDeadZone() { return 0f; } /** * Set the dead zone for the X axis * * @param zone The dead zone to use for the X axis */ public void setXAxisDeadZone(float zone) { } /** * Get the value from the Y axis if there is one. If no Y axis is defined a * zero value will be returned. * * @return The value from the Y axis */ public float getYAxisValue() { return 0f; } /** * Get the dead zone for the Y axis. * * @return The dead zone for the Y axis */ public float getYAxisDeadZone() { return 0f; } /** * Set the dead zone for the Y axis * * @param zone The dead zone to use for the Y axis */ public void setYAxisDeadZone(float zone) { } /** * Get the value from the Z axis if there is one. If no Z axis is defined a * zero value will be returned. * * @return The value from the Z axis */ public float getZAxisValue() { return 0f; } /** * Get the dead zone for the Z axis. * * @return The dead zone for the Z axis */ public float getZAxisDeadZone() { return 0f; } /** * Set the dead zone for the Z axis * * @param zone The dead zone to use for the Z axis */ public void setZAxisDeadZone(float zone) { } /** * Get the value from the RX axis if there is one. If no RX axis is defined * a zero value will be returned. * * @return The value from the RX axis */ public float getRXAxisValue() { return 0f; } /** * Get the dead zone for the RX axis. * * @return The dead zone for the RX axis */ public float getRXAxisDeadZone() { return 0f; } /** * Set the dead zone for the RX axis * * @param zone The dead zone to use for the RX axis */ public void setRXAxisDeadZone(float zone) { } /** * Get the value from the RY axis if there is one. If no RY axis is defined * a zero value will be returned. * * @return The value from the RY axis */ public float getRYAxisValue() { return 0f; } /** * Get the dead zone for the RY axis. * * @return The dead zone for the RY axis */ public float getRYAxisDeadZone() { return 0f; } /** * Set the dead zone for the RY axis * * @param zone The dead zone to use for the RY axis */ public void setRYAxisDeadZone(float zone) { } /** * Get the value from the RZ axis if there is one. If no RZ axis is defined * a zero value will be returned. * * @return The value from the RZ axis */ public float getRZAxisValue() { return 0f; } /** * Get the dead zone for the RZ axis. * * @return The dead zone for the RZ axis */ public float getRZAxisDeadZone() { return 0f; } /** * Set the dead zone for the RZ axis * * @param zone The dead zone to use for the RZ axis */ public void setRZAxisDeadZone(float zone) { } }lwjgl-2.7.1/src/java/org/lwjgl/util/WaveData.java0000644000175000017500000001720011543426510020653 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util; import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.ShortBuffer; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import org.lwjgl.openal.AL10; import com.sun.media.sound.WaveFileReader; /** * * Utitlity class for loading wavefiles. * * @author Brian Matzon * @version $Revision: 3438 $ * $Id: WaveData.java 3438 2010-10-12 15:34:26Z matzon $ */ public class WaveData { /** actual wave data */ public final ByteBuffer data; /** format type of data */ public final int format; /** sample rate of data */ public final int samplerate; /** * Creates a new WaveData * * @param data actual wavedata * @param format format of wave data * @param samplerate sample rate of data */ private WaveData(ByteBuffer data, int format, int samplerate) { this.data = data; this.format = format; this.samplerate = samplerate; } /** * Disposes the wavedata */ public void dispose() { data.clear(); } /** * Creates a WaveData container from the specified url * * @param path URL to file * @return WaveData containing data, or null if a failure occured */ public static WaveData create(URL path) { try { // due to an issue with AudioSystem.getAudioInputStream // and mixing unsigned and signed code // we will use the reader directly WaveFileReader wfr = new WaveFileReader(); return create(wfr.getAudioInputStream(new BufferedInputStream(path.openStream()))); } catch (Exception e) { org.lwjgl.LWJGLUtil.log("Unable to create from: " + path + ", " + e.getMessage()); return null; } } /** * Creates a WaveData container from the specified in the classpath * * @param path path to file (relative, and in classpath) * @return WaveData containing data, or null if a failure occured */ public static WaveData create(String path) { return create(Thread.currentThread().getContextClassLoader().getResource(path)); } /** * Creates a WaveData container from the specified inputstream * * @param is InputStream to read from * @return WaveData containing data, or null if a failure occured */ public static WaveData create(InputStream is) { try { return create( AudioSystem.getAudioInputStream(is)); } catch (Exception e) { org.lwjgl.LWJGLUtil.log("Unable to create from inputstream, " + e.getMessage()); return null; } } /** * Creates a WaveData container from the specified bytes * * @param buffer array of bytes containing the complete wave file * @return WaveData containing data, or null if a failure occured */ public static WaveData create(byte[] buffer) { try { return create( AudioSystem.getAudioInputStream( new BufferedInputStream(new ByteArrayInputStream(buffer)))); } catch (Exception e) { org.lwjgl.LWJGLUtil.log("Unable to create from byte array, " + e.getMessage()); return null; } } /** * Creates a WaveData container from the specified ByetBuffer. * If the buffer is backed by an array, it will be used directly, * else the contents of the buffer will be copied using get(byte[]). * * @param buffer ByteBuffer containing sound file * @return WaveData containing data, or null if a failure occured */ public static WaveData create(ByteBuffer buffer) { try { byte[] bytes = null; if(buffer.hasArray()) { bytes = buffer.array(); } else { bytes = new byte[buffer.capacity()]; buffer.get(bytes); } return create(bytes); } catch (Exception e) { org.lwjgl.LWJGLUtil.log("Unable to create from ByteBuffer, " + e.getMessage()); return null; } } /** * Creates a WaveData container from the specified stream * * @param ais AudioInputStream to read from * @return WaveData containing data, or null if a failure occured */ public static WaveData create(AudioInputStream ais) { //get format of data AudioFormat audioformat = ais.getFormat(); // get channels int channels = 0; if (audioformat.getChannels() == 1) { if (audioformat.getSampleSizeInBits() == 8) { channels = AL10.AL_FORMAT_MONO8; } else if (audioformat.getSampleSizeInBits() == 16) { channels = AL10.AL_FORMAT_MONO16; } else { assert false : "Illegal sample size"; } } else if (audioformat.getChannels() == 2) { if (audioformat.getSampleSizeInBits() == 8) { channels = AL10.AL_FORMAT_STEREO8; } else if (audioformat.getSampleSizeInBits() == 16) { channels = AL10.AL_FORMAT_STEREO16; } else { assert false : "Illegal sample size"; } } else { assert false : "Only mono or stereo is supported"; } //read data into buffer ByteBuffer buffer = null; try { int available = ais.available(); if(available <= 0) { available = ais.getFormat().getChannels() * (int) ais.getFrameLength() * ais.getFormat().getSampleSizeInBits() / 8; } byte[] buf = new byte[ais.available()]; int read = 0, total = 0; while ((read = ais.read(buf, total, buf.length - total)) != -1 && total < buf.length) { total += read; } buffer = convertAudioBytes(buf, audioformat.getSampleSizeInBits() == 16); } catch (IOException ioe) { return null; } //create our result WaveData wavedata = new WaveData(buffer, channels, (int) audioformat.getSampleRate()); //close stream try { ais.close(); } catch (IOException ioe) { } return wavedata; } private static ByteBuffer convertAudioBytes(byte[] audio_bytes, boolean two_bytes_data) { ByteBuffer dest = ByteBuffer.allocateDirect(audio_bytes.length); dest.order(ByteOrder.nativeOrder()); ByteBuffer src = ByteBuffer.wrap(audio_bytes); src.order(ByteOrder.LITTLE_ENDIAN); if (two_bytes_data) { ShortBuffer dest_short = dest.asShortBuffer(); ShortBuffer src_short = src.asShortBuffer(); while (src_short.hasRemaining()) dest_short.put(src_short.get()); } else { while (src.hasRemaining()) dest.put(src.get()); } dest.rewind(); return dest; } } lwjgl-2.7.1/src/java/org/lwjgl/util/WritableDimension.java0000644000175000017500000000400311543426510022573 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util; /** * Write interface for Dimensions * @author $Author: spasi $ * @version $Revision: 3418 $ * $Id: WritableDimension.java 3418 2010-09-28 21:11:35Z spasi $ */ public interface WritableDimension { void setSize(int w, int h); void setSize(ReadableDimension d); /** * Sets the height. * @param height The height to set */ void setHeight(int height); /** * Sets the width. * @param width The width to set */ void setWidth(int width); }lwjgl-2.7.1/src/java/org/lwjgl/util/vector/0000755000175000017500000000000011543426510017616 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/util/vector/ReadableVector3f.java0000644000175000017500000000327611543426510023604 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; /** * @author foo */ public interface ReadableVector3f extends ReadableVector2f { /** * @return z */ float getZ(); }lwjgl-2.7.1/src/java/org/lwjgl/util/vector/Matrix4f.java0000644000175000017500000006002211543426510022157 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; import java.io.Serializable; import java.nio.FloatBuffer; /** * Holds a 4x4 float matrix. * * @author foo */ public class Matrix4f extends Matrix implements Serializable { private static final long serialVersionUID = 1L; public float m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33; /** * Construct a new matrix, initialized to the identity. */ public Matrix4f() { super(); setIdentity(); } /** * Returns a string representation of this matrix */ public String toString() { StringBuilder buf = new StringBuilder(); buf.append(m00).append(' ').append(m10).append(' ').append(m20).append(' ').append(m30).append('\n'); buf.append(m01).append(' ').append(m11).append(' ').append(m21).append(' ').append(m31).append('\n'); buf.append(m02).append(' ').append(m12).append(' ').append(m22).append(' ').append(m32).append('\n'); buf.append(m03).append(' ').append(m13).append(' ').append(m23).append(' ').append(m33).append('\n'); return buf.toString(); } /** * Set this matrix to be the identity matrix. * @return this */ public Matrix setIdentity() { return setIdentity(this); } /** * Set the given matrix to be the identity matrix. * @param m The matrix to set to the identity * @return m */ public static Matrix4f setIdentity(Matrix4f m) { m.m00 = 1.0f; m.m01 = 0.0f; m.m02 = 0.0f; m.m03 = 0.0f; m.m10 = 0.0f; m.m11 = 1.0f; m.m12 = 0.0f; m.m13 = 0.0f; m.m20 = 0.0f; m.m21 = 0.0f; m.m22 = 1.0f; m.m23 = 0.0f; m.m30 = 0.0f; m.m31 = 0.0f; m.m32 = 0.0f; m.m33 = 1.0f; return m; } /** * Set this matrix to 0. * @return this */ public Matrix setZero() { return setZero(this); } /** * Set the given matrix to 0. * @param m The matrix to set to 0 * @return m */ public static Matrix4f setZero(Matrix4f m) { m.m00 = 0.0f; m.m01 = 0.0f; m.m02 = 0.0f; m.m03 = 0.0f; m.m10 = 0.0f; m.m11 = 0.0f; m.m12 = 0.0f; m.m13 = 0.0f; m.m20 = 0.0f; m.m21 = 0.0f; m.m22 = 0.0f; m.m23 = 0.0f; m.m30 = 0.0f; m.m31 = 0.0f; m.m32 = 0.0f; m.m33 = 0.0f; return m; } /** * Load from another matrix4f * @param src The source matrix * @return this */ public Matrix4f load(Matrix4f src) { return load(src, this); } /** * Copy the source matrix to the destination matrix * @param src The source matrix * @param dest The destination matrix, or null of a new one is to be created * @return The copied matrix */ public static Matrix4f load(Matrix4f src, Matrix4f dest) { if (dest == null) dest = new Matrix4f(); dest.m00 = src.m00; dest.m01 = src.m01; dest.m02 = src.m02; dest.m03 = src.m03; dest.m10 = src.m10; dest.m11 = src.m11; dest.m12 = src.m12; dest.m13 = src.m13; dest.m20 = src.m20; dest.m21 = src.m21; dest.m22 = src.m22; dest.m23 = src.m23; dest.m30 = src.m30; dest.m31 = src.m31; dest.m32 = src.m32; dest.m33 = src.m33; return dest; } /** * Load from a float buffer. The buffer stores the matrix in column major * (OpenGL) order. * * @param buf A float buffer to read from * @return this */ public Matrix load(FloatBuffer buf) { m00 = buf.get(); m01 = buf.get(); m02 = buf.get(); m03 = buf.get(); m10 = buf.get(); m11 = buf.get(); m12 = buf.get(); m13 = buf.get(); m20 = buf.get(); m21 = buf.get(); m22 = buf.get(); m23 = buf.get(); m30 = buf.get(); m31 = buf.get(); m32 = buf.get(); m33 = buf.get(); return this; } /** * Load from a float buffer. The buffer stores the matrix in row major * (maths) order. * * @param buf A float buffer to read from * @return this */ public Matrix loadTranspose(FloatBuffer buf) { m00 = buf.get(); m10 = buf.get(); m20 = buf.get(); m30 = buf.get(); m01 = buf.get(); m11 = buf.get(); m21 = buf.get(); m31 = buf.get(); m02 = buf.get(); m12 = buf.get(); m22 = buf.get(); m32 = buf.get(); m03 = buf.get(); m13 = buf.get(); m23 = buf.get(); m33 = buf.get(); return this; } /** * Store this matrix in a float buffer. The matrix is stored in column * major (openGL) order. * @param buf The buffer to store this matrix in */ public Matrix store(FloatBuffer buf) { buf.put(m00); buf.put(m01); buf.put(m02); buf.put(m03); buf.put(m10); buf.put(m11); buf.put(m12); buf.put(m13); buf.put(m20); buf.put(m21); buf.put(m22); buf.put(m23); buf.put(m30); buf.put(m31); buf.put(m32); buf.put(m33); return this; } /** * Store this matrix in a float buffer. The matrix is stored in row * major (maths) order. * @param buf The buffer to store this matrix in */ public Matrix storeTranspose(FloatBuffer buf) { buf.put(m00); buf.put(m10); buf.put(m20); buf.put(m30); buf.put(m01); buf.put(m11); buf.put(m21); buf.put(m31); buf.put(m02); buf.put(m12); buf.put(m22); buf.put(m32); buf.put(m03); buf.put(m13); buf.put(m23); buf.put(m33); return this; } /** * Add two matrices together and place the result in a third matrix. * @param left The left source matrix * @param right The right source matrix * @param dest The destination matrix, or null if a new one is to be created * @return the destination matrix */ public static Matrix4f add(Matrix4f left, Matrix4f right, Matrix4f dest) { if (dest == null) dest = new Matrix4f(); dest.m00 = left.m00 + right.m00; dest.m01 = left.m01 + right.m01; dest.m02 = left.m02 + right.m02; dest.m03 = left.m03 + right.m03; dest.m10 = left.m10 + right.m10; dest.m11 = left.m11 + right.m11; dest.m12 = left.m12 + right.m12; dest.m13 = left.m13 + right.m13; dest.m20 = left.m20 + right.m20; dest.m21 = left.m21 + right.m21; dest.m22 = left.m22 + right.m22; dest.m23 = left.m23 + right.m23; dest.m30 = left.m30 + right.m30; dest.m31 = left.m31 + right.m31; dest.m32 = left.m32 + right.m32; dest.m33 = left.m33 + right.m33; return dest; } /** * Subtract the right matrix from the left and place the result in a third matrix. * @param left The left source matrix * @param right The right source matrix * @param dest The destination matrix, or null if a new one is to be created * @return the destination matrix */ public static Matrix4f sub(Matrix4f left, Matrix4f right, Matrix4f dest) { if (dest == null) dest = new Matrix4f(); dest.m00 = left.m00 - right.m00; dest.m01 = left.m01 - right.m01; dest.m02 = left.m02 - right.m02; dest.m03 = left.m03 - right.m03; dest.m10 = left.m10 - right.m10; dest.m11 = left.m11 - right.m11; dest.m12 = left.m12 - right.m12; dest.m13 = left.m13 - right.m13; dest.m20 = left.m20 - right.m20; dest.m21 = left.m21 - right.m21; dest.m22 = left.m22 - right.m22; dest.m23 = left.m23 - right.m23; dest.m30 = left.m30 - right.m30; dest.m31 = left.m31 - right.m31; dest.m32 = left.m32 - right.m32; dest.m33 = left.m33 - right.m33; return dest; } /** * Multiply the right matrix by the left and place the result in a third matrix. * @param left The left source matrix * @param right The right source matrix * @param dest The destination matrix, or null if a new one is to be created * @return the destination matrix */ public static Matrix4f mul(Matrix4f left, Matrix4f right, Matrix4f dest) { if (dest == null) dest = new Matrix4f(); float m00 = left.m00 * right.m00 + left.m10 * right.m01 + left.m20 * right.m02 + left.m30 * right.m03; float m01 = left.m01 * right.m00 + left.m11 * right.m01 + left.m21 * right.m02 + left.m31 * right.m03; float m02 = left.m02 * right.m00 + left.m12 * right.m01 + left.m22 * right.m02 + left.m32 * right.m03; float m03 = left.m03 * right.m00 + left.m13 * right.m01 + left.m23 * right.m02 + left.m33 * right.m03; float m10 = left.m00 * right.m10 + left.m10 * right.m11 + left.m20 * right.m12 + left.m30 * right.m13; float m11 = left.m01 * right.m10 + left.m11 * right.m11 + left.m21 * right.m12 + left.m31 * right.m13; float m12 = left.m02 * right.m10 + left.m12 * right.m11 + left.m22 * right.m12 + left.m32 * right.m13; float m13 = left.m03 * right.m10 + left.m13 * right.m11 + left.m23 * right.m12 + left.m33 * right.m13; float m20 = left.m00 * right.m20 + left.m10 * right.m21 + left.m20 * right.m22 + left.m30 * right.m23; float m21 = left.m01 * right.m20 + left.m11 * right.m21 + left.m21 * right.m22 + left.m31 * right.m23; float m22 = left.m02 * right.m20 + left.m12 * right.m21 + left.m22 * right.m22 + left.m32 * right.m23; float m23 = left.m03 * right.m20 + left.m13 * right.m21 + left.m23 * right.m22 + left.m33 * right.m23; float m30 = left.m00 * right.m30 + left.m10 * right.m31 + left.m20 * right.m32 + left.m30 * right.m33; float m31 = left.m01 * right.m30 + left.m11 * right.m31 + left.m21 * right.m32 + left.m31 * right.m33; float m32 = left.m02 * right.m30 + left.m12 * right.m31 + left.m22 * right.m32 + left.m32 * right.m33; float m33 = left.m03 * right.m30 + left.m13 * right.m31 + left.m23 * right.m32 + left.m33 * right.m33; dest.m00 = m00; dest.m01 = m01; dest.m02 = m02; dest.m03 = m03; dest.m10 = m10; dest.m11 = m11; dest.m12 = m12; dest.m13 = m13; dest.m20 = m20; dest.m21 = m21; dest.m22 = m22; dest.m23 = m23; dest.m30 = m30; dest.m31 = m31; dest.m32 = m32; dest.m33 = m33; return dest; } /** * Transform a Vector by a matrix and return the result in a destination * vector. * @param left The left matrix * @param right The right vector * @param dest The destination vector, or null if a new one is to be created * @return the destination vector */ public static Vector4f transform(Matrix4f left, Vector4f right, Vector4f dest) { if (dest == null) dest = new Vector4f(); float x = left.m00 * right.x + left.m10 * right.y + left.m20 * right.z + left.m30 * right.w; float y = left.m01 * right.x + left.m11 * right.y + left.m21 * right.z + left.m31 * right.w; float z = left.m02 * right.x + left.m12 * right.y + left.m22 * right.z + left.m32 * right.w; float w = left.m03 * right.x + left.m13 * right.y + left.m23 * right.z + left.m33 * right.w; dest.x = x; dest.y = y; dest.z = z; dest.w = w; return dest; } /** * Transpose this matrix * @return this */ public Matrix transpose() { return transpose(this); } /** * Translate this matrix * @param vec The vector to translate by * @return this */ public Matrix4f translate(Vector2f vec) { return translate(vec, this); } /** * Translate this matrix * @param vec The vector to translate by * @return this */ public Matrix4f translate(Vector3f vec) { return translate(vec, this); } /** * Scales this matrix * @param vec The vector to scale by * @return this */ public Matrix4f scale(Vector3f vec) { return scale(vec, this, this); } /** * Scales the source matrix and put the result in the destination matrix * @param vec The vector to scale by * @param src The source matrix * @param dest The destination matrix, or null if a new matrix is to be created * @return The scaled matrix */ public static Matrix4f scale(Vector3f vec, Matrix4f src, Matrix4f dest) { if (dest == null) dest = new Matrix4f(); dest.m00 = src.m00 * vec.x; dest.m01 = src.m01 * vec.x; dest.m02 = src.m02 * vec.x; dest.m03 = src.m03 * vec.x; dest.m10 = src.m10 * vec.y; dest.m11 = src.m11 * vec.y; dest.m12 = src.m12 * vec.y; dest.m13 = src.m13 * vec.y; dest.m20 = src.m20 * vec.z; dest.m21 = src.m21 * vec.z; dest.m22 = src.m22 * vec.z; dest.m23 = src.m23 * vec.z; return dest; } /** * Rotates the matrix around the given axis the specified angle * @param angle the angle, in radians. * @param axis The vector representing the rotation axis. Must be normalized. * @return this */ public Matrix4f rotate(float angle, Vector3f axis) { return rotate(angle, axis, this); } /** * Rotates the matrix around the given axis the specified angle * @param angle the angle, in radians. * @param axis The vector representing the rotation axis. Must be normalized. * @param dest The matrix to put the result, or null if a new matrix is to be created * @return The rotated matrix */ public Matrix4f rotate(float angle, Vector3f axis, Matrix4f dest) { return rotate(angle, axis, this, dest); } /** * Rotates the source matrix around the given axis the specified angle and * put the result in the destination matrix. * @param angle the angle, in radians. * @param axis The vector representing the rotation axis. Must be normalized. * @param src The matrix to rotate * @param dest The matrix to put the result, or null if a new matrix is to be created * @return The rotated matrix */ public static Matrix4f rotate(float angle, Vector3f axis, Matrix4f src, Matrix4f dest) { if (dest == null) dest = new Matrix4f(); float c = (float) Math.cos(angle); float s = (float) Math.sin(angle); float oneminusc = 1.0f - c; float xy = axis.x*axis.y; float yz = axis.y*axis.z; float xz = axis.x*axis.z; float xs = axis.x*s; float ys = axis.y*s; float zs = axis.z*s; float f00 = axis.x*axis.x*oneminusc+c; float f01 = xy*oneminusc+zs; float f02 = xz*oneminusc-ys; // n[3] not used float f10 = xy*oneminusc-zs; float f11 = axis.y*axis.y*oneminusc+c; float f12 = yz*oneminusc+xs; // n[7] not used float f20 = xz*oneminusc+ys; float f21 = yz*oneminusc-xs; float f22 = axis.z*axis.z*oneminusc+c; float t00 = src.m00 * f00 + src.m10 * f01 + src.m20 * f02; float t01 = src.m01 * f00 + src.m11 * f01 + src.m21 * f02; float t02 = src.m02 * f00 + src.m12 * f01 + src.m22 * f02; float t03 = src.m03 * f00 + src.m13 * f01 + src.m23 * f02; float t10 = src.m00 * f10 + src.m10 * f11 + src.m20 * f12; float t11 = src.m01 * f10 + src.m11 * f11 + src.m21 * f12; float t12 = src.m02 * f10 + src.m12 * f11 + src.m22 * f12; float t13 = src.m03 * f10 + src.m13 * f11 + src.m23 * f12; dest.m20 = src.m00 * f20 + src.m10 * f21 + src.m20 * f22; dest.m21 = src.m01 * f20 + src.m11 * f21 + src.m21 * f22; dest.m22 = src.m02 * f20 + src.m12 * f21 + src.m22 * f22; dest.m23 = src.m03 * f20 + src.m13 * f21 + src.m23 * f22; dest.m00 = t00; dest.m01 = t01; dest.m02 = t02; dest.m03 = t03; dest.m10 = t10; dest.m11 = t11; dest.m12 = t12; dest.m13 = t13; return dest; } /** * Translate this matrix and stash the result in another matrix * @param vec The vector to translate by * @param dest The destination matrix or null if a new matrix is to be created * @return the translated matrix */ public Matrix4f translate(Vector3f vec, Matrix4f dest) { return translate(vec, this, dest); } /** * Translate the source matrix and stash the result in the destination matrix * @param vec The vector to translate by * @param src The source matrix * @param dest The destination matrix or null if a new matrix is to be created * @return The translated matrix */ public static Matrix4f translate(Vector3f vec, Matrix4f src, Matrix4f dest) { if (dest == null) dest = new Matrix4f(); dest.m30 += src.m00 * vec.x + src.m10 * vec.y + src.m20 * vec.z; dest.m31 += src.m01 * vec.x + src.m11 * vec.y + src.m21 * vec.z; dest.m32 += src.m02 * vec.x + src.m12 * vec.y + src.m22 * vec.z; dest.m33 += src.m03 * vec.x + src.m13 * vec.y + src.m23 * vec.z; return dest; } /** * Translate this matrix and stash the result in another matrix * @param vec The vector to translate by * @param dest The destination matrix or null if a new matrix is to be created * @return the translated matrix */ public Matrix4f translate(Vector2f vec, Matrix4f dest) { return translate(vec, this, dest); } /** * Translate the source matrix and stash the result in the destination matrix * @param vec The vector to translate by * @param src The source matrix * @param dest The destination matrix or null if a new matrix is to be created * @return The translated matrix */ public static Matrix4f translate(Vector2f vec, Matrix4f src, Matrix4f dest) { if (dest == null) dest = new Matrix4f(); dest.m30 += src.m00 * vec.x + src.m10 * vec.y; dest.m31 += src.m01 * vec.x + src.m11 * vec.y; dest.m32 += src.m02 * vec.x + src.m12 * vec.y; dest.m33 += src.m03 * vec.x + src.m13 * vec.y; return dest; } /** * Transpose this matrix and place the result in another matrix * @param dest The destination matrix or null if a new matrix is to be created * @return the transposed matrix */ public Matrix4f transpose(Matrix4f dest) { return transpose(this, dest); } /** * Transpose the source matrix and place the result in the destination matrix * @param src The source matrix * @param dest The destination matrix or null if a new matrix is to be created * @return the transposed matrix */ public static Matrix4f transpose(Matrix4f src, Matrix4f dest) { if (dest == null) dest = new Matrix4f(); float m00 = src.m00; float m01 = src.m10; float m02 = src.m20; float m03 = src.m30; float m10 = src.m01; float m11 = src.m11; float m12 = src.m21; float m13 = src.m31; float m20 = src.m02; float m21 = src.m12; float m22 = src.m22; float m23 = src.m32; float m30 = src.m03; float m31 = src.m13; float m32 = src.m23; float m33 = src.m33; dest.m00 = m00; dest.m01 = m01; dest.m02 = m02; dest.m03 = m03; dest.m10 = m10; dest.m11 = m11; dest.m12 = m12; dest.m13 = m13; dest.m20 = m20; dest.m21 = m21; dest.m22 = m22; dest.m23 = m23; dest.m30 = m30; dest.m31 = m31; dest.m32 = m32; dest.m33 = m33; return dest; } /** * @return the determinant of the matrix */ public float determinant() { float f = m00 * ((m11 * m22 * m33 + m12 * m23 * m31 + m13 * m21 * m32) - m13 * m22 * m31 - m11 * m23 * m32 - m12 * m21 * m33); f -= m01 * ((m10 * m22 * m33 + m12 * m23 * m30 + m13 * m20 * m32) - m13 * m22 * m30 - m10 * m23 * m32 - m12 * m20 * m33); f += m02 * ((m10 * m21 * m33 + m11 * m23 * m30 + m13 * m20 * m31) - m13 * m21 * m30 - m10 * m23 * m31 - m11 * m20 * m33); f -= m03 * ((m10 * m21 * m32 + m11 * m22 * m30 + m12 * m20 * m31) - m12 * m21 * m30 - m10 * m22 * m31 - m11 * m20 * m32); return f; } /** * Calculate the determinant of a 3x3 matrix * @return result */ private static float determinant3x3(float t00, float t01, float t02, float t10, float t11, float t12, float t20, float t21, float t22) { return t00 * (t11 * t22 - t12 * t21) + t01 * (t12 * t20 - t10 * t22) + t02 * (t10 * t21 - t11 * t20); } /** * Invert this matrix * @return this if successful, null otherwise */ public Matrix invert() { return invert(this, this); } /** * Invert the source matrix and put the result in the destination * @param src The source matrix * @param dest The destination matrix, or null if a new matrix is to be created * @return The inverted matrix if successful, null otherwise */ public static Matrix4f invert(Matrix4f src, Matrix4f dest) { float determinant = src.determinant(); if (determinant != 0) { /* * m00 m01 m02 m03 * m10 m11 m12 m13 * m20 m21 m22 m23 * m30 m31 m32 m33 */ if (dest == null) dest = new Matrix4f(); float determinant_inv = 1f/determinant; // first row float t00 = determinant3x3(src.m11, src.m12, src.m13, src.m21, src.m22, src.m23, src.m31, src.m32, src.m33); float t01 = -determinant3x3(src.m10, src.m12, src.m13, src.m20, src.m22, src.m23, src.m30, src.m32, src.m33); float t02 = determinant3x3(src.m10, src.m11, src.m13, src.m20, src.m21, src.m23, src.m30, src.m31, src.m33); float t03 = -determinant3x3(src.m10, src.m11, src.m12, src.m20, src.m21, src.m22, src.m30, src.m31, src.m32); // second row float t10 = -determinant3x3(src.m01, src.m02, src.m03, src.m21, src.m22, src.m23, src.m31, src.m32, src.m33); float t11 = determinant3x3(src.m00, src.m02, src.m03, src.m20, src.m22, src.m23, src.m30, src.m32, src.m33); float t12 = -determinant3x3(src.m00, src.m01, src.m03, src.m20, src.m21, src.m23, src.m30, src.m31, src.m33); float t13 = determinant3x3(src.m00, src.m01, src.m02, src.m20, src.m21, src.m22, src.m30, src.m31, src.m32); // third row float t20 = determinant3x3(src.m01, src.m02, src.m03, src.m11, src.m12, src.m13, src.m31, src.m32, src.m33); float t21 = -determinant3x3(src.m00, src.m02, src.m03, src.m10, src.m12, src.m13, src.m30, src.m32, src.m33); float t22 = determinant3x3(src.m00, src.m01, src.m03, src.m10, src.m11, src.m13, src.m30, src.m31, src.m33); float t23 = -determinant3x3(src.m00, src.m01, src.m02, src.m10, src.m11, src.m12, src.m30, src.m31, src.m32); // fourth row float t30 = -determinant3x3(src.m01, src.m02, src.m03, src.m11, src.m12, src.m13, src.m21, src.m22, src.m23); float t31 = determinant3x3(src.m00, src.m02, src.m03, src.m10, src.m12, src.m13, src.m20, src.m22, src.m23); float t32 = -determinant3x3(src.m00, src.m01, src.m03, src.m10, src.m11, src.m13, src.m20, src.m21, src.m23); float t33 = determinant3x3(src.m00, src.m01, src.m02, src.m10, src.m11, src.m12, src.m20, src.m21, src.m22); // transpose and divide by the determinant dest.m00 = t00*determinant_inv; dest.m11 = t11*determinant_inv; dest.m22 = t22*determinant_inv; dest.m33 = t33*determinant_inv; dest.m01 = t10*determinant_inv; dest.m10 = t01*determinant_inv; dest.m20 = t02*determinant_inv; dest.m02 = t20*determinant_inv; dest.m12 = t21*determinant_inv; dest.m21 = t12*determinant_inv; dest.m03 = t30*determinant_inv; dest.m30 = t03*determinant_inv; dest.m13 = t31*determinant_inv; dest.m31 = t13*determinant_inv; dest.m32 = t23*determinant_inv; dest.m23 = t32*determinant_inv; return dest; } else return null; } /** * Negate this matrix * @return this */ public Matrix negate() { return negate(this); } /** * Negate this matrix and place the result in a destination matrix. * @param dest The destination matrix, or null if a new matrix is to be created * @return the negated matrix */ public Matrix4f negate(Matrix4f dest) { return negate(this, this); } /** * Negate this matrix and place the result in a destination matrix. * @param src The source matrix * @param dest The destination matrix, or null if a new matrix is to be created * @return The negated matrix */ public static Matrix4f negate(Matrix4f src, Matrix4f dest) { if (dest == null) dest = new Matrix4f(); dest.m00 = -src.m00; dest.m01 = -src.m01; dest.m02 = -src.m02; dest.m03 = -src.m03; dest.m10 = -src.m10; dest.m11 = -src.m11; dest.m12 = -src.m12; dest.m13 = -src.m13; dest.m20 = -src.m20; dest.m21 = -src.m21; dest.m22 = -src.m22; dest.m23 = -src.m23; dest.m30 = -src.m30; dest.m31 = -src.m31; dest.m32 = -src.m32; dest.m33 = -src.m33; return dest; } } lwjgl-2.7.1/src/java/org/lwjgl/util/vector/ReadableVector4f.java0000644000175000017500000000330111543426510023572 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; /** * @author foo */ public interface ReadableVector4f extends ReadableVector3f { /** * @return w */ float getW(); } lwjgl-2.7.1/src/java/org/lwjgl/util/vector/Matrix3f.java0000644000175000017500000003165711543426510022172 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; import java.io.Serializable; import java.nio.FloatBuffer; /** * * Holds a 3x3 matrix. * * @author cix_foo * @version $Revision: 3418 $ * $Id: Matrix3f.java 3418 2010-09-28 21:11:35Z spasi $ */ public class Matrix3f extends Matrix implements Serializable { private static final long serialVersionUID = 1L; public float m00, m01, m02, m10, m11, m12, m20, m21, m22; /** * Constructor for Matrix3f. Matrix is initialised to the identity. */ public Matrix3f() { super(); setIdentity(); } /** * Load from another matrix * @param src The source matrix * @return this */ public Matrix3f load(Matrix3f src) { return load(src, this); } /** * Copy source matrix to destination matrix * @param src The source matrix * @param dest The destination matrix, or null of a new matrix is to be created * @return The copied matrix */ public static Matrix3f load(Matrix3f src, Matrix3f dest) { if (dest == null) dest = new Matrix3f(); dest.m00 = src.m00; dest.m10 = src.m10; dest.m20 = src.m20; dest.m01 = src.m01; dest.m11 = src.m11; dest.m21 = src.m21; dest.m02 = src.m02; dest.m12 = src.m12; dest.m22 = src.m22; return dest; } /** * Load from a float buffer. The buffer stores the matrix in column major * (OpenGL) order. * * @param buf A float buffer to read from * @return this */ public Matrix load(FloatBuffer buf) { m00 = buf.get(); m01 = buf.get(); m02 = buf.get(); m10 = buf.get(); m11 = buf.get(); m12 = buf.get(); m20 = buf.get(); m21 = buf.get(); m22 = buf.get(); return this; } /** * Load from a float buffer. The buffer stores the matrix in row major * (maths) order. * * @param buf A float buffer to read from * @return this */ public Matrix loadTranspose(FloatBuffer buf) { m00 = buf.get(); m10 = buf.get(); m20 = buf.get(); m01 = buf.get(); m11 = buf.get(); m21 = buf.get(); m02 = buf.get(); m12 = buf.get(); m22 = buf.get(); return this; } /** * Store this matrix in a float buffer. The matrix is stored in column * major (openGL) order. * @param buf The buffer to store this matrix in */ public Matrix store(FloatBuffer buf) { buf.put(m00); buf.put(m01); buf.put(m02); buf.put(m10); buf.put(m11); buf.put(m12); buf.put(m20); buf.put(m21); buf.put(m22); return this; } /** * Store this matrix in a float buffer. The matrix is stored in row * major (maths) order. * @param buf The buffer to store this matrix in */ public Matrix storeTranspose(FloatBuffer buf) { buf.put(m00); buf.put(m10); buf.put(m20); buf.put(m01); buf.put(m11); buf.put(m21); buf.put(m02); buf.put(m12); buf.put(m22); return this; } /** * Add two matrices together and place the result in a third matrix. * @param left The left source matrix * @param right The right source matrix * @param dest The destination matrix, or null if a new one is to be created * @return the destination matrix */ public static Matrix3f add(Matrix3f left, Matrix3f right, Matrix3f dest) { if (dest == null) dest = new Matrix3f(); dest.m00 = left.m00 + right.m00; dest.m01 = left.m01 + right.m01; dest.m02 = left.m02 + right.m02; dest.m10 = left.m10 + right.m10; dest.m11 = left.m11 + right.m11; dest.m12 = left.m12 + right.m12; dest.m20 = left.m20 + right.m20; dest.m21 = left.m21 + right.m21; dest.m22 = left.m22 + right.m22; return dest; } /** * Subtract the right matrix from the left and place the result in a third matrix. * @param left The left source matrix * @param right The right source matrix * @param dest The destination matrix, or null if a new one is to be created * @return the destination matrix */ public static Matrix3f sub(Matrix3f left, Matrix3f right, Matrix3f dest) { if (dest == null) dest = new Matrix3f(); dest.m00 = left.m00 - right.m00; dest.m01 = left.m01 - right.m01; dest.m02 = left.m02 - right.m02; dest.m10 = left.m10 - right.m10; dest.m11 = left.m11 - right.m11; dest.m12 = left.m12 - right.m12; dest.m20 = left.m20 - right.m20; dest.m21 = left.m21 - right.m21; dest.m22 = left.m22 - right.m22; return dest; } /** * Multiply the right matrix by the left and place the result in a third matrix. * @param left The left source matrix * @param right The right source matrix * @param dest The destination matrix, or null if a new one is to be created * @return the destination matrix */ public static Matrix3f mul(Matrix3f left, Matrix3f right, Matrix3f dest) { if (dest == null) dest = new Matrix3f(); float m00 = left.m00 * right.m00 + left.m10 * right.m01 + left.m20 * right.m02; float m01 = left.m01 * right.m00 + left.m11 * right.m01 + left.m21 * right.m02; float m02 = left.m02 * right.m00 + left.m12 * right.m01 + left.m22 * right.m02; float m10 = left.m00 * right.m10 + left.m10 * right.m11 + left.m20 * right.m12; float m11 = left.m01 * right.m10 + left.m11 * right.m11 + left.m21 * right.m12; float m12 = left.m02 * right.m10 + left.m12 * right.m11 + left.m22 * right.m12; float m20 = left.m00 * right.m20 + left.m10 * right.m21 + left.m20 * right.m22; float m21 = left.m01 * right.m20 + left.m11 * right.m21 + left.m21 * right.m22; float m22 = left.m02 * right.m20 + left.m12 * right.m21 + left.m22 * right.m22; dest.m00 = m00; dest.m01 = m01; dest.m02 = m02; dest.m10 = m10; dest.m11 = m11; dest.m12 = m12; dest.m20 = m20; dest.m21 = m21; dest.m22 = m22; return dest; } /** * Transform a Vector by a matrix and return the result in a destination * vector. * @param left The left matrix * @param right The right vector * @param dest The destination vector, or null if a new one is to be created * @return the destination vector */ public static Vector3f transform(Matrix3f left, Vector3f right, Vector3f dest) { if (dest == null) dest = new Vector3f(); float x = left.m00 * right.x + left.m10 * right.y + left.m20 * right.z; float y = left.m01 * right.x + left.m11 * right.y + left.m21 * right.z; float z = left.m02 * right.x + left.m12 * right.y + left.m22 * right.z; dest.x = x; dest.y = y; dest.z = z; return dest; } /** * Transpose this matrix * @return this */ public Matrix transpose() { return transpose(this, this); } /** * Transpose this matrix and place the result in another matrix * @param dest The destination matrix or null if a new matrix is to be created * @return the transposed matrix */ public Matrix3f transpose(Matrix3f dest) { return transpose(this, dest); } /** * Transpose the source matrix and place the result into the destination matrix * @param src The source matrix to be transposed * @param dest The destination matrix or null if a new matrix is to be created * @return the transposed matrix */ public static Matrix3f transpose(Matrix3f src, Matrix3f dest) { if (dest == null) dest = new Matrix3f(); float m00 = src.m00; float m01 = src.m10; float m02 = src.m20; float m10 = src.m01; float m11 = src.m11; float m12 = src.m21; float m20 = src.m02; float m21 = src.m12; float m22 = src.m22; dest.m00 = m00; dest.m01 = m01; dest.m02 = m02; dest.m10 = m10; dest.m11 = m11; dest.m12 = m12; dest.m20 = m20; dest.m21 = m21; dest.m22 = m22; return dest; } /** * @return the determinant of the matrix */ public float determinant() { float f = m00 * (m11 * m22 - m12 * m21) + m01 * (m12 * m20 - m10 * m22) + m02 * (m10 * m21 - m11 * m20); return f; } /** * Returns a string representation of this matrix */ public String toString() { StringBuilder buf = new StringBuilder(); buf.append(m00).append(' ').append(m10).append(' ').append(m20).append(' ').append('\n'); buf.append(m01).append(' ').append(m11).append(' ').append(m21).append(' ').append('\n'); buf.append(m02).append(' ').append(m12).append(' ').append(m22).append(' ').append('\n'); return buf.toString(); } /** * Invert this matrix * @return this if successful, null otherwise */ public Matrix invert() { return invert(this, this); } /** * Invert the source matrix and put the result into the destination matrix * @param src The source matrix to be inverted * @param dest The destination matrix, or null if a new one is to be created * @return The inverted matrix if successful, null otherwise */ public static Matrix3f invert(Matrix3f src, Matrix3f dest) { float determinant = src.determinant(); if (determinant != 0) { if (dest == null) dest = new Matrix3f(); /* do it the ordinary way * * inv(A) = 1/det(A) * adj(T), where adj(T) = transpose(Conjugate Matrix) * * m00 m01 m02 * m10 m11 m12 * m20 m21 m22 */ float determinant_inv = 1f/determinant; // get the conjugate matrix float t00 = src.m11 * src.m22 - src.m12* src.m21; float t01 = - src.m10 * src.m22 + src.m12 * src.m20; float t02 = src.m10 * src.m21 - src.m11 * src.m20; float t10 = - src.m01 * src.m22 + src.m02 * src.m21; float t11 = src.m00 * src.m22 - src.m02 * src.m20; float t12 = - src.m00 * src.m21 + src.m01 * src.m20; float t20 = src.m01 * src.m12 - src.m02 * src.m11; float t21 = -src.m00 * src.m12 + src.m02 * src.m10; float t22 = src.m00 * src.m11 - src.m01 * src.m10; dest.m00 = t00*determinant_inv; dest.m11 = t11*determinant_inv; dest.m22 = t22*determinant_inv; dest.m01 = t10*determinant_inv; dest.m10 = t01*determinant_inv; dest.m20 = t02*determinant_inv; dest.m02 = t20*determinant_inv; dest.m12 = t21*determinant_inv; dest.m21 = t12*determinant_inv; return dest; } else return null; } /** * Negate this matrix * @return this */ public Matrix negate() { return negate(this); } /** * Negate this matrix and place the result in a destination matrix. * @param dest The destination matrix, or null if a new matrix is to be created * @return the negated matrix */ public Matrix3f negate(Matrix3f dest) { return negate(this, this); } /** * Negate the source matrix and place the result in the destination matrix. * @param src The source matrix * @param dest The destination matrix, or null if a new matrix is to be created * @return the negated matrix */ public static Matrix3f negate(Matrix3f src, Matrix3f dest) { if (dest == null) dest = new Matrix3f(); dest.m00 = -src.m00; dest.m01 = -src.m02; dest.m02 = -src.m01; dest.m10 = -src.m10; dest.m11 = -src.m12; dest.m12 = -src.m11; dest.m20 = -src.m20; dest.m21 = -src.m22; dest.m22 = -src.m21; return dest; } /** * Set this matrix to be the identity matrix. * @return this */ public Matrix setIdentity() { return setIdentity(this); } /** * Set the matrix to be the identity matrix. * @param m The matrix to be set to the identity * @return m */ public static Matrix3f setIdentity(Matrix3f m) { m.m00 = 1.0f; m.m01 = 0.0f; m.m02 = 0.0f; m.m10 = 0.0f; m.m11 = 1.0f; m.m12 = 0.0f; m.m20 = 0.0f; m.m21 = 0.0f; m.m22 = 1.0f; return m; } /** * Set this matrix to 0. * @return this */ public Matrix setZero() { return setZero(this); } /** * Set the matrix matrix to 0. * @param m The matrix to be set to 0 * @return m */ public static Matrix3f setZero(Matrix3f m) { m.m00 = 0.0f; m.m01 = 0.0f; m.m02 = 0.0f; m.m10 = 0.0f; m.m11 = 0.0f; m.m12 = 0.0f; m.m20 = 0.0f; m.m21 = 0.0f; m.m22 = 0.0f; return m; } } lwjgl-2.7.1/src/java/org/lwjgl/util/vector/Matrix2f.java0000644000175000017500000002365411543426510022167 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; import java.io.Serializable; import java.nio.FloatBuffer; /** * * Holds a 2x2 matrix * * @author cix_foo * @version $Revision: 3418 $ * $Id: Matrix2f.java 3418 2010-09-28 21:11:35Z spasi $ */ public class Matrix2f extends Matrix implements Serializable { private static final long serialVersionUID = 1L; public float m00, m01, m10, m11; /** * Constructor for Matrix2f. The matrix is initialised to the identity. */ public Matrix2f() { setIdentity(); } /** * Constructor */ public Matrix2f(Matrix2f src) { load(src); } /** * Load from another matrix * @param src The source matrix * @return this */ public Matrix2f load(Matrix2f src) { return load(src, this); } /** * Copy the source matrix to the destination matrix. * @param src The source matrix * @param dest The destination matrix, or null if a new one should be created. * @return The copied matrix */ public static Matrix2f load(Matrix2f src, Matrix2f dest) { if (dest == null) dest = new Matrix2f(); dest.m00 = src.m00; dest.m01 = src.m01; dest.m10 = src.m10; dest.m11 = src.m11; return dest; } /** * Load from a float buffer. The buffer stores the matrix in column major * (OpenGL) order. * * @param buf A float buffer to read from * @return this */ public Matrix load(FloatBuffer buf) { m00 = buf.get(); m01 = buf.get(); m10 = buf.get(); m11 = buf.get(); return this; } /** * Load from a float buffer. The buffer stores the matrix in row major * (mathematical) order. * * @param buf A float buffer to read from * @return this */ public Matrix loadTranspose(FloatBuffer buf) { m00 = buf.get(); m10 = buf.get(); m01 = buf.get(); m11 = buf.get(); return this; } /** * Store this matrix in a float buffer. The matrix is stored in column * major (openGL) order. * @param buf The buffer to store this matrix in */ public Matrix store(FloatBuffer buf) { buf.put(m00); buf.put(m01); buf.put(m10); buf.put(m11); return this; } /** * Store this matrix in a float buffer. The matrix is stored in row * major (maths) order. * @param buf The buffer to store this matrix in */ public Matrix storeTranspose(FloatBuffer buf) { buf.put(m00); buf.put(m10); buf.put(m01); buf.put(m11); return this; } /** * Add two matrices together and place the result in a third matrix. * @param left The left source matrix * @param right The right source matrix * @param dest The destination matrix, or null if a new one is to be created * @return the destination matrix */ public static Matrix2f add(Matrix2f left, Matrix2f right, Matrix2f dest) { if (dest == null) dest = new Matrix2f(); dest.m00 = left.m00 + right.m00; dest.m01 = left.m01 + right.m01; dest.m10 = left.m10 + right.m10; dest.m11 = left.m11 + right.m11; return dest; } /** * Subtract the right matrix from the left and place the result in a third matrix. * @param left The left source matrix * @param right The right source matrix * @param dest The destination matrix, or null if a new one is to be created * @return the destination matrix */ public static Matrix2f sub(Matrix2f left, Matrix2f right, Matrix2f dest) { if (dest == null) dest = new Matrix2f(); dest.m00 = left.m00 - right.m00; dest.m01 = left.m01 - right.m01; dest.m10 = left.m10 - right.m10; dest.m11 = left.m11 - right.m11; return dest; } /** * Multiply the right matrix by the left and place the result in a third matrix. * @param left The left source matrix * @param right The right source matrix * @param dest The destination matrix, or null if a new one is to be created * @return the destination matrix */ public static Matrix2f mul(Matrix2f left, Matrix2f right, Matrix2f dest) { if (dest == null) dest = new Matrix2f(); float m00 = left.m00 * right.m00 + left.m10 * right.m01; float m01 = left.m01 * right.m00 + left.m11 * right.m01; float m10 = left.m00 * right.m10 + left.m10 * right.m11; float m11 = left.m01 * right.m10 + left.m11 * right.m11; dest.m00 = m00; dest.m01 = m01; dest.m10 = m10; dest.m11 = m11; return dest; } /** * Transform a Vector by a matrix and return the result in a destination * vector. * @param left The left matrix * @param right The right vector * @param dest The destination vector, or null if a new one is to be created * @return the destination vector */ public static Vector2f transform(Matrix2f left, Vector2f right, Vector2f dest) { if (dest == null) dest = new Vector2f(); float x = left.m00 * right.x + left.m10 * right.y; float y = left.m01 * right.x + left.m11 * right.y; dest.x = x; dest.y = y; return dest; } /** * Transpose this matrix * @return this */ public Matrix transpose() { return transpose(this); } /** * Transpose this matrix and place the result in another matrix. * @param dest The destination matrix or null if a new matrix is to be created * @return the transposed matrix */ public Matrix2f transpose(Matrix2f dest) { return transpose(this, dest); } /** * Transpose the source matrix and place the result in the destination matrix. * @param src The source matrix or null if a new matrix is to be created * @param dest The destination matrix or null if a new matrix is to be created * @return the transposed matrix */ public static Matrix2f transpose(Matrix2f src, Matrix2f dest) { if (dest == null) dest = new Matrix2f(); float m01 = src.m10; float m10 = src.m01; dest.m01 = m01; dest.m10 = m10; return dest; } /** * Invert this matrix * @return this if successful, null otherwise */ public Matrix invert() { return invert(this, this); } /** * Invert the source matrix and place the result in the destination matrix. * @param src The source matrix to be inverted * @param dest The destination matrix or null if a new matrix is to be created * @return The inverted matrix, or null if source can't be reverted. */ public static Matrix2f invert(Matrix2f src, Matrix2f dest) { /* *inv(A) = 1/det(A) * adj(A); */ float determinant = src.determinant(); if (determinant != 0) { if (dest == null) dest = new Matrix2f(); float determinant_inv = 1f/determinant; float t00 = src.m11*determinant_inv; float t01 = -src.m01*determinant_inv; float t11 = src.m00*determinant_inv; float t10 = -src.m10*determinant_inv; dest.m00 = t00; dest.m01 = t01; dest.m10 = t10; dest.m11 = t11; return dest; } else return null; } /** * Returns a string representation of this matrix */ public String toString() { StringBuilder buf = new StringBuilder(); buf.append(m00).append(' ').append(m10).append(' ').append('\n'); buf.append(m01).append(' ').append(m11).append(' ').append('\n'); return buf.toString(); } /** * Negate this matrix * @return this */ public Matrix negate() { return negate(this); } /** * Negate this matrix and stash the result in another matrix. * @param dest The destination matrix, or null if a new matrix is to be created * @return the negated matrix */ public Matrix2f negate(Matrix2f dest) { return negate(this, this); } /** * Negate the source matrix and stash the result in the destination matrix. * @param src The source matrix to be negated * @param dest The destination matrix, or null if a new matrix is to be created * @return the negated matrix */ public static Matrix2f negate(Matrix2f src, Matrix2f dest) { if (dest == null) dest = new Matrix2f(); dest.m00 = -src.m00; dest.m01 = -src.m01; dest.m10 = -src.m10; dest.m11 = -src.m11; return dest; } /** * Set this matrix to be the identity matrix. * @return this */ public Matrix setIdentity() { return setIdentity(this); } /** * Set the source matrix to be the identity matrix. * @param src The matrix to set to the identity. * @return The source matrix */ public static Matrix2f setIdentity(Matrix2f src) { src.m00 = 1.0f; src.m01 = 0.0f; src.m10 = 0.0f; src.m11 = 1.0f; return src; } /** * Set this matrix to 0. * @return this */ public Matrix setZero() { return setZero(this); } public static Matrix2f setZero(Matrix2f src) { src.m00 = 0.0f; src.m01 = 0.0f; src.m10 = 0.0f; src.m11 = 0.0f; return src; } /* (non-Javadoc) * @see org.lwjgl.vector.Matrix#determinant() */ public float determinant() { return m00 * m11 - m01*m10; } } lwjgl-2.7.1/src/java/org/lwjgl/util/vector/ReadableVector.java0000644000175000017500000000371511543426510023351 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; import java.nio.FloatBuffer; /** * @author foo */ public interface ReadableVector { /** * @return the length of the vector */ float length(); /** * @return the length squared of the vector */ float lengthSquared(); /** * Store this vector in a FloatBuffer * @param buf The buffer to store it in, at the current position * @return this */ Vector store(FloatBuffer buf); }lwjgl-2.7.1/src/java/org/lwjgl/util/vector/Vector3f.java0000644000175000017500000001702411543426510022160 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; import java.io.Serializable; import java.nio.FloatBuffer; /** * * Holds a 3-tuple vector. * * @author cix_foo * @version $Revision: 3418 $ * $Id: Vector3f.java 3418 2010-09-28 21:11:35Z spasi $ */ public class Vector3f extends Vector implements Serializable, ReadableVector3f, WritableVector3f { private static final long serialVersionUID = 1L; public float x, y, z; /** * Constructor for Vector3f. */ public Vector3f() { super(); } /** * Constructor */ public Vector3f(ReadableVector3f src) { set(src); } /** * Constructor */ public Vector3f(float x, float y, float z) { set(x, y, z); } /* (non-Javadoc) * @see org.lwjgl.util.vector.WritableVector2f#set(float, float) */ public void set(float x, float y) { this.x = x; this.y = y; } /* (non-Javadoc) * @see org.lwjgl.util.vector.WritableVector3f#set(float, float, float) */ public void set(float x, float y, float z) { this.x = x; this.y = y; this.z = z; } /** * Load from another Vector3f * @param src The source vector * @return this */ public Vector3f set(ReadableVector3f src) { x = src.getX(); y = src.getY(); z = src.getZ(); return this; } /** * @return the length squared of the vector */ public float lengthSquared() { return x * x + y * y + z * z; } /** * Translate a vector * @param x The translation in x * @param y the translation in y * @return this */ public Vector3f translate(float x, float y, float z) { this.x += x; this.y += y; this.z += z; return this; } /** * Add a vector to another vector and place the result in a destination * vector. * @param left The LHS vector * @param right The RHS vector * @param dest The destination vector, or null if a new vector is to be created * @return the sum of left and right in dest */ public static Vector3f add(Vector3f left, Vector3f right, Vector3f dest) { if (dest == null) return new Vector3f(left.x + right.x, left.y + right.y, left.z + right.z); else { dest.set(left.x + right.x, left.y + right.y, left.z + right.z); return dest; } } /** * Subtract a vector from another vector and place the result in a destination * vector. * @param left The LHS vector * @param right The RHS vector * @param dest The destination vector, or null if a new vector is to be created * @return left minus right in dest */ public static Vector3f sub(Vector3f left, Vector3f right, Vector3f dest) { if (dest == null) return new Vector3f(left.x - right.x, left.y - right.y, left.z - right.z); else { dest.set(left.x - right.x, left.y - right.y, left.z - right.z); return dest; } } /** * The cross product of two vectors. * * @param left The LHS vector * @param right The RHS vector * @param dest The destination result, or null if a new vector is to be created * @return left cross right */ public static Vector3f cross( Vector3f left, Vector3f right, Vector3f dest) { if (dest == null) dest = new Vector3f(); dest.set( left.y * right.z - left.z * right.y, right.x * left.z - right.z * left.x, left.x * right.y - left.y * right.x ); return dest; } /** * Negate a vector * @return this */ public Vector negate() { x = -x; y = -y; z = -z; return this; } /** * Negate a vector and place the result in a destination vector. * @param dest The destination vector or null if a new vector is to be created * @return the negated vector */ public Vector3f negate(Vector3f dest) { if (dest == null) dest = new Vector3f(); dest.x = -x; dest.y = -y; dest.z = -z; return dest; } /** * Normalise this vector and place the result in another vector. * @param dest The destination vector, or null if a new vector is to be created * @return the normalised vector */ public Vector3f normalise(Vector3f dest) { float l = length(); if (dest == null) dest = new Vector3f(x / l, y / l, z / l); else dest.set(x / l, y / l, z / l); return dest; } /** * The dot product of two vectors is calculated as * v1.x * v2.x + v1.y * v2.y + v1.z * v2.z * @param left The LHS vector * @param right The RHS vector * @return left dot right */ public static float dot(Vector3f left, Vector3f right) { return left.x * right.x + left.y * right.y + left.z * right.z; } /** * Calculate the angle between two vectors, in radians * @param a A vector * @param b The other vector * @return the angle between the two vectors, in radians */ public static float angle(Vector3f a, Vector3f b) { float dls = dot(a, b) / (a.length() * b.length()); if (dls < -1f) dls = -1f; else if (dls > 1.0f) dls = 1.0f; return (float)Math.acos(dls); } /* (non-Javadoc) * @see org.lwjgl.vector.Vector#load(FloatBuffer) */ public Vector load(FloatBuffer buf) { x = buf.get(); y = buf.get(); z = buf.get(); return this; } /* (non-Javadoc) * @see org.lwjgl.vector.Vector#scale(float) */ public Vector scale(float scale) { x *= scale; y *= scale; z *= scale; return this; } /* (non-Javadoc) * @see org.lwjgl.vector.Vector#store(FloatBuffer) */ public Vector store(FloatBuffer buf) { buf.put(x); buf.put(y); buf.put(z); return this; } /* (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { StringBuilder sb = new StringBuilder(64); sb.append("Vector3f["); sb.append(x); sb.append(", "); sb.append(y); sb.append(", "); sb.append(z); sb.append(']'); return sb.toString(); } /** * @return x */ public final float getX() { return x; } /** * @return y */ public final float getY() { return y; } /** * Set X * @param x */ public final void setX(float x) { this.x = x; } /** * Set Y * @param y */ public final void setY(float y) { this.y = y; } /** * Set Z * @param z */ public void setZ(float z) { this.z = z; } /* (Overrides) * @see org.lwjgl.vector.ReadableVector3f#getZ() */ public float getZ() { return z; } } lwjgl-2.7.1/src/java/org/lwjgl/util/vector/WritableVector2f.java0000644000175000017500000000373211543426510023652 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; /** * Writable interface to Vector2fs * @author $author$ * @version $revision$ * $Id: WritableVector2f.java 3418 2010-09-28 21:11:35Z spasi $ */ public interface WritableVector2f { /** * Set the X value * @param x */ void setX(float x); /** * Set the Y value * @param y */ void setY(float y); /** * Set the X,Y values * @param x * @param y */ void set(float x, float y); }lwjgl-2.7.1/src/java/org/lwjgl/util/vector/WritableVector3f.java0000644000175000017500000000371311543426510023652 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; /** * Writable interface to Vector3fs * @author $author$ * @version $revision$ * $Id: WritableVector3f.java 3418 2010-09-28 21:11:35Z spasi $ */ public interface WritableVector3f extends WritableVector2f { /** * Set the Z value * @param z */ void setZ(float z); /** * Set the X,Y,Z values * @param x * @param y * @param z */ void set(float x, float y, float z); }lwjgl-2.7.1/src/java/org/lwjgl/util/vector/Vector2f.java0000644000175000017500000001475711543426510022171 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; import java.io.Serializable; import java.nio.FloatBuffer; /** * * Holds a 2-tuple vector. * * @author cix_foo * @version $Revision: 3418 $ * $Id: Vector2f.java 3418 2010-09-28 21:11:35Z spasi $ */ public class Vector2f extends Vector implements Serializable, ReadableVector2f, WritableVector2f { private static final long serialVersionUID = 1L; public float x, y; /** * Constructor for Vector3f. */ public Vector2f() { super(); } /** * Constructor */ public Vector2f(ReadableVector2f src) { set(src); } /** * Constructor */ public Vector2f(float x, float y) { set(x, y); } /* (non-Javadoc) * @see org.lwjgl.util.vector.WritableVector2f#set(float, float) */ public void set(float x, float y) { this.x = x; this.y = y; } /** * Load from another Vector2f * @param src The source vector * @return this */ public Vector2f set(ReadableVector2f src) { x = src.getX(); y = src.getY(); return this; } /** * @return the length squared of the vector */ public float lengthSquared() { return x * x + y * y; } /** * Translate a vector * @param x The translation in x * @param y the translation in y * @return this */ public Vector2f translate(float x, float y) { this.x += x; this.y += y; return this; } /** * Negate a vector * @return this */ public Vector negate() { x = -x; y = -y; return this; } /** * Negate a vector and place the result in a destination vector. * @param dest The destination vector or null if a new vector is to be created * @return the negated vector */ public Vector2f negate(Vector2f dest) { if (dest == null) dest = new Vector2f(); dest.x = -x; dest.y = -y; return dest; } /** * Normalise this vector and place the result in another vector. * @param dest The destination vector, or null if a new vector is to be created * @return the normalised vector */ public Vector2f normalise(Vector2f dest) { float l = length(); if (dest == null) dest = new Vector2f(x / l, y / l); else dest.set(x / l, y / l); return dest; } /** * The dot product of two vectors is calculated as * v1.x * v2.x + v1.y * v2.y + v1.z * v2.z * @param left The LHS vector * @param right The RHS vector * @return left dot right */ public static float dot(Vector2f left, Vector2f right) { return left.x * right.x + left.y * right.y; } /** * Calculate the angle between two vectors, in radians * @param a A vector * @param b The other vector * @return the angle between the two vectors, in radians */ public static float angle(Vector2f a, Vector2f b) { float dls = dot(a, b) / (a.length() * b.length()); if (dls < -1f) dls = -1f; else if (dls > 1.0f) dls = 1.0f; return (float)Math.acos(dls); } /** * Add a vector to another vector and place the result in a destination * vector. * @param left The LHS vector * @param right The RHS vector * @param dest The destination vector, or null if a new vector is to be created * @return the sum of left and right in dest */ public static Vector2f add(Vector2f left, Vector2f right, Vector2f dest) { if (dest == null) return new Vector2f(left.x + right.x, left.y + right.y); else { dest.set(left.x + right.x, left.y + right.y); return dest; } } /** * Subtract a vector from another vector and place the result in a destination * vector. * @param left The LHS vector * @param right The RHS vector * @param dest The destination vector, or null if a new vector is to be created * @return left minus right in dest */ public static Vector2f sub(Vector2f left, Vector2f right, Vector2f dest) { if (dest == null) return new Vector2f(left.x - right.x, left.y - right.y); else { dest.set(left.x - right.x, left.y - right.y); return dest; } } /** * Store this vector in a FloatBuffer * @param buf The buffer to store it in, at the current position * @return this */ public Vector store(FloatBuffer buf) { buf.put(x); buf.put(y); return this; } /** * Load this vector from a FloatBuffer * @param buf The buffer to load it from, at the current position * @return this */ public Vector load(FloatBuffer buf) { x = buf.get(); y = buf.get(); return this; } /* (non-Javadoc) * @see org.lwjgl.vector.Vector#scale(float) */ public Vector scale(float scale) { x *= scale; y *= scale; return this; } /* (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { StringBuilder sb = new StringBuilder(64); sb.append("Vector2f["); sb.append(x); sb.append(", "); sb.append(y); sb.append(']'); return sb.toString(); } /** * @return x */ public final float getX() { return x; } /** * @return y */ public final float getY() { return y; } /** * Set X * @param x */ public final void setX(float x) { this.x = x; } /** * Set Y * @param y */ public final void setY(float y) { this.y = y; } } lwjgl-2.7.1/src/java/org/lwjgl/util/vector/WritableVector4f.java0000644000175000017500000000374411543426510023657 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; /** * Writable interface to Vector4fs * @author $author$ * @version $revision$ * $Id: WritableVector4f.java 3418 2010-09-28 21:11:35Z spasi $ */ public interface WritableVector4f extends WritableVector3f { /** * Set the W value * @param w */ void setW(float w); /** * Set the X,Y,Z,W values * @param x * @param y * @param z * @param w */ void set(float x, float y, float z, float w); }lwjgl-2.7.1/src/java/org/lwjgl/util/vector/Matrix.java0000644000175000017500000000670311543426510021733 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; import java.io.Serializable; import java.nio.FloatBuffer; /** * * Base class for matrices. When a matrix is constructed it will be the identity * matrix unless otherwise stated. * * @author cix_foo * @version $Revision: 3418 $ * $Id: Matrix.java 3418 2010-09-28 21:11:35Z spasi $ */ public abstract class Matrix implements Serializable { /** * Constructor for Matrix. */ protected Matrix() { super(); } /** * Set this matrix to be the identity matrix. * @return this */ public abstract Matrix setIdentity(); /** * Invert this matrix * @return this */ public abstract Matrix invert(); /** * Load from a float buffer. The buffer stores the matrix in column major * (OpenGL) order. * * @param buf A float buffer to read from * @return this */ public abstract Matrix load(FloatBuffer buf); /** * Load from a float buffer. The buffer stores the matrix in row major * (mathematical) order. * * @param buf A float buffer to read from * @return this */ public abstract Matrix loadTranspose(FloatBuffer buf); /** * Negate this matrix * @return this */ public abstract Matrix negate(); /** * Store this matrix in a float buffer. The matrix is stored in column * major (openGL) order. * @param buf The buffer to store this matrix in * @return this */ public abstract Matrix store(FloatBuffer buf); /** * Store this matrix in a float buffer. The matrix is stored in row * major (maths) order. * @param buf The buffer to store this matrix in * @return this */ public abstract Matrix storeTranspose(FloatBuffer buf); /** * Transpose this matrix * @return this */ public abstract Matrix transpose(); /** * Set this matrix to 0. * @return this */ public abstract Matrix setZero(); /** * @return the determinant of the matrix */ public abstract float determinant(); } lwjgl-2.7.1/src/java/org/lwjgl/util/vector/Vector.java0000644000175000017500000000573511543426510021735 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; import java.io.Serializable; import java.nio.FloatBuffer; /** * * Base class for vectors. * * @author cix_foo * @version $Revision: 3418 $ * $Id: Vector.java 3418 2010-09-28 21:11:35Z spasi $ */ public abstract class Vector implements Serializable, ReadableVector { /** * Constructor for Vector. */ protected Vector() { super(); } /** * @return the length of the vector */ public final float length() { return (float) Math.sqrt(lengthSquared()); } /** * @return the length squared of the vector */ public abstract float lengthSquared(); /** * Load this vector from a FloatBuffer * @param buf The buffer to load it from, at the current position * @return this */ public abstract Vector load(FloatBuffer buf); /** * Negate a vector * @return this */ public abstract Vector negate(); /** * Normalise this vector * @return this */ public final Vector normalise() { float len = length(); if (len != 0.0f) { float l = 1.0f / len; return scale(l); } else throw new IllegalStateException("Zero length vector"); } /** * Store this vector in a FloatBuffer * @param buf The buffer to store it in, at the current position * @return this */ public abstract Vector store(FloatBuffer buf); /** * Scale this vector * @param scale The scale factor * @return this */ public abstract Vector scale(float scale); } lwjgl-2.7.1/src/java/org/lwjgl/util/vector/ReadableVector2f.java0000644000175000017500000000334311543426510023576 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; /** * @author foo */ public interface ReadableVector2f extends ReadableVector { /** * @return x */ float getX(); /** * @return y */ float getY(); }lwjgl-2.7.1/src/java/org/lwjgl/util/vector/Vector4f.java0000644000175000017500000001674311543426510022170 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; import java.io.Serializable; import java.nio.FloatBuffer; /** * * Holds a 4-tuple vector. * * @author cix_foo * @version $Revision: 2983 $ * $Id: Vector4f.java 2983 2008-04-07 18:36:09Z matzon $ */ public class Vector4f extends Vector implements Serializable, ReadableVector4f, WritableVector4f { private static final long serialVersionUID = 1L; public float x, y, z, w; /** * Constructor for Vector4f. */ public Vector4f() { super(); } /** * Constructor */ public Vector4f(ReadableVector4f src) { set(src); } /** * Constructor */ public Vector4f(float x, float y, float z, float w) { set(x, y, z, w); } /* (non-Javadoc) * @see org.lwjgl.util.vector.WritableVector2f#set(float, float) */ public void set(float x, float y) { this.x = x; this.y = y; } /* (non-Javadoc) * @see org.lwjgl.util.vector.WritableVector3f#set(float, float, float) */ public void set(float x, float y, float z) { this.x = x; this.y = y; this.z = z; } /* (non-Javadoc) * @see org.lwjgl.util.vector.WritableVector4f#set(float, float, float, float) */ public void set(float x, float y, float z, float w) { this.x = x; this.y = y; this.z = z; this.w = w; } /** * Load from another Vector4f * @param src The source vector * @return this */ public Vector4f set(ReadableVector4f src) { x = src.getX(); y = src.getY(); z = src.getZ(); w = src.getW(); return this; } /** * @return the length squared of the vector */ public float lengthSquared() { return x * x + y * y + z * z + w * w; } /** * Translate a vector * @param x The translation in x * @param y the translation in y * @return this */ public Vector4f translate(float x, float y, float z, float w) { this.x += x; this.y += y; this.z += z; this.w += w; return this; } /** * Add a vector to another vector and place the result in a destination * vector. * @param left The LHS vector * @param right The RHS vector * @param dest The destination vector, or null if a new vector is to be created * @return the sum of left and right in dest */ public static Vector4f add(Vector4f left, Vector4f right, Vector4f dest) { if (dest == null) return new Vector4f(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w); else { dest.set(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w); return dest; } } /** * Subtract a vector from another vector and place the result in a destination * vector. * @param left The LHS vector * @param right The RHS vector * @param dest The destination vector, or null if a new vector is to be created * @return left minus right in dest */ public static Vector4f sub(Vector4f left, Vector4f right, Vector4f dest) { if (dest == null) return new Vector4f(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w); else { dest.set(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w); return dest; } } /** * Negate a vector * @return this */ public Vector negate() { x = -x; y = -y; z = -z; w = -w; return this; } /** * Negate a vector and place the result in a destination vector. * @param dest The destination vector or null if a new vector is to be created * @return the negated vector */ public Vector4f negate(Vector4f dest) { if (dest == null) dest = new Vector4f(); dest.x = -x; dest.y = -y; dest.z = -z; dest.w = -w; return dest; } /** * Normalise this vector and place the result in another vector. * @param dest The destination vector, or null if a new vector is to be created * @return the normalised vector */ public Vector4f normalise(Vector4f dest) { float l = length(); if (dest == null) dest = new Vector4f(x / l, y / l, z / l, w / l); else dest.set(x / l, y / l, z / l, w / l); return dest; } /** * The dot product of two vectors is calculated as * v1.x * v2.x + v1.y * v2.y + v1.z * v2.z + v1.w * v2.w * @param left The LHS vector * @param right The RHS vector * @return left dot right */ public static float dot(Vector4f left, Vector4f right) { return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w; } /** * Calculate the angle between two vectors, in radians * @param a A vector * @param b The other vector * @return the angle between the two vectors, in radians */ public static float angle(Vector4f a, Vector4f b) { float dls = dot(a, b) / (a.length() * b.length()); if (dls < -1f) dls = -1f; else if (dls > 1.0f) dls = 1.0f; return (float)Math.acos(dls); } /* (non-Javadoc) * @see org.lwjgl.vector.Vector#load(FloatBuffer) */ public Vector load(FloatBuffer buf) { x = buf.get(); y = buf.get(); z = buf.get(); w = buf.get(); return this; } /* (non-Javadoc) * @see org.lwjgl.vector.Vector#scale(float) */ public Vector scale(float scale) { x *= scale; y *= scale; z *= scale; w *= scale; return this; } /* (non-Javadoc) * @see org.lwjgl.vector.Vector#store(FloatBuffer) */ public Vector store(FloatBuffer buf) { buf.put(x); buf.put(y); buf.put(z); buf.put(w); return this; } public String toString() { return "Vector4f: " + x + " " + y + " " + z + " " + w; } /** * @return x */ public final float getX() { return x; } /** * @return y */ public final float getY() { return y; } /** * Set X * @param x */ public final void setX(float x) { this.x = x; } /** * Set Y * @param y */ public final void setY(float y) { this.y = y; } /** * Set Z * @param z */ public void setZ(float z) { this.z = z; } /* (Overrides) * @see org.lwjgl.vector.ReadableVector3f#getZ() */ public float getZ() { return z; } /** * Set W * @param w */ public void setW(float w) { this.w = w; } /* (Overrides) * @see org.lwjgl.vector.ReadableVector3f#getZ() */ public float getW() { return w; } } lwjgl-2.7.1/src/java/org/lwjgl/util/vector/Quaternion.java0000644000175000017500000003004611543426510022611 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.vector; /** * * Quaternions for LWJGL! * * @author fbi * @version $Revision: 3418 $ * $Id: Quaternion.java 3418 2010-09-28 21:11:35Z spasi $ */ import java.nio.FloatBuffer; public class Quaternion extends Vector implements ReadableVector4f { private static final long serialVersionUID = 1L; public float x, y, z, w; /** * C'tor. The quaternion will be initialized to the identity. */ public Quaternion() { super(); setIdentity(); } /** * C'tor * * @param src */ public Quaternion(ReadableVector4f src) { set(src); } /** * C'tor * */ public Quaternion(float x, float y, float z, float w) { set(x, y, z, w); } /* * (non-Javadoc) * * @see org.lwjgl.util.vector.WritableVector2f#set(float, float) */ public void set(float x, float y) { this.x = x; this.y = y; } /* * (non-Javadoc) * * @see org.lwjgl.util.vector.WritableVector3f#set(float, float, float) */ public void set(float x, float y, float z) { this.x = x; this.y = y; this.z = z; } /* * (non-Javadoc) * * @see org.lwjgl.util.vector.WritableVector4f#set(float, float, float, * float) */ public void set(float x, float y, float z, float w) { this.x = x; this.y = y; this.z = z; this.w = w; } /** * Load from another Vector4f * * @param src * The source vector * @return this */ public Quaternion set(ReadableVector4f src) { x = src.getX(); y = src.getY(); z = src.getZ(); w = src.getW(); return this; } /** * Set this quaternion to the multiplication identity. * @return this */ public Quaternion setIdentity() { return setIdentity(this); } /** * Set the given quaternion to the multiplication identity. * @param q The quaternion * @return q */ public static Quaternion setIdentity(Quaternion q) { q.x = 0; q.y = 0; q.z = 0; q.w = 1; return q; } /** * @return the length squared of the quaternion */ public float lengthSquared() { return x * x + y * y + z * z + w * w; } /** * Normalise the source quaternion and place the result in another quaternion. * * @param src * The source quaternion * @param dest * The destination quaternion, or null if a new quaternion is to be * created * @return The normalised quaternion */ public static Quaternion normalise(Quaternion src, Quaternion dest) { float inv_l = 1f/src.length(); if (dest == null) dest = new Quaternion(); dest.set(src.x * inv_l, src.y * inv_l, src.z * inv_l, src.w * inv_l); return dest; } /** * Normalise this quaternion and place the result in another quaternion. * * @param dest * The destination quaternion, or null if a new quaternion is to be * created * @return the normalised quaternion */ public Quaternion normalise(Quaternion dest) { return normalise(this, dest); } /** * The dot product of two quaternions * * @param left * The LHS quat * @param right * The RHS quat * @return left dot right */ public static float dot(Quaternion left, Quaternion right) { return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w; } /** * Calculate the conjugate of this quaternion and put it into the given one * * @param dest * The quaternion which should be set to the conjugate of this * quaternion */ public Quaternion negate(Quaternion dest) { return negate(this, dest); } /** * Calculate the conjugate of this quaternion and put it into the given one * * @param src * The source quaternion * @param dest * The quaternion which should be set to the conjugate of this * quaternion */ public static Quaternion negate(Quaternion src, Quaternion dest) { if (dest == null) dest = new Quaternion(); dest.x = -src.x; dest.y = -src.y; dest.z = -src.z; dest.w = src.w; return dest; } /** * Calculate the conjugate of this quaternion */ public Vector negate() { return negate(this, this); } /* (non-Javadoc) * @see org.lwjgl.util.vector.Vector#load(java.nio.FloatBuffer) */ public Vector load(FloatBuffer buf) { x = buf.get(); y = buf.get(); z = buf.get(); w = buf.get(); return this; } /* * (non-Javadoc) * * @see org.lwjgl.vector.Vector#scale(float) */ public Vector scale(float scale) { return scale(scale, this, this); } /** * Scale the source quaternion by scale and put the result in the destination * @param scale The amount to scale by * @param src The source quaternion * @param dest The destination quaternion, or null if a new quaternion is to be created * @return The scaled quaternion */ public static Quaternion scale(float scale, Quaternion src, Quaternion dest) { if (dest == null) dest = new Quaternion(); dest.x = src.x * scale; dest.y = src.y * scale; dest.z = src.z * scale; dest.w = src.w * scale; return dest; } /* (non-Javadoc) * @see org.lwjgl.util.vector.ReadableVector#store(java.nio.FloatBuffer) */ public Vector store(FloatBuffer buf) { buf.put(x); buf.put(y); buf.put(z); buf.put(w); return this; } /** * @return x */ public final float getX() { return x; } /** * @return y */ public final float getY() { return y; } /** * Set X * * @param x */ public final void setX(float x) { this.x = x; } /** * Set Y * * @param y */ public final void setY(float y) { this.y = y; } /** * Set Z * * @param z */ public void setZ(float z) { this.z = z; } /* * (Overrides) * * @see org.lwjgl.vector.ReadableVector3f#getZ() */ public float getZ() { return z; } /** * Set W * * @param w */ public void setW(float w) { this.w = w; } /* * (Overrides) * * @see org.lwjgl.vector.ReadableVector3f#getW() */ public float getW() { return w; } public String toString() { return "Quaternion: " + x + " " + y + " " + z + " " + w; } /** * Sets the value of this quaternion to the quaternion product of * quaternions left and right (this = left * right). Note that this is safe * for aliasing (e.g. this can be left or right). * * @param left * the first quaternion * @param right * the second quaternion */ public static Quaternion mul(Quaternion left, Quaternion right, Quaternion dest) { if (dest == null) dest = new Quaternion(); dest.set(left.x * right.w + left.w * right.x + left.y * right.z - left.z * right.y, left.y * right.w + left.w * right.y + left.z * right.x - left.x * right.z, left.z * right.w + left.w * right.z + left.x * right.y - left.y * right.x, left.w * right.w - left.x * right.x - left.y * right.y - left.z * right.z); return dest; } /** * * Multiplies quaternion left by the inverse of quaternion right and places * the value into this quaternion. The value of both argument quaternions is * preservered (this = left * right^-1). * * @param left * the left quaternion * @param right * the right quaternion */ public static Quaternion mulInverse(Quaternion left, Quaternion right, Quaternion dest) { float n = right.lengthSquared(); // zero-div may occur. n = (n == 0.0 ? n : 1 / n); // store on stack once for aliasing-safty if (dest == null) dest = new Quaternion(); dest .set((left.x * right.w - left.w * right.x - left.y * right.z + left.z * right.y) * n, (left.y * right.w - left.w * right.y - left.z * right.x + left.x * right.z) * n, (left.z * right.w - left.w * right.z - left.x * right.y + left.y * right.x) * n, (left.w * right.w + left.x * right.x + left.y * right.y + left.z * right.z) * n); return dest; } /** * Sets the value of this quaternion to the equivalent rotation of the * Axis-Angle argument. * * @param a1 * the axis-angle: (x,y,z) is the axis and w is the angle */ public final void setFromAxisAngle(Vector4f a1) { x = a1.x; y = a1.y; z = a1.z; float n = (float) Math.sqrt(x * x + y * y + z * z); // zero-div may occur. float s = (float) (Math.sin(0.5 * a1.w) / n); x *= s; y *= s; z *= s; w = (float) Math.cos(0.5 * a1.w); } /** * Sets the value of this quaternion using the rotational component of the * passed matrix. * * @param m * The matrix * @return this */ public final Quaternion setFromMatrix(Matrix4f m) { return setFromMatrix(m, this); } /** * Sets the value of the source quaternion using the rotational component of the * passed matrix. * * @param m * The source matrix * @param q * The destination quaternion, or null if a new quaternion is to be created * @return q */ public static Quaternion setFromMatrix(Matrix4f m, Quaternion q) { return q.setFromMat(m.m00, m.m01, m.m02, m.m10, m.m11, m.m12, m.m20, m.m21, m.m22); } /** * Sets the value of this quaternion using the rotational component of the * passed matrix. * * @param m * The source matrix */ public final Quaternion setFromMatrix(Matrix3f m) { return setFromMatrix(m, this); } /** * Sets the value of the source quaternion using the rotational component of the * passed matrix. * * @param m * The source matrix * @param q * The destination quaternion, or null if a new quaternion is to be created * @return q */ public static Quaternion setFromMatrix(Matrix3f m, Quaternion q) { return q.setFromMat(m.m00, m.m01, m.m02, m.m10, m.m11, m.m12, m.m20, m.m21, m.m22); } /** * Private method to perform the matrix-to-quaternion conversion */ private Quaternion setFromMat(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22) { float s; float tr = m00 + m11 + m22; if (tr >= 0.0) { s = (float) Math.sqrt(tr + 1.0); w = s * 0.5f; s = 0.5f / s; x = (m21 - m12) * s; y = (m02 - m20) * s; z = (m10 - m01) * s; } else { float max = Math.max(Math.max(m00, m11), m22); if (max == m00) { s = (float) Math.sqrt(m00 - (m11 + m22) + 1.0); x = s * 0.5f; s = 0.5f / s; y = (m01 + m10) * s; z = (m20 + m02) * s; w = (m21 - m12) * s; } else if (max == m11) { s = (float) Math.sqrt(m11 - (m22 + m00) + 1.0); y = s * 0.5f; s = 0.5f / s; z = (m12 + m21) * s; x = (m01 + m10) * s; w = (m02 - m20) * s; } else { s = (float) Math.sqrt(m22 - (m00 + m11) + 1.0); z = s * 0.5f; s = 0.5f / s; x = (m20 + m02) * s; y = (m12 + m21) * s; w = (m10 - m01) * s; } } return this; } } lwjgl-2.7.1/src/java/org/lwjgl/util/WritableRectangle.java0000644000175000017500000000447111543426510022563 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util; /** * Write interface for Rectangles * @author $Author: spasi $ * @version $Revision: 3418 $ * $Id: WritableRectangle.java 3418 2010-09-28 21:11:35Z spasi $ */ public interface WritableRectangle extends WritablePoint, WritableDimension { /** * Sets the bounds of the rectangle * @param x Position of rectangle on x axis * @param y Position of rectangle on y axis * @param width Width of rectangle * @param height Height of rectangle */ void setBounds(int x, int y, int width, int height); /** * Sets the bounds of the rectangle * @param location * @param size */ void setBounds(ReadablePoint location, ReadableDimension size); /** * Sets the bounds of the rectangle * @param src */ void setBounds(ReadableRectangle src); } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/0000755000175000017500000000000011543426510020302 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Indirect.java0000644000175000017500000000374211543426510022714 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * Implies that a parameter is indirect, and forces the native * stub to use the indirection operator '&' on it. * * @author elias_naur * @version $Revision: 2983 $ * $Id: Indirect.java 2983 2008-04-07 18:36:09Z matzon $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target(ElementType.PARAMETER) public @interface Indirect { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/0000755000175000017500000000000011543426510021562 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/CLCapabilitiesGenerator.java0000644000175000017500000001414611543426510027112 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import org.lwjgl.util.generator.*; import java.io.PrintWriter; import java.util.Collection; import java.util.Iterator; import com.sun.mirror.declaration.InterfaceDeclaration; import com.sun.mirror.declaration.MethodDeclaration; import com.sun.mirror.declaration.TypeDeclaration; /** * CLCapabilities generator. * * @author Spasi */ public class CLCapabilitiesGenerator { static void generateClassPrologue(final PrintWriter writer) { writer.println("public final class " + CLGeneratorProcessorFactory.CLCAPS_CLASS_NAME + " {"); writer.println(); } static void generateSymbolAddresses(final PrintWriter writer, final InterfaceDeclaration d) { final Alias alias_annotation = d.getAnnotation(Alias.class); final boolean aliased = alias_annotation != null && alias_annotation.postfix().length() > 0; boolean foundNative = false; for ( final MethodDeclaration method : d.getMethods() ) { if ( method.getAnnotation(Alternate.class) != null || method.getAnnotation(Reuse.class) != null ) continue; if ( !foundNative ) { //writer.println("\t// " + d.getSimpleName()); writer.println("\tstatic final boolean " + CLGeneratorProcessorFactory.getExtensionName(d.getSimpleName()) + ";"); foundNative = true; } writer.print("\tstatic final long " + Utils.getFunctionAddressName(d, method) + " = CL.getFunctionAddress("); if ( aliased ) writer.println("new String [] {\"" + Utils.getFunctionAddressName(d, method) + "\",\"" + method.getSimpleName() + alias_annotation.postfix() + "\"});"); else writer.println("\"" + Utils.getFunctionAddressName(d, method) + "\");"); } if ( foundNative ) writer.println(); } static void generateConstructor(final PrintWriter writer, final Collection interface_decls) { writer.println("\tprivate " + CLGeneratorProcessorFactory.CLCAPS_CLASS_NAME + "() {}"); writer.println(); writer.println("\tstatic {"); for ( final TypeDeclaration d : interface_decls ) { if ( d.getMethods().isEmpty() ) continue; //writer.println("\t\tif ( " + getExtensionSupportedName(d.getSimpleName()) + "() )"); //writer.println("\t\t\t" + SUPPORTED_EXTS + ".add(\"" + CLGeneratorProcessorFactory.getExtensionName(d.getSimpleName()) + "\");"); writer.println("\t\t" + CLGeneratorProcessorFactory.getExtensionName(d.getSimpleName()) + " = " + getExtensionSupportedName(d.getSimpleName()) + "();"); } writer.println("\t}\n"); } static void generateExtensionChecks(final PrintWriter writer, final InterfaceDeclaration d) { Iterator methods = d.getMethods().iterator(); if ( !methods.hasNext() ) return; writer.println("\tprivate static boolean " + getExtensionSupportedName(d.getSimpleName()) + "() {"); writer.println("\t\treturn "); boolean first = true; while ( methods.hasNext() ) { MethodDeclaration method = methods.next(); if ( method.getAnnotation(Alternate.class) != null ) continue; if ( !first ) writer.println(" &"); else first = false; final boolean optional = method.getAnnotation(Optional.class) != null; writer.print("\t\t\t"); if ( optional ) writer.print('('); writer.print(Utils.getFunctionAddressName(d, method) + " != 0"); if ( optional ) writer.print(" || true)"); } writer.println(";"); writer.println("\t}"); writer.println(); } private static String getExtensionSupportedName(final String class_name) { return "is" + class_name + "Supported"; } public static void generateCapabilitiesGetters(final PrintWriter writer) { writer.println("\tpublic static CLPlatformCapabilities getPlatformCapabilities(final CLPlatform platform) {\n" + "\t\tplatform.checkValid();\n" + "\n" + "\t\tCLPlatformCapabilities caps = (CLPlatformCapabilities)platform.getCapabilities();\n" + "\t\tif ( caps == null )\n" + "\t\t\tplatform.setCapabilities(caps = new CLPlatformCapabilities(platform));\n" + "\n" + "\t\treturn caps;\n" + "\t}\n"); writer.println("\tpublic static CLDeviceCapabilities getDeviceCapabilities(final CLDevice device) {\n" + "\t\tdevice.checkValid();\n" + "\n" + "\t\tCLDeviceCapabilities caps = (CLDeviceCapabilities)device.getCapabilities();\n" + "\t\tif ( caps == null )\n" + "\t\t\tdevice.setCapabilities(caps = new CLDeviceCapabilities(device));\n" + "\n" + "\t\treturn caps;\n" + "\t}\n"); } }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/cl_double.java0000644000175000017500000000345211543426510024361 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import org.lwjgl.util.generator.NativeType; import java.lang.annotation.ElementType; import java.lang.annotation.Target; @NativeType @Target({ ElementType.PARAMETER, ElementType.METHOD }) public @interface cl_double { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/cl_void.java0000644000175000017500000000361711543426510024053 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import org.lwjgl.util.generator.NativeType; import java.lang.annotation.ElementType; import java.lang.annotation.Target; import com.sun.mirror.type.PrimitiveType; @NativeType @Target({ ElementType.PARAMETER, ElementType.METHOD }) public @interface cl_void { PrimitiveType.Kind value() default PrimitiveType.Kind.BYTE; }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/cl_char.java0000644000175000017500000000342411543426510024023 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import org.lwjgl.util.generator.NativeType; import java.lang.annotation.ElementType; import java.lang.annotation.Target; @NativeType @Target({ ElementType.PARAMETER }) public @interface cl_char { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/cl_float.java0000644000175000017500000000345111543426510024213 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import org.lwjgl.util.generator.NativeType; import java.lang.annotation.ElementType; import java.lang.annotation.Target; @NativeType @Target({ ElementType.PARAMETER, ElementType.METHOD }) public @interface cl_float { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/cl_uint.java0000644000175000017500000000344711543426510024072 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import org.lwjgl.util.generator.NativeType; import java.lang.annotation.ElementType; import java.lang.annotation.Target; @NativeType @Target({ ElementType.PARAMETER, ElementType.METHOD }) public @interface cl_uint { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/cl_int.java0000644000175000017500000000344611543426510023704 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import org.lwjgl.util.generator.NativeType; import java.lang.annotation.ElementType; import java.lang.annotation.Target; @NativeType @Target({ ElementType.PARAMETER, ElementType.METHOD }) public @interface cl_int { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/cl_byte.java0000644000175000017500000000345011543426510024050 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import org.lwjgl.util.generator.NativeType; import java.lang.annotation.ElementType; import java.lang.annotation.Target; @NativeType @Target({ ElementType.PARAMETER, ElementType.METHOD }) public @interface cl_byte { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessorFactory.java0000644000175000017500000001537511543426510030035 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import org.lwjgl.PointerWrapper; import org.lwjgl.opencl.CLDevice; import org.lwjgl.opencl.CLPlatform; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.lang.annotation.Annotation; import java.util.Arrays; import java.util.Collection; import java.util.Set; import com.sun.mirror.apt.*; import com.sun.mirror.declaration.AnnotationTypeDeclaration; import com.sun.mirror.declaration.InterfaceDeclaration; import com.sun.mirror.declaration.TypeDeclaration; import com.sun.mirror.util.DeclarationFilter; import static java.util.Collections.*; /** * Generator tool for creating the OpenCL capabilities classes * * @author Spasi */ public class CLGeneratorProcessorFactory implements AnnotationProcessorFactory, RoundCompleteListener { public static final String CLCAPS_CLASS_NAME = "CLCapabilities"; public static final String PLATFORM_CAPS_CLASS_NAME = "CLPlatformCapabilities"; public static final String DEVICE_CAPS_CLASS_NAME = "CLDeviceCapabilities"; private static final String EXTENSION_PREFIX = "CL_"; private static final String CORE_PREFIX = "Open"; private static boolean first_round = true; // Process any set of annotations private static final Collection supportedAnnotations = unmodifiableCollection(Arrays.asList("*")); public Collection supportedAnnotationTypes() { return supportedAnnotations; } public Collection supportedOptions() { return unmodifiableCollection(Arrays.asList("-Acontextspecific")); } public void roundComplete(RoundCompleteEvent event) { first_round = false; } public AnnotationProcessor getProcessorFor(Set atds, AnnotationProcessorEnvironment env) { // Only process the initial types, not the generated ones if ( first_round ) { env.addListener(this); return new GeneratorProcessor(env); } else return AnnotationProcessors.NO_OP; } static String getExtensionName(String interface_name) { if ( interface_name.startsWith("CL") ) return CORE_PREFIX + interface_name; else return EXTENSION_PREFIX + interface_name; } private static class GeneratorProcessor implements AnnotationProcessor { private final AnnotationProcessorEnvironment env; GeneratorProcessor(AnnotationProcessorEnvironment env) { this.env = env; } public void process() { try { generateCLCapabilitiesSource(); generateCLPDCapabilitiesSource(CLPlatformExtension.class, PLATFORM_CAPS_CLASS_NAME, CLPlatform.class, "platform"); generateCLPDCapabilitiesSource(CLDeviceExtension.class, DEVICE_CAPS_CLASS_NAME, CLDevice.class, "device"); } catch (IOException e) { throw new RuntimeException(e); } } private static void printHeader(final PrintWriter writer) { writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */"); writer.println(); writer.println("package org.lwjgl.opencl;"); writer.println(); } private void generateCLCapabilitiesSource() throws IOException { final PrintWriter writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, "org.lwjgl.opencl", new File(CLCAPS_CLASS_NAME + ".java"), null); printHeader(writer); CLCapabilitiesGenerator.generateClassPrologue(writer); final Collection templates = DeclarationFilter.getFilter(InterfaceDeclaration.class).filter(env.getSpecifiedTypeDeclarations()); for ( final TypeDeclaration t : templates ) { if ( t.getAnnotation(CLPlatformExtension.class) == null && t.getAnnotation(CLDeviceExtension.class) == null && !t.getSimpleName().startsWith("CL") ) throw new RuntimeException("An OpenCL extension is missing an extension type annotation: " + t.getSimpleName()); CLCapabilitiesGenerator.generateSymbolAddresses(writer, (InterfaceDeclaration)t); } writer.println(); CLCapabilitiesGenerator.generateConstructor(writer, templates); CLCapabilitiesGenerator.generateCapabilitiesGetters(writer); for ( final TypeDeclaration template : templates ) CLCapabilitiesGenerator.generateExtensionChecks(writer, (InterfaceDeclaration)template); writer.println("}"); writer.close(); } private void generateCLPDCapabilitiesSource(final Class capsType, final String capsName, final Class objectType, final String objectName) throws IOException { final PrintWriter writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, "org.lwjgl.opencl", new File(capsName + ".java"), null); printHeader(writer); writer.println("import java.util.*;"); writer.println(); CLPDCapabilitiesGenerator.generateClassPrologue(writer, capsName); final Collection templates = DeclarationFilter.getFilter(InterfaceDeclaration.class).filter(env.getSpecifiedTypeDeclarations()); for ( final TypeDeclaration t : templates ) { if ( t.getAnnotation(capsType) != null ) CLPDCapabilitiesGenerator.generateExtensions(writer, (InterfaceDeclaration)t); } writer.println(); CLPDCapabilitiesGenerator.generateConstructor(writer, templates, capsType, capsName, objectType, objectName); CLPDCapabilitiesGenerator.generateGetters(writer); CLPDCapabilitiesGenerator.generateToString(writer, templates, capsType); writer.println("}"); writer.close(); } } }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/cl_bool.java0000644000175000017500000000342411543426510024041 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import org.lwjgl.util.generator.NativeType; import java.lang.annotation.ElementType; import java.lang.annotation.Target; @NativeType @Target({ ElementType.PARAMETER }) public @interface cl_bool { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/size_t.java0000644000175000017500000000342311543426510023724 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import org.lwjgl.util.generator.NativeType; import java.lang.annotation.ElementType; import java.lang.annotation.Target; @NativeType @Target({ ElementType.PARAMETER }) public @interface size_t { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/cl_uchar.java0000644000175000017500000000342511543426510024211 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import org.lwjgl.util.generator.NativeType; import java.lang.annotation.ElementType; import java.lang.annotation.Target; @NativeType @Target({ ElementType.PARAMETER }) public @interface cl_uchar { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/cl_long.java0000644000175000017500000000342411543426510024045 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import org.lwjgl.util.generator.NativeType; import java.lang.annotation.ElementType; import java.lang.annotation.Target; @NativeType @Target({ ElementType.PARAMETER }) public @interface cl_long { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/CLDeviceExtension.java0000644000175000017500000000347711543426510025753 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import java.lang.annotation.ElementType; import java.lang.annotation.Target; /** Extension templates marked with @CLDeviceExtension will be considered CL device extensions. */ @Target(ElementType.TYPE) public @interface CLDeviceExtension { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/cl_bitfield.java0000644000175000017500000000346311543426510024673 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import org.lwjgl.util.generator.NativeType; import java.lang.annotation.ElementType; import java.lang.annotation.Target; @NativeType @Target({ ElementType.PARAMETER }) public @interface cl_bitfield { String alias() default ""; }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java0000644000175000017500000002171311543426510024227 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; /** * * OpenCL specific generator behaviour * * @author Spasi */ import org.lwjgl.PointerBuffer; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLreturn; import java.io.PrintWriter; import java.lang.annotation.Annotation; import java.nio.*; import java.util.HashMap; import java.util.Map; import com.sun.mirror.declaration.AnnotationMirror; import com.sun.mirror.declaration.MethodDeclaration; import com.sun.mirror.declaration.ParameterDeclaration; import com.sun.mirror.type.PrimitiveType; public class CLTypeMap implements TypeMap { private static final Map native_types_to_primitive; static { native_types_to_primitive = new HashMap(); native_types_to_primitive.put(cl_void.class, PrimitiveType.Kind.BYTE); native_types_to_primitive.put(cl_byte.class, PrimitiveType.Kind.BYTE); native_types_to_primitive.put(cl_char.class, PrimitiveType.Kind.BYTE); native_types_to_primitive.put(cl_uchar.class, PrimitiveType.Kind.BYTE); native_types_to_primitive.put(cl_short.class, PrimitiveType.Kind.SHORT); native_types_to_primitive.put(cl_bool.class, PrimitiveType.Kind.INT); native_types_to_primitive.put(cl_int.class, PrimitiveType.Kind.INT); native_types_to_primitive.put(cl_uint.class, PrimitiveType.Kind.INT); native_types_to_primitive.put(cl_long.class, PrimitiveType.Kind.LONG); native_types_to_primitive.put(size_t.class, PrimitiveType.Kind.LONG); native_types_to_primitive.put(cl_bitfield.class, PrimitiveType.Kind.LONG); native_types_to_primitive.put(cl_float.class, PrimitiveType.Kind.FLOAT); native_types_to_primitive.put(cl_double.class, PrimitiveType.Kind.DOUBLE); } public PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class native_type) { PrimitiveType.Kind kind = native_types_to_primitive.get(native_type); if ( kind == null ) throw new RuntimeException("Unsupported type " + native_type); return kind; } public void printCapabilitiesInit(final PrintWriter writer) { } public String getCapabilities() { return "CLCapabilities"; } public void printErrorCheckMethod(final PrintWriter writer, final MethodDeclaration method, final String tabs) { final Check check = method.getAnnotation(Check.class); if ( check != null ) // Get the error code from an IntBuffer output parameter writer.println(tabs + "Util.checkCLError(" + check.value() + ".get(" + check.value() + ".position()));"); else { final Class return_type = Utils.getJavaType(method.getReturnType()); if ( return_type == int.class ) writer.println(tabs + "Util.checkCLError(__result);"); else { boolean hasErrCodeParam = false; for ( final ParameterDeclaration param : method.getParameters() ) { if ( "errcode_ret".equals(param.getSimpleName()) && Utils.getJavaType(param.getType()) == IntBuffer.class ) { hasErrCodeParam = true; break; } } if ( hasErrCodeParam ) throw new RuntimeException("A method is missing the @Check annotation: " + method.toString()); } } } public String getRegisterNativesFunctionName() { return "extcl_InitializeClass"; } public Signedness getSignednessFromType(Class type) { if ( cl_uint.class.equals(type) ) return Signedness.UNSIGNED; else if ( cl_int.class.equals(type) ) return Signedness.SIGNED; else return Signedness.NONE; } public String translateAnnotation(Class annotation_type) { if ( annotation_type.equals(cl_uint.class) || annotation_type.equals(cl_int.class) ) return "i"; else if ( annotation_type.equals(cl_short.class) ) return "s"; else if ( annotation_type.equals(cl_byte.class) ) return "b"; else if ( annotation_type.equals(cl_float.class) ) return "f"; else if ( annotation_type.equals(cl_double.class) ) return "d"; else throw new RuntimeException(annotation_type + " is not allowed"); } public Class getNativeTypeFromPrimitiveType(PrimitiveType.Kind kind) { Class type; switch ( kind ) { case INT: type = cl_int.class; break; case DOUBLE: type = cl_double.class; break; case FLOAT: type = cl_float.class; break; case SHORT: type = cl_short.class; break; case BYTE: type = cl_byte.class; break; case LONG: type = cl_long.class; break; case BOOLEAN: type = cl_bool.class; break; default: throw new RuntimeException(kind + " is not allowed"); } return type; } public Class getVoidType() { return cl_void.class; } public Class getStringElementType() { return cl_char.class; } public Class getStringArrayType() { return cl_char.class; } public Class getByteBufferArrayType() { return cl_uchar.class; } private static Class[] getValidBufferTypes(Class type) { if ( type.equals(IntBuffer.class) ) return new Class[] { cl_int.class, cl_uint.class }; else if ( type.equals(FloatBuffer.class) ) return new Class[] { cl_float.class }; else if ( type.equals(ByteBuffer.class) ) return new Class[] { cl_byte.class, cl_char.class, cl_uchar.class, cl_void.class }; else if ( type.equals(ShortBuffer.class) ) return new Class[] { cl_short.class }; else if ( type.equals(DoubleBuffer.class) ) return new Class[] { cl_double.class }; else if ( type.equals(LongBuffer.class) ) return new Class[] { cl_long.class }; else if ( type.equals(PointerBuffer.class) ) return new Class[] { size_t.class }; else return new Class[] { }; } private static Class[] getValidPrimitiveTypes(Class type) { if ( type.equals(long.class) ) return new Class[] { cl_long.class, size_t.class, cl_bitfield.class }; else if ( type.equals(int.class) ) return new Class[] { cl_int.class, cl_uint.class, cl_bool.class }; else if ( type.equals(double.class) ) return new Class[] { cl_double.class }; else if ( type.equals(float.class) ) return new Class[] { cl_float.class }; else if ( type.equals(short.class) ) return new Class[] { cl_short.class }; else if ( type.equals(byte.class) ) return new Class[] { cl_byte.class, cl_char.class, cl_uchar.class }; else if ( type.equals(boolean.class) ) return new Class[] { cl_bool.class }; else if ( type.equals(void.class) ) return new Class[] { cl_void.class }; else return new Class[] { }; } public String getTypedefPostfix() { return "CL_API_ENTRY "; } public String getFunctionPrefix() { return "CL_API_CALL"; } public void printNativeIncludes(PrintWriter writer) { writer.println("#include \"extcl.h\""); } public Class[] getValidAnnotationTypes(Class type) { Class[] valid_types; if ( Buffer.class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) ) valid_types = getValidBufferTypes(type); else if ( type.isPrimitive() ) valid_types = getValidPrimitiveTypes(type); else if ( String.class.equals(type) ) valid_types = new Class[] { cl_byte.class }; else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) ) valid_types = new Class[] { PointerWrapper.class }; else if ( ByteBuffer[].class == type ) valid_types = new Class[] { cl_char.class, cl_uchar.class }; else if ( void.class.equals(type) ) valid_types = new Class[] { GLreturn.class }; else valid_types = new Class[] { }; return valid_types; } public Class getInverseType(Class type) { return null; } public String getAutoTypeFromAnnotation(AnnotationMirror annotation) { return null; } }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/CLPDCapabilitiesGenerator.java0000644000175000017500000001447111543426510027337 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import org.lwjgl.PointerWrapper; import org.lwjgl.util.generator.Private; import java.io.PrintWriter; import java.lang.annotation.Annotation; import java.util.Collection; import com.sun.mirror.declaration.InterfaceDeclaration; import com.sun.mirror.declaration.TypeDeclaration; /** * CL platform/device capabilities generator. * * @author Spasi */ public class CLPDCapabilitiesGenerator { // TODO: Add future versions here private static final int[][] CL_VERSIONS = { { 1 }, // OpenCL 1 }; static void generateClassPrologue(final PrintWriter writer, final String name) { writer.println("public class " + name + " {"); writer.println(); writer.println("\tpublic final int majorVersion;"); writer.println("\tpublic final int minorVersion;"); writer.println(); for ( int major = 1; major <= CL_VERSIONS.length; major++ ) { for ( final int minor : CL_VERSIONS[major - 1] ) writer.println("\tpublic final boolean OpenCL" + Integer.toString(major) + Integer.toString(minor) + ";"); } writer.println(); } static void generateExtensions(final PrintWriter writer, final InterfaceDeclaration d) { writer.print("\t"); if ( d.getAnnotation(Private.class) == null ) writer.print("public "); writer.println("final boolean " + CLGeneratorProcessorFactory.getExtensionName(d.getSimpleName()) + ";"); } static void generateConstructor(final PrintWriter writer, final Collection templates, final Class capsType, final String capsName, final Class objectType, final String objectName) { writer.println("\tpublic " + capsName + "(final " + objectType.getSimpleName() + ' ' + objectName + ") {"); writer.println("\t\tfinal String extensionList = " + objectName + ".getInfoString(CL10.CL_" + objectName.toUpperCase() + "_EXTENSIONS);\n" + "\t\tfinal String version = " + objectName + ".getInfoString(CL10.CL_" + objectName.toUpperCase() + "_VERSION);\n" + "\t\tif ( !version.startsWith(\"OpenCL \") )\n" + "\t\t\tthrow new RuntimeException(\"Invalid OpenCL version string: \" + version);\n\n" + "\t\ttry {\n" + "\t\t\tfinal StringTokenizer tokenizer = new StringTokenizer(version.substring(7), \". \");\n" + "\n" + "\t\t\tmajorVersion = Integer.parseInt(tokenizer.nextToken());\n" + "\t\t\tminorVersion = Integer.parseInt(tokenizer.nextToken());\n"); for ( int major = 1; major <= CL_VERSIONS.length; major++ ) { for ( final int minor : CL_VERSIONS[major - 1] ) writer.println("\t\t\tOpenCL" + Integer.toString(major) + Integer.toString(minor) + " = " + major + " < majorVersion || (" + major + " == majorVersion && " + minor + " <= minorVersion);"); } writer.println("\t\t} catch (RuntimeException e) {\n" + "\t\t\tthrow new RuntimeException(\"The major and/or minor OpenCL version \\\"\" + version + \"\\\" is malformed: \" + e.getMessage());\n" + "\t\t}\n"); writer.println("\t\tfinal Set extensions = APIUtil.getExtensions(extensionList);"); for ( final TypeDeclaration t : templates ) { if ( t.getAnnotation(capsType) == null ) continue; final String extName = CLGeneratorProcessorFactory.getExtensionName(t.getSimpleName()); writer.print("\t\t" + extName + " = extensions.contains(\"" + extName.toLowerCase() + "\")"); if ( !t.getMethods().isEmpty() ) writer.print(" && CLCapabilities." + extName); writer.println(";"); } writer.println("\t}\n"); } public static void generateGetters(final PrintWriter writer) { writer.println("\tpublic int getMajorVersion() {"); writer.println("\t\treturn majorVersion;"); writer.println("\t}\n"); writer.println("\tpublic int getMinorVersion() {"); writer.println("\t\treturn minorVersion;"); writer.println("\t}\n"); } public static void generateToString(final PrintWriter writer, final Collection templates, final Class capsType) { writer.println("\tpublic String toString() {"); writer.println("\t\tfinal StringBuilder buf = new StringBuilder();\n"); writer.println("\t\tbuf.append(\"OpenCL \").append(majorVersion).append('.').append(minorVersion);"); writer.println(); writer.println("\t\tbuf.append(\" - Extensions: \");"); for ( final TypeDeclaration t : templates ) { if ( t.getAnnotation(capsType) == null ) continue; writer.println("\t\tif ( " + CLGeneratorProcessorFactory.getExtensionName(t.getSimpleName()) + " ) buf.append(\"" + CLGeneratorProcessorFactory.getExtensionName(t.getSimpleName()).toLowerCase() + " \");"); } writer.println("\n\t\treturn buf.toString();"); writer.println("\t}\n"); } }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/cl_short.java0000644000175000017500000000345111543426510024245 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import org.lwjgl.util.generator.NativeType; import java.lang.annotation.ElementType; import java.lang.annotation.Target; @NativeType @Target({ ElementType.PARAMETER, ElementType.METHOD }) public @interface cl_short { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opencl/CLPlatformExtension.java0000644000175000017500000000350511543426510026330 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opencl; import java.lang.annotation.ElementType; import java.lang.annotation.Target; /** Extension templates marked with @CLPlatformExtension will be considered CL platform extensions. */ @Target(ElementType.TYPE) public @interface CLPlatformExtension { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/PointerWrapper.java0000644000175000017500000000414311543426510024130 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * @author spasi */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface PointerWrapper { String value(); // The native pointer type. boolean canBeNull() default false; // Whether the pointer may be null. String params() default ""; // Pass these extra parameters when constructing PointerWrapper objects. String factory() default ""; // Use this factory method call instead of normal object construction. }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/BufferObject.java0000644000175000017500000000374511543426510023516 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * This annotation implies that a Buffer parameter can be an * integer VBO/PBO offset. * * @author elias_naur * @version $Revision: 2983 $ * $Id: BufferObject.java 2983 2008-04-07 18:36:09Z matzon $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target(ElementType.PARAMETER) public @interface BufferObject { BufferKind value(); } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/TypedefsGenerator.java0000644000175000017500000000745611543426510024613 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * A TypeVisitor that generates the native typedefs. * * @author elias_naur * @version $Revision: 3412 $ * $Id: TypedefsGenerator.java 3412 2010-09-26 23:43:24Z spasi $ */ import com.sun.mirror.declaration.*; import com.sun.mirror.type.*; import java.io.*; import java.util.*; public class TypedefsGenerator { private static void generateNativeTypedefs(TypeMap type_map, PrintWriter writer, MethodDeclaration method) { TypeMirror return_type = method.getReturnType(); writer.print("typedef "); writer.print(type_map.getTypedefPostfix()); NativeTypeTranslator translator = new NativeTypeTranslator(type_map, method); return_type.accept(translator); writer.print(translator.getSignature()); writer.print(" ("); writer.print(type_map.getFunctionPrefix()); writer.print(" *" + Utils.getTypedefName(method) + ") ("); generateNativeTypedefsParameters(type_map, writer, method.getParameters()); writer.println(");"); } private static void generateNativeTypedefsParameters(TypeMap type_map, PrintWriter writer, Collection params) { if (params.size() > 0) { boolean first = true; for ( ParameterDeclaration param : params ) { if ( param.getAnnotation(Helper.class) != null ) continue; if ( first ) first = false; else writer.print(", "); generateNativeTypedefsParameter(type_map, writer, param); } } } private static void generateNativeTypedefsParameter(TypeMap type_map, PrintWriter writer, ParameterDeclaration param) { NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param); param.getType().accept(translator); writer.print(translator.getSignature()); if (param.getAnnotation(Result.class) != null || param.getAnnotation(Indirect.class) != null || param.getAnnotation(PointerArray.class) != null) writer.print("*"); writer.print(" " + param.getSimpleName()); } public static void generateNativeTypedefs(TypeMap type_map, PrintWriter writer, Collection methods) { for (MethodDeclaration method : methods) { if ( method.getAnnotation(Alternate.class) == null && method.getAnnotation(Reuse.class) == null ) generateNativeTypedefs(type_map, writer, method); } } } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/StripPostfix.java0000644000175000017500000000421411543426510023624 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * This annotation implies that a method have its postfix stripped * according to a specified Buffer parameter. * * @author elias_naur * @version $Revision: 3256 $ * $Id: StripPostfix.java 3256 2009-12-01 03:37:27Z spasi $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target(ElementType.METHOD) public @interface StripPostfix { String value(); // The parameter to deduce the postfix from String extension() default "NULL"; boolean hasPostfix() default true; String postfix() default "NULL"; } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java0000644000175000017500000001132511543426510024744 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; import org.lwjgl.opencl.CLMem; import java.nio.ByteBuffer; import com.sun.mirror.type.*; import com.sun.mirror.util.*; /** * A TypeVisitor that translates (annotated) TypeMirrors to * java types (represented by a Class) * * @author elias_naur * @version $Revision: 3430 $ * $Id: JavaTypeTranslator.java 3430 2010-10-04 17:04:46Z spasi $ */ public class JavaTypeTranslator implements TypeVisitor { private Class type; public Class getType() { return type; } public void visitAnnotationType(AnnotationType t) { throw new RuntimeException(t + " is not allowed"); } public void visitArrayType(ArrayType t) { final TypeMirror componentType = t.getComponentType(); if ( componentType instanceof PrimitiveType ) { type = getPrimitiveArrayClassFromKind(((PrimitiveType)componentType).getKind()); } else { try { final Class c = Class.forName(t.getComponentType().toString()); if ( CharSequence.class.isAssignableFrom(c) || ByteBuffer.class.isAssignableFrom(c) || org.lwjgl.PointerWrapper.class.isAssignableFrom(c) ) type = Class.forName("[L" + t.getComponentType() + ";"); else { throw new RuntimeException(t + " is not allowed"); } } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } } public static Class getPrimitiveClassFromKind(PrimitiveType.Kind kind) { switch ( kind ) { case LONG: return long.class; case INT: return int.class; case DOUBLE: return double.class; case FLOAT: return float.class; case SHORT: return short.class; case BYTE: return byte.class; case BOOLEAN: return boolean.class; default: throw new RuntimeException(kind + " is not allowed"); } } private static Class getPrimitiveArrayClassFromKind(PrimitiveType.Kind kind) { switch ( kind ) { case LONG: return long[].class; case INT: return int[].class; case DOUBLE: return double[].class; case FLOAT: return float[].class; case SHORT: return short[].class; case BYTE: return byte[].class; case BOOLEAN: return boolean[].class; default: throw new RuntimeException(kind + " is not allowed"); } } public void visitPrimitiveType(PrimitiveType t) { type = getPrimitiveClassFromKind(t.getKind()); } public void visitDeclaredType(DeclaredType t) { throw new RuntimeException(t + " is not allowed"); } public void visitEnumType(EnumType t) { throw new RuntimeException(t + " is not allowed"); } public void visitClassType(ClassType t) { type = NativeTypeTranslator.getClassFromType(t); } public void visitInterfaceType(InterfaceType t) { type = NativeTypeTranslator.getClassFromType(t); } public void visitReferenceType(ReferenceType t) { throw new RuntimeException(t + " is not allowed"); } public void visitTypeMirror(TypeMirror t) { throw new RuntimeException(t + " is not allowed"); } public void visitTypeVariable(TypeVariable t) { throw new RuntimeException(t + " is not allowed"); } public void visitVoidType(VoidType t) { type = void.class; } public void visitWildcardType(WildcardType t) { throw new RuntimeException(t + " is not allowed"); } } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Optional.java0000644000175000017500000000401511543426510022732 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * A function annotated with @Optional will allow the extension to be available even if the driver does not expose that function. * This is useful when certain buggy drivers miss some functionality. * * @author spasi */ import java.lang.annotation.ElementType; import java.lang.annotation.Target; @Target(ElementType.METHOD) public @interface Optional { String reason(); // No default value to force documentation }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Constant.java0000644000175000017500000000410211543426510022733 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * @author elias_naur * @version $Revision: 3412 $ * $Id: Constant.java 3412 2010-09-26 23:43:24Z spasi $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target(ElementType.PARAMETER) public @interface Constant { String value(); /** If true, the original parameter will not be removed from the method. */ boolean keepParam() default false; /** If true, this is a native code constant. */ boolean isNative() default false; } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/openal/0000755000175000017500000000000011543426510021560 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/util/generator/openal/ALuint.java0000644000175000017500000000367711543426510023634 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.openal; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: ALuint.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface ALuint { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/openal/ALenum.java0000644000175000017500000000367711543426510023621 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.openal; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: ALenum.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface ALenum { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/openal/ALboolean.java0000644000175000017500000000370511543426510024264 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.openal; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: ALboolean.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface ALboolean { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/openal/ALdouble.java0000644000175000017500000000370311543426510024115 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.openal; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: ALdouble.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface ALdouble { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java0000644000175000017500000001712111543426510024221 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.openal; /** * * The OpenAL specific generator behaviour * * @author elias_naur * @version $Revision: 2983 $ * $Id: ALTypeMap.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.Signedness; import org.lwjgl.util.generator.TypeMap; import com.sun.mirror.declaration.*; import com.sun.mirror.type.*; import java.io.*; import java.lang.annotation.Annotation; import java.util.*; import java.nio.*; public class ALTypeMap implements TypeMap { private static final Map native_types_to_primitive; static { native_types_to_primitive = new HashMap(); native_types_to_primitive.put(ALboolean.class, PrimitiveType.Kind.BOOLEAN); native_types_to_primitive.put(ALbyte.class, PrimitiveType.Kind.BYTE); native_types_to_primitive.put(ALenum.class, PrimitiveType.Kind.INT); native_types_to_primitive.put(ALfloat.class, PrimitiveType.Kind.FLOAT); native_types_to_primitive.put(ALdouble.class, PrimitiveType.Kind.DOUBLE); native_types_to_primitive.put(ALint.class, PrimitiveType.Kind.INT); native_types_to_primitive.put(ALshort.class, PrimitiveType.Kind.SHORT); native_types_to_primitive.put(ALsizei.class, PrimitiveType.Kind.INT); native_types_to_primitive.put(ALubyte.class, PrimitiveType.Kind.BYTE); native_types_to_primitive.put(ALuint.class, PrimitiveType.Kind.INT); native_types_to_primitive.put(ALvoid.class, PrimitiveType.Kind.BYTE); } public PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class native_type) { PrimitiveType.Kind kind = native_types_to_primitive.get(native_type); if (kind == null) throw new RuntimeException("Unsupported type " + native_type); return kind; } public Signedness getSignednessFromType(Class type) { if (ALuint.class.equals(type)) return Signedness.UNSIGNED; else if (ALint.class.equals(type)) return Signedness.SIGNED; else if (ALshort.class.equals(type)) return Signedness.SIGNED; else if (ALbyte.class.equals(type)) return Signedness.SIGNED; else return Signedness.NONE; } public String translateAnnotation(Class annotation_type) { if (annotation_type.equals(ALuint.class)) return "i"; else if (annotation_type.equals(ALint.class)) return "i"; else if (annotation_type.equals(ALshort.class)) return "s"; else if (annotation_type.equals(ALbyte.class)) return "b"; else if (annotation_type.equals(ALfloat.class)) return "f"; else if (annotation_type.equals(ALdouble.class)) return "d"; else if (annotation_type.equals(ALboolean.class) || annotation_type.equals(ALvoid.class)) return ""; else throw new RuntimeException(annotation_type + " is not allowed"); } public Class getNativeTypeFromPrimitiveType(PrimitiveType.Kind kind) { Class type; switch (kind) { case INT: type = ALint.class; break; case FLOAT: type = ALfloat.class; break; case DOUBLE: type = ALdouble.class; break; case SHORT: type = ALshort.class; break; case BYTE: type = ALbyte.class; break; case BOOLEAN: type = ALboolean.class; break; default: throw new RuntimeException(kind + " is not allowed"); } return type; } private static Class[] getValidBufferTypes(Class type) { if (type.equals(IntBuffer.class)) return new Class[]{ALenum.class, ALint.class, ALsizei.class, ALuint.class}; else if (type.equals(FloatBuffer.class)) return new Class[]{ALfloat.class}; else if (type.equals(ByteBuffer.class)) return new Class[]{ALboolean.class, ALbyte.class, ALvoid.class}; else if (type.equals(ShortBuffer.class)) return new Class[]{ALshort.class}; else if (type.equals(DoubleBuffer.class)) return new Class[]{ALdouble.class}; else return new Class[]{}; } private static Class[] getValidPrimitiveTypes(Class type) { if (type.equals(int.class)) return new Class[]{ALenum.class, ALint.class, ALsizei.class, ALuint.class}; else if (type.equals(double.class)) return new Class[]{ALdouble.class}; else if (type.equals(float.class)) return new Class[]{ALfloat.class}; else if (type.equals(short.class)) return new Class[]{ALshort.class}; else if (type.equals(byte.class)) return new Class[]{ALbyte.class}; else if (type.equals(boolean.class)) return new Class[]{ALboolean.class}; else if (type.equals(void.class)) return new Class[]{ALvoid.class}; else return new Class[]{}; } public void printCapabilitiesInit(final PrintWriter writer) { throw new UnsupportedOperationException(); } public String getCapabilities() { throw new UnsupportedOperationException(); } public void printErrorCheckMethod(final PrintWriter writer, final MethodDeclaration method, final String tabs) { writer.println(tabs + "Util.checkALError();"); } public String getRegisterNativesFunctionName() { return "extal_InitializeClass"; } public String getTypedefPostfix() { return ""; } public String getFunctionPrefix() { return "ALAPIENTRY"; } public void printNativeIncludes(PrintWriter writer) { writer.println("#include \"extal.h\""); } public Class getStringElementType() { return ALubyte.class; } public Class getStringArrayType() { return ALubyte.class; } public Class getByteBufferArrayType() { return ALubyte.class; } public Class[] getValidAnnotationTypes(Class type) { Class[] valid_types; if (Buffer.class.isAssignableFrom(type)) valid_types = getValidBufferTypes(type); else if (type.isPrimitive()) valid_types = getValidPrimitiveTypes(type); else if (type.equals(String.class)) valid_types = new Class[]{ALubyte.class}; else valid_types = new Class[]{}; return valid_types; } public Class getVoidType() { return ALvoid.class; } public Class getInverseType(Class type) { if (ALuint.class.equals(type)) return ALint.class; else if (ALint.class.equals(type)) return ALuint.class; else return null; } public String getAutoTypeFromAnnotation(AnnotationMirror annotation) { return null; } } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/openal/ALbyte.java0000644000175000017500000000367711543426510023620 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.openal; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: ALbyte.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface ALbyte { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/openal/ALfloat.java0000644000175000017500000000370111543426510023746 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.openal; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: ALfloat.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface ALfloat { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/openal/ALubyte.java0000644000175000017500000000370111543426510023771 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.openal; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: ALubyte.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface ALubyte { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/openal/ALshort.java0000644000175000017500000000370111543426510024000 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.openal; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: ALshort.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface ALshort { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/openal/ALint.java0000644000175000017500000000367511543426510023445 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.openal; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: ALint.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface ALint { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/openal/ALsizei.java0000644000175000017500000000370111543426510023764 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.openal; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: ALsizei.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface ALsizei { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/openal/ALvoid.java0000644000175000017500000000367711543426510023616 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.openal; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: ALvoid.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface ALvoid { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/PlatformDependent.java0000644000175000017500000000404711543426510024565 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * This annotation implies that the corresponding native * function symbol is named after the platform specific * window system (glX, wgl, ...) * * @author elias_naur * @version $Revision: 2983 $ * $Id: PlatformDependent.java 2983 2008-04-07 18:36:09Z matzon $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target(ElementType.METHOD) public @interface PlatformDependent { Platform[] value(); } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/AutoSize.java0000644000175000017500000000452111543426510022712 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * AutoSize specifies that a parameter should be pre-computed * according to the remaining() of a Buffer parameter. * * @author elias_naur * @version $Revision: 3412 $ * $Id: AutoSize.java 3412 2010-09-26 23:43:24Z spasi $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Auto @Target({ElementType.METHOD,ElementType.PARAMETER}) public @interface AutoSize { String value(); // The name of the Buffer parameter String expression() default ""; // This value is added after the argument boolean canBeNull() default false; // When this is true and the Buffer parameter is null, 0 will be used. boolean isNative() default false; // When this is true, auto-sizing will be performed in native code. } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java0000644000175000017500000002055411543426510025315 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * A TypeVisitor that translates types (and optional native type * annotations) to the native type string. * * @author elias_naur * @version $Revision: 3412 $ * $Id: NativeTypeTranslator.java 3412 2010-09-26 23:43:24Z spasi $ */ import org.lwjgl.PointerBuffer; import java.lang.annotation.Annotation; import java.nio.*; import java.util.ArrayList; import java.util.Collection; import com.sun.mirror.declaration.AnnotationMirror; import com.sun.mirror.declaration.Declaration; import com.sun.mirror.type.*; import com.sun.mirror.util.TypeVisitor; /** * $Id: NativeTypeTranslator.java 3412 2010-09-26 23:43:24Z spasi $ *

      * A TypeVisitor that translates (annotated) TypeMirrors to * native types * * @author elias_naur * @version $Revision: 3412 $ */ public class NativeTypeTranslator implements TypeVisitor { private Collection native_types; private boolean is_indirect; private final Declaration declaration; private final TypeMap type_map; public NativeTypeTranslator(TypeMap type_map, Declaration declaration) { this.declaration = declaration; this.type_map = type_map; } public String getSignature() { return getSignature(false); } public String getSignature(final boolean skipConst) { StringBuilder signature = new StringBuilder(); if ( !skipConst && declaration.getAnnotation(Const.class) != null ) signature.append("const "); if ( declaration.getAnnotation(PointerWrapper.class) != null ) { signature.append(declaration.getAnnotation(PointerWrapper.class).value()); } else if ( declaration.getAnnotation(NativeType.class) != null ) { signature.append(declaration.getAnnotation(NativeType.class).value()); } else { // Use the name of the native type annotation as the C type name signature.append(getAnnotationType().getSimpleName()); } if ( is_indirect ) signature.append(" *"); return signature.toString(); } public Class getAnnotationType() { if ( native_types.size() != 1 ) throw new RuntimeException("Expected only one native type for declaration " + declaration + ", but got " + native_types.size()); return native_types.iterator().next(); } public void visitAnnotationType(AnnotationType t) { throw new RuntimeException(t + " is not allowed"); } public void visitArrayType(ArrayType t) { final Class type = Utils.getJavaType(t).getComponentType(); if ( CharSequence.class.isAssignableFrom(type) ) { is_indirect = true; native_types = new ArrayList(); native_types.add(type_map.getStringArrayType()); } else if ( Buffer.class.isAssignableFrom(type) ) { is_indirect = true; native_types = new ArrayList(); native_types.add(type_map.getByteBufferArrayType()); } else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) ) { is_indirect = false; } else throw new RuntimeException(t + " is not allowed"); } public static PrimitiveType.Kind getPrimitiveKindFromBufferClass(Class c) { if ( IntBuffer.class.equals(c) ) return PrimitiveType.Kind.INT; else if ( DoubleBuffer.class.equals(c) ) return PrimitiveType.Kind.DOUBLE; else if ( ShortBuffer.class.equals(c) ) return PrimitiveType.Kind.SHORT; else if ( ByteBuffer.class.equals(c) || PointerBuffer.class.equals(c) ) return PrimitiveType.Kind.BYTE; else if ( FloatBuffer.class.equals(c) ) return PrimitiveType.Kind.FLOAT; else if ( LongBuffer.class.equals(c) ) return PrimitiveType.Kind.LONG; else throw new RuntimeException(c + " is not allowed"); } @SuppressWarnings("unchecked") public static Class getClassFromType(DeclaredType t) { try { return (Class)Class.forName(t.getDeclaration().getQualifiedName()); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } private void getNativeTypeFromAnnotatedPrimitiveType(PrimitiveType.Kind kind) { native_types = translateAnnotations(); if ( native_types.size() == 0 ) native_types.add(type_map.getNativeTypeFromPrimitiveType(kind)); } public void visitClassType(ClassType t) { is_indirect = true; Class c = getClassFromType(t); if ( String.class.equals(c) ) { native_types = new ArrayList(); native_types.add(type_map.getStringElementType()); } else if ( Buffer.class.equals(c) ) { native_types = new ArrayList(); native_types.add(type_map.getVoidType()); } else if ( Buffer.class.isAssignableFrom(c) ) { PrimitiveType.Kind kind = getPrimitiveKindFromBufferClass(c); getNativeTypeFromAnnotatedPrimitiveType(kind); } else if ( PointerBuffer.class.isAssignableFrom(c) ) { native_types = new ArrayList(); native_types.add(PointerBuffer.class); } else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(c) ) { native_types = new ArrayList(); native_types.add(PointerWrapper.class); is_indirect = false; } else throw new RuntimeException(t + " is not allowed"); } public void visitPrimitiveType(PrimitiveType t) { getNativeTypeFromAnnotatedPrimitiveType(t.getKind()); } public void visitDeclaredType(DeclaredType t) { throw new RuntimeException(t + " is not allowed"); } public void visitEnumType(EnumType t) { throw new RuntimeException(t + " is not allowed"); } public void visitInterfaceType(InterfaceType t) { throw new RuntimeException(t + " is not allowed"); } // Check if the annotation is itself annotated with a certain annotation type public static T getAnnotation(AnnotationMirror annotation, Class type) { return annotation.getAnnotationType().getDeclaration().getAnnotation(type); } private static Class translateAnnotation(AnnotationMirror annotation) { NativeType native_type = getAnnotation(annotation, NativeType.class); if ( native_type != null ) { return getClassFromType(annotation.getAnnotationType()); } else return null; } private Collection translateAnnotations() { Collection result = new ArrayList(); for ( AnnotationMirror annotation : Utils.getSortedAnnotations(declaration.getAnnotationMirrors()) ) { Class translated_result = translateAnnotation(annotation); if ( translated_result != null ) { result.add(translated_result); } } return result; } public void visitReferenceType(ReferenceType t) { throw new RuntimeException(t + " is not allowed"); } public void visitTypeMirror(TypeMirror t) { throw new RuntimeException(t + " is not allowed"); } public void visitTypeVariable(TypeVariable t) { throw new RuntimeException(t + " is not allowed"); } public void visitVoidType(VoidType t) { native_types = translateAnnotations(); if ( native_types.size() == 0 ) native_types.add(void.class); } public void visitWildcardType(WildcardType t) { throw new RuntimeException(t + " is not allowed"); } } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/0000755000175000017500000000000011543426510021566 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLushort.java0000644000175000017500000000370311543426510024203 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLushort.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLushort { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLsizei.java0000644000175000017500000000370111543426510024000 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLsizei.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLsizei { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLint64EXT.java0000644000175000017500000000345011543426510024203 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLint64EXT { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java0000644000175000017500000003020611543426510024234 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * OpenGL sepcific generator behaviour * * @author elias_naur * @version $Revision: 3392 $ * $Id: GLTypeMap.java 3392 2010-07-27 15:33:22Z spasi $ */ import org.lwjgl.util.generator.NativeTypeTranslator; import org.lwjgl.util.generator.PointerWrapper; import org.lwjgl.util.generator.Signedness; import org.lwjgl.util.generator.TypeMap; import java.io.PrintWriter; import java.lang.annotation.Annotation; import java.nio.*; import java.util.HashMap; import java.util.Map; import com.sun.mirror.declaration.AnnotationMirror; import com.sun.mirror.declaration.MethodDeclaration; import com.sun.mirror.type.PrimitiveType; public class GLTypeMap implements TypeMap { private static final Map native_types_to_primitive; static { native_types_to_primitive = new HashMap(); native_types_to_primitive.put(GLbitfield.class, PrimitiveType.Kind.INT); native_types_to_primitive.put(GLcharARB.class, PrimitiveType.Kind.BYTE); native_types_to_primitive.put(GLclampf.class, PrimitiveType.Kind.FLOAT); native_types_to_primitive.put(GLfloat.class, PrimitiveType.Kind.FLOAT); native_types_to_primitive.put(GLint.class, PrimitiveType.Kind.INT); native_types_to_primitive.put(GLshort.class, PrimitiveType.Kind.SHORT); native_types_to_primitive.put(GLsizeiptr.class, PrimitiveType.Kind.LONG); native_types_to_primitive.put(GLuint.class, PrimitiveType.Kind.INT); native_types_to_primitive.put(GLboolean.class, PrimitiveType.Kind.BOOLEAN); native_types_to_primitive.put(GLchar.class, PrimitiveType.Kind.BYTE); native_types_to_primitive.put(GLdouble.class, PrimitiveType.Kind.DOUBLE); native_types_to_primitive.put(GLhalf.class, PrimitiveType.Kind.SHORT); native_types_to_primitive.put(GLintptrARB.class, PrimitiveType.Kind.LONG); native_types_to_primitive.put(GLsizei.class, PrimitiveType.Kind.INT); native_types_to_primitive.put(GLushort.class, PrimitiveType.Kind.SHORT); native_types_to_primitive.put(GLbyte.class, PrimitiveType.Kind.BYTE); native_types_to_primitive.put(GLclampd.class, PrimitiveType.Kind.DOUBLE); native_types_to_primitive.put(GLenum.class, PrimitiveType.Kind.INT); native_types_to_primitive.put(GLhandleARB.class, PrimitiveType.Kind.INT); native_types_to_primitive.put(GLintptr.class, PrimitiveType.Kind.LONG); native_types_to_primitive.put(GLsizeiptrARB.class, PrimitiveType.Kind.LONG); native_types_to_primitive.put(GLubyte.class, PrimitiveType.Kind.BYTE); native_types_to_primitive.put(GLvoid.class, PrimitiveType.Kind.BYTE); native_types_to_primitive.put(GLint64EXT.class, PrimitiveType.Kind.LONG); native_types_to_primitive.put(GLuint64EXT.class, PrimitiveType.Kind.LONG); native_types_to_primitive.put(GLint64.class, PrimitiveType.Kind.LONG); native_types_to_primitive.put(GLuint64.class, PrimitiveType.Kind.LONG); } public PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class native_type) { PrimitiveType.Kind kind = native_types_to_primitive.get(native_type); if ( kind == null ) throw new RuntimeException("Unsupported type " + native_type); return kind; } public void printCapabilitiesInit(final PrintWriter writer) { writer.println("\t\tContextCapabilities caps = GLContext.getCapabilities();"); } public String getCapabilities() { return "caps"; } public void printErrorCheckMethod(final PrintWriter writer, final MethodDeclaration method, final String tabs) { writer.println(tabs + "Util.checkGLError();"); } public String getRegisterNativesFunctionName() { return "extgl_InitializeClass"; } public Signedness getSignednessFromType(Class type) { if ( GLuint.class.equals(type) ) return Signedness.UNSIGNED; else if ( GLint.class.equals(type) ) return Signedness.SIGNED; else if ( GLushort.class.equals(type) ) return Signedness.UNSIGNED; else if ( GLshort.class.equals(type) ) return Signedness.SIGNED; else if ( GLubyte.class.equals(type) ) return Signedness.UNSIGNED; else if ( GLbyte.class.equals(type) ) return Signedness.SIGNED; else if ( GLuint64EXT.class.equals(type) ) return Signedness.UNSIGNED; else if ( GLint64EXT.class.equals(type) ) return Signedness.SIGNED; else if ( GLuint64.class.equals(type) ) return Signedness.UNSIGNED; else if ( GLint64.class.equals(type) ) return Signedness.SIGNED; else return Signedness.NONE; } public String translateAnnotation(Class annotation_type) { if ( annotation_type.equals(GLuint.class) || annotation_type.equals(GLint.class) ) return "i"; else if ( annotation_type.equals(GLushort.class) || annotation_type.equals(GLshort.class) ) return "s"; else if ( annotation_type.equals(GLubyte.class) || annotation_type.equals(GLbyte.class) ) return "b"; else if ( annotation_type.equals(GLfloat.class) || annotation_type.equals(GLclampf.class) ) return "f"; else if ( annotation_type.equals(GLdouble.class) || annotation_type.equals(GLclampd.class) ) return "d"; else if ( annotation_type.equals(GLhalf.class) ) return "h"; else if ( annotation_type.equals(GLuint64EXT.class) || annotation_type.equals(GLint64EXT.class) || annotation_type.equals(GLuint64.class) || annotation_type.equals(GLint64.class) ) return "i64"; else if ( annotation_type.equals(GLboolean.class) || annotation_type.equals(GLvoid.class) ) return ""; else throw new RuntimeException(annotation_type + " is not allowed"); } public Class getNativeTypeFromPrimitiveType(PrimitiveType.Kind kind) { Class type; switch ( kind ) { case INT: type = GLint.class; break; case DOUBLE: type = GLdouble.class; break; case FLOAT: type = GLfloat.class; break; case SHORT: type = GLshort.class; break; case BYTE: type = GLbyte.class; break; case LONG: type = GLint64EXT.class; break; case BOOLEAN: type = GLboolean.class; break; default: throw new RuntimeException(kind + " is not allowed"); } return type; } public Class getVoidType() { return GLvoid.class; } public Class getStringElementType() { return GLubyte.class; } public Class getStringArrayType() { return GLchar.class; } public Class getByteBufferArrayType() { return GLchar.class; } private static Class[] getValidBufferTypes(Class type) { if ( type.equals(IntBuffer.class) ) return new Class[] { GLbitfield.class, GLenum.class, GLhandleARB.class, GLint.class, GLsizei.class, GLuint.class, GLvoid.class }; else if ( type.equals(FloatBuffer.class) ) return new Class[] { GLclampf.class, GLfloat.class }; else if ( type.equals(ByteBuffer.class) ) return new Class[] { GLboolean.class, GLbyte.class, GLcharARB.class, GLchar.class, GLubyte.class, GLvoid.class }; else if ( type.equals(ShortBuffer.class) ) return new Class[] { GLhalf.class, GLshort.class, GLushort.class }; else if ( type.equals(DoubleBuffer.class) ) return new Class[] { GLclampd.class, GLdouble.class }; else if ( type.equals(LongBuffer.class) ) return new Class[] { GLint64EXT.class, GLuint64EXT.class, GLint64.class, GLuint64.class }; else return new Class[] { }; } private static Class[] getValidPrimitiveTypes(Class type) { if ( type.equals(long.class) ) return new Class[] { GLintptrARB.class, GLuint.class, GLintptr.class, GLsizeiptrARB.class, GLsizeiptr.class, GLint64EXT.class, GLuint64EXT.class, GLint64.class, GLuint64.class }; else if ( type.equals(int.class) ) return new Class[] { GLbitfield.class, GLenum.class, GLhandleARB.class, GLint.class, GLuint.class, GLsizei.class }; else if ( type.equals(double.class) ) return new Class[] { GLclampd.class, GLdouble.class }; else if ( type.equals(float.class) ) return new Class[] { GLclampf.class, GLfloat.class }; else if ( type.equals(short.class) ) return new Class[] { GLhalf.class, GLshort.class, GLushort.class }; else if ( type.equals(byte.class) ) return new Class[] { GLbyte.class, GLcharARB.class, GLchar.class, GLubyte.class }; else if ( type.equals(boolean.class) ) return new Class[] { GLboolean.class }; else if ( type.equals(void.class) ) return new Class[] { GLvoid.class, GLreturn.class }; else return new Class[] { }; } public String getTypedefPostfix() { return ""; } public String getFunctionPrefix() { return "APIENTRY"; } public void printNativeIncludes(PrintWriter writer) { writer.println("#include \"extgl.h\""); } public Class[] getValidAnnotationTypes(Class type) { Class[] valid_types; if ( Buffer.class.isAssignableFrom(type) ) valid_types = getValidBufferTypes(type); else if ( type.isPrimitive() ) valid_types = getValidPrimitiveTypes(type); else if ( String.class.equals(type) ) valid_types = new Class[] { GLubyte.class }; else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) ) valid_types = new Class[] { PointerWrapper.class }; else if (void.class.equals(type) ) valid_types = new Class[] { GLreturn.class }; else valid_types = new Class[] { }; return valid_types; } public Class getInverseType(Class type) { if ( GLuint.class.equals(type) ) return GLint.class; else if ( GLint.class.equals(type) ) return GLuint.class; else if ( GLushort.class.equals(type) ) return GLshort.class; else if ( GLshort.class.equals(type) ) return GLushort.class; else if ( GLubyte.class.equals(type) ) return GLbyte.class; else if ( GLbyte.class.equals(type) ) return GLubyte.class; else if ( GLuint64EXT.class.equals(type) ) return GLint64EXT.class; else if ( GLint64EXT.class.equals(type) ) return GLuint64EXT.class; else if ( GLuint64.class.equals(type) ) return GLint64.class; else if ( GLint64.class.equals(type) ) return GLuint64.class; else return null; } public String getAutoTypeFromAnnotation(AnnotationMirror annotation) { Class annotation_class = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType()); if ( annotation_class.equals(GLint.class) ) return "GL11.GL_INT"; else if ( annotation_class.equals(GLbyte.class) ) return "GL11.GL_BYTE"; else if ( annotation_class.equals(GLshort.class) ) return "GL11.GL_SHORT"; if ( annotation_class.equals(GLuint.class) ) return "GL11.GL_UNSIGNED_INT"; else if ( annotation_class.equals(GLubyte.class) ) return "GL11.GL_UNSIGNED_BYTE"; else if ( annotation_class.equals(GLushort.class) ) return "GL11.GL_UNSIGNED_SHORT"; else if ( annotation_class.equals(GLfloat.class) ) return "GL11.GL_FLOAT"; else if ( annotation_class.equals(GLdouble.class) ) return "GL11.GL_DOUBLE"; else return null; } } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLint64.java0000644000175000017500000000344511543426510023626 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLint64 { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLclampf.java0000644000175000017500000000370311543426510024121 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLclampf.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLclampf { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLint.java0000644000175000017500000000367511543426510023461 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLint.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLint { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLenum.java0000644000175000017500000000367711543426510023635 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLenum.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLenum { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLhandleARB.java0000644000175000017500000000371111543426510024436 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLhandleARB.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLhandleARB { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLintptrARB.java0000644000175000017500000000371111543426510024523 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLintptrARB.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLintptrARB { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLhalf.java0000644000175000017500000000367711543426510023603 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLhalf.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLhalf { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLdouble.java0000644000175000017500000000370311543426510024131 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLdouble.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLdouble { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLsizeiptr.java0000644000175000017500000000370711543426510024534 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLsizeiptr.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLsizeiptr { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLtime.java0000644000175000017500000000376511543426510023625 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * Unsigned binary representing an absolute absolute or relative time interval. * Precision is nanoseconds but accuracy is implementation-dependent. * * @author spasi */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.ElementType; import java.lang.annotation.Target; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLtime { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessorFactory.java0000644000175000017500000001725411543426510030043 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; import org.lwjgl.util.generator.Utils; import static java.util.Collections.unmodifiableCollection; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.Arrays; import java.util.Collection; import java.util.Map; import java.util.Set; import com.sun.mirror.apt.AnnotationProcessor; import com.sun.mirror.apt.AnnotationProcessorEnvironment; import com.sun.mirror.apt.AnnotationProcessorFactory; import com.sun.mirror.apt.AnnotationProcessors; import com.sun.mirror.apt.Filer; import com.sun.mirror.apt.RoundCompleteEvent; import com.sun.mirror.apt.RoundCompleteListener; import com.sun.mirror.declaration.AnnotationTypeDeclaration; import com.sun.mirror.declaration.InterfaceDeclaration; import com.sun.mirror.declaration.TypeDeclaration; import com.sun.mirror.util.DeclarationFilter; /** * * Generator tool for creating the ContexCapabilities class * * @author elias_naur * @version $Revision: 3316 $ * $Id: ContextGeneratorProcessorFactory.java 3316 2010-04-09 23:57:40Z spasi $ */ public class GLGeneratorProcessorFactory implements AnnotationProcessorFactory, RoundCompleteListener { private static boolean first_round = true; // Process any set of annotations private static final Collection supportedAnnotations = unmodifiableCollection(Arrays.asList("*")); public Collection supportedAnnotationTypes() { return supportedAnnotations; } public Collection supportedOptions() { return unmodifiableCollection(Arrays.asList("-Acontextspecific", "-Ageneratechecks")); } public void roundComplete(RoundCompleteEvent event) { first_round = false; } public AnnotationProcessor getProcessorFor(Set atds, AnnotationProcessorEnvironment env) { // Only process the initial types, not the generated ones if (first_round) { env.addListener(this); return new GeneratorProcessor(env); } else return AnnotationProcessors.NO_OP; } private static class GeneratorProcessor implements AnnotationProcessor { private final AnnotationProcessorEnvironment env; GeneratorProcessor(AnnotationProcessorEnvironment env) { this.env = env; } public void process() { Map options = env.getOptions(); boolean generate_error_checks = options.containsKey("-Ageneratechecks"); boolean context_specific = options.containsKey("-Acontextspecific"); try { generateContextCapabilitiesSource(context_specific, generate_error_checks); } catch (IOException e) { throw new RuntimeException(e); } } private void generateContextCapabilitiesSource(boolean context_specific, boolean generate_error_checks) throws IOException { PrintWriter writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, "org.lwjgl.opengl", new File(Utils.CONTEXT_CAPS_CLASS_NAME + ".java"), null); writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */"); writer.println(); writer.println("package org.lwjgl.opengl;"); writer.println(); writer.println("import org.lwjgl.LWJGLException;"); writer.println("import org.lwjgl.LWJGLUtil;"); writer.println("import java.util.Set;"); writer.println("import java.util.HashSet;"); writer.println(); GLCapabilitiesGenerator.generateClassPrologue(writer, context_specific, generate_error_checks); DeclarationFilter filter = DeclarationFilter.getFilter(InterfaceDeclaration.class); Collection interface_decls = filter.filter(env.getSpecifiedTypeDeclarations()); for (TypeDeclaration typedecl : interface_decls) { InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; if (Utils.isFinal(interface_decl)) GLCapabilitiesGenerator.generateField(writer, interface_decl); } writer.println(); for (TypeDeclaration typedecl : interface_decls) { InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; GLCapabilitiesGenerator.generateSymbolAddresses(writer, interface_decl); } writer.println(); if (context_specific) { for (TypeDeclaration typedecl : interface_decls) { InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; GLCapabilitiesGenerator.generateAddressesInitializers(writer, interface_decl); } writer.println(); } writer.println("\tprivate static void remove(Set supported_extensions, String extension) {"); writer.println("\t\tLWJGLUtil.log(extension + \" was reported as available but an entry point is missing\");"); writer.println("\t\tsupported_extensions.remove(extension);"); writer.println("\t}\n"); GLCapabilitiesGenerator.generateInitStubsPrologue(writer, context_specific); for (TypeDeclaration typedecl : interface_decls) { InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; GLCapabilitiesGenerator.generateSuperClassAdds(writer, interface_decl); } for (TypeDeclaration typedecl : interface_decls) { InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; String simple_name = interface_decl.getSimpleName(); if ( "GL11".equals(simple_name) ) continue; GLCapabilitiesGenerator.generateInitStubs(writer, interface_decl, context_specific); } GLCapabilitiesGenerator.generateInitStubsEpilogue(writer, context_specific); writer.println(); writer.println("\tstatic void unloadAllStubs() {"); if (!context_specific) { writer.println("\t\tif (!loaded_stubs)"); writer.println("\t\t\treturn;"); for (TypeDeclaration typedecl : interface_decls) { InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; GLCapabilitiesGenerator.generateUnloadStubs(writer, interface_decl); } writer.println("\t\tloaded_stubs = false;"); } writer.println("\t}"); writer.println(); GLCapabilitiesGenerator.generateInitializerPrologue(writer); for (TypeDeclaration typedecl : interface_decls) { InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; if (Utils.isFinal(interface_decl)) GLCapabilitiesGenerator.generateInitializer(writer, interface_decl); } writer.println("\t\ttracker.init();"); writer.println("\t}"); writer.println("}"); writer.close(); } } } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLvoid.java0000644000175000017500000000404611543426510023621 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 3279 $ * $Id: GLvoid.java 3279 2010-03-11 21:06:49Z spasi $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; import com.sun.mirror.type.PrimitiveType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLvoid { PrimitiveType.Kind value() default PrimitiveType.Kind.BYTE; } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLreturn.java0000644000175000017500000000475411543426510024205 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * When a method is annonated with @GLreturn, the specified output Buffer parameter * will be used to return a single value. The primitive type will match the Buffer type. * String will be returned if the Buffer is a ByteBuffer annotated with @GLchar. * * @author spasi */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.ElementType; import java.lang.annotation.Target; @NativeType @Target({ ElementType.METHOD }) public @interface GLreturn { /** The Buffer parameter to use as the method result. */ String value(); /** The argument that specifies the maximum number of bytes that may be read (String results only). */ String maxLength() default ""; /** If true, the maxLength value is going to be used when creating the String. */ boolean forceMaxLength() default false; ///** If we use the byte buffer for another parameter, an offset must be used. */ //String offset() default ""; }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLboolean.java0000644000175000017500000000370511543426510024300 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLboolean.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLboolean { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLclampd.java0000644000175000017500000000370311543426510024117 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLclampd.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLclampd { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLbyte.java0000644000175000017500000000367711543426510023634 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLbyte.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLbyte { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLintptr.java0000644000175000017500000000370311543426510024177 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLintptr.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLintptr { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLcharARB.java0000644000175000017500000000370511543426510024123 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLcharARB.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLcharARB { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLuint64EXT.java0000644000175000017500000000345111543426510024371 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLuint64EXT { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLshort.java0000644000175000017500000000370111543426510024014 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLshort.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLshort { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLuint64.java0000644000175000017500000000344611543426510024014 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLuint64 { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java0000644000175000017500000003337011543426510027122 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; import org.lwjgl.util.generator.*; import java.io.PrintWriter; import java.util.Arrays; import java.util.Collection; import java.util.EnumSet; import java.util.Iterator; import com.sun.mirror.declaration.InterfaceDeclaration; import com.sun.mirror.declaration.MethodDeclaration; import com.sun.mirror.type.InterfaceType; /** * Generator visitor for the context capabilities generator tool * * @author elias_naur * @version $Revision: 3355 $ * $Id: ContextCapabilitiesGenerator.java 3355 2010-05-27 22:56:29Z spasi $ */ public class GLCapabilitiesGenerator { private static final String STUBS_LOADED_NAME = "loaded_stubs"; private static final String ALL_INIT_METHOD_NAME = "initAllStubs"; private static final String POINTER_INITIALIZER_POSTFIX = "_initNativeFunctionAddresses"; private static final String CACHED_EXTS_VAR_NAME = "supported_extensions"; private static final String PROFILE_MASK_VAR_NAME = "profileMask"; private static final String EXTENSION_PREFIX = "GL_"; private static final String CORE_PREFIX = "Open"; public static void generateClassPrologue(PrintWriter writer, boolean context_specific, boolean generate_error_checks) { writer.println("public class " + Utils.CONTEXT_CAPS_CLASS_NAME + " {"); writer.println("\tstatic final boolean DEBUG = " + Boolean.toString(generate_error_checks) + ";"); writer.println("\tfinal StateTracker tracker = new StateTracker();"); writer.println(); if ( !context_specific ) { writer.println("\tprivate static boolean " + STUBS_LOADED_NAME + " = false;"); } } public static void generateInitializerPrologue(PrintWriter writer) { writer.println("\t" + Utils.CONTEXT_CAPS_CLASS_NAME + "(boolean forwardCompatible) throws LWJGLException {"); writer.println("\t\tSet " + CACHED_EXTS_VAR_NAME + " = " + ALL_INIT_METHOD_NAME + "(forwardCompatible);"); } private static String translateFieldName(String interface_name) { if ( interface_name.startsWith("GL") ) return CORE_PREFIX + interface_name; else return EXTENSION_PREFIX + interface_name; } public static void generateSuperClassAdds(PrintWriter writer, InterfaceDeclaration d) { Collection super_interfaces = d.getSuperinterfaces(); if ( super_interfaces.size() > 1 ) throw new RuntimeException(d + " extends more than one other interface"); if ( super_interfaces.size() == 1 ) { InterfaceType super_interface = super_interfaces.iterator().next(); writer.print("\t\tif (" + CACHED_EXTS_VAR_NAME + ".contains(\""); writer.println(translateFieldName(d.getSimpleName()) + "\"))"); writer.print("\t\t\t"); generateAddExtension(writer, super_interface.getDeclaration()); } } public static void generateInitializer(PrintWriter writer, InterfaceDeclaration d) { String translated_field_name = translateFieldName(d.getSimpleName()); writer.print("\t\tthis." + translated_field_name + " = "); writer.print(CACHED_EXTS_VAR_NAME + ".contains(\""); writer.print(translated_field_name + "\")"); Collection super_interfaces = d.getSuperinterfaces(); if ( super_interfaces.size() > 1 ) throw new RuntimeException(d + " extends more than one other interface"); if ( super_interfaces.size() == 1 ) { InterfaceType super_interface = super_interfaces.iterator().next(); writer.println(); writer.print("\t\t\t&& " + CACHED_EXTS_VAR_NAME + ".contains(\""); writer.print(translateFieldName(super_interface.getDeclaration().getSimpleName()) + "\")"); } Alias alias_annotation = d.getAnnotation(Alias.class); if ( alias_annotation != null ) { writer.println(); writer.print("\t\t\t|| " + CACHED_EXTS_VAR_NAME + ".contains(\""); writer.print(translateFieldName(alias_annotation.value()) + "\")"); } writer.println(";"); } private static String getAddressesInitializerName(String class_name) { return class_name + POINTER_INITIALIZER_POSTFIX; } public static void generateInitStubsPrologue(PrintWriter writer, boolean context_specific) { writer.println("\tprivate Set " + ALL_INIT_METHOD_NAME + "(boolean forwardCompatible) throws LWJGLException {"); // Load the basic pointers we need to detect OpenGL version and supported extensions. writer.println("\t\tglGetError = GLContext.getFunctionAddress(\"glGetError\");"); writer.println("\t\tglGetString = GLContext.getFunctionAddress(\"glGetString\");"); // Initialize GL11.glGetIntegerv and GL30.glGetStringi here, in case we have created an OpenGL 3.0 context. // (they will be used in GLContext.getSupportedExtensions) writer.println("\t\tglGetIntegerv = GLContext.getFunctionAddress(\"glGetIntegerv\");"); writer.println("\t\tglGetStringi = GLContext.getFunctionAddress(\"glGetStringi\");"); // Get the supported extensions set. writer.println("\t\tGLContext.setCapabilities(this);"); writer.println("\t\tSet " + CACHED_EXTS_VAR_NAME + " = new HashSet(256);"); writer.println("\t\tint " + PROFILE_MASK_VAR_NAME + " = GLContext.getSupportedExtensions(" + CACHED_EXTS_VAR_NAME + ");"); // Force forward compatible mode when OpenGL version is 3.1 or higher and ARB_compatibility is not available. writer.println("\t\tif ( supported_extensions.contains(\"OpenGL31\") && !(supported_extensions.contains(\"GL_ARB_compatibility\") || (profileMask & GL32.GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) != 0) )"); writer.println("\t\t\tforwardCompatible = true;"); if ( !context_specific ) { writer.println("\t\tif (" + STUBS_LOADED_NAME + ")"); writer.println("\t\t\treturn GLContext.getSupportedExtensions();"); writer.println("\t\torg.lwjgl.opengl.GL11." + Utils.STUB_INITIALIZER_NAME + "();"); } else { writer.println("\t\tif (!" + getAddressesInitializerName("GL11") + "(forwardCompatible))"); writer.println("\t\t\tthrow new LWJGLException(\"GL11 not supported\");"); } } public static void generateInitStubsEpilogue(PrintWriter writer, boolean context_specific) { if ( !context_specific ) { writer.println("\t\t" + STUBS_LOADED_NAME + " = true;"); } writer.println("\t\treturn " + CACHED_EXTS_VAR_NAME + ";"); writer.println("\t}"); } public static void generateUnloadStubs(PrintWriter writer, InterfaceDeclaration d) { if ( d.getMethods().size() > 0 ) { writer.print("\t\tGLContext.resetNativeStubs(" + Utils.getSimpleClassName(d)); writer.println(".class);"); } } public static void generateInitStubs(PrintWriter writer, InterfaceDeclaration d, boolean context_specific) { if ( d.getMethods().size() > 0 ) { if ( context_specific ) { final Alias alias_annotation = d.getAnnotation(Alias.class); if ( d.getAnnotation(ForceInit.class) != null ) writer.println("\t\t" + CACHED_EXTS_VAR_NAME + ".add(\"" + translateFieldName(d.getSimpleName()) + "\");"); writer.print("\t\tif ("); if ( alias_annotation != null ) writer.print("("); writer.print(CACHED_EXTS_VAR_NAME + ".contains(\""); writer.print(translateFieldName(d.getSimpleName()) + "\")"); if ( alias_annotation != null ) { writer.print(" || " + CACHED_EXTS_VAR_NAME + ".contains(\""); writer.print(translateFieldName(alias_annotation.value()) + "\"))"); } writer.print(" && !" + getAddressesInitializerName(d.getSimpleName()) + "("); if ( d.getAnnotation(DeprecatedGL.class) != null ) writer.print("forwardCompatible"); if ( d.getAnnotation(Dependent.class) != null ) { if ( d.getAnnotation(DeprecatedGL.class) != null ) writer.print(","); writer.print("supported_extensions"); } if ( alias_annotation != null ) { writer.println(")) {"); writer.print("\t\t\tremove(" + CACHED_EXTS_VAR_NAME + ", \""); writer.println(translateFieldName(alias_annotation.value()) + "\");"); } else writer.println("))"); writer.print("\t\t\tremove(" + CACHED_EXTS_VAR_NAME + ", \""); writer.println(translateFieldName(d.getSimpleName()) + "\");"); if ( alias_annotation != null ) writer.println("\t\t}"); } else { writer.print("\t\tGLContext." + Utils.STUB_INITIALIZER_NAME + "(" + Utils.getSimpleClassName(d)); writer.println(".class, " + CACHED_EXTS_VAR_NAME + ", \"" + translateFieldName(d.getSimpleName()) + "\");"); } } } private static void generateAddExtension(PrintWriter writer, InterfaceDeclaration d) { writer.print(CACHED_EXTS_VAR_NAME + ".add(\""); writer.println(translateFieldName(d.getSimpleName()) + "\");"); } public static void generateAddressesInitializers(PrintWriter writer, InterfaceDeclaration d) { Iterator methods = d.getMethods().iterator(); if ( !methods.hasNext() ) return; writer.print("\tprivate boolean " + getAddressesInitializerName(d.getSimpleName()) + "("); boolean optional; boolean deprecated = d.getAnnotation(DeprecatedGL.class) != null; Dependent dependent = d.getAnnotation(Dependent.class); if ( deprecated ) writer.print("boolean forwardCompatible"); if ( dependent != null ) { if ( deprecated ) writer.print(","); writer.print("Set supported_extensions"); } Alias alias_annotation = d.getAnnotation(Alias.class); boolean aliased = alias_annotation != null && alias_annotation.postfix().length() > 0; writer.println(") {"); writer.println("\t\treturn "); boolean first = true; while ( methods.hasNext() ) { MethodDeclaration method = methods.next(); if ( method.getAnnotation(Alternate.class) != null ) continue; if ( !first ) writer.println(" &"); else first = false; optional = method.getAnnotation(Optional.class) != null; deprecated = method.getAnnotation(DeprecatedGL.class) != null; dependent = method.getAnnotation(Dependent.class); writer.print("\t\t\t("); if ( optional ) writer.print('('); if ( deprecated ) writer.print("forwardCompatible || "); if ( dependent != null ) { if ( dependent.value().indexOf(',') == -1 ) writer.print("!supported_extensions.contains(\"" + dependent.value() + "\") || "); else { writer.print("!(false"); for ( String extension : dependent.value().split(",") ) writer.print(" || supported_extensions.contains(\"" + extension + "\")"); writer.print(") || "); } } if ( deprecated || dependent != null ) writer.print('('); writer.print(Utils.getFunctionAddressName(d, method) + " = "); PlatformDependent platform_dependent = method.getAnnotation(PlatformDependent.class); if ( platform_dependent != null ) { EnumSet platform_set = EnumSet.copyOf(Arrays.asList(platform_dependent.value())); writer.print("GLContext.getPlatformSpecificFunctionAddress(\""); writer.print(Platform.ALL.getPrefix() + "\", "); writer.print("new String[]{"); Iterator platforms = platform_set.iterator(); while ( platforms.hasNext() ) { writer.print("\"" + platforms.next().getOSPrefix() + "\""); if ( platforms.hasNext() ) writer.print(", "); } writer.print("}, new String[]{"); platforms = platform_set.iterator(); while ( platforms.hasNext() ) { writer.print("\"" + platforms.next().getPrefix() + "\""); if ( platforms.hasNext() ) writer.print(", "); } writer.print("}, "); } else if ( aliased ) { writer.print("GLContext.getFunctionAddress(new String[] {\"" + method.getSimpleName() + "\",\"" + method.getSimpleName() + alias_annotation.postfix() + "\"})) != 0"); } else writer.print("GLContext.getFunctionAddress("); if ( !aliased ) writer.print("\"" + method.getSimpleName() + "\")) != 0"); if ( deprecated || dependent != null ) writer.print(')'); if ( optional ) writer.print(" || true)"); } writer.println(";"); writer.println("\t}"); writer.println(); } public static void generateSymbolAddresses(PrintWriter writer, InterfaceDeclaration d) { boolean first = true; for ( final MethodDeclaration method : d.getMethods() ) { if ( method.getAnnotation(Alternate.class) != null || method.getAnnotation(Reuse.class) != null ) continue; if ( first ) { writer.println("\t// " + d.getSimpleName()); first = false; } writer.println("\tlong " + Utils.getFunctionAddressName(d, method) + ";"); } } public static void generateField(PrintWriter writer, InterfaceDeclaration d) { writer.println("\tpublic final boolean " + translateFieldName(d.getSimpleName()) + ";"); } }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLbitfield.java0000644000175000017500000000370711543426510024445 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLbitfield.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLbitfield { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLchar.java0000644000175000017500000000367711543426510023606 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLchar.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLchar { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLubyte.java0000644000175000017500000000370111543426510024005 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLubyte.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLubyte { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLsizeiptrARB.java0000644000175000017500000000371511543426510025060 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLsizeiptrARB.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLsizeiptrARB { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessorFactory.java0000644000175000017500000002155511543426510032044 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; import org.lwjgl.util.generator.CachedReference; import org.lwjgl.util.generator.Utils; import static java.util.Collections.emptyList; import static java.util.Collections.unmodifiableCollection; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.Arrays; import java.util.Collection; import java.util.Set; import com.sun.mirror.apt.AnnotationProcessor; import com.sun.mirror.apt.AnnotationProcessorEnvironment; import com.sun.mirror.apt.AnnotationProcessorFactory; import com.sun.mirror.apt.AnnotationProcessors; import com.sun.mirror.apt.Filer; import com.sun.mirror.apt.RoundCompleteEvent; import com.sun.mirror.apt.RoundCompleteListener; import com.sun.mirror.declaration.AnnotationTypeDeclaration; import com.sun.mirror.declaration.InterfaceDeclaration; import com.sun.mirror.declaration.MethodDeclaration; import com.sun.mirror.declaration.ParameterDeclaration; import com.sun.mirror.declaration.TypeDeclaration; import com.sun.mirror.util.DeclarationFilter; /** * * Generator tool for creating the References class * * @author elias_naur * @version $Revision: 3237 $ * $Id: ReferencesGeneratorProcessorFactory.java 3237 2009-09-08 15:07:15Z spasi $ */ public class GLReferencesGeneratorProcessorFactory implements AnnotationProcessorFactory, RoundCompleteListener { private static final String REFERENCES_CLASS_NAME = "References"; private static final String REFERENCES_PARAMETER_NAME = "references"; private static boolean first_round = true; // Process any set of annotations private static final Collection supportedAnnotations = unmodifiableCollection(Arrays.asList("*")); public Collection supportedAnnotationTypes() { return supportedAnnotations; } public Collection supportedOptions() { return emptyList(); } public void roundComplete(RoundCompleteEvent event) { first_round = false; } public AnnotationProcessor getProcessorFor(Set atds, AnnotationProcessorEnvironment env) { // Only process the initial types, not the generated ones if (first_round) { env.addListener(this); return new GeneratorProcessor(env); } else return AnnotationProcessors.NO_OP; } private static class GeneratorProcessor implements AnnotationProcessor { private final AnnotationProcessorEnvironment env; GeneratorProcessor(AnnotationProcessorEnvironment env) { this.env = env; } public void process() { try { generateReferencesSource(); } catch (IOException e) { throw new RuntimeException(e); } } private static void generateClearsFromParameters(PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method) { for (ParameterDeclaration param : method.getParameters()) { CachedReference cached_reference_annotation = param.getAnnotation(CachedReference.class); if (cached_reference_annotation != null && cached_reference_annotation.name().length() == 0) { Class nio_type = Utils.getNIOBufferType(param.getType()); String reference_name = Utils.getReferenceName(interface_decl, method, param); writer.println("\t\tthis." + reference_name + " = null;"); } } } private static void generateCopiesFromParameters(PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method) { for (ParameterDeclaration param : method.getParameters()) { CachedReference cached_reference_annotation = param.getAnnotation(CachedReference.class); if (cached_reference_annotation != null && cached_reference_annotation.name().length() == 0) { Class nio_type = Utils.getNIOBufferType(param.getType()); String reference_name = Utils.getReferenceName(interface_decl, method, param); writer.print("\t\t\tthis." + reference_name + " = "); writer.println(REFERENCES_PARAMETER_NAME + "." + reference_name + ";"); } } } private static void generateClearsFromMethods(PrintWriter writer, InterfaceDeclaration interface_decl) { for (MethodDeclaration method : interface_decl.getMethods()) { generateClearsFromParameters(writer, interface_decl, method); } } private static void generateCopiesFromMethods(PrintWriter writer, InterfaceDeclaration interface_decl) { for (MethodDeclaration method : interface_decl.getMethods()) { generateCopiesFromParameters(writer, interface_decl, method); } } private static void generateReferencesFromParameters(PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method) { for (ParameterDeclaration param : method.getParameters()) { CachedReference cached_reference_annotation = param.getAnnotation(CachedReference.class); if (cached_reference_annotation != null && cached_reference_annotation.name().length() == 0) { Class nio_type = Utils.getNIOBufferType(param.getType()); if (nio_type == null) throw new RuntimeException(param + " in method " + method + " in " + interface_decl + " is annotated with " + cached_reference_annotation.annotationType().getSimpleName() + " but the parameter is not a NIO buffer"); writer.print("\t" + nio_type.getName() + " " + Utils.getReferenceName(interface_decl, method, param)); writer.println(";"); } } } private static void generateReferencesFromMethods(PrintWriter writer, InterfaceDeclaration interface_decl) { for (MethodDeclaration method : interface_decl.getMethods()) { generateReferencesFromParameters(writer, interface_decl, method); } } private void generateReferencesSource() throws IOException { PrintWriter writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, "org.lwjgl.opengl", new File(REFERENCES_CLASS_NAME + ".java"), null); writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */"); writer.println(); writer.println("package org.lwjgl.opengl;"); writer.println(); writer.println("class " + REFERENCES_CLASS_NAME + " extends BaseReferences {"); writer.println("\t" + REFERENCES_CLASS_NAME + "(ContextCapabilities caps) {"); writer.println("\t\tsuper(caps);"); writer.println("\t}"); DeclarationFilter filter = DeclarationFilter.getFilter(InterfaceDeclaration.class); Collection interface_decls = filter.filter(env.getSpecifiedTypeDeclarations()); for (TypeDeclaration typedecl : interface_decls) { InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; generateReferencesFromMethods(writer, interface_decl); } writer.println(); writer.println("\tvoid copy(" + REFERENCES_CLASS_NAME + " " + REFERENCES_PARAMETER_NAME + ", int mask) {"); writer.println("\t\tsuper.copy(" + REFERENCES_PARAMETER_NAME + ", mask);"); writer.println("\t\tif ( (mask & GL11.GL_CLIENT_VERTEX_ARRAY_BIT) != 0 ) {"); for (TypeDeclaration typedecl : interface_decls) { InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; generateCopiesFromMethods(writer, interface_decl); } writer.println("\t\t}"); writer.println("\t}"); writer.println("\tvoid clear() {"); writer.println("\t\tsuper.clear();"); for (TypeDeclaration typedecl : interface_decls) { InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; generateClearsFromMethods(writer, interface_decl); } writer.println("\t}"); writer.println("}"); writer.close(); } } } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLfloat.java0000644000175000017500000000370111543426510023762 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLfloat.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLfloat { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/opengl/GLuint.java0000644000175000017500000000367711543426510023650 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator.opengl; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: GLuint.java 2983 2008-04-07 18:36:09Z matzon $ */ import org.lwjgl.util.generator.NativeType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLuint { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/FieldsGenerator.java0000644000175000017500000001211111543426510024216 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; import java.io.PrintWriter; import java.util.Collection; import com.sun.mirror.declaration.FieldDeclaration; import com.sun.mirror.declaration.Modifier; import com.sun.mirror.type.PrimitiveType; import com.sun.mirror.type.TypeMirror; public class FieldsGenerator { private static void validateField(FieldDeclaration field) { // Check if field is "public static final" Collection modifiers = field.getModifiers(); if ( modifiers.size() != 3 || !modifiers.contains(Modifier.PUBLIC) || !modifiers.contains(Modifier.STATIC) || !modifiers.contains(Modifier.FINAL) ) { throw new RuntimeException("Field " + field.getSimpleName() + " is not declared public static final"); } // Check suported types (int, long, float, String) TypeMirror field_type = field.getType(); if ( field_type instanceof PrimitiveType ) { PrimitiveType field_type_prim = (PrimitiveType)field_type; PrimitiveType.Kind field_kind = field_type_prim.getKind(); if ( field_kind != PrimitiveType.Kind.INT && field_kind != PrimitiveType.Kind.LONG && field_kind != PrimitiveType.Kind.FLOAT ) { throw new RuntimeException("Field " + field.getSimpleName() + " is not of type 'int', 'long' or 'float'"); } } else if ( "java.lang.String".equals(field_type.toString()) ) { } else { throw new RuntimeException("Field " + field.getSimpleName() + " is not a primitive type or String"); } Object field_value = field.getConstantValue(); if ( field_value == null ) { throw new RuntimeException("Field " + field.getSimpleName() + " has no initial value"); } } private static void generateField(PrintWriter writer, FieldDeclaration field, FieldDeclaration prev_field) { validateField(field); Object value = field.getConstantValue(); String field_value_string; Class field_value_class = value.getClass(); if ( field_value_class.equals(Integer.class) ) { field_value_string = "0x" + Integer.toHexString((Integer)field.getConstantValue()).toUpperCase(); } else if ( field_value_class.equals(Long.class) ) { field_value_string = "0x" + Long.toHexString((Long)field.getConstantValue()).toUpperCase() + 'L'; } else if ( field_value_class.equals(Float.class) ) { field_value_string = field.getConstantValue() + "f"; } else if ( field_value_class.equals(String.class) ) { field_value_string = "\"" + field.getConstantValue() + "\""; } else { throw new RuntimeException("Field is of unexpected type. This means there is a bug in validateField()."); } boolean hadDoc = prev_field != null && prev_field.getDocComment() != null; boolean hasDoc = field.getDocComment() != null; boolean newBatch = prev_field == null || !prev_field.getType().equals(field.getType()) || (!hadDoc && field.getDocComment() != null) || (hadDoc && hasDoc && !prev_field.getDocComment().equals(field.getDocComment())); // Print field declaration if ( newBatch ) { if ( prev_field != null ) writer.println(";\n"); Utils.printDocComment(writer, field); writer.print("\tpublic static final " + field.getType().toString() + " " + field.getSimpleName() + " = " + field_value_string); } else writer.print(",\n\t\t" + field.getSimpleName() + " = " + field_value_string); } public static void generateFields(PrintWriter writer, Collection fields) { if ( 0 < fields.size() ) { writer.println(); FieldDeclaration prev_field = null; for ( FieldDeclaration field : fields ) { generateField(writer, field, prev_field); prev_field = field; } writer.println(";"); } } } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/CachedResult.java0000644000175000017500000000362311543426510023517 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * @author elias_naur * @version $Revision: 3262 $ * $Id: CachedResult.java 3262 2010-01-04 18:47:49Z spasi $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target(ElementType.METHOD) public @interface CachedResult { boolean isRange() default false; } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Dependent.java0000644000175000017500000000403411543426510023054 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * Use this annotation on extensions with functionality that depends on the presence of other extensions. * Functions in such extensions marked with this annotation will only be loaded if the specified extension is present. * * @author spasi */ import java.lang.annotation.ElementType; import java.lang.annotation.Target; @Target({ ElementType.TYPE, ElementType.METHOD }) public @interface Dependent { String value() default ""; }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/PointerArray.java0000644000175000017500000000373711543426510023576 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * @author spasi */ import java.lang.annotation.ElementType; import java.lang.annotation.Target; @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface PointerArray { /** Number of values in the string list (name of native-side parameter) */ String value(); /** List of string lengths (name of native-side parameter) */ String lengths() default ""; }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Reuse.java0000644000175000017500000000406411543426510022234 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; import java.lang.annotation.ElementType; import java.lang.annotation.Target; /** * Reuse can be used to annotate methods that duplicate functionality that has been already * defined somewhere else. For example, this can be applied to OpenGL core functionality that * exists as an ARB extension as well, but with the exact same entry points. * * @author Spasi */ @Target(ElementType.METHOD) public @interface Reuse { /** The extension Class that defines the method. */ String value(); }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Code.java0000644000175000017500000000457711543426510022034 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * @author elias_naur * @version $Revision: 3412 $ * $Id: Code.java 3412 2010-09-26 23:43:24Z spasi $ */ import java.lang.annotation.ElementType; import java.lang.annotation.Target; @Target(ElementType.METHOD) public @interface Code { String value() default ""; // Java, before everything boolean tryBlock() default false; // Add a try/finally block around the native call and return statement String javaBeforeNative() default ""; // Before the native call String javaAfterNative() default ""; // After the native call String javaFinally() default ""; // In the finally block String nativeAfterVars() default ""; // After variable declaration String nativeBeforeCall() default ""; // Before the API call String nativeAfterCall() default ""; // After the API call } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/BufferKind.java0000644000175000017500000000350411543426510023166 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * @author elias_naur * @version $Revision: 3279 $ * $Id: BufferKind.java 3279 2010-03-11 21:06:49Z spasi $ */ public enum BufferKind { UnpackPBO, PackPBO, ElementVBO, ArrayVBO, IndirectBO } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/TypeInfo.java0000644000175000017500000002042111543426510022701 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * This class represent a parameter configuration. There are multiple * TypeInfos in case of multityped parameters. * * @author elias_naur * @version $Revision: 3412 $ * $Id: TypeInfo.java 3412 2010-09-26 23:43:24Z spasi $ */ import org.lwjgl.util.generator.opengl.GLvoid; import com.sun.mirror.declaration.*; import com.sun.mirror.type.*; import java.lang.annotation.Annotation; import java.util.*; import java.nio.*; public class TypeInfo { public static final String UNSIGNED_PARAMETER_NAME = "unsigned"; private final Signedness signedness; private final Class type; private final String auto_type; private TypeInfo(Class type, Signedness signedness, String auto_type) { this.type = type; this.signedness = signedness; this.auto_type = auto_type; } public Class getType() { return type; } public Signedness getSignedness() { return signedness; } public String getAutoType() { if (auto_type == null) throw new RuntimeException("No auto type assigned"); return auto_type; } private static Class getTypeFromPrimitiveKind(PrimitiveType.Kind kind) { Class type; switch (kind) { case LONG: type = long.class; break; case INT: type = int.class; break; case FLOAT: type = float.class; break; case DOUBLE: type = double.class; break; case SHORT: type = short.class; break; case BYTE: type = byte.class; break; case BOOLEAN: type = boolean.class; break; default: throw new RuntimeException(kind + " is not allowed"); } return type; } private static Class getBufferTypeFromPrimitiveKind(PrimitiveType.Kind kind) { Class type; switch (kind) { case INT: type = IntBuffer.class; break; case FLOAT: type = FloatBuffer.class; break; case DOUBLE: type = DoubleBuffer.class; break; case SHORT: type = ShortBuffer.class; break; case LONG: type = LongBuffer.class; break; case BYTE: /* fall through */ case BOOLEAN: type = ByteBuffer.class; break; default: throw new RuntimeException(kind + " is not allowed"); } return type; } private static TypeInfo getDefaultTypeInfo(TypeMirror t) { Class java_type = Utils.getJavaType(t); return new TypeInfo(java_type, Signedness.NONE, null); } public static Map getDefaultTypeInfoMap(MethodDeclaration method) { Map map = new HashMap(); for (ParameterDeclaration param : method.getParameters()) { TypeInfo type_info = getDefaultTypeInfo(param.getType()); map.put(param, type_info); } return map; } private static Collection getTypeInfos(TypeMap type_map, Declaration param, TypeMirror decl_type) { Collection annotations = Utils.getSortedAnnotations(param.getAnnotationMirrors()); Map types = new HashMap(); Collection multityped_result = new ArrayList(); boolean add_default_type = true; for (AnnotationMirror annotation : annotations) { NativeType native_type_annotation = NativeTypeTranslator.getAnnotation(annotation, NativeType.class); if (native_type_annotation != null) { Class annotation_type = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType()); Signedness signedness = type_map.getSignednessFromType(annotation_type); Class inverse_type = type_map.getInverseType(annotation_type); String auto_type = type_map.getAutoTypeFromAnnotation(annotation); if (inverse_type != null) { if (types.containsKey(inverse_type)) { TypeInfo inverse_type_info = types.get(inverse_type); String inverse_auto_type = inverse_type_info.getAutoType(); auto_type = signedness == Signedness.UNSIGNED ? auto_type + " : " + inverse_auto_type : inverse_auto_type + " : " + auto_type; auto_type = UNSIGNED_PARAMETER_NAME + " ? " + auto_type; signedness = Signedness.BOTH; types.remove(inverse_type); multityped_result.remove(inverse_type_info); } } Class type; PrimitiveType.Kind kind; GLvoid void_annotation = param.getAnnotation(GLvoid.class); kind = void_annotation == null ? type_map.getPrimitiveTypeFromNativeType(annotation_type) : void_annotation.value(); if (Utils.getNIOBufferType(decl_type) != null) type = getBufferTypeFromPrimitiveKind(kind); else type = getTypeFromPrimitiveKind(kind); TypeInfo type_info = new TypeInfo(type, signedness, auto_type); types.put(annotation_type, type_info); multityped_result.add(type_info); add_default_type = false; } } if (add_default_type) { TypeInfo default_type_info = getDefaultTypeInfo(decl_type); Collection result = new ArrayList(); result.add(default_type_info); return result; } else return multityped_result; } private static Map> getTypeInfoMap(TypeMap type_map, MethodDeclaration method) { Map> map = new HashMap>(); for (ParameterDeclaration param : method.getParameters()) { Collection types = getTypeInfos(type_map, param, param.getType()); map.put(param, types); } return map; } public static Collection> getTypeInfoCrossProduct(TypeMap type_map, MethodDeclaration method) { Collection parameter_collection = method.getParameters(); ParameterDeclaration[] parameters = new ParameterDeclaration[parameter_collection.size()]; parameter_collection.toArray(parameters); Collection> cross_product = new ArrayList>(); getCrossProductRecursive(0, parameters, getTypeInfoMap(type_map, method), new HashMap(), cross_product); return cross_product; } private static void getCrossProductRecursive(int index, ParameterDeclaration[] parameters, Map> typeinfos_map, Map current_instance, Collection> cross_product) { if (index == parameters.length) { cross_product.add(current_instance); return; } ParameterDeclaration param = parameters[index]; Collection typeinfos = typeinfos_map.get(param); if (typeinfos != null) { for (TypeInfo typeinfo : typeinfos) { Map instance = new HashMap(current_instance); instance.put(param, typeinfo); getCrossProductRecursive(index + 1, parameters, typeinfos_map, instance, cross_product); } } } } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/GeneratorVisitor.java0000644000175000017500000003625711543426510024470 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; import com.sun.mirror.apt.*; import com.sun.mirror.declaration.*; import com.sun.mirror.type.*; import com.sun.mirror.util.*; import java.io.*; import java.lang.annotation.Annotation; import java.nio.channels.FileChannel; import java.util.*; import java.nio.*; /** * * Generator visitor for the generator tool * * @author elias_naur * @version $Revision: 3430 $ * $Id: GeneratorVisitor.java 3430 2010-10-04 17:04:46Z spasi $ */ public class GeneratorVisitor extends SimpleDeclarationVisitor { private final AnnotationProcessorEnvironment env; private final TypeMap type_map; private final boolean generate_error_checks; private final boolean context_specific; private final long generatorLM; public GeneratorVisitor(AnnotationProcessorEnvironment env, TypeMap type_map, boolean generate_error_checks, boolean context_specific, long generatorLM) { this.env = env; this.type_map = type_map; this.generate_error_checks = generate_error_checks; this.context_specific = context_specific; this.generatorLM = generatorLM; } private void validateMethod(MethodDeclaration method) { if (method.isVarArgs()) throw new RuntimeException("Method " + method.getSimpleName() + " is variadic"); Collection modifiers = method.getModifiers(); if (!modifiers.contains(Modifier.PUBLIC)) throw new RuntimeException("Method " + method.getSimpleName() + " is not public"); if (method.getThrownTypes().size() > 0) throw new RuntimeException("Method " + method.getSimpleName() + " throws checked exceptions"); validateParameters(method); StripPostfix strip_annotation = method.getAnnotation(StripPostfix.class); if (strip_annotation != null && method.getAnnotation(Alternate.class) == null) { String postfix_param_name = strip_annotation.value(); ParameterDeclaration postfix_param = Utils.findParameter(method, postfix_param_name); if (Utils.isParameterMultiTyped(postfix_param)) throw new RuntimeException("Postfix parameter can't be the same as a multityped parameter in method " + method); if (Utils.getNIOBufferType(postfix_param.getType()) == null) throw new RuntimeException("Postfix parameter type must be a nio Buffer"); } if (Utils.getResultParameter(method) != null && !method.getReturnType().equals(env.getTypeUtils().getVoidType())) throw new RuntimeException(method + " return type is not void but a parameter is annotated with Result"); if (method.getAnnotation(CachedResult.class) != null) { if (Utils.getNIOBufferType(Utils.getMethodReturnType(method)) == null) throw new RuntimeException(method + " return type is not a Buffer, but is annotated with CachedResult"); if (method.getAnnotation(AutoSize.class) == null) throw new RuntimeException(method + " is annotated with CachedResult but misses an AutoSize annotation"); } validateTypes(method, method.getAnnotationMirrors(), method.getReturnType()); } private void validateType(MethodDeclaration method, Class annotation_type, Class type) { Class[] valid_types = type_map.getValidAnnotationTypes(type); for ( Class valid_type : valid_types ) if ( valid_type.equals(annotation_type) ) return; throw new RuntimeException(type + " is annotated with invalid native type " + annotation_type + " in method " + method); } private void validateTypes(MethodDeclaration method, Collection annotations, TypeMirror type_mirror) { for (AnnotationMirror annotation : annotations) { NativeType native_type_annotation = NativeTypeTranslator.getAnnotation(annotation, NativeType.class); if (native_type_annotation != null) { Class annotation_type = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType()); Class type = Utils.getJavaType(type_mirror); if (Buffer.class.equals(type)) continue; validateType(method, annotation_type, type); } } } private void validateParameters(MethodDeclaration method) { for (ParameterDeclaration param : method.getParameters()) { validateTypes(method, param.getAnnotationMirrors(), param.getType()); Class param_type = Utils.getJavaType(param.getType()); if (Utils.getNIOBufferType(param.getType()) != null && param_type != CharSequence.class && param_type != CharSequence[].class) { Check parameter_check_annotation = param.getAnnotation(Check.class); NullTerminated null_terminated_annotation = param.getAnnotation(NullTerminated.class); if (parameter_check_annotation == null && null_terminated_annotation == null) { boolean found_auto_size_param = false; for (ParameterDeclaration inner_param : method.getParameters()) { AutoSize auto_size_annotation = inner_param.getAnnotation(AutoSize.class); if (auto_size_annotation != null && auto_size_annotation.value().equals(param.getSimpleName())) { found_auto_size_param = true; break; } } if (!found_auto_size_param && param.getAnnotation(Result.class) == null && param.getAnnotation(Constant.class) == null && !Utils.isReturnParameter(method, param) ) throw new RuntimeException(param + " has no Check, Result nor Constant annotation, is not the return parameter and no other parameter has" + " an @AutoSize annotation on it in method " + method); } if (param.getAnnotation(CachedReference.class) != null && param.getAnnotation(Result.class) != null) throw new RuntimeException(param + " can't be annotated with both CachedReference and Result"); if (param.getAnnotation(BufferObject.class) != null && param.getAnnotation(Result.class) != null) throw new RuntimeException(param + " can't be annotated with both BufferObject and Result"); //if (param.getAnnotation(Constant.class) != null) //throw new RuntimeException("Buffer parameter " + param + " cannot be Constant"); } else { if (param.getAnnotation(BufferObject.class) != null) throw new RuntimeException(param + " type is not a buffer, but annotated as a BufferObject"); if (param.getAnnotation(CachedReference.class) != null) throw new RuntimeException(param + " type is not a buffer, but annotated as a CachedReference"); } } } private static void generateMethodsNativePointers(PrintWriter writer, Collection methods) { for (MethodDeclaration method : methods) { if ( method.getAnnotation(Alternate.class) == null ) generateMethodNativePointers(writer, method); } } private static void generateMethodNativePointers(PrintWriter writer, MethodDeclaration method) { if ( method.getAnnotation(Extern.class) == null ) writer.print("static "); writer.println(Utils.getTypedefName(method) + " " + method.getSimpleName() + ";"); } private void generateJavaSource(InterfaceDeclaration d, PrintWriter java_writer) throws IOException { java_writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */"); java_writer.println(); java_writer.println("package " + d.getPackage().getQualifiedName() + ";"); java_writer.println(); java_writer.println("import org.lwjgl.*;"); java_writer.println("import java.nio.*;"); Imports imports = d.getAnnotation(Imports.class); if ( imports != null ) { for ( String i : imports.value() ) java_writer.println("import " + i + ";"); } java_writer.println(); Utils.printDocComment(java_writer, d); if ( d.getAnnotation(Private.class) == null ) java_writer.print("public "); boolean is_final = Utils.isFinal(d); if (is_final) java_writer.write("final "); java_writer.print("class " + Utils.getSimpleClassName(d)); Collection super_interfaces = d.getSuperinterfaces(); if (super_interfaces.size() > 1) throw new RuntimeException(d + " extends more than one interface"); if (super_interfaces.size() == 1) { InterfaceDeclaration super_interface = super_interfaces.iterator().next().getDeclaration(); java_writer.print(" extends " + Utils.getSimpleClassName(super_interface)); } java_writer.println(" {"); FieldsGenerator.generateFields(java_writer, d.getFields()); java_writer.println(); if (is_final) { // Write private constructor to avoid instantiation java_writer.println("\tprivate " + Utils.getSimpleClassName(d) + "() {}"); } if (d.getMethods().size() > 0 && !context_specific) { java_writer.println(); java_writer.println("\tstatic native void " + Utils.STUB_INITIALIZER_NAME + "() throws LWJGLException;"); } JavaMethodsGenerator.generateMethodsJava(env, type_map, java_writer, d, generate_error_checks, context_specific); java_writer.println("}"); java_writer.close(); String qualified_interface_name = Utils.getQualifiedClassName(d); env.getMessager().printNotice("Generated class " + qualified_interface_name); } private void generateNativeSource(InterfaceDeclaration d) throws IOException { String qualified_interface_name = Utils.getQualifiedClassName(d); String qualified_native_name = Utils.getNativeQualifiedName(qualified_interface_name)+ ".c"; PrintWriter native_writer = env.getFiler().createTextFile(Filer.Location.CLASS_TREE, "", new File(qualified_native_name), "UTF-8"); native_writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */"); native_writer.println(); native_writer.println("#include "); type_map.printNativeIncludes(native_writer); native_writer.println(); TypedefsGenerator.generateNativeTypedefs(type_map, native_writer, d.getMethods()); native_writer.println(); if (!context_specific) { generateMethodsNativePointers(native_writer, d.getMethods()); native_writer.println(); } NativeMethodStubsGenerator.generateNativeMethodStubs(env, type_map, native_writer, d, generate_error_checks, context_specific); if (!context_specific) { native_writer.print("JNIEXPORT void JNICALL " + Utils.getQualifiedNativeMethodName(qualified_interface_name, Utils.STUB_INITIALIZER_NAME)); native_writer.println("(JNIEnv *env, jclass clazz) {"); native_writer.println("\tJavaMethodAndExtFunction functions[] = {"); RegisterStubsGenerator.generateMethodsNativeStubBind(native_writer, d, generate_error_checks, context_specific); native_writer.println("\t};"); native_writer.println("\tint num_functions = NUMFUNCTIONS(functions);"); native_writer.print("\t"); native_writer.print(type_map.getRegisterNativesFunctionName()); native_writer.println("(env, clazz, num_functions, functions);"); native_writer.println("}"); } native_writer.close(); env.getMessager().printNotice("Generated C source " + qualified_interface_name); } public void visitInterfaceDeclaration(InterfaceDeclaration d) { final File input = d.getPosition().file(); final File outputJava = new File(env.getOptions().get("-s") + '/' + d.getPackage().getQualifiedName().replace('.', '/'), Utils.getSimpleClassName(d) + ".java"); PrintWriter java_writer = null; try { final Collection methods = d.getMethods(); if ( methods.size() == 0 && d.getFields().size() == 0 ) return; // Skip this class if the output exists and the input has not been modified. if ( outputJava.exists() && Math.max(input.lastModified(), generatorLM) < outputJava.lastModified() ) return; for ( final MethodDeclaration method : methods ) validateMethod(method); java_writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, d.getPackage().getQualifiedName(), new File(Utils.getSimpleClassName(d) + ".java"), null); generateJavaSource(d, java_writer); if ( methods.size() > 0 ) { boolean hasNative = false; for ( final MethodDeclaration method : methods ) { Alternate alt_annotation = method.getAnnotation(Alternate.class); if ( (alt_annotation == null || alt_annotation.nativeAlt()) && method.getAnnotation(Reuse.class) == null ) { hasNative = true; break; } } if ( !hasNative ) return; final String outputPath = env.getOptions().get("-d") + '/' + Utils.getNativeQualifiedName(Utils.getQualifiedClassName(d)); final File outputNative = new File(outputPath + ".c"); final File outputBackup = new File(outputPath + "_backup.c"); // If the native file exists, rename. final ByteBuffer nativeBefore; if ( outputNative.exists() ) { nativeBefore = readFile(outputNative); outputNative.renameTo(outputBackup); } else nativeBefore = null; try { generateNativeSource(d); // If the native file did exist, compare with the new file. If they're the same, // reset the last modified time to avoid ridiculous C compilation times. if ( nativeBefore != null && outputNative.length() == nativeBefore.capacity() ) { final ByteBuffer nativeAfter = readFile(outputNative); boolean same = true; for ( int i = nativeBefore.position(); i < nativeBefore.limit(); i++ ) { if ( nativeBefore.get(i) != nativeAfter.get(i) ) { same = false; break; } } if ( same ) { outputNative.delete(); outputBackup.renameTo(outputNative); } } } finally { if ( outputBackup.exists() ) outputBackup.delete(); } } } catch (Exception e) { // If anything goes wrong mid-gen, delete output to allow regen next time we run. if ( java_writer != null ) java_writer.close(); if ( outputJava.exists() ) outputJava.delete(); throw new RuntimeException(e); } } private static ByteBuffer readFile(final File file) throws IOException { final FileChannel channel = new FileInputStream(file).getChannel(); final long bytesTotal = channel.size(); final ByteBuffer buffer = ByteBuffer.allocateDirect((int)bytesTotal); long bytesRead = 0; do { bytesRead += channel.read(buffer); } while ( bytesRead < bytesTotal ); buffer.flip(); channel.close(); return buffer; } } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/NoErrorCheck.java0000644000175000017500000000373211543426510023476 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * This annotation implies that a method should not include * error checking even if it is enabled. * * @author elias_naur * @version $Revision: 2983 $ * $Id: NoErrorCheck.java 2983 2008-04-07 18:36:09Z matzon $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target(ElementType.METHOD) public @interface NoErrorCheck { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java0000644000175000017500000004632311543426510026434 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * This class generates the functions in the native source files. * * @author elias_naur * @version $Revision: 3418 $ * $Id: NativeMethodStubsGenerator.java 3418 2010-09-28 21:11:35Z spasi $ */ import org.lwjgl.PointerBuffer; import com.sun.mirror.apt.*; import com.sun.mirror.declaration.*; import com.sun.mirror.type.*; import java.io.*; import java.util.*; import java.nio.*; public class NativeMethodStubsGenerator { private static final String BUFFER_ADDRESS_POSTFIX = "_address"; public static final String BUFFER_POSITION_POSTFIX = "_position"; private static final String STRING_LIST_NAME = "_str"; private static final String POINTER_LIST_NAME = "_ptr"; public static void generateNativeMethodStubs(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration d, boolean generate_error_checks, boolean context_specific) { for (MethodDeclaration method : d.getMethods()) { Alternate alt_annotation = method.getAnnotation(Alternate.class); if ( (alt_annotation != null && (!alt_annotation.nativeAlt() || alt_annotation.skipNative())) || method.getAnnotation(Reuse.class) != null ) continue; generateMethodStub(env, type_map, writer, Utils.getQualifiedClassName(d), method, Mode.NORMAL, generate_error_checks, context_specific); if (Utils.hasMethodBufferObjectParameter(method)) generateMethodStub(env, type_map, writer, Utils.getQualifiedClassName(d), method, Mode.BUFFEROBJECT, generate_error_checks, context_specific); } } private static void generateParameters(PrintWriter writer, Collection params, Mode mode) { for (ParameterDeclaration param : params) { if ( param.getAnnotation(Result.class) != null || (param.getAnnotation(Helper.class) != null && !param.getAnnotation(Helper.class).passToNative()) ) continue; final Constant constant_annotation = param.getAnnotation(Constant.class); if ( constant_annotation == null || !constant_annotation.isNative() ) generateParameter(writer, param, mode); } } private static void generateParameter(PrintWriter writer, ParameterDeclaration param, Mode mode) { writer.print(", "); if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null) { writer.print("jlong " + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX); } else if ( param.getAnnotation(PointerWrapper.class) != null ) { writer.print("jlong " + param.getSimpleName()); } else { JNITypeTranslator translator = new JNITypeTranslator(); param.getType().accept(translator); writer.print(translator.getSignature() + " " + param.getSimpleName()); if (Utils.getNIOBufferType(param.getType()) != null) writer.print(", jint " + param.getSimpleName() + BUFFER_POSITION_POSTFIX); } } private static void generateMethodStub(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, String interface_name, MethodDeclaration method, Mode mode, boolean generate_error_checks, boolean context_specific) { if ( !context_specific && method.getAnnotation(Alternate.class) == null ) writer.print("static "); else writer.print("JNIEXPORT "); final TypeMirror result_type = Utils.getMethodReturnType(method); final CachedResult cached_result_annotation = method.getAnnotation(CachedResult.class); final AutoSize auto_size_annotation = method.getAnnotation(AutoSize.class); if ( method.getAnnotation(PointerWrapper.class) != null ) { writer.print("jlong"); } else { JNITypeTranslator translator = new JNITypeTranslator(); result_type.accept(translator); writer.print(translator.getSignature()); } writer.print(" JNICALL "); writer.print(Utils.getQualifiedNativeMethodName(interface_name, method, generate_error_checks, context_specific)); if (mode == Mode.BUFFEROBJECT) writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX); writer.print("(JNIEnv *env, jclass clazz"); generateParameters(writer, method.getParameters(), mode); if (Utils.getNIOBufferType(result_type) != null) { if ( (cached_result_annotation == null || !cached_result_annotation.isRange()) && (auto_size_annotation == null || !auto_size_annotation.isNative()) ) writer.print(", jlong " + Utils.RESULT_SIZE_NAME); if (cached_result_annotation != null) writer.print(", jobject " + Utils.CACHED_BUFFER_NAME); } if (context_specific) { writer.print(", jlong " + Utils.FUNCTION_POINTER_VAR_NAME); } writer.println(") {"); generateBufferParameterAddresses(type_map, writer, method, mode); Alternate alt_annotation = method.getAnnotation(Alternate.class); if (context_specific) { String typedef_name = Utils.getTypedefName(method); writer.print("\t" + typedef_name + " " + (alt_annotation == null ? method.getSimpleName() : alt_annotation.value())); writer.print(" = (" + typedef_name + ")((intptr_t)"); writer.println(Utils.FUNCTION_POINTER_VAR_NAME + ");"); } final Code code_annotation = method.getAnnotation(Code.class); final boolean hasResult = !result_type.equals(env.getTypeUtils().getVoidType()); final boolean resultPreDeclare = hasResult && (hasPointerArrayInits(method.getParameters()) || (code_annotation != null && (code_annotation.nativeAfterVars().length() > 0 || code_annotation.nativeBeforeCall().length() > 0))); if ( resultPreDeclare ) printResultParam(type_map, writer, method, result_type, true); if ( code_annotation != null && code_annotation.nativeAfterVars().length() > 0 ) writer.println(code_annotation.nativeAfterVars()); generatePointerArrayInits(type_map, writer, method.getParameters()); if ( code_annotation != null && code_annotation.nativeBeforeCall().length() > 0 ) writer.println(code_annotation.nativeBeforeCall()); writer.print("\t"); if ( resultPreDeclare ) writer.print(Utils.RESULT_VAR_NAME + " = "); else if ( hasResult ) printResultParam(type_map, writer, method, result_type, false); writer.print((alt_annotation == null ? method.getSimpleName() : alt_annotation.value()) + "("); generateCallParameters(writer, type_map, method.getParameters()); writer.print(")"); writer.println(";"); if ( code_annotation != null && code_annotation.nativeAfterCall().length() > 0 ) writer.println(code_annotation.nativeAfterCall()); generateStringDeallocations(writer, method.getParameters()); if (!result_type.equals(env.getTypeUtils().getVoidType())) { writer.print("\treturn "); Class java_result_type = Utils.getJavaType(result_type); if (Buffer.class.isAssignableFrom(java_result_type)) { if (cached_result_annotation != null) writer.print("safeNewBufferCached(env, "); else writer.print("safeNewBuffer(env, "); } else if (String.class.equals(java_result_type)) { writer.print("NewStringNativeUnsigned(env, "); } else if ( method.getAnnotation(PointerWrapper.class) != null ) { writer.print("(intptr_t)"); } writer.print(Utils.RESULT_VAR_NAME); if (Buffer.class.isAssignableFrom(java_result_type)) { final String size_parameter_name; if ( auto_size_annotation != null && (auto_size_annotation.isNative() || (cached_result_annotation != null && cached_result_annotation.isRange())) ) size_parameter_name = auto_size_annotation.value(); else size_parameter_name = Utils.RESULT_SIZE_NAME; writer.print(", "); Utils.printExtraCallArguments(writer, method, size_parameter_name); } if (Buffer.class.isAssignableFrom(java_result_type) || String.class.equals(java_result_type)) writer.print(")"); writer.println(";"); } writer.println("}"); writer.println(); } private static void printResultParam(final TypeMap type_map, final PrintWriter writer, final MethodDeclaration method, final TypeMirror result_type, final boolean preDeclare) { final ParameterDeclaration result_param = Utils.getResultParameter(method); final Declaration return_declaration = result_param == null ? method : result_param; final NativeTypeTranslator result_translator = new NativeTypeTranslator(type_map, return_declaration); result_type.accept(result_translator); if ( preDeclare ) writer.print("\t"); writer.print(result_translator.getSignature() + " " + Utils.RESULT_VAR_NAME); if ( preDeclare) writer.println(";"); else writer.print(result_param == null ? " = " : ";\n\t"); } private static void generateCallParameters(PrintWriter writer, TypeMap type_map, Collection params) { if (params.size() > 0) { boolean first = true; for ( ParameterDeclaration param : params ) { if ( param.getAnnotation(Helper.class) != null ) continue; if ( first ) first = false; else writer.print(", "); generateCallParameter(writer, type_map, param); } } } private static void generateCallParameter(PrintWriter writer, TypeMap type_map, ParameterDeclaration param) { if ( param.getAnnotation(Helper.class) != null ) return; final Constant constant_annotation = param.getAnnotation(Constant.class); if ( constant_annotation != null && constant_annotation.isNative() ) { writer.print(constant_annotation.value()); return; } boolean is_indirect = param.getAnnotation(Indirect.class) != null; if (is_indirect || param.getAnnotation(PointerArray.class) != null) { writer.print("("); final NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param); param.getType().accept(translator); writer.print(translator.getSignature()); writer.print("*)"); } if ( param.getAnnotation(PointerWrapper.class) != null ) writer.print("(" + param.getAnnotation(PointerWrapper.class).value() + ")(intptr_t)"); if (param.getAnnotation(Result.class) != null || is_indirect) writer.print("&"); if ( param.getAnnotation(Result.class) != null ) { writer.print(Utils.RESULT_VAR_NAME); } else { writer.print(param.getSimpleName()); if ( param.getAnnotation(PointerArray.class) != null ) writer.print(getPointerArrayName(Utils.getJavaType(param.getType()))); else if ( Utils.isAddressableType(param.getType()) ) writer.print(BUFFER_ADDRESS_POSTFIX); } } private static void generateStringDeallocations(PrintWriter writer, Collection params) { for (ParameterDeclaration param : params) { final Class java_type = Utils.getJavaType(param.getType()); if ( java_type.equals(String.class) && param.getAnnotation(Result.class) == null ) writer.println("\tfree(" + param.getSimpleName() + BUFFER_ADDRESS_POSTFIX + ");"); else if (param.getAnnotation(PointerArray.class) != null ) // Free the string array mem writer.println("\tfree(" + param.getSimpleName() + getPointerArrayName(java_type) + ");"); } } private static void generateBufferParameterAddresses(TypeMap type_map, PrintWriter writer, MethodDeclaration method, Mode mode) { strLoopDeclared = false; ptrLoopDeclared = false; for ( ParameterDeclaration param : method.getParameters() ) { final Constant constant_annotation = param.getAnnotation(Constant.class); if ( param.getAnnotation(Result.class) == null && (constant_annotation == null || !constant_annotation.isNative()) && Utils.isAddressableType(param.getType())) generateBufferParameterAddress(type_map, writer, method, param, mode); } } private static boolean strLoopDeclared; private static boolean ptrLoopDeclared; private static void generateBufferParameterAddress(TypeMap type_map, PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Mode mode) { final Check check_annotation = param.getAnnotation(Check.class); final PointerArray array_annotation = param.getAnnotation(PointerArray.class); final Class java_type = Utils.getJavaType(param.getType()); final NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param); param.getType().accept(translator); final String native_type = translator.getSignature(); if ( !java_type.isArray() || CharSequence.class.isAssignableFrom(java_type.getComponentType()) ) { writer.print("\t" + native_type + param.getSimpleName()); writer.print(BUFFER_ADDRESS_POSTFIX + " = (("); writer.print(native_type); writer.print(")"); if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null) { writer.print("offsetToPointer(" + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX + "))"); } else { if (Buffer.class.isAssignableFrom(java_type) || java_type.equals(CharSequence.class) || java_type.equals(CharSequence[].class) || PointerBuffer.class.isAssignableFrom(java_type) ) { boolean explicitly_byte_sized = java_type.equals(Buffer.class) || translator.getAnnotationType().equals(type_map.getVoidType()) || param.getAnnotation(NativeType.class) != null; if (explicitly_byte_sized) writer.print("(((char *)"); if (method.getAnnotation(GenerateAutos.class) != null || (check_annotation != null && check_annotation.canBeNull())) { writer.print("safeGetBufferAddress(env, " + param.getSimpleName()); } else { writer.print("(*env)->GetDirectBufferAddress(env, " + param.getSimpleName()); } writer.print("))"); writer.print(" + " + param.getSimpleName() + BUFFER_POSITION_POSTFIX); if (explicitly_byte_sized) writer.print("))"); } else if (java_type.equals(String.class)) { writer.print("GetStringNativeChars(env, " + param.getSimpleName() + "))"); } else if ( array_annotation == null ) throw new RuntimeException("Illegal type " + java_type); } writer.println(";"); } if ( array_annotation != null ) { final String n = getPointerArrayName(java_type); final String arrayType; if ( POINTER_LIST_NAME.equals(n) ) { if ( n.equals(param.getSimpleName()) ) throw new RuntimeException("The name '" + n + "' is not valid for object array arguments annotated with PointerArray"); arrayType = translator.getSignature(true) + (org.lwjgl.PointerWrapper.class.isAssignableFrom(java_type.getComponentType()) ? " " : ""); // Declare loop counters and allocate object array if ( !ptrLoopDeclared ) { writer.println("\tunsigned int " + n + "_i;"); writer.println("\tjobject " + n + "_object;"); ptrLoopDeclared = true; } } else { if ( n.equals(param.getSimpleName()) ) throw new RuntimeException("The name '" + n + "' is not valid for arguments annotated with PointerArray"); arrayType = translator.getSignature(true); // Declare loop counters and allocate string array if ( !strLoopDeclared ) { writer.println("\tunsigned int " + n + "_i;"); writer.println("\t" + arrayType + n + "_address;"); strLoopDeclared = true; } } writer.print("\t" + arrayType + "*" + param.getSimpleName() + n + " = "); if ( check_annotation != null && check_annotation.canBeNull() ) writer.print(array_annotation.value() + " == 0 ? NULL : "); writer.println("(" + arrayType + "*) malloc(" + array_annotation.value() + " * sizeof(" + arrayType + "));"); } } private static String getPointerArrayName(final Class java_type) { final Class component_type = java_type.getComponentType(); if ( component_type != null && (Buffer.class.isAssignableFrom(component_type) || org.lwjgl.PointerWrapper.class.isAssignableFrom(component_type)) ) return POINTER_LIST_NAME; else return STRING_LIST_NAME; } private static boolean hasPointerArrayInits(Collection params) { for ( ParameterDeclaration param : params ) { PointerArray pointerArray_annotation = param.getAnnotation(PointerArray.class); if ( pointerArray_annotation != null ) return true; } return false; } private static void generatePointerArrayInits(TypeMap type_map, PrintWriter writer, Collection params) { for ( ParameterDeclaration param : params ) { PointerArray pointerArray_annotation = param.getAnnotation(PointerArray.class); if ( pointerArray_annotation != null ) { final Class java_type = Utils.getJavaType(param.getType()); final Class component_type = java_type.isArray() ? java_type.getComponentType() : null; final NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param); param.getType().accept(translator); final String n = getPointerArrayName(java_type); if ( POINTER_LIST_NAME.equals(n) ) { // Init vars writer.println("\t" + n + "_i = 0;"); // Fill pointer array with the buffer pointers writer.println("\twhile ( " + n + "_i < " + pointerArray_annotation.value() + " ) {"); if ( component_type.isAssignableFrom(Buffer.class) ) writer.println("\t\t" + n + "_object = (*env)->GetObjectArrayElement(env, " + param.getSimpleName() + ", " + n + "_i);"); else writer.println("\t\t" + n + "_object = (*env)->GetObjectArrayElement(env, " + param.getSimpleName() + ", " + n + "_i);"); writer.println("\t\t" + param.getSimpleName() + n + "[" + n + "_i++] = (" + translator.getSignature(true) + ")(intptr_t)getPointerWrapperAddress(env, " + n + "_object);"); writer.println("\t}"); } else { final String lengths = pointerArray_annotation.lengths(); // Init vars writer.println("\t" + n + "_i = 0;"); writer.println("\t" + n + "_address = (" + translator.getSignature(true) + ")" + param.getSimpleName() + BUFFER_ADDRESS_POSTFIX + ";"); // Fill string array with the string pointers writer.println("\twhile ( " + n + "_i < " + pointerArray_annotation.value() + " ) {"); if ( lengths.length() == 0 ) { writer.println("\t\t" + param.getSimpleName() + n + "[" + n + "_i++] = " + n + "_address;"); writer.println("\t\t" + n + "_address += strlen(" + n + "_address) + 1;"); } else { writer.println("\t\t" + param.getSimpleName() + n + "[" + n + "_i] = " + n + "_address;"); writer.println("\t\t" + n + "_address += " + lengths + BUFFER_ADDRESS_POSTFIX + "[" + n + "_i++];"); } writer.println("\t}"); } } } } } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Extern.java0000644000175000017500000000361311543426510022415 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; import java.lang.annotation.ElementType; import java.lang.annotation.Target; /** * Functions marked with @Extern will not be declared as static in the C implementation. * This allows other source files to call them. * * @author Spasi */ @Target(ElementType.METHOD) public @interface Extern { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Check.java0000644000175000017500000000367411543426510022174 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * @author elias_naur * @version $Revision: 3412 $ * $Id: Check.java 3412 2010-09-26 23:43:24Z spasi $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface Check { String value() default ""; boolean canBeNull() default false; } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Utils.java0000644000175000017500000004454711543426510022263 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * Various utility methods to the generator. * * @author elias_naur * @version $Revision: 3443 $ * $Id: Utils.java 3443 2010-10-12 21:13:03Z spasi $ */ import org.lwjgl.PointerBuffer; import org.lwjgl.util.generator.opengl.GLboolean; import org.lwjgl.util.generator.opengl.GLchar; import org.lwjgl.util.generator.opengl.GLcharARB; import org.lwjgl.util.generator.opengl.GLreturn; import java.io.PrintWriter; import java.nio.Buffer; import java.nio.ByteBuffer; import java.util.*; import com.sun.mirror.declaration.*; import com.sun.mirror.type.PrimitiveType; import com.sun.mirror.type.TypeMirror; public class Utils { public static final String TYPEDEF_POSTFIX = "PROC"; public static final String FUNCTION_POINTER_VAR_NAME = "function_pointer"; public static final String FUNCTION_POINTER_POSTFIX = "_pointer"; public static final String CHECKS_CLASS_NAME = "GLChecks"; public static final String CONTEXT_CAPS_CLASS_NAME = "ContextCapabilities"; public static final String STUB_INITIALIZER_NAME = "initNativeStubs"; public static final String BUFFER_OBJECT_METHOD_POSTFIX = "BO"; public static final String BUFFER_OBJECT_PARAMETER_POSTFIX = "_buffer_offset"; public static final String RESULT_SIZE_NAME = "result_size"; public static final String RESULT_VAR_NAME = "__result"; public static final String CACHED_BUFFER_LENGTH_NAME = "length"; public static final String CACHED_BUFFER_NAME = "old_buffer"; private static final String OVERLOADED_METHOD_PREFIX = "n"; public static String getTypedefName(MethodDeclaration method) { Alternate alt_annotation = method.getAnnotation(Alternate.class); return (alt_annotation == null ? method.getSimpleName() : alt_annotation.value()) + TYPEDEF_POSTFIX; } public static String getFunctionAddressName(InterfaceDeclaration interface_decl, MethodDeclaration method) { return getFunctionAddressName(interface_decl, method, false); } public static String getFunctionAddressName(InterfaceDeclaration interface_decl, MethodDeclaration method, boolean forceAlt) { final Alternate alt_annotation = method.getAnnotation(Alternate.class); /* Removed prefix so that we can identify reusable entry points, removed postfix because it's not needed and looks nicer. String interfaceName = interface_decl.getSimpleName(); // If we add this back, we need to fix @Reuse (add a param for the template name) if ( alt_annotation == null || (alt_annotation.nativeAlt() && !forceAlt) ) return interfaceName + "_" + method.getSimpleName() + FUNCTION_POINTER_POSTFIX; else return interfaceName + "_" + alt_annotation.value() + FUNCTION_POINTER_POSTFIX; */ if ( alt_annotation == null || (alt_annotation.nativeAlt() && !forceAlt) ) return method.getSimpleName(); else return alt_annotation.value(); } public static boolean isFinal(InterfaceDeclaration d) { Extension extension_annotation = d.getAnnotation(Extension.class); return extension_annotation == null || extension_annotation.isFinal(); } private static class AnnotationMirrorComparator implements Comparator { public int compare(AnnotationMirror a1, AnnotationMirror a2) { String n1 = a1.getAnnotationType().getDeclaration().getQualifiedName(); String n2 = a2.getAnnotationType().getDeclaration().getQualifiedName(); int result = n1.compareTo(n2); return result; } public boolean equals(AnnotationMirror a1, AnnotationMirror a2) { return compare(a1, a2) == 0; } } public static Collection getSortedAnnotations(Collection annotations) { List annotation_list = new ArrayList(annotations); Collections.sort(annotation_list, new AnnotationMirrorComparator()); return annotation_list; } public static String getReferenceName(InterfaceDeclaration interface_decl, MethodDeclaration method, ParameterDeclaration param) { return interface_decl.getSimpleName() + "_" + method.getSimpleName() + "_" + param.getSimpleName(); } public static boolean isAddressableType(TypeMirror type) { return isAddressableType(getJavaType(type)); } public static boolean isAddressableType(Class type) { if ( type.isArray() ) { final Class component_type = type.getComponentType(); return isAddressableTypeImpl(component_type) || org.lwjgl.PointerWrapper.class.isAssignableFrom(component_type); } return isAddressableTypeImpl(type); } private static boolean isAddressableTypeImpl(Class type) { return Buffer.class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) || CharSequence.class.isAssignableFrom(type); } public static Class getJavaType(TypeMirror type_mirror) { JavaTypeTranslator translator = new JavaTypeTranslator(); type_mirror.accept(translator); return translator.getType(); } private static boolean hasParameterMultipleTypes(ParameterDeclaration param) { int num_native_annotations = 0; for (AnnotationMirror annotation : param.getAnnotationMirrors()) if (NativeTypeTranslator.getAnnotation(annotation, NativeType.class) != null) num_native_annotations++; return num_native_annotations > 1; } public static boolean isParameterMultiTyped(ParameterDeclaration param) { boolean result = Buffer.class.equals(Utils.getJavaType(param.getType())); if (!result && hasParameterMultipleTypes(param)) throw new RuntimeException(param + " not defined as java.nio.Buffer but has multiple types"); return result; } public static ParameterDeclaration findParameter(MethodDeclaration method, String name) { for (ParameterDeclaration param : method.getParameters()) if (param.getSimpleName().equals(name)) return param; throw new RuntimeException("Parameter " + name + " not found"); } public static void printDocComment(PrintWriter writer, Declaration decl) { final String overloadsComment; if ( (decl instanceof MethodDeclaration) && decl.getAnnotation(Alternate.class) != null ) overloadsComment = "Overloads " + decl.getAnnotation(Alternate.class).value() + "."; else overloadsComment = null; String doc_comment = decl.getDocComment(); if (doc_comment != null) { final String tab = decl instanceof InterfaceDeclaration ? "" : "\t"; writer.println(tab + "/**"); if ( overloadsComment != null ) { writer.println("\t * " + overloadsComment); writer.println("\t *

      "); } final StringTokenizer doc_lines = new StringTokenizer(doc_comment, "\n", true); boolean lastWasNL = false; while (doc_lines.hasMoreTokens()) { final String t = doc_lines.nextToken(); if ( "\n".equals(t) ) { if ( lastWasNL ) writer.println(tab + " *

      "); lastWasNL = true; } else { writer.println(tab + " * " + t); lastWasNL = false; } } writer.println(tab + " */"); } else if ( overloadsComment != null ) writer.println("\t/** " + overloadsComment + " */"); } public static AnnotationMirror getParameterAutoAnnotation(ParameterDeclaration param) { for (AnnotationMirror annotation : param.getAnnotationMirrors()) if (NativeTypeTranslator.getAnnotation(annotation, Auto.class) != null) return annotation; return null; } // DISABLED: We always generate indirect methods. (affects OpenAL only at the time of this change) public static boolean isMethodIndirect(boolean generate_error_checks, boolean context_specific, MethodDeclaration method) { /* for (ParameterDeclaration param : method.getParameters()) { if (isAddressableType(param.getType()) || getParameterAutoAnnotation(param) != null || param.getAnnotation(Constant.class) != null) return true; } return hasMethodBufferObjectParameter(method) || method.getAnnotation(Code.class) != null || method.getAnnotation(CachedResult.class) != null || (generate_error_checks && method.getAnnotation(NoErrorCheck.class) == null) || context_specific; */ return true; } public static String getNativeQualifiedName(String qualified_name) { return qualified_name.replaceAll("\\.", "_"); } public static String getQualifiedNativeMethodName(String qualified_class_name, String method_name) { return "Java_" + getNativeQualifiedName(qualified_class_name) + "_" + method_name; } public static String getQualifiedNativeMethodName(String qualified_class_name, MethodDeclaration method, boolean generate_error_checks, boolean context_specific) { String method_name = getSimpleNativeMethodName(method, generate_error_checks, context_specific); return getQualifiedNativeMethodName(qualified_class_name, method_name); } public static ParameterDeclaration getResultParameter(MethodDeclaration method) { ParameterDeclaration result_param = null; for (ParameterDeclaration param : method.getParameters()) { if (param.getAnnotation(Result.class) != null) { if (result_param != null) throw new RuntimeException("Multiple parameters annotated with Result in method " + method); result_param = param; } } return result_param; } public static TypeMirror getMethodReturnType(MethodDeclaration method) { TypeMirror result_type; ParameterDeclaration result_param = getResultParameter(method); if (result_param != null) { result_type = result_param.getType(); } else result_type = method.getReturnType(); return result_type; } public static String getMethodReturnType(MethodDeclaration method, GLreturn return_annotation, boolean buffer) { ParameterDeclaration return_param = null; for ( ParameterDeclaration param : method.getParameters() ) { if ( param.getSimpleName().equals(return_annotation.value()) ) { return_param = param; break; } } if ( return_param == null ) throw new RuntimeException("The @GLreturn parameter \"" + return_annotation.value() + "\" could not be found in method: " + method); PrimitiveType.Kind kind = NativeTypeTranslator.getPrimitiveKindFromBufferClass(Utils.getJavaType(return_param.getType())); if ( return_param.getAnnotation(GLboolean.class) != null ) kind = PrimitiveType.Kind.BOOLEAN; if ( kind == PrimitiveType.Kind.BYTE && (return_param.getAnnotation(GLchar.class) != null || return_param.getAnnotation(GLcharARB.class) != null) ) return "String"; else { final String type = JavaTypeTranslator.getPrimitiveClassFromKind(kind).getName(); return buffer ? Character.toUpperCase(type.charAt(0)) + type.substring(1) : type; } } public static boolean needResultSize(MethodDeclaration method) { return getNIOBufferType(getMethodReturnType(method)) != null && method.getAnnotation(AutoSize.class) == null; } public static void printExtraCallArguments(PrintWriter writer, MethodDeclaration method, String size_parameter_name) { writer.print(size_parameter_name); if (method.getAnnotation(CachedResult.class) != null) { writer.print(", " + CACHED_BUFFER_NAME); } } private static String getClassName(InterfaceDeclaration interface_decl, String opengl_name) { Extension extension_annotation = interface_decl.getAnnotation(Extension.class); if (extension_annotation != null && !"".equals(extension_annotation.className())) { return extension_annotation.className(); } StringBuilder result = new StringBuilder(); for (int i = 0; i < opengl_name.length(); i++) { int ch = opengl_name.codePointAt(i); if (ch == '_') { i++; result.appendCodePoint(Character.toUpperCase(opengl_name.codePointAt(i))); } else result.appendCodePoint(ch); } return result.toString(); } public static boolean hasMethodBufferObjectParameter(MethodDeclaration method) { for (ParameterDeclaration param : method.getParameters()) { if (param.getAnnotation(BufferObject.class) != null) { return true; } } return false; } public static String getQualifiedClassName(InterfaceDeclaration interface_decl) { return interface_decl.getPackage().getQualifiedName() + "." + getSimpleClassName(interface_decl); } public static String getSimpleClassName(InterfaceDeclaration interface_decl) { return getClassName(interface_decl, interface_decl.getSimpleName()); } public static Class getNIOBufferType(TypeMirror t) { Class param_type = getJavaType(t); if (Buffer.class.isAssignableFrom(param_type)) return param_type; else if ( param_type == CharSequence.class || param_type == CharSequence[].class || param_type == PointerBuffer.class ) return ByteBuffer.class; else return null; } public static String getSimpleNativeMethodName(MethodDeclaration method, boolean generate_error_checks, boolean context_specific) { String method_name; Alternate alt_annotation = method.getAnnotation(Alternate.class); method_name = alt_annotation == null || alt_annotation.nativeAlt() ? method.getSimpleName() : alt_annotation.value(); if (isMethodIndirect(generate_error_checks, context_specific, method)) method_name = OVERLOADED_METHOD_PREFIX + method_name; return method_name; } static boolean isReturnParameter(MethodDeclaration method, ParameterDeclaration param) { GLreturn string_annotation = method.getAnnotation(GLreturn.class); if ( string_annotation == null || !string_annotation.value().equals(param.getSimpleName()) ) return false; if ( param.getAnnotation(OutParameter.class) == null ) throw new RuntimeException("The parameter specified in @GLreturn is not annotated with @OutParameter in method: " + method); if ( param.getAnnotation(Check.class) != null ) throw new RuntimeException("The parameter specified in @GLreturn is annotated with @Check in method: " + method); if ( param.getAnnotation(GLchar.class) != null && Utils.getJavaType(param.getType()).equals(ByteBuffer.class) && string_annotation.maxLength().length() == 0 ) throw new RuntimeException("The @GLreturn annotation is missing a maxLength parameter in method: " + method); return true; } static String getStringOffset(MethodDeclaration method, ParameterDeclaration param) { String offset = null; for ( ParameterDeclaration p : method.getParameters() ) { if ( param != null && p.getSimpleName().equals(param.getSimpleName()) ) break; final Class type = Utils.getJavaType(p.getType()); if ( type.equals(CharSequence.class) ) { if ( offset == null ) offset = p.getSimpleName() + ".length()"; else offset += " + " + p.getSimpleName() + ".length()"; if ( p.getAnnotation(NullTerminated.class) != null ) offset += " + 1"; } else if ( type.equals(CharSequence[].class) ) { if ( offset == null ) offset = "APIUtil.getTotalLength(" + p.getSimpleName() + ")"; else offset += " + APIUtil.getTotalLength(" + p.getSimpleName() + ")"; if ( p.getAnnotation(NullTerminated.class) != null ) offset += " + " + p.getSimpleName() + ".length"; } } return offset; } static void printGLReturnPre(PrintWriter writer, MethodDeclaration method, GLreturn return_annotation) { final String return_type = getMethodReturnType(method, return_annotation, true); if ( "String".equals(return_type) ) { if ( !return_annotation.forceMaxLength() ) { writer.println("IntBuffer " + return_annotation.value() + "_length = APIUtil.getLengths();"); writer.print("\t\t"); } writer.print("ByteBuffer " + return_annotation.value() + " = APIUtil.getBufferByte(" + return_annotation.maxLength()); /* Params that use the return buffer will advance its position while filling it. When we return, the position will be at the right spot for grabbing the returned string bytes. We only have to make sure that the original buffer was large enough to hold everything, so that no re-allocations happen while filling. */ final String offset = getStringOffset(method, null); if ( offset != null ) writer.print(" + " + offset); writer.println(");"); } else { final String buffer_type = "Boolean".equals(return_type) ? "Byte" : return_type; writer.print(buffer_type + "Buffer " + return_annotation.value() + " = APIUtil.getBuffer" + buffer_type + "("); if ( "Byte".equals(buffer_type) ) writer.print('1'); writer.println(");"); } final Code code_annotation = method.getAnnotation(Code.class); if ( code_annotation != null && code_annotation.tryBlock() ) { writer.println("\t\ttry {"); writer.print("\t\t\t"); } else writer.print("\t\t"); } static void printGLReturnPost(PrintWriter writer, MethodDeclaration method, GLreturn return_annotation) { final String return_type = getMethodReturnType(method, return_annotation, true); if ( "String".equals(return_type) ) { writer.print("\t\t" + return_annotation.value() + ".limit("); final String offset = getStringOffset(method, null); if ( offset != null) writer.print(offset + " + "); if ( return_annotation.forceMaxLength() ) writer.print(return_annotation.maxLength()); else writer.print(return_annotation.value() + "_length.get(0)"); writer.println(");"); writer.println("\t\treturn APIUtil.getString(" + return_annotation.value() + ");"); } else { writer.print("\t\treturn " + return_annotation.value() + ".get(0)"); if ( "Boolean".equals(return_type) ) writer.print(" == 1"); writer.println(";"); } } } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Helper.java0000644000175000017500000000365011543426510022370 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * Method parameters marked with @Helper will be considered Java-API * parameters and will be ignored when generating native stubs/code. * * @author Spasi */ import java.lang.annotation.ElementType; import java.lang.annotation.Target; @Target(ElementType.PARAMETER) public @interface Helper { boolean passToNative() default false; }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/AutoType.java0000644000175000017500000000402211543426510022715 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * Indicates that a parameter should be pre-computed according * to the type of a Buffer parameter. * * @author elias_naur * @version $Revision: 2983 $ * $Id: AutoType.java 2983 2008-04-07 18:36:09Z matzon $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Auto @Target(ElementType.PARAMETER) public @interface AutoType { String value(); // The parameter to get the type from } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Result.java0000644000175000017500000000370211543426510022425 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * This annotation indicates that the method result is in the * specified parameter. * * @author elias_naur * @version $Revision: 2983 $ * $Id: Result.java 2983 2008-04-07 18:36:09Z matzon $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target(ElementType.PARAMETER) public @interface Result { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Alternate.java0000644000175000017500000000503511543426510023067 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; import java.lang.annotation.ElementType; import java.lang.annotation.Target; /** * When a method is annonated with @Alternate, no native stub will be created and the Java method will be renamed to value(). * This can be useful when we want to provide an alternate GL call with different arguments (created by different annotations) * * @author spasi */ @Target({ ElementType.METHOD }) public @interface Alternate { /** This must match an existing GL method name. */ String value(); /** If true, an alternate Java->native call will be created. Useful when the alternate implementation uses different types. */ boolean nativeAlt() default false; /** Applicable when nativeAlt is true. If true, no extra native call will be generated. Useful when there's another nativeAlt already defined. */ boolean skipNative() default false; /** If true, the alternate method's name will be used for the Java call. */ boolean javaAlt() default false; }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Auto.java0000644000175000017500000000364011543426510022060 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * AutoType and AutoSize is annotated with @Auto. * * @author elias_naur * @version $Revision: 2983 $ * $Id: Auto.java 2983 2008-04-07 18:36:09Z matzon $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target(ElementType.ANNOTATION_TYPE) public @interface Auto { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java0000644000175000017500000001364511543426510026334 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; import java.io.File; import java.io.FileFilter; import java.util.Arrays; import java.util.Collection; import java.util.Map; import java.util.Set; import com.sun.mirror.apt.*; import com.sun.mirror.declaration.AnnotationTypeDeclaration; import com.sun.mirror.declaration.TypeDeclaration; import static com.sun.mirror.util.DeclarationVisitors.*; import static java.util.Collections.*; /** * Generator tool for creating the java classes and native code * from an annotated template java interface. * * @author elias_naur * @version $Revision: 3430 $ * $Id: GeneratorProcessorFactory.java 3430 2010-10-04 17:04:46Z spasi $ */ public class GeneratorProcessorFactory implements AnnotationProcessorFactory, RoundCompleteListener { private static boolean first_round = true; // Process any set of annotations private static final Collection supportedAnnotations = unmodifiableCollection(Arrays.asList("*")); private static final Collection supportedOptions = unmodifiableCollection(Arrays.asList("-Atypemap", "-Ageneratechecks", "-Acontextspecific")); public Collection supportedAnnotationTypes() { return supportedAnnotations; } public Collection supportedOptions() { return supportedOptions; } public void roundComplete(RoundCompleteEvent event) { first_round = false; } public AnnotationProcessor getProcessorFor(Set atds, AnnotationProcessorEnvironment env) { // Only process the initial types, not the generated ones if ( first_round ) { env.addListener(this); return new GeneratorProcessor(env); } else return AnnotationProcessors.NO_OP; } private static class GeneratorProcessor implements AnnotationProcessor { private final AnnotationProcessorEnvironment env; GeneratorProcessor(AnnotationProcessorEnvironment env) { this.env = env; } public void process() { Map options = env.getOptions(); String typemap_classname = null; boolean generate_error_checks = options.containsKey("-Ageneratechecks"); boolean context_specific = options.containsKey("-Acontextspecific"); for ( String k : options.keySet() ) { int delimiter = k.indexOf('='); if ( delimiter != -1 ) { if ( k.startsWith("-Atypemap") ) { typemap_classname = k.substring(delimiter + 1); } } } if ( typemap_classname == null ) throw new RuntimeException("No TypeMap class name specified with -Atypemap="); TypeDeclaration lastFile = null; try { long generatorLM = getGeneratorLastModified(); TypeMap type_map = (TypeMap)(Class.forName(typemap_classname).newInstance()); for ( TypeDeclaration typedecl : env.getSpecifiedTypeDeclarations() ) { lastFile = typedecl; typedecl.accept(getDeclarationScanner(new GeneratorVisitor(env, type_map, generate_error_checks, context_specific, generatorLM), NO_OP)); } } catch (Exception e) { if ( lastFile == null ) throw new RuntimeException(e); else throw new RuntimeException("\n-- Failed to process template: " + lastFile.getQualifiedName() + " --", e); } } /** * Gets the time of the latest change on the Generator classes. * * @return time of the latest change */ private static long getGeneratorLastModified() { long lastModified = getDirectoryLastModified("/bin/org/lwjgl/util/generator"); lastModified = Math.max(lastModified, getDirectoryLastModified("/bin/org/lwjgl/util/generator/openal")); lastModified = Math.max(lastModified, getDirectoryLastModified("/bin/org/lwjgl/util/generator/opengl")); lastModified = Math.max(lastModified, getDirectoryLastModified("/bin/org/lwjgl/util/generator/opencl")); return lastModified; } private static long getDirectoryLastModified(final String path) { final File pck = new File(System.getProperty("user.dir") + path); if ( !pck.exists() || !pck.isDirectory() ) return Long.MAX_VALUE; final File[] classes = pck.listFiles(new FileFilter() { public boolean accept(final File pathname) { return pathname.isFile() && pathname.getName().endsWith(".class"); } }); if ( classes == null || classes.length == 0 ) return Long.MAX_VALUE; long lastModified = 0; for ( File clazz : classes ) { long lm = clazz.lastModified(); if ( lastModified < lm ) lastModified = lm; } return lastModified; } } }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/DeprecatedGL.java0000644000175000017500000000372611543426510023440 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * Use this annotation on extensions with deprecated functionality. * Functions in such extensions marked with this annotation will not be loaded in a forward compatible context. * * @author spasi */ import java.lang.annotation.ElementType; import java.lang.annotation.Target; @Target({ ElementType.TYPE, ElementType.METHOD }) public @interface DeprecatedGL { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/CachedReference.java0000644000175000017500000000434711543426510024143 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * This annotation indicates that a buffer parameter is cached by * OpenGL. * * @author elias_naur * @version $Revision: 2983 $ * $Id: CachedReference.java 2983 2008-04-07 18:36:09Z matzon $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target(ElementType.PARAMETER) public @interface CachedReference { /** If set then this will be used as array index for accessing the stored reference. */ String index() default ""; /** If set then this name will be used for the reference and the reference field will not be auto generated in References. */ String name() default ""; } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/NativeType.java0000644000175000017500000000377011543426510023244 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * This annotation indicates that another annotation is * a native type. * * @author elias_naur * @version $Revision: 3412 $ * $Id: NativeType.java 3412 2010-09-26 23:43:24Z spasi $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target({ElementType.ANNOTATION_TYPE, ElementType.PARAMETER}) public @interface NativeType { String value() default ""; } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/NullTerminated.java0000644000175000017500000000376211543426510024104 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * This annotation implies that a Buffer argument should be * checked for a trailing '\0' * * @author elias_naur * @version $Revision: 3260 $ * $Id: NullTerminated.java 3260 2009-12-04 04:49:19Z spasi $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target(ElementType.PARAMETER) public @interface NullTerminated { String value() default ""; } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Alias.java0000644000175000017500000000412611543426510022201 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * This annotation can be used for extensions that have aliases * with the exact same functionality. *

      * This is currently only implemented for context-specific functionality. * * @author Spasi */ import java.lang.annotation.ElementType; import java.lang.annotation.Target; @Target(ElementType.TYPE) public @interface Alias { /** The aliased extension name. */ String value(); /** The function name postfix for the aliased version. (optional) */ String postfix() default ""; }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Mode.java0000644000175000017500000000332711543426510022036 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; public enum Mode { BUFFEROBJECT, AUTOS, CACHEDRESULT, // Used for generating a CachedResult method with an explicit length argument. NORMAL } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/GenerateAutos.java0000644000175000017500000000371511543426510023721 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * @author elias_naur * @version $Revision: 3412 $ * $Id: GenerateAutos.java 3412 2010-09-26 23:43:24Z spasi $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target(ElementType.METHOD) public @interface GenerateAutos { /** If true, a size variable will be generated. */ String[] sizeVariables() default {}; } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Private.java0000644000175000017500000000356711543426510022572 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * Extension templates marked with @Private will result in classes without the public keyword. * * @author Spasi */ import java.lang.annotation.ElementType; import java.lang.annotation.Target; @Target({ElementType.TYPE, ElementType.METHOD}) public @interface Private { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java0000644000175000017500000001362211543426510025625 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * This class generates the initNatives native function. * * @author elias_naur * @version $Revision: 3418 $ * $Id: RegisterStubsGenerator.java 3418 2010-09-28 21:11:35Z spasi $ */ import org.lwjgl.opencl.CLMem; import com.sun.mirror.declaration.*; import com.sun.mirror.type.*; import java.io.*; import java.util.*; public class RegisterStubsGenerator { public static void generateMethodsNativeStubBind(PrintWriter writer, InterfaceDeclaration d, boolean generate_error_checks, boolean context_specific) { Iterator it = d.getMethods().iterator(); while (it.hasNext()) { MethodDeclaration method = it.next(); Alternate alt_annotation = method.getAnnotation(Alternate.class); if ( (alt_annotation != null && (!alt_annotation.nativeAlt() || alt_annotation.skipNative())) || method.getAnnotation(Reuse.class) != null ) continue; EnumSet platforms; PlatformDependent platform_annotation = method.getAnnotation(PlatformDependent.class); if (platform_annotation != null) platforms = EnumSet.copyOf(Arrays.asList(platform_annotation.value())); else platforms = EnumSet.of(Platform.ALL); for (Platform platform : platforms) { platform.printPrologue(writer); boolean has_buffer_parameter = Utils.hasMethodBufferObjectParameter(method); printMethodNativeStubBind(writer, d, method, platform, Mode.NORMAL, it.hasNext() || has_buffer_parameter, generate_error_checks, context_specific); if (has_buffer_parameter) { printMethodNativeStubBind(writer, d, method, platform, Mode.BUFFEROBJECT, it.hasNext(), generate_error_checks, context_specific); } platform.printEpilogue(writer); } } writer.println(); } private static String getTypeSignature(TypeMirror type, boolean add_position_signature) { SignatureTranslator v = new SignatureTranslator(add_position_signature); type.accept(v); return v.getSignature(); } private static String getMethodSignature(MethodDeclaration method, Mode mode) { Collection params = method.getParameters(); String signature = "("; for (ParameterDeclaration param : params) { if ( param.getAnnotation(Result.class) != null || (param.getAnnotation(Helper.class) != null && !param.getAnnotation(Helper.class).passToNative()) ) continue; final Constant constant_annotation = param.getAnnotation(Constant.class); if ( constant_annotation != null && constant_annotation.isNative() ) continue; if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null) signature += "I"; else signature += getTypeSignature(param.getType(), true); } final TypeMirror result_type = Utils.getMethodReturnType(method); final CachedResult cached_result_annotation = method.getAnnotation(CachedResult.class); final AutoSize auto_size_annotation = method.getAnnotation(AutoSize.class); if ( Utils.getNIOBufferType(result_type) != null && (auto_size_annotation == null || !auto_size_annotation.isNative()) ) signature += "J"; String result_type_signature = getTypeSignature(result_type, false); if ( cached_result_annotation != null ) signature += result_type_signature; signature += ")"; signature += result_type_signature; return signature; } private static void printMethodNativeStubBind(PrintWriter writer, InterfaceDeclaration d, MethodDeclaration method, Platform platform, Mode mode, boolean has_more, boolean generate_error_checks, boolean context_specific) { writer.print("\t\t{\"" + Utils.getSimpleNativeMethodName(method, generate_error_checks, context_specific)); if (mode == Mode.BUFFEROBJECT) writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX); writer.print("\", \"" + getMethodSignature(method, mode) + "\", (void *)&"); writer.print(Utils.getQualifiedNativeMethodName(Utils.getQualifiedClassName(d), method, generate_error_checks, context_specific)); if (mode == Mode.BUFFEROBJECT) writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX); final Alternate alt_annotation = method.getAnnotation(Alternate.class); final String methodName = alt_annotation == null ? method.getSimpleName() : alt_annotation.value(); String opengl_handle_name = methodName.replaceFirst("gl", platform.getPrefix()); writer.print(", \"" + opengl_handle_name + "\", (void *)&" + methodName + "}"); if (has_more) writer.println(","); } } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/ForceInit.java0000644000175000017500000000353711543426510023037 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * Extensions marked with ForceInit will be initialized by LWJGL even if not exposed in the GL_EXTENSIONS string. * * @author spasi */ import java.lang.annotation.ElementType; import java.lang.annotation.Target; @Target({ ElementType.TYPE }) public @interface ForceInit { }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Imports.java0000644000175000017500000000354211543426510022606 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; import java.lang.annotation.ElementType; import java.lang.annotation.Target; /** * This annotation can be used when an extension template needs * extra imports in its generated class. * * @author Spasi */ @Target(ElementType.TYPE) public @interface Imports { String[] value(); }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/TypeMap.java0000644000175000017500000000565511543426510022537 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * The interface to the OpenAL/OpenGL specific generator behaviour * * @author elias_naur * @version $Revision: 3412 $ * $Id: TypeMap.java 3412 2010-09-26 23:43:24Z spasi $ */ import com.sun.mirror.declaration.*; import com.sun.mirror.type.*; import java.io.*; import java.lang.annotation.Annotation; public interface TypeMap { void printCapabilitiesInit(PrintWriter writer); String getCapabilities(); void printErrorCheckMethod(PrintWriter writer, MethodDeclaration method, String tabs); String getRegisterNativesFunctionName(); PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class native_type); String getTypedefPostfix(); String getFunctionPrefix(); void printNativeIncludes(PrintWriter writer); Class getStringElementType(); Class getStringArrayType(); Class getByteBufferArrayType(); Class[] getValidAnnotationTypes(Class type); Class getVoidType(); String translateAnnotation(Class annotation_type); Class getNativeTypeFromPrimitiveType(PrimitiveType.Kind kind); String getAutoTypeFromAnnotation(AnnotationMirror annotation); Class getInverseType(Class type); Signedness getSignednessFromType(Class type); } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/PostfixTranslator.java0000644000175000017500000001323611543426510024660 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * A TypeVisitor that translates (annotated) TypeMirrors to * postfixes. * * @author elias_naur * @version $Revision: 3412 $ * $Id: PostfixTranslator.java 3412 2010-09-26 23:43:24Z spasi $ */ import com.sun.mirror.declaration.*; import com.sun.mirror.type.*; import com.sun.mirror.util.*; import java.lang.annotation.Annotation; import java.nio.*; public class PostfixTranslator implements TypeVisitor { private final StringBuilder signature = new StringBuilder(); private final Declaration declaration; private final TypeMap type_map; public PostfixTranslator(TypeMap type_map, Declaration declaration) { this.declaration = declaration; this.type_map = type_map; } public String getSignature() { return signature.toString(); } public void visitAnnotationType(AnnotationType t) { throw new RuntimeException(t + " is not allowed"); } public void visitArrayType(ArrayType t) { throw new RuntimeException(t + " is not allowed"); } private static PrimitiveType.Kind getPrimitiveKindFromBufferClass(Class c) { if (IntBuffer.class.equals(c) || int.class.equals(c) ) return PrimitiveType.Kind.INT; else if (DoubleBuffer.class.equals(c) || double.class.equals(c) ) return PrimitiveType.Kind.DOUBLE; else if (ShortBuffer.class.equals(c) || short.class.equals(c) ) return PrimitiveType.Kind.SHORT; else if (ByteBuffer.class.equals(c) || byte.class.equals(c) ) return PrimitiveType.Kind.BYTE; else if (FloatBuffer.class.equals(c) || float.class.equals(c)) return PrimitiveType.Kind.FLOAT; else if (LongBuffer.class.equals(c) || long.class.equals(c) ) return PrimitiveType.Kind.LONG; else throw new RuntimeException(c + " is not allowed"); } public void visitClassType(ClassType t) { Class c = NativeTypeTranslator.getClassFromType(t); PrimitiveType.Kind kind = getPrimitiveKindFromBufferClass(c); visitPrimitiveTypeKind(kind); } public void visitDeclaredType(DeclaredType t) { throw new RuntimeException(t + " is not allowed"); } public void visitEnumType(EnumType t) { throw new RuntimeException(t + " is not allowed"); } public void visitInterfaceType(InterfaceType t) { throw new RuntimeException(t + " is not allowed"); } private boolean translateAnnotation(AnnotationMirror annotation) { NativeType native_type = NativeTypeTranslator.getAnnotation(annotation, NativeType.class); if (native_type != null) { Class annotation_class = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType()); signature.append(type_map.translateAnnotation(annotation_class)); return true; } else return false; } private boolean translateAnnotations() { boolean result = false; for (AnnotationMirror annotation : Utils.getSortedAnnotations(declaration.getAnnotationMirrors())) if (translateAnnotation(annotation)) { if (result) throw new RuntimeException("Multiple native types"); result = true; } return result; } public void visitPrimitiveType(PrimitiveType t) { visitPrimitiveTypeKind(t.getKind()); } private void visitPrimitiveTypeKind(PrimitiveType.Kind kind) { boolean annotated_translation = translateAnnotations(); if (annotated_translation) return; // No annotation type was specified, fall back to default String type; switch (kind) { case INT: type = "i"; break; case DOUBLE: type = "d"; break; case FLOAT: type = "f"; break; case SHORT: type = "s"; break; case BYTE: type = "b"; break; case LONG: type = "i64"; break; default: throw new RuntimeException(kind + " is not allowed"); } signature.append(type); } public void visitReferenceType(ReferenceType t) { throw new RuntimeException(t + " is not allowed"); } public void visitTypeMirror(TypeMirror t) { throw new RuntimeException(t + " is not allowed"); } public void visitTypeVariable(TypeVariable t) { throw new RuntimeException(t + " is not allowed"); } public void visitVoidType(VoidType t) { } public void visitWildcardType(WildcardType t) { throw new RuntimeException(t + " is not allowed"); } }lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Extension.java0000644000175000017500000000367611543426510023135 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: Extension.java 2983 2008-04-07 18:36:09Z matzon $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target(ElementType.TYPE) public @interface Extension { String className() default ""; boolean isFinal() default true; String postfix(); } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/JNITypeTranslator.java0000644000175000017500000000771611543426510024514 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; import com.sun.mirror.type.*; import com.sun.mirror.util.*; /** * * A TypeVisitor that translates TypeMirrors to JNI * type strings. * * @author elias_naur * @version $Revision: 3412 $ * $Id: JNITypeTranslator.java 3412 2010-09-26 23:43:24Z spasi $ */ public class JNITypeTranslator implements TypeVisitor { private final StringBuilder signature = new StringBuilder(); public String getSignature() { return signature.toString(); } public void visitAnnotationType(AnnotationType t) { throw new RuntimeException(t + " is not allowed"); } public void visitArrayType(ArrayType t) { final String className = t.getComponentType().toString(); if ( "java.lang.CharSequence".equals(className) ) signature.append("jobject"); else if ( "java.nio.ByteBuffer".equals(className) ) signature.append("jobjectArray"); else if ( "org.lwjgl.opencl.CLMem".equals(className) ) signature.append("jobjectArray"); else throw new RuntimeException(t + " is not allowed"); } public void visitClassType(ClassType t) { signature.append("jobject"); } public void visitDeclaredType(DeclaredType t) { throw new RuntimeException(t + " is not allowed"); } public void visitEnumType(EnumType t) { throw new RuntimeException(t + " is not allowed"); } public void visitInterfaceType(InterfaceType t) { throw new RuntimeException(t + " is not allowed"); } public void visitPrimitiveType(PrimitiveType t) { String type; switch (t.getKind()) { case LONG: type = "jlong"; break; case INT: type = "jint"; break; case FLOAT: type = "jfloat"; break; case SHORT: type = "jshort"; break; case BYTE: type = "jbyte"; break; case DOUBLE: type = "jdouble"; break; case BOOLEAN: type = "jboolean"; break; default: throw new RuntimeException(t + " is not allowed"); } signature.append(type); } public void visitReferenceType(ReferenceType t) { throw new RuntimeException(t + " is not allowed"); } public void visitTypeMirror(TypeMirror t) { throw new RuntimeException(t + " is not allowed"); } public void visitTypeVariable(TypeVariable t) { throw new RuntimeException(t + " is not allowed"); } public void visitVoidType(VoidType t) { signature.append(t.toString()); } public void visitWildcardType(WildcardType t) { throw new RuntimeException(t + " is not allowed"); } } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Platform.java0000644000175000017500000000520711543426510022735 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: Platform.java 2983 2008-04-07 18:36:09Z matzon $ */ import java.io.PrintWriter; public enum Platform { WGL, GLX, ALL; public void printPrologue(PrintWriter writer) { if (this == ALL) return; writer.print("#ifdef "); switch (this) { case WGL: writer.println("_WIN32"); break; case GLX: writer.println("_X11"); break; default: throw new RuntimeException(this + " is not supported"); } } public void printEpilogue(PrintWriter writer) { if (this == ALL) return; writer.println("#endif"); } public String getOSPrefix() { switch (this) { case WGL: return "Windows"; case GLX: return "Linux"; default: throw new RuntimeException(this + " has no OS specific prefix"); } } public String getPrefix() { switch (this) { case WGL: return "wgl"; case GLX: return "glX"; case ALL: return "gl"; default: throw new RuntimeException(this + " is not supported"); } } } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java0000644000175000017500000010720711543426510025230 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * This class generates the methods in the generated java source files. * * @author elias_naur * @version $Revision: 3460 $ * $Id: JavaMethodsGenerator.java 3460 2010-11-29 18:25:28Z spasi $ */ import org.lwjgl.PointerBuffer; import org.lwjgl.util.generator.opengl.GLreturn; import com.sun.mirror.apt.*; import com.sun.mirror.declaration.*; import com.sun.mirror.type.*; import java.io.*; import java.util.*; import java.nio.*; public class JavaMethodsGenerator { private static final String SAVED_PARAMETER_POSTFIX = "_saved"; public static void generateMethodsJava(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration interface_decl, boolean generate_error_checks, boolean context_specific) { for (MethodDeclaration method : interface_decl.getMethods()) generateMethodJava(env, type_map, writer, interface_decl, method, generate_error_checks, context_specific); } private static void generateMethodJava(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method, boolean generate_error_checks, boolean context_specific) { writer.println(); if (Utils.isMethodIndirect(generate_error_checks, context_specific, method)) { if (method.getAnnotation(GenerateAutos.class) != null) { printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.AUTOS, generate_error_checks, context_specific); } Collection> cross_product = TypeInfo.getTypeInfoCrossProduct(type_map, method); for (Map typeinfos_instance : cross_product) { printMethodWithMultiType(env, type_map, writer, interface_decl, method, typeinfos_instance, Mode.NORMAL, generate_error_checks, context_specific); } } if ( method.getAnnotation(CachedResult.class) != null && !method.getAnnotation(CachedResult.class).isRange() ) { printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.CACHEDRESULT, generate_error_checks, context_specific); } Reuse reuse_annotation = method.getAnnotation(Reuse.class); Alternate alt_annotation = method.getAnnotation(Alternate.class); if ( alt_annotation == null || (alt_annotation.nativeAlt() && !alt_annotation.skipNative()) ) { if ( alt_annotation != null && method.getSimpleName().equals(alt_annotation.value()) ) throw new RuntimeException("An alternate function with native code should have a different name than the main function."); if ( reuse_annotation == null ) printJavaNativeStub(writer, method, Mode.NORMAL, generate_error_checks, context_specific); if (Utils.hasMethodBufferObjectParameter(method)) { printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.BUFFEROBJECT, generate_error_checks, context_specific); if ( reuse_annotation == null ) printJavaNativeStub(writer, method, Mode.BUFFEROBJECT, generate_error_checks, context_specific); } } } private static void printJavaNativeStub(PrintWriter writer, MethodDeclaration method, Mode mode, boolean generate_error_checks, boolean context_specific) { if (Utils.isMethodIndirect(generate_error_checks, context_specific, method)) { writer.print("\tstatic native "); } else { Utils.printDocComment(writer, method); writer.print("\tpublic static native "); } writer.print(getResultType(method, true)); writer.print(" " + Utils.getSimpleNativeMethodName(method, generate_error_checks, context_specific)); if (mode == Mode.BUFFEROBJECT) writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX); writer.print("("); boolean first_parameter = generateParametersJava(writer, method, TypeInfo.getDefaultTypeInfoMap(method), true, true, mode); if (context_specific) { if (!first_parameter) writer.print(", "); writer.print("long " + Utils.FUNCTION_POINTER_VAR_NAME); } writer.println(");"); } private static boolean generateParametersJava(PrintWriter writer, MethodDeclaration method, Map typeinfos_instance, boolean native_stub, final boolean printTypes, Mode mode) { boolean first_parameter = true; for (ParameterDeclaration param : method.getParameters()) { if ( native_stub && (param.getAnnotation(Helper.class) != null && !param.getAnnotation(Helper.class).passToNative()) ) continue; final Constant constant_annotation = param.getAnnotation(Constant.class); if ( constant_annotation != null && constant_annotation.isNative() ) continue; AnnotationMirror auto_annotation_mirror = Utils.getParameterAutoAnnotation(param); boolean hide_auto_parameter = mode == Mode.NORMAL && !native_stub && auto_annotation_mirror != null; if (hide_auto_parameter) { AutoType auto_type_annotation = param.getAnnotation(AutoType.class); if (auto_type_annotation != null) { ParameterDeclaration auto_parameter = Utils.findParameter(method, auto_type_annotation.value()); TypeInfo auto_param_type_info = typeinfos_instance.get(auto_parameter); if (auto_param_type_info.getSignedness() == Signedness.BOTH) { if (!first_parameter) writer.print(", "); first_parameter = false; if ( printTypes ) writer.print("boolean "); writer.print(TypeInfo.UNSIGNED_PARAMETER_NAME); } } } else if ( param.getAnnotation(Result.class) == null && (native_stub || ((param.getAnnotation(Constant.class) == null || param.getAnnotation(Constant.class).keepParam()) && !Utils.isReturnParameter(method, param))) && (mode != Mode.AUTOS || getAutoTypeParameter(method, param) == null) ) { first_parameter = generateParameterJava(writer, param, typeinfos_instance.get(param), native_stub, printTypes, first_parameter, mode); } } CachedResult cached_result_annotation = method.getAnnotation(CachedResult.class); TypeMirror result_type = Utils.getMethodReturnType(method); if ((native_stub && Utils.getNIOBufferType(result_type) != null) || Utils.needResultSize(method)) { AutoSize auto_size_annotation = method.getAnnotation(AutoSize.class); if ( auto_size_annotation == null || !auto_size_annotation.isNative() ) { if (cached_result_annotation == null || !cached_result_annotation.isRange()) { if (!first_parameter) writer.print(", "); first_parameter = false; if ( printTypes ) writer.print("long "); writer.print(Utils.RESULT_SIZE_NAME); } } } if (cached_result_annotation != null) { if (!first_parameter) writer.print(", "); if ( mode == Mode.CACHEDRESULT ) { if ( printTypes ) writer.print("long "); writer.print(Utils.CACHED_BUFFER_LENGTH_NAME + ", "); } first_parameter = false; if ( printTypes ) writer.print(getResultType(method, native_stub)); writer.print(" " + Utils.CACHED_BUFFER_NAME); } return first_parameter; } private static boolean generateParameterJava(PrintWriter writer, ParameterDeclaration param, TypeInfo type_info, boolean native_stub, final boolean printTypes, boolean first_parameter, Mode mode) { Class buffer_type = Utils.getNIOBufferType(param.getType()); if (!first_parameter) writer.print(", "); BufferObject bo_annotation = param.getAnnotation(BufferObject.class); if (bo_annotation != null && mode == Mode.BUFFEROBJECT) { if (buffer_type == null) throw new RuntimeException("type of " + param + " is not a nio Buffer parameter but is annotated as buffer object"); if ( printTypes ) writer.print("long "); writer.print(param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX); } else { if ( native_stub && param.getAnnotation(PointerWrapper.class) != null ) writer.print("long "); else { Class type = type_info.getType(); if ( native_stub && (type == CharSequence.class || type == CharSequence[].class || type == PointerBuffer.class) ) writer.print("ByteBuffer "); else if ( printTypes ) writer.print(type_info.getType().getSimpleName() + " "); } AutoSize auto_size_annotation = param.getAnnotation(AutoSize.class); if ( auto_size_annotation != null ) writer.print(auto_size_annotation.value() + "_"); writer.print(param.getSimpleName()); if ( native_stub && buffer_type != null ) writer.print(", int " + param.getSimpleName() + NativeMethodStubsGenerator.BUFFER_POSITION_POSTFIX); } return false; } private static void printBufferObjectCheck(PrintWriter writer, BufferKind kind, Mode mode) { String bo_check_method_name = kind.toString(); writer.print("\t\t" + Utils.CHECKS_CLASS_NAME + ".ensure" + bo_check_method_name); if (mode == Mode.BUFFEROBJECT) writer.print("enabled"); else writer.print("disabled"); writer.println("(caps);"); } private static void printBufferObjectChecks(PrintWriter writer, MethodDeclaration method, Mode mode) { EnumSet check_set = EnumSet.noneOf(BufferKind.class); for (ParameterDeclaration param : method.getParameters()) { BufferObject bo_annotation = param.getAnnotation(BufferObject.class); if (bo_annotation != null) check_set.add(bo_annotation.value()); } for (BufferKind kind : check_set) printBufferObjectCheck(writer, kind, mode); } private static void printMethodWithMultiType(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method, Map typeinfos_instance, Mode mode, boolean generate_error_checks, boolean context_specific) { Utils.printDocComment(writer, method); if ( interface_decl.getAnnotation(Private.class) == null && method.getAnnotation(Private.class) == null ) writer.print("\tpublic static "); else writer.print("\tstatic "); writer.print(getResultType(method, false)); StripPostfix strip_annotation = method.getAnnotation(StripPostfix.class); String method_name; Alternate alt_annotation = method.getAnnotation(Alternate.class); method_name = alt_annotation == null || alt_annotation.javaAlt() ? method.getSimpleName() : alt_annotation.value(); if (strip_annotation != null && mode == Mode.NORMAL) method_name = getPostfixStrippedName(type_map, interface_decl, method); writer.print(" " + method_name + "("); generateParametersJava(writer, method, typeinfos_instance, false, true, mode); writer.println(") {"); final TypeMirror result_type = Utils.getMethodReturnType(method); boolean has_result = !result_type.equals(env.getTypeUtils().getVoidType()); final Reuse reuse_annotation = method.getAnnotation(Reuse.class); if ( reuse_annotation != null ) { writer.print("\t\t"); if ( has_result || method.getAnnotation(GLreturn.class) != null ) writer.print("return "); writer.print(reuse_annotation.value() + "." + method_name + "("); generateParametersJava(writer, method, typeinfos_instance, false, false, mode); writer.println(");\n\t}"); return; } if (context_specific) { type_map.printCapabilitiesInit(writer); writer.print("\t\tlong " + Utils.FUNCTION_POINTER_VAR_NAME + " = " + type_map.getCapabilities() + "."); writer.println(Utils.getFunctionAddressName(interface_decl, method, true) + ";"); writer.print("\t\tBufferChecks.checkFunctionAddress("); writer.println(Utils.FUNCTION_POINTER_VAR_NAME + ");"); } final Code code_annotation = method.getAnnotation(Code.class); if (code_annotation != null && code_annotation.value().length() > 0) writer.println(code_annotation.value()); printBufferObjectChecks(writer, method, mode); printParameterChecks(writer, method, typeinfos_instance, mode, generate_error_checks); printParameterCaching(writer, interface_decl, method, mode); if ( code_annotation != null && code_annotation.javaBeforeNative().length() > 0 ) writer.println(code_annotation.javaBeforeNative()); writer.print("\t\t"); final PointerWrapper pointer_wrapper_annotation = method.getAnnotation(PointerWrapper.class); if (has_result) { writer.print(getResultType(method, false) + " " + Utils.RESULT_VAR_NAME); if ( code_annotation != null && code_annotation.tryBlock() ) { writer.print(" = " + getDefaultResultValue(method)); writer.println(";\n\t\ttry {"); writer.print("\t\t\t" + Utils.RESULT_VAR_NAME); } writer.print(" = "); if ( pointer_wrapper_annotation != null ) { if ( pointer_wrapper_annotation.factory().length() > 0 ) writer.print(pointer_wrapper_annotation.factory() + "("); else writer.print("new " + getResultType(method, false) + "("); } } else if ( method.getAnnotation(GLreturn.class) != null ) { has_result = true; Utils.printGLReturnPre(writer, method, method.getAnnotation(GLreturn.class)); } writer.print(Utils.getSimpleNativeMethodName(method, generate_error_checks, context_specific)); if (mode == Mode.BUFFEROBJECT) writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX); writer.print("("); boolean first_parameter = printMethodCallArguments(writer, method, typeinfos_instance, mode); if (context_specific) { if (!first_parameter) writer.print(", "); writer.print(Utils.FUNCTION_POINTER_VAR_NAME); } if ( has_result && pointer_wrapper_annotation != null ) { writer.print(")"); if ( pointer_wrapper_annotation.params().length() > 0 ) writer.print(", " + pointer_wrapper_annotation.params()); } writer.println(");"); if ( code_annotation != null && code_annotation.javaAfterNative().length() > 0 ) writer.println(code_annotation.javaAfterNative()); final String tabs = code_annotation != null && code_annotation.tryBlock() ? "\t\t\t" : "\t\t"; if (generate_error_checks && method.getAnnotation(NoErrorCheck.class) == null) type_map.printErrorCheckMethod(writer, method, tabs); // DISABLED: indirect buffer support //printNondirectParameterCopies(writer, method, mode); if (has_result) { if ( method.getAnnotation(GLreturn.class) == null ) { if ( ByteBuffer.class.equals(Utils.getJavaType(result_type)) ) writer.println(tabs + "return LWJGLUtil.CHECKS && " + Utils.RESULT_VAR_NAME + " == null ? null : " + Utils.RESULT_VAR_NAME + ".order(ByteOrder.nativeOrder());"); // safeNewBuffer returns a direct ByteBuffer with BIG_ENDIAN order. else writer.println(tabs + "return " + Utils.RESULT_VAR_NAME + ";"); } else Utils.printGLReturnPost(writer, method, method.getAnnotation(GLreturn.class)); } if ( code_annotation != null && code_annotation.tryBlock() ) { writer.println("\t\t} finally {"); writer.println(code_annotation.javaFinally()); writer.println("\t\t}"); } writer.println("\t}"); } private static String getExtensionPostfix(InterfaceDeclaration interface_decl) { String interface_simple_name = interface_decl.getSimpleName(); Extension extension_annotation = interface_decl.getAnnotation(Extension.class); if (extension_annotation == null) { int underscore_index = interface_simple_name.indexOf("_"); if (underscore_index != -1) return interface_simple_name.substring(0, underscore_index); else return ""; } else return extension_annotation.postfix(); } private static ParameterDeclaration getAutoTypeParameter(MethodDeclaration method, ParameterDeclaration target_parameter) { for (ParameterDeclaration param : method.getParameters()) { AnnotationMirror auto_annotation = Utils.getParameterAutoAnnotation(param); if (auto_annotation != null) { Class annotation_type = NativeTypeTranslator.getClassFromType(auto_annotation.getAnnotationType()); String parameter_name; if (annotation_type.equals(AutoType.class)) parameter_name = param.getAnnotation(AutoType.class).value(); else if (annotation_type.equals(AutoSize.class)) parameter_name = param.getAnnotation(AutoSize.class).value(); else throw new RuntimeException("Unknown annotation type " + annotation_type); if (target_parameter.getSimpleName().equals(parameter_name)) return param; } } return null; } private static boolean hasAnyParameterAutoTypeAnnotation(MethodDeclaration method, ParameterDeclaration target_param) { for (ParameterDeclaration param : method.getParameters()) { AutoType auto_type_annotation = param.getAnnotation(AutoType.class); if (auto_type_annotation != null) { ParameterDeclaration type_target_param = Utils.findParameter(method, auto_type_annotation.value()); if (target_param.equals(type_target_param)) return true; } } return false; } private static String getPostfixStrippedName(TypeMap type_map, InterfaceDeclaration interface_decl, MethodDeclaration method) { StripPostfix strip_annotation = method.getAnnotation(StripPostfix.class); ParameterDeclaration postfix_parameter = Utils.findParameter(method, strip_annotation.value()); String postfix = strip_annotation.postfix(); if ( "NULL".equals(postfix) ) { PostfixTranslator translator = new PostfixTranslator(type_map, postfix_parameter); postfix_parameter.getType().accept(translator); postfix = translator.getSignature(); } String method_name; Alternate alt_annotation = method.getAnnotation(Alternate.class); method_name = alt_annotation == null || alt_annotation.javaAlt() ? method.getSimpleName() : alt_annotation.value(); String extension_postfix = "NULL".equals(strip_annotation.extension()) ? getExtensionPostfix(interface_decl) : strip_annotation.extension(); String result; if ( strip_annotation.hasPostfix() && method_name.endsWith(postfix + "v" + extension_postfix)) result = method_name.substring(0, method_name.length() - (postfix.length() + 1 + extension_postfix.length())); else if ( strip_annotation.hasPostfix() && method_name.endsWith(postfix + extension_postfix)) result = method_name.substring(0, method_name.length() - (postfix.length() + extension_postfix.length())); else if ( strip_annotation.hasPostfix() && method_name.endsWith(postfix + "i_v" + extension_postfix) ) result = method_name.substring(0, method_name.length() - (postfix.length() + 3 + extension_postfix.length())); else if ( method_name.endsWith("i_v" + extension_postfix) ) result = method_name.substring(0, method_name.length() - (3 + extension_postfix.length())); else if (method_name.endsWith("v" + extension_postfix)) result = method_name.substring(0, method_name.length() - (1 + extension_postfix.length())); else throw new RuntimeException(method + " is specified as being postfix stripped on parameter " + postfix_parameter + ", but it's postfix is not '" + postfix + "' nor 'v'"); return result + extension_postfix; } private static int getBufferElementSizeExponent(Class c) { if (IntBuffer.class.equals(c)) return 2; else if (LongBuffer.class.equals(c)) return 3; else if (DoubleBuffer.class.equals(c)) return 3; else if (ShortBuffer.class.equals(c)) return 1; else if (ByteBuffer.class.equals(c)) return 0; else if (FloatBuffer.class.equals(c)) return 2; else throw new RuntimeException(c + " is not allowed"); } private static boolean printMethodCallArgument(PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Map typeinfos_instance, Mode mode, boolean first_parameter) { if (!first_parameter) writer.print(", "); AnnotationMirror auto_annotation = Utils.getParameterAutoAnnotation(param); Constant constant_annotation = param.getAnnotation(Constant.class); if (constant_annotation != null) { writer.print(constant_annotation.value()); } else if (auto_annotation != null && mode == Mode.NORMAL) { Class param_type = NativeTypeTranslator.getClassFromType(auto_annotation.getAnnotationType()); if (AutoType.class.equals(param_type)) { final AutoType auto_type_annotation = param.getAnnotation(AutoType.class); final ParameterDeclaration auto_parameter = Utils.findParameter(method, auto_type_annotation.value()); final String auto_type = typeinfos_instance.get(auto_parameter).getAutoType(); if ( auto_type == null ) throw new RuntimeException("No auto type for parameter " + param.getSimpleName() + " in method " + method); writer.print(auto_type); } else if (AutoSize.class.equals(param_type)) { final AutoSize auto_size_annotation = param.getAnnotation(AutoSize.class); final String auto_parameter_name = auto_size_annotation.value(); final ParameterDeclaration auto_target_param = Utils.findParameter(method, auto_parameter_name); final TypeInfo auto_target_type_info = typeinfos_instance.get(auto_target_param); final boolean shift_remaining = !hasAnyParameterAutoTypeAnnotation(method, auto_target_param) && Utils.isParameterMultiTyped(auto_target_param); int shifting = 0; if ( shift_remaining ) { shifting = getBufferElementSizeExponent(auto_target_type_info.getType()); if ( shifting > 0 ) writer.print("("); } if ( auto_size_annotation.canBeNull() ) writer.print("(" + auto_parameter_name + " == null ? 0 : " + auto_parameter_name + ".remaining())"); else writer.print(auto_parameter_name + ".remaining()"); // Shift the remaining if the target parameter is multityped and there's no AutoType to track type if (shift_remaining && shifting > 0) { writer.print(" << " + shifting); writer.print(")"); } writer.print(auto_size_annotation.expression()); } else throw new RuntimeException("Unknown auto annotation " + param_type); } else { if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null) { writer.print(param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX); } else { Class type = typeinfos_instance.get(param).getType(); Check check_annotation = param.getAnnotation(Check.class); boolean hide_buffer = mode == Mode.AUTOS && getAutoTypeParameter(method, param) != null; if (hide_buffer) { writer.print("null"); } else { if ( type == CharSequence.class || type == CharSequence[].class ) { final String offset = Utils.getStringOffset(method, param); writer.print("APIUtil.getBuffer"); if ( param.getAnnotation(NullTerminated.class) != null ) writer.print("NT"); writer.print("(" + param.getSimpleName()); if ( offset != null ) writer.print(", " + offset); writer.print(")"); hide_buffer = true; } else { final AutoSize auto_size_annotation = param.getAnnotation(AutoSize.class); if ( auto_size_annotation != null ) writer.print(auto_size_annotation.value() + "_"); writer.print(param.getSimpleName()); if ( PointerBuffer.class.isAssignableFrom(type) ) { if ( check_annotation != null && check_annotation.canBeNull() ) writer.print(" != null ? " + param.getSimpleName()); writer.print(".getBuffer()"); if ( check_annotation != null && check_annotation.canBeNull() ) writer.print(" : null"); } } } Class buffer_type = Utils.getNIOBufferType(param.getType()); if (buffer_type != null) { writer.print(", "); if (!hide_buffer) { int shifting; if (Utils.getNIOBufferType(param.getType()).equals(Buffer.class)) { shifting = getBufferElementSizeExponent(type == Buffer.class ? ByteBuffer.class : type); // TODO: This will always throw an exception //shifting = 0; } else shifting = 0; writer.print(param.getSimpleName()); if (check_annotation != null && check_annotation.canBeNull()) writer.print(" != null ? " + param.getSimpleName()); if ( type == PointerBuffer.class ) writer.print(".positionByte()"); else writer.print(".position()"); if (shifting > 0) writer.print(" << " + shifting); if (check_annotation != null && check_annotation.canBeNull()) writer.print(" : 0"); } else if ( type == CharSequence.class || type == CharSequence[].class ) { final String offset = Utils.getStringOffset(method, param); writer.print(offset == null ? "0" : offset); } else writer.print("0"); } else if ( type != long.class ) { PointerWrapper pointer_annotation = param.getAnnotation(PointerWrapper.class); if ( pointer_annotation != null ) { if ( pointer_annotation.canBeNull() ) writer.print(" == null ? 0 : " + param.getSimpleName()); writer.print(".getPointer()"); } } } } return false; } private static boolean printMethodCallArguments(PrintWriter writer, MethodDeclaration method, Map typeinfos_instance, Mode mode) { boolean first_parameter = true; for ( ParameterDeclaration param : method.getParameters() ) { if ( param.getAnnotation(Result.class) != null || (param.getAnnotation(Helper.class) != null && !param.getAnnotation(Helper.class).passToNative()) ) continue; final Constant constant_annotation = param.getAnnotation(Constant.class); if ( constant_annotation== null || !constant_annotation.isNative() ) first_parameter = printMethodCallArgument(writer, method, param, typeinfos_instance, mode, first_parameter); } if (Utils.getNIOBufferType(Utils.getMethodReturnType(method)) != null) { if (method.getAnnotation(CachedResult.class) != null && method.getAnnotation(CachedResult.class).isRange()) { first_parameter = false; Utils.printExtraCallArguments(writer, method, ""); } else { AutoSize auto_size_annotation = method.getAnnotation(AutoSize.class); if ( auto_size_annotation == null || !auto_size_annotation.isNative() ) { if (!first_parameter) writer.print(", "); first_parameter = false; String result_size_expression; if ( mode == Mode.CACHEDRESULT ) result_size_expression = Utils.CACHED_BUFFER_LENGTH_NAME; else if ( auto_size_annotation == null ) result_size_expression = Utils.RESULT_SIZE_NAME; else result_size_expression = auto_size_annotation.value(); Utils.printExtraCallArguments(writer, method, result_size_expression); } } } return first_parameter; } private static void printParameterCaching(PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method, Mode mode) { for (ParameterDeclaration param : method.getParameters()) { Class java_type = Utils.getJavaType(param.getType()); CachedReference cachedReference = param.getAnnotation(CachedReference.class); if (Buffer.class.isAssignableFrom(java_type) && cachedReference != null && (mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) && param.getAnnotation(Result.class) == null) { writer.print("\t\tif ( LWJGLUtil.CHECKS ) " + "StateTracker.getReferences(caps)."); if(cachedReference.name().length() > 0) { writer.print(cachedReference.name()); } else { writer.print(Utils.getReferenceName(interface_decl, method, param)); } if(cachedReference.index().length() > 0) { writer.print("[" + cachedReference.index() + "]"); } writer.println(" = " + param.getSimpleName() + ";"); } } } private static void printNondirectParameterCopies(PrintWriter writer, MethodDeclaration method, Mode mode) { for (ParameterDeclaration param : method.getParameters()) { Class java_type = Utils.getJavaType(param.getType()); if (Utils.isAddressableType(java_type) && (mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) && (mode != Mode.AUTOS || getAutoTypeParameter(method, param) == null) && param.getAnnotation(Result.class) == null) { if (Buffer.class.isAssignableFrom(java_type)) { boolean out_parameter = param.getAnnotation(OutParameter.class) != null; if (out_parameter) writer.println("\t\tNondirectBufferWrapper.copy(" + param.getSimpleName() + ", " + param.getSimpleName() + SAVED_PARAMETER_POSTFIX + ");"); } } } } private static void printParameterChecks(PrintWriter writer, MethodDeclaration method, Map typeinfos, Mode mode, final boolean generate_error_checks) { if ( mode == Mode.NORMAL ) { final GenerateAutos gen_autos_annotation = method.getAnnotation(GenerateAutos.class); if ( gen_autos_annotation != null && gen_autos_annotation.sizeVariables().length > 0 ) { // For the auto-generated parameters, declare and init a size variable (that can be reused by @Code) for ( final ParameterDeclaration param : method.getParameters() ) { if ( Arrays.binarySearch(gen_autos_annotation.sizeVariables(), param.getSimpleName()) >= 0 ) { final int shifting = getBufferElementSizeExponent(typeinfos.get(param).getType()); final Check check_annotation = param.getAnnotation(Check.class); writer.print("\t\tlong " + param.getSimpleName() + "_size = "); if ( check_annotation == null || !check_annotation.canBeNull() ) writer.println(param.getSimpleName() + ".remaining() << " + shifting + ";"); else writer.println(param.getSimpleName() + " == null ? 0 : " + param.getSimpleName() + ".remaining() << " + shifting + ";"); } } } } for (ParameterDeclaration param : method.getParameters()) { Class java_type = Utils.getJavaType(param.getType()); if ( java_type.isArray() || (Utils.isAddressableType(java_type) && (mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) && (mode != Mode.AUTOS || getAutoTypeParameter(method, param) == null) && param.getAnnotation(Result.class) == null && !Utils.isReturnParameter(method, param)) ) { String check_value = null; boolean can_be_null = false; Check check_annotation = param.getAnnotation(Check.class); if (check_annotation != null) { check_value = check_annotation.value(); can_be_null = check_annotation.canBeNull(); } if ((Buffer.class.isAssignableFrom(java_type) || PointerBuffer.class.isAssignableFrom(java_type)) && param.getAnnotation(Constant.class) == null) { boolean indirect_buffer_allowed = false && param.getAnnotation(CachedReference.class) == null; // DISABLED: indirect buffer support boolean out_parameter = param.getAnnotation(OutParameter.class) != null; TypeInfo typeinfo = typeinfos.get(param); printParameterCheck(writer, method, param.getSimpleName(), typeinfo.getType().getSimpleName(), check_value, can_be_null, param.getAnnotation(NullTerminated.class), indirect_buffer_allowed, out_parameter, generate_error_checks); } else if ( String.class.equals(java_type)) { if (!can_be_null) writer.println("\t\tBufferChecks.checkNotNull(" + param.getSimpleName() + ");"); } else if ( java_type.isArray() ) { final TypeInfo typeinfo = typeinfos.get(param); printArrayParameterCheck(writer, param.getSimpleName(), typeinfo.getType().getSimpleName(), check_value, can_be_null); } } } if (method.getAnnotation(CachedResult.class) != null) printParameterCheck(writer, method, Utils.CACHED_BUFFER_NAME, null, null, true, null, false, false, generate_error_checks); } private static void printParameterCheck(PrintWriter writer, MethodDeclaration method, String name, String type, String check_value, boolean can_be_null, NullTerminated null_terminated, boolean indirect_buffer_allowed, boolean out_parameter, final boolean generate_error_checks) { if (indirect_buffer_allowed && out_parameter) { writer.println("\t\t" + type + " " + name + SAVED_PARAMETER_POSTFIX + " = " + name + ";"); } String tabs; if (can_be_null) { writer.print("\t\tif (" + name + " != null)"); if ( null_terminated != null ) writer.println(" {"); else writer.println(); tabs = "\t\t\t"; } else tabs = "\t\t"; if (indirect_buffer_allowed) { writer.print(tabs + name + " = NondirectBufferWrapper.wrap"); if (out_parameter) writer.print("NoCopy"); } else writer.print(tabs + "BufferChecks.check"); if (check_value != null && check_value.length() > 0) { writer.print("Buffer"); if ( "Buffer".equals(type) ) writer.print("Size"); // Check size only, Buffer.isDirect() was added in 1.6, cannot use yet. TODO: Remove? writer.print("(" + name + ", " + check_value); } else { writer.print("Direct(" + name); } writer.println(");"); if ( can_be_null && generate_error_checks ) { final Check check_annotation = method.getAnnotation(Check.class); if ( check_annotation != null && check_annotation.value().equals(name) ) { writer.println("\t\telse"); writer.println("\t\t\t" + name + " = APIUtil.getBufferIntDebug();"); // Use an exclusive buffer here } } if (null_terminated != null) { writer.print(tabs + "BufferChecks.checkNullTerminated("); writer.print(name); if ( null_terminated.value().length() > 0 ) { writer.print(", "); writer.print(null_terminated.value()); } writer.println(");"); if ( can_be_null ) writer.println("\t\t}"); } } private static void printArrayParameterCheck(PrintWriter writer, String name, String type, String check_value, boolean can_be_null) { String tabs; if ( can_be_null ) { writer.println("\t\tif (" + name + " != null)"); tabs = "\t\t\t"; } else tabs = "\t\t"; writer.print(tabs + "BufferChecks.checkArray(" + name); if ( check_value != null && check_value.length() > 0) writer.print(", " + check_value); writer.println(");"); } private static String getResultType(MethodDeclaration method, boolean native_stub) { if ( native_stub && method.getAnnotation(PointerWrapper.class) != null ) return "long"; else if ( !native_stub && method.getAnnotation(GLreturn.class) != null ) return Utils.getMethodReturnType(method, method.getAnnotation(GLreturn.class), false); else return Utils.getJavaType(Utils.getMethodReturnType(method)).getSimpleName(); } private static String getDefaultResultValue(MethodDeclaration method) { if ( method.getAnnotation(GLreturn.class) != null ) { final String type = Utils.getMethodReturnType(method, method.getAnnotation(GLreturn.class), false); if ( "boolean".equals(type) ) return "false"; else if ( Character.isLowerCase(type.charAt(0)) ) return "0"; else return "null"; } else { final Class type = Utils.getJavaType(Utils.getMethodReturnType(method)); if ( type.isPrimitive() ) { if ( type == boolean.class ) return "false"; else return "0"; } else return "null"; } } } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Signedness.java0000644000175000017500000000345411543426510023255 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: Signedness.java 2983 2008-04-07 18:36:09Z matzon $ */ public enum Signedness { SIGNED, UNSIGNED, NONE, BOTH } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/OutParameter.java0000644000175000017500000000366611543426510023570 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * This annotation indicates that a parameter is written, * not read. * * @author elias_naur * @version $Revision: 2286 $ * $Id: Check.java 2286 2006-03-23 19:32:21Z matzon $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target(ElementType.PARAMETER) public @interface OutParameter { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/Const.java0000644000175000017500000000357511543426510022245 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * @author elias_naur * @version $Revision: 2983 $ * $Id: Const.java 2983 2008-04-07 18:36:09Z matzon $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface Const { } lwjgl-2.7.1/src/java/org/lwjgl/util/generator/SignatureTranslator.java0000644000175000017500000001175611543426510025172 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * * A TypeVisitor that translates types to JNI signatures. * * @author elias_naur * @version $Revision: 3443 $ * $Id: SignatureTranslator.java 3443 2010-10-12 21:13:03Z spasi $ */ import org.lwjgl.PointerBuffer; import com.sun.mirror.type.*; import com.sun.mirror.util.*; import java.nio.*; class SignatureTranslator implements TypeVisitor { private final boolean add_position_signature; private final StringBuilder signature = new StringBuilder(); SignatureTranslator(boolean add_position_signature) { this.add_position_signature = add_position_signature; } private static String getNativeNameFromClassName(String class_name) { return class_name.replaceAll("\\.", "/"); } public String getSignature() { return signature.toString(); } public void visitAnnotationType(AnnotationType t) { throw new RuntimeException(t + " is not allowed"); } public void visitArrayType(ArrayType t) { final Class type = Utils.getJavaType(t.getComponentType()); if ( CharSequence.class.isAssignableFrom(type) ) signature.append("Ljava/nio/ByteBuffer;I"); else if ( Buffer.class.isAssignableFrom(type) ) signature.append("[Ljava/nio/ByteBuffer;"); else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) ) signature.append("[L" + getNativeNameFromClassName(type.getName()) + ";"); else throw new RuntimeException(t + " is not allowed"); } public void visitClassType(ClassType t) { Class type = NativeTypeTranslator.getClassFromType(t); String type_name; if ( (CharSequence.class.isAssignableFrom(type) && !String.class.equals(type)) || CharSequence[].class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) ) type_name = ByteBuffer.class.getName(); else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) ) { signature.append("J"); return; } else type_name = t.getDeclaration().getQualifiedName(); signature.append("L"); signature.append(getNativeNameFromClassName(type_name)); signature.append(";"); if ( add_position_signature && Utils.isAddressableType(type) && !String.class.equals(type) ) signature.append("I"); } public void visitDeclaredType(DeclaredType t) { throw new RuntimeException(t + " is not allowed"); } public void visitEnumType(EnumType t) { throw new RuntimeException(t + " is not allowed"); } public void visitInterfaceType(InterfaceType t) { throw new RuntimeException(t + " is not allowed"); } public void visitPrimitiveType(PrimitiveType t) { switch (t.getKind()) { case BOOLEAN: signature.append("Z"); break; case INT: signature.append("I"); break; case FLOAT: signature.append("F"); break; case SHORT: signature.append("S"); break; case DOUBLE: signature.append("D"); break; case BYTE: signature.append("B"); break; case LONG: signature.append("J"); break; default: throw new RuntimeException("Unsupported type " + t); } } public void visitReferenceType(ReferenceType t) { throw new RuntimeException(t + " is not allowed"); } public void visitTypeMirror(TypeMirror t) { throw new RuntimeException(t + " is not allowed"); } public void visitTypeVariable(TypeVariable t) { throw new RuntimeException(t + " is not allowed"); } public void visitVoidType(VoidType t) { signature.append("V"); } public void visitWildcardType(WildcardType t) { throw new RuntimeException(t + " is not allowed"); } } lwjgl-2.7.1/src/java/org/lwjgl/util/Display.java0000644000175000017500000002024311543426510020565 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.opengl.DisplayMode; /** * Display initialization utility, that can be used to find display modes and pick * one for you based on your criteria. * @author $Author: spasi $ * @version $Revision: 3418 $ * $Id: Display.java 3418 2010-09-28 21:11:35Z spasi $ */ public final class Display { private static final boolean DEBUG = false; /** * Determine the available display modes that match the specified minimum and maximum criteria. * If any given criterium is specified as -1 then it is ignored. * * @param minWidth the minimum display resolution in pixels * @param minHeight the minimum display resolution in pixels * @param maxWidth the maximum display resolution in pixels * @param maxHeight the maximum display resolution in pixels * @param minBPP the minimum bit depth per pixel * @param maxBPP the maximum bit depth per pixel * @param minFreq the minimum display frequency in Hz * @param maxFreq the maximum display frequency in Hz * @return an array of matching display modes */ public static DisplayMode[] getAvailableDisplayModes(int minWidth, int minHeight, int maxWidth, int maxHeight, int minBPP, int maxBPP, int minFreq, int maxFreq) throws LWJGLException { // First get the available display modes DisplayMode[] modes = org.lwjgl.opengl.Display.getAvailableDisplayModes(); if (LWJGLUtil.DEBUG || DEBUG) { System.out.println("Available screen modes:"); for ( DisplayMode mode : modes ) { System.out.println(mode); } } ArrayList matches = new ArrayList(modes.length); for (int i = 0; i < modes.length; i ++) { assert modes[i] != null : ""+i+" "+modes.length; if (minWidth != -1 && modes[i].getWidth() < minWidth) continue; if (maxWidth != -1 && modes[i].getWidth() > maxWidth) continue; if (minHeight != -1 && modes[i].getHeight() < minHeight) continue; if (maxHeight != -1 && modes[i].getHeight() > maxHeight) continue; if (minBPP != -1 && modes[i].getBitsPerPixel() < minBPP) continue; if (maxBPP != -1 && modes[i].getBitsPerPixel() > maxBPP) continue; //if (modes[i].bpp == 24) // continue; if (modes[i].getFrequency() != 0) { if (minFreq != -1 && modes[i].getFrequency() < minFreq) continue; if (maxFreq != -1 && modes[i].getFrequency() > maxFreq) continue; } matches.add(modes[i]); } DisplayMode[] ret = new DisplayMode[matches.size()]; matches.toArray(ret); if (LWJGLUtil.DEBUG && DEBUG) { System.out.println("Filtered screen modes:"); for ( DisplayMode mode : ret ) { System.out.println(mode); } } return ret; } /** * Create the display by choosing from a list of display modes based on an order of preference. * You must supply a list of allowable display modes, probably by calling getAvailableDisplayModes(), * and an array with the order in which you would like them sorted in descending order. * This method attempts to create the topmost display mode; if that fails, it will try the next one, * and so on, until there are no modes left. If no mode is set at the end, an exception is thrown. * @param dm a list of display modes to choose from * @param param the names of the DisplayMode fields in the order in which you would like them sorted. * @return the chosen display mode * @throws NoSuchFieldException if one of the params is not a field in DisplayMode * @throws Exception if no display mode could be set * @see org.lwjgl.opengl.DisplayMode */ public static DisplayMode setDisplayMode(DisplayMode[] dm, final String[] param) throws Exception { class FieldAccessor { final String fieldName; final int order; final int preferred; final boolean usePreferred; FieldAccessor(String fieldName, int order, int preferred, boolean usePreferred) { this.fieldName = fieldName; this.order = order; this.preferred = preferred; this.usePreferred = usePreferred; } int getInt(DisplayMode mode) { if ("width".equals(fieldName)) { return mode.getWidth(); } if ("height".equals(fieldName)) { return mode.getHeight(); } if ("freq".equals(fieldName)) { return mode.getFrequency(); } if ("bpp".equals(fieldName)) { return mode.getBitsPerPixel(); } throw new IllegalArgumentException("Unknown field "+fieldName); } } class Sorter implements Comparator { final FieldAccessor[] accessors; Sorter() { accessors = new FieldAccessor[param.length]; for (int i = 0; i < accessors.length; i ++) { int idx = param[i].indexOf('='); if (idx > 0) { accessors[i] = new FieldAccessor(param[i].substring(0, idx), 0, Integer.parseInt(param[i].substring(idx + 1, param[i].length())), true); } else if (param[i].charAt(0) == '-') { accessors[i] = new FieldAccessor(param[i].substring(1), -1, 0, false); } else { accessors[i] = new FieldAccessor(param[i], 1, 0, false); } } } /** * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ public int compare(DisplayMode dm1, DisplayMode dm2) { for ( FieldAccessor accessor : accessors ) { int f1 = accessor.getInt(dm1); int f2 = accessor.getInt(dm2); if ( accessor.usePreferred && f1 != f2 ) { if ( f1 == accessor.preferred ) return -1; else if ( f2 == accessor.preferred ) return 1; else { // Score according to the difference between the values int absf1 = Math.abs(f1 - accessor.preferred); int absf2 = Math.abs(f2 - accessor.preferred); if ( absf1 < absf2 ) return -1; else if ( absf1 > absf2 ) return 1; else continue; } } else if ( f1 < f2 ) return accessor.order; else if ( f1 == f2 ) continue; else return -accessor.order; } return 0; } } // Sort the display modes Arrays.sort(dm, new Sorter()); // Try them out in the appropriate order if (LWJGLUtil.DEBUG || DEBUG) { System.out.println("Sorted display modes:"); for ( DisplayMode aDm : dm ) { System.out.println(aDm); } } for ( DisplayMode aDm : dm ) { try { if ( LWJGLUtil.DEBUG || DEBUG ) System.out.println("Attempting to set displaymode: " + aDm); org.lwjgl.opengl.Display.setDisplayMode(aDm); return aDm; } catch (Exception e) { if ( LWJGLUtil.DEBUG || DEBUG ) { System.out.println("Failed to set display mode to " + aDm); e.printStackTrace(); } } } throw new Exception("Failed to set display mode."); } } lwjgl-2.7.1/src/java/org/lwjgl/util/Rectangle.java0000644000175000017500000004105611543426510021071 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util; import java.io.Serializable; /** * A 2D integer Rectangle class which looks remarkably like an AWT one. * @author $Author: matzon $ * @version $Revision: 2983 $ * $Id: Rectangle.java 2983 2008-04-07 18:36:09Z matzon $ */ public final class Rectangle implements ReadableRectangle, WritableRectangle, Serializable { static final long serialVersionUID = 1L; /** Rectangle's bounds */ private int x, y, width, height; /** * Constructor for Rectangle. */ public Rectangle() { super(); } /** * Constructor for Rectangle. */ public Rectangle(int x, int y, int w, int h) { this.x = x; this.y = y; this.width = w; this.height = h; } /** * Constructor for Rectangle. */ public Rectangle(ReadablePoint p, ReadableDimension d) { x = p.getX(); y = p.getY(); width = d.getWidth(); height = d.getHeight(); } /** * Constructor for Rectangle. */ public Rectangle(ReadableRectangle r) { x = r.getX(); y = r.getY(); width = r.getWidth(); height = r.getHeight(); } public void setLocation(int x, int y) { this.x = x; this.y = y; } public void setLocation(ReadablePoint p) { this.x = p.getX(); this.y = p.getY(); } public void setSize(int w, int h) { this.width = w; this.height = h; } public void setSize(ReadableDimension d) { this.width = d.getWidth(); this.height = d.getHeight(); } public void setBounds(int x, int y, int w, int h) { this.x = x; this.y = y; this.width = w; this.height = h; } public void setBounds(ReadablePoint p, ReadableDimension d) { x = p.getX(); y = p.getY(); width = d.getWidth(); height = d.getHeight(); } public void setBounds(ReadableRectangle r) { x = r.getX(); y = r.getY(); width = r.getWidth(); height = r.getHeight(); } /* (Overrides) * @see com.shavenpuppy.jglib.ReadableRectangle#getBounds(com.shavenpuppy.jglib.Rectangle) */ public void getBounds(WritableRectangle dest) { dest.setBounds(x, y, width, height); } /* (Overrides) * @see com.shavenpuppy.jglib.ReadablePoint#getLocation(com.shavenpuppy.jglib.Point) */ public void getLocation(WritablePoint dest) { dest.setLocation(x, y); } /* (Overrides) * @see com.shavenpuppy.jglib.ReadableDimension#getSize(com.shavenpuppy.jglib.Dimension) */ public void getSize(WritableDimension dest) { dest.setSize(width, height); } /** * Translate the rectangle by an amount. * @param x The translation amount on the x axis * @param y The translation amount on the y axis */ public void translate(int x, int y) { this.x += x; this.y += y; } /** * Translate the rectangle by an amount. * @param point The translation amount */ public void translate(ReadablePoint point) { this.x += point.getX(); this.y += point.getY(); } /** * Un-translate the rectangle by an amount. * @param point The translation amount */ public void untranslate(ReadablePoint point) { this.x -= point.getX(); this.y -= point.getY(); } /** * Checks whether or not this Rectangle contains the * specified Point. * @param p the Point to test * @return true if the Point * (xy) is inside this * Rectangle; * false otherwise. */ public boolean contains(ReadablePoint p) { return contains(p.getX(), p.getY()); } /** * Checks whether or not this Rectangle contains the * point at the specified location * (xy). * @param X the specified x coordinate * @param Y the specified y coordinate * @return true if the point * (xy) is inside this * Rectangle; * false otherwise. */ public boolean contains(int X, int Y) { int w = this.width; int h = this.height; if ((w | h) < 0) { // At least one of the dimensions is negative... return false; } // Note: if either dimension is zero, tests below must return false... int x = this.x; int y = this.y; if (X < x || Y < y) { return false; } w += x; h += y; // overflow || intersect return ((w < x || w > X) && (h < y || h > Y)); } /** * Checks whether or not this Rectangle entirely contains * the specified Rectangle. * @param r the specified Rectangle * @return true if the Rectangle * is contained entirely inside this Rectangle; * false otherwise. */ public boolean contains(ReadableRectangle r) { return contains(r.getX(), r.getY(), r.getWidth(), r.getHeight()); } /** * Checks whether this Rectangle entirely contains * the Rectangle * at the specified location (XY) with the * specified dimensions (WH). * @param X the specified x coordinate * @param Y the specified y coordinate * @param W the width of the Rectangle * @param H the height of the Rectangle * @return true if the Rectangle specified by * (XYWH) * is entirely enclosed inside this Rectangle; * false otherwise. */ public boolean contains(int X, int Y, int W, int H) { int w = this.width; int h = this.height; if ((w | h | W | H) < 0) { // At least one of the dimensions is negative... return false; } // Note: if any dimension is zero, tests below must return false... int x = this.x; int y = this.y; if (X < x || Y < y) { return false; } w += x; W += X; if (W <= X) { // X+W overflowed or W was zero, return false if... // either original w or W was zero or // x+w did not overflow or // the overflowed x+w is smaller than the overflowed X+W if (w >= x || W > w) return false; } else { // X+W did not overflow and W was not zero, return false if... // original w was zero or // x+w did not overflow and x+w is smaller than X+W if (w >= x && W > w) return false; } h += y; H += Y; if (H <= Y) { if (h >= y || H > h) return false; } else { if (h >= y && H > h) return false; } return true; } /** * Determines whether or not this Rectangle and the specified * Rectangle intersect. Two rectangles intersect if * their intersection is nonempty. * * @param r the specified Rectangle * @return true if the specified Rectangle * and this Rectangle intersect; * false otherwise. */ public boolean intersects(ReadableRectangle r) { int tw = this.width; int th = this.height; int rw = r.getWidth(); int rh = r.getHeight(); if (rw <= 0 || rh <= 0 || tw <= 0 || th <= 0) { return false; } int tx = this.x; int ty = this.y; int rx = r.getX(); int ry = r.getY(); rw += rx; rh += ry; tw += tx; th += ty; // overflow || intersect return ((rw < rx || rw > tx) && (rh < ry || rh > ty) && (tw < tx || tw > rx) && (th < ty || th > ry)); } /** * Computes the intersection of this Rectangle with the * specified Rectangle. Returns a new Rectangle * that represents the intersection of the two rectangles. * If the two rectangles do not intersect, the result will be * an empty rectangle. * * @param r the specified Rectangle * @return the largest Rectangle contained in both the * specified Rectangle and in * this Rectangle; or if the rectangles * do not intersect, an empty rectangle. */ public Rectangle intersection(ReadableRectangle r, Rectangle dest) { int tx1 = this.x; int ty1 = this.y; int rx1 = r.getX(); int ry1 = r.getY(); long tx2 = tx1; tx2 += this.width; long ty2 = ty1; ty2 += this.height; long rx2 = rx1; rx2 += r.getWidth(); long ry2 = ry1; ry2 += r.getHeight(); if (tx1 < rx1) tx1 = rx1; if (ty1 < ry1) ty1 = ry1; if (tx2 > rx2) tx2 = rx2; if (ty2 > ry2) ty2 = ry2; tx2 -= tx1; ty2 -= ty1; // tx2,ty2 will never overflow (they will never be // larger than the smallest of the two source w,h) // they might underflow, though... if (tx2 < Integer.MIN_VALUE) tx2 = Integer.MIN_VALUE; if (ty2 < Integer.MIN_VALUE) ty2 = Integer.MIN_VALUE; if (dest == null) dest = new Rectangle(tx1, ty1, (int) tx2, (int) ty2); else dest.setBounds(tx1, ty1, (int) tx2, (int) ty2); return dest; } /** * Computes the union of this Rectangle with the * specified Rectangle. Returns a new * Rectangle that * represents the union of the two rectangles * @param r the specified Rectangle * @return the smallest Rectangle containing both * the specified Rectangle and this * Rectangle. */ public WritableRectangle union(ReadableRectangle r, WritableRectangle dest) { int x1 = Math.min(x, r.getX()); int x2 = Math.max(x + width, r.getX() + r.getWidth()); int y1 = Math.min(y, r.getY()); int y2 = Math.max(y + height, r.getY() + r.getHeight()); dest.setBounds(x1, y1, x2 - x1, y2 - y1); return dest; } /** * Adds a point, specified by the integer arguments newx * and newy, to this Rectangle. The * resulting Rectangle is * the smallest Rectangle that contains both the * original Rectangle and the specified point. *

      * After adding a point, a call to contains with the * added point as an argument does not necessarily return * true. The contains method does not * return true for points on the right or bottom * edges of a Rectangle. Therefore, if the added point * falls on the right or bottom edge of the enlarged * Rectangle, contains returns * false for that point. * @param newx the x coordinates of the new point * @param newy the y coordinates of the new point */ public void add(int newx, int newy) { int x1 = Math.min(x, newx); int x2 = Math.max(x + width, newx); int y1 = Math.min(y, newy); int y2 = Math.max(y + height, newy); x = x1; y = y1; width = x2 - x1; height = y2 - y1; } /** * Adds the specified Point to this * Rectangle. The resulting Rectangle * is the smallest Rectangle that contains both the * original Rectangle and the specified * Point. *

      * After adding a Point, a call to contains * with the added Point as an argument does not * necessarily return true. The contains * method does not return true for points on the right * or bottom edges of a Rectangle. Therefore if the added * Point falls on the right or bottom edge of the * enlarged Rectangle, contains returns * false for that Point. * @param pt the new Point to add to this * Rectangle */ public void add(ReadablePoint pt) { add(pt.getX(), pt.getY()); } /** * Adds a Rectangle to this Rectangle. * The resulting Rectangle is the union of the two * rectangles. * @param r the specified Rectangle */ public void add(ReadableRectangle r) { int x1 = Math.min(x, r.getX()); int x2 = Math.max(x + width, r.getX() + r.getWidth()); int y1 = Math.min(y, r.getY()); int y2 = Math.max(y + height, r.getY() + r.getHeight()); x = x1; y = y1; width = x2 - x1; height = y2 - y1; } /** * Resizes the Rectangle both horizontally and vertically. *

      * This method modifies the Rectangle so that it is * h units larger on both the left and right side, * and v units larger at both the top and bottom. *

      * The new Rectangle has (x - h, * y - v) as its top-left corner, a * width of * width + 2h, * and a height of * height + 2v. *

      * If negative values are supplied for h and * v, the size of the Rectangle * decreases accordingly. * The grow method does not check whether the resulting * values of width and height are * non-negative. * @param h the horizontal expansion * @param v the vertical expansion */ public void grow(int h, int v) { x -= h; y -= v; width += h * 2; height += v * 2; } /** * Determines whether or not this Rectangle is empty. A * Rectangle is empty if its width or its height is less * than or equal to zero. * @return true if this Rectangle is empty; * false otherwise. */ public boolean isEmpty() { return (width <= 0) || (height <= 0); } /** * Checks whether two rectangles are equal. *

      * The result is true if and only if the argument is not * null and is a Rectangle object that has the * same top-left corner, width, and height as this Rectangle. * @param obj the Object to compare with * this Rectangle * @return true if the objects are equal; * false otherwise. */ public boolean equals(Object obj) { if (obj instanceof Rectangle) { Rectangle r = (Rectangle) obj; return ((x == r.x) && (y == r.y) && (width == r.width) && (height == r.height)); } return super.equals(obj); } /** * Debugging * @return a String */ public String toString() { return getClass().getName() + "[x=" + x + ",y=" + y + ",width=" + width + ",height=" + height + "]"; } /** * Gets the height. * @return Returns a int */ public int getHeight() { return height; } /** * Sets the height. * @param height The height to set */ public void setHeight(int height) { this.height = height; } /** * Gets the width. * @return Returns a int */ public int getWidth() { return width; } /** * Sets the width. * @param width The width to set */ public void setWidth(int width) { this.width = width; } /** * Gets the x. * @return Returns a int */ public int getX() { return x; } /** * Sets the x. * @param x The x to set */ public void setX(int x) { this.x = x; } /** * Gets the y. * @return Returns a int */ public int getY() { return y; } /** * Sets the y. * @param y The y to set */ public void setY(int y) { this.y = y; } } lwjgl-2.7.1/src/java/org/lwjgl/util/ReadablePoint.java0000644000175000017500000000377311543426510021702 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util; /** * Readonly interface for Points * @author $Author: spasi $ * @version $Revision: 3418 $ * $Id: ReadablePoint.java 3418 2010-09-28 21:11:35Z spasi $ */ public interface ReadablePoint { /** * @return int */ int getX(); /** * @return int */ int getY(); /** * Copy this ReadablePoint into a destination Point * @param dest The destination Point, or null, to create a new Point */ void getLocation(WritablePoint dest); } lwjgl-2.7.1/src/java/org/lwjgl/util/WritablePoint.java0000644000175000017500000000354511543426510021751 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util; /** * Write interface for Points * @author $Author: spasi $ * @version $Revision: 3418 $ * $Id: WritablePoint.java 3418 2010-09-28 21:11:35Z spasi $ */ public interface WritablePoint { void setLocation(int x, int y); void setLocation(ReadablePoint p); void setX(int x); void setY(int y); }lwjgl-2.7.1/src/java/org/lwjgl/util/Point.java0000644000175000017500000001102211543426510020244 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util; import java.io.Serializable; /** * A 2D integer point class, which looks remarkably like an AWT one. * @author $Author: matzon $ * @version $Revision: 2983 $ * $Id: Point.java 2983 2008-04-07 18:36:09Z matzon $ */ public final class Point implements ReadablePoint, WritablePoint, Serializable { static final long serialVersionUID = 1L; /** The location */ private int x, y; /** * Constructor for Point. */ public Point() { super(); } /** * Constructor for Point. */ public Point(int x, int y) { setLocation(x, y); } /** * Constructor for Point. */ public Point(ReadablePoint p) { setLocation(p); } public void setLocation(int x, int y) { this.x = x; this.y = y; } public void setLocation(ReadablePoint p) { this.x = p.getX(); this.y = p.getY(); } public void setX(int x) { this.x = x; } public void setY(int y) { this.y = y; } /** * Translate a point. * @param dx The translation to apply * @param dy The translation to apply */ public void translate(int dx, int dy) { this.x += dx; this.y += dy; } /** * Translate a point. * @param p The translation to apply */ public void translate(ReadablePoint p) { this.x += p.getX(); this.y += p.getY(); } /** * Un-translate a point. * @param p The translation to apply */ public void untranslate(ReadablePoint p) { this.x -= p.getX(); this.y -= p.getY(); } /** * Determines whether an instance of Point2D is equal * to this point. Two instances of Point2D are equal if * the values of their x and y member * fields, representing their position in the coordinate space, are * the same. * @param obj an object to be compared with this point * @return true if the object to be compared is * an instance of Point and has * the same values; false otherwise */ public boolean equals(Object obj) { if (obj instanceof Point) { Point pt = (Point) obj; return (x == pt.x) && (y == pt.y); } return super.equals(obj); } /** * Returns a string representation of this point and its location * in the (xy) coordinate space. This method is * intended to be used only for debugging purposes, and the content * and format of the returned string may vary between implementations. * The returned string may be empty but may not be null. * * @return a string representation of this point */ public String toString() { return getClass().getName() + "[x=" + x + ",y=" + y + "]"; } /** * Returns the hash code for this Point. * * @return a hash code for this Point */ public int hashCode() { int sum = x + y; return sum * (sum + 1) / 2 + x; } public int getX() { return x; } public int getY() { return y; } public void getLocation(WritablePoint dest) { dest.setLocation(x, y); } } lwjgl-2.7.1/src/java/org/lwjgl/util/ReadableRectangle.java0000644000175000017500000000377511543426510022517 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util; /** * Readonly interface for Rectangles * @author $Author: spasi $ * @version $Revision: 3418 $ * $Id: ReadableRectangle.java 3418 2010-09-28 21:11:35Z spasi $ */ public interface ReadableRectangle extends ReadableDimension, ReadablePoint { /** * Copy this readable rectangle's bounds into a destination Rectangle * @param dest The destination Rectangle, or null, to create a new Rectangle */ void getBounds(WritableRectangle dest); } lwjgl-2.7.1/src/java/org/lwjgl/util/XPMFile.java0000644000175000017500000002057511543426510020434 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.LineNumberReader; import java.util.HashMap; import java.util.StringTokenizer; /** *

      * NOTE: This simple XPM reader does not support extensions nor hotspots *

      * * @author Brian Matzon * @author Jos Hirth * @version $Revision$ * $Id$ */ public class XPMFile { /** Array of bytes (RGBA) */ private byte bytes[]; private static final int WIDTH = 0; private static final int HEIGHT = 1; private static final int NUMBER_OF_COLORS = 2; private static final int CHARACTERS_PER_PIXEL = 3; private static int[] format = new int[4]; /* * Private constructor, use load(String filename) */ private XPMFile() { } /** * Loads the XPM file * * @param file * path to file * @return XPMFile loaded, or exception * @throws IOException * If any IO exceptions occurs while reading file */ public static XPMFile load(String file) throws IOException { return load(new FileInputStream(new File(file))); } /** * Loads the XPM file * * @param is * InputStream to read file from * @return XPMFile loaded, or exception */ public static XPMFile load(InputStream is) { XPMFile xFile = new XPMFile(); xFile.readImage(is); return xFile; } /** * @return the height of the image. */ public int getHeight() { return format[HEIGHT]; } /** * @return the width of the image. */ public int getWidth() { return format[WIDTH]; } /** * @return The data of the image. */ public byte[] getBytes() { return bytes; } /** * Read the image from the specified file. */ private void readImage(InputStream is) { try { LineNumberReader reader = new LineNumberReader( new InputStreamReader(is)); HashMap colors = new HashMap(); format = parseFormat(nextLineOfInterest(reader)); // setup color mapping for (int i = 0; i < format[NUMBER_OF_COLORS]; i++) { Object[] colorDefinition = parseColor(nextLineOfInterest(reader)); colors.put((String)colorDefinition[0], (Integer)colorDefinition[1]); } // read actual image (convert to RGBA) bytes = new byte[format[WIDTH] * format[HEIGHT] * 4]; for (int i = 0; i < format[HEIGHT]; i++) { parseImageLine(nextLineOfInterest(reader), format, colors, i); } } catch (Exception e) { e.printStackTrace(); throw new IllegalArgumentException("Unable to parse XPM File"); } } /** * Finds the next interesting line of text. * * @param reader * The LineNumberReader to read from * @return The next interesting String (with stripped quotes) * @throws IOException * If any IO exceptions occurs while reading file */ private static String nextLineOfInterest(LineNumberReader reader) throws IOException { String ret; do { ret = reader.readLine(); } while (!ret.startsWith("\"")); // lacks sanity check return ret.substring(1, ret.lastIndexOf('\"')); } /** * Parses the format of the xpm file given a format string * * @param format * String to parse * @return Array specifying width, height, colors, characters per pixel */ private static int[] parseFormat(String format) { // format should look like this: // 16 16 122 2 // tokenize it StringTokenizer st = new StringTokenizer(format); return new int[] { Integer.parseInt(st.nextToken()), /* width */ Integer.parseInt(st.nextToken()), /* height */ Integer.parseInt(st.nextToken()), /* colors */ Integer.parseInt(st.nextToken()) /* chars per pixel */ }; } /** * Given a line defining a color/pixel, parses this into an array containing * a key and a color * * @param line * Line to parse * @return Array containing a key (String) and a color (Integer) */ private static Object[] parseColor(String line) { // line should look like this: // # c #0A0A0A // NOTE: will break if the color is something like "black" or "gray50" // etc (instead of #rrggbb). String key = line.substring(0, format[CHARACTERS_PER_PIXEL]); // since we always assume color as type we dont need to read it // String type = line.substring(format[CHARACTERS_PER_PIXEL] + 1, // format[CHARACTERS_PER_PIXEL] + 2); String color = line.substring(format[CHARACTERS_PER_PIXEL] + 4); // we always assume type is color, and supplied as # return new Object[] { key, Integer.parseInt(color, 16) }; } /** * Parses an Image line into its byte values * * @param line * Line of chars to parse * @param format * Format to expext it in * @param colors * Colors to lookup * @param index * current index into lines, we've reached */ private void parseImageLine(String line, int[] format, HashMap colors, int index) { // offset for next line int offset = index * 4 * format[WIDTH]; // read characters times, // each iteration equals one pixel for (int i = 0; i < format[WIDTH]; i++) { String key = line .substring( i * format[CHARACTERS_PER_PIXEL], (i * format[CHARACTERS_PER_PIXEL] + format[CHARACTERS_PER_PIXEL])); int color = colors.get(key); bytes[offset + (i * 4)] = (byte) ((color & 0x00ff0000) >> 16); bytes[offset + ((i * 4) + 1)] = (byte) ((color & 0x0000ff00) >> 8); bytes[offset + ((i * 4) + 2)] = (byte) ((color & 0x000000ff) >> 0); // looks // better // :) bytes[offset + ((i * 4) + 3)] = (byte) 0xff; // always 0xff alpha } } /** * @param args */ public static void main(String[] args) { if (args.length != 1) { System.out.println("usage:\nXPMFile "); } try { String out = args[0].substring(0, args[0].indexOf(".")) + ".raw"; XPMFile file = XPMFile.load(args[0]); BufferedOutputStream bos = new BufferedOutputStream( new FileOutputStream(new File(out))); bos.write(file.getBytes()); bos.close(); // showResult(file.getBytes()); } catch (Exception e) { e.printStackTrace(); } } /* private static void showResult(byte[] bytes) { final BufferedImage i = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB); int c = 0; for (int y = 0; y < 16; y++) { for (int x = 0; x < 16; x++) { i.setRGB(x, y, (bytes[c] << 16) + (bytes[c + 1] << 8) + (bytes[c + 2] << 0) + (bytes[c + 3] << 24));//+(128<<24));// c += 4; } } final Frame frame = new Frame("XPM Result"); frame.add(new Canvas() { public void paint(Graphics g) { g.drawImage(i, 0, 0, frame); } }); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { frame.dispose(); } }); frame.setSize(100, 100); frame.setVisible(true); }*/ }lwjgl-2.7.1/src/java/org/lwjgl/util/WritableColor.java0000644000175000017500000000644711543426510021742 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util; import java.nio.ByteBuffer; /** * Write interface for Colors * @author $Author: spasi $ * @version $Revision: 3418 $ * $Id: WritableColor.java 3418 2010-09-28 21:11:35Z spasi $ */ public interface WritableColor { /** * Set a color */ void set(int r, int g, int b, int a); /** * Set a color */ void set(byte r, byte g, byte b, byte a); /** * Set a color */ void set(int r, int g, int b); /** * Set a color */ void set(byte r, byte g, byte b); /** * Set the Red component */ void setRed(int red); /** * Set the Green component */ void setGreen(int green); /** * Set the Blue component */ void setBlue(int blue); /** * Set the Alpha component */ void setAlpha(int alpha); /** * Set the Red component */ void setRed(byte red); /** * Set the Green component */ void setGreen(byte green); /** * Set the Blue component */ void setBlue(byte blue); /** * Set the Alpha component */ void setAlpha(byte alpha); /** * Read a color from a byte buffer * @param src The source buffer */ void readRGBA(ByteBuffer src); /** * Read a color from a byte buffer * @param src The source buffer */ void readRGB(ByteBuffer src); /** * Read a color from a byte buffer * @param src The source buffer */ void readARGB(ByteBuffer src); /** * Read a color from a byte buffer * @param src The source buffer */ void readBGRA(ByteBuffer src); /** * Read a color from a byte buffer * @param src The source buffer */ void readBGR(ByteBuffer src); /** * Read a color from a byte buffer * @param src The source buffer */ void readABGR(ByteBuffer src); /** * Set this color's color by copying another color * @param src The source color */ void setColor(ReadableColor src); }lwjgl-2.7.1/src/java/org/lwjgl/util/Timer.java0000644000175000017500000001033311543426510020237 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util; import org.lwjgl.Sys; /** * * A hires timer. This measures time in seconds as floating point values. * All Timers created are updated simultaneously by calling the static method * tick(). This ensures that within a single iteration of a game loop that * all timers are updated consistently with each other. * * @author cix_foo * @version $Revision: 3418 $ * $Id: Timer.java 3418 2010-09-28 21:11:35Z spasi $ */ public class Timer { // Record the timer resolution on classload private static long resolution = Sys.getTimerResolution(); // Every so often we will re-query the timer resolution private static final int QUERY_INTERVAL = 50; // in calls to tick() private static int queryCount; // Globally keeps track of time for all instances of Timer private static long currentTime; // When the timer was started private long startTime; // The last time recorded by getTime() private long lastTime; // Whether the timer is paused private boolean paused; static { tick(); } /** * Constructs a timer. The timer will be reset to 0.0 and resumed immediately. */ public Timer() { reset(); resume(); } /** * @return the time in seconds, as a float */ public float getTime() { if (!paused) { lastTime = currentTime - startTime; } return (float) ((double) lastTime / (double) resolution); } /** * @return whether this timer is paused */ public boolean isPaused() { return paused; } /** * Pause the timer. Whilst paused the time will not change for this timer * when tick() is called. * * @see #resume() */ public void pause() { paused = true; } /** * Reset the timer. Equivalent to set(0.0f); * @see #set(float) */ public void reset() { set(0.0f); } /** * Resume the timer. * @see #pause() */ public void resume() { paused = false; startTime = currentTime - lastTime; } /** * Set the time of this timer * @param newTime the new time, in seconds */ public void set(float newTime) { long newTimeInTicks = (long) ((double) newTime * (double) resolution); startTime = currentTime - newTimeInTicks; lastTime = newTimeInTicks; } /** * Get the next time update from the system's hires timer. This method should * be called once per main loop iteration; all timers are updated simultaneously * from it. */ public static void tick() { currentTime = Sys.getTime(); // Periodically refresh the timer resolution: queryCount ++; if (queryCount > QUERY_INTERVAL) { queryCount = 0; resolution = Sys.getTimerResolution(); } } /** * Debug output. */ public String toString() { return "Timer[Time=" + getTime() + ", Paused=" + paused + "]"; } }lwjgl-2.7.1/src/java/org/lwjgl/util/Renderable.java0000644000175000017500000000355111543426510021226 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util; /** * * Simple interface to things that can be Rendered. * * @author $Author: spasi $ * @version $Revision: 3418 $ * $Id: Renderable.java 3418 2010-09-28 21:11:35Z spasi $ */ public interface Renderable { /** * "Render" this thing. This will involve calls to the GL. */ void render(); } lwjgl-2.7.1/src/java/org/lwjgl/util/jinput/0000755000175000017500000000000011543426510017625 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/util/jinput/LWJGLKeyboard.java0000644000175000017500000001034511543426510023033 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.jinput; import net.java.games.input.AbstractComponent; import net.java.games.input.Keyboard; import net.java.games.input.Component; import net.java.games.input.Controller; import net.java.games.input.Rumbler; import net.java.games.input.Event; import java.util.List; import java.util.ArrayList; import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.Modifier; /** * @author elias */ final class LWJGLKeyboard extends Keyboard { LWJGLKeyboard() { super("LWJGLKeyboard", createComponents(), new Controller[]{}, new Rumbler[]{}); } private static Component[] createComponents() { List components = new ArrayList(); Field[] vkey_fields = org.lwjgl.input.Keyboard.class.getFields(); for ( Field vkey_field : vkey_fields ) { try { if (Modifier.isStatic(vkey_field.getModifiers()) && vkey_field.getType() == int.class && vkey_field.getName().startsWith("KEY_")) { int vkey_code = vkey_field.getInt(null); Component.Identifier.Key key_id = KeyMap.map(vkey_code); if (key_id != Component.Identifier.Key.UNKNOWN) components.add(new Key(key_id, vkey_code)); } } catch (IllegalAccessException e) { throw new RuntimeException(e); } } return components.toArray(new Component[components.size()]); } public synchronized void pollDevice() throws IOException { if (!org.lwjgl.input.Keyboard.isCreated()) return; org.lwjgl.input.Keyboard.poll(); for ( Component component : getComponents() ) { Key key = (Key)component; key.update(); } } protected synchronized boolean getNextDeviceEvent(Event event) throws IOException { if (!org.lwjgl.input.Keyboard.isCreated()) return false; if (!org.lwjgl.input.Keyboard.next()) return false; int lwjgl_key = org.lwjgl.input.Keyboard.getEventKey(); if (lwjgl_key == org.lwjgl.input.Keyboard.KEY_NONE) return false; Component.Identifier.Key key_id = KeyMap.map(lwjgl_key); if (key_id == null) return false; Component key = getComponent(key_id); if (key == null) return false; float value = org.lwjgl.input.Keyboard.getEventKeyState() ? 1 : 0; event.set(key, value, org.lwjgl.input.Keyboard.getEventNanoseconds()); return true; } private static final class Key extends AbstractComponent { private final int lwjgl_key; private float value; Key(Component.Identifier.Key key_id, int lwjgl_key) { super(key_id.getName(), key_id); this.lwjgl_key = lwjgl_key; } public void update() { this.value = org.lwjgl.input.Keyboard.isKeyDown(lwjgl_key) ? 1 : 0; } protected float poll() { return value; } public boolean isRelative() { return false; } public boolean isAnalog() { return false; } } } lwjgl-2.7.1/src/java/org/lwjgl/util/jinput/LWJGLMouse.java0000644000175000017500000001250711543426510022365 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.jinput; import java.io.IOException; import net.java.games.input.AbstractComponent; import net.java.games.input.Component; import net.java.games.input.Controller; import net.java.games.input.Event; import net.java.games.input.Mouse; import net.java.games.input.Rumbler; /** * @author elias */ final class LWJGLMouse extends Mouse { private static final int EVENT_X = 1; private static final int EVENT_Y = 2; private static final int EVENT_WHEEL = 3; private static final int EVENT_BUTTON = 4; private static final int EVENT_DONE = 5; private int event_state = EVENT_DONE; LWJGLMouse() { super("LWJGLMouse", createComponents(), new Controller[]{}, new Rumbler[]{}); } private static Component[] createComponents() { return new Component[]{new Axis(Component.Identifier.Axis.X), new Axis(Component.Identifier.Axis.Y), new Axis(Component.Identifier.Axis.Z), new Button(Component.Identifier.Button.LEFT), new Button(Component.Identifier.Button.MIDDLE), new Button(Component.Identifier.Button.RIGHT)}; } public synchronized void pollDevice() throws IOException { if (!org.lwjgl.input.Mouse.isCreated()) return; org.lwjgl.input.Mouse.poll(); for (int i = 0; i < 3; i++) setButtonState(i); } private Button map(int lwjgl_button) { switch (lwjgl_button) { case 0: return (Button)getLeft(); case 1: return (Button)getRight(); case 2: return (Button)getMiddle(); default: return null; } } private void setButtonState(int lwjgl_button) { Button button = map(lwjgl_button); if (button != null) button.setValue(org.lwjgl.input.Mouse.isButtonDown(lwjgl_button) ? 1 : 0); } protected synchronized boolean getNextDeviceEvent(Event event) throws IOException { if (!org.lwjgl.input.Mouse.isCreated()) return false; while (true) { long nanos = org.lwjgl.input.Mouse.getEventNanoseconds(); switch (event_state) { case EVENT_X: event_state = EVENT_Y; int dx = org.lwjgl.input.Mouse.getEventDX(); if (dx != 0) { event.set(getX(), dx, nanos); return true; } break; case EVENT_Y: event_state = EVENT_WHEEL; /* We must negate the y coord since lwjgl uses the * OpenGL coordinate system */ int dy = -org.lwjgl.input.Mouse.getEventDY(); if (dy != 0) { event.set(getY(), dy, nanos); return true; } break; case EVENT_WHEEL: event_state = EVENT_BUTTON; int dwheel = org.lwjgl.input.Mouse.getEventDWheel(); if (dwheel != 0) { event.set(getWheel(), dwheel, nanos); return true; } break; case EVENT_BUTTON: event_state = EVENT_DONE; int lwjgl_button = org.lwjgl.input.Mouse.getEventButton(); if (lwjgl_button != -1) { Button button = map(lwjgl_button); if (button != null) { event.set(button, org.lwjgl.input.Mouse.getEventButtonState() ? 1f : 0f, nanos); return true; } } break; case EVENT_DONE: if (!org.lwjgl.input.Mouse.next()) return false; event_state = EVENT_X; break; default: break; } } } static final class Axis extends AbstractComponent { Axis(Component.Identifier.Axis axis_id) { super(axis_id.getName(), axis_id); } public boolean isRelative() { return true; } protected float poll() throws IOException { return 0; } public boolean isAnalog() { return true; } } static final class Button extends AbstractComponent { private float value; Button(Component.Identifier.Button button_id) { super(button_id.getName(), button_id); } void setValue(float value) { this.value = value; } protected float poll() throws IOException { return value; } public boolean isRelative() { return false; } public boolean isAnalog() { return false; } } } lwjgl-2.7.1/src/java/org/lwjgl/util/jinput/LWJGLEnvironmentPlugin.java0000644000175000017500000000415111543426510024754 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.jinput; import net.java.games.input.Controller; import net.java.games.input.ControllerEnvironment; import net.java.games.util.plugins.Plugin; /** * @author elias */ public class LWJGLEnvironmentPlugin extends ControllerEnvironment implements Plugin { private final Controller[] controllers; public LWJGLEnvironmentPlugin() { this.controllers = new Controller[]{new LWJGLKeyboard(), new LWJGLMouse()}; } public Controller[] getControllers() { return controllers; } public boolean isSupported() { return true; } } lwjgl-2.7.1/src/java/org/lwjgl/util/jinput/KeyMap.java0000644000175000017500000002426211543426510021664 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.jinput; import org.lwjgl.input.Keyboard; import net.java.games.input.Component; /** * @author elias */ final class KeyMap { public static Component.Identifier.Key map(int lwjgl_key_code) { switch (lwjgl_key_code) { case Keyboard.KEY_ESCAPE: return Component.Identifier.Key.ESCAPE; case Keyboard.KEY_1: return Component.Identifier.Key._1; case Keyboard.KEY_2: return Component.Identifier.Key._2; case Keyboard.KEY_3: return Component.Identifier.Key._3; case Keyboard.KEY_4: return Component.Identifier.Key._4; case Keyboard.KEY_5: return Component.Identifier.Key._5; case Keyboard.KEY_6: return Component.Identifier.Key._6; case Keyboard.KEY_7: return Component.Identifier.Key._7; case Keyboard.KEY_8: return Component.Identifier.Key._8; case Keyboard.KEY_9: return Component.Identifier.Key._9; case Keyboard.KEY_0: return Component.Identifier.Key._0; case Keyboard.KEY_MINUS: return Component.Identifier.Key.MINUS; case Keyboard.KEY_EQUALS: return Component.Identifier.Key.EQUALS; case Keyboard.KEY_BACK: return Component.Identifier.Key.BACK; case Keyboard.KEY_TAB: return Component.Identifier.Key.TAB; case Keyboard.KEY_Q: return Component.Identifier.Key.Q; case Keyboard.KEY_W: return Component.Identifier.Key.W; case Keyboard.KEY_E: return Component.Identifier.Key.E; case Keyboard.KEY_R: return Component.Identifier.Key.R; case Keyboard.KEY_T: return Component.Identifier.Key.T; case Keyboard.KEY_Y: return Component.Identifier.Key.Y; case Keyboard.KEY_U: return Component.Identifier.Key.U; case Keyboard.KEY_I: return Component.Identifier.Key.I; case Keyboard.KEY_O: return Component.Identifier.Key.O; case Keyboard.KEY_P: return Component.Identifier.Key.P; case Keyboard.KEY_LBRACKET: return Component.Identifier.Key.LBRACKET; case Keyboard.KEY_RBRACKET: return Component.Identifier.Key.RBRACKET; case Keyboard.KEY_RETURN: return Component.Identifier.Key.RETURN; case Keyboard.KEY_LCONTROL: return Component.Identifier.Key.LCONTROL; case Keyboard.KEY_A: return Component.Identifier.Key.A; case Keyboard.KEY_S: return Component.Identifier.Key.S; case Keyboard.KEY_D: return Component.Identifier.Key.D; case Keyboard.KEY_F: return Component.Identifier.Key.F; case Keyboard.KEY_G: return Component.Identifier.Key.G; case Keyboard.KEY_H: return Component.Identifier.Key.H; case Keyboard.KEY_J: return Component.Identifier.Key.J; case Keyboard.KEY_K: return Component.Identifier.Key.K; case Keyboard.KEY_L: return Component.Identifier.Key.L; case Keyboard.KEY_SEMICOLON: return Component.Identifier.Key.SEMICOLON; case Keyboard.KEY_APOSTROPHE: return Component.Identifier.Key.APOSTROPHE; case Keyboard.KEY_GRAVE: return Component.Identifier.Key.GRAVE; case Keyboard.KEY_LSHIFT: return Component.Identifier.Key.LSHIFT; case Keyboard.KEY_BACKSLASH: return Component.Identifier.Key.BACKSLASH; case Keyboard.KEY_Z: return Component.Identifier.Key.Z; case Keyboard.KEY_X: return Component.Identifier.Key.X; case Keyboard.KEY_C: return Component.Identifier.Key.C; case Keyboard.KEY_V: return Component.Identifier.Key.V; case Keyboard.KEY_B: return Component.Identifier.Key.B; case Keyboard.KEY_N: return Component.Identifier.Key.N; case Keyboard.KEY_M: return Component.Identifier.Key.M; case Keyboard.KEY_COMMA: return Component.Identifier.Key.COMMA; case Keyboard.KEY_PERIOD: return Component.Identifier.Key.PERIOD; case Keyboard.KEY_SLASH: return Component.Identifier.Key.SLASH; case Keyboard.KEY_RSHIFT: return Component.Identifier.Key.RSHIFT; case Keyboard.KEY_MULTIPLY: return Component.Identifier.Key.MULTIPLY; case Keyboard.KEY_LMENU: return Component.Identifier.Key.LALT; case Keyboard.KEY_SPACE: return Component.Identifier.Key.SPACE; case Keyboard.KEY_CAPITAL: return Component.Identifier.Key.CAPITAL; case Keyboard.KEY_F1: return Component.Identifier.Key.F1; case Keyboard.KEY_F2: return Component.Identifier.Key.F2; case Keyboard.KEY_F3: return Component.Identifier.Key.F3; case Keyboard.KEY_F4: return Component.Identifier.Key.F4; case Keyboard.KEY_F5: return Component.Identifier.Key.F5; case Keyboard.KEY_F6: return Component.Identifier.Key.F6; case Keyboard.KEY_F7: return Component.Identifier.Key.F7; case Keyboard.KEY_F8: return Component.Identifier.Key.F8; case Keyboard.KEY_F9: return Component.Identifier.Key.F9; case Keyboard.KEY_F10: return Component.Identifier.Key.F10; case Keyboard.KEY_NUMLOCK: return Component.Identifier.Key.NUMLOCK; case Keyboard.KEY_SCROLL: return Component.Identifier.Key.SCROLL; case Keyboard.KEY_NUMPAD7: return Component.Identifier.Key.NUMPAD7; case Keyboard.KEY_NUMPAD8: return Component.Identifier.Key.NUMPAD8; case Keyboard.KEY_NUMPAD9: return Component.Identifier.Key.NUMPAD9; case Keyboard.KEY_SUBTRACT: return Component.Identifier.Key.SUBTRACT; case Keyboard.KEY_NUMPAD4: return Component.Identifier.Key.NUMPAD4; case Keyboard.KEY_NUMPAD5: return Component.Identifier.Key.NUMPAD5; case Keyboard.KEY_NUMPAD6: return Component.Identifier.Key.NUMPAD6; case Keyboard.KEY_ADD: return Component.Identifier.Key.ADD; case Keyboard.KEY_NUMPAD1: return Component.Identifier.Key.NUMPAD1; case Keyboard.KEY_NUMPAD2: return Component.Identifier.Key.NUMPAD2; case Keyboard.KEY_NUMPAD3: return Component.Identifier.Key.NUMPAD3; case Keyboard.KEY_NUMPAD0: return Component.Identifier.Key.NUMPAD0; case Keyboard.KEY_DECIMAL: return Component.Identifier.Key.DECIMAL; case Keyboard.KEY_F11: return Component.Identifier.Key.F11; case Keyboard.KEY_F12: return Component.Identifier.Key.F12; case Keyboard.KEY_F13: return Component.Identifier.Key.F13; case Keyboard.KEY_F14: return Component.Identifier.Key.F14; case Keyboard.KEY_F15: return Component.Identifier.Key.F15; case Keyboard.KEY_KANA: return Component.Identifier.Key.KANA; case Keyboard.KEY_CONVERT: return Component.Identifier.Key.CONVERT; case Keyboard.KEY_NOCONVERT: return Component.Identifier.Key.NOCONVERT; case Keyboard.KEY_YEN: return Component.Identifier.Key.YEN; case Keyboard.KEY_NUMPADEQUALS: return Component.Identifier.Key.NUMPADEQUAL; case Keyboard.KEY_CIRCUMFLEX: return Component.Identifier.Key.CIRCUMFLEX; case Keyboard.KEY_AT: return Component.Identifier.Key.AT; case Keyboard.KEY_COLON: return Component.Identifier.Key.COLON; case Keyboard.KEY_UNDERLINE: return Component.Identifier.Key.UNDERLINE; case Keyboard.KEY_KANJI: return Component.Identifier.Key.KANJI; case Keyboard.KEY_STOP: return Component.Identifier.Key.STOP; case Keyboard.KEY_AX: return Component.Identifier.Key.AX; case Keyboard.KEY_UNLABELED: return Component.Identifier.Key.UNLABELED; case Keyboard.KEY_NUMPADENTER: return Component.Identifier.Key.NUMPADENTER; case Keyboard.KEY_RCONTROL: return Component.Identifier.Key.RCONTROL; case Keyboard.KEY_NUMPADCOMMA: return Component.Identifier.Key.NUMPADCOMMA; case Keyboard.KEY_DIVIDE: return Component.Identifier.Key.DIVIDE; case Keyboard.KEY_SYSRQ: return Component.Identifier.Key.SYSRQ; case Keyboard.KEY_RMENU: return Component.Identifier.Key.RALT; case Keyboard.KEY_PAUSE: return Component.Identifier.Key.PAUSE; case Keyboard.KEY_HOME: return Component.Identifier.Key.HOME; case Keyboard.KEY_UP: return Component.Identifier.Key.UP; case Keyboard.KEY_PRIOR: return Component.Identifier.Key.PAGEUP; case Keyboard.KEY_LEFT: return Component.Identifier.Key.LEFT; case Keyboard.KEY_RIGHT: return Component.Identifier.Key.RIGHT; case Keyboard.KEY_END: return Component.Identifier.Key.END; case Keyboard.KEY_DOWN: return Component.Identifier.Key.DOWN; case Keyboard.KEY_NEXT: return Component.Identifier.Key.PAGEDOWN; case Keyboard.KEY_INSERT: return Component.Identifier.Key.INSERT; case Keyboard.KEY_DELETE: return Component.Identifier.Key.DELETE; case Keyboard.KEY_LMETA: return Component.Identifier.Key.LWIN; case Keyboard.KEY_RMETA: return Component.Identifier.Key.RWIN; case Keyboard.KEY_APPS: return Component.Identifier.Key.APPS; case Keyboard.KEY_POWER: return Component.Identifier.Key.POWER; case Keyboard.KEY_SLEEP: return Component.Identifier.Key.SLEEP; default: return Component.Identifier.Key.UNKNOWN; } } } lwjgl-2.7.1/src/java/org/lwjgl/util/ReadableDimension.java0000644000175000017500000000403011543426510022521 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util; /** * Readonly interface for Dimensions * @author $Author: spasi $ * @version $Revision: 3418 $ * $Id: ReadableDimension.java 3418 2010-09-28 21:11:35Z spasi $ */ public interface ReadableDimension { /** * Get the width * @return int */ int getWidth(); /** * Get the height * @return int */ int getHeight(); /** * Copy this ReadableDimension into a destination Dimension * @param dest The destination */ void getSize(WritableDimension dest); } lwjgl-2.7.1/src/java/org/lwjgl/Sys.java0000644000175000017500000002136311543426510016765 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl; import java.io.File; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; import org.lwjgl.input.Mouse; /** *

      * System class (named Sys so as not to conflict with java.lang.System) *

      * @author cix_foo * @version $Revision: 3488 $ * $Id: Sys.java 3488 2011-02-09 21:09:33Z matzon $ */ public final class Sys { /** The native library name */ private static final String JNI_LIBRARY_NAME = "lwjgl"; /** Current version of library */ private static final String VERSION = "2.7.1"; private static final String POSTFIX64BIT = "64"; /** The implementation instance to delegate platform specific behavior to */ private static final SysImplementation implementation; private static final boolean is64Bit; private static void doLoadLibrary(final String lib_name) { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { String library_path = System.getProperty("org.lwjgl.librarypath"); if (library_path != null) { System.load(library_path + File.separator + System.mapLibraryName(lib_name)); } else { System.loadLibrary(lib_name); } return null; } }); } private static void loadLibrary(final String lib_name) { try { doLoadLibrary(lib_name); } catch (UnsatisfiedLinkError e) { if (implementation.has64Bit()) { try { doLoadLibrary(lib_name + POSTFIX64BIT); return; } catch (UnsatisfiedLinkError e2) { LWJGLUtil.log("Failed to load 64 bit library: " + e2.getMessage()); } } // Throw original error throw e; } } static { implementation = createImplementation(); loadLibrary(JNI_LIBRARY_NAME); is64Bit = implementation.getPointerSize() == 8; int native_jni_version = implementation.getJNIVersion(); int required_version = implementation.getRequiredJNIVersion(); if (native_jni_version != required_version) throw new LinkageError("Version mismatch: jar version is '" + required_version + "', native library version is '" + native_jni_version + "'"); implementation.setDebug(LWJGLUtil.DEBUG); } private static SysImplementation createImplementation() { switch (LWJGLUtil.getPlatform()) { case LWJGLUtil.PLATFORM_LINUX: return new LinuxSysImplementation(); case LWJGLUtil.PLATFORM_WINDOWS: return new WindowsSysImplementation(); case LWJGLUtil.PLATFORM_MACOSX: return new MacOSXSysImplementation(); default: throw new IllegalStateException("Unsupported platform"); } } /** * No constructor for Sys. */ private Sys() { } /** * Return the version of the core LWJGL libraries as a String. */ public static String getVersion() { return VERSION; } /** * Initialization. This is just a dummy method to trigger the static constructor. */ public static void initialize() { } /** Returns true if a 64bit implementation was loaded. */ public static boolean is64Bit() { return is64Bit; } /** * Obtains the number of ticks that the hires timer does in a second. This method is fast; * it should be called as frequently as possible, as it recalibrates the timer. * * @return timer resolution in ticks per second or 0 if no timer is present. */ public static long getTimerResolution() { return implementation.getTimerResolution(); } /** * Gets the current value of the hires timer, in ticks. When the Sys class is first loaded * the hires timer is reset to 0. If no hires timer is present then this method will always * return 0.

      NOTEZ BIEN that the hires timer WILL wrap around. * * @return the current hires time, in ticks (always >= 0) */ public static long getTime() { return implementation.getTime() & 0x7FFFFFFFFFFFFFFFL; } /** * Attempt to display a modal alert to the user. This method should be used * when a game fails to initialize properly or crashes out losing its display * in the process. It is provided because AWT may not be available on the target * platform, although on Mac and Linux and other platforms supporting AWT we * delegate the task to AWT instead of doing it ourselves. *

      * The alert should display the title and the message and then the current * thread should block until the user dismisses the alert - typically with an * OK button click. *

      * It may be that the user's system has no windowing system installed for some * reason, in which case this method may do nothing at all, or attempt to provide * some console output. * * @param title The title of the alert. We suggest using the title of your game. * @param message The message text for the alert. */ public static void alert(String title, String message) { boolean grabbed = Mouse.isGrabbed(); if (grabbed) { Mouse.setGrabbed(false); } if (title == null) title = ""; if (message == null) message = ""; implementation.alert(title, message); if (grabbed) { Mouse.setGrabbed(true); } } /** * Open the system web browser and point it at the specified URL. It is recommended * that this not be called whilst your game is running, but on application exit in * a shutdown hook, as the screen resolution will not be reset when the browser is * brought into view. *

      * There is no guarantee that this will work, nor that we can detect if it has * failed - hence we don't return success code or throw an Exception. This is just a * best attempt at opening the URL given - don't rely on it to work! *

      * @param url The URL. Ensure that the URL is properly encoded. * @return false if we are CERTAIN the call has failed */ public static boolean openURL(String url) { // Attempt to use Webstart if we have it available try { // Lookup the javax.jnlp.BasicService object final Class serviceManagerClass = Class.forName("javax.jnlp.ServiceManager"); Method lookupMethod = AccessController.doPrivileged(new PrivilegedExceptionAction() { public Method run() throws Exception { return serviceManagerClass.getMethod("lookup", String.class); } }); Object basicService = lookupMethod.invoke(serviceManagerClass, new Object[] {"javax.jnlp.BasicService"}); final Class basicServiceClass = Class.forName("javax.jnlp.BasicService"); Method showDocumentMethod = AccessController.doPrivileged(new PrivilegedExceptionAction() { public Method run() throws Exception { return basicServiceClass.getMethod("showDocument", URL.class); } }); try { Boolean ret = (Boolean)showDocumentMethod.invoke(basicService, new URL(url)); return ret; } catch (MalformedURLException e) { e.printStackTrace(System.err); return false; } } catch (Exception ue) { return implementation.openURL(url); } } /** * Get the contents of the system clipboard. The system might not have a * clipboard (particularly if it doesn't even have a keyboard) in which case * we return null. Otherwise we return a String, which may be the empty * string "". * * @return a String, or null if there is no system clipboard. */ public static String getClipboard() { return implementation.getClipboard(); } } lwjgl-2.7.1/src/java/org/lwjgl/input/0000755000175000017500000000000011543426510016476 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/input/OpenGLPackageAccess.java0000644000175000017500000000577211543426510023076 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.input; import org.lwjgl.opengl.InputImplementation; import org.lwjgl.opengl.Display; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedExceptionAction; import java.security.PrivilegedActionException; /** * This class contains utilities for accessing the org.lwjgl.opengl * package through (privileged) reflection. */ final class OpenGLPackageAccess { static final Object global_lock; static { try { global_lock = AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { Field lock_field = Class.forName("org.lwjgl.opengl.GlobalLock").getDeclaredField("lock"); lock_field.setAccessible(true); return lock_field.get(null); } }); } catch (PrivilegedActionException e) { throw new Error(e); } } static InputImplementation createImplementation() { /* Use reflection since we can't make Display.getImplementation * public */ try { return AccessController.doPrivileged(new PrivilegedExceptionAction() { public InputImplementation run() throws Exception { Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation"); getImplementation_method.setAccessible(true); return (InputImplementation)getImplementation_method.invoke(null); } }); } catch (PrivilegedActionException e) { throw new Error(e); } } } lwjgl-2.7.1/src/java/org/lwjgl/input/JInputController.java0000644000175000017500000003050411543426510022620 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.input; import java.util.ArrayList; import net.java.games.input.Component; import net.java.games.input.Component.Identifier.Axis; import net.java.games.input.Component.Identifier.Button; import net.java.games.input.Event; import net.java.games.input.EventQueue; /** * A wrapper round a JInput controller that attempts to make the interface * more useable. * * @author Kevin Glass */ class JInputController implements Controller { /** The JInput controller this class is wrapping */ private net.java.games.input.Controller target; /** The index that has been assigned to this controller */ private int index; /** The Buttons that have been detected on the JInput controller */ private ArrayList buttons = new ArrayList(); /** The Axes that have been detected on the JInput controller */ private ArrayList axes = new ArrayList(); /** The POVs that have been detected on the JInput controller */ private ArrayList pov = new ArrayList(); /** The state of the buttons last check */ private boolean[] buttonState; /** The values that were read from the pov last check */ private float[] povValues; /** The values that were read from the axes last check */ private float[] axesValue; /** The maximum values read for each axis */ private float[] axesMax; /** The dead zones for each axis */ private float[] deadZones; /** The index of the X axis or -1 if no X axis is defined */ private int xaxis = -1; /** The index of the Y axis or -1 if no Y axis is defined */ private int yaxis = -1; /** The index of the X axis or -1 if no Z axis is defined */ private int zaxis = -1; /** The index of the RX axis or -1 if no RX axis is defined */ private int rxaxis = -1; /** The index of the RY axis or -1 if no RY axis is defined */ private int ryaxis = -1; /** The index of the RZ axis or -1 if no RZ axis is defined */ private int rzaxis = -1; /** * Create a new controller that wraps round a JInput controller and hopefully * makes it easier to use. * * @param index The index this controller has been assigned to * @param target The target JInput controller this class is wrapping */ JInputController(int index,net.java.games.input.Controller target) { this.target = target; this.index = index; Component[] sourceAxes = target.getComponents(); for ( Component sourceAxis : sourceAxes ) { if ( sourceAxis.getIdentifier() instanceof Button ) { buttons.add(sourceAxis); } else if ( sourceAxis.getIdentifier().equals(Axis.POV) ) { pov.add(sourceAxis); } else { axes.add(sourceAxis); } } buttonState = new boolean[buttons.size()]; povValues = new float[pov.size()]; axesValue = new float[axes.size()]; int buttonsCount = 0; int axesCount = 0; // initialise the state for ( Component sourceAxis : sourceAxes ) { if ( sourceAxis.getIdentifier() instanceof Button ) { buttonState[buttonsCount] = sourceAxis.getPollData() != 0; buttonsCount++; } else if ( sourceAxis.getIdentifier().equals(Axis.POV) ) { // no account for POV yet // pov.add(sourceAxes[i]); } else { axesValue[axesCount] = sourceAxis.getPollData(); if ( sourceAxis.getIdentifier().equals(Axis.X) ) { xaxis = axesCount; } if ( sourceAxis.getIdentifier().equals(Axis.Y) ) { yaxis = axesCount; } if ( sourceAxis.getIdentifier().equals(Axis.Z) ) { zaxis = axesCount; } if ( sourceAxis.getIdentifier().equals(Axis.RX) ) { rxaxis = axesCount; } if ( sourceAxis.getIdentifier().equals(Axis.RY) ) { ryaxis = axesCount; } if ( sourceAxis.getIdentifier().equals(Axis.RZ) ) { rzaxis = axesCount; } axesCount++; } } axesMax = new float[axes.size()]; deadZones = new float[axes.size()]; for (int i=0;i axesMax[axisIndex]) { axesMax[axisIndex] = Math.abs(value); } // normalize the value based on maximum value read in the past value /= axesMax[axisIndex]; // fire event Controllers.addEvent(new ControllerEvent(this,event.getNanos(),ControllerEvent.AXIS,axisIndex, axisIndex == xaxis,axisIndex == yaxis)); axesValue[axisIndex] = value; } } } /* * @see org.lwjgl.input.Controller#getAxisCount() */ public int getAxisCount() { return axes.size(); } /* * @see org.lwjgl.input.Controller#getAxisName(int) */ public String getAxisName(int index) { return axes.get(index).getName(); } /* * @see org.lwjgl.input.Controller#getAxisValue(int) */ public float getAxisValue(int index) { return axesValue[index]; } /* * @see org.lwjgl.input.Controller#getXAxisValue() */ public float getXAxisValue() { if (xaxis == -1) { return 0; } return getAxisValue(xaxis); } /* * @see org.lwjgl.input.Controller#getYAxisValue() */ public float getYAxisValue() { if (yaxis == -1) { return 0; } return getAxisValue(yaxis); } /* * @see org.lwjgl.input.Controller#getXAxisDeadZone() */ public float getXAxisDeadZone() { if (xaxis == -1) { return 0; } return getDeadZone(xaxis); } /* * @see org.lwjgl.input.Controller#getYAxisDeadZone() */ public float getYAxisDeadZone() { if (yaxis == -1) { return 0; } return getDeadZone(yaxis); } /* * @see org.lwjgl.input.Controller#setXAxisDeadZone(float) */ public void setXAxisDeadZone(float zone) { setDeadZone(xaxis,zone); } /* * @see org.lwjgl.input.Controller#setYAxisDeadZone(float) */ public void setYAxisDeadZone(float zone) { setDeadZone(yaxis,zone); } /* * @see org.lwjgl.input.Controller#getDeadZone(int) */ public float getDeadZone(int index) { return deadZones[index]; } /* * @see org.lwjgl.input.Controller#setDeadZone(int, float) */ public void setDeadZone(int index, float zone) { deadZones[index] = zone; } /* * @see org.lwjgl.input.Controller#getZAxisValue() */ public float getZAxisValue() { if (zaxis == -1) { return 0; } return getAxisValue(zaxis); } /* * @see org.lwjgl.input.Controller#getZAxisDeadZone() */ public float getZAxisDeadZone() { if (zaxis == -1) { return 0; } return getDeadZone(zaxis); } /* * @see org.lwjgl.input.Controller#setZAxisDeadZone(float) */ public void setZAxisDeadZone(float zone) { setDeadZone(zaxis,zone); } /* * @see org.lwjgl.input.Controller#getRXAxisValue() */ public float getRXAxisValue() { if (rxaxis == -1) { return 0; } return getAxisValue(rxaxis); } /* * @see org.lwjgl.input.Controller#getRXAxisDeadZone() */ public float getRXAxisDeadZone() { if (rxaxis == -1) { return 0; } return getDeadZone(rxaxis); } /* * @see org.lwjgl.input.Controller#setRXAxisDeadZone(float) */ public void setRXAxisDeadZone(float zone) { setDeadZone(rxaxis,zone); } /* * @see org.lwjgl.input.Controller#getRYAxisValue() */ public float getRYAxisValue() { if (ryaxis == -1) { return 0; } return getAxisValue(ryaxis); } /* * @see org.lwjgl.input.Controller#getRYAxisDeadZone() */ public float getRYAxisDeadZone() { if (ryaxis == -1) { return 0; } return getDeadZone(ryaxis); } /* * @see org.lwjgl.input.Controller#setRYAxisDeadZone(float) */ public void setRYAxisDeadZone(float zone) { setDeadZone(ryaxis,zone); } /* * @see org.lwjgl.input.Controller#getRZAxisValue() */ public float getRZAxisValue() { if (rzaxis == -1) { return 0; } return getAxisValue(rzaxis); } /* * @see org.lwjgl.input.Controller#getRZAxisDeadZone() */ public float getRZAxisDeadZone() { if (rzaxis == -1) { return 0; } return getDeadZone(rzaxis); } /* * @see org.lwjgl.input.Controller#setRZAxisDeadZone(float) */ public void setRZAxisDeadZone(float zone) { setDeadZone(rzaxis,zone); } /* * @see org.lwjgl.input.Controller#getPovX() */ public float getPovX() { if (pov.size() == 0) { return 0; } float value = povValues[0]; if ((value == Component.POV.DOWN_LEFT) || (value == Component.POV.UP_LEFT) || (value == Component.POV.LEFT)) { return -1; } if ((value == Component.POV.DOWN_RIGHT) || (value == Component.POV.UP_RIGHT) || (value == Component.POV.RIGHT)) { return 1; } return 0; } /* * @see org.lwjgl.input.Controller#getPovY() */ public float getPovY() { if (pov.size() == 0) { return 0; } float value = povValues[0]; if ((value == Component.POV.DOWN_LEFT) || (value == Component.POV.DOWN_RIGHT) || (value == Component.POV.DOWN)) { return 1; } if ((value == Component.POV.UP_LEFT) || (value == Component.POV.UP_RIGHT) || (value == Component.POV.UP)) { return -1; } return 0; } } lwjgl-2.7.1/src/java/org/lwjgl/input/Cursor.java0000644000175000017500000002675111543426510020631 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.input; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.NondirectBufferWrapper; import org.lwjgl.Sys; /** * * A class representing a native cursor. Instances of this * class can be used with Mouse.setCursor(), if available. * * @author elias_naur * @version $Revision: 3418 $ * $Id: Cursor.java 3418 2010-09-28 21:11:35Z spasi $ */ public class Cursor { /** 1 bit transparency for native cursor */ public static final int CURSOR_ONE_BIT_TRANSPARENCY = 1; /** 8 bit alhpa native cursor */ public static final int CURSOR_8_BIT_ALPHA = 2; /** animation native cursor */ public static final int CURSOR_ANIMATION = 4; /** First element to display */ private final CursorElement[] cursors; /** Index into list of cursors */ private int index; private boolean destroyed; /** * Constructs a new Cursor, with the given parameters. Mouse must have been created before you can create * Cursor objects. Cursor images are in ARGB format, but only one bit transparancy is guaranteed to be supported. * So to maximize portability, lwjgl applications should only create cursor images with 0x00 or 0xff as alpha values. * The constructor will copy the images and delays, so there's no need to keep them around. * * @param width cursor image width * @param height cursor image height * @param xHotspot the x coordinate of the cursor hotspot * @param yHotspot the y coordinate of the cursor hotspot * @param numImages number of cursor images specified. Must be 1 if animations are not supported. * @param images A buffer containing the images. The origin is at the lower left corner, like OpenGL. * @param delays An int buffer of animation frame delays, if numImages is greater than 1, else null * @throws LWJGLException if the cursor could not be created for any reason */ public Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException { synchronized (OpenGLPackageAccess.global_lock) { if ((getCapabilities() & CURSOR_ONE_BIT_TRANSPARENCY) == 0) throw new LWJGLException("Native cursors not supported"); images = NondirectBufferWrapper.wrapBuffer(images, width*height*numImages); if (delays != null) delays = NondirectBufferWrapper.wrapBuffer(delays, numImages); if (!Mouse.isCreated()) throw new IllegalStateException("Mouse must be created before creating cursor objects"); if (width*height*numImages > images.remaining()) throw new IllegalArgumentException("width*height*numImages > images.remaining()"); if (xHotspot >= width || xHotspot < 0) throw new IllegalArgumentException("xHotspot > width || xHotspot < 0"); if (yHotspot >= height || yHotspot < 0) throw new IllegalArgumentException("yHotspot > height || yHotspot < 0"); Sys.initialize(); // Hmm yHotspot = height - 1 - yHotspot; // create cursor (or cursors if multiple images supplied) cursors = createCursors(width, height, xHotspot, yHotspot, numImages, images, delays); } } /** * Gets the minimum size of a native cursor. Can only be called if * The Mouse is created and cursor caps includes at least * CURSOR_ONE_BIT_TRANSPARANCY. * * @return the maximum size of a native cursor */ public static int getMinCursorSize() { synchronized (OpenGLPackageAccess.global_lock) { if (!Mouse.isCreated()) throw new IllegalStateException("Mouse must be created."); return Mouse.getImplementation().getMinCursorSize(); } } /** * Gets the maximum size of a native cursor. Can only be called if * The Mouse is created and cursor caps includes at least * CURSOR_ONE_BIT_TRANSPARANCY. * * @return the maximum size of a native cursor */ public static int getMaxCursorSize() { synchronized (OpenGLPackageAccess.global_lock) { if (!Mouse.isCreated()) throw new IllegalStateException("Mouse must be created."); return Mouse.getImplementation().getMaxCursorSize(); } } /** * Get the capabilities of the native cursor. Return a bit mask of the native cursor capabilities. * The CURSOR_ONE_BIT_TRANSPARANCY indicates support for cursors with one bit transparancy, * the CURSOR_8_BIT_ALPHA indicates support for 8 bit alpha and CURSOR_ANIMATION indicates * support for cursor animations. * * @return A bit mask with native cursor capabilities. */ public static int getCapabilities() { synchronized (OpenGLPackageAccess.global_lock) { if (Mouse.getImplementation() != null) return Mouse.getImplementation().getNativeCursorCapabilities(); else return OpenGLPackageAccess.createImplementation().getNativeCursorCapabilities(); } } /** * Creates the actual cursor, using a platform specific class */ private static CursorElement[] createCursors(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException { // create copy and flip images to match ogl IntBuffer images_copy = BufferUtils.createIntBuffer(images.remaining()); flipImages(width, height, numImages, images, images_copy); // Win32 doesn't (afaik) allow for animation based cursors, except when they're // in the .ani format, which we don't support. // The cursor animation was therefor developed using java side time tracking. // unfortunately X flickers when changing cursor. We therefore check for either // Win32 or X and do accordingly. This hasn't been implemented on Mac, but we // might want to split it into a X/Win/Mac cursor if it gets too cluttered CursorElement[] cursors; switch (LWJGLUtil.getPlatform()) { case LWJGLUtil.PLATFORM_MACOSX: /* Fall through */ case LWJGLUtil.PLATFORM_WINDOWS: // create our cursor elements cursors = new CursorElement[numImages]; for(int i=0; i> 24 & 0xff; if(alpha != 0xff) { images_copy.put(index, 0); } } Object handle = Mouse.getImplementation().createCursor(width, height, xHotspot, yHotspot, 1, images_copy, null); long delay = (delays != null) ? delays.get(i) : 0; long timeout = System.currentTimeMillis(); cursors[i] = new CursorElement(handle, delay, timeout); // offset to next image images_copy.position(width*height*(i+1)); } break; case LWJGLUtil.PLATFORM_LINUX: // create our cursor elements Object handle = Mouse.getImplementation().createCursor(width, height, xHotspot, yHotspot, numImages, images_copy, delays); CursorElement cursor_element = new CursorElement(handle, -1, -1); cursors = new CursorElement[]{cursor_element}; break; default: throw new RuntimeException("Unknown OS"); } return cursors; } /** * Flips the images so they're oriented according to opengl * * @param width Width of image * @param height Height of images * @param numImages How many images to flip * @param images Source images * @param images_copy Destination images */ private static void flipImages(int width, int height, int numImages, IntBuffer images, IntBuffer images_copy) { for (int i = 0; i < numImages; i++) { int start_index = i*width*height; flipImage(width, height, start_index, images, images_copy); } } /** * @param width Width of image * @param height Height of images * @param start_index index into source buffer to copy to * @param images Source images * @param images_copy Destination images */ private static void flipImage(int width, int height, int start_index, IntBuffer images, IntBuffer images_copy) { for (int y = 0; y < height>>1; y++) { int index_y_1 = y*width + start_index; int index_y_2 = (height - y - 1)*width + start_index; for (int x = 0; x < width; x++) { int index1 = index_y_1 + x; int index2 = index_y_2 + x; int temp_pixel = images.get(index1 + images.position()); images_copy.put(index1, images.get(index2 + images.position())); images_copy.put(index2, temp_pixel); } } } /** * Gets the native handle associated with the cursor object. */ Object getHandle() { checkValid(); return cursors[index].cursorHandle; } private void checkValid() { if (destroyed) throw new IllegalStateException("The cursor is destroyed"); } /** * Destroy the native cursor. If the cursor is current, * the current native cursor is set to null (the default * OS cursor) */ public void destroy() { synchronized (OpenGLPackageAccess.global_lock) { if (destroyed) return; if (Mouse.getNativeCursor() == this) { try { Mouse.setNativeCursor(null); } catch (LWJGLException e) { // ignore } } for ( CursorElement cursor : cursors ) { Mouse.getImplementation().destroyCursor(cursor.cursorHandle); } destroyed = true; } } /** * Sets the timout property to the time it should be changed */ protected void setTimeout() { checkValid(); cursors[index].timeout = System.currentTimeMillis() + cursors[index].delay; } /** * Determines whether this cursor has timed out * @return true if the this cursor has timed out, false if not */ protected boolean hasTimedOut() { checkValid(); return cursors.length > 1 && cursors[index].timeout < System.currentTimeMillis(); } /** * Changes to the next cursor */ protected void nextCursor() { checkValid(); index = ++index % cursors.length; } /** * A single cursor element, used when animating */ private static class CursorElement { /** Handle to cursor */ final Object cursorHandle; /** How long a delay this element should have */ final long delay; /** Absolute time this element times out */ long timeout; CursorElement(Object cursorHandle, long delay, long timeout) { this.cursorHandle = cursorHandle; this.delay = delay; this.timeout = timeout; } } } lwjgl-2.7.1/src/java/org/lwjgl/input/Keyboard.java0000644000175000017500000005317611543426510021115 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.input; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.InputImplementation; /** *
      * A raw Keyboard interface. This can be used to poll the current state of the * keys, or read all the keyboard presses / releases since the last read. * * @author cix_foo * @author elias_naur * @author Brian Matzon * @version $Revision: 3463 $ * $Id: Keyboard.java 3463 2010-12-15 18:48:56Z kappa1 $ */ public class Keyboard { /** Internal use - event size in bytes */ public static final int EVENT_SIZE = 4 + 1 + 4 + 8 + 1; /** * The special character meaning that no * character was translated for the event. */ public static final int CHAR_NONE = '\0'; /** * The special keycode meaning that only the * translated character is valid. */ public static final int KEY_NONE = 0x00; public static final int KEY_ESCAPE = 0x01; public static final int KEY_1 = 0x02; public static final int KEY_2 = 0x03; public static final int KEY_3 = 0x04; public static final int KEY_4 = 0x05; public static final int KEY_5 = 0x06; public static final int KEY_6 = 0x07; public static final int KEY_7 = 0x08; public static final int KEY_8 = 0x09; public static final int KEY_9 = 0x0A; public static final int KEY_0 = 0x0B; public static final int KEY_MINUS = 0x0C; /* - on main keyboard */ public static final int KEY_EQUALS = 0x0D; public static final int KEY_BACK = 0x0E; /* backspace */ public static final int KEY_TAB = 0x0F; public static final int KEY_Q = 0x10; public static final int KEY_W = 0x11; public static final int KEY_E = 0x12; public static final int KEY_R = 0x13; public static final int KEY_T = 0x14; public static final int KEY_Y = 0x15; public static final int KEY_U = 0x16; public static final int KEY_I = 0x17; public static final int KEY_O = 0x18; public static final int KEY_P = 0x19; public static final int KEY_LBRACKET = 0x1A; public static final int KEY_RBRACKET = 0x1B; public static final int KEY_RETURN = 0x1C; /* Enter on main keyboard */ public static final int KEY_LCONTROL = 0x1D; public static final int KEY_A = 0x1E; public static final int KEY_S = 0x1F; public static final int KEY_D = 0x20; public static final int KEY_F = 0x21; public static final int KEY_G = 0x22; public static final int KEY_H = 0x23; public static final int KEY_J = 0x24; public static final int KEY_K = 0x25; public static final int KEY_L = 0x26; public static final int KEY_SEMICOLON = 0x27; public static final int KEY_APOSTROPHE = 0x28; public static final int KEY_GRAVE = 0x29; /* accent grave */ public static final int KEY_LSHIFT = 0x2A; public static final int KEY_BACKSLASH = 0x2B; public static final int KEY_Z = 0x2C; public static final int KEY_X = 0x2D; public static final int KEY_C = 0x2E; public static final int KEY_V = 0x2F; public static final int KEY_B = 0x30; public static final int KEY_N = 0x31; public static final int KEY_M = 0x32; public static final int KEY_COMMA = 0x33; public static final int KEY_PERIOD = 0x34; /* . on main keyboard */ public static final int KEY_SLASH = 0x35; /* / on main keyboard */ public static final int KEY_RSHIFT = 0x36; public static final int KEY_MULTIPLY = 0x37; /* * on numeric keypad */ public static final int KEY_LMENU = 0x38; /* left Alt */ public static final int KEY_SPACE = 0x39; public static final int KEY_CAPITAL = 0x3A; public static final int KEY_F1 = 0x3B; public static final int KEY_F2 = 0x3C; public static final int KEY_F3 = 0x3D; public static final int KEY_F4 = 0x3E; public static final int KEY_F5 = 0x3F; public static final int KEY_F6 = 0x40; public static final int KEY_F7 = 0x41; public static final int KEY_F8 = 0x42; public static final int KEY_F9 = 0x43; public static final int KEY_F10 = 0x44; public static final int KEY_NUMLOCK = 0x45; public static final int KEY_SCROLL = 0x46; /* Scroll Lock */ public static final int KEY_NUMPAD7 = 0x47; public static final int KEY_NUMPAD8 = 0x48; public static final int KEY_NUMPAD9 = 0x49; public static final int KEY_SUBTRACT = 0x4A; /* - on numeric keypad */ public static final int KEY_NUMPAD4 = 0x4B; public static final int KEY_NUMPAD5 = 0x4C; public static final int KEY_NUMPAD6 = 0x4D; public static final int KEY_ADD = 0x4E; /* + on numeric keypad */ public static final int KEY_NUMPAD1 = 0x4F; public static final int KEY_NUMPAD2 = 0x50; public static final int KEY_NUMPAD3 = 0x51; public static final int KEY_NUMPAD0 = 0x52; public static final int KEY_DECIMAL = 0x53; /* . on numeric keypad */ public static final int KEY_F11 = 0x57; public static final int KEY_F12 = 0x58; public static final int KEY_F13 = 0x64; /* (NEC PC98) */ public static final int KEY_F14 = 0x65; /* (NEC PC98) */ public static final int KEY_F15 = 0x66; /* (NEC PC98) */ public static final int KEY_KANA = 0x70; /* (Japanese keyboard) */ public static final int KEY_CONVERT = 0x79; /* (Japanese keyboard) */ public static final int KEY_NOCONVERT = 0x7B; /* (Japanese keyboard) */ public static final int KEY_YEN = 0x7D; /* (Japanese keyboard) */ public static final int KEY_NUMPADEQUALS = 0x8D; /* = on numeric keypad (NEC PC98) */ public static final int KEY_CIRCUMFLEX = 0x90; /* (Japanese keyboard) */ public static final int KEY_AT = 0x91; /* (NEC PC98) */ public static final int KEY_COLON = 0x92; /* (NEC PC98) */ public static final int KEY_UNDERLINE = 0x93; /* (NEC PC98) */ public static final int KEY_KANJI = 0x94; /* (Japanese keyboard) */ public static final int KEY_STOP = 0x95; /* (NEC PC98) */ public static final int KEY_AX = 0x96; /* (Japan AX) */ public static final int KEY_UNLABELED = 0x97; /* (J3100) */ public static final int KEY_NUMPADENTER = 0x9C; /* Enter on numeric keypad */ public static final int KEY_RCONTROL = 0x9D; public static final int KEY_NUMPADCOMMA = 0xB3; /* , on numeric keypad (NEC PC98) */ public static final int KEY_DIVIDE = 0xB5; /* / on numeric keypad */ public static final int KEY_SYSRQ = 0xB7; public static final int KEY_RMENU = 0xB8; /* right Alt */ public static final int KEY_PAUSE = 0xC5; /* Pause */ public static final int KEY_HOME = 0xC7; /* Home on arrow keypad */ public static final int KEY_UP = 0xC8; /* UpArrow on arrow keypad */ public static final int KEY_PRIOR = 0xC9; /* PgUp on arrow keypad */ public static final int KEY_LEFT = 0xCB; /* LeftArrow on arrow keypad */ public static final int KEY_RIGHT = 0xCD; /* RightArrow on arrow keypad */ public static final int KEY_END = 0xCF; /* End on arrow keypad */ public static final int KEY_DOWN = 0xD0; /* DownArrow on arrow keypad */ public static final int KEY_NEXT = 0xD1; /* PgDn on arrow keypad */ public static final int KEY_INSERT = 0xD2; /* Insert on arrow keypad */ public static final int KEY_DELETE = 0xD3; /* Delete on arrow keypad */ public static final int KEY_LMETA = 0xDB; /* Left Windows/Option key */ /** * The left windows key, mapped to KEY_LMETA * * @deprecated Use KEY_LMETA instead */ public static final int KEY_LWIN = KEY_LMETA; /* Left Windows key */ public static final int KEY_RMETA = 0xDC; /* Right Windows/Option key */ /** * The right windows key, mapped to KEY_RMETA * * @deprecated Use KEY_RMETA instead */ public static final int KEY_RWIN = KEY_RMETA; /* Right Windows key */ public static final int KEY_APPS = 0xDD; /* AppMenu key */ public static final int KEY_POWER = 0xDE; public static final int KEY_SLEEP = 0xDF; /* public static final int STATE_ON = 0; public static final int STATE_OFF = 1; public static final int STATE_UNKNOWN = 2; */ public static final int KEYBOARD_SIZE = 256; /** Buffer size in events */ private static final int BUFFER_SIZE = 50; /** Key names */ private static final String[] keyName = new String[255]; private static final Map keyMap = new HashMap(253); private static int counter; static { // Use reflection to find out key names Field[] fields = Keyboard.class.getFields(); try { for ( Field field : fields ) { if ( Modifier.isStatic(field.getModifiers()) && Modifier.isPublic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) && field.getType().equals(int.class) && field.getName().startsWith("KEY_") ) { int key = field.getInt(null); String name = field.getName().substring(4); keyName[key] = name; keyMap.put(name, key); counter++; } } } catch (Exception e) { } } /** The number of keys supported */ private static final int keyCount = counter; /** Has the keyboard been created? */ private static boolean created; /** Are repeat events enabled? */ private static boolean repeat_enabled; /** The keys status from the last poll */ private static final ByteBuffer keyDownBuffer = BufferUtils.createByteBuffer(KEYBOARD_SIZE); /** * The key events from the last read: a sequence of pairs of key number, * followed by state. The state is followed by * a 4 byte code point representing the translated character. */ private static ByteBuffer readBuffer; /** current event */ private static KeyEvent current_event = new KeyEvent(); /** scratch event */ private static KeyEvent tmp_event = new KeyEvent(); /** One time initialization */ private static boolean initialized; private static InputImplementation implementation; /** * Keyboard cannot be constructed. */ private Keyboard() { } /** * Static initialization */ private static void initialize() { if (initialized) return; Sys.initialize(); initialized = true; } /** * "Create" the keyboard with the given implementation. This is used * reflectively from AWTInputAdapter. * * @throws LWJGLException if the keyboard could not be created for any reason */ private static void create(InputImplementation impl) throws LWJGLException { if (created) return; if (!initialized) initialize(); implementation = impl; implementation.createKeyboard(); created = true; readBuffer = ByteBuffer.allocate(EVENT_SIZE*BUFFER_SIZE); reset(); } /** * "Create" the keyboard. The display must first have been created. The * reason for this is so the keyboard has a window to "focus" in. * * @throws LWJGLException if the keyboard could not be created for any reason */ public static void create() throws LWJGLException { synchronized (OpenGLPackageAccess.global_lock) { if (!Display.isCreated()) throw new IllegalStateException("Display must be created."); create(OpenGLPackageAccess.createImplementation()); } } private static void reset() { readBuffer.limit(0); for (int i = 0; i < keyDownBuffer.remaining(); i++) keyDownBuffer.put(i, (byte)0); current_event.reset(); } /** * @return true if the keyboard has been created */ public static boolean isCreated() { synchronized (OpenGLPackageAccess.global_lock) { return created; } } /** * "Destroy" the keyboard */ public static void destroy() { synchronized (OpenGLPackageAccess.global_lock) { if (!created) return; created = false; implementation.destroyKeyboard(); reset(); } } /** * Polls the keyboard for its current state. Access the polled values using the * isKeyDown method. * By using this method, it is possible to "miss" keyboard keys if you don't * poll fast enough. * * To use buffered values, you have to call next for each event you * want to read. You can query which key caused the event by using * getEventKey. To get the state of that key, for that event, use * getEventKeyState - finally use getEventCharacter to get the * character for that event. * * NOTE: This method does not query the operating system for new events. To do that, * Display.processMessages() (or Display.update()) must be called first. * * @see org.lwjgl.input.Keyboard#isKeyDown(int key) * @see org.lwjgl.input.Keyboard#next() * @see org.lwjgl.input.Keyboard#getEventKey() * @see org.lwjgl.input.Keyboard#getEventKeyState() * @see org.lwjgl.input.Keyboard#getEventCharacter() */ public static void poll() { synchronized (OpenGLPackageAccess.global_lock) { if (!created) throw new IllegalStateException("Keyboard must be created before you can poll the device"); implementation.pollKeyboard(keyDownBuffer); read(); } } private static void read() { readBuffer.compact(); implementation.readKeyboard(readBuffer); readBuffer.flip(); } /** * Checks to see if a key is down. * @param key Keycode to check * @return true if the key is down according to the last poll() */ public static boolean isKeyDown(int key) { synchronized (OpenGLPackageAccess.global_lock) { if (!created) throw new IllegalStateException("Keyboard must be created before you can query key state"); return keyDownBuffer.get(key) != 0; } } /** * Checks whether one of the state keys are "active" * * @param key State key to test (KEY_CAPITAL | KEY_NUMLOCK | KEY_SYSRQ) * @return STATE_ON if on, STATE_OFF if off and STATE_UNKNOWN if the state is unknown */ /* public static int isStateKeySet(int key) { if (!created) throw new IllegalStateException("Keyboard must be created before you can query key state"); return implementation.isStateKeySet(key); } */ /** * Gets a key's name * @param key The key * @return a String with the key's human readable name in it or null if the key is unnamed */ public static synchronized String getKeyName(int key) { return keyName[key]; } /** * Get's a key's index. If the key is unrecognised then KEY_NONE is returned. * @param keyName The key name */ public static synchronized int getKeyIndex(String keyName) { Integer ret = keyMap.get(keyName); if (ret == null) return KEY_NONE; else return ret; } /** * Gets the number of keyboard events waiting after doing a buffer enabled poll(). * @return the number of keyboard events */ public static int getNumKeyboardEvents() { synchronized (OpenGLPackageAccess.global_lock) { if (!created) throw new IllegalStateException("Keyboard must be created before you can read events"); int old_position = readBuffer.position(); int num_events = 0; while (readNext(tmp_event) && (!tmp_event.repeat || repeat_enabled)) num_events++; readBuffer.position(old_position); return num_events; } } /** * Gets the next keyboard event. You can query which key caused the event by using * getEventKey. To get the state of that key, for that event, use * getEventKeyState - finally use getEventCharacter to get the * character for that event. * * @see org.lwjgl.input.Keyboard#getEventKey() * @see org.lwjgl.input.Keyboard#getEventKeyState() * @see org.lwjgl.input.Keyboard#getEventCharacter() * @return true if a keyboard event was read, false otherwise */ public static boolean next() { synchronized (OpenGLPackageAccess.global_lock) { if (!created) throw new IllegalStateException("Keyboard must be created before you can read events"); boolean result; while ((result = readNext(current_event)) && current_event.repeat && !repeat_enabled) ; return result; } } /** * Controls whether repeat events are reported or not. If repeat events * are enabled, key down events are reported when a key is pressed and held for * a OS dependent amount of time. To distinguish a repeat event from a normal event, * use isRepeatEvent(). * * @see org.lwjgl.input.Keyboard#getEventKey() */ public static void enableRepeatEvents(boolean enable) { synchronized (OpenGLPackageAccess.global_lock) { repeat_enabled = enable; } } /** * Check whether repeat events are currently reported or not. * * @return true is repeat events are reported, false if not. * @see org.lwjgl.input.Keyboard#getEventKey() */ public static boolean areRepeatEventsEnabled() { synchronized (OpenGLPackageAccess.global_lock) { return repeat_enabled; } } private static boolean readNext(KeyEvent event) { if (readBuffer.hasRemaining()) { event.key = readBuffer.getInt() & 0xFF; event.state = readBuffer.get() != 0; event.character = readBuffer.getInt(); event.nanos = readBuffer.getLong(); event.repeat = readBuffer.get() == 1; return true; } else return false; } /** * @return Number of keys on this keyboard */ public static int getKeyCount() { return keyCount; } /** * @return The character from the current event */ public static char getEventCharacter() { synchronized (OpenGLPackageAccess.global_lock) { return (char)current_event.character; } } /** * Please note that the key code returned is NOT valid against the * current keyboard layout. To get the actual character pressed call * getEventCharacter * * @return The key from the current event */ public static int getEventKey() { synchronized (OpenGLPackageAccess.global_lock) { return current_event.key; } } /** * Gets the state of the key that generated the * current event * * @return True if key was down, or false if released */ public static boolean getEventKeyState() { synchronized (OpenGLPackageAccess.global_lock) { return current_event.state; } } /** * Gets the time in nanoseconds of the current event. * Only useful for relative comparisons with other * Keyboard events, as the absolute time has no defined * origin. * @return The time in nanoseconds of the current event */ public static long getEventNanoseconds() { synchronized (OpenGLPackageAccess.global_lock) { return current_event.nanos; } } /** * @see org.lwjgl.input.Keyboard#enableRepeatEvents(boolean) * @return true if the current event is a repeat event, false if * the current event is not a repeat even or if repeat events are disabled. */ public static boolean isRepeatEvent() { synchronized (OpenGLPackageAccess.global_lock) { return current_event.repeat; } } private static final class KeyEvent { /** The current keyboard character being examined */ private int character; /** The current keyboard event key being examined */ private int key; /** The current state of the key being examined in the event queue */ private boolean state; /** The current event time */ private long nanos; /** Is the current event a repeated event? */ private boolean repeat; private void reset() { character = 0; key = 0; state = false; repeat = false; } } } lwjgl-2.7.1/src/java/org/lwjgl/input/Controllers.java0000644000175000017500000001643111543426510021654 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.input; import java.util.ArrayList; import net.java.games.input.ControllerEnvironment; import org.lwjgl.LWJGLException; /** * The collection of controllers currently connected. * * @author Kevin Glass */ public class Controllers { /** The controllers available */ private static ArrayList controllers = new ArrayList(); /** The number of controllers */ private static int controllerCount; /** The current list of events */ private static ArrayList events = new ArrayList(); /** The current event */ private static ControllerEvent event; /** Whether controllers were created */ private static boolean created; /** * Initialise the controllers collection * * @throws LWJGLException Indicates a failure to initialise the controller library. */ public static void create() throws LWJGLException { if (created) return; try { ControllerEnvironment env = ControllerEnvironment.getDefaultEnvironment(); net.java.games.input.Controller[] found = env.getControllers(); ArrayList lollers = new ArrayList(); for ( net.java.games.input.Controller c : found ) { if ( (!c.getType().equals(net.java.games.input.Controller.Type.KEYBOARD)) && (!c.getType().equals(net.java.games.input.Controller.Type.MOUSE)) ) { lollers.add(c); } } for ( net.java.games.input.Controller c : lollers ) { createController(c); } created = true; } catch (Throwable e) { throw new LWJGLException("Failed to initialise controllers",e); } } /** * Utility to create a controller based on its potential sub-controllers * * @param c The controller to add */ private static void createController(net.java.games.input.Controller c) { net.java.games.input.Controller[] subControllers = c.getControllers(); if (subControllers.length == 0) { JInputController controller = new JInputController(controllerCount,c); controllers.add(controller); controllerCount++; } else { for ( net.java.games.input.Controller sub : subControllers ) { createController(sub); } } } /** * Get a controller from the collection * * @param index The index of the controller to retrieve * @return The controller requested */ public static Controller getController(int index) { return controllers.get(index); } /** * Retrieve a count of the number of controllers * * @return The number of controllers available */ public static int getControllerCount() { return controllers.size(); } /** * Poll the controllers available. This will both update their state * and generate events that must be cleared. */ public static void poll() { for (int i=0;i * A raw Mouse interface. This can be used to poll the current state of the * mouse buttons, and determine the mouse movement delta since the last poll. * * n buttons supported, n being a native limit. A scrolly wheel is also * supported, if one such is available. Movement is reported as delta from * last position or as an absolute position. If the window has been created * the absolute position will be clamped to 0 - width | height. * * @author cix_foo * @author elias_naur * @author Brian Matzon * @version $Revision: 3418 $ * $Id: Mouse.java 3418 2010-09-28 21:11:35Z spasi $ */ public class Mouse { /** Internal use - event size in bytes */ public static final int EVENT_SIZE = 1 + 1 + 4 + 4 + 4 + 8; /** Has the mouse been created? */ private static boolean created; /** The mouse buttons status from the last poll */ private static ByteBuffer buttons; /** Mouse absolute X position in pixels */ private static int x; /** Mouse absolute Y position in pixels */ private static int y; /** Buffer to hold the deltas dx, dy and dwheel */ private static IntBuffer coord_buffer; /** Delta X */ private static int dx; /** Delta Y */ private static int dy; /** Delta Z */ private static int dwheel; /** Number of buttons supported by the mouse */ private static int buttonCount = -1; /** Does this mouse support a scroll wheel */ private static boolean hasWheel; /** The current native cursor, if any */ private static Cursor currentCursor; /** Button names. These are set upon create(), to names like BUTTON0, BUTTON1, etc. */ private static String[] buttonName; /** hashmap of button names, for fast lookup */ private static final Map buttonMap = new HashMap(16); /** Lazy initialization */ private static boolean initialized; /** The mouse button events from the last read */ private static ByteBuffer readBuffer; /** The current mouse event button being examined */ private static int eventButton; /** The current state of the button being examined in the event queue */ private static boolean eventState; /** The current delta of the mouse in the event queue */ private static int event_dx; private static int event_dy; private static int event_dwheel; /** The current absolute position of the mouse in the event queue */ private static int event_x; private static int event_y; private static long event_nanos; /** The position of the mouse it was grabbed at */ private static int grab_x; private static int grab_y; /** Buffer size in events */ private static final int BUFFER_SIZE = 50; private static boolean isGrabbed; private static InputImplementation implementation; /** Whether we need cursor animation emulation */ private static final boolean emulateCursorAnimation = LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_WINDOWS || LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX; private static final boolean allowNegativeMouseCoords = getPrivilegedBoolean("org.lwjgl.input.Mouse.allowNegativeMouseCoords"); /** * Mouse cannot be constructed. */ private Mouse() { } /** * Gets the currently bound native cursor, if any. * * @return the currently bound native cursor, if any. */ public static Cursor getNativeCursor() { synchronized (OpenGLPackageAccess.global_lock) { return currentCursor; } } /** * Binds a native cursor. If the cursor argument is null, any * currently bound native cursor is disabled, and the cursor reverts * to the default operating system supplied cursor. * * NOTE: The native cursor is not constrained to the window, but * relative events will not be generated if the cursor is outside. * * @param cursor the native cursor object to bind. May be null. * @return The previous Cursor object set, or null. * @throws LWJGLException if the cursor could not be set for any reason */ public static Cursor setNativeCursor(Cursor cursor) throws LWJGLException { synchronized (OpenGLPackageAccess.global_lock) { if ((Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) == 0) throw new IllegalStateException("Mouse doesn't support native cursors"); Cursor oldCursor = currentCursor; currentCursor = cursor; if (isCreated()) { if (currentCursor != null) { implementation.setNativeCursor(currentCursor.getHandle()); currentCursor.setTimeout(); } else { implementation.setNativeCursor(null); } } return oldCursor; } } /** * Set the position of the cursor. If the cursor is not grabbed, * the native cursor is moved to the new position. * * @param new_x The x coordinate of the new cursor position in OpenGL coordinates relative * to the window origin. * @param new_y The y coordinate of the new cursor position in OpenGL coordinates relative * to the window origin. */ public static void setCursorPosition(int new_x, int new_y) { synchronized (OpenGLPackageAccess.global_lock) { if (!isCreated()) throw new IllegalStateException("Mouse is not created"); x = event_x = new_x; y = event_y = new_y; if (!isGrabbed() && (Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0) { implementation.setCursorPosition(x, y); } else { grab_x = new_x; grab_y = new_y; } } } /** * Static initialization */ private static void initialize() { Sys.initialize(); // Assign names to all the buttons buttonName = new String[16]; for (int i = 0; i < 16; i++) { buttonName[i] = "BUTTON" + i; buttonMap.put(buttonName[i], i); } initialized = true; } private static void resetMouse() { dx = dy = dwheel = 0; readBuffer.position(readBuffer.limit()); } static InputImplementation getImplementation() { return implementation; } /** * "Create" the mouse with the given custom implementation. This is used * reflectively by AWTInputAdapter. * * @throws LWJGLException if the mouse could not be created for any reason */ private static void create(InputImplementation impl) throws LWJGLException { if (created) return; if (!initialized) initialize(); implementation = impl; implementation.createMouse(); hasWheel = implementation.hasWheel(); created = true; // set mouse buttons buttonCount = implementation.getButtonCount(); buttons = BufferUtils.createByteBuffer(buttonCount); coord_buffer = BufferUtils.createIntBuffer(3); if (currentCursor != null && implementation.getNativeCursorCapabilities() != 0) setNativeCursor(currentCursor); readBuffer = ByteBuffer.allocate(EVENT_SIZE * BUFFER_SIZE); readBuffer.limit(0); setGrabbed(isGrabbed); } /** * "Create" the mouse. The display must first have been created. * Initially, the mouse is not grabbed and the delta values are reported * with respect to the center of the display. * * @throws LWJGLException if the mouse could not be created for any reason */ public static void create() throws LWJGLException { synchronized (OpenGLPackageAccess.global_lock) { if (!Display.isCreated()) throw new IllegalStateException("Display must be created."); create(OpenGLPackageAccess.createImplementation()); } } /** * @return true if the mouse has been created */ public static boolean isCreated() { synchronized (OpenGLPackageAccess.global_lock) { return created; } } /** * "Destroy" the mouse. */ public static void destroy() { synchronized (OpenGLPackageAccess.global_lock) { if (!created) return; created = false; buttons = null; coord_buffer = null; implementation.destroyMouse(); } } /** * Polls the mouse for its current state. Access the polled values using the * get methods. * By using this method, it is possible to "miss" mouse click events if you don't * poll fast enough. * * To use buffered values, you have to call next for each event you * want to read. You can query which button caused the event by using * getEventButton. To get the state of that button, for that event, use * getEventButtonState. * * NOTE: This method does not query the operating system for new events. To do that, * Display.processMessages() (or Display.update()) must be called first. * * @see org.lwjgl.input.Mouse#next() * @see org.lwjgl.input.Mouse#getEventButton() * @see org.lwjgl.input.Mouse#getEventButtonState() * @see org.lwjgl.input.Mouse#isButtonDown(int button) * @see org.lwjgl.input.Mouse#getX() * @see org.lwjgl.input.Mouse#getY() * @see org.lwjgl.input.Mouse#getDX() * @see org.lwjgl.input.Mouse#getDY() * @see org.lwjgl.input.Mouse#getDWheel() */ public static void poll() { synchronized (OpenGLPackageAccess.global_lock) { if (!created) throw new IllegalStateException("Mouse must be created before you can poll it"); implementation.pollMouse(coord_buffer, buttons); /* If we're grabbed, poll returns mouse deltas, if not it returns absolute coordinates */ int poll_coord1 = coord_buffer.get(0); int poll_coord2 = coord_buffer.get(1); /* The wheel is always relative */ int poll_dwheel = coord_buffer.get(2); if (isGrabbed()) { dx += poll_coord1; dy += poll_coord2; x += poll_coord1; y += poll_coord2; } else { dx = poll_coord1 - x; dy = poll_coord2 - y; x = poll_coord1; y = poll_coord2; } if(!allowNegativeMouseCoords) { x = Math.min(implementation.getWidth() - 1, Math.max(0, x)); y = Math.min(implementation.getHeight() - 1, Math.max(0, y)); } dwheel += poll_dwheel; read(); } } private static void read() { readBuffer.compact(); implementation.readMouse(readBuffer); readBuffer.flip(); } /** * See if a particular mouse button is down. * * @param button The index of the button you wish to test (0..getButtonCount-1) * @return true if the specified button is down */ public static boolean isButtonDown(int button) { synchronized (OpenGLPackageAccess.global_lock) { if (!created) throw new IllegalStateException("Mouse must be created before you can poll the button state"); if (button >= buttonCount || button < 0) return false; else return buttons.get(button) == 1; } } /** * Gets a button's name * @param button The button * @return a String with the button's human readable name in it or null if the button is unnamed */ public static String getButtonName(int button) { synchronized (OpenGLPackageAccess.global_lock) { if (button >= buttonName.length || button < 0) return null; else return buttonName[button]; } } /** * Get's a button's index. If the button is unrecognised then -1 is returned. * @param buttonName The button name */ public static int getButtonIndex(String buttonName) { synchronized (OpenGLPackageAccess.global_lock) { Integer ret = buttonMap.get(buttonName); if (ret == null) return -1; else return ret; } } /** * Gets the next mouse event. You can query which button caused the event by using * getEventButton() (if any). To get the state of that key, for that event, use * getEventButtonState. To get the current mouse delta values use getEventDX(), * getEventDY() and getEventDZ(). * @see org.lwjgl.input.Mouse#getEventButton() * @see org.lwjgl.input.Mouse#getEventButtonState() * @return true if a mouse event was read, false otherwise */ public static boolean next() { synchronized (OpenGLPackageAccess.global_lock) { if (!created) throw new IllegalStateException("Mouse must be created before you can read events"); if (readBuffer.hasRemaining()) { eventButton = readBuffer.get(); eventState = readBuffer.get() != 0; if (isGrabbed()) { event_dx = readBuffer.getInt(); event_dy = readBuffer.getInt(); event_x += event_dx; event_y += event_dy; } else { int new_event_x = readBuffer.getInt(); int new_event_y = readBuffer.getInt(); event_dx = new_event_x - event_x; event_dy = new_event_y - event_y; event_x = new_event_x; event_y = new_event_y; } event_x = Math.min(implementation.getWidth() - 1, Math.max(0, event_x)); event_y = Math.min(implementation.getHeight() - 1, Math.max(0, event_y)); event_dwheel = readBuffer.getInt(); event_nanos = readBuffer.getLong(); return true; } else return false; } } /** * @return Current events button. Returns -1 if no button state was changed */ public static int getEventButton() { synchronized (OpenGLPackageAccess.global_lock) { return eventButton; } } /** * Get the current events button state. * @return Current events button state. */ public static boolean getEventButtonState() { synchronized (OpenGLPackageAccess.global_lock) { return eventState; } } /** * @return Current events delta x. */ public static int getEventDX() { synchronized (OpenGLPackageAccess.global_lock) { return event_dx; } } /** * @return Current events delta y. */ public static int getEventDY() { synchronized (OpenGLPackageAccess.global_lock) { return event_dy; } } /** * @return Current events absolute x. */ public static int getEventX() { synchronized (OpenGLPackageAccess.global_lock) { return event_x; } } /** * @return Current events absolute y. */ public static int getEventY() { synchronized (OpenGLPackageAccess.global_lock) { return event_y; } } /** * @return Current events delta z */ public static int getEventDWheel() { synchronized (OpenGLPackageAccess.global_lock) { return event_dwheel; } } /** * Gets the time in nanoseconds of the current event. * Only useful for relative comparisons with other * Mouse events, as the absolute time has no defined * origin. * * @return The time in nanoseconds of the current event */ public static long getEventNanoseconds() { synchronized (OpenGLPackageAccess.global_lock) { return event_nanos; } } /** * Retrieves the absolute position. It will be clamped to * 0...width-1. * * @return Absolute x axis position of mouse */ public static int getX() { synchronized (OpenGLPackageAccess.global_lock) { return x; } } /** * Retrieves the absolute position. It will be clamped to * 0...height-1. * * @return Absolute y axis position of mouse */ public static int getY() { synchronized (OpenGLPackageAccess.global_lock) { return y; } } /** * @return Movement on the x axis since last time getDX() was called. */ public static int getDX() { synchronized (OpenGLPackageAccess.global_lock) { int result = dx; dx = 0; return result; } } /** * @return Movement on the y axis since last time getDY() was called. */ public static int getDY() { synchronized (OpenGLPackageAccess.global_lock) { int result = dy; dy = 0; return result; } } /** * @return Movement of the wheel since last time getDWheel() was called */ public static int getDWheel() { synchronized (OpenGLPackageAccess.global_lock) { int result = dwheel; dwheel = 0; return result; } } /** * @return Number of buttons on this mouse */ public static int getButtonCount() { synchronized (OpenGLPackageAccess.global_lock) { return buttonCount; } } /** * @return Whether or not this mouse has wheel support */ public static boolean hasWheel() { synchronized (OpenGLPackageAccess.global_lock) { return hasWheel; } } /** * @return whether or not the mouse has grabbed the cursor */ public static boolean isGrabbed() { synchronized (OpenGLPackageAccess.global_lock) { return isGrabbed; } } /** * Sets whether or not the mouse has grabbed the cursor * (and thus hidden). If grab is false, the getX() and getY() * will return delta movement in pixels clamped to the display * dimensions, from the center of the display. * * @param grab whether the mouse should be grabbed */ public static void setGrabbed(boolean grab) { synchronized (OpenGLPackageAccess.global_lock) { boolean grabbed = isGrabbed; isGrabbed = grab; if (isCreated()) { if (grab && !grabbed) { // store location mouse was grabbed grab_x = x; grab_y = y; } else if (!grab && grabbed) { // move mouse back to location it was grabbed before ungrabbing if ((Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0) implementation.setCursorPosition(grab_x, grab_y); } implementation.grabMouse(grab); // Get latest values from native side poll(); event_x = x; event_y = y; resetMouse(); } } } /** * Updates the cursor, so that animation can be changed if needed. * This method is called automatically by the window on its update, and * shouldn't be called otherwise */ public static void updateCursor() { synchronized (OpenGLPackageAccess.global_lock) { if (emulateCursorAnimation && currentCursor != null && currentCursor.hasTimedOut() && Mouse.isInsideWindow()) { currentCursor.nextCursor(); try { setNativeCursor(currentCursor); } catch (LWJGLException e) { if (LWJGLUtil.DEBUG) e.printStackTrace(); } } } } /** Gets a boolean property as a privileged action. */ static boolean getPrivilegedBoolean(final String property_name) { Boolean value = AccessController.doPrivileged(new PrivilegedAction() { public Boolean run() { return Boolean.getBoolean(property_name); } }); return value; } /** * Retrieves whether or not the mouse cursor is within the bounds of the window. * If the mouse cursor was moved outside the display during a drag, then the result of calling * this method will be true until the button is released. * @return true if mouse is inside display, false otherwise. */ public static boolean isInsideWindow() { return implementation.isInsideWindow(); } } lwjgl-2.7.1/src/java/org/lwjgl/input/Controller.java0000644000175000017500000001564011543426510021472 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.input; /** * A game controller of some sort that will provide input. The controller * presents buttons and axes. Buttons are either pressed or not pressed. Axis * provide analogue values. * * @author Kevin Glass */ public interface Controller { /** * Get the name assigned to this controller. * * @return The name assigned to this controller */ String getName(); /** * Get the index of this controller in the collection * * @return The index of this controller in the collection */ int getIndex(); /** * Retrieve the number of buttons available on this controller * * @return The number of butotns available on this controller */ int getButtonCount(); /** * Get the name of the specified button. Be warned, often this is * as exciting as "Button X" * * @param index The index of the button whose name should be retrieved * @return The name of the button requested */ String getButtonName(int index); /** * Check if a button is currently pressed * * @param index The button to check * @return True if the button is currently pressed */ boolean isButtonPressed(int index); /** * Poll the controller for new data. This will also update * events */ void poll(); /** * Get the X-Axis value of the POV on this controller * * @return The X-Axis value of the POV on this controller */ float getPovX(); /** * Get the Y-Axis value of the POV on this controller * * @return The Y-Axis value of the POV on this controller */ float getPovY(); /** * Get the dead zone for a specified axis * * @param index The index of the axis for which to retrieve the dead zone * @return The dead zone for the specified axis */ float getDeadZone(int index); /** * Set the dead zone for the specified axis * * @param index The index of hte axis for which to set the dead zone * @param zone The dead zone to use for the specified axis */ void setDeadZone(int index,float zone); /** * Retrieve the number of axes available on this controller. * * @return The number of axes available on this controller. */ int getAxisCount(); /** * Get the name that's given to the specified axis * * @param index The index of the axis whose name should be retrieved * @return The name of the specified axis. */ String getAxisName(int index); /** * Retrieve the value thats currently available on a specified axis. The * value will always be between 1.0 and -1.0 and will calibrate as values * are passed read. It may be useful to get the player to wiggle the joystick * from side to side to get the calibration right. * * @param index The index of axis to be read * @return The value from the specified axis. */ float getAxisValue(int index); /** * Get the value from the X axis if there is one. If no X axis is * defined a zero value will be returned. * * @return The value from the X axis */ float getXAxisValue(); /** * Get the dead zone for the X axis. * * @return The dead zone for the X axis */ float getXAxisDeadZone(); /** * Set the dead zone for the X axis * * @param zone The dead zone to use for the X axis */ void setXAxisDeadZone(float zone); /** * Get the value from the Y axis if there is one. If no Y axis is * defined a zero value will be returned. * * @return The value from the Y axis */ float getYAxisValue(); /** * Get the dead zone for the Y axis. * * @return The dead zone for the Y axis */ float getYAxisDeadZone(); /** * Set the dead zone for the Y axis * * @param zone The dead zone to use for the Y axis */ void setYAxisDeadZone(float zone); /** * Get the value from the Z axis if there is one. If no Z axis is * defined a zero value will be returned. * * @return The value from the Z axis */ float getZAxisValue(); /** * Get the dead zone for the Z axis. * * @return The dead zone for the Z axis */ float getZAxisDeadZone(); /** * Set the dead zone for the Z axis * * @param zone The dead zone to use for the Z axis */ void setZAxisDeadZone(float zone); /** * Get the value from the RX axis if there is one. If no RX axis is * defined a zero value will be returned. * * @return The value from the RX axis */ float getRXAxisValue(); /** * Get the dead zone for the RX axis. * * @return The dead zone for the RX axis */ float getRXAxisDeadZone(); /** * Set the dead zone for the RX axis * * @param zone The dead zone to use for the RX axis */ void setRXAxisDeadZone(float zone); /** * Get the value from the RY axis if there is one. If no RY axis is * defined a zero value will be returned. * * @return The value from the RY axis */ float getRYAxisValue(); /** * Get the dead zone for the RY axis. * * @return The dead zone for the RY axis */ float getRYAxisDeadZone(); /** * Set the dead zone for the RY axis * * @param zone The dead zone to use for the RY axis */ void setRYAxisDeadZone(float zone); /** * Get the value from the RZ axis if there is one. If no RZ axis is * defined a zero value will be returned. * * @return The value from the RZ axis */ float getRZAxisValue(); /** * Get the dead zone for the RZ axis. * * @return The dead zone for the RZ axis */ float getRZAxisDeadZone(); /** * Set the dead zone for the RZ axis * * @param zone The dead zone to use for the RZ axis */ void setRZAxisDeadZone(float zone); } lwjgl-2.7.1/src/java/org/lwjgl/J2SESysImplementation.java0000644000175000017500000000545311543426510022321 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl; import javax.swing.JOptionPane; import javax.swing.UIManager; /** * A SysImplementation which delegates as much as it can to J2SE. *

      * @author $Author: matzon $ * @version $Revision: 2983 $ * $Id: J2SESysImplementation.java 2983 2008-04-07 18:36:09Z matzon $ */ abstract class J2SESysImplementation extends DefaultSysImplementation { public long getTime() { return System.currentTimeMillis(); } public void alert(String title, String message) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { LWJGLUtil.log("Caught exception while setting LAF: " + e); } JOptionPane.showMessageDialog(null, message, title, JOptionPane.WARNING_MESSAGE); } public String getClipboard() { try { java.awt.datatransfer.Clipboard clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard(); java.awt.datatransfer.Transferable transferable = clipboard.getContents(null); if (transferable.isDataFlavorSupported(java.awt.datatransfer.DataFlavor.stringFlavor)) { return (String)transferable.getTransferData(java.awt.datatransfer.DataFlavor.stringFlavor); } } catch (Exception e) { LWJGLUtil.log("Exception while getting clipboard: " + e); } return null; } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/0000755000175000017500000000000011543426510016623 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/opengl/InputImplementation.java0000644000175000017500000000712111543426510023474 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * This is the input implementation interface. Mouse and Keyboard delegates * to implementors of this interface. There is one InputImplementation * for each supported platform. * @author elias_naur */ import java.nio.ByteBuffer; import java.nio.IntBuffer; import org.lwjgl.LWJGLException; public interface InputImplementation { /* * Mouse methods */ /** Query of wheel support */ boolean hasWheel(); /** Query of button count */ int getButtonCount(); /** * Method to create the mouse. */ void createMouse() throws LWJGLException; /** * Method the destroy the mouse */ void destroyMouse(); /** * Method to poll the mouse */ void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons); /** * Method to read the keyboard buffer */ void readMouse(ByteBuffer buffer); void grabMouse(boolean grab); /** * Function to determine native cursor support */ int getNativeCursorCapabilities(); /** Method to set the native cursor position */ void setCursorPosition(int x, int y); /** Method to set the native cursor */ void setNativeCursor(Object handle) throws LWJGLException; /** Method returning the minimum cursor size */ int getMinCursorSize(); /** Method returning the maximum cursor size */ int getMaxCursorSize(); /* * Keyboard methods */ /** * Method to create the keyboard */ void createKeyboard() throws LWJGLException; /** * Method to destroy the keyboard */ void destroyKeyboard(); /** * Method to poll the keyboard. * * @param keyDownBuffer the address of a 256-byte buffer to place * key states in. */ void pollKeyboard(ByteBuffer keyDownBuffer); /** * Method to read the keyboard buffer */ void readKeyboard(ByteBuffer buffer); // int isStateKeySet(int key); /** Native cursor handles */ Object createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException; void destroyCursor(Object cursor_handle); int getWidth(); int getHeight(); boolean isInsideWindow(); } lwjgl-2.7.1/src/java/org/lwjgl/opengl/MacOSXFrame.java0000644000175000017500000001462611543426510021544 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * This is the Mac OS X AWT Frame. It contains thread safe * methods to manipulateit from non-AWT threads * @author elias_naur */ import java.awt.BorderLayout; import java.awt.Frame; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.Insets; import java.awt.Rectangle; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import org.lwjgl.LWJGLException; final class MacOSXFrame extends Frame implements WindowListener, ComponentListener { private static final long serialVersionUID = -5823294716668988777L; private final MacOSXGLCanvas canvas; private boolean close_requested; /* States */ private Rectangle bounds; private boolean active; private boolean minimized; private boolean should_warp_cursor; private boolean should_release_cursor; MacOSXFrame(DisplayMode mode, final java.awt.DisplayMode requested_mode, boolean fullscreen, int x, int y) throws LWJGLException { setResizable(false); addWindowListener(this); addComponentListener(this); canvas = new MacOSXGLCanvas(); canvas.setFocusTraversalKeysEnabled(false); add(canvas, BorderLayout.CENTER); boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated"); setUndecorated(fullscreen || undecorated); if ( fullscreen ) { try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { getDevice().setFullScreenWindow(MacOSXFrame.this); getDevice().setDisplayMode(requested_mode); java.awt.DisplayMode real_mode = getDevice().getDisplayMode(); /** For some strange reason, the display mode is sometimes silently capped even though the mode is reported as supported */ if ( requested_mode.getWidth() != real_mode.getWidth() || requested_mode.getHeight() != real_mode.getHeight() ) { getDevice().setFullScreenWindow(null); if (isDisplayable()) dispose(); throw new LWJGLException("AWT capped mode: requested mode = " + requested_mode.getWidth() + "x" + requested_mode.getHeight() + " but got " + real_mode.getWidth() + " " + real_mode.getHeight()); } return null; } }); } catch (PrivilegedActionException e) { throw new LWJGLException(e); } } pack(); resize(x, y, mode.getWidth(), mode.getHeight()); setVisible(true); requestFocus(); canvas.requestFocus(); updateBounds(); } public void resize(int x, int y, int width, int height) { Insets insets = getInsets(); setBounds(x, y, width + insets.left + insets.right, height + insets.top + insets.bottom); } public Rectangle syncGetBounds() { synchronized ( this ) { return bounds; } } public void componentShown(ComponentEvent e) { } public void componentHidden(ComponentEvent e) { } private void updateBounds() { synchronized ( this ) { bounds = getBounds(); } } public void componentResized(ComponentEvent e) { updateBounds(); } public void componentMoved(ComponentEvent e) { updateBounds(); } public static GraphicsDevice getDevice() { GraphicsEnvironment g_env = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice device = g_env.getDefaultScreenDevice(); return device; } public void windowIconified(WindowEvent e) { synchronized ( this ) { minimized = true; } } public void windowDeiconified(WindowEvent e) { synchronized ( this ) { minimized = false; } } public void windowOpened(WindowEvent e) { } public void windowClosed(WindowEvent e) { } public void windowClosing(WindowEvent e) { synchronized ( this ) { close_requested = true; } } public void windowDeactivated(WindowEvent e) { synchronized ( this ) { active = false; should_release_cursor = true; should_warp_cursor = false; } } public void windowActivated(WindowEvent e) { synchronized ( this ) { active = true; should_warp_cursor = true; should_release_cursor = false; } } public boolean syncIsCloseRequested() { boolean result; synchronized ( this ) { result = close_requested; close_requested = false; } return result; } public boolean syncIsVisible() { synchronized ( this ) { return !minimized; } } public boolean syncIsActive() { synchronized ( this ) { return active; } } public MacOSXGLCanvas getCanvas() { return canvas; } public boolean syncShouldReleaseCursor() { boolean result; synchronized ( this ) { result = should_release_cursor; should_release_cursor = false; } return result; } public boolean syncShouldWarpCursor() { boolean result; synchronized ( this ) { result = should_warp_cursor; should_warp_cursor = false; } return result; } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/MacOSXPeerInfo.java0000644000175000017500000000576211543426510022222 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; /** * * @author elias_naur * @version $Revision: 3116 $ * $Id: MacOSXPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ */ abstract class MacOSXPeerInfo extends PeerInfo { MacOSXPeerInfo(PixelFormat pixel_format, boolean use_display_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException { super(createHandle()); if (pixel_format.isFloatingPoint() && !LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 4)) throw new LWJGLException("Floating point pixel format requested, but is not supported"); choosePixelFormat(pixel_format, use_display_bpp, support_window, support_pbuffer, double_buffered); } private static native ByteBuffer createHandle(); private void choosePixelFormat(PixelFormat pixel_format, boolean use_display_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException { nChoosePixelFormat(getHandle(), pixel_format, use_display_bpp, support_window, support_pbuffer, double_buffered); } private static native void nChoosePixelFormat(ByteBuffer peer_info_handle, PixelFormat pixel_format, boolean use_display_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException; public void destroy() { nDestroy(getHandle()); } private static native void nDestroy(ByteBuffer handle); } lwjgl-2.7.1/src/java/org/lwjgl/opengl/MacOSXDisplayPeerInfo.java0000644000175000017500000000461611543426510023545 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.awt.Canvas; import org.lwjgl.LWJGLException; /** * * @author elias_naur * @version $Revision: 3418 $ * $Id: MacOSXDisplayPeerInfo.java 3418 2010-09-28 21:11:35Z spasi $ */ final class MacOSXDisplayPeerInfo extends MacOSXCanvasPeerInfo { private boolean locked; MacOSXDisplayPeerInfo(PixelFormat pixel_format, boolean support_pbuffer) throws LWJGLException { super(pixel_format, support_pbuffer); } protected void doLockAndInitHandle() throws LWJGLException { if (locked) throw new RuntimeException("Already locked"); Canvas canvas = ((MacOSXDisplay)Display.getImplementation()).getCanvas(); if (canvas != null) { initHandle(canvas); locked = true; } } protected void doUnlock() throws LWJGLException { if (locked) { super.doUnlock(); locked = false; } } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/MacOSXCanvasPeerInfo.java0000644000175000017500000000467011543426510023353 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.awt.Canvas; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; /** * * @author elias_naur * @version $Revision: 3116 $ * $Id: MacOSXCanvasPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ */ abstract class MacOSXCanvasPeerInfo extends MacOSXPeerInfo { private final AWTSurfaceLock awt_surface = new AWTSurfaceLock(); protected MacOSXCanvasPeerInfo(PixelFormat pixel_format, boolean support_pbuffer) throws LWJGLException { super(pixel_format, true, true, support_pbuffer, true); } protected void initHandle(Canvas component) throws LWJGLException { nInitHandle(awt_surface.lockAndGetHandle(component), getHandle()); } private static native void nInitHandle(ByteBuffer surface_buffer, ByteBuffer peer_info_handle) throws LWJGLException; protected void doUnlock() throws LWJGLException { awt_surface.unlock(); } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/DisplayMode.java0000644000175000017500000001005011543426510021674 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * * This class encapsulates the properties for a given display mode. * This class is not instantiable, and is aquired from the Display. * getAvailableDisplayModes() method. * * @author cix_foo * @version $Revision: 3418 $ * $Id: DisplayMode.java 3418 2010-09-28 21:11:35Z spasi $ */ public final class DisplayMode { /** properties of the display mode */ private final int width, height, bpp, freq; /** If true, this instance can be used for fullscreen modes */ private final boolean fullscreen; /** * Construct a display mode. DisplayModes constructed through the * public constructor can only be used to specify the dimensions of * the Display in windowed mode. To get the available DisplayModes for * fullscreen modes, use Display.getAvailableDisplayModes(). * * @param width The Display width. * @param height The Display height. * @see Display */ public DisplayMode(int width, int height) { this(width, height, 0, 0, false); } DisplayMode(int width, int height, int bpp, int freq) { this(width, height, bpp, freq, true); } private DisplayMode(int width, int height, int bpp, int freq, boolean fullscreen) { this.width = width; this.height = height; this.bpp = bpp; this.freq = freq; this.fullscreen = fullscreen; } /** True iff this instance can be used for fullscreen modes */ public boolean isFullscreenCapable() { return fullscreen; } public int getWidth() { return width; } public int getHeight() { return height; } public int getBitsPerPixel() { return bpp; } public int getFrequency() { return freq; } /** * Tests for DisplayMode equality * * @see java.lang.Object#equals(Object) */ public boolean equals(Object obj) { if (obj == null || !(obj instanceof DisplayMode)) { return false; } DisplayMode dm = (DisplayMode) obj; return dm.width == width && dm.height == height && dm.bpp == bpp && dm.freq == freq; } /** * Retrieves the hashcode for this object * * @see java.lang.Object#hashCode() */ public int hashCode() { return width ^ height ^ freq ^ bpp; } /** * Retrieves a String representation of this DisplayMode * * @see java.lang.Object#toString() */ public String toString() { StringBuilder sb = new StringBuilder(32); sb.append(width); sb.append(" x "); sb.append(height); sb.append(" x "); sb.append(bpp); sb.append(" @"); sb.append(freq); sb.append("Hz"); return sb.toString(); } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java0000644000175000017500000001337411543426510023704 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.PointerWrapperAbstract; /** * Instances of this class are needed to use the callback functionality of the AMD_debug_output extension. * A debug context must be current before creating instances of this class. Users of this class may provide * implementations of the {@code Handler} interface to receive notifications. The same {@code Handler} * instance may be used by different contexts but it is not recommended. Handler notifications are synchronized. * * @author Spasi */ public final class AMDDebugOutputCallback extends PointerWrapperAbstract { /** Severity levels. */ private static final int GL_DEBUG_SEVERITY_HIGH_AMD = 0x9146, GL_DEBUG_SEVERITY_MEDIUM_AMD = 0x9147, GL_DEBUG_SEVERITY_LOW_AMD = 0x9148; /** Categories */ private static final int GL_DEBUG_CATEGORY_API_ERROR_AMD = 0x9149, GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD = 0x914A, GL_DEBUG_CATEGORY_DEPRECATION_AMD = 0x914B, GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD = 0x914C, GL_DEBUG_CATEGORY_PERFORMANCE_AMD = 0x914D, GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD = 0x914E, GL_DEBUG_CATEGORY_APPLICATION_AMD = 0x914F, GL_DEBUG_CATEGORY_OTHER_AMD = 0x9150; private static final long CALLBACK_POINTER; static { long pointer = 0; try { // Call reflectively so that we can compile this class for the Generator. pointer = (Long)Class.forName("org.lwjgl.opengl.CallbackUtil").getDeclaredMethod("getDebugOutputCallbackAMD").invoke(null); } catch (Exception e) { // ignore } CALLBACK_POINTER = pointer; } private final Handler handler; /** * Creates an AMDDebugOutputCallback with a default callback handler. * The default handler will simply print the message on System.err. */ public AMDDebugOutputCallback() { this(new Handler() { public void handleMessage(final int id, final int category, final int severity, final String message) { System.err.println("[LWJGL] AMD_debug_output message"); System.err.println("\tID: " + id); String description; switch ( category ) { case GL_DEBUG_CATEGORY_API_ERROR_AMD: description = "API ERROR"; break; case GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD: description = "WINDOW SYSTEM"; break; case GL_DEBUG_CATEGORY_DEPRECATION_AMD: description = "DEPRECATION"; break; case GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD: description = "UNDEFINED BEHAVIOR"; break; case GL_DEBUG_CATEGORY_PERFORMANCE_AMD: description = "PERFORMANCE"; break; case GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD: description = "SHADER COMPILER"; break; case GL_DEBUG_CATEGORY_APPLICATION_AMD: description = "APPLICATION"; break; case GL_DEBUG_CATEGORY_OTHER_AMD: description = "OTHER"; break; default: description = "Unknown (" + Integer.toHexString(category) + ")"; } System.err.println("\tCategory: " + description); switch ( severity ) { case GL_DEBUG_SEVERITY_HIGH_AMD: description = "HIGH"; break; case GL_DEBUG_SEVERITY_MEDIUM_AMD: description = "MEDIUM"; break; case GL_DEBUG_SEVERITY_LOW_AMD: description = "LOW"; break; default: description = "Unknown (" + Integer.toHexString(category) + ")"; } System.err.println("\tSeverity: " + description); System.err.println("\tMessage: " + message); } }); } /** * Creates an AMDDebugOutputCallback with the specified callback handler. * The handler's {@code handleMessage} method will be called whenever * debug output is generated by the GL. * * @param handler the callback handler */ public AMDDebugOutputCallback(final Handler handler) { super(CALLBACK_POINTER); this.handler = handler; } Handler getHandler() { return handler; } /** Implementations of this interface can be used to receive AMD_debug_output notifications. */ public interface Handler { /** * This method will be called when an AMD_debug_output message is generated. * * @param id the message ID * @param category the message category * @param severity the message severity * @param message the string representation of the message. */ void handleMessage(int id, int category, int severity, String message); } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/AWTUtil.java0000644000175000017500000001572511543426510020771 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * @author elias_naur */ import java.awt.Component; import java.awt.Cursor; import java.awt.Dimension; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.IllegalComponentStateException; import java.awt.MouseInfo; import java.awt.Point; import java.awt.PointerInfo; import java.awt.Robot; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.nio.IntBuffer; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; final class AWTUtil { public static boolean hasWheel() { return true; } public static int getButtonCount() { return MouseEventQueue.NUM_BUTTONS; } public static int getNativeCursorCapabilities() { if (LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_MACOSX || LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 4)) { int cursor_colors = Toolkit.getDefaultToolkit().getMaximumCursorColors(); boolean supported = cursor_colors >= Short.MAX_VALUE && getMaxCursorSize() > 0; int caps = supported ? org.lwjgl.input.Cursor.CURSOR_8_BIT_ALPHA | org.lwjgl.input.Cursor.CURSOR_ONE_BIT_TRANSPARENCY: 0 | org.lwjgl.input.Cursor.CURSOR_ANIMATION; return caps; } else { /* Return no capability in Mac OS X 10.3 and earlier , as there are two unsolved bugs (both reported to apple along with minimal test case): 1. When a custom cursor (or some standard) java.awt.Cursor is assigned to a Componennt, it is reset to the default pointer cursor when the window is de- activated and the re-activated. The Cursor can not be reset to the custom cursor, with another setCursor. 2. When the cursor is moving in the top pixel row (y = 0 in AWT coordinates) in fullscreen mode, no mouse moved events are reported, even though mouse pressed/released and dragged events are reported */ return 0; } } public static Robot createRobot(final Component component) { try { return AccessController.doPrivileged(new PrivilegedExceptionAction() { public Robot run() throws Exception { return new Robot(component.getGraphicsConfiguration().getDevice()); } }); } catch (PrivilegedActionException e) { LWJGLUtil.log("Got exception while creating robot: " + e.getCause()); return null; } } private static int transformY(Component component, int y) { return component.getHeight() - 1 - y; } /** * Use reflection to access the JDK 1.5 pointer location, if possible and * only if the given component is on the same screen as the cursor. Return * null otherwise. */ private static Point getPointerLocation(final Component component) { try { final GraphicsConfiguration config = component.getGraphicsConfiguration(); if (config != null) { PointerInfo pointer_info = AccessController.doPrivileged(new PrivilegedExceptionAction() { public PointerInfo run() throws Exception { return MouseInfo.getPointerInfo(); } }); GraphicsDevice device = pointer_info.getDevice(); if (device == config.getDevice()) { return pointer_info.getLocation(); } return null; } } catch (Exception e) { LWJGLUtil.log("Failed to query pointer location: " + e.getCause()); } return null; } /** * Use the 1.5 API to get the cursor position relative to the component. Return null * if it fails (JDK <= 1.4). */ public static Point getCursorPosition(Component component) { try { Point pointer_location = getPointerLocation(component); if (pointer_location != null) { Point location = component.getLocationOnScreen(); pointer_location.translate(-location.x, -location.y); pointer_location.move(pointer_location.x, transformY(component, pointer_location.y)); return pointer_location; } } catch (IllegalComponentStateException e) { LWJGLUtil.log("Failed to set cursor position: " + e); } catch (NoClassDefFoundError e) { // Not JDK 1.5 LWJGLUtil.log("Failed to query cursor position: " + e); } return null; } public static void setCursorPosition(Component component, Robot robot, int x, int y) { if (robot != null) { try { Point location = component.getLocationOnScreen(); int transformed_x = location.x + x; int transformed_y = location.y + transformY(component, y); robot.mouseMove(transformed_x, transformed_y); } catch (IllegalComponentStateException e) { LWJGLUtil.log("Failed to set cursor position: " + e); } } } public static int getMinCursorSize() { Dimension min_size = Toolkit.getDefaultToolkit().getBestCursorSize(0, 0); return Math.max(min_size.width, min_size.height); } public static int getMaxCursorSize() { Dimension max_size = Toolkit.getDefaultToolkit().getBestCursorSize(10000, 10000); return Math.min(max_size.width, max_size.height); } /** Native cursor handles */ public static Cursor createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException { BufferedImage cursor_image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); int[] pixels = new int[images.remaining()]; int old_position = images.position(); images.get(pixels); images.position(old_position); cursor_image.setRGB(0, 0, width, height, pixels, 0, width); return Toolkit.getDefaultToolkit().createCustomCursor(cursor_image, new Point(xHotspot, yHotspot), "LWJGL Custom cursor"); } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/GLChecks.java0000644000175000017500000002455011543426510021117 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.Buffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLUtil; import static org.lwjgl.opengl.ARBBufferObject.*; import static org.lwjgl.opengl.ATIVertexArrayObject.*; import static org.lwjgl.opengl.EXTAbgr.*; import static org.lwjgl.opengl.EXTBgra.*; import static org.lwjgl.opengl.EXTDirectStateAccess.*; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL15.*; /** * A class to check buffer boundaries in GL methods. Many GL * methods read data from the GL into a native Buffer at its current position. If there is unsufficient space in the buffer when * the call is made then a buffer overflow would otherwise occur and cause unexpected behaviour, a crash, or worse, a security * risk. Therefore in those methods where GL reads data back into a buffer, we will call a bounds check method from this class * to ensure that there is sufficient space in the buffer. *

      * Thrown by the debug build library of the LWJGL if any OpenGL operation causes an error. * * @author cix_foo * @version $Revision: 3459 $ * $Id: GLChecks.java 3459 2010-11-29 17:21:05Z spasi $ */ class GLChecks { /** Static methods only! */ private GLChecks() { } static int getBufferObjectSize(ContextCapabilities caps, int buffer_enum) { return glGetBufferParameter(buffer_enum, GL_BUFFER_SIZE); } static int getBufferObjectSizeARB(ContextCapabilities caps, int buffer_enum) { return glGetBufferParameterARB(buffer_enum, GL_BUFFER_SIZE_ARB); } static int getBufferObjectSizeATI(ContextCapabilities caps, int buffer) { return glGetObjectBufferATI(buffer, GL_OBJECT_BUFFER_SIZE_ATI); } static int getNamedBufferObjectSize(ContextCapabilities caps, int buffer) { return glGetNamedBufferParameterEXT(buffer, GL_BUFFER_SIZE); } /** Helper method to ensure that array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */ static void ensureArrayVBOdisabled(ContextCapabilities caps) { if( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).arrayBuffer != 0 ) throw new OpenGLException("Cannot use Buffers when Array Buffer Object is enabled"); } /** Helper method to ensure that array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */ static void ensureArrayVBOenabled(ContextCapabilities caps) { if( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).arrayBuffer == 0 ) throw new OpenGLException("Cannot use offsets when Array Buffer Object is disabled"); } /** Helper method to ensure that element array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */ static void ensureElementVBOdisabled(ContextCapabilities caps) { if( LWJGLUtil.CHECKS && StateTracker.getElementArrayBufferBound(caps) != 0 ) throw new OpenGLException("Cannot use Buffers when Element Array Buffer Object is enabled"); } /** Helper method to ensure that element array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */ static void ensureElementVBOenabled(ContextCapabilities caps) { if( LWJGLUtil.CHECKS && StateTracker.getElementArrayBufferBound(caps) == 0 ) throw new OpenGLException("Cannot use offsets when Element Array Buffer Object is disabled"); } /** Helper method to ensure that array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */ static void ensureIndirectBOdisabled(ContextCapabilities caps) { if ( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).indirectBuffer != 0 ) throw new OpenGLException("Cannot use Buffers when Draw Indirect Object is enabled"); } /** Helper method to ensure that array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */ static void ensureIndirectBOenabled(ContextCapabilities caps) { if ( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).indirectBuffer == 0 ) throw new OpenGLException("Cannot use offsets when Draw Indirect Object is disabled"); } /** Helper method to ensure that pixel pack buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */ static void ensurePackPBOdisabled(ContextCapabilities caps) { if ( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).pixelPackBuffer != 0 ) throw new OpenGLException("Cannot use Buffers when Pixel Pack Buffer Object is enabled"); } /** Helper method to ensure that pixel pack buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */ static void ensurePackPBOenabled(ContextCapabilities caps) { if ( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).pixelPackBuffer == 0 ) throw new OpenGLException("Cannot use offsets when Pixel Pack Buffer Object is disabled"); } /** Helper method to ensure that pixel unpack buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */ static void ensureUnpackPBOdisabled(ContextCapabilities caps) { if ( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).pixelUnpackBuffer != 0 ) throw new OpenGLException("Cannot use Buffers when Pixel Unpack Buffer Object is enabled"); } /** Helper method to ensure that pixel unpack buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */ static void ensureUnpackPBOenabled(ContextCapabilities caps) { if ( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).pixelUnpackBuffer == 0 ) throw new OpenGLException("Cannot use offsets when Pixel Unpack Buffer Object is disabled"); } /** * Calculate the storage required for an image in elements * * @param format The format of the image (example: GL_RGBA) * @param type The type of the image elements (example: GL_UNSIGNED_BYTE) * @param width The width of the image * @param height The height of the image (1 for 1D images) * @param depth The depth of the image (1 for 2D images) * * @return the size, in elements, of the image */ static int calculateImageStorage(Buffer buffer, int format, int type, int width, int height, int depth) { return LWJGLUtil.CHECKS ? calculateImageStorage(format, type, width, height, depth) >> BufferUtils.getElementSizeExponent(buffer) : 0; } static int calculateTexImage1DStorage(Buffer buffer, int format, int type, int width) { return LWJGLUtil.CHECKS ? calculateTexImage1DStorage(format, type, width) >> BufferUtils.getElementSizeExponent(buffer) : 0; } static int calculateTexImage2DStorage(Buffer buffer, int format, int type, int width, int height) { return LWJGLUtil.CHECKS ? calculateTexImage2DStorage(format, type, width, height) >> BufferUtils.getElementSizeExponent(buffer) : 0; } static int calculateTexImage3DStorage(Buffer buffer, int format, int type, int width, int height, int depth) { return LWJGLUtil.CHECKS ? calculateTexImage3DStorage(format, type, width, height, depth) >> BufferUtils.getElementSizeExponent(buffer) : 0; } /** * Calculate the storage required for an image in bytes. * * @param format The format of the image (example: GL_RGBA) * @param type The type of the image elements (example: GL_UNSIGNED_BYTE) * @param width The width of the image * @param height The height of the image (1 for 1D images) * @param depth The depth of the image (1 for 2D images) * * @return the size, in bytes, of the image */ private static int calculateImageStorage(int format, int type, int width, int height, int depth) { return calculateBytesPerPixel(format, type) * width * height * depth; } private static int calculateTexImage1DStorage(int format, int type, int width) { return calculateBytesPerPixel(format, type) * width; } private static int calculateTexImage2DStorage(int format, int type, int width, int height) { return calculateTexImage1DStorage(format, type, width) * height; } private static int calculateTexImage3DStorage(int format, int type, int width, int height, int depth) { return calculateTexImage2DStorage(format, type, width, height) * depth; } private static int calculateBytesPerPixel(int format, int type) { int bpe; switch ( type ) { case GL_UNSIGNED_BYTE: case GL_BYTE: bpe = 1; break; case GL_UNSIGNED_SHORT: case GL_SHORT: bpe = 2; break; case GL_UNSIGNED_INT: case GL_INT: case GL_FLOAT: bpe = 4; break; default : // TODO: Add more types (like the GL12 types GL_UNSIGNED_INT_8_8_8_8 return 0; // throw new IllegalArgumentException("Unknown type " + type); } int epp; switch ( format ) { case GL_LUMINANCE: case GL_ALPHA: epp = 1; break; case GL_LUMINANCE_ALPHA: epp = 2; break; case GL_RGB: case GL_BGR_EXT: epp = 3; break; case GL_RGBA: case GL_ABGR_EXT: case GL_BGRA_EXT: epp = 4; break; default : // TODO: Add more formats. Assuming 4 is too wasteful on buffer sizes where e.g. 1 is enough (like GL_DEPTH_COMPONENT) return 0; /* // Assume 4 elements per pixel epp = 4;*/ } return bpe * epp; } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/WindowsKeycodes.java0000644000175000017500000004500011543426510022606 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * @author elias_naur */ import org.lwjgl.input.Keyboard; final class WindowsKeycodes { public static final int VK_LBUTTON = 0x01; public static final int VK_RBUTTON = 0x02; public static final int VK_CANCEL = 0x03; public static final int VK_MBUTTON = 0x04; /* NOT contiguous with L & RBUTTON */ public static final int VK_XBUTTON1 = 0x05; /* NOT contiguous with L & RBUTTON */ public static final int VK_XBUTTON2 = 0x06; /* NOT contiguous with L & RBUTTON */ /* * 0x07 : unassigned */ public static final int VK_BACK = 0x08; public static final int VK_TAB = 0x09; /* * 0x0A - 0x0B : reserved */ public static final int VK_CLEAR = 0x0C; public static final int VK_RETURN = 0x0D; public static final int VK_SHIFT = 0x10; public static final int VK_CONTROL = 0x11; public static final int VK_MENU = 0x12; public static final int VK_PAUSE = 0x13; public static final int VK_CAPITAL = 0x14; public static final int VK_KANA = 0x15; public static final int VK_HANGEUL = 0x15; /* old name - should be here for compatibility */ public static final int VK_HANGUL = 0x15; public static final int VK_JUNJA = 0x17; public static final int VK_FINAL = 0x18; public static final int VK_HANJA = 0x19; public static final int VK_KANJI = 0x19; public static final int VK_ESCAPE = 0x1B; public static final int VK_CONVERT = 0x1C; public static final int VK_NONCONVERT = 0x1D; public static final int VK_ACCEPT = 0x1E; public static final int VK_MODECHANGE = 0x1F; public static final int VK_SPACE = 0x20; public static final int VK_PRIOR = 0x21; public static final int VK_NEXT = 0x22; public static final int VK_END = 0x23; public static final int VK_HOME = 0x24; public static final int VK_LEFT = 0x25; public static final int VK_UP = 0x26; public static final int VK_RIGHT = 0x27; public static final int VK_DOWN = 0x28; public static final int VK_SELECT = 0x29; public static final int VK_PRINT = 0x2A; public static final int VK_EXECUTE = 0x2B; public static final int VK_SNAPSHOT = 0x2C; public static final int VK_INSERT = 0x2D; public static final int VK_DELETE = 0x2E; public static final int VK_HELP = 0x2F; /* * VK_0 - VK_9 are the same as ASCII '0' - '9' (0x30 - 0x39) * 0x40 : unassigned * VK_A - VK_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A) */ public static final int VK_0 = 0x30; public static final int VK_1 = 0x31; public static final int VK_2 = 0x32; public static final int VK_3 = 0x33; public static final int VK_4 = 0x34; public static final int VK_5 = 0x35; public static final int VK_6 = 0x36; public static final int VK_7 = 0x37; public static final int VK_8 = 0x38; public static final int VK_9 = 0x39; public static final int VK_A = 0x41; public static final int VK_B = 0x42; public static final int VK_C = 0x43; public static final int VK_D = 0x44; public static final int VK_E = 0x45; public static final int VK_F = 0x46; public static final int VK_G = 0x47; public static final int VK_H = 0x48; public static final int VK_I = 0x49; public static final int VK_J = 0x4A; public static final int VK_K = 0x4B; public static final int VK_L = 0x4C; public static final int VK_M = 0x4D; public static final int VK_N = 0x4E; public static final int VK_O = 0x4F; public static final int VK_P = 0x50; public static final int VK_Q = 0x51; public static final int VK_R = 0x52; public static final int VK_S = 0x53; public static final int VK_T = 0x54; public static final int VK_U = 0x55; public static final int VK_V = 0x56; public static final int VK_W = 0x57; public static final int VK_X = 0x58; public static final int VK_Y = 0x59; public static final int VK_Z = 0x5A; public static final int VK_LWIN = 0x5B; public static final int VK_RWIN = 0x5C; public static final int VK_APPS = 0x5D; /* * 0x5E : reserved; */ public static final int VK_SLEEP = 0x5F; public static final int VK_NUMPAD0 = 0x60; public static final int VK_NUMPAD1 = 0x61; public static final int VK_NUMPAD2 = 0x62; public static final int VK_NUMPAD3 = 0x63; public static final int VK_NUMPAD4 = 0x64; public static final int VK_NUMPAD5 = 0x65; public static final int VK_NUMPAD6 = 0x66; public static final int VK_NUMPAD7 = 0x67; public static final int VK_NUMPAD8 = 0x68; public static final int VK_NUMPAD9 = 0x69; public static final int VK_MULTIPLY = 0x6A; public static final int VK_ADD = 0x6B; public static final int VK_SEPARATOR = 0x6C; public static final int VK_SUBTRACT = 0x6D; public static final int VK_DECIMAL = 0x6E; public static final int VK_DIVIDE = 0x6F; public static final int VK_F1 = 0x70; public static final int VK_F2 = 0x71; public static final int VK_F3 = 0x72; public static final int VK_F4 = 0x73; public static final int VK_F5 = 0x74; public static final int VK_F6 = 0x75; public static final int VK_F7 = 0x76; public static final int VK_F8 = 0x77; public static final int VK_F9 = 0x78; public static final int VK_F10 = 0x79; public static final int VK_F11 = 0x7A; public static final int VK_F12 = 0x7B; public static final int VK_F13 = 0x7C; public static final int VK_F14 = 0x7D; public static final int VK_F15 = 0x7E; public static final int VK_F16 = 0x7F; public static final int VK_F17 = 0x80; public static final int VK_F18 = 0x81; public static final int VK_F19 = 0x82; public static final int VK_F20 = 0x83; public static final int VK_F21 = 0x84; public static final int VK_F22 = 0x85; public static final int VK_F23 = 0x86; public static final int VK_F24 = 0x87; /* * 0x88 - 0x8F : unassigned; */ public static final int VK_NUMLOCK = 0x90; public static final int VK_SCROLL = 0x91; /* * NEC PC-9800 kbd definitions */ public static final int VK_OEM_NEC_EQUAL = 0x92; // '=' key on numpad /* * Fujitsu/OASYS kbd definitions */ public static final int VK_OEM_FJ_JISHO = 0x92; // 'Dictionary' key public static final int VK_OEM_FJ_MASSHOU = 0x93; // 'Unregister word' key public static final int VK_OEM_FJ_TOUROKU = 0x94; // 'Register word' key public static final int VK_OEM_FJ_LOYA = 0x95; // 'Left OYAYUBI' key public static final int VK_OEM_FJ_ROYA = 0x96; // 'Right OYAYUBI' key /* * 0x97 - 0x9F : unassigned */ /* * VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys. * Used only as parameters to GetAsyncKeyState() and GetKeyState(). * No other API or message will distinguish left and right keys in this way. */ public static final int VK_LSHIFT = 0xA0; public static final int VK_RSHIFT = 0xA1; public static final int VK_LCONTROL = 0xA2; public static final int VK_RCONTROL = 0xA3; public static final int VK_LMENU = 0xA4; public static final int VK_RMENU = 0xA5; public static final int VK_BROWSER_BACK = 0xA6; public static final int VK_BROWSER_FORWARD = 0xA7; public static final int VK_BROWSER_REFRESH = 0xA8; public static final int VK_BROWSER_STOP = 0xA9; public static final int VK_BROWSER_SEARCH = 0xAA; public static final int VK_BROWSER_FAVORITES = 0xAB; public static final int VK_BROWSER_HOME = 0xAC; public static final int VK_VOLUME_MUTE = 0xAD; public static final int VK_VOLUME_DOWN = 0xAE; public static final int VK_VOLUME_UP = 0xAF; public static final int VK_MEDIA_NEXT_TRACK = 0xB0; public static final int VK_MEDIA_PREV_TRACK = 0xB1; public static final int VK_MEDIA_STOP = 0xB2; public static final int VK_MEDIA_PLAY_PAUSE = 0xB3; public static final int VK_LAUNCH_MAIL = 0xB4; public static final int VK_LAUNCH_MEDIA_SELECT = 0xB5; public static final int VK_LAUNCH_APP1 = 0xB6; public static final int VK_LAUNCH_APP2 = 0xB7; /* * 0xB8 - 0xB9 : reserved */ public static final int VK_OEM_1 = 0xBA; // ';:' for US public static final int VK_OEM_PLUS = 0xBB; // '+' any country public static final int VK_OEM_COMMA = 0xBC; // ',' any country public static final int VK_OEM_MINUS = 0xBD; // '-' any country public static final int VK_OEM_PERIOD = 0xBE; // '.' any country public static final int VK_OEM_2 = 0xBF; // '/?' for US public static final int VK_OEM_3 = 0xC0; // '`~' for US /* * 0xC1 - 0xD7 : reserved */ /* * 0xD8 - 0xDA : unassigned */ public static final int VK_OEM_4 = 0xDB; // '[{' for US public static final int VK_OEM_5 = 0xDC; // '\|' for US public static final int VK_OEM_6 = 0xDD; // ']}' for US public static final int VK_OEM_7 = 0xDE; // ''"' for US public static final int VK_OEM_8 = 0xDF; /* * 0xE0 : reserved */ /* * Various extended or enhanced keyboards */ public static final int VK_OEM_AX = 0xE1; // 'AX' key on Japanese AX kbd public static final int VK_OEM_102 = 0xE2; // "<>" or "\|" on RT 102-key kbd. public static final int VK_ICO_HELP = 0xE3; // Help key on ICO public static final int VK_ICO_00 = 0xE4; // 00 key on ICO public static final int VK_PROCESSKEY = 0xE5; public static final int VK_ICO_CLEAR = 0xE6; public static final int VK_PACKET = 0xE7; /* * 0xE8 : unassigned */ /* * Nokia/Ericsson definitions */ public static final int VK_OEM_RESET = 0xE9; public static final int VK_OEM_JUMP = 0xEA; public static final int VK_OEM_PA1 = 0xEB; public static final int VK_OEM_PA2 = 0xEC; public static final int VK_OEM_PA3 = 0xED; public static final int VK_OEM_WSCTRL = 0xEE; public static final int VK_OEM_CUSEL = 0xEF; public static final int VK_OEM_ATTN = 0xF0; public static final int VK_OEM_FINISH = 0xF1; public static final int VK_OEM_COPY = 0xF2; public static final int VK_OEM_AUTO = 0xF3; public static final int VK_OEM_ENLW = 0xF4; public static final int VK_OEM_BACKTAB = 0xF5; public static final int VK_ATTN = 0xF6; public static final int VK_CRSEL = 0xF7; public static final int VK_EXSEL = 0xF8; public static final int VK_EREOF = 0xF9; public static final int VK_PLAY = 0xFA; public static final int VK_ZOOM = 0xFB; public static final int VK_NONAME = 0xFC; public static final int VK_PA1 = 0xFD; public static final int VK_OEM_CLEAR = 0xFE; public static int mapVirtualKeyToLWJGLCode(int virt_key) { switch (virt_key) { case VK_ESCAPE: return Keyboard.KEY_ESCAPE; case VK_1: return Keyboard.KEY_1; case VK_2: return Keyboard.KEY_2; case VK_3: return Keyboard.KEY_3; case VK_4: return Keyboard.KEY_4; case VK_5: return Keyboard.KEY_5; case VK_6: return Keyboard.KEY_6; case VK_7: return Keyboard.KEY_7; case VK_8: return Keyboard.KEY_8; case VK_9: return Keyboard.KEY_9; case VK_0: return Keyboard.KEY_0; case VK_OEM_MINUS: return Keyboard.KEY_MINUS; case VK_OEM_PLUS: return Keyboard.KEY_EQUALS; case VK_BACK: return Keyboard.KEY_BACK; case VK_TAB: return Keyboard.KEY_TAB; case VK_Q: return Keyboard.KEY_Q; case VK_W: return Keyboard.KEY_W; case VK_E: return Keyboard.KEY_E; case VK_R: return Keyboard.KEY_R; case VK_T: return Keyboard.KEY_T; case VK_Y: return Keyboard.KEY_Y; case VK_U: return Keyboard.KEY_U; case VK_I: return Keyboard.KEY_I; case VK_O: return Keyboard.KEY_O; case VK_P: return Keyboard.KEY_P; case VK_OEM_4: return Keyboard.KEY_LBRACKET; case VK_OEM_6: return Keyboard.KEY_RBRACKET; case VK_RETURN: return Keyboard.KEY_RETURN; case VK_LCONTROL: return Keyboard.KEY_LCONTROL; case VK_A: return Keyboard.KEY_A; case VK_S: return Keyboard.KEY_S; case VK_D: return Keyboard.KEY_D; case VK_F: return Keyboard.KEY_F; case VK_G: return Keyboard.KEY_G; case VK_H: return Keyboard.KEY_H; case VK_J: return Keyboard.KEY_J; case VK_K: return Keyboard.KEY_K; case VK_L: return Keyboard.KEY_L; case VK_OEM_1: return Keyboard.KEY_SEMICOLON; case VK_OEM_7: return Keyboard.KEY_APOSTROPHE; case VK_OEM_3: case VK_OEM_8: return Keyboard.KEY_GRAVE; case VK_LSHIFT: return Keyboard.KEY_LSHIFT; case VK_OEM_5: return Keyboard.KEY_BACKSLASH; case VK_Z: return Keyboard.KEY_Z; case VK_X: return Keyboard.KEY_X; case VK_C: return Keyboard.KEY_C; case VK_V: return Keyboard.KEY_V; case VK_B: return Keyboard.KEY_B; case VK_N: return Keyboard.KEY_N; case VK_M: return Keyboard.KEY_M; case VK_OEM_COMMA: return Keyboard.KEY_COMMA; case VK_OEM_PERIOD: return Keyboard.KEY_PERIOD; case VK_OEM_2: return Keyboard.KEY_SLASH; case VK_RSHIFT: return Keyboard.KEY_RSHIFT; case VK_MULTIPLY: return Keyboard.KEY_MULTIPLY; case VK_LMENU: return Keyboard.KEY_LMENU; case VK_SPACE: return Keyboard.KEY_SPACE; case VK_CAPITAL: return Keyboard.KEY_CAPITAL; case VK_F1: return Keyboard.KEY_F1; case VK_F2: return Keyboard.KEY_F2; case VK_F3: return Keyboard.KEY_F3; case VK_F4: return Keyboard.KEY_F4; case VK_F5: return Keyboard.KEY_F5; case VK_F6: return Keyboard.KEY_F6; case VK_F7: return Keyboard.KEY_F7; case VK_F8: return Keyboard.KEY_F8; case VK_F9: return Keyboard.KEY_F9; case VK_F10: return Keyboard.KEY_F10; case VK_NUMLOCK: return Keyboard.KEY_NUMLOCK; case VK_SCROLL: return Keyboard.KEY_SCROLL; case VK_NUMPAD7: return Keyboard.KEY_NUMPAD7; case VK_NUMPAD8: return Keyboard.KEY_NUMPAD8; case VK_NUMPAD9: return Keyboard.KEY_NUMPAD9; case VK_SUBTRACT: return Keyboard.KEY_SUBTRACT; case VK_NUMPAD4: return Keyboard.KEY_NUMPAD4; case VK_NUMPAD5: return Keyboard.KEY_NUMPAD5; case VK_NUMPAD6: return Keyboard.KEY_NUMPAD6; case VK_ADD: return Keyboard.KEY_ADD; case VK_NUMPAD1: return Keyboard.KEY_NUMPAD1; case VK_NUMPAD2: return Keyboard.KEY_NUMPAD2; case VK_NUMPAD3: return Keyboard.KEY_NUMPAD3; case VK_NUMPAD0: return Keyboard.KEY_NUMPAD0; case VK_DECIMAL: return Keyboard.KEY_DECIMAL; case VK_F11: return Keyboard.KEY_F11; case VK_F12: return Keyboard.KEY_F12; case VK_F13: return Keyboard.KEY_F13; case VK_F14: return Keyboard.KEY_F14; case VK_F15: return Keyboard.KEY_F15; case VK_KANA: return Keyboard.KEY_KANA; case VK_CONVERT: return Keyboard.KEY_CONVERT; case VK_NONCONVERT: return Keyboard.KEY_NOCONVERT; /* case VK_YEN: return Keyboard.KEY_YEN; case VK_NUMPADEQUALS: return Keyboard.KEY_NUMPADEQUALS; case VK_CIRCUMFLEX: return Keyboard.KEY_CIRCUMFLEX; case VK_AT: return Keyboard.KEY_AT; case VK_COLON: return Keyboard.KEY_COLON; case VK_UNDERLINE: return Keyboard.KEY_UNDERLINE;*/ case VK_KANJI: return Keyboard.KEY_KANJI; /* case VK_STOP: return Keyboard.KEY_STOP; case VK_AX: return Keyboard.KEY_AX; case VK_UNLABELED: return Keyboard.KEY_UNLABELED; case VK_NUMPADENTER: return Keyboard.KEY_NUMPADENTER;*/ case VK_RCONTROL: return Keyboard.KEY_RCONTROL; case VK_SEPARATOR: return Keyboard.KEY_NUMPADCOMMA; case VK_DIVIDE: return Keyboard.KEY_DIVIDE; case VK_SNAPSHOT: return Keyboard.KEY_SYSRQ; case VK_RMENU: return Keyboard.KEY_RMENU; case VK_PAUSE: return Keyboard.KEY_PAUSE; case VK_HOME: return Keyboard.KEY_HOME; case VK_UP: return Keyboard.KEY_UP; case VK_PRIOR: return Keyboard.KEY_PRIOR; case VK_LEFT: return Keyboard.KEY_LEFT; case VK_RIGHT: return Keyboard.KEY_RIGHT; case VK_END: return Keyboard.KEY_END; case VK_DOWN: return Keyboard.KEY_DOWN; case VK_NEXT: return Keyboard.KEY_NEXT; case VK_INSERT: return Keyboard.KEY_INSERT; case VK_DELETE: return Keyboard.KEY_DELETE; case VK_LWIN: return Keyboard.KEY_LMETA; case VK_RWIN: return Keyboard.KEY_RMETA; case VK_APPS: return Keyboard.KEY_APPS; /* case VK_POWER: return Keyboard.KEY_POWER;*/ case VK_SLEEP: return Keyboard.KEY_SLEEP; default: return Keyboard.KEY_NONE; } } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java0000644000175000017500000000601111543426510023541 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; /** * * @author elias_naur * @version $Revision: 3116 $ * $Id: LinuxDisplayPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ */ final class LinuxDisplayPeerInfo extends LinuxPeerInfo { LinuxDisplayPeerInfo(PixelFormat pixel_format) throws LWJGLException { LinuxDisplay.lockAWT(); try { GLContext.loadOpenGLLibrary(); try { LinuxDisplay.incDisplay(); try { initDefaultPeerInfo(LinuxDisplay.getDisplay(), LinuxDisplay.getDefaultScreen(), getHandle(), pixel_format); } catch (LWJGLException e) { LinuxDisplay.decDisplay(); throw e; } } catch (LWJGLException e) { GLContext.unloadOpenGLLibrary(); throw e; } } finally { LinuxDisplay.unlockAWT(); } } private static native void initDefaultPeerInfo(long display, int screen, ByteBuffer peer_info_handle, PixelFormat pixel_format) throws LWJGLException; protected void doLockAndInitHandle() throws LWJGLException { LinuxDisplay.lockAWT(); try { initDrawable(LinuxDisplay.getWindow(), getHandle()); } finally { LinuxDisplay.unlockAWT(); } } private static native void initDrawable(long window, ByteBuffer peer_info_handle); protected void doUnlock() throws LWJGLException { // NO-OP } public void destroy() { super.destroy(); LinuxDisplay.lockAWT(); LinuxDisplay.decDisplay(); GLContext.unloadOpenGLLibrary(); LinuxDisplay.unlockAWT(); } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/Util.java0000644000175000017500000000572411543426510020413 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import static org.lwjgl.opengl.ARBImaging.*; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL30.*; /** * Simple utility class. * * @author cix_foo * @version $Revision: 3418 $ */ public final class Util { /** No c'tor */ private Util() { } /** * Throws OpenGLException if glGetError() returns anything else than GL_NO_ERROR * */ public static void checkGLError() throws OpenGLException { if ( ContextCapabilities.DEBUG && GLContext.getCapabilities().tracker.isBeginEnd() ) // Do not call GetError inside a Begin/End pair. return; int err = glGetError(); if ( err != GL_NO_ERROR ) { throw new OpenGLException(err); } } /** * Translate a GL error code to a String describing the error */ public static String translateGLErrorString(int error_code) { switch (error_code) { case GL_NO_ERROR: return "No error"; case GL_INVALID_ENUM: return "Invalid enum"; case GL_INVALID_VALUE: return "Invalid value"; case GL_INVALID_OPERATION: return "Invalid operation"; case GL_STACK_OVERFLOW: return "Stack overflow"; case GL_STACK_UNDERFLOW: return "Stack underflow"; case GL_OUT_OF_MEMORY: return "Out of memory"; case GL_TABLE_TOO_LARGE: return "Table too large"; case GL_INVALID_FRAMEBUFFER_OPERATION: return "Invalid framebuffer operation"; default: return null; } } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/BaseReferences.java0000644000175000017500000000732511543426510022351 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.Buffer; import java.util.Arrays; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL13.*; import static org.lwjgl.opengl.GL20.*; class BaseReferences { int elementArrayBuffer; int arrayBuffer; final Buffer[] glVertexAttribPointer_buffer; final Buffer[] glTexCoordPointer_buffer; int glClientActiveTexture; int vertexArrayObject; int pixelPackBuffer; int pixelUnpackBuffer; int indirectBuffer; BaseReferences(ContextCapabilities caps) { int max_vertex_attribs; if ( caps.OpenGL20 || caps.GL_ARB_vertex_shader ) max_vertex_attribs = glGetInteger(GL_MAX_VERTEX_ATTRIBS); else max_vertex_attribs = 0; glVertexAttribPointer_buffer = new Buffer[max_vertex_attribs]; int max_texture_units; if ( caps.OpenGL20 ) max_texture_units = glGetInteger(GL_MAX_TEXTURE_IMAGE_UNITS); else if ( caps.OpenGL13 || caps.GL_ARB_multitexture ) max_texture_units = glGetInteger(GL_MAX_TEXTURE_UNITS); else max_texture_units = 1; glTexCoordPointer_buffer = new Buffer[max_texture_units]; } void clear() { this.elementArrayBuffer = 0; this.arrayBuffer = 0; this.glClientActiveTexture = 0; Arrays.fill(glVertexAttribPointer_buffer, null); Arrays.fill(glTexCoordPointer_buffer, null); this.vertexArrayObject = 0; this.pixelPackBuffer = 0; this.pixelUnpackBuffer = 0; this.indirectBuffer = 0; } void copy(BaseReferences references, int mask) { if ( (mask & GL_CLIENT_VERTEX_ARRAY_BIT) != 0 ) { this.elementArrayBuffer = references.elementArrayBuffer; this.arrayBuffer = references.arrayBuffer; this.glClientActiveTexture = references.glClientActiveTexture; System.arraycopy(references.glVertexAttribPointer_buffer, 0, glVertexAttribPointer_buffer, 0, glVertexAttribPointer_buffer.length); System.arraycopy(references.glTexCoordPointer_buffer, 0, glTexCoordPointer_buffer, 0, glTexCoordPointer_buffer.length); this.vertexArrayObject = references.vertexArrayObject; this.indirectBuffer = references.indirectBuffer; } if ( (mask & GL_CLIENT_PIXEL_STORE_BIT) != 0 ) { this.pixelPackBuffer = references.pixelPackBuffer; this.pixelUnpackBuffer = references.pixelUnpackBuffer; } } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/LinuxContextAttribs.java0000644000175000017500000000625411543426510023472 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * An implementation of ContextAttribs using GLX_create_context. *

      * ---- WIP - GLX_create_context has not been defined yet ---- * * @author spasi */ final class LinuxContextAttribs implements ContextAttribsImplementation { private static final int GLX_CONTEXT_MAJOR_VERSION_ARB = 0x2091; private static final int GLX_CONTEXT_MINOR_VERSION_ARB = 0x2092; private static final int GLX_CONTEXT_LAYER_PLANE_ARB = 0x2093; private static final int GLX_CONTEXT_FLAGS_ARB = 0x2094; private static final int GLX_CONTEXT_PROFILE_MASK_ARB = 0x9126; private static final int GLX_CONTEXT_DEBUG_BIT_ARB = 0x0001; private static final int GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002; private static final int GLX_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001; private static final int GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002; LinuxContextAttribs() { } public int getMajorVersionAttrib() { return GLX_CONTEXT_MAJOR_VERSION_ARB; } public int getMinorVersionAttrib() { return GLX_CONTEXT_MINOR_VERSION_ARB; } public int getLayerPlaneAttrib() { return GLX_CONTEXT_LAYER_PLANE_ARB; } public int getFlagsAttrib() { return GLX_CONTEXT_FLAGS_ARB; } public int getDebugBit() { return GLX_CONTEXT_DEBUG_BIT_ARB; } public int getForwardCompatibleBit() { return GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; } public int getProfileMaskAttrib() { return GLX_CONTEXT_PROFILE_MASK_ARB; } public int getProfileCoreBit() { return GLX_CONTEXT_CORE_PROFILE_BIT_ARB; } public int getProfileCompatibilityBit() { return GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; } }lwjgl-2.7.1/src/java/org/lwjgl/opengl/RenderTexture.java0000644000175000017500000002370411543426510022274 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import static org.lwjgl.opengl.GL11.*; /** This class represents the state necessary for render-to-texture. */ public final class RenderTexture { // ---------------------------------------------------------------------------------- // ----------------------------- WGL_ARB_render_texture ----------------------------- // ---------------------------------------------------------------------------------- /* Accepted by the parameter of wglGetPixelFormatAttribivARB, wglGetPixelFormatAttribfvARB, and the and parameters of wglChoosePixelFormatARB: */ private static final int WGL_BIND_TO_TEXTURE_RGB_ARB = 0x2070; private static final int WGL_BIND_TO_TEXTURE_RGBA_ARB = 0x2071; /* Accepted by the parameter of wglCreatePbufferARB and by the parameter of wglQueryPbufferARB: */ private static final int WGL_TEXTURE_FORMAT_ARB = 0x2072; private static final int WGL_TEXTURE_TARGET_ARB = 0x2073; private static final int WGL_MIPMAP_TEXTURE_ARB = 0x2074; /* Accepted as a value in the parameter of wglCreatePbufferARB and returned in the value parameter of wglQueryPbufferARB when is WGL_TEXTURE_FORMAT_ARB: */ private static final int WGL_TEXTURE_RGB_ARB = 0x2075; private static final int WGL_TEXTURE_RGBA_ARB = 0x2076; /* Accepted as a value in the parameter of wglCreatePbufferARB and returned in the value parameter of wglQueryPbufferARB when is WGL_TEXTURE_TARGET_ARB: */ private static final int WGL_TEXTURE_CUBE_MAP_ARB = 0x2078; private static final int WGL_TEXTURE_1D_ARB = 0x2079; private static final int WGL_TEXTURE_2D_ARB = 0x207A; private static final int WGL_NO_TEXTURE_ARB = 0x2077; /* Accepted by the parameter of wglSetPbufferAttribARB and by the parameter of wglQueryPbufferARB: */ static final int WGL_MIPMAP_LEVEL_ARB = 0x207B; static final int WGL_CUBE_MAP_FACE_ARB = 0x207C; /* Accepted as a value in the parameter of wglSetPbufferAttribARB and returned in the value parameter of wglQueryPbufferARB when is WGL_CUBE_MAP_FACE_ARB: */ static final int WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = 0x207D; static final int WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = 0x207E; static final int WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = 0x207F; static final int WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = 0x2080; static final int WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = 0x2081; static final int WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = 0x2082; /* Accepted by the parameter of wglBindTexImageARB and wglReleaseTexImageARB: */ static final int WGL_FRONT_LEFT_ARB = 0x2083; static final int WGL_FRONT_RIGHT_ARB = 0x2084; static final int WGL_BACK_LEFT_ARB = 0x2085; static final int WGL_BACK_RIGHT_ARB = 0x2086; /* private static final int WGL_AUX0_ARB = 0x2087; private static final int WGL_AUX1_ARB = 0x2088; private static final int WGL_AUX2_ARB = 0x2089; private static final int WGL_AUX3_ARB = 0x208A; private static final int WGL_AUX4_ARB = 0x208B; private static final int WGL_AUX5_ARB = 0x208C; private static final int WGL_AUX6_ARB = 0x208D; private static final int WGL_AUX7_ARB = 0x208E; private static final int WGL_AUX8_ARB = 0x208F; private static final int WGL_AUX9_ARB = 0x2090; */ // ------------------------------------------------------------------------------------------- // ----------------------------- WGL_NV_render_texture_rectangle ----------------------------- // ------------------------------------------------------------------------------------------- /* Accepted by the parameter of wglGetPixelFormatAttribivARB, wglGetPixelFormatAttribfvARB, and the and parameters of wglChoosePixelFormatARB: */ private static final int WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV = 0x20A0; private static final int WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = 0x20A1; /* Accepted as a value in the parameter of wglCreatePbufferARB and returned in the value parameter of wglQueryPbufferARB when is WGL_TEXTURE_TARGET_ARB: */ private static final int WGL_TEXTURE_RECTANGLE_NV = 0x20A2; // --------------------------------------------------------------------------------------- // ----------------------------- WGL_NV_render_depth_texture ----------------------------- // --------------------------------------------------------------------------------------- /* Accepted by the parameter of wglGetPixelFormatAttribivARB, wglGetPixelFormatAttribfvARB, and the and parameters of wglChoosePixelFormatARB: */ private static final int WGL_BIND_TO_TEXTURE_DEPTH_NV = 0x20A3; private static final int WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV = 0x20A4; /* Accepted by the parameter of wglCreatePbufferARB and by the parameter of wglQueryPbufferARB: */ private static final int WGL_DEPTH_TEXTURE_FORMAT_NV = 0x20A5; /* Accepted as a value in the parameter of wglCreatePbufferARB and returned in the value parameter of wglQueryPbufferARB when is WGL_DEPTH_TEXTURE_FORMAT_NV: */ private static final int WGL_TEXTURE_DEPTH_COMPONENT_NV = 0x20A6; /* Accepted by the parameter of wglBindTexImageARB: */ static final int WGL_DEPTH_COMPONENT_NV = 0x20A7; /** The TEXTURE_1D target. */ public static final int RENDER_TEXTURE_1D = WGL_TEXTURE_1D_ARB; /** The TEXTURE_2D target. */ public static final int RENDER_TEXTURE_2D = WGL_TEXTURE_2D_ARB; /** The TEXTURE_RECTANGLE target. */ public static final int RENDER_TEXTURE_RECTANGLE = WGL_TEXTURE_RECTANGLE_NV; /** The TEXTURE_CUBE_MAP target. */ public static final int RENDER_TEXTURE_CUBE_MAP = WGL_TEXTURE_CUBE_MAP_ARB; IntBuffer pixelFormatCaps; IntBuffer pBufferAttribs; /** * Creates a RenderTexture object for enabling render-to-texture on a P-buffer. *

      * NOTE: Only one of useRGB and useRGBA can be true at the same time. *

      * NOTE: useRGB(A) and useDepth can be true at the same time, thus allowing two different render textures. *

      * NOTE: The target parameter can be one of the following: *

      * RENDER_TEXTURE_1D RENDER_TEXTURE_2D RENDER_TEXTURE_RECTANGLE RENDER_TEXTURE_CUBE_MAP * * @param useRGB - When true the P-buffer can be used as an RGB render texture. * @param useRGBA - When true the P-buffer can be used as an RGBA render texture. * @param useDepth - When true the P-buffer can be used as a depth render texture. * @param isRectangle - When true rectangle textures will be allowed on the P-buffer. * @param target - The texture target of the render texture. * @param mipmaps - How many mipmap levels to allocate on the P-buffer. */ public RenderTexture(boolean useRGB, boolean useRGBA, boolean useDepth, boolean isRectangle, int target, int mipmaps) { if ( useRGB && useRGBA ) throw new IllegalArgumentException("A RenderTexture can't be both RGB and RGBA."); if ( mipmaps < 0 ) throw new IllegalArgumentException("The mipmap levels can't be negative."); if ( isRectangle && target != RENDER_TEXTURE_RECTANGLE ) throw new IllegalArgumentException("When the RenderTexture is rectangle the target must be RENDER_TEXTURE_RECTANGLE."); pixelFormatCaps = BufferUtils.createIntBuffer(4); pBufferAttribs = BufferUtils.createIntBuffer(8); if ( useRGB ) { pixelFormatCaps.put(isRectangle ? WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV : WGL_BIND_TO_TEXTURE_RGB_ARB); pixelFormatCaps.put(GL_TRUE); pBufferAttribs.put(WGL_TEXTURE_FORMAT_ARB); pBufferAttribs.put(WGL_TEXTURE_RGB_ARB); } else if ( useRGBA ) { pixelFormatCaps.put(isRectangle ? WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV : WGL_BIND_TO_TEXTURE_RGBA_ARB); pixelFormatCaps.put(GL_TRUE); pBufferAttribs.put(WGL_TEXTURE_FORMAT_ARB); pBufferAttribs.put(WGL_TEXTURE_RGBA_ARB); } if ( useDepth ) { pixelFormatCaps.put(isRectangle ? WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV : WGL_BIND_TO_TEXTURE_DEPTH_NV); pixelFormatCaps.put(GL_TRUE); pBufferAttribs.put(WGL_DEPTH_TEXTURE_FORMAT_NV); pBufferAttribs.put(WGL_TEXTURE_DEPTH_COMPONENT_NV); } pBufferAttribs.put(WGL_TEXTURE_TARGET_ARB); pBufferAttribs.put(target); if ( mipmaps != 0 ) { pBufferAttribs.put(WGL_MIPMAP_TEXTURE_ARB); pBufferAttribs.put(mipmaps); } pixelFormatCaps.flip(); pBufferAttribs.flip(); } }lwjgl-2.7.1/src/java/org/lwjgl/opengl/KeyboardEventQueue.java0000644000175000017500000003716411543426510023250 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * An AWT implementation of a LWJGL compatible Keyboard event queue. * @author elias_naur */ import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.Component; import java.nio.ByteBuffer; import org.lwjgl.input.Keyboard; final class KeyboardEventQueue extends EventQueue implements KeyListener { private static final int[] KEY_MAP = new int[0xffff]; private final byte[] key_states = new byte[Keyboard.KEYBOARD_SIZE]; /** Event scratch array */ private final ByteBuffer event = ByteBuffer.allocate(Keyboard.EVENT_SIZE); private final Component component; private boolean has_deferred_event; private long deferred_nanos; private int deferred_key_code; private int deferred_key_location; private byte deferred_key_state; private int deferred_character; static { KEY_MAP[KeyEvent.VK_0] = Keyboard.KEY_0; KEY_MAP[KeyEvent.VK_1] = Keyboard.KEY_1; KEY_MAP[KeyEvent.VK_2] = Keyboard.KEY_2; KEY_MAP[KeyEvent.VK_3] = Keyboard.KEY_3; KEY_MAP[KeyEvent.VK_4] = Keyboard.KEY_4; KEY_MAP[KeyEvent.VK_5] = Keyboard.KEY_5; KEY_MAP[KeyEvent.VK_6] = Keyboard.KEY_6; KEY_MAP[KeyEvent.VK_7] = Keyboard.KEY_7; KEY_MAP[KeyEvent.VK_8] = Keyboard.KEY_8; KEY_MAP[KeyEvent.VK_9] = Keyboard.KEY_9; KEY_MAP[KeyEvent.VK_A] = Keyboard.KEY_A; // KEY_MAP[KeyEvent.VK_ACCEPT] = Keyboard.KEY_ACCEPT; KEY_MAP[KeyEvent.VK_ADD] = Keyboard.KEY_ADD; // KEY_MAP[KeyEvent.VK_AGAIN] = Keyboard.KEY_AGAIN; // KEY_MAP[KeyEvent.VK_ALL_CANDIDATES] = Keyboard.KEY_ALL_CANDIDATES; // KEY_MAP[KeyEvent.VK_ALPHANUMERIC] = Keyboard.KEY_ALPHANUMERIC; // KEY_MAP[KeyEvent.VK_ALT] = Keyboard.KEY_LMENU; manually mapped KEY_MAP[KeyEvent.VK_ALT_GRAPH] = Keyboard.KEY_RMENU; // KEY_MAP[KeyEvent.VK_AMPERSAND] = Keyboard.KEY_AMPERSAND; // KEY_MAP[KeyEvent.VK_ASTERISK] = Keyboard.KEY_ASTERISK; KEY_MAP[KeyEvent.VK_AT] = Keyboard.KEY_AT; KEY_MAP[KeyEvent.VK_B] = Keyboard.KEY_B; // KEY_MAP[KeyEvent.VK_BACK_QUOTE] = Keyboard.KEY_BACK_QUOTE; KEY_MAP[KeyEvent.VK_BACK_SLASH] = Keyboard.KEY_BACKSLASH; KEY_MAP[KeyEvent.VK_BACK_SPACE] = Keyboard.KEY_BACK; // KEY_MAP[KeyEvent.VK_BRACELEFT] = Keyboard.KEY_BRACELEFT; // KEY_MAP[KeyEvent.VK_BRACERIGHT] = Keyboard.KEY_BRACERIGHT; KEY_MAP[KeyEvent.VK_C] = Keyboard.KEY_C; // KEY_MAP[KeyEvent.VK_CANCEL] = Keyboard.KEY_CANCEL; KEY_MAP[KeyEvent.VK_CAPS_LOCK] = Keyboard.KEY_CAPITAL; KEY_MAP[KeyEvent.VK_CIRCUMFLEX] = Keyboard.KEY_CIRCUMFLEX; // KEY_MAP[KeyEvent.VK_CLEAR] = Keyboard.KEY_CLEAR; KEY_MAP[KeyEvent.VK_CLOSE_BRACKET] = Keyboard.KEY_RBRACKET; // KEY_MAP[KeyEvent.VK_CODE_INPUT] = Keyboard.KEY_CODE_INPUT; KEY_MAP[KeyEvent.VK_COLON] = Keyboard.KEY_COLON; KEY_MAP[KeyEvent.VK_COMMA] = Keyboard.KEY_COMMA; // KEY_MAP[KeyEvent.VK_COMPOSE] = Keyboard.KEY_COMPOSE; // KEY_MAP[KeyEvent.VK_CONTROL] = Keyboard.KEY_LCONTROL; manually mapped KEY_MAP[KeyEvent.VK_CONVERT] = Keyboard.KEY_CONVERT; // KEY_MAP[KeyEvent.VK_COPY] = Keyboard.KEY_COPY; // KEY_MAP[KeyEvent.VK_CUT] = Keyboard.KEY_CUT; KEY_MAP[KeyEvent.VK_D] = Keyboard.KEY_D; // KEY_MAP[KeyEvent.VK_DEAD_ABOVEDOT] = Keyboard.KEY_DEAD_ABOVEDOT; // KEY_MAP[KeyEvent.VK_DEAD_ABOVERING] = Keyboard.KEY_DEAD_ABOVERING; // KEY_MAP[KeyEvent.VK_DEAD_ACUTE] = Keyboard.KEY_DEAD_ACUTE; // KEY_MAP[KeyEvent.VK_DEAD_BREVE] = Keyboard.KEY_DEAD_BREVE; // KEY_MAP[KeyEvent.VK_DEAD_CARON] = Keyboard.KEY_DEAD_CARON; // KEY_MAP[KeyEvent.VK_DEAD_CEDILLA] = Keyboard.KEY_DEAD_CEDILLA; // KEY_MAP[KeyEvent.VK_DEAD_CIRCUMFLEX] = Keyboard.KEY_DEAD_CIRCUMFLEX; // KEY_MAP[KeyEvent.VK_DEAD_DIAERESIS] = Keyboard.KEY_DEAD_DIAERESIS; // KEY_MAP[KeyEvent.VK_DEAD_DOUBLEACUTE] = Keyboard.KEY_DEAD_DOUBLEACUTE; // KEY_MAP[KeyEvent.VK_DEAD_GRAVE] = Keyboard.KEY_DEAD_GRAVE; // KEY_MAP[KeyEvent.VK_DEAD_IOTA] = Keyboard.KEY_DEAD_IOTA; // KEY_MAP[KeyEvent.VK_DEAD_MACRON] = Keyboard.KEY_DEAD_MACRON; // KEY_MAP[KeyEvent.VK_DEAD_OGONEK] = Keyboard.KEY_DEAD_OGONEK; // KEY_MAP[KeyEvent.VK_DEAD_SEMIVOICED_SOUND] = Keyboard.KEY_DEAD_SEMIVOICED_SOUND; // KEY_MAP[KeyEvent.VK_DEAD_TILDE] = Keyboard.KEY_DEAD_TILDE; // KEY_MAP[KeyEvent.VK_DEAD_VOICED_SOUND] = Keyboard.KEY_DEAD_VOICED_SOUND; KEY_MAP[KeyEvent.VK_DECIMAL] = Keyboard.KEY_DECIMAL; KEY_MAP[KeyEvent.VK_DELETE] = Keyboard.KEY_DELETE; KEY_MAP[KeyEvent.VK_DIVIDE] = Keyboard.KEY_DIVIDE; // KEY_MAP[KeyEvent.VK_DOLLAR] = Keyboard.KEY_DOLLAR; KEY_MAP[KeyEvent.VK_DOWN] = Keyboard.KEY_DOWN; KEY_MAP[KeyEvent.VK_E] = Keyboard.KEY_E; KEY_MAP[KeyEvent.VK_END] = Keyboard.KEY_END; KEY_MAP[KeyEvent.VK_ENTER] = Keyboard.KEY_RETURN; KEY_MAP[KeyEvent.VK_EQUALS] = Keyboard.KEY_EQUALS; KEY_MAP[KeyEvent.VK_ESCAPE] = Keyboard.KEY_ESCAPE; // KEY_MAP[KeyEvent.VK_EURO_SIGN] = Keyboard.KEY_EURO_SIGN; // KEY_MAP[KeyEvent.VK_EXCLAMATION_MARK] = Keyboard.KEY_EXCLAMATION_MARK; KEY_MAP[KeyEvent.VK_F] = Keyboard.KEY_F; KEY_MAP[KeyEvent.VK_F1] = Keyboard.KEY_F1; KEY_MAP[KeyEvent.VK_F10] = Keyboard.KEY_F10; KEY_MAP[KeyEvent.VK_F11] = Keyboard.KEY_F11; KEY_MAP[KeyEvent.VK_F12] = Keyboard.KEY_F12; KEY_MAP[KeyEvent.VK_F13] = Keyboard.KEY_F13; KEY_MAP[KeyEvent.VK_F14] = Keyboard.KEY_F14; KEY_MAP[KeyEvent.VK_F15] = Keyboard.KEY_F15; // KEY_MAP[KeyEvent.VK_F16] = Keyboard.KEY_F16; // KEY_MAP[KeyEvent.VK_F17] = Keyboard.KEY_F17; // KEY_MAP[KeyEvent.VK_F18] = Keyboard.KEY_F18; // KEY_MAP[KeyEvent.VK_F19] = Keyboard.KEY_F19; KEY_MAP[KeyEvent.VK_F2] = Keyboard.KEY_F2; // KEY_MAP[KeyEvent.VK_F20] = Keyboard.KEY_F20; // KEY_MAP[KeyEvent.VK_F21] = Keyboard.KEY_F21; // KEY_MAP[KeyEvent.VK_F22] = Keyboard.KEY_F22; // KEY_MAP[KeyEvent.VK_F23] = Keyboard.KEY_F23; // KEY_MAP[KeyEvent.VK_F24] = Keyboard.KEY_F24; KEY_MAP[KeyEvent.VK_F3] = Keyboard.KEY_F3; KEY_MAP[KeyEvent.VK_F4] = Keyboard.KEY_F4; KEY_MAP[KeyEvent.VK_F5] = Keyboard.KEY_F5; KEY_MAP[KeyEvent.VK_F6] = Keyboard.KEY_F6; KEY_MAP[KeyEvent.VK_F7] = Keyboard.KEY_F7; KEY_MAP[KeyEvent.VK_F8] = Keyboard.KEY_F8; KEY_MAP[KeyEvent.VK_F9] = Keyboard.KEY_F9; // KEY_MAP[KeyEvent.VK_FINAL] = Keyboard.KEY_FINAL; // KEY_MAP[KeyEvent.VK_FIND] = Keyboard.KEY_FIND; // KEY_MAP[KeyEvent.VK_FULL_WIDTH] = Keyboard.KEY_FULL_WIDTH; KEY_MAP[KeyEvent.VK_G] = Keyboard.KEY_G; // KEY_MAP[KeyEvent.VK_GREATER] = Keyboard.KEY_GREATER; KEY_MAP[KeyEvent.VK_H] = Keyboard.KEY_H; // KEY_MAP[KeyEvent.VK_HALF_WIDTH] = Keyboard.KEY_HALF_WIDTH; // KEY_MAP[KeyEvent.VK_HELP] = Keyboard.KEY_HELP; // KEY_MAP[KeyEvent.VK_HIRAGANA] = Keyboard.KEY_HIRAGANA; KEY_MAP[KeyEvent.VK_HOME] = Keyboard.KEY_HOME; KEY_MAP[KeyEvent.VK_I] = Keyboard.KEY_I; // KEY_MAP[KeyEvent.VK_INPUT_METHOD_ON_OFF] = Keyboard.KEY_INPUT_METHOD_ON_OFF; KEY_MAP[KeyEvent.VK_INSERT] = Keyboard.KEY_INSERT; // KEY_MAP[KeyEvent.VK_INVERTED_EXCLAMATION_MARK] = Keyboard.KEY_INVERTED_EXCLAMATION_MARK; KEY_MAP[KeyEvent.VK_J] = Keyboard.KEY_J; // KEY_MAP[KeyEvent.VK_JAPANESE_HIRAGANA] = Keyboard.KEY_JAPANESE_HIRAGANA; // KEY_MAP[KeyEvent.VK_JAPANESE_KATAKANA] = Keyboard.KEY_JAPANESE_KATAKANA; // KEY_MAP[KeyEvent.VK_JAPANESE_ROMAN] = Keyboard.KEY_JAPANESE_ROMAN; KEY_MAP[KeyEvent.VK_K] = Keyboard.KEY_K; KEY_MAP[KeyEvent.VK_KANA] = Keyboard.KEY_KANA; // KEY_MAP[KeyEvent.VK_KANA_LOCK] = Keyboard.KEY_KANA_LOCK; KEY_MAP[KeyEvent.VK_KANJI] = Keyboard.KEY_KANJI; // KEY_MAP[KeyEvent.VK_KATAKANA] = Keyboard.KEY_KATAKANA; // KEY_MAP[KeyEvent.VK_KP_DOWN] = Keyboard.KEY_KP_DOWN; // KEY_MAP[KeyEvent.VK_KP_LEFT] = Keyboard.KEY_KP_LEFT; // KEY_MAP[KeyEvent.VK_KP_RIGHT] = Keyboard.KEY_KP_RIGHT; // KEY_MAP[KeyEvent.VK_KP_UP] = Keyboard.KEY_KP_UP; KEY_MAP[KeyEvent.VK_L] = Keyboard.KEY_L; KEY_MAP[KeyEvent.VK_LEFT] = Keyboard.KEY_LEFT; // KEY_MAP[KeyEvent.VK_LEFT_PARENTHESIS] = Keyboard.KEY_LEFT_PARENTHESIS; // KEY_MAP[KeyEvent.VK_LESS] = Keyboard.KEY_LESS; KEY_MAP[KeyEvent.VK_M] = Keyboard.KEY_M; // KEY_MAP[KeyEvent.VK_META] = Keyboard.KEY_LMENU; manually mapped KEY_MAP[KeyEvent.VK_MINUS] = Keyboard.KEY_MINUS; // KEY_MAP[KeyEvent.VK_MODECHANGE] = Keyboard.KEY_MODECHANGE; KEY_MAP[KeyEvent.VK_MULTIPLY] = Keyboard.KEY_MULTIPLY; KEY_MAP[KeyEvent.VK_N] = Keyboard.KEY_N; // KEY_MAP[KeyEvent.VK_NONCONVERT] = Keyboard.KEY_NONCONVERT; KEY_MAP[KeyEvent.VK_NUM_LOCK] = Keyboard.KEY_NUMLOCK; // KEY_MAP[KeyEvent.VK_NUMBER_SIGN] = Keyboard.KEY_NUMBER_SIGN; KEY_MAP[KeyEvent.VK_NUMPAD0] = Keyboard.KEY_NUMPAD0; KEY_MAP[KeyEvent.VK_NUMPAD1] = Keyboard.KEY_NUMPAD1; KEY_MAP[KeyEvent.VK_NUMPAD2] = Keyboard.KEY_NUMPAD2; KEY_MAP[KeyEvent.VK_NUMPAD3] = Keyboard.KEY_NUMPAD3; KEY_MAP[KeyEvent.VK_NUMPAD4] = Keyboard.KEY_NUMPAD4; KEY_MAP[KeyEvent.VK_NUMPAD5] = Keyboard.KEY_NUMPAD5; KEY_MAP[KeyEvent.VK_NUMPAD6] = Keyboard.KEY_NUMPAD6; KEY_MAP[KeyEvent.VK_NUMPAD7] = Keyboard.KEY_NUMPAD7; KEY_MAP[KeyEvent.VK_NUMPAD8] = Keyboard.KEY_NUMPAD8; KEY_MAP[KeyEvent.VK_NUMPAD9] = Keyboard.KEY_NUMPAD9; KEY_MAP[KeyEvent.VK_O] = Keyboard.KEY_O; KEY_MAP[KeyEvent.VK_OPEN_BRACKET] = Keyboard.KEY_LBRACKET; KEY_MAP[KeyEvent.VK_P] = Keyboard.KEY_P; KEY_MAP[KeyEvent.VK_PAGE_DOWN] = Keyboard.KEY_NEXT; KEY_MAP[KeyEvent.VK_PAGE_UP] = Keyboard.KEY_PRIOR; // KEY_MAP[KeyEvent.VK_PASTE] = Keyboard.KEY_PASTE; KEY_MAP[KeyEvent.VK_PAUSE] = Keyboard.KEY_PAUSE; KEY_MAP[KeyEvent.VK_PERIOD] = Keyboard.KEY_PERIOD; // KEY_MAP[KeyEvent.VK_PLUS] = Keyboard.KEY_PLUS; // KEY_MAP[KeyEvent.VK_PREVIOUS_CANDIDATE] = Keyboard.KEY_PREVIOUS_CANDIDATE; // KEY_MAP[KeyEvent.VK_PRINTSCREEN] = Keyboard.KEY_PRINTSCREEN; // KEY_MAP[KeyEvent.VK_PROPS] = Keyboard.KEY_PROPS; KEY_MAP[KeyEvent.VK_Q] = Keyboard.KEY_Q; // KEY_MAP[KeyEvent.VK_QUOTE] = Keyboard.KEY_QUOTE; // KEY_MAP[KeyEvent.VK_QUOTEDBL] = Keyboard.KEY_QUOTEDBL; KEY_MAP[KeyEvent.VK_R] = Keyboard.KEY_R; KEY_MAP[KeyEvent.VK_RIGHT] = Keyboard.KEY_RIGHT; // KEY_MAP[KeyEvent.VK_RIGHT_PARENTHESIS] = Keyboard.KEY_RIGHT_PARENTHESIS; // KEY_MAP[KeyEvent.VK_ROMAN_CHARACTERS] = Keyboard.KEY_ROMAN_CHARACTERS; KEY_MAP[KeyEvent.VK_S] = Keyboard.KEY_S; KEY_MAP[KeyEvent.VK_SCROLL_LOCK] = Keyboard.KEY_SCROLL; KEY_MAP[KeyEvent.VK_SEMICOLON] = Keyboard.KEY_SEMICOLON; KEY_MAP[KeyEvent.VK_SEPARATOR] = Keyboard.KEY_DECIMAL; // KEY_MAP[KeyEvent.VK_SHIFT] = Keyboard.KEY_LSHIFT; manually mapped KEY_MAP[KeyEvent.VK_SLASH] = Keyboard.KEY_SLASH; KEY_MAP[KeyEvent.VK_SPACE] = Keyboard.KEY_SPACE; KEY_MAP[KeyEvent.VK_STOP] = Keyboard.KEY_STOP; KEY_MAP[KeyEvent.VK_SUBTRACT] = Keyboard.KEY_SUBTRACT; KEY_MAP[KeyEvent.VK_T] = Keyboard.KEY_T; KEY_MAP[KeyEvent.VK_TAB] = Keyboard.KEY_TAB; KEY_MAP[KeyEvent.VK_U] = Keyboard.KEY_U; // KEY_MAP[KeyEvent.VK_UNDERSCORE] = Keyboard.KEY_UNDERSCORE; // KEY_MAP[KeyEvent.VK_UNDO] = Keyboard.KEY_UNDO; KEY_MAP[KeyEvent.VK_UP] = Keyboard.KEY_UP; KEY_MAP[KeyEvent.VK_V] = Keyboard.KEY_V; KEY_MAP[KeyEvent.VK_W] = Keyboard.KEY_W; KEY_MAP[KeyEvent.VK_X] = Keyboard.KEY_X; KEY_MAP[KeyEvent.VK_Y] = Keyboard.KEY_Y; KEY_MAP[KeyEvent.VK_Z] = Keyboard.KEY_Z; } KeyboardEventQueue(Component component) { super(Keyboard.EVENT_SIZE); this.component = component; } public void register() { component.addKeyListener(this); } public void unregister() { /* * This line is commented out to work around AWT bug 4867453: * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4867453 */ //component.removeKeyListener(this); } private void putKeyboardEvent(int key_code, byte state, int character, long nanos, boolean repeat) { event.clear(); event.putInt(key_code).put(state).putInt(character).putLong(nanos).put(repeat ? (byte)1 : (byte)0); event.flip(); putEvent(event); } public synchronized void poll(ByteBuffer key_down_buffer) { flushDeferredEvent(); int old_position = key_down_buffer.position(); key_down_buffer.put(key_states); key_down_buffer.position(old_position); } public synchronized void copyEvents(ByteBuffer dest) { flushDeferredEvent(); super.copyEvents(dest); } private synchronized void handleKey(int key_code, int key_location, byte state, int character, long nanos) { if (character == KeyEvent.CHAR_UNDEFINED) character = Keyboard.CHAR_NONE; if (state == 1) { boolean repeat = false; if (has_deferred_event) { if ((nanos == deferred_nanos && deferred_key_code == key_code && deferred_key_location == key_location)) { has_deferred_event = false; repeat = true; // Repeat event } else flushDeferredEvent(); } putKeyEvent(key_code, key_location, state, character, nanos, repeat); } else { flushDeferredEvent(); has_deferred_event = true; deferred_nanos = nanos; deferred_key_code = key_code; deferred_key_location = key_location; deferred_key_state = state; deferred_character = character; } } private void flushDeferredEvent() { if (has_deferred_event) { putKeyEvent(deferred_key_code, deferred_key_location, deferred_key_state, deferred_character, deferred_nanos, false); has_deferred_event = false; } } private void putKeyEvent(int key_code, int key_location, byte state, int character, long nanos, boolean repeat) { int key_code_mapped = getMappedKeyCode(key_code, key_location); /* Ignore repeating presses */ if ( key_states[key_code_mapped] == state ) repeat = true; key_states[key_code_mapped] = state; int key_int_char = character & 0xffff; putKeyboardEvent(key_code_mapped, state, key_int_char, nanos, repeat); } private int getMappedKeyCode(int key_code, int position) { // manually map positioned keys switch (key_code) { case KeyEvent.VK_ALT: // fall through if (position == KeyEvent.KEY_LOCATION_RIGHT) return Keyboard.KEY_RMENU; else return Keyboard.KEY_LMENU; case KeyEvent.VK_META: if (position == KeyEvent.KEY_LOCATION_RIGHT) return Keyboard.KEY_RMETA; else return Keyboard.KEY_LMETA; case KeyEvent.VK_SHIFT: if (position == KeyEvent.KEY_LOCATION_RIGHT) return Keyboard.KEY_RSHIFT; else return Keyboard.KEY_LSHIFT; case KeyEvent.VK_CONTROL: if (position == KeyEvent.KEY_LOCATION_RIGHT) return Keyboard.KEY_RCONTROL; else return Keyboard.KEY_LCONTROL; default: return KEY_MAP[key_code]; } } public void keyPressed(KeyEvent e) { handleKey(e.getKeyCode(), e.getKeyLocation(), (byte)1, e.getKeyChar(), e.getWhen()*1000000); } public void keyReleased(KeyEvent e) { handleKey(e.getKeyCode(), e.getKeyLocation(), (byte)0, Keyboard.CHAR_NONE, e.getWhen()*1000000); } public void keyTyped(KeyEvent e) { } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/MacOSXGLCanvas.java0000644000175000017500000000446211543426510022145 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * The AWT compatible Canvas for Mac OS X. * @author elias_naur */ import java.awt.Canvas; import java.awt.Graphics; final class MacOSXGLCanvas extends Canvas { private static final long serialVersionUID = 6916664741667434870L; private boolean canvas_painted; private boolean dirty; public void update(Graphics g) { paint(g); } public void paint(Graphics g) { synchronized ( this ) { dirty = true; canvas_painted = true; } } public boolean syncCanvasPainted() { boolean result; synchronized (this) { result = canvas_painted; canvas_painted = false; } return result; } public boolean syncIsDirty() { boolean result; synchronized ( this ) { result = dirty; dirty = false; } return result; } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/DisplayImplementation.java0000644000175000017500000001170511543426510024005 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * This is the Display implementation interface. Display delegates * to implementors of this interface. There is one DisplayImplementation * for each supported platform. * @author elias_naur */ import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.awt.Canvas; import org.lwjgl.LWJGLException; interface DisplayImplementation extends InputImplementation { void createWindow(DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException; void destroyWindow(); void switchDisplayMode(DisplayMode mode) throws LWJGLException; /** * Reset the display mode to whatever it was when LWJGL was initialized. * Fails silently. */ void resetDisplayMode(); /** * Return the length of the gamma ramp arrays. Returns 0 if gamma settings are * unsupported. * * @return the length of each gamma ramp array, or 0 if gamma settings are unsupported. */ int getGammaRampLength(); /** * Method to set the gamma ramp. */ void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException; /** * Get the driver adapter string. This is a unique string describing the actual card's hardware, eg. "Geforce2", "PS2", * "Radeon9700". If the adapter cannot be determined, this function returns null. * @return a String */ String getAdapter(); /** * Get the driver version. This is a vendor/adapter specific version string. If the version cannot be determined, * this function returns null. * @return a String */ String getVersion(); /** * Initialize and return the current display mode. */ DisplayMode init() throws LWJGLException; /** * Implementation of setTitle(). This will read the window's title member * and stash it in the native title of the window. */ void setTitle(String title); boolean isCloseRequested(); boolean isVisible(); boolean isActive(); boolean isDirty(); /** * Create the native PeerInfo. * @throws LWJGLException */ PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException; // void destroyPeerInfo(); /** * Updates the windows internal state. This must be called at least once per video frame * to handle window close requests, moves, paints, etc. */ void update(); void reshape(int x, int y, int width, int height); /** * Method for getting displaymodes */ DisplayMode[] getAvailableDisplayModes() throws LWJGLException; /* Pbuffer */ int getPbufferCapabilities(); /** * Method to test for buffer integrity */ boolean isBufferLost(PeerInfo handle); /** * Method to create a Pbuffer */ PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException; void setPbufferAttrib(PeerInfo handle, int attrib, int value); void bindTexImageToPbuffer(PeerInfo handle, int buffer); void releaseTexImageFromPbuffer(PeerInfo handle, int buffer); /** * Sets one or more icons for the Display. *

        *
      • On Windows you should supply at least one 16x16 icon and one 32x32.
      • *
      • Linux (and similar platforms) expect one 32x32 icon.
      • *
      • Mac OS X should be supplied one 128x128 icon
      • *
      * The implementation will use the supplied ByteBuffers with image data in RGBA and perform any conversions nescesarry for the specific platform. * * @param icons Array of icons in RGBA mode * @return number of icons used. */ int setIcon(ByteBuffer[] icons); } lwjgl-2.7.1/src/java/org/lwjgl/opengl/MouseEventQueue.java0000644000175000017500000001611311543426510022567 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * An AWT implementation of a LWJGL compatible Mouse event queue. * @author elias_naur */ import java.awt.Component; import java.awt.Point; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import java.nio.ByteBuffer; import java.nio.IntBuffer; import org.lwjgl.input.Mouse; class MouseEventQueue extends EventQueue implements MouseListener, MouseMotionListener, MouseWheelListener { private static final int WHEEL_SCALE = 120; public static final int NUM_BUTTONS = 3; private final Component component; private boolean grabbed; /** The accumulated mouse deltas returned by poll() */ private int accum_dx; private int accum_dy; private int accum_dz; /** The last mouse position */ private int last_x; private int last_y; /** Saved control key state for ctrl-click right button emulation */ private boolean saved_control_state; /** Event scratch array */ private final ByteBuffer event = ByteBuffer.allocate(Mouse.EVENT_SIZE); /** Buttons array */ private final byte[] buttons = new byte[NUM_BUTTONS]; MouseEventQueue(Component component) { super(Mouse.EVENT_SIZE); this.component = component; } public synchronized void register() { resetCursorToCenter(); component.addMouseListener(this); component.addMouseMotionListener(this); component.addMouseWheelListener(this); } public synchronized void unregister() { component.removeMouseListener(this); component.removeMouseMotionListener(this); component.removeMouseWheelListener(this); } protected Component getComponent() { return component; } public synchronized void setGrabbed(boolean grabbed) { this.grabbed = grabbed; resetCursorToCenter(); } public synchronized boolean isGrabbed() { return grabbed; } private int transformY(int y) { return component.getHeight() - 1 - y; } protected void resetCursorToCenter() { clearEvents(); accum_dx = accum_dy = 0; Point cursor_location = AWTUtil.getCursorPosition(component); if (cursor_location != null) { last_x = cursor_location.x; last_y = cursor_location.y; } } private void putMouseEvent(byte button, byte state, int dz, long nanos) { if (grabbed) putMouseEventWithCoords(button, state, 0, 0, dz, nanos); else putMouseEventWithCoords(button, state, last_x, last_y, dz, nanos); } protected void putMouseEventWithCoords(byte button, byte state, int coord1, int coord2, int dz, long nanos) { event.clear(); event.put(button).put(state).putInt(coord1).putInt(coord2).putInt(dz).putLong(nanos); event.flip(); putEvent(event); } public synchronized void poll(IntBuffer coord_buffer, ByteBuffer buttons_buffer) { if ( grabbed ) { coord_buffer.put(0, accum_dx); coord_buffer.put(1, accum_dy); } else { coord_buffer.put(0, last_x); coord_buffer.put(1, last_y); } coord_buffer.put(2, accum_dz); accum_dx = accum_dy = accum_dz = 0; int old_position = buttons_buffer.position(); buttons_buffer.put(buttons, 0, buttons.length); buttons_buffer.position(old_position); } private void setCursorPos(int x, int y, long nanos) { y = transformY(y); if ( grabbed ) return; int dx = x - last_x; int dy = y - last_y; addDelta(dx, dy); last_x = x; last_y = y; putMouseEventWithCoords((byte)-1, (byte)0, x, y, 0, nanos); } protected void addDelta(int dx, int dy) { accum_dx += dx; accum_dy += dy; } public void mouseClicked(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } private void handleButton(MouseEvent e) { byte state; switch (e.getID()) { case MouseEvent.MOUSE_PRESSED: state = 1; break; case MouseEvent.MOUSE_RELEASED: state = 0; break; default: throw new IllegalArgumentException("Not a valid event ID: " + e.getID()); } byte button; switch (e.getButton()) { case MouseEvent.NOBUTTON: // Nothing to do, so return return; case MouseEvent.BUTTON1: // Emulate right click if ctrl is down if (state == 1) saved_control_state = e.isControlDown(); if (saved_control_state) { if (buttons[1] == state) return; // ignore button = (byte)1; } else { button = (byte)0; } break; case MouseEvent.BUTTON2: button = (byte)2; break; case MouseEvent.BUTTON3: if (buttons[1] == state) return; // ignore button = (byte)1; break; default: throw new IllegalArgumentException("Not a valid button: " + e.getButton()); } setButton(button, state, e.getWhen()*1000000); } public synchronized void mousePressed(MouseEvent e) { handleButton(e); } private void setButton(byte button, byte state, long nanos) { buttons[button] = state; putMouseEvent(button, state, 0, nanos); } public synchronized void mouseReleased(MouseEvent e) { handleButton(e); } private void handleMotion(MouseEvent e) { if (grabbed) { updateDeltas(e.getWhen()*1000000); } else { setCursorPos(e.getX(), e.getY(), e.getWhen()*1000000); } } public synchronized void mouseDragged(MouseEvent e) { handleMotion(e); } public synchronized void mouseMoved(MouseEvent e) { handleMotion(e); } private void handleWheel(int amount, long nanos) { accum_dz += amount; putMouseEvent((byte)-1, (byte)0, amount, nanos); } protected void updateDeltas(long nanos) { } public synchronized void mouseWheelMoved(MouseWheelEvent e) { int wheel_amount = -e.getWheelRotation() * WHEEL_SCALE; handleWheel(wheel_amount, e.getWhen()*1000000); } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/WindowsPbufferPeerInfo.java0000644000175000017500000000635411543426510024072 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import java.nio.IntBuffer; import org.lwjgl.LWJGLException; /** * * @author elias_naur * @version $Revision: 3116 $ * $Id: WindowsPbufferPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ */ final class WindowsPbufferPeerInfo extends WindowsPeerInfo { WindowsPbufferPeerInfo(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { nCreate(getHandle(), width, height, pixel_format, pixelFormatCaps, pBufferAttribs); } private static native void nCreate(ByteBuffer handle, int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException; public boolean isBufferLost() { return nIsBufferLost(getHandle()); } private static native boolean nIsBufferLost(ByteBuffer handle); public void setPbufferAttrib(int attrib, int value) { nSetPbufferAttrib(getHandle(), attrib, value); } private static native void nSetPbufferAttrib(ByteBuffer handle, int attrib, int value); public void bindTexImageToPbuffer(int buffer) { nBindTexImageToPbuffer(getHandle(), buffer); } private static native void nBindTexImageToPbuffer(ByteBuffer handle, int buffer); public void releaseTexImageFromPbuffer(int buffer) { nReleaseTexImageFromPbuffer(getHandle(), buffer); } private static native void nReleaseTexImageFromPbuffer(ByteBuffer handle, int buffer); public void destroy() { nDestroy(getHandle()); } private static native void nDestroy(ByteBuffer handle); protected void doLockAndInitHandle() throws LWJGLException { // NO-OP } protected void doUnlock() throws LWJGLException { // NO-OP } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/ContextAttribsImplementation.java0000644000175000017500000000364211543426510025356 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** @author spasi */ interface ContextAttribsImplementation { int getMajorVersionAttrib(); int getMinorVersionAttrib(); int getLayerPlaneAttrib(); int getFlagsAttrib(); int getDebugBit(); int getForwardCompatibleBit(); int getProfileMaskAttrib(); int getProfileCoreBit(); int getProfileCompatibilityBit(); }lwjgl-2.7.1/src/java/org/lwjgl/opengl/LinuxMouse.java0000644000175000017500000002321611543426510021602 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * @author elias_naur */ import java.nio.ByteBuffer; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.input.Mouse; final class LinuxMouse { private static final int NUM_BUTTONS = 3; private static final int POINTER_WARP_BORDER = 10; // scale the mouse wheel according to DirectInput private static final int WHEEL_SCALE = 120; /* X11 constants */ private static final int Button1 = 1; private static final int Button2 = 2; private static final int Button3 = 3; private static final int Button4 = 4; private static final int Button5 = 5; private static final int ButtonPress = 4; private static final int ButtonRelease = 5; private final long display; private final long window; private final long input_window; private final long warp_atom; private final IntBuffer query_pointer_buffer = BufferUtils.createIntBuffer(4); private final ByteBuffer event_buffer = ByteBuffer.allocate(Mouse.EVENT_SIZE); private int last_x; private int last_y; private int accum_dx; private int accum_dy; private int accum_dz; private byte[] buttons = new byte[NUM_BUTTONS]; private EventQueue event_queue; private long last_event_nanos; LinuxMouse(long display, long window, long input_window) throws LWJGLException { this.display = display; this.window = window; this.input_window = input_window; this.warp_atom = LinuxDisplay.nInternAtom(display, "_LWJGL", false); reset(false, false); } private void reset(boolean grab, boolean warp_pointer) { event_queue = new EventQueue(event_buffer.capacity()); accum_dx = accum_dy = 0; long root_window = nQueryPointer(display, window, query_pointer_buffer); int root_x = query_pointer_buffer.get(0); int root_y = query_pointer_buffer.get(1); int win_x = query_pointer_buffer.get(2); int win_y = query_pointer_buffer.get(3); // Pretend that the cursor never moved last_x = win_x; last_y = transformY(win_y); doHandlePointerMotion(grab, warp_pointer, root_window, root_x, root_y, win_x, win_y, last_event_nanos); } public void read(ByteBuffer buffer) { event_queue.copyEvents(buffer); } public void poll(boolean grab, IntBuffer coord_buffer, ByteBuffer buttons_buffer) { if (grab) { coord_buffer.put(0, accum_dx); coord_buffer.put(1, accum_dy); } else { coord_buffer.put(0, last_x); coord_buffer.put(1, last_y); } coord_buffer.put(2, accum_dz); accum_dx = accum_dy = accum_dz = 0; for (int i = 0; i < buttons.length; i++) buttons_buffer.put(i, buttons[i]); } private void putMouseEventWithCoords(byte button, byte state, int coord1, int coord2, int dz, long nanos) { event_buffer.clear(); event_buffer.put(button).put(state).putInt(coord1).putInt(coord2).putInt(dz).putLong(nanos); event_buffer.flip(); event_queue.putEvent(event_buffer); last_event_nanos = nanos; } private void setCursorPos(boolean grab, int x, int y, long nanos) { y = transformY(y); int dx = x - last_x; int dy = y - last_y; if (dx != 0 || dy != 0) { accum_dx += dx; accum_dy += dy; last_x = x; last_y = y; if (grab) { putMouseEventWithCoords((byte)-1, (byte)0, dx, dy, 0, nanos); } else { putMouseEventWithCoords((byte)-1, (byte)0, x, y, 0, nanos); } } } private void doWarpPointer(int center_x, int center_y) { nSendWarpEvent(display, input_window, warp_atom, center_x, center_y); nWarpCursor(display, window, center_x, center_y); } private static native void nSendWarpEvent(long display, long window, long warp_atom, int center_x, int center_y); private void doHandlePointerMotion(boolean grab, boolean warp_pointer, long root_window, int root_x, int root_y, int win_x, int win_y, long nanos) { setCursorPos(grab, win_x, win_y, nanos); if (!warp_pointer) return; int root_window_height = nGetWindowHeight(display, root_window); int root_window_width = nGetWindowWidth(display, root_window); int window_height = nGetWindowHeight(display, window); int window_width = nGetWindowWidth(display, window); // find the window position in root coordinates int win_left = root_x - win_x; int win_top = root_y - win_y; int win_right = win_left + window_width; int win_bottom = win_top + window_height; // cap the window position to the screen dimensions int border_left = Math.max(0, win_left); int border_top = Math.max(0, win_top); int border_right = Math.min(root_window_width, win_right); int border_bottom = Math.min(root_window_height, win_bottom); // determine whether the cursor is outside the bounds boolean outside_limits = root_x < border_left + POINTER_WARP_BORDER || root_y < border_top + POINTER_WARP_BORDER || root_x > border_right - POINTER_WARP_BORDER || root_y > border_bottom - POINTER_WARP_BORDER; if (outside_limits) { // Find the center of the limits in window coordinates int center_x = (border_right - border_left)/2; int center_y = (border_bottom - border_top)/2; doWarpPointer(center_x, center_y); } } public void changeGrabbed(boolean grab, boolean warp_pointer) { reset(grab, warp_pointer); } public int getButtonCount() { return buttons.length; } private int transformY(int y) { return nGetWindowHeight(display, window) - 1 - y; } private static native int nGetWindowHeight(long display, long window); private static native int nGetWindowWidth(long display, long window); private static native long nQueryPointer(long display, long window, IntBuffer result); public void setCursorPosition(int x, int y) { nWarpCursor(display, window, x, transformY(y)); } private static native void nWarpCursor(long display, long window, int x, int y); private void handlePointerMotion(boolean grab, boolean warp_pointer, long millis, long root_window, int x_root, int y_root, int x, int y) { doHandlePointerMotion(grab, warp_pointer, root_window, x_root, y_root, x, y, millis*1000000); } private void handleButton(boolean grab, int button, byte state, long nanos) { byte button_num; switch (button) { case Button1: button_num = (byte)0; break; case Button2: button_num = (byte)2; break; case Button3: button_num = (byte)1; break; default: return; } buttons[button_num] = state; putMouseEvent(grab, button_num, state, 0, nanos); } private void putMouseEvent(boolean grab, byte button, byte state, int dz, long nanos) { if (grab) putMouseEventWithCoords(button, state, 0, 0, dz, nanos); else putMouseEventWithCoords(button, state, last_x, last_y, dz, nanos); } private void handleButtonPress(boolean grab, byte button, long nanos) { int delta = 0; switch (button) { case Button4: delta = WHEEL_SCALE; putMouseEvent(grab, (byte)-1, (byte)0, delta, nanos); accum_dz += delta; break; case Button5: delta = -WHEEL_SCALE; putMouseEvent(grab, (byte)-1, (byte)0, delta, nanos); accum_dz += delta; break; default: handleButton(grab, button, (byte)1, nanos); break; } } private void handleButtonEvent(boolean grab, long millis, int type, byte button) { long nanos = millis*1000000; switch (type) { case ButtonRelease: handleButton(grab, button, (byte)0, nanos); break; case ButtonPress: handleButtonPress(grab, button, nanos); break; default: break; } } private void resetCursor(int x, int y) { last_x = x; last_y = transformY(y); } private void handleWarpEvent(int x, int y) { resetCursor(x, y); } public boolean filterEvent(boolean grab, boolean warp_pointer, LinuxEvent event) { switch (event.getType()) { case LinuxEvent.ClientMessage: if (event.getClientMessageType() == warp_atom) { handleWarpEvent(event.getClientData(0), event.getClientData(1)); return true; } break; case LinuxEvent.ButtonPress: /* Fall through */ case LinuxEvent.ButtonRelease: handleButtonEvent(grab, event.getButtonTime(), event.getButtonType(), (byte)event.getButtonButton()); return true; case LinuxEvent.MotionNotify: handlePointerMotion(grab, warp_pointer, event.getButtonTime(), event.getButtonRoot(), event.getButtonXRoot(), event.getButtonYRoot(), event.getButtonX(), event.getButtonY()); return true; default: break; } return false; } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/WindowsDisplay.java0000644000175000017500000007344311543426510022461 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * This is the Display implementation interface. Display delegates * to implementors of this interface. There is one DisplayImplementation * for each supported platform. * @author elias_naur */ import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.awt.Canvas; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.BufferUtils; import org.lwjgl.input.Cursor; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; final class WindowsDisplay implements DisplayImplementation { private static final int GAMMA_LENGTH = 256; private static final int WM_CANCELMODE = 0x001F; private static final int WM_MOUSEMOVE = 0x0200; private static final int WM_LBUTTONDOWN = 0x0201; private static final int WM_LBUTTONUP = 0x0202; private static final int WM_LBUTTONDBLCLK = 0x0203; private static final int WM_RBUTTONDOWN = 0x0204; private static final int WM_RBUTTONUP = 0x0205; private static final int WM_RBUTTONDBLCLK = 0x0206; private static final int WM_MBUTTONDOWN = 0x0207; private static final int WM_MBUTTONUP = 0x0208; private static final int WM_MBUTTONDBLCLK = 0x0209; private static final int WM_MOUSEWHEEL = 0x020A; private static final int WM_CAPTURECHANGED = 0x0215; private static final int WM_MOUSELEAVE = 0x02A3; private static final int WM_KEYDOWN = 256; private static final int WM_KEYUP = 257; private static final int WM_SYSKEYUP = 261; private static final int WM_SYSKEYDOWN = 260; private static final int WM_SYSCHAR = 262; private static final int WM_CHAR = 258; private static final int WM_SETICON = 0x0080; private static final int WM_QUIT = 0x0012; private static final int WM_SYSCOMMAND = 0x0112; private static final int WM_PAINT = 0x000F; private static final int WM_KILLFOCUS = 8; private static final int WM_SETFOCUS = 7; private static final int SC_SIZE = 0xF000; private static final int SC_MOVE = 0xF010; private static final int SC_MINIMIZE = 0xF020; private static final int SC_MAXIMIZE = 0xF030; private static final int SC_NEXTWINDOW = 0xF040; private static final int SC_PREVWINDOW = 0xF050; private static final int SC_CLOSE = 0xF060; private static final int SC_VSCROLL = 0xF070; private static final int SC_HSCROLL = 0xF080; private static final int SC_MOUSEMENU = 0xF090; private static final int SC_KEYMENU = 0xF100; private static final int SC_ARRANGE = 0xF110; private static final int SC_RESTORE = 0xF120; private static final int SC_TASKLIST = 0xF130; private static final int SC_SCREENSAVE = 0xF140; private static final int SC_HOTKEY = 0xF150; private static final int SC_DEFAULT = 0xF160; private static final int SC_MONITORPOWER = 0xF170; private static final int SC_CONTEXTHELP = 0xF180; private static final int SC_SEPARATOR = 0xF00F; static final int SM_CXCURSOR = 13; static final int SM_CYCURSOR = 14; static final int SM_CMOUSEBUTTONS = 43; static final int SM_MOUSEWHEELPRESENT = 75; private static final int SIZE_RESTORED = 0; private static final int SIZE_MINIMIZED = 1; private static final int SIZE_MAXIMIZED = 2; private static final int WM_SIZE = 0x0005; private static final int WM_ACTIVATE = 0x0006; private static final int WA_INACTIVE = 0; private static final int WA_ACTIVE = 1; private static final int WA_CLICKACTIVE = 2; private static final int SW_SHOWMINNOACTIVE = 7; private static final int SW_SHOWDEFAULT = 10; private static final int SW_RESTORE = 9; private static final int ICON_SMALL = 0; private static final int ICON_BIG = 1; private static final IntBuffer rect_buffer = BufferUtils.createIntBuffer(4); private static final Rect rect = new Rect(); private static final Rect rect2 = new Rect(); private static WindowsDisplay current_display; private static boolean cursor_clipped; private WindowsDisplayPeerInfo peer_info; private Object current_cursor; private Canvas parent; private static boolean hasParent; private WindowsKeyboard keyboard; private WindowsMouse mouse; private boolean close_requested; private boolean is_dirty; private ByteBuffer current_gamma; private ByteBuffer saved_gamma; private DisplayMode current_mode; private boolean mode_set; private boolean isMinimized; private boolean isFocused; private boolean did_maximize; private boolean inAppActivate; private long hwnd; private long hdc; private long small_icon; private long large_icon; private int captureMouse = -1; private boolean trackingMouse; private boolean mouseInside; WindowsDisplay() { current_display = this; } public void createWindow(DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException { close_requested = false; is_dirty = false; isMinimized = false; isFocused = false; did_maximize = false; this.parent = parent; hasParent = parent != null; long parent_hwnd = parent != null ? getHwnd(parent) : 0; this.hwnd = nCreateWindow(x, y, mode.getWidth(), mode.getHeight(), Display.isFullscreen() || isUndecorated(), parent != null, parent_hwnd); if (hwnd == 0) { throw new LWJGLException("Failed to create window"); } this.hdc = getDC(hwnd); if (hdc == 0) { nDestroyWindow(hwnd); throw new LWJGLException("Failed to get dc"); } try { int format = WindowsPeerInfo.choosePixelFormat(getHdc(), 0, 0, peer_info.getPixelFormat(), null, true, true, false, true); WindowsPeerInfo.setPixelFormat(getHdc(), format); peer_info.initDC(getHwnd(), getHdc()); showWindow(getHwnd(), SW_SHOWDEFAULT); if (parent == null) { setForegroundWindow(getHwnd()); setFocus(getHwnd()); } } catch (LWJGLException e) { nReleaseDC(hwnd, hdc); nDestroyWindow(hwnd); throw e; } } private static native long nCreateWindow(int x, int y, int width, int height, boolean undecorated, boolean child_window, long parent_hwnd) throws LWJGLException; private static boolean isUndecorated() { return Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated"); } private static long getHwnd(Canvas parent) throws LWJGLException { AWTCanvasImplementation awt_impl = AWTGLCanvas.createImplementation(); WindowsPeerInfo parent_peer_info = (WindowsPeerInfo)awt_impl.createPeerInfo(parent, null); ByteBuffer parent_peer_info_handle = parent_peer_info.lockAndGetHandle(); try { return parent_peer_info.getHwnd(); } finally { parent_peer_info.unlock(); } } public void destroyWindow() { nReleaseDC(hwnd, hdc); nDestroyWindow(hwnd); freeLargeIcon(); freeSmallIcon(); resetCursorClipping(); } private static native void nReleaseDC(long hwnd, long hdc); private static native void nDestroyWindow(long hwnd); static void resetCursorClipping() { if (cursor_clipped) { try { clipCursor(null); } catch (LWJGLException e) { LWJGLUtil.log("Failed to reset cursor clipping: " + e); } cursor_clipped = false; } } private static void getGlobalClientRect(long hwnd, Rect rect) { rect_buffer.put(0, 0).put(1, 0); clientToScreen(hwnd, rect_buffer); int offset_x = rect_buffer.get(0); int offset_y = rect_buffer.get(1); getClientRect(hwnd, rect_buffer); rect.copyFromBuffer(rect_buffer); rect.offset(offset_x, offset_y); } static void setupCursorClipping(long hwnd) throws LWJGLException { cursor_clipped = true; getGlobalClientRect(hwnd, rect); rect.copyToBuffer(rect_buffer); clipCursor(rect_buffer); } private static native void clipCursor(IntBuffer rect) throws LWJGLException; public void switchDisplayMode(DisplayMode mode) throws LWJGLException { nSwitchDisplayMode(mode); current_mode = mode; mode_set = true; } private static native void nSwitchDisplayMode(DisplayMode mode) throws LWJGLException; /* * Called when the application is alt-tabbed to or from */ private void appActivate(boolean active) { if (inAppActivate) { return; } inAppActivate = true; isFocused = active; if (active) { if (Display.isFullscreen()) { restoreDisplayMode(); } if (parent == null) { showWindow(getHwnd(), SW_RESTORE); setForegroundWindow(getHwnd()); setFocus(getHwnd()); } did_maximize = true; if (Display.isFullscreen()) updateClipping(); } else if (Display.isFullscreen()) { showWindow(getHwnd(), SW_SHOWMINNOACTIVE); resetDisplayMode(); } else updateClipping(); updateCursor(); inAppActivate = false; } private static native void showWindow(long hwnd, int mode); private static native void setForegroundWindow(long hwnd); private static native void setFocus(long hwnd); private void restoreDisplayMode() { try { doSetGammaRamp(current_gamma); } catch (LWJGLException e) { LWJGLUtil.log("Failed to restore gamma: " + e.getMessage()); } if (!mode_set) { mode_set = true; try { nSwitchDisplayMode(current_mode); } catch (LWJGLException e) { LWJGLUtil.log("Failed to restore display mode: " + e.getMessage()); } } } public void resetDisplayMode() { try { doSetGammaRamp(saved_gamma); } catch (LWJGLException e) { LWJGLUtil.log("Failed to reset gamma ramp: " + e.getMessage()); } current_gamma = saved_gamma; if (mode_set) { mode_set = false; nResetDisplayMode(); } resetCursorClipping(); } private static native void nResetDisplayMode(); public int getGammaRampLength() { return GAMMA_LENGTH; } public void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException { doSetGammaRamp(convertToNativeRamp(gammaRamp)); } private static native ByteBuffer convertToNativeRamp(FloatBuffer gamma_ramp) throws LWJGLException; private static native ByteBuffer getCurrentGammaRamp() throws LWJGLException; private void doSetGammaRamp(ByteBuffer native_gamma) throws LWJGLException { nSetGammaRamp(native_gamma); current_gamma = native_gamma; } private static native void nSetGammaRamp(ByteBuffer native_ramp) throws LWJGLException; public String getAdapter() { try { String maxObjNo = WindowsRegistry.queryRegistrationKey( WindowsRegistry.HKEY_LOCAL_MACHINE, "HARDWARE\\DeviceMap\\Video", "MaxObjectNumber"); int maxObjectNumber = maxObjNo.charAt(0); String vga_driver_value = ""; for(int i=0;i0) { WindowsFileVersion version = nGetVersion(drivers[0] + ".dll"); if (version != null) return version.toString(); } } return null; } private native WindowsFileVersion nGetVersion(String driver); public DisplayMode init() throws LWJGLException { current_gamma = saved_gamma = getCurrentGammaRamp(); return current_mode = getCurrentDisplayMode(); } private static native DisplayMode getCurrentDisplayMode() throws LWJGLException; public void setTitle(String title) { nSetTitle(hwnd, title); } private static native void nSetTitle(long hwnd, String title); public boolean isCloseRequested() { boolean saved = close_requested; close_requested = false; return saved; } public boolean isVisible() { return !isMinimized; } public boolean isActive() { return isFocused; } public boolean isDirty() { boolean saved = is_dirty; is_dirty = false; return saved; } public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { peer_info = new WindowsDisplayPeerInfo(pixel_format); return peer_info; } public void update() { nUpdate(); if (parent != null && parent.isFocusOwner()) { setFocus(getHwnd()); } if (did_maximize) { did_maximize = false; /** * WORKAROUND: * Making the context current (redundantly) when the window * is maximized helps some gfx cards recover from fullscreen */ try { Context context = ((DrawableLWJGL)Display.getDrawable()).getContext(); if (context != null && context.isCurrent()) context.makeCurrent(); } catch (LWJGLException e) { LWJGLUtil.log("Exception occurred while trying to make context current: " + e); } } } private static native void nUpdate(); public void reshape(int x, int y, int width, int height) { nReshape(getHwnd(), x, y, width, height, Display.isFullscreen() || isUndecorated(), parent != null); } private static native void nReshape(long hwnd, int x, int y, int width, int height, boolean undecorated, boolean child); public native DisplayMode[] getAvailableDisplayModes() throws LWJGLException; /* Mouse */ public boolean hasWheel() { return mouse.hasWheel(); } public int getButtonCount() { return mouse.getButtonCount(); } public void createMouse() throws LWJGLException { mouse = new WindowsMouse(getHwnd()); } public void destroyMouse() { if (mouse != null) mouse.destroy(); mouse = null; } public void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons) { mouse.poll(coord_buffer, buttons); } public void readMouse(ByteBuffer buffer) { mouse.read(buffer); } public void grabMouse(boolean grab) { mouse.grab(grab, shouldGrab()); updateCursor(); } public int getNativeCursorCapabilities() { return Cursor.CURSOR_ONE_BIT_TRANSPARENCY; } public void setCursorPosition(int x, int y) { getGlobalClientRect(getHwnd(), rect); int transformed_x = rect.left + x; int transformed_y = rect.bottom - 1 - y; nSetCursorPosition(transformed_x, transformed_y); setMousePosition(x, y); } private static native void nSetCursorPosition(int x, int y); public void setNativeCursor(Object handle) throws LWJGLException { current_cursor = handle; updateCursor(); } private void updateCursor() { try { if (mouse != null && shouldGrab()) nSetNativeCursor(getHwnd(), mouse.getBlankCursor()); else nSetNativeCursor(getHwnd(), current_cursor); } catch (LWJGLException e) { LWJGLUtil.log("Failed to update cursor: " + e); } } static native void nSetNativeCursor(long hwnd, Object handle) throws LWJGLException; public int getMinCursorSize() { return getSystemMetrics(SM_CXCURSOR); } public int getMaxCursorSize() { return getSystemMetrics(SM_CXCURSOR); } static native int getSystemMetrics(int index); private static native long getDllInstance(); private long getHwnd() { return hwnd; } private long getHdc() { return hdc; } private static native long getDC(long hwnd); private static native long getDesktopWindow(); private static native long getForegroundWindow(); static void centerCursor(long hwnd) { if (getForegroundWindow() != hwnd && !hasParent) return; getGlobalClientRect(hwnd, rect); int local_offset_x = rect.left; int local_offset_y = rect.top; /* -- This is wrong on multi-monitor setups getGlobalClientRect(getDesktopWindow(), rect2); Rect.intersect(rect, rect2, rect); */ int center_x = (rect.left + rect.right)/2; int center_y = (rect.top + rect.bottom)/2; nSetCursorPosition(center_x, center_y); int local_x = center_x - local_offset_x; int local_y = center_y - local_offset_y; if (current_display != null) current_display.setMousePosition(local_x, transformY(hwnd, local_y)); } private void setMousePosition(int x, int y) { if (mouse != null) mouse.setPosition(x, y); } /* Keyboard */ public void createKeyboard() throws LWJGLException { keyboard = new WindowsKeyboard(getHwnd()); } public void destroyKeyboard() { keyboard.destroy(); keyboard = null; } public void pollKeyboard(ByteBuffer keyDownBuffer) { keyboard.poll(keyDownBuffer); } public void readKeyboard(ByteBuffer buffer) { keyboard.read(buffer); } // public native int isStateKeySet(int key); public static native ByteBuffer nCreateCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, int images_offset, IntBuffer delays, int delays_offset) throws LWJGLException; public Object createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException { return doCreateCursor(width, height, xHotspot, yHotspot, numImages, images, delays); } static Object doCreateCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException { return nCreateCursor(width, height, xHotspot, yHotspot, numImages, images, images.position(), delays, delays != null ? delays.position() : -1); } public void destroyCursor(Object cursorHandle) { doDestroyCursor(cursorHandle); } static native void doDestroyCursor(Object cursorHandle); public int getPbufferCapabilities() { try { // Return the capabilities of a minimum pixel format return nGetPbufferCapabilities(new PixelFormat(0, 0, 0, 0, 0, 0, 0, 0, false)); } catch (LWJGLException e) { LWJGLUtil.log("Exception occurred while determining pbuffer capabilities: " + e); return 0; } } private native int nGetPbufferCapabilities(PixelFormat format) throws LWJGLException; public boolean isBufferLost(PeerInfo handle) { return ((WindowsPbufferPeerInfo)handle).isBufferLost(); } public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { return new WindowsPbufferPeerInfo(width, height, pixel_format, pixelFormatCaps, pBufferAttribs); } public void setPbufferAttrib(PeerInfo handle, int attrib, int value) { ((WindowsPbufferPeerInfo)handle).setPbufferAttrib(attrib, value); } public void bindTexImageToPbuffer(PeerInfo handle, int buffer) { ((WindowsPbufferPeerInfo)handle).bindTexImageToPbuffer(buffer); } public void releaseTexImageFromPbuffer(PeerInfo handle, int buffer) { ((WindowsPbufferPeerInfo)handle).releaseTexImageFromPbuffer(buffer); } private void freeSmallIcon() { if (small_icon != 0) { destroyIcon(small_icon); small_icon = 0; } } private void freeLargeIcon() { if (large_icon != 0) { destroyIcon(large_icon); large_icon = 0; } } /** * Sets one or more icons for the Display. *
        *
      • On Windows you should supply at least one 16x16 icon and one 32x32.
      • *
      • Linux (and similar platforms) expect one 32x32 icon.
      • *
      • Mac OS X should be supplied one 128x128 icon
      • *
      * The implementation will use the supplied ByteBuffers with image data in RGBA and perform any conversions nescesarry for the specific platform. * * @param icons Array of icons in RGBA mode * @return number of icons used. */ public int setIcon(ByteBuffer[] icons) { boolean done_small = false; boolean done_large = false; int used = 0; int small_icon_size = 16; int large_icon_size = 32; for ( ByteBuffer icon : icons ) { int size = icon.limit() / 4; if ( (((int)Math.sqrt(size)) == small_icon_size) && (!done_small) ) { freeSmallIcon(); small_icon = createIcon(small_icon_size, small_icon_size, icon.asIntBuffer()); sendMessage(hwnd, WM_SETICON, ICON_SMALL, small_icon); used++; done_small = true; } if ( (((int)Math.sqrt(size)) == large_icon_size) && (!done_large) ) { freeLargeIcon(); large_icon = createIcon(large_icon_size, large_icon_size, icon.asIntBuffer()); sendMessage(hwnd, WM_SETICON, ICON_BIG, large_icon); used++; done_large = true; } } return used; } private static native long createIcon(int width, int height, IntBuffer icon); private static native void destroyIcon(long handle); private static native long sendMessage(long hwnd, long msg, long wparam, long lparam); private void handleMouseButton(int button, int state, long millis) { if (mouse != null) { mouse.handleMouseButton((byte)button, (byte)state, millis); // need to capture? if (captureMouse == -1 && button != -1 && state == 1) { captureMouse = button; nSetCapture(hwnd); } // done with capture? if(captureMouse != -1 && button == captureMouse && state == 0) { captureMouse = -1; nReleaseCapture(); } } if (parent != null && !isFocused) { setFocus(getHwnd()); } } private boolean shouldGrab() { return !isMinimized && isFocused && Mouse.isGrabbed(); } private void handleMouseMoved(int x, int y, long millis) { if (mouse != null) { mouse.handleMouseMoved(x, y, millis, shouldGrab()); } } private static native long nSetCapture(long hwnd); private static native boolean nReleaseCapture(); private void handleMouseScrolled(int amount, long millis) { if (mouse != null) mouse.handleMouseScrolled(amount, millis); } private static native void getClientRect(long hwnd, IntBuffer rect); private void handleChar(long wParam, long lParam, long millis) { byte previous_state = (byte)((lParam >>> 30) & 0x1); byte state = (byte)(1 - ((lParam >>> 31) & 0x1)); boolean repeat = state == previous_state; if (keyboard != null) keyboard.handleChar((int)(wParam & 0xFF), millis, repeat); } private void handleKeyButton(long wParam, long lParam, long millis) { byte previous_state = (byte)((lParam >>> 30) & 0x1); byte state = (byte)(1 - ((lParam >>> 31) & 0x1)); boolean repeat = state == previous_state; // Repeat message byte extended = (byte)((lParam >>> 24) & 0x1); int scan_code = (int)((lParam >>> 16) & 0xFF); if (keyboard != null) { keyboard.handleKey((int)wParam, scan_code, extended != 0, state, millis, repeat); } } private static int transformY(long hwnd, int y) { getClientRect(hwnd, rect_buffer); rect.copyFromBuffer(rect_buffer); return (rect.bottom - rect.top) - 1 - y; } private static native void clientToScreen(long hwnd, IntBuffer point); private static int handleMessage(long hwnd, int msg, long wParam, long lParam, long millis) { if (current_display != null) return current_display.doHandleMessage(hwnd, msg, wParam, lParam, millis); else return defWindowProc(hwnd, msg, wParam, lParam); } private static native int defWindowProc(long hwnd, int msg, long wParam, long lParam); private void checkCursorState() { updateClipping(); } private void updateClipping() { if ((Display.isFullscreen() || (mouse != null && mouse.isGrabbed())) && !isMinimized && isFocused && (getForegroundWindow() == getHwnd() || hasParent)) { try { setupCursorClipping(getHwnd()); } catch (LWJGLException e) { LWJGLUtil.log("setupCursorClipping failed: " + e.getMessage()); } } else { resetCursorClipping(); } } private void setMinimized(boolean m) { isMinimized = m; checkCursorState(); } private int doHandleMessage(long hwnd, int msg, long wParam, long lParam, long millis) { switch (msg) { // disable screen saver and monitor power down messages which wreak havoc case WM_ACTIVATE: switch ((int)wParam) { case WA_ACTIVE: case WA_CLICKACTIVE: appActivate(true); break; case WA_INACTIVE: appActivate(false); break; } return 0; case WM_SIZE: switch ((int)wParam) { case SIZE_RESTORED: case SIZE_MAXIMIZED: setMinimized(false); break; case SIZE_MINIMIZED: setMinimized(true); break; } return defWindowProc(hwnd, msg, wParam, lParam); case WM_KILLFOCUS: appActivate(false); return 0; case WM_SETFOCUS: appActivate(true); return 0; case WM_MOUSEMOVE: int xPos = (int)(short)(lParam & 0xFFFF); int yPos = transformY(getHwnd(), (int)(short)((lParam >> 16) & 0xFFFF)); handleMouseMoved(xPos, yPos, millis); checkCursorState(); mouseInside = true; if(!trackingMouse) { trackingMouse = nTrackMouseEvent(hwnd); } return 0; case WM_MOUSEWHEEL: int dwheel = (int)(short)((wParam >> 16) & 0xFFFF); handleMouseScrolled(dwheel, millis); return 0; case WM_LBUTTONDOWN: handleMouseButton(0, 1, millis); return 0; case WM_LBUTTONUP: handleMouseButton(0, 0, millis); return 0; case WM_RBUTTONDOWN: handleMouseButton(1, 1, millis); return 0; case WM_RBUTTONUP: handleMouseButton(1, 0, millis); return 0; case WM_MBUTTONDOWN: handleMouseButton(2, 1, millis); return 0; case WM_MBUTTONUP: handleMouseButton(2, 0, millis); return 0; case WM_SYSCHAR: case WM_CHAR: handleChar(wParam, lParam, millis); return 0; case WM_SYSKEYUP: /* Fall through */ case WM_KEYUP: // SysRq apparently only generates WM_KEYUP, so we'll fake a WM_KEYDOWN if (wParam == WindowsKeycodes.VK_SNAPSHOT && keyboard != null && !keyboard.isKeyDown(org.lwjgl.input.Keyboard.KEY_SYSRQ)) { // Set key state to pressed long fake_lparam = lParam & ~(1 << 31); // Set key previous state to released fake_lparam &= ~(1 << 30); handleKeyButton(wParam, fake_lparam, millis); } /* Fall through */ case WM_SYSKEYDOWN: /* Fall through */ case WM_KEYDOWN: handleKeyButton(wParam, lParam, millis); return defWindowProc(hwnd, msg, wParam, lParam); case WM_QUIT: close_requested = true; return 0; case WM_SYSCOMMAND: switch ((int)(wParam & 0xfff0)) { case SC_KEYMENU: case SC_MOUSEMENU: case SC_SCREENSAVE: case SC_MONITORPOWER: return 0; case SC_CLOSE: close_requested = true; return 0; default: break; } return defWindowProc(hwnd, msg, wParam, lParam); case WM_PAINT: is_dirty = true; return defWindowProc(hwnd, msg, wParam, lParam); case WM_MOUSELEAVE: mouseInside = false; trackingMouse = false; return defWindowProc(hwnd, msg, wParam, lParam); case WM_CANCELMODE: nReleaseCapture(); /* fall through */ case WM_CAPTURECHANGED: if(captureMouse != -1) { handleMouseButton(captureMouse, 0, millis); captureMouse = -1; } return 0; default: return defWindowProc(hwnd, msg, wParam, lParam); } } public int getWidth() { return Display.getDisplayMode().getWidth(); } public int getHeight() { return Display.getDisplayMode().getHeight(); } private int firstMouseButtonDown() { for(int i=0; i * An AWT rendering context. *

      * * @author $Author: spasi $ * $Id: AWTGLCanvas.java 3418 2010-09-28 21:11:35Z spasi $ * @version $Revision: 3418 $ */ public class AWTGLCanvas extends Canvas implements DrawableLWJGL, ComponentListener, HierarchyListener { private static final long serialVersionUID = 1L; private static final AWTCanvasImplementation implementation; private boolean update_context; private Object SYNC_LOCK = new Object(); /** The requested pixel format */ private final PixelFormat pixel_format; /** The drawable to share context with */ private final Drawable drawable; /** The ContextAttribs to use when creating the context */ private final ContextAttribs attribs; /** Context handle */ private PeerInfo peer_info; private Context context; /** * re-entry counter for support for re-entrant * redrawing in paint(). It happens when using dialog boxes. */ private int reentry_count; /** Tracks whether initGL() needs to be called */ private boolean first_run; static { Sys.initialize(); implementation = createImplementation(); } static AWTCanvasImplementation createImplementation() { switch ( LWJGLUtil.getPlatform() ) { case LWJGLUtil.PLATFORM_LINUX: return new LinuxCanvasImplementation(); case LWJGLUtil.PLATFORM_WINDOWS: return new WindowsCanvasImplementation(); case LWJGLUtil.PLATFORM_MACOSX: return new MacOSXCanvasImplementation(); default: throw new IllegalStateException("Unsupported platform"); } } private void setUpdate() { synchronized ( SYNC_LOCK ) { update_context = true; } } /** This method should only be called internally. */ public Context getContext() { return context; } /** This method should only be called internally. */ public Context createSharedContext() throws LWJGLException { synchronized ( SYNC_LOCK ) { if ( context == null ) throw new IllegalStateException("Canvas not yet displayable"); return new Context(peer_info, context.getContextAttribs(), context); } } /** Constructor using the default PixelFormat. */ public AWTGLCanvas() throws LWJGLException { this(new PixelFormat()); } /** * Create an AWTGLCanvas with the requested PixelFormat on the default GraphicsDevice. * * @param pixel_format The desired pixel format. May not be null */ public AWTGLCanvas(PixelFormat pixel_format) throws LWJGLException { this(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(), pixel_format); } /** * Create an AWTGLCanvas with the requested PixelFormat on the default GraphicsDevice. * * @param device the device to create the canvas on. * @param pixel_format The desired pixel format. May not be null */ public AWTGLCanvas(GraphicsDevice device, PixelFormat pixel_format) throws LWJGLException { this(device, pixel_format, null); } /** * Create an AWTGLCanvas with the requested PixelFormat on the specified GraphicsDevice. * * @param device the device to create the canvas on. * @param pixel_format The desired pixel format. May not be null * @param drawable The Drawable to share context with */ public AWTGLCanvas(GraphicsDevice device, PixelFormat pixel_format, Drawable drawable) throws LWJGLException { this(device, pixel_format, drawable, null); } /** * Create an AWTGLCanvas with the requested PixelFormat on the specified GraphicsDevice. * * @param device the device to create the canvas on. * @param pixel_format The desired pixel format. May not be null * @param drawable The Drawable to share context with * @param attribs The ContextAttribs to use when creating the context. (optional, may be null) */ public AWTGLCanvas(GraphicsDevice device, PixelFormat pixel_format, Drawable drawable, ContextAttribs attribs) throws LWJGLException { super(implementation.findConfiguration(device, pixel_format)); if ( pixel_format == null ) throw new NullPointerException("Pixel format must be non-null"); addHierarchyListener(this); addComponentListener(this); this.drawable = drawable; this.pixel_format = pixel_format; this.attribs = attribs; } /* (non-Javadoc) * @see java.awt.Canvas#addNotify() */ public void addNotify() { super.addNotify(); } /* (non-Javadoc) * @see java.awt.Component#removeNotify() */ public void removeNotify() { synchronized ( SYNC_LOCK ) { destroy(); super.removeNotify(); } } /** Set swap interval. */ public void setSwapInterval(int swap_interval) { synchronized ( SYNC_LOCK ) { if ( context == null ) throw new IllegalStateException("Canvas not yet displayable"); Context.setSwapInterval(swap_interval); } } /** Enable vsync */ public void setVSyncEnabled(boolean enabled) { setSwapInterval(enabled ? 1 : 0); } /** Swap the canvas' buffer */ public void swapBuffers() throws LWJGLException { synchronized ( SYNC_LOCK ) { if ( context == null ) throw new IllegalStateException("Canvas not yet displayable"); Context.swapBuffers(); } } public boolean isCurrent() throws LWJGLException { synchronized ( SYNC_LOCK ) { if ( context == null ) throw new IllegalStateException("Canvas not yet displayable"); return context.isCurrent(); } } /** * Make the canvas' context current. It is highly recommended that the context * is only made current inside the AWT thread (for example in an overridden paintGL()). */ public void makeCurrent() throws LWJGLException { synchronized ( SYNC_LOCK ) { if ( context == null ) throw new IllegalStateException("Canvas not yet displayable"); context.makeCurrent(); } } public void releaseContext() throws LWJGLException { synchronized ( SYNC_LOCK ) { if ( context == null ) throw new IllegalStateException("Canvas not yet displayable"); if ( context.isCurrent() ) Context.releaseCurrentContext(); } } /** Destroy the OpenGL context. This happens when the component becomes undisplayable */ public final void destroy() { synchronized ( SYNC_LOCK ) { try { if ( context != null ) { context.forceDestroy(); context = null; reentry_count = 0; peer_info.destroy(); peer_info = null; } } catch (LWJGLException e) { throw new RuntimeException(e); } } } public final void setCLSharingProperties(final PointerBuffer properties) throws LWJGLException { synchronized ( SYNC_LOCK ) { if ( context == null ) throw new IllegalStateException("Canvas not yet displayable"); context.setCLSharingProperties(properties); } } /** * Override this to do initialising of the context. * It will be called once from paint(), immediately after * the context is created and made current. */ protected void initGL() { } /** Override this to do painting */ protected void paintGL() { } /** * The default paint() operation makes the context current and calls paintGL() which should * be overridden to do GL operations. */ public final void paint(Graphics g) { LWJGLException exception = null; synchronized ( SYNC_LOCK ) { if ( !isDisplayable() ) return; try { if ( peer_info == null ) { this.peer_info = implementation.createPeerInfo(this, pixel_format); } peer_info.lockAndGetHandle(); try { if ( context == null ) { this.context = new Context(peer_info, attribs, drawable != null ? ((DrawableLWJGL)drawable).getContext() : null); first_run = true; } if ( reentry_count == 0 ) context.makeCurrent(); reentry_count++; try { if ( update_context ) { context.update(); update_context = false; } if ( first_run ) { first_run = false; initGL(); } paintGL(); } finally { reentry_count--; if ( reentry_count == 0 ) Context.releaseCurrentContext(); } } finally { peer_info.unlock(); } } catch (LWJGLException e) { exception = e; } } if ( exception != null ) exceptionOccurred(exception); } /** * This method will be called if an unhandled LWJGLException occurs in paint(). * Override this method to be notified of this. * * @param exception The exception that occurred. */ protected void exceptionOccurred(LWJGLException exception) { LWJGLUtil.log("Unhandled exception occurred, skipping paint(): " + exception); } /** override update to avoid clearing */ public void update(Graphics g) { paint(g); } public void componentShown(ComponentEvent e) { } public void componentHidden(ComponentEvent e) { } public void componentResized(ComponentEvent e) { setUpdate(); } public void componentMoved(ComponentEvent e) { setUpdate(); } public void setLocation(int x, int y) { super.setLocation(x, y); setUpdate(); } public void setLocation(Point p) { super.setLocation(p); setUpdate(); } public void setSize(Dimension d) { super.setSize(d); setUpdate(); } public void setSize(int width, int height) { super.setSize(width, height); setUpdate(); } public void setBounds(int x, int y, int width, int height) { super.setBounds(x, y, width, height); setUpdate(); } public void hierarchyChanged(HierarchyEvent e) { setUpdate(); } }lwjgl-2.7.1/src/java/org/lwjgl/opengl/WindowsKeyboard.java0000644000175000017500000001400611543426510022602 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * This is the Windows implementation of the Keyboard. * @author elias_naur */ import java.nio.ByteBuffer; import java.nio.CharBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.input.Keyboard; final class WindowsKeyboard { private static final int MAPVK_VK_TO_VSC = 0; private static final int BUFFER_SIZE = 50; private final long hwnd; private final ByteBuffer keyboard_state; private final byte[] key_down_buffer = new byte[Keyboard.KEYBOARD_SIZE]; private final EventQueue event_queue = new EventQueue(Keyboard.EVENT_SIZE); private final ByteBuffer tmp_event = ByteBuffer.allocate(Keyboard.EVENT_SIZE); private boolean grabbed; private boolean has_retained_event; // Indicates if we're waiting for a WM_CHAR private int retained_key_code; private byte retained_state; private int retained_char; private long retained_millis; private boolean retained_repeat; WindowsKeyboard(long hwnd) throws LWJGLException { this.hwnd = hwnd; keyboard_state = BufferUtils.createByteBuffer(256); } private static native boolean isWindowsNT(); public void destroy() { } boolean isKeyDown(int lwjgl_keycode) { return key_down_buffer[lwjgl_keycode] == 1; } public void grab(boolean grab) { if(grab) { if (!grabbed) { grabbed = true; } } else { if (grabbed) { grabbed = false; } } } public void poll(ByteBuffer keyDownBuffer) { int old_position = keyDownBuffer.position(); keyDownBuffer.put(key_down_buffer); keyDownBuffer.position(old_position); } private static native int MapVirtualKey(int uCode, int uMapType); private static native int ToUnicode(int wVirtKey, int wScanCode, ByteBuffer lpKeyState, CharBuffer pwszBuff, int cchBuff, int flags); private static native int ToAscii(int wVirtKey, int wScanCode, ByteBuffer lpKeyState, ByteBuffer lpChar, int flags); private static native int GetKeyboardState(ByteBuffer lpKeyState); private static native int GetKeyState(int virt_key); private void putEvent(int keycode, byte state, int ch, long millis, boolean repeat) { tmp_event.clear(); tmp_event.putInt(keycode).put(state).putInt(ch).putLong(millis*1000000).put(repeat ? (byte)1 : (byte)0); tmp_event.flip(); event_queue.putEvent(tmp_event); } private boolean checkShiftKey(int virt_key, byte state) { int key_state = (GetKeyState(virt_key) >>> 15) & 0x1; int lwjgl_code = WindowsKeycodes.mapVirtualKeyToLWJGLCode(virt_key); return (key_down_buffer[lwjgl_code] == 1 - state) && (key_state == state); } private int translateShift(int scan_code, byte state) { if (checkShiftKey(WindowsKeycodes.VK_LSHIFT, state)) { return WindowsKeycodes.VK_LSHIFT; } else if (checkShiftKey(WindowsKeycodes.VK_RSHIFT, state)) { return WindowsKeycodes.VK_RSHIFT; } else { if (scan_code== 0x2A) return WindowsKeycodes.VK_LSHIFT; else { if (scan_code == 0x36) return WindowsKeycodes.VK_RSHIFT; else return WindowsKeycodes.VK_LSHIFT; } } } private int translateExtended(int virt_key, int scan_code, byte state, boolean extended) { switch (virt_key) { case WindowsKeycodes.VK_SHIFT: return translateShift(scan_code, state); case WindowsKeycodes.VK_CONTROL: return extended ? WindowsKeycodes.VK_RCONTROL : WindowsKeycodes.VK_LCONTROL; case WindowsKeycodes.VK_MENU: return extended ? WindowsKeycodes.VK_RMENU : WindowsKeycodes.VK_LMENU; default: return virt_key; } } private void flushRetained() { if (has_retained_event) { has_retained_event = false; putEvent(retained_key_code, retained_state, retained_char, retained_millis, retained_repeat); } } public void handleKey(int virt_key, int scan_code, boolean extended, byte event_state, long millis, boolean repeat) { virt_key = translateExtended(virt_key, scan_code, event_state, extended); flushRetained(); has_retained_event = true; int keycode = WindowsKeycodes.mapVirtualKeyToLWJGLCode(virt_key); if (keycode < key_down_buffer.length) key_down_buffer[keycode] = event_state; retained_key_code = keycode; retained_state = event_state; retained_millis = millis; retained_char = 0; retained_repeat = repeat; } public void handleChar(int event_char, long millis, boolean repeat) { if (has_retained_event && retained_char != 0) flushRetained(); if (!has_retained_event) { putEvent(0, (byte)0, event_char, millis, repeat); } else retained_char = event_char; } public void read(ByteBuffer buffer) { flushRetained(); event_queue.copyEvents(buffer); } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java0000644000175000017500000001123411543426510024630 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.Canvas; import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedExceptionAction; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; /** * * @author elias_naur * @version $Revision: 3418 $ * $Id: LinuxCanvasImplementation.java 3418 2010-09-28 21:11:35Z spasi $ */ final class LinuxCanvasImplementation implements AWTCanvasImplementation { static int getScreenFromDevice(final GraphicsDevice device) throws LWJGLException { try { Method getScreen_method = AccessController.doPrivileged(new PrivilegedExceptionAction() { public Method run() throws Exception { return device.getClass().getMethod("getScreen"); } }); Integer screen = (Integer)getScreen_method.invoke(device); return screen; } catch (Exception e) { throw new LWJGLException(e); } } private static int getVisualIDFromConfiguration(final GraphicsConfiguration configuration) throws LWJGLException { try { Method getVisual_method = AccessController.doPrivileged(new PrivilegedExceptionAction() { public Method run() throws Exception { return configuration.getClass().getMethod("getVisual"); } }); Integer visual = (Integer)getVisual_method.invoke(configuration); return visual; } catch (Exception e) { throw new LWJGLException(e); } } public PeerInfo createPeerInfo(Canvas component, PixelFormat pixel_format) throws LWJGLException { return new LinuxAWTGLCanvasPeerInfo(component); } /** * Find a proper GraphicsConfiguration from the given GraphicsDevice and PixelFormat. * * @return The GraphicsConfiguration corresponding to a visual that matches the pixel format. */ public GraphicsConfiguration findConfiguration(GraphicsDevice device, PixelFormat pixel_format) throws LWJGLException { try { int screen = getScreenFromDevice(device); int visual_id_matching_format = findVisualIDFromFormat(screen, pixel_format); GraphicsConfiguration[] configurations = device.getConfigurations(); for ( GraphicsConfiguration configuration : configurations ) { int visual_id = getVisualIDFromConfiguration(configuration); if ( visual_id == visual_id_matching_format ) return configuration; } } catch (LWJGLException e) { LWJGLUtil.log("Got exception while trying to determine configuration: " + e); } return null; // In case we failed to locate the visual, or if we're not on a SUN JDK } private static int findVisualIDFromFormat(int screen, PixelFormat pixel_format) throws LWJGLException { try { LinuxDisplay.lockAWT(); try { GLContext.loadOpenGLLibrary(); try { LinuxDisplay.incDisplay(); return nFindVisualIDFromFormat(LinuxDisplay.getDisplay(), screen, pixel_format); } finally { LinuxDisplay.decDisplay(); } } finally { GLContext.unloadOpenGLLibrary(); } } finally { LinuxDisplay.unlockAWT(); } } private static native int nFindVisualIDFromFormat(long display, int screen, PixelFormat pixel_format) throws LWJGLException; } lwjgl-2.7.1/src/java/org/lwjgl/opengl/MacOSXCanvasImplementation.java0000644000175000017500000000516511543426510024631 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.Canvas; import org.lwjgl.LWJGLException; /** * * @author elias_naur * @version $Revision: 3002 $ * $Id: MacOSXCanvasImplementation.java 3002 2008-04-10 20:25:54Z elias_naur $ */ final class MacOSXCanvasImplementation implements AWTCanvasImplementation { public PeerInfo createPeerInfo(Canvas component, PixelFormat pixel_format) throws LWJGLException { try { return new MacOSXAWTGLCanvasPeerInfo(component, pixel_format, true); } catch (LWJGLException e) { return new MacOSXAWTGLCanvasPeerInfo(component, pixel_format, false); } } /** * Find a proper GraphicsConfiguration from the given GraphicsDevice and PixelFormat. * * @return The GraphicsConfiguration corresponding to a visual that matches the pixel format. */ public GraphicsConfiguration findConfiguration(GraphicsDevice device, PixelFormat pixel_format) throws LWJGLException { /* * It seems like the best way is to simply return null */ return null; } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/MacOSXDisplay.java0000644000175000017500000003637711543426510022126 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * This is the Display implementation interface. Display delegates * to implementors of this interface. There is one DisplayImplementation * for each supported platform. * @author elias_naur */ import java.awt.Canvas; import java.awt.Cursor; import java.awt.Robot; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; import java.util.ArrayList; import java.util.List; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import com.apple.eawt.Application; import com.apple.eawt.ApplicationAdapter; import com.apple.eawt.ApplicationEvent; import static org.lwjgl.opengl.GL11.*; final class MacOSXDisplay implements DisplayImplementation { private static final int PBUFFER_HANDLE_SIZE = 24; private static final int GAMMA_LENGTH = 256; private MacOSXCanvasListener canvas_listener; private MacOSXFrame frame; private Canvas canvas; private Robot robot; private MacOSXMouseEventQueue mouse_queue; private KeyboardEventQueue keyboard_queue; private java.awt.DisplayMode requested_mode; /* States */ private boolean close_requested; MacOSXDisplay() { try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { Application.getApplication().addApplicationListener(new ApplicationAdapter() { public void handleQuit(ApplicationEvent event) { doHandleQuit(); } }); return null; } }); } catch (Throwable e) { /** * In an applet environment, referencing com.apple.eawt.Application can fail with * a native exception. So log any exceptions instead of re-throwing. */ LWJGLUtil.log("Failed to register quit handler: " + e.getMessage()); } } public void createWindow(DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException { boolean fullscreen = Display.isFullscreen(); hideUI(fullscreen); close_requested = false; try { if (parent == null) { frame = new MacOSXFrame(mode, requested_mode, fullscreen, x, y); canvas = frame.getCanvas(); } else { frame = null; canvas = parent; } canvas_listener = new MacOSXCanvasListener(canvas); robot = AWTUtil.createRobot(canvas); } catch (LWJGLException e) { destroyWindow(); throw e; } } private void doHandleQuit() { synchronized (this) { close_requested = true; } } public void destroyWindow() { if (canvas_listener != null) { canvas_listener.disableListeners(); canvas_listener = null; } if (frame != null) { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { if (MacOSXFrame.getDevice().getFullScreenWindow() == frame) MacOSXFrame.getDevice().setFullScreenWindow(null); return null; } }); if (frame.isDisplayable()) frame.dispose(); frame = null; } hideUI(false); } public int getGammaRampLength() { return GAMMA_LENGTH; } public native void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException; public String getAdapter() { return null; } public String getVersion() { return null; } private static boolean equals(java.awt.DisplayMode awt_mode, DisplayMode mode) { return awt_mode.getWidth() == mode.getWidth() && awt_mode.getHeight() == mode.getHeight() && awt_mode.getBitDepth() == mode.getBitsPerPixel() && awt_mode.getRefreshRate() == mode.getFrequency(); } public void switchDisplayMode(DisplayMode mode) throws LWJGLException { java.awt.DisplayMode[] awt_modes = MacOSXFrame.getDevice().getDisplayModes(); for ( java.awt.DisplayMode awt_mode : awt_modes ) { if (equals(awt_mode, mode)) { requested_mode = awt_mode; return; } } throw new LWJGLException(mode + " is not supported"); } public void resetDisplayMode() { if (MacOSXFrame.getDevice().getFullScreenWindow() != null) MacOSXFrame.getDevice().setFullScreenWindow(null); requested_mode = null; restoreGamma(); } private native void restoreGamma(); private static DisplayMode createLWJGLDisplayMode(java.awt.DisplayMode awt_mode) { int bit_depth; int refresh_rate; int awt_bit_depth = awt_mode.getBitDepth(); int awt_refresh_rate = awt_mode.getRefreshRate(); if (awt_bit_depth != java.awt.DisplayMode.BIT_DEPTH_MULTI) bit_depth = awt_bit_depth; else bit_depth = 32; // Assume the best bit depth if (awt_refresh_rate != java.awt.DisplayMode.REFRESH_RATE_UNKNOWN) refresh_rate = awt_refresh_rate; else refresh_rate = 0; return new DisplayMode(awt_mode.getWidth(), awt_mode.getHeight(), bit_depth, refresh_rate); } public DisplayMode init() throws LWJGLException { return createLWJGLDisplayMode(MacOSXFrame.getDevice().getDisplayMode()); } public DisplayMode[] getAvailableDisplayModes() throws LWJGLException { java.awt.DisplayMode[] awt_modes = MacOSXFrame.getDevice().getDisplayModes(); List modes = new ArrayList(); for ( java.awt.DisplayMode awt_mode : awt_modes ) if ( awt_mode.getBitDepth() >= 16 ) modes.add(createLWJGLDisplayMode(awt_mode)); return modes.toArray(new DisplayMode[modes.size()]); } public void setTitle(String title) { if (frame != null) frame.setTitle(title); } public boolean isCloseRequested() { boolean result; synchronized (this) { result = close_requested || (frame != null && frame.syncIsCloseRequested()); close_requested = false; } return result; } public boolean isVisible() { return frame == null || frame.syncIsVisible(); } public boolean isActive() { return canvas.isFocusOwner(); } public Canvas getCanvas() { return canvas; } public boolean isDirty() { return frame != null && frame.getCanvas().syncIsDirty(); } public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { try { return new MacOSXDisplayPeerInfo(pixel_format, true); } catch (LWJGLException e) { return new MacOSXDisplayPeerInfo(pixel_format, false); } } private static final IntBuffer current_viewport = BufferUtils.createIntBuffer(16); public void update() { boolean should_update = canvas_listener.syncShouldUpdateContext(); /* * Workaround for the "white screen in fullscreen mode" problem * * Sometimes, switching from windowed mode to fullscreen or simply creating the Display * in fullscreen mode will result in the context not being bound to the window correctly. * The program runs fine, but the canvas background (white) is shown instead of the context * front buffer. * * I've discovered that re-binding the context with another setView() won't fix the problem, while a * clearDrawable() followed by a setView() does work. A straightforward workaround would be * to simply run the combination at every update(). This is not sufficient, since the clearDrawable() * call makes the the background appear shortly, causing visual artifacts. * What we really need is a way to detect that a setView() failed, and then do the magic combo. I've not * been able to find such a detection so alternatively I'm triggering the combo if the display is fullscreen * (I've not seen the white screen problem in windowed mode) and if the canvas has gotten a paint message or * if its update flag was set. * * My testing seems to indicate that the workaround works, since I've not seen the problem after the fix. * * - elias */ AbstractDrawable drawable = (AbstractDrawable)Display.getDrawable(); if (Display.isFullscreen() && (frame != null && frame.getCanvas().syncCanvasPainted() || should_update)) { try { MacOSXContextImplementation.resetView(drawable.peer_info, drawable.context); } catch (LWJGLException e) { LWJGLUtil.log("Failed to reset context: " + e); } } if (should_update) { drawable.context.update(); /* This is necessary to make sure the context won't "forget" about the view size */ glGetInteger(GL_VIEWPORT, current_viewport); glViewport(current_viewport.get(0), current_viewport.get(1), current_viewport.get(2), current_viewport.get(3)); } if (frame != null && mouse_queue != null) { if (frame.syncShouldReleaseCursor()) MacOSXMouseEventQueue.nGrabMouse(false); if (frame.syncShouldWarpCursor()) mouse_queue.warpCursor(); } } /** * This is an interface to the native Carbon call * SetSystemUIMode. It is used to hide the dock in a way * that will prevent AWT from shifting the fullscreen window * * The workaround is not necessary on 10.4, and since 10.4 shows * instability problems calling SetSystemUIMode, we'll only call it * when the OS version is 10.3 or lower. */ private void hideUI(boolean hide) { if (!LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 4)) nHideUI(hide); } private native void nHideUI(boolean hide); public void reshape(int x, int y, int width, int height) { if (frame != null) frame.resize(x, y, width, height); } /* Mouse */ public boolean hasWheel() { return AWTUtil.hasWheel(); } public int getButtonCount() { return AWTUtil.getButtonCount(); } public void createMouse() throws LWJGLException { this.mouse_queue = new MacOSXMouseEventQueue(canvas); mouse_queue.register(); } public void destroyMouse() { if (mouse_queue != null) { MacOSXMouseEventQueue.nGrabMouse(false); mouse_queue.unregister(); } this.mouse_queue = null; } public void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons_buffer) { mouse_queue.poll(coord_buffer, buttons_buffer); } public void readMouse(ByteBuffer buffer) { mouse_queue.copyEvents(buffer); } public void grabMouse(boolean grab) { mouse_queue.setGrabbed(grab); } public int getNativeCursorCapabilities() { return AWTUtil.getNativeCursorCapabilities(); } public void setCursorPosition(int x, int y) { AWTUtil.setCursorPosition(canvas, robot, x, y); } public void setNativeCursor(Object handle) throws LWJGLException { Cursor awt_cursor = (Cursor)handle; if (frame != null) frame.setCursor(awt_cursor); } public int getMinCursorSize() { return AWTUtil.getMinCursorSize(); } public int getMaxCursorSize() { return AWTUtil.getMaxCursorSize(); } /* Keyboard */ public void createKeyboard() throws LWJGLException { this.keyboard_queue = new KeyboardEventQueue(canvas); keyboard_queue.register(); } public void destroyKeyboard() { if (keyboard_queue != null) keyboard_queue.unregister(); this.keyboard_queue = null; } public void pollKeyboard(ByteBuffer keyDownBuffer) { keyboard_queue.poll(keyDownBuffer); } public void readKeyboard(ByteBuffer buffer) { keyboard_queue.copyEvents(buffer); } /* public int isStateKeySet(int key) { int awt_key; switch (key) { case Keyboard.KEY_CAPITAL: awt_key = KeyEvent.VK_CAPS_LOCK; break; case Keyboard.KEY_NUMLOCK: awt_key = KeyEvent.VK_NUM_LOCK; break; case Keyboard.KEY_SYSRQ: awt_key = KeyEvent.VK_SCROLL_LOCK; break; default: return Keyboard.STATE_UNKNOWN; } try { boolean state = Toolkit.getDefaultToolkit().getLockingKeyState(awt_key); return state ? Keyboard.STATE_ON : Keyboard.STATE_OFF; } catch (Exception e) { LWJGLUtil.log("Failed to query key state: " + e); return Keyboard.STATE_UNKNOWN; } } */ /** Native cursor handles */ public Object createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException { return AWTUtil.createCursor(width, height, xHotspot, yHotspot, numImages, images, delays); } public void destroyCursor(Object cursor_handle) { } public int getPbufferCapabilities() { if (LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 3)) return Pbuffer.PBUFFER_SUPPORTED; else return 0; } public boolean isBufferLost(PeerInfo handle) { return false; } public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { return new MacOSXPbufferPeerInfo(width, height, pixel_format); } public void setPbufferAttrib(PeerInfo handle, int attrib, int value) { throw new UnsupportedOperationException(); } public void bindTexImageToPbuffer(PeerInfo handle, int buffer) { throw new UnsupportedOperationException(); } public void releaseTexImageFromPbuffer(PeerInfo handle, int buffer) { throw new UnsupportedOperationException(); } /** * Sets one or more icons for the Display. *
        *
      • On Windows you should supply at least one 16x16 icon and one 32x32.
      • *
      • Linux (and similar platforms) expect one 32x32 icon.
      • *
      • Mac OS X should be supplied one 128x128 icon
      • *
      * The implementation will use the supplied ByteBuffers with image data in RGBA and perform any conversions nescesarry for the specific platform. * * @param icons Array of icons in RGBA mode * @return number of icons used. */ public int setIcon(ByteBuffer[] icons) { /* int size = 0; int biggest = -1; for (int i=0;i size) { biggest = i; size = icons[i].remaining(); } } if (biggest == -1) { return 0; } int width; int height; IntBuffer biggest_icon = icons[biggest].asIntBuffer(); int[] imageData = new int[biggest_icon.remaining()]; width = height = (int) Math.sqrt(imageData.length); biggest_icon.get(imageData); BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); img.setRGB(0, 0, width, height, imageData, 0, width); frame.setIconImage(img); return 1;*/ // Don't use any icon, since Mac OS X windows don't have window icons return 0; } public int getWidth() { return Display.getDisplayMode().getWidth(); } public int getHeight() { return Display.getDisplayMode().getHeight(); } public boolean isInsideWindow() { return true; } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/StateStack.java0000644000175000017500000000434311543426510021540 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; class StateStack { private int[] state_stack; private int stack_pos; public int getState() { return state_stack[stack_pos]; } public void pushState(int new_state) { int pos = ++stack_pos; if (pos == state_stack.length) { growState(); } state_stack[pos] = new_state; } public int popState() { return state_stack[stack_pos--]; } public void growState() { int[] new_state_stack = new int[state_stack.length + 1]; System.arraycopy(state_stack, 0, new_state_stack, 0, state_stack.length); state_stack = new_state_stack; } StateStack(int initial_value) { state_stack = new int[1]; stack_pos = 0; state_stack[stack_pos] = initial_value; } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/GLContext.java0000644000175000017500000004076011543426510021344 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.Sys; import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; import java.util.*; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL30.*; import static org.lwjgl.opengl.GL32.*; /** *

      * Manages GL contexts. Before any rendering is done by a LWJGL system, a call should be made to GLContext.useContext() with a * context. This will ensure that GLContext has an accurate reflection of the current context's capabilities and function * pointers. *

      * This class is thread-safe in the sense that multiple threads can safely call all public methods. The class is also * thread-aware in the sense that it tracks a per-thread current context (including capabilities and function pointers). * That way, multiple threads can have multiple contexts current and render to them concurrently. * * @author elias_naur * @version $Revision: 3418 $ * $Id: GLContext.java 3418 2010-09-28 21:11:35Z spasi $ */ public final class GLContext { /** Maps threads to their current context's ContextCapabilities, if any */ private static final ThreadLocal current_capabilities = new ThreadLocal(); /** * The getCapabilities() method is a potential hot spot in any LWJGL application, since * it is needed for context capability discovery (e.g. is OpenGL 2.0 supported?), and * for the function pointers of gl functions. However, the 'current_capabilities' ThreadLocal * is (relatively) expensive to look up, and since most OpenGL applications use are single threaded * rendering, the following two is an optimization for this case. *

      * ThreadLocals can be thought of as a mapping between threads and values, so the idea * is to use a lock-less cache of mappings between threads and the current ContextCapabilities. The cache * could be any size, but in our case, we want a single sized cache for optimal performance * in the single threaded case. *

      * 'fast_path_cache' is the most recent ContextCapabilities (potentially null) and its owner. By * recent I mean the last thread setting the value in setCapabilities(). When getCapabilities() * is called, a check to see if the current is the owner of the ContextCapabilities instance in * fast_path_cache. If so, the instance is returned, if not, some thread has since taken ownership * of the cache entry and the slower current_capabilities ThreadLocal is queried instead. *

      * No locks are needed in get/setCapabilities, because even though fast_path_cache can be accessed * from multiple threads at once, we are guaranteed by the JVM spec that its value is always valid. * Furthermore, if the ownership test in getCapabilities() succeeds, the cache entry can only contain * the correct ContextCapabilites (that is, the one from getThreadLocalCapabilites()), * since no other thread can set the owner to anyone else than itself. */ private static CapabilitiesCacheEntry fast_path_cache = new CapabilitiesCacheEntry(); /** * Simple lock-free cache of CapabilitesEntryCache to avoid allocating more than one * cache entry per thread */ private static final ThreadLocal thread_cache_entries = new ThreadLocal(); /** * The weak mapping from context Object instances to ContextCapabilities. Used * to avoid recreating a ContextCapabilities every time a context is made current. */ private static final Map capability_cache = new WeakHashMap(); /** Reference count of the native opengl implementation library */ private static int gl_ref_count; private static boolean did_auto_load; static { Sys.initialize(); } /** * Get the current capabilities instance. It contains the flags used * to test for support of a particular extension. * * @return The current capabilities instance. */ public static ContextCapabilities getCapabilities() { CapabilitiesCacheEntry recent_cache_entry = fast_path_cache; // Check owner of cache entry if ( recent_cache_entry.owner == Thread.currentThread() ) { /* The owner ship test succeeded, so the cache must contain the current ContextCapabilities instance * assert recent_cache_entry.capabilities == getThreadLocalCapabilities(); */ return recent_cache_entry.capabilities; } else // Some other thread has written to the cache since, and we fall back to the slower path return getThreadLocalCapabilities(); } private static ContextCapabilities getThreadLocalCapabilities() { return current_capabilities.get(); } /** * Set the current capabilities instance. It contains the flags used * to test for support of a particular extension. * * @return The current capabilities instance. */ static void setCapabilities(ContextCapabilities capabilities) { current_capabilities.set(capabilities); CapabilitiesCacheEntry thread_cache_entry = thread_cache_entries.get(); if ( thread_cache_entry == null ) { thread_cache_entry = new CapabilitiesCacheEntry(); thread_cache_entries.set(thread_cache_entry); } thread_cache_entry.owner = Thread.currentThread(); thread_cache_entry.capabilities = capabilities; fast_path_cache = thread_cache_entry; } /** * Helper method to get a pointer to a named function in the OpenGL library * with a name dependent on the current platform */ static long getPlatformSpecificFunctionAddress(String function_prefix, String[] os_prefixes, String[] os_function_prefixes, String function) { String os_name = AccessController.doPrivileged(new PrivilegedAction() { public String run() { return System.getProperty("os.name"); } }); for ( int i = 0; i < os_prefixes.length; i++ ) if ( os_name.startsWith(os_prefixes[i]) ) { String platform_function_name = function.replaceFirst(function_prefix, os_function_prefixes[i]); long address = getFunctionAddress(platform_function_name); return address; } return 0; } /** * Helper method to get a pointer to a named function with aliases in the OpenGL library. * * @param aliases the function name aliases. * * @return the function pointer address */ static long getFunctionAddress(String[] aliases) { for ( String alias : aliases ) { long address = getFunctionAddress(alias); if ( address != 0 ) return address; } return 0; } /** Helper method to get a pointer to a named function in the OpenGL library */ static native long getFunctionAddress(String name); /** * Determine which extensions are available and returns the context profile mask. Helper method to ContextCapabilities. * * @param supported_extensions the Set to fill with the available extension names * * @return the context profile mask, will be 0 for any version < 3.2 */ static int getSupportedExtensions(final Set supported_extensions) { // Detect OpenGL version first final String version = glGetString(GL_VERSION); if ( version == null ) throw new IllegalStateException("glGetString(GL_VERSION) returned null - possibly caused by missing current context."); final StringTokenizer version_tokenizer = new StringTokenizer(version, ". "); final String major_string = version_tokenizer.nextToken(); final String minor_string = version_tokenizer.nextToken(); int majorVersion = 0; int minorVersion = 0; try { majorVersion = Integer.parseInt(major_string); minorVersion = Integer.parseInt(minor_string); } catch (NumberFormatException e) { LWJGLUtil.log("The major and/or minor OpenGL version is malformed: " + e.getMessage()); } final int[][] GL_VERSIONS = { { 1, 2, 3, 4, 5 }, // OpenGL 1 { 0, 1 }, // OpenGL 2 { 0, 1, 2, 3 }, // OpenGL 3 { 0, 1 }, // OpenGL 4 }; for ( int major = 1; major <= GL_VERSIONS.length; major++ ) { int[] minors = GL_VERSIONS[major - 1]; for ( int minor : minors ) { if ( major < majorVersion || (major == majorVersion && minor <= minorVersion) ) supported_extensions.add("OpenGL" + Integer.toString(major) + Integer.toString(minor)); } } int profileMask = 0; if ( majorVersion < 3 ) { // Parse EXTENSIONS string final String extensions_string = glGetString(GL_EXTENSIONS); if ( extensions_string == null ) throw new IllegalStateException("glGetString(GL_EXTENSIONS) returned null - is there a context current?"); final StringTokenizer tokenizer = new StringTokenizer(extensions_string); while ( tokenizer.hasMoreTokens() ) supported_extensions.add(tokenizer.nextToken()); } else { // Use forward compatible indexed EXTENSIONS final int extensionCount = glGetInteger(GL_NUM_EXTENSIONS); for ( int i = 0; i < extensionCount; i++ ) supported_extensions.add(glGetStringi(GL_EXTENSIONS, i)); // Get the context profile mask for versions >= 3.2 if ( 3 < majorVersion || 2 <= minorVersion ) { Util.checkGLError(); // Make sure we have no errors up to this point try { profileMask = glGetInteger(GL_CONTEXT_PROFILE_MASK); // Retrieving GL_CONTEXT_PROFILE_MASK may generate an INVALID_OPERATION error on certain implementations, ignore. // Happens on pre10.1 ATI drivers, when ContextAttribs.withProfileCompatibility is not used Util.checkGLError(); } catch (OpenGLException e) { LWJGLUtil.log("Failed to retrieve CONTEXT_PROFILE_MASK"); } } } return profileMask; } /** * Helper method to ContextCapabilities. It will try to initialize the native stubs, * and remove the given extension name from the extension set if the initialization fails. */ static void initNativeStubs(final Class extension_class, Set supported_extensions, String ext_name) { resetNativeStubs(extension_class); if ( supported_extensions.contains(ext_name) ) { try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { Method init_stubs_method = extension_class.getDeclaredMethod("initNativeStubs"); init_stubs_method.invoke(null); return null; } }); } catch (Exception e) { LWJGLUtil.log("Failed to initialize extension " + extension_class + " - exception: " + e); supported_extensions.remove(ext_name); } } } /** * Makes a GL context the current LWJGL context by loading GL function pointers. The context must be current before a call to * this method! Instead it simply ensures that the current context is reflected accurately by GLContext's extension caps and * function pointers. Use useContext(null) when no context is active.

      If the context is the same as last time, then this is * a no-op.

      If the context has not been encountered before it will be fully initialized from scratch. Otherwise a cached set * of caps and function pointers will be used.

      The reference to the context is held in a weak reference; therefore if no * strong reference exists to the GL context it will automatically be forgotten by the VM at an indeterminate point in the * future, freeing up a little RAM. * * @param context The context object, which uniquely identifies a GL context. If context is null, the native stubs are * unloaded. * * @throws LWJGLException if context non-null, and the gl library can't be loaded or the basic GL11 functions can't be loaded */ public static synchronized void useContext(Object context) throws LWJGLException { useContext(context, false); } /** * Makes a GL context the current LWJGL context by loading GL function pointers. The context must be current before a call to * this method! Instead it simply ensures that the current context is reflected accurately by GLContext's extension caps and * function pointers. Use useContext(null) when no context is active.

      If the context is the same as last time, then this is * a no-op.

      If the context has not been encountered before it will be fully initialized from scratch. Otherwise a cached set * of caps and function pointers will be used.

      The reference to the context is held in a weak reference; therefore if no * strong reference exists to the GL context it will automatically be forgotten by the VM at an indeterminate point in the * future, freeing up a little RAM. *

      If forwardCompatible is true, function pointers of deprecated GL11-GL21 functionality will not be loaded. Calling a deprecated * function using the specified context will result in an IllegalStateException. * * @param context The context object, which uniquely identifies a GL context. If context is null, the native stubs are * unloaded. * @param forwardCompatible If the context is a forward compatible context (does not expose deprecated functionality, see XGL_ARB_create_context) * * @throws LWJGLException if context non-null, and the gl library can't be loaded or the basic GL11 functions can't be loaded */ public static synchronized void useContext(Object context, boolean forwardCompatible) throws LWJGLException { if ( context == null ) { ContextCapabilities.unloadAllStubs(); setCapabilities(null); if ( did_auto_load ) unloadOpenGLLibrary(); return; } if ( gl_ref_count == 0 ) { loadOpenGLLibrary(); did_auto_load = true; } try { ContextCapabilities capabilities = capability_cache.get(context); if ( capabilities == null ) { /* * The capabilities object registers itself as current. This behaviour is caused * by a chicken-and-egg situation where the constructor needs to call GL functions * as part of its capability discovery, but GL functions cannot be called before * a capabilities object has been set. */ new ContextCapabilities(forwardCompatible); capability_cache.put(context, getCapabilities()); } else setCapabilities(capabilities); } catch (LWJGLException e) { if ( did_auto_load ) unloadOpenGLLibrary(); throw e; } } /** If the OpenGL reference count is 0, the library is loaded. The reference count is then incremented. */ public static synchronized void loadOpenGLLibrary() throws LWJGLException { if ( gl_ref_count == 0 ) nLoadOpenGLLibrary(); gl_ref_count++; } private static native void nLoadOpenGLLibrary() throws LWJGLException; /** The OpenGL library reference count is decremented, and if it reaches 0, the library is unloaded. */ public static synchronized void unloadOpenGLLibrary() { gl_ref_count--; /* * Unload the native OpenGL library unless we're on linux, since * some drivers (NVIDIA proprietary) crash on exit when unloading the library. */ if ( gl_ref_count == 0 && LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_LINUX ) nUnloadOpenGLLibrary(); } private static native void nUnloadOpenGLLibrary(); /** Native method to clear native stub bindings */ static native void resetNativeStubs(Class clazz); private static final class CapabilitiesCacheEntry { Thread owner; ContextCapabilities capabilities; } }lwjgl-2.7.1/src/java/org/lwjgl/opengl/Context.java0000644000175000017500000002302711543426510021116 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.PointerBuffer; import org.lwjgl.Sys; import org.lwjgl.opencl.KHRGLSharing; import java.nio.ByteBuffer; import java.nio.IntBuffer; import static org.lwjgl.opengl.GL11.*; /** *

      * Context encapsulates an OpenGL context. *

      *

      * This class is thread-safe. * * @author elias_naur * @version $Revision: 3418 $ * $Id: Context.java 3418 2010-09-28 21:11:35Z spasi $ */ final class Context { /** The platform specific implementation of context methods */ private static final ContextImplementation implementation; /** The current Context */ private static final ThreadLocal current_context_local = new ThreadLocal(); /** Handle to the native GL rendering context */ private final ByteBuffer handle; private final PeerInfo peer_info; private final ContextAttribs contextAttribs; private final boolean forwardCompatible; /** Whether the context has been destroyed */ private boolean destroyed; private boolean destroy_requested; /** The thread that has this context current, or null. */ private Thread thread; static { Sys.initialize(); implementation = createImplementation(); } private static ContextImplementation createImplementation() { switch ( LWJGLUtil.getPlatform() ) { case LWJGLUtil.PLATFORM_LINUX: return new LinuxContextImplementation(); case LWJGLUtil.PLATFORM_WINDOWS: return new WindowsContextImplementation(); case LWJGLUtil.PLATFORM_MACOSX: return new MacOSXContextImplementation(); default: throw new IllegalStateException("Unsupported platform"); } } PeerInfo getPeerInfo() { return peer_info; } ContextAttribs getContextAttribs() { return contextAttribs; } static Context getCurrentContext() { return current_context_local.get(); } /** Create a context with the specified peer info and shared context */ Context(PeerInfo peer_info, ContextAttribs attribs, Context shared_context) throws LWJGLException { Context context_lock = shared_context != null ? shared_context : this; // If shared_context is not null, synchronize on it to make sure it is not deleted // while this context is created. Otherwise, simply synchronize on ourself to avoid NPE synchronized ( context_lock ) { if ( shared_context != null && shared_context.destroyed ) throw new IllegalArgumentException("Shared context is destroyed"); GLContext.loadOpenGLLibrary(); try { this.peer_info = peer_info; this.contextAttribs = attribs; IntBuffer attribList; if ( attribs != null ) { attribList = attribs.getAttribList(); forwardCompatible = attribs.isForwardCompatible(); } else { attribList = null; forwardCompatible = false; } this.handle = implementation.create(peer_info, attribList, shared_context != null ? shared_context.handle : null); } catch (LWJGLException e) { GLContext.unloadOpenGLLibrary(); throw e; } } } /** Release the current context (if any). After this call, no context is current. */ public static void releaseCurrentContext() throws LWJGLException { Context current_context = getCurrentContext(); if ( current_context != null ) { implementation.releaseCurrentContext(); GLContext.useContext(null); current_context_local.set(null); synchronized ( current_context ) { current_context.thread = null; current_context.checkDestroy(); } } } /** * Release the context from its drawable. This is necessary on some platforms, * like Mac OS X, where binding the context to a drawable and binding the context * for rendering are two distinct actions and where calling releaseDrawable * on every releaseCurrentContext results in artifacts. */ public synchronized void releaseDrawable() throws LWJGLException { if ( destroyed ) throw new IllegalStateException("Context is destroyed"); implementation.releaseDrawable(getHandle()); } /** Update the context. Should be called whenever it's drawable is moved or resized */ public synchronized void update() { if ( destroyed ) throw new IllegalStateException("Context is destroyed"); implementation.update(getHandle()); } /** Swap the buffers on the current context. Only valid for double-buffered contexts */ public static void swapBuffers() throws LWJGLException { implementation.swapBuffers(); } private boolean canAccess() { return thread == null || Thread.currentThread() == thread; } private void checkAccess() { if ( !canAccess() ) throw new IllegalStateException("From thread " + Thread.currentThread() + ": " + thread + " already has the context current"); } /** Make the context current */ public synchronized void makeCurrent() throws LWJGLException { checkAccess(); if ( destroyed ) throw new IllegalStateException("Context is destroyed"); thread = Thread.currentThread(); current_context_local.set(this); implementation.makeCurrent(peer_info, handle); GLContext.useContext(this, forwardCompatible); } ByteBuffer getHandle() { return handle; } /** Query whether the context is current */ public synchronized boolean isCurrent() throws LWJGLException { if ( destroyed ) throw new IllegalStateException("Context is destroyed"); return implementation.isCurrent(handle); } private void checkDestroy() { if ( !destroyed && destroy_requested ) { try { releaseDrawable(); implementation.destroy(peer_info, handle); CallbackUtil.unregisterCallbacks(this); destroyed = true; thread = null; GLContext.unloadOpenGLLibrary(); } catch (LWJGLException e) { LWJGLUtil.log("Exception occurred while destroying context: " + e); } } } /** * Set the buffer swap interval. This call is a best-attempt at changing * the monitor swap interval, which is the minimum periodicity of color buffer swaps, * measured in video frame periods, and is not guaranteed to be successful. *

      * A video frame period is the time required to display a full frame of video data. */ public static void setSwapInterval(int value) { implementation.setSwapInterval(value); } /** * Destroy the context. This method behaves the same as destroy() with the extra * requirement that the context must be either current to the current thread or not * current at all. */ public synchronized void forceDestroy() throws LWJGLException { checkAccess(); destroy(); } /** * Request destruction of the Context. If the context is current, no context will be current after this call. * The context is destroyed when no thread has it current. */ public synchronized void destroy() throws LWJGLException { if ( destroyed ) return; destroy_requested = true; boolean was_current = isCurrent(); int error = GL_NO_ERROR; if ( was_current ) { if ( GLContext.getCapabilities() != null && GLContext.getCapabilities().OpenGL11 ) error = glGetError(); releaseCurrentContext(); } checkDestroy(); if ( was_current && error != GL_NO_ERROR ) throw new OpenGLException(error); } public synchronized void setCLSharingProperties(final PointerBuffer properties) throws LWJGLException { final ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { switch ( LWJGLUtil.getPlatform() ) { case LWJGLUtil.PLATFORM_WINDOWS: final WindowsContextImplementation implWindows = (WindowsContextImplementation)implementation; properties.put(KHRGLSharing.CL_GL_CONTEXT_KHR).put(implWindows.getHGLRC(handle)); properties.put(KHRGLSharing.CL_WGL_HDC_KHR).put(implWindows.getHDC(peer_handle)); break; case LWJGLUtil.PLATFORM_LINUX: final LinuxContextImplementation implLinux = (LinuxContextImplementation)implementation; properties.put(KHRGLSharing.CL_GL_CONTEXT_KHR).put(implLinux.getGLXContext(handle)); properties.put(KHRGLSharing.CL_GLX_DISPLAY_KHR).put(implLinux.getDisplay(peer_handle)); break; default: throw new UnsupportedOperationException("CL/GL context sharing is not supposed on this platform."); } } finally { peer_info.unlock(); } } }lwjgl-2.7.1/src/java/org/lwjgl/opengl/PeerInfo.java0000644000175000017500000000623411543426510021202 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; /** * * @author elias_naur * @version $Revision: 3418 $ * $Id: PeerInfo.java 3418 2010-09-28 21:11:35Z spasi $ */ abstract class PeerInfo { private final ByteBuffer handle; private Thread locking_thread; // Thread that has locked this PeerInfo private int lock_count; protected PeerInfo(ByteBuffer handle) { this.handle = handle; } private void lockAndInitHandle() throws LWJGLException { doLockAndInitHandle(); } public final synchronized void unlock() throws LWJGLException { if (lock_count <= 0) throw new IllegalStateException("PeerInfo not locked!"); if (Thread.currentThread() != locking_thread) throw new IllegalStateException("PeerInfo already locked by " + locking_thread); lock_count--; if (lock_count == 0) { doUnlock(); locking_thread = null; notify(); } } protected abstract void doLockAndInitHandle() throws LWJGLException; protected abstract void doUnlock() throws LWJGLException; public final synchronized ByteBuffer lockAndGetHandle() throws LWJGLException { Thread this_thread = Thread.currentThread(); while (locking_thread != null && locking_thread != this_thread) { try { wait(); } catch (InterruptedException e) { LWJGLUtil.log("Interrupted while waiting for PeerInfo lock: " + e); } } if (lock_count == 0) { locking_thread = this_thread; doLockAndInitHandle(); } lock_count++; return getHandle(); } protected final ByteBuffer getHandle() { return handle; } public void destroy() { } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/EventQueue.java0000644000175000017500000000544311543426510021562 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * A java implementation of a LWJGL compatible event queue. * @author elias_naur */ import java.nio.ByteBuffer; class EventQueue { private static final int QUEUE_SIZE = 200; private final int event_size; private final ByteBuffer queue; protected EventQueue(int event_size) { this.event_size = event_size; this.queue = ByteBuffer.allocate(QUEUE_SIZE*event_size); } protected synchronized void clearEvents() { queue.clear(); } /** * Copy available events into the specified buffer. */ public synchronized void copyEvents(ByteBuffer dest) { queue.flip(); int old_limit = queue.limit(); if (dest.remaining() < queue.remaining()) queue.limit(dest.remaining() + queue.position()); dest.put(queue); queue.limit(old_limit); queue.compact(); } /** * Put an event into the queue. * @return true if the event fitted into the queue, false otherwise */ public synchronized boolean putEvent(ByteBuffer event) { if (event.remaining() != event_size) throw new IllegalArgumentException("Internal error: event size " + event_size + " does not equal the given event size " + event.remaining()); if (queue.remaining() >= event.remaining()) { queue.put(event); return true; } else return false; } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/StateTracker.java0000644000175000017500000001212211543426510022060 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.IntBuffer; import static org.lwjgl.opengl.GL15.*; import static org.lwjgl.opengl.GL21.*; import static org.lwjgl.opengl.GL40.*; final class StateTracker { private ReferencesStack references_stack; private final StateStack attrib_stack; private boolean insideBeginEnd; // VAOs are not shareable between contexts, no need to sync or make this static. private final FastIntMap vaoMap = new FastIntMap(); StateTracker() { attrib_stack = new StateStack(0); } /** This is called after getting function addresses. */ void init() { references_stack = new ReferencesStack(); } static void setBeginEnd(ContextCapabilities caps, boolean inside) { caps.tracker.insideBeginEnd = inside; } boolean isBeginEnd() { return insideBeginEnd; } static void popAttrib(ContextCapabilities caps) { caps.tracker.doPopAttrib(); } private void doPopAttrib() { references_stack.popState(attrib_stack.popState()); } static void pushAttrib(ContextCapabilities caps, int mask) { caps.tracker.doPushAttrib(mask); } private void doPushAttrib(int mask) { attrib_stack.pushState(mask); references_stack.pushState(); } static References getReferences(ContextCapabilities caps) { return caps.tracker.references_stack.getReferences(); } static void bindBuffer(ContextCapabilities caps, int target, int buffer) { final BaseReferences references = getReferences(caps); switch ( target ) { case GL_ARRAY_BUFFER: references.arrayBuffer = buffer; break; case GL_ELEMENT_ARRAY_BUFFER: // When a vertex array object is currently bound, update // the VAO state instead of client state. if ( references.vertexArrayObject != 0 ) caps.tracker.vaoMap.get(references.vertexArrayObject).elementArrayBuffer = buffer; else references.elementArrayBuffer = buffer; break; case GL_PIXEL_PACK_BUFFER: references.pixelPackBuffer = buffer; break; case GL_PIXEL_UNPACK_BUFFER: references.pixelUnpackBuffer = buffer; break; case GL_DRAW_INDIRECT_BUFFER: references.indirectBuffer = buffer; break; } } static void bindVAO(final ContextCapabilities caps, final int array) { final FastIntMap vaoMap = caps.tracker.vaoMap; if ( !vaoMap.containsKey(array) ) vaoMap.put(array, new VAOState()); getReferences(caps).vertexArrayObject = array; } static void deleteVAO(final ContextCapabilities caps, final IntBuffer arrays) { for ( int i = arrays.position(); i < arrays.limit(); i++ ) deleteVAO(caps, arrays.get(i)); } static void deleteVAO(final ContextCapabilities caps, final int array) { caps.tracker.vaoMap.remove(array); final BaseReferences references = getReferences(caps); if ( references.vertexArrayObject == array ) references.vertexArrayObject = 0; } /** * Returns the currently bound ELEMENT_ARRAY_BUFFER. If a vertex array * object is currently bound, then the VAO state is returned instead * of the client state. * * @return the currently bound ELEMENT_ARRAY_BUFFER. */ static int getElementArrayBufferBound(final ContextCapabilities caps) { final BaseReferences references = getReferences(caps); if ( references.vertexArrayObject == 0 ) return references.elementArrayBuffer; else return caps.tracker.vaoMap.get(references.vertexArrayObject).elementArrayBuffer; } /** * Simple class to help us track VAO state. Currently * only ELEMENT_ARRAY_BUFFER_BINDING is tracked, since * that's the only state we check from tables 6.6-6.9. */ private static class VAOState { int elementArrayBuffer; } }lwjgl-2.7.1/src/java/org/lwjgl/opengl/LinuxDisplay.java0000644000175000017500000012133111543426510022114 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * This is the Display implementation interface. Display delegates * to implementors of this interface. There is one DisplayImplementation * for each supported platform. * @author elias_naur */ import java.awt.Canvas; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.opengl.XRandR.Screen; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.List; final class LinuxDisplay implements DisplayImplementation { /* X11 constants */ public static final int CurrentTime = 0; public static final int GrabSuccess = 0; public static final int AutoRepeatModeOff = 0; public static final int AutoRepeatModeOn = 1; public static final int AutoRepeatModeDefault = 2; public static final int None = 0; private static final int KeyPressMask = 1 << 0; private static final int KeyReleaseMask = 1 << 1; private static final int ButtonPressMask = 1 << 2; private static final int ButtonReleaseMask = 1 << 3; private static final int NotifyAncestor = 0; private static final int NotifyNonlinear = 3; private static final int NotifyPointer = 5; private static final int NotifyPointerRoot = 6; private static final int NotifyDetailNone = 7; private static final int SetModeInsert = 0; private static final int SaveSetRoot = 1; private static final int SaveSetUnmap = 1; /** Window mode enum */ private static final int FULLSCREEN_LEGACY = 1; private static final int FULLSCREEN_NETWM = 2; private static final int WINDOWED = 3; /** Current window mode */ private static int current_window_mode = WINDOWED; /** Display mode switching API */ private static final int XRANDR = 10; private static final int XF86VIDMODE = 11; private static final int NONE = 12; /** Current X11 Display pointer */ private static long display; private static long current_window; private static long saved_error_handler; private static int display_connection_usage_count; /** Event buffer */ private final LinuxEvent event_buffer = new LinuxEvent(); private final LinuxEvent tmp_event_buffer = new LinuxEvent(); /** Current mode swithcing API */ private int current_displaymode_extension = NONE; /** Atom used for the pointer warp messages */ private long delete_atom; private PeerInfo peer_info; /** Saved gamma used to restore display settings */ private ByteBuffer saved_gamma; private ByteBuffer current_gamma; /** Saved mode to restore with */ private DisplayMode saved_mode; private DisplayMode current_mode; private Screen[] savedXrandrConfig; private boolean keyboard_grabbed; private boolean pointer_grabbed; private boolean input_released; private boolean grab; private boolean focused; private boolean minimized; private boolean dirty; private boolean close_requested; private long current_cursor; private long blank_cursor; private Canvas parent; private long parent_window; private boolean xembedded; private boolean parent_focus; private boolean mouseInside = true; private LinuxKeyboard keyboard; private LinuxMouse mouse; private static ByteBuffer getCurrentGammaRamp() throws LWJGLException { lockAWT(); try { incDisplay(); try { if (isXF86VidModeSupported()) return nGetCurrentGammaRamp(getDisplay(), getDefaultScreen()); else return null; } finally { decDisplay(); } } finally { unlockAWT(); } } private static native ByteBuffer nGetCurrentGammaRamp(long display, int screen) throws LWJGLException; private static int getBestDisplayModeExtension() { int result; if (isXrandrSupported()) { LWJGLUtil.log("Using Xrandr for display mode switching"); result = XRANDR; } else if (isXF86VidModeSupported()) { LWJGLUtil.log("Using XF86VidMode for display mode switching"); result = XF86VIDMODE; } else { LWJGLUtil.log("No display mode extensions available"); result = NONE; } return result; } private static boolean isXrandrSupported() { if (Display.getPrivilegedBoolean("LWJGL_DISABLE_XRANDR")) return false; lockAWT(); try { incDisplay(); try { return nIsXrandrSupported(getDisplay()); } finally { decDisplay(); } } catch (LWJGLException e) { LWJGLUtil.log("Got exception while querying Xrandr support: " + e); return false; } finally { unlockAWT(); } } private static native boolean nIsXrandrSupported(long display) throws LWJGLException; private static boolean isXF86VidModeSupported() { lockAWT(); try { incDisplay(); try { return nIsXF86VidModeSupported(getDisplay()); } finally { decDisplay(); } } catch (LWJGLException e) { LWJGLUtil.log("Got exception while querying XF86VM support: " + e); return false; } finally { unlockAWT(); } } private static native boolean nIsXF86VidModeSupported(long display) throws LWJGLException; private static boolean isNetWMFullscreenSupported() throws LWJGLException { if (Display.getPrivilegedBoolean("LWJGL_DISABLE_NETWM")) return false; lockAWT(); try { incDisplay(); try { return nIsNetWMFullscreenSupported(getDisplay(), getDefaultScreen()); } finally { decDisplay(); } } catch (LWJGLException e) { LWJGLUtil.log("Got exception while querying NetWM support: " + e); return false; } finally { unlockAWT(); } } private static native boolean nIsNetWMFullscreenSupported(long display, int screen) throws LWJGLException; /* Since Xlib is not guaranteed to be thread safe, we need a way to synchronize LWJGL * Xlib calls with AWT Xlib calls. Fortunately, JAWT implements Lock()/Unlock() to * do just that. */ static void lockAWT() { try { nLockAWT(); } catch (LWJGLException e) { LWJGLUtil.log("Caught exception while locking AWT: " + e); } } private static native void nLockAWT() throws LWJGLException; static void unlockAWT() { try { nUnlockAWT(); } catch (LWJGLException e) { LWJGLUtil.log("Caught exception while unlocking AWT: " + e); } } private static native void nUnlockAWT() throws LWJGLException; /** * increment and decrement display usage. */ static void incDisplay() throws LWJGLException { if (display_connection_usage_count == 0) { GLContext.loadOpenGLLibrary(); saved_error_handler = setErrorHandler(); display = openDisplay(); // synchronize(display, true); } display_connection_usage_count++; } private static native int callErrorHandler(long handler, long display, long error_ptr); private static native long setErrorHandler(); private static native long resetErrorHandler(long handler); private static native void synchronize(long display, boolean synchronize); private static int globalErrorHandler(long display, long event_ptr, long error_display, long serial, long error_code, long request_code, long minor_code) throws LWJGLException { if (display == getDisplay()) { String error_msg = getErrorText(display, error_code); throw new LWJGLException("X Error - disp: 0x" + Long.toHexString(error_display) + " serial: " + serial + " error: " + error_msg + " request_code: " + request_code + " minor_code: " + minor_code); } else if (saved_error_handler != 0) return callErrorHandler(saved_error_handler, display, event_ptr); return 0; } private static native String getErrorText(long display, long error_code); static void decDisplay() { /* * Some drivers (at least some versions of the radeon dri driver) * don't like it when the display is closed and later re-opened, * so we'll just let the singleton display connection leak. */ /* display_connection_usage_count--; if (display_connection_usage_count < 0) throw new InternalError("display_connection_usage_count < 0: " + display_connection_usage_count); if (display_connection_usage_count == 0) { closeDisplay(display); resetErrorHandler(saved_error_handler); display = 0; GLContext.unloadOpenGLLibrary(); }*/ } static native long openDisplay() throws LWJGLException; static native void closeDisplay(long display); private int getWindowMode(boolean fullscreen) throws LWJGLException { if (fullscreen) { if (current_displaymode_extension == XRANDR && isNetWMFullscreenSupported()) { LWJGLUtil.log("Using NetWM for fullscreen window"); return FULLSCREEN_NETWM; } else { LWJGLUtil.log("Using legacy mode for fullscreen window"); return FULLSCREEN_LEGACY; } } else return WINDOWED; } static long getDisplay() { if (display_connection_usage_count <= 0) throw new InternalError("display_connection_usage_count = " + display_connection_usage_count); return display; } static int getDefaultScreen() { return nGetDefaultScreen(getDisplay()); } static native int nGetDefaultScreen(long display); static long getWindow() { return current_window; } private void ungrabKeyboard() { if (keyboard_grabbed) { nUngrabKeyboard(getDisplay()); keyboard_grabbed = false; } } static native int nUngrabKeyboard(long display); private void grabKeyboard() { if (!keyboard_grabbed) { int res = nGrabKeyboard(getDisplay(), getWindow()); if (res == GrabSuccess) keyboard_grabbed = true; } } static native int nGrabKeyboard(long display, long window); private void grabPointer() { if (!pointer_grabbed) { int result = nGrabPointer(getDisplay(), getWindow(), None); if (result == GrabSuccess) { pointer_grabbed = true; // make sure we have a centered window if (isLegacyFullscreen()) { nSetViewPort(getDisplay(), getWindow(), getDefaultScreen()); } } } } static native int nGrabPointer(long display, long window, long cursor); private static native void nSetViewPort(long display, long window, int screen); private void ungrabPointer() { if (pointer_grabbed) { pointer_grabbed = false; nUngrabPointer(getDisplay()); } } static native int nUngrabPointer(long display); private static boolean isFullscreen() { return current_window_mode == FULLSCREEN_LEGACY || current_window_mode == FULLSCREEN_NETWM; } private boolean shouldGrab() { return !input_released && grab && mouse != null; } private void updatePointerGrab() { if (isFullscreen() || shouldGrab()) { grabPointer(); } else { ungrabPointer(); } updateCursor(); } private void updateCursor() { long cursor; if (shouldGrab()) { cursor = blank_cursor; } else { cursor = current_cursor; } nDefineCursor(getDisplay(), getWindow(), cursor); } private static native void nDefineCursor(long display, long window, long cursor_handle); private static boolean isLegacyFullscreen() { return current_window_mode == FULLSCREEN_LEGACY; } private void updateKeyboardGrab() { if (isLegacyFullscreen()) grabKeyboard(); else ungrabKeyboard(); } public void createWindow(DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException { lockAWT(); try { incDisplay(); try { ByteBuffer handle = peer_info.lockAndGetHandle(); try { current_window_mode = getWindowMode(Display.isFullscreen()); // Try to enable Lecagy FullScreen Support in Compiz, else // we may have trouble with stuff overlapping our fullscreen window. if ( current_window_mode != WINDOWED ) Compiz.setLegacyFullscreenSupport(true); // Setting _MOTIF_WM_HINTS in fullscreen mode is problematic for certain window // managers. We do not set MWM_HINTS_DECORATIONS in fullscreen mode anymore, // unless org.lwjgl.opengl.Window.undecorated_fs has been specified. // See native/linux/org_lwjgl_opengl_Display.c, createWindow function. boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated") || (current_window_mode != WINDOWED && Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated_fs")); this.parent = parent; parent_window = parent != null ? getHandle(parent) : getRootWindow(getDisplay(), getDefaultScreen()); current_window = nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y, undecorated, parent_window); mapRaised(getDisplay(), current_window); xembedded = parent != null && isAncestorXEmbedded(parent_window); blank_cursor = createBlankCursor(); current_cursor = None; focused = false; input_released = false; pointer_grabbed = false; keyboard_grabbed = false; close_requested = false; grab = false; minimized = false; dirty = true; } finally { peer_info.unlock(); } } catch (LWJGLException e) { decDisplay(); throw e; } } finally { unlockAWT(); } } private static native long nCreateWindow(long display, int screen, ByteBuffer peer_info_handle, DisplayMode mode, int window_mode, int x, int y, boolean undecorated, long parent_handle) throws LWJGLException; private static native long getRootWindow(long display, int screen); private static native boolean hasProperty(long display, long window, long property); private static native long getParentWindow(long display, long window) throws LWJGLException; private static native void mapRaised(long display, long window); private static native void reparentWindow(long display, long window, long parent, int x, int y); private static boolean isAncestorXEmbedded(long window) throws LWJGLException { long xembed_atom = internAtom("_XEMBED_INFO", true); if (xembed_atom != None) { long w = window; while (w != None) { if (hasProperty(getDisplay(), w, xembed_atom)) return true; w = getParentWindow(getDisplay(), w); } } return false; } private static long getHandle(Canvas parent) throws LWJGLException { AWTCanvasImplementation awt_impl = AWTGLCanvas.createImplementation(); LinuxPeerInfo parent_peer_info = (LinuxPeerInfo)awt_impl.createPeerInfo(parent, null); ByteBuffer parent_peer_info_handle = parent_peer_info.lockAndGetHandle(); try { return parent_peer_info.getDrawable(); } finally { parent_peer_info.unlock(); } } private void updateInputGrab() { updatePointerGrab(); updateKeyboardGrab(); } public void destroyWindow() { lockAWT(); try { try { setNativeCursor(null); } catch (LWJGLException e) { LWJGLUtil.log("Failed to reset cursor: " + e.getMessage()); } nDestroyCursor(getDisplay(), blank_cursor); blank_cursor = None; ungrabKeyboard(); nDestroyWindow(getDisplay(), getWindow()); decDisplay(); if ( current_window_mode != WINDOWED ) Compiz.setLegacyFullscreenSupport(false); } finally { unlockAWT(); } } static native void nDestroyWindow(long display, long window); public void switchDisplayMode(DisplayMode mode) throws LWJGLException { lockAWT(); try { switchDisplayModeOnTmpDisplay(mode); current_mode = mode; } finally { unlockAWT(); } } private void switchDisplayModeOnTmpDisplay(DisplayMode mode) throws LWJGLException { incDisplay(); try { nSwitchDisplayMode(getDisplay(), getDefaultScreen(), current_displaymode_extension, mode); } finally { decDisplay(); } } private static native void nSwitchDisplayMode(long display, int screen, int extension, DisplayMode mode) throws LWJGLException; private static long internAtom(String atom_name, boolean only_if_exists) throws LWJGLException { incDisplay(); try { return nInternAtom(getDisplay(), atom_name, only_if_exists); } finally { decDisplay(); } } static native long nInternAtom(long display, String atom_name, boolean only_if_exists); public void resetDisplayMode() { lockAWT(); try { if( current_displaymode_extension == XRANDR && savedXrandrConfig.length > 0 ) { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { XRandR.setConfiguration( savedXrandrConfig ); return null; } }); } else { switchDisplayMode(saved_mode); } if (isXF86VidModeSupported()) doSetGamma(saved_gamma); Compiz.setLegacyFullscreenSupport(false); } catch (LWJGLException e) { LWJGLUtil.log("Caught exception while resetting mode: " + e); } finally { unlockAWT(); } } public int getGammaRampLength() { if (!isXF86VidModeSupported()) return 0; lockAWT(); try { try { incDisplay(); try { return nGetGammaRampLength(getDisplay(), getDefaultScreen()); } catch (LWJGLException e) { LWJGLUtil.log("Got exception while querying gamma length: " + e); return 0; } finally { decDisplay(); } } catch (LWJGLException e) { LWJGLUtil.log("Failed to get gamma ramp length: " + e); return 0; } } finally { unlockAWT(); } } private static native int nGetGammaRampLength(long display, int screen) throws LWJGLException; public void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException { if (!isXF86VidModeSupported()) throw new LWJGLException("No gamma ramp support (Missing XF86VM extension)"); doSetGamma(convertToNativeRamp(gammaRamp)); } private void doSetGamma(ByteBuffer native_gamma) throws LWJGLException { lockAWT(); try { setGammaRampOnTmpDisplay(native_gamma); current_gamma = native_gamma; } finally { unlockAWT(); } } private static void setGammaRampOnTmpDisplay(ByteBuffer native_gamma) throws LWJGLException { incDisplay(); try { nSetGammaRamp(getDisplay(), getDefaultScreen(), native_gamma); } finally { decDisplay(); } } private static native void nSetGammaRamp(long display, int screen, ByteBuffer gammaRamp) throws LWJGLException; private static ByteBuffer convertToNativeRamp(FloatBuffer ramp) throws LWJGLException { return nConvertToNativeRamp(ramp, ramp.position(), ramp.remaining()); } private static native ByteBuffer nConvertToNativeRamp(FloatBuffer ramp, int offset, int length) throws LWJGLException; public String getAdapter() { return null; } public String getVersion() { return null; } public DisplayMode init() throws LWJGLException { lockAWT(); try { Compiz.init(); delete_atom = internAtom("WM_DELETE_WINDOW", false); current_displaymode_extension = getBestDisplayModeExtension(); if (current_displaymode_extension == NONE) throw new LWJGLException("No display mode extension is available"); DisplayMode[] modes = getAvailableDisplayModes(); if (modes == null || modes.length == 0) throw new LWJGLException("No modes available"); switch (current_displaymode_extension) { case XRANDR: savedXrandrConfig = AccessController.doPrivileged(new PrivilegedAction() { public Screen[] run() { return XRandR.getConfiguration(); } }); saved_mode = getCurrentXRandrMode(); break; case XF86VIDMODE: saved_mode = modes[0]; break; default: throw new LWJGLException("Unknown display mode extension: " + current_displaymode_extension); } current_mode = saved_mode; saved_gamma = getCurrentGammaRamp(); current_gamma = saved_gamma; return saved_mode; } finally { unlockAWT(); } } private static DisplayMode getCurrentXRandrMode() throws LWJGLException { lockAWT(); try { incDisplay(); try { return nGetCurrentXRandrMode(getDisplay(), getDefaultScreen()); } finally { decDisplay(); } } finally { unlockAWT(); } } /** Assumes extension == XRANDR */ private static native DisplayMode nGetCurrentXRandrMode(long display, int screen) throws LWJGLException; public void setTitle(String title) { lockAWT(); try { nSetTitle(getDisplay(), getWindow(), title); } finally { unlockAWT(); } } private static native void nSetTitle(long display, long window, String title); public boolean isCloseRequested() { boolean result = close_requested; close_requested = false; return result; } public boolean isVisible() { return !minimized; } public boolean isActive() { return focused || isLegacyFullscreen(); } public boolean isDirty() { boolean result = dirty; dirty = false; return result; } public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { peer_info = new LinuxDisplayPeerInfo(pixel_format); return peer_info; } static native void setInputFocus(long display, long window, long time); private void relayEventToParent(LinuxEvent event_buffer, int event_mask) { tmp_event_buffer.copyFrom(event_buffer); tmp_event_buffer.setWindow(parent_window); tmp_event_buffer.sendEvent(getDisplay(), parent_window, true, event_mask); } private void relayEventToParent(LinuxEvent event_buffer) { if (parent == null) return; switch (event_buffer.getType()) { case LinuxEvent.KeyPress: relayEventToParent(event_buffer, KeyPressMask); break; case LinuxEvent.KeyRelease: relayEventToParent(event_buffer, KeyPressMask); break; case LinuxEvent.ButtonPress: relayEventToParent(event_buffer, KeyPressMask); break; case LinuxEvent.ButtonRelease: relayEventToParent(event_buffer, KeyPressMask); break; default: break; } } private void processEvents() { while (LinuxEvent.getPending(getDisplay()) > 0) { event_buffer.nextEvent(getDisplay()); long event_window = event_buffer.getWindow(); relayEventToParent(event_buffer); if (event_window != getWindow() || event_buffer.filterEvent(event_window) || (mouse != null && mouse.filterEvent(grab, shouldWarpPointer(), event_buffer)) || (keyboard != null && keyboard.filterEvent(event_buffer))) continue; switch (event_buffer.getType()) { case LinuxEvent.FocusIn: setFocused(true, event_buffer.getFocusDetail()); break; case LinuxEvent.FocusOut: setFocused(false, event_buffer.getFocusDetail()); break; case LinuxEvent.ClientMessage: if ((event_buffer.getClientFormat() == 32) && (event_buffer.getClientData(0) == delete_atom)) close_requested = true; break; case LinuxEvent.MapNotify: dirty = true; minimized = false; break; case LinuxEvent.UnmapNotify: dirty = true; minimized = true; break; case LinuxEvent.Expose: dirty = true; break; case LinuxEvent.EnterNotify: mouseInside = true; break; case LinuxEvent.LeaveNotify: mouseInside = false; break; default: break; } } } public void update() { lockAWT(); try { processEvents(); checkInput(); } finally { unlockAWT(); } } public void reshape(int x, int y, int width, int height) { lockAWT(); try { nReshape(getDisplay(), getWindow(), x, y, width, height); } finally { unlockAWT(); } } private static native void nReshape(long display, long window, int x, int y, int width, int height); public DisplayMode[] getAvailableDisplayModes() throws LWJGLException { lockAWT(); try { incDisplay(); try { DisplayMode[] modes = nGetAvailableDisplayModes(getDisplay(), getDefaultScreen(), current_displaymode_extension); return modes; } finally { decDisplay(); } } finally { unlockAWT(); } } private static native DisplayMode[] nGetAvailableDisplayModes(long display, int screen, int extension) throws LWJGLException; /* Mouse */ public boolean hasWheel() { return true; } public int getButtonCount() { return mouse.getButtonCount(); } public void createMouse() throws LWJGLException { lockAWT(); try { mouse = new LinuxMouse(getDisplay(), getWindow(), getWindow()); } finally { unlockAWT(); } } public void destroyMouse() { mouse = null; updateInputGrab(); } public void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons) { lockAWT(); try { mouse.poll(grab, coord_buffer, buttons); } finally { unlockAWT(); } } public void readMouse(ByteBuffer buffer) { lockAWT(); try { mouse.read(buffer); } finally { unlockAWT(); } } public void setCursorPosition(int x, int y) { lockAWT(); try { mouse.setCursorPosition(x, y); } finally { unlockAWT(); } } private void checkInput() { if (parent == null) return; if (parent_focus != parent.hasFocus()) { parent_focus = parent.hasFocus(); if (parent_focus) { setInputFocusUnsafe(current_window); } else if (xembedded) { setInputFocusUnsafe(1); } } //else if (parent_focus && !focused && !xembedded) { // setInputFocusUnsafe(current_window); //} } private void setFocused(boolean got_focus, int focus_detail) { if (focused == got_focus || focus_detail == NotifyDetailNone || focus_detail == NotifyPointer || focus_detail == NotifyPointerRoot) return; focused = got_focus; if (focused) { acquireInput(); if (parent != null && !xembedded) parent.setFocusable(false); } else { releaseInput(); if (parent != null && !xembedded) parent.setFocusable(true); } } static native long nGetInputFocus(long display); private static void setInputFocusUnsafe(long window) { try { setInputFocus(getDisplay(), window, CurrentTime); sync(getDisplay(), false); } catch (LWJGLException e) { // Since we don't have any event timings for XSetInputFocus, a race condition might give a BadMatch, which we'll catch and ignore LWJGLUtil.log("Got exception while trying to focus: " + e); } } private static native void sync(long display, boolean throw_away_events) throws LWJGLException; private void releaseInput() { if (isLegacyFullscreen() || input_released) return; input_released = true; updateInputGrab(); if (current_window_mode == FULLSCREEN_NETWM) { nIconifyWindow(getDisplay(), getWindow(), getDefaultScreen()); try { if( current_displaymode_extension == XRANDR && savedXrandrConfig.length > 0 ) { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { XRandR.setConfiguration( savedXrandrConfig ); return null; } }); } else { switchDisplayModeOnTmpDisplay(saved_mode); } setGammaRampOnTmpDisplay(saved_gamma); } catch (LWJGLException e) { LWJGLUtil.log("Failed to restore saved mode: " + e.getMessage()); } } } private static native void nIconifyWindow(long display, long window, int screen); private void acquireInput() { if (isLegacyFullscreen() || !input_released) return; input_released = false; updateInputGrab(); if (current_window_mode == FULLSCREEN_NETWM) { try { switchDisplayModeOnTmpDisplay(current_mode); setGammaRampOnTmpDisplay(current_gamma); } catch (LWJGLException e) { LWJGLUtil.log("Failed to restore mode: " + e.getMessage()); } } } public void grabMouse(boolean new_grab) { lockAWT(); try { if (new_grab != grab) { grab = new_grab; updateInputGrab(); mouse.changeGrabbed(grab, shouldWarpPointer()); } } finally { unlockAWT(); } } private boolean shouldWarpPointer() { return pointer_grabbed && shouldGrab(); } public int getNativeCursorCapabilities() { lockAWT(); try { incDisplay(); try { return nGetNativeCursorCapabilities(getDisplay()); } finally { decDisplay(); } } catch (LWJGLException e) { throw new RuntimeException(e); } finally { unlockAWT(); } } private static native int nGetNativeCursorCapabilities(long display) throws LWJGLException; public void setNativeCursor(Object handle) throws LWJGLException { current_cursor = getCursorHandle(handle); lockAWT(); try { updateCursor(); } finally { unlockAWT(); } } public int getMinCursorSize() { lockAWT(); try { incDisplay(); try { return nGetMinCursorSize(getDisplay(), getWindow()); } finally { decDisplay(); } } catch (LWJGLException e) { LWJGLUtil.log("Exception occurred in getMinCursorSize: " + e); return 0; } finally { unlockAWT(); } } private static native int nGetMinCursorSize(long display, long window); public int getMaxCursorSize() { lockAWT(); try { incDisplay(); try { return nGetMaxCursorSize(getDisplay(), getWindow()); } finally { decDisplay(); } } catch (LWJGLException e) { LWJGLUtil.log("Exception occurred in getMaxCursorSize: " + e); return 0; } finally { unlockAWT(); } } private static native int nGetMaxCursorSize(long display, long window); /* Keyboard */ public void createKeyboard() throws LWJGLException { lockAWT(); try { keyboard = new LinuxKeyboard(getDisplay(), getWindow()); } finally { unlockAWT(); } } public void destroyKeyboard() { lockAWT(); try { keyboard.destroy(getDisplay()); keyboard = null; } finally { unlockAWT(); } } public void pollKeyboard(ByteBuffer keyDownBuffer) { lockAWT(); try { keyboard.poll(keyDownBuffer); } finally { unlockAWT(); } } public void readKeyboard(ByteBuffer buffer) { lockAWT(); try { keyboard.read(buffer); } finally { unlockAWT(); } } private static native long nCreateCursor(long display, int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, int images_offset, IntBuffer delays, int delays_offset) throws LWJGLException; private static long createBlankCursor() { return nCreateBlankCursor(getDisplay(), getWindow()); } static native long nCreateBlankCursor(long display, long window); public Object createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException { lockAWT(); try { incDisplay(); try { long cursor = nCreateCursor(getDisplay(), width, height, xHotspot, yHotspot, numImages, images, images.position(), delays, delays != null ? delays.position() : -1); return cursor; } catch (LWJGLException e) { decDisplay(); throw e; } } finally { unlockAWT(); } } private static long getCursorHandle(Object cursor_handle) { return cursor_handle != null ? (Long)cursor_handle : None; } public void destroyCursor(Object cursorHandle) { lockAWT(); try { nDestroyCursor(getDisplay(), getCursorHandle(cursorHandle)); decDisplay(); } finally { unlockAWT(); } } static native void nDestroyCursor(long display, long cursorHandle); public int getPbufferCapabilities() { lockAWT(); try { incDisplay(); try { return nGetPbufferCapabilities(getDisplay(), getDefaultScreen()); } finally { decDisplay(); } } catch (LWJGLException e) { LWJGLUtil.log("Exception occurred in getPbufferCapabilities: " + e); return 0; } finally { unlockAWT(); } } private static native int nGetPbufferCapabilities(long display, int screen); public boolean isBufferLost(PeerInfo handle) { return false; } public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { return new LinuxPbufferPeerInfo(width, height, pixel_format); } public void setPbufferAttrib(PeerInfo handle, int attrib, int value) { throw new UnsupportedOperationException(); } public void bindTexImageToPbuffer(PeerInfo handle, int buffer) { throw new UnsupportedOperationException(); } public void releaseTexImageFromPbuffer(PeerInfo handle, int buffer) { throw new UnsupportedOperationException(); } private static ByteBuffer convertIcon(ByteBuffer icon, int width, int height) { ByteBuffer icon_rgb = BufferUtils.createByteBuffer(icon.capacity()); int x; int y; byte r,g,b; int depth = 4; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { r = icon.get((x*4)+(y*width*4)); g = icon.get((x*4)+(y*width*4)+1); b = icon.get((x*4)+(y*width*4)+2); icon_rgb.put((x*depth)+(y*width*depth), b); // blue icon_rgb.put((x*depth)+(y*width*depth)+1, g); // green icon_rgb.put((x*depth)+(y*width*depth)+2, r); } } return icon_rgb; } private static ByteBuffer convertIconMask(ByteBuffer icon, int width, int height) { ByteBuffer icon_mask = BufferUtils.createByteBuffer((icon.capacity()/4)/8); int x; int y; byte a; int depth = 4; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { a = icon.get((x*4)+(y*width*4)+3); int mask_index = x + y*width; int mask_byte_index = mask_index/8; int mask_bit_index = mask_index%8; byte bit = (((int)a) & 0xff) >= 127 ? (byte)1 : (byte)0; byte new_byte = (byte)((icon_mask.get(mask_byte_index) | (bit< *
    • On Windows you should supply at least one 16x16 icon and one 32x32.
    • *
    • Linux (and similar platforms) expect one 32x32 icon.
    • *
    • Mac OS X should be supplied one 128x128 icon
    • * * The implementation will use the supplied ByteBuffers with image data in RGBA and perform any conversions necessary for the specific platform. * * @param icons Array of icons in RGBA mode * @return number of icons used. */ public int setIcon(ByteBuffer[] icons) { lockAWT(); try { incDisplay(); try { for ( ByteBuffer icon : icons ) { int size = icon.limit() / 4; int dimension = (int)Math.sqrt(size); if ( dimension > 0 ) { ByteBuffer icon_rgb = convertIcon(icon, dimension, dimension); ByteBuffer icon_mask = convertIconMask(icon, dimension, dimension); nSetWindowIcon(getDisplay(), getWindow(), icon_rgb, icon_rgb.capacity(), icon_mask, icon_mask.capacity(), dimension, dimension); return 1; } } return 0; } finally { decDisplay(); } } catch (LWJGLException e) { LWJGLUtil.log("Failed to set display icon: " + e); return 0; } finally { unlockAWT(); } } private static native void nSetWindowIcon(long display, long window, ByteBuffer icon_rgb, int icon_rgb_size, ByteBuffer icon_mask, int icon_mask_size, int width, int height); public int getWidth() { return Display.getDisplayMode().getWidth(); } public int getHeight() { return Display.getDisplayMode().getHeight(); } public boolean isInsideWindow() { return mouseInside; } /** * Helper class for managing Compiz's workarounds. We need this to enable Legacy * Fullscreen Support in Compiz, else we'll have trouble with fullscreen windows * when Compiz effects are enabled. * * Implementation Note: This code is probably too much for an inner class, but * keeping it here until we're sure we cannot find a better solution. */ private static final class Compiz { private static boolean applyFix; private static Provider provider; private Compiz() { } static void init() { if ( Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.nocompiz_lfs") ) return; AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { // Check if Compiz is active if ( !isProcessActive("compiz") ) return null; provider = null; String providerName = null; // Check if Dbus is available if ( isProcessActive("dbus-daemon") ) { providerName = "Dbus"; provider = new Provider() { private static final String KEY = "/org/freedesktop/compiz/workarounds/allscreens/legacy_fullscreen"; public boolean hasLegacyFullscreenSupport() throws LWJGLException { final List output = Compiz.run( "dbus-send", "--print-reply", "--type=method_call", "--dest=org.freedesktop.compiz", KEY, "org.freedesktop.compiz.get" ); if ( output == null || output.size() < 2 ) throw new LWJGLException("Invalid Dbus reply."); String line = (String)output.get(0); if ( !line.startsWith("method return") ) throw new LWJGLException("Invalid Dbus reply."); line = ((String)output.get(1)).trim(); // value if ( !line.startsWith("boolean") || line.length() < 12) throw new LWJGLException("Invalid Dbus reply."); return "true".equalsIgnoreCase(line.substring("boolean".length() + 1)); } public void setLegacyFullscreenSupport(final boolean state) throws LWJGLException { if ( Compiz.run( "dbus-send", "--type=method_call", "--dest=org.freedesktop.compiz", KEY, "org.freedesktop.compiz.set", "boolean:" + Boolean.toString(state) ) == null ) throw new LWJGLException("Failed to apply Compiz LFS workaround."); } }; } else { try { // Check if Gconf is available Runtime.getRuntime().exec("gconftool"); providerName = "gconftool"; provider = new Provider() { private static final String KEY = "/apps/compiz/plugins/workarounds/allscreens/options/legacy_fullscreen"; public boolean hasLegacyFullscreenSupport() throws LWJGLException { final List output = Compiz.run(new String[] { "gconftool", "-g", KEY }); if ( output == null || output.size() == 0 ) throw new LWJGLException("Invalid gconftool reply."); return Boolean.parseBoolean(((String)output.get(0)).trim()); } public void setLegacyFullscreenSupport(final boolean state) throws LWJGLException { if ( Compiz.run(new String[] { "gconftool", "-s", KEY, "-s", Boolean.toString(state), "-t", "bool" }) == null ) throw new LWJGLException("Failed to apply Compiz LFS workaround."); if ( state ) { try { // gconftool will not apply the workaround immediately, sleep a bit // to make sure it will be ok when we create the window. Thread.sleep(200); // 100 is too low, 150 works, set to 200 to be safe. } catch (InterruptedException e) { e.printStackTrace(); } } } }; } catch (IOException e) { // Ignore } } if ( provider != null && !provider.hasLegacyFullscreenSupport() ) { // No need to do anything if LFS is already enabled. applyFix = true; LWJGLUtil.log("Using " + providerName + " to apply Compiz LFS workaround."); } } catch (LWJGLException e) { // Ignore } finally { return null; } } }); } static void setLegacyFullscreenSupport(final boolean enabled) { if ( !applyFix ) return; AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { provider.setLegacyFullscreenSupport(enabled); } catch (LWJGLException e) { LWJGLUtil.log("Failed to change Compiz Legacy Fullscreen Support. Reason: " + e.getMessage()); } return null; } }); } private static List run(final String... command) throws LWJGLException { final List output = new ArrayList(); try { final Process p = Runtime.getRuntime().exec(command); try { final int exitValue = p.waitFor(); if ( exitValue != 0 ) return null; } catch (InterruptedException e) { throw new LWJGLException("Process interrupted.", e); } final BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); String line; while ( (line = br.readLine()) != null ) output.add(line); br.close(); } catch (final IOException e) { throw new LWJGLException("Process failed.", e); } return output; } private static boolean isProcessActive(final String processName) throws LWJGLException { final List output = run(new String[] { "ps", "-C", processName }); if ( output == null ) return false; for ( final String line : output ) { if ( line.contains(processName) ) return true; } return false; } private interface Provider { boolean hasLegacyFullscreenSupport() throws LWJGLException; void setLegacyFullscreenSupport(boolean state) throws LWJGLException; } } }lwjgl-2.7.1/src/java/org/lwjgl/opengl/WindowsContextAttribs.java0000644000175000017500000000614511543426510024024 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * An implementation of ContextAttribs using WGL_create_context. * * @author spasi */ final class WindowsContextAttribs implements ContextAttribsImplementation { private static final int WGL_CONTEXT_MAJOR_VERSION_ARB = 0x2091; private static final int WGL_CONTEXT_MINOR_VERSION_ARB = 0x2092; private static final int WGL_CONTEXT_LAYER_PLANE_ARB = 0x2093; private static final int WGL_CONTEXT_FLAGS_ARB = 0x2094; private static final int WGL_CONTEXT_PROFILE_MASK_ARB = 0x9126; private static final int WGL_CONTEXT_DEBUG_BIT_ARB = 0x0001; private static final int WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002; private static final int WGL_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001; private static final int WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002; WindowsContextAttribs() { } public int getMajorVersionAttrib() { return WGL_CONTEXT_MAJOR_VERSION_ARB; } public int getMinorVersionAttrib() { return WGL_CONTEXT_MINOR_VERSION_ARB; } public int getLayerPlaneAttrib() { return WGL_CONTEXT_LAYER_PLANE_ARB; } public int getFlagsAttrib() { return WGL_CONTEXT_FLAGS_ARB; } public int getDebugBit() { return WGL_CONTEXT_DEBUG_BIT_ARB; } public int getForwardCompatibleBit() { return WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; } public int getProfileMaskAttrib() { return WGL_CONTEXT_PROFILE_MASK_ARB; } public int getProfileCoreBit() { return WGL_CONTEXT_CORE_PROFILE_BIT_ARB; } public int getProfileCompatibilityBit() { return WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; } }lwjgl-2.7.1/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java0000644000175000017500000000627211543426510025171 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.Toolkit; import java.awt.Canvas; import java.security.PrivilegedAction; import java.security.AccessController; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; /** * * @author elias_naur * @version $Revision: 3418 $ * $Id: WindowsCanvasImplementation.java 3418 2010-09-28 21:11:35Z spasi $ */ final class WindowsCanvasImplementation implements AWTCanvasImplementation { static { // Make sure the awt stuff is properly initialised (the jawt library in particular) Toolkit.getDefaultToolkit(); AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { System.loadLibrary("jawt"); } catch (UnsatisfiedLinkError e) { /* It is probably already loaded, potentially by a different ClassLoader * so just log the exception and continue */ LWJGLUtil.log("Failed to load jawt: " + e.getMessage()); } return null; } }); } public PeerInfo createPeerInfo(Canvas component, PixelFormat pixel_format) throws LWJGLException { return new WindowsAWTGLCanvasPeerInfo(component, pixel_format); } /** * Find a proper GraphicsConfiguration from the given GraphicsDevice and PixelFormat. * * @return The GraphicsConfiguration corresponding to a visual that matches the pixel format. */ public GraphicsConfiguration findConfiguration(GraphicsDevice device, PixelFormat pixel_format) throws LWJGLException { /* * It seems like the best way is to simply return null and * use SetPixelFormat in JNI later. */ return null; } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/LinuxEvent.java0000644000175000017500000001512011543426510021566 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; /** * Wrapper class for X11 events. * * @author elias_naur * @version $Revision: 2286 $ * $Id: LinuxPeerInfo.java 2286 2006-03-23 19:32:21Z matzon $ */ final class LinuxEvent { public static final int FocusIn = 9; public static final int FocusOut = 10; public static final int KeyPress = 2; public static final int KeyRelease = 3; public static final int ButtonPress = 4; public static final int ButtonRelease = 5; public static final int MotionNotify = 6; public static final int EnterNotify = 7; public static final int LeaveNotify = 8; public static final int UnmapNotify = 18; public static final int MapNotify = 19; public static final int Expose = 12; public static final int ClientMessage = 33; private final ByteBuffer event_buffer; LinuxEvent() { this.event_buffer = createEventBuffer(); } private static native ByteBuffer createEventBuffer(); public void copyFrom(LinuxEvent event) { int pos = event_buffer.position(); int event_pos = event.event_buffer.position(); event_buffer.put(event.event_buffer); event_buffer.position(pos); event.event_buffer.position(event_pos); } public static native int getPending(long display); public void sendEvent(long display, long window, boolean propagate, long event_mask) { nSendEvent(event_buffer, display, window, propagate, event_mask); } private static native void nSendEvent(ByteBuffer event_buffer, long display, long window, boolean propagate, long event_mask); public boolean filterEvent(long window) { return nFilterEvent(event_buffer, window); } private static native boolean nFilterEvent(ByteBuffer event_buffer, long window); public void nextEvent(long display) { nNextEvent(display, event_buffer); } private static native void nNextEvent(long display, ByteBuffer event_buffer); public int getType() { return nGetType(event_buffer); } private static native int nGetType(ByteBuffer event_buffer); public long getWindow() { return nGetWindow(event_buffer); } private static native long nGetWindow(ByteBuffer event_buffer); public void setWindow(long window) { nSetWindow(event_buffer, window); } private static native void nSetWindow(ByteBuffer event_buffer, long window); /* Focus methods */ public int getFocusMode() { return nGetFocusMode(event_buffer); } private static native int nGetFocusMode(ByteBuffer event_buffer); public int getFocusDetail() { return nGetFocusDetail(event_buffer); } private static native int nGetFocusDetail(ByteBuffer event_buffer); /* ClientMessage methods */ public long getClientMessageType() { return nGetClientMessageType(event_buffer); } private static native long nGetClientMessageType(ByteBuffer event_buffer); public int getClientData(int index) { return nGetClientData(event_buffer, index); } private static native int nGetClientData(ByteBuffer event_buffer, int index); public int getClientFormat() { return nGetClientFormat(event_buffer); } private static native int nGetClientFormat(ByteBuffer event_buffer); /* Button methods */ public long getButtonTime() { return nGetButtonTime(event_buffer); } private static native long nGetButtonTime(ByteBuffer event_buffer); public int getButtonState() { return nGetButtonState(event_buffer); } private static native int nGetButtonState(ByteBuffer event_buffer); public int getButtonType() { return nGetButtonType(event_buffer); } private static native int nGetButtonType(ByteBuffer event_buffer); public int getButtonButton() { return nGetButtonButton(event_buffer); } private static native int nGetButtonButton(ByteBuffer event_buffer); public long getButtonRoot() { return nGetButtonRoot(event_buffer); } private static native long nGetButtonRoot(ByteBuffer event_buffer); public int getButtonXRoot() { return nGetButtonXRoot(event_buffer); } private static native int nGetButtonXRoot(ByteBuffer event_buffer); public int getButtonYRoot() { return nGetButtonYRoot(event_buffer); } private static native int nGetButtonYRoot(ByteBuffer event_buffer); public int getButtonX() { return nGetButtonX(event_buffer); } private static native int nGetButtonX(ByteBuffer event_buffer); public int getButtonY() { return nGetButtonY(event_buffer); } private static native int nGetButtonY(ByteBuffer event_buffer); /* Key methods */ public long getKeyAddress() { return nGetKeyAddress(event_buffer); } private static native long nGetKeyAddress(ByteBuffer event_buffer); public long getKeyTime() { return nGetKeyTime(event_buffer); } private static native int nGetKeyTime(ByteBuffer event_buffer); public int getKeyType() { return nGetKeyType(event_buffer); } private static native int nGetKeyType(ByteBuffer event_buffer); public int getKeyKeyCode() { return nGetKeyKeyCode(event_buffer); } private static native int nGetKeyKeyCode(ByteBuffer event_buffer); public int getKeyState() { return nGetKeyState(event_buffer); } private static native int nGetKeyState(ByteBuffer event_buffer); } lwjgl-2.7.1/src/java/org/lwjgl/opengl/LinuxKeyboard.java0000644000175000017500000002767311543426510022265 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * @author elias_naur */ import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLUtil; import org.lwjgl.input.Keyboard; final class LinuxKeyboard { private static final int LockMapIndex = 1; private static final long NoSymbol = 0; private static final long ShiftMask = 1 << 0; private static final long LockMask = 1 << 1; private static final int XLookupChars = 2; private static final int XLookupBoth = 4; private static final int KEYBOARD_BUFFER_SIZE = 50; private final long xim; private final long xic; private final int numlock_mask; private final int modeswitch_mask; private final int caps_lock_mask; private final int shift_lock_mask; private final ByteBuffer compose_status; private final byte[] key_down_buffer = new byte[Keyboard.KEYBOARD_SIZE]; private final EventQueue event_queue = new EventQueue(Keyboard.EVENT_SIZE); private final ByteBuffer tmp_event = ByteBuffer.allocate(Keyboard.EVENT_SIZE); private final int[] temp_translation_buffer = new int[KEYBOARD_BUFFER_SIZE]; private final ByteBuffer native_translation_buffer = BufferUtils.createByteBuffer(KEYBOARD_BUFFER_SIZE); private final CharsetDecoder utf8_decoder = Charset.forName("UTF-8").newDecoder(); private final CharBuffer char_buffer = CharBuffer.allocate(KEYBOARD_BUFFER_SIZE); // Deferred key released event, to detect key repeat private boolean has_deferred_event; private int deferred_keycode; private int deferred_event_keycode; private long deferred_nanos; private byte deferred_key_state; LinuxKeyboard(long display, long window) { long modifier_map = getModifierMapping(display); int tmp_numlock_mask = 0; int tmp_modeswitch_mask = 0; int tmp_caps_lock_mask = 0; int tmp_shift_lock_mask = 0; if (modifier_map != 0) { int max_keypermod = getMaxKeyPerMod(modifier_map); // Find modifier masks int i, j; for (i = 0; i < 8; i++) { for (j = 0; j < max_keypermod; j++) { int key_code = lookupModifierMap(modifier_map, i*max_keypermod + j); int key_sym = (int)keycodeToKeySym(display, key_code); int mask = 1 << i; switch (key_sym) { case LinuxKeycodes.XK_Num_Lock: tmp_numlock_mask |= mask; break; case LinuxKeycodes.XK_Mode_switch: tmp_modeswitch_mask |= mask; break; case LinuxKeycodes.XK_Caps_Lock: if (i == LockMapIndex) { tmp_caps_lock_mask = mask; tmp_shift_lock_mask = 0; } break; case LinuxKeycodes.XK_Shift_Lock: if (i == LockMapIndex && tmp_caps_lock_mask == 0) tmp_shift_lock_mask = mask; break; default: break; } } } freeModifierMapping(modifier_map); } numlock_mask = tmp_numlock_mask; modeswitch_mask = tmp_modeswitch_mask; caps_lock_mask = tmp_caps_lock_mask; shift_lock_mask = tmp_shift_lock_mask; setDetectableKeyRepeat(display, true); xim = openIM(display); if (xim != 0) { xic = createIC(xim, window); if (xic != 0) { setupIMEventMask(display, window, xic); } else { destroy(display); } } else { xic = 0; } compose_status = allocateComposeStatus(); } private static native long getModifierMapping(long display); private static native void freeModifierMapping(long modifier_map); private static native int getMaxKeyPerMod(long modifier_map); private static native int lookupModifierMap(long modifier_map, int index); private static native long keycodeToKeySym(long display, int key_code); private static native long openIM(long display); private static native long createIC(long xim, long window); private static native void setupIMEventMask(long display, long window, long xic); private static native ByteBuffer allocateComposeStatus(); private static void setDetectableKeyRepeat(long display, boolean enabled) { boolean success = nSetDetectableKeyRepeat(display, enabled); if (!success) LWJGLUtil.log("Failed to set detectable key repeat to " + enabled); } private static native boolean nSetDetectableKeyRepeat(long display, boolean enabled); public void destroy(long display) { if (xic != 0) destroyIC(xic); if (xim != 0) closeIM(xim); setDetectableKeyRepeat(display, false); } private static native void destroyIC(long xic); private static native void closeIM(long xim); public void read(ByteBuffer buffer) { flushDeferredEvent(); event_queue.copyEvents(buffer); } public void poll(ByteBuffer keyDownBuffer) { flushDeferredEvent(); int old_position = keyDownBuffer.position(); keyDownBuffer.put(key_down_buffer); keyDownBuffer.position(old_position); } private void putKeyboardEvent(int keycode, byte state, int ch, long nanos, boolean repeat) { tmp_event.clear(); tmp_event.putInt(keycode).put(state).putInt(ch).putLong(nanos).put(repeat ? (byte)1 : (byte)0); tmp_event.flip(); event_queue.putEvent(tmp_event); } private int lookupStringISO88591(long event_ptr, int[] translation_buffer) { int i; int num_chars = lookupString(event_ptr, native_translation_buffer, compose_status); for (i = 0; i < num_chars; i++) { translation_buffer[i] = ((int)native_translation_buffer.get(i)) & 0xff; } return num_chars; } private static native int lookupString(long event_ptr, ByteBuffer buffer, ByteBuffer compose_status); private int lookupStringUnicode(long event_ptr, int[] translation_buffer) { int status = utf8LookupString(xic, event_ptr, native_translation_buffer, native_translation_buffer.position(), native_translation_buffer.remaining()); if (status != XLookupChars && status != XLookupBoth) return 0; native_translation_buffer.flip(); utf8_decoder.decode(native_translation_buffer, char_buffer, true); native_translation_buffer.compact(); char_buffer.flip(); int i = 0; while (char_buffer.hasRemaining() && i < translation_buffer.length) { translation_buffer[i++] = char_buffer.get(); } char_buffer.compact(); return i; } private static native int utf8LookupString(long xic, long event_ptr, ByteBuffer buffer, int pos, int size); private int lookupString(long event_ptr, int[] translation_buffer) { if (xic != 0) { return lookupStringUnicode(event_ptr, translation_buffer); } else return lookupStringISO88591(event_ptr, translation_buffer); } private void translateEvent(long event_ptr, int keycode, byte key_state, long nanos, boolean repeat) { int num_chars, i; int ch; num_chars = lookupString(event_ptr, temp_translation_buffer); if (num_chars > 0) { ch = temp_translation_buffer[0]; putKeyboardEvent(keycode, key_state, ch, nanos, repeat); for (i = 1; i < num_chars; i++) { ch = temp_translation_buffer[i]; putKeyboardEvent(0, (byte)0, ch, nanos, repeat); } } else { putKeyboardEvent(keycode, key_state, 0, nanos, repeat); } } private static boolean isKeypadKeysym(long keysym) { return (0xFF80 <= keysym && keysym <= 0xFFBD) || (0x11000000 <= keysym && keysym <= 0x1100FFFF); } private static boolean isNoSymbolOrVendorSpecific(long keysym) { return keysym == NoSymbol || (keysym & (1 << 28)) != 0; } private static long getKeySym(long event_ptr, int group, int index) { long keysym = lookupKeysym(event_ptr, group*2 + index); if (isNoSymbolOrVendorSpecific(keysym) && index == 1) { keysym = lookupKeysym(event_ptr, group*2 + 0); } if (isNoSymbolOrVendorSpecific(keysym) && group == 1) keysym = getKeySym(event_ptr, 0, index); return keysym; } private static native long lookupKeysym(long event_ptr, int index); private static native long toUpper(long keysym); private long mapEventToKeySym(long event_ptr, int event_state) { int group; long keysym; if ((event_state & modeswitch_mask) != 0) group = 1; else group = 0; if ((event_state & numlock_mask) != 0 && isKeypadKeysym(keysym = getKeySym(event_ptr, group, 1))) { if ((event_state & (ShiftMask | shift_lock_mask)) != 0) { return getKeySym(event_ptr, group, 0); } else { return keysym; } } else if ((event_state & (ShiftMask | LockMask)) == 0) { return getKeySym(event_ptr, group, 0); } else if ((event_state & ShiftMask) == 0) { keysym = getKeySym(event_ptr, group, 0); if ((event_state & caps_lock_mask) != 0) keysym = toUpper(keysym); return keysym; } else { keysym = getKeySym(event_ptr, group, 1); if ((event_state & caps_lock_mask) != 0) keysym = toUpper(keysym); return keysym; } } private int getKeycode(long event_ptr, int event_state) { long keysym = mapEventToKeySym(event_ptr, event_state); int keycode = LinuxKeycodes.mapKeySymToLWJGLKeyCode(keysym); if (keycode == Keyboard.KEY_NONE) { // Try unshifted keysym mapping keysym = lookupKeysym(event_ptr, 0); keycode = LinuxKeycodes.mapKeySymToLWJGLKeyCode(keysym); } return keycode; } private byte getKeyState(int event_type) { switch (event_type) { case LinuxEvent.KeyPress: return 1; case LinuxEvent.KeyRelease: return 0; default: throw new IllegalArgumentException("Unknown event_type: " + event_type); } } private void handleKeyEvent(long event_ptr, long millis, int event_type, int event_keycode, int event_state) { int keycode = getKeycode(event_ptr, event_state); byte key_state = getKeyState(event_type); boolean repeat = key_state == key_down_buffer[keycode]; key_down_buffer[keycode] = key_state; long nanos = millis*1000000; if (event_type == LinuxEvent.KeyPress) { if (has_deferred_event) { if (nanos == deferred_nanos && event_keycode == deferred_event_keycode) { has_deferred_event = false; repeat = true; // Repeated event } else flushDeferredEvent(); } translateEvent(event_ptr, keycode, key_state, nanos, repeat); } else { flushDeferredEvent(); has_deferred_event = true; deferred_keycode = keycode; deferred_event_keycode = event_keycode; deferred_nanos = nanos; deferred_key_state = key_state; } } private void flushDeferredEvent() { if (has_deferred_event) { putKeyboardEvent(deferred_keycode, deferred_key_state, 0, deferred_nanos, false); has_deferred_event = false; } } public boolean filterEvent(LinuxEvent event) { switch (event.getType()) { case LinuxEvent.KeyPress: /* Fall through */ case LinuxEvent.KeyRelease: handleKeyEvent(event.getKeyAddress(), event.getKeyTime(), event.getKeyType(), event.getKeyKeyCode(), event.getKeyState()); return true; default: break; } return false; } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/APIUtil.java0000644000175000017500000002002611543426510020735 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLUtil; import java.nio.*; /** @author spasi */ final class APIUtil { private static final int INITIAL_BUFFER_SIZE = 256; private static final int INITIAL_LENGTHS_SIZE = 4; private static final int BUFFERS_SIZE = 32; private static final ThreadLocal arrayTL = new ThreadLocal() { protected char[] initialValue() { return new char[INITIAL_BUFFER_SIZE]; } }; private static final ThreadLocal bufferTL = new ThreadLocal() { protected ByteBuffer initialValue() { return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); } }; private static final ThreadLocal lengthsTL = new ThreadLocal() { protected IntBuffer initialValue() { return BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE); } }; private static final ThreadLocal buffersTL = new ThreadLocal() { protected Buffers initialValue() { return new Buffers(); } }; private APIUtil() { } private static char[] getArray(final int size) { char[] array = arrayTL.get(); if ( array.length < size ) { int sizeNew = array.length << 1; while ( sizeNew < size ) sizeNew <<= 1; array = new char[size]; arrayTL.set(array); } return array; } static ByteBuffer getBufferByte(final int size) { ByteBuffer buffer = bufferTL.get(); if ( buffer.capacity() < size ) { int sizeNew = buffer.capacity() << 1; while ( sizeNew < size ) sizeNew <<= 1; buffer = BufferUtils.createByteBuffer(size); bufferTL.set(buffer); } else buffer.clear(); return buffer; } private static ByteBuffer getBufferByteOffset(final int size) { ByteBuffer buffer = bufferTL.get(); if ( buffer.capacity() < size ) { int sizeNew = buffer.capacity() << 1; while ( sizeNew < size ) sizeNew <<= 1; final ByteBuffer bufferNew = BufferUtils.createByteBuffer(size); bufferNew.put(buffer); bufferTL.set(buffer = bufferNew); } else { buffer.position(buffer.limit()); buffer.limit(buffer.capacity()); } return buffer; } static ShortBuffer getBufferShort() { return buffersTL.get().shorts; } static IntBuffer getBufferInt() { return buffersTL.get().ints; } static LongBuffer getBufferLong() { return buffersTL.get().longs; } static FloatBuffer getBufferFloat() { return buffersTL.get().floats; } static DoubleBuffer getBufferDouble() { return buffersTL.get().doubles; } static IntBuffer getLengths() { return getLengths(1); } static IntBuffer getLengths(final int size) { IntBuffer lengths = lengthsTL.get(); if ( lengths.capacity() < size ) { int sizeNew = lengths.capacity(); while ( sizeNew < size ) sizeNew <<= 1; lengths = BufferUtils.createIntBuffer(size); lengthsTL.set(lengths); } else lengths.clear(); return lengths; } /** * Simple ASCII encoding. * * @param buffer The target buffer * @param string The source string */ private static ByteBuffer encode(final ByteBuffer buffer, final CharSequence string) { for ( int i = 0; i < string.length(); i++ ) { final char c = string.charAt(i); if ( LWJGLUtil.DEBUG && 0x80 <= c ) // Silently ignore and map to 0x1A. buffer.put((byte)0x1A); else buffer.put((byte)c); } return buffer; } /** * Reads a byte string from the specified buffer. * * @param buffer * * @return the buffer as a String. */ static String getString(final ByteBuffer buffer) { final int length = buffer.remaining(); final char[] charArray = getArray(length); for ( int i = buffer.position(); i < buffer.limit(); i++ ) charArray[i - buffer.position()] = (char)buffer.get(i); return new String(charArray, 0, length); } /** * Returns a buffer containing the specified string as bytes. * * @param string * * @return the String as a ByteBuffer */ static ByteBuffer getBuffer(final CharSequence string) { final ByteBuffer buffer = encode(getBufferByte(string.length()), string); buffer.flip(); return buffer; } /** * Returns a buffer containing the specified string as bytes, starting at the specified offset. * * @param string * * @return the String as a ByteBuffer */ static ByteBuffer getBuffer(final CharSequence string, final int offset) { final ByteBuffer buffer = encode(getBufferByteOffset(offset + string.length()), string); buffer.flip(); return buffer; } /** * Returns a buffer containing the specified string as bytes, including null-termination. * * @param string * * @return the String as a ByteBuffer */ static ByteBuffer getBufferNT(final CharSequence string) { final ByteBuffer buffer = encode(getBufferByte(string.length() + 1), string); buffer.put((byte)0); buffer.flip(); return buffer; } static int getTotalLength(final CharSequence[] strings) { int length = 0; for ( CharSequence string : strings ) length += string.length(); return length; } /** * Returns a buffer containing the specified strings as bytes. * * @param strings * * @return the Strings as a ByteBuffer */ static ByteBuffer getBuffer(final CharSequence[] strings) { final ByteBuffer buffer = getBufferByte(getTotalLength(strings)); for ( CharSequence string : strings ) encode(buffer, string); buffer.flip(); return buffer; } /** * Returns a buffer containing the specified strings as bytes, including null-termination. * * @param strings * * @return the Strings as a ByteBuffer */ static ByteBuffer getBufferNT(final CharSequence[] strings) { final ByteBuffer buffer = getBufferByte(getTotalLength(strings) + strings.length); for ( CharSequence string : strings ) { encode(buffer, string); buffer.put((byte)0); } buffer.flip(); return buffer; } /** * Returns a buffer containing the lengths of the specified strings. * * @param strings * * @return the String lengths in an IntBuffer */ static IntBuffer getLengths(final CharSequence[] strings) { IntBuffer buffer = getLengths(strings.length); for ( CharSequence string : strings ) buffer.put(string.length()); buffer.flip(); return buffer; } private static class Buffers { final ShortBuffer shorts; final IntBuffer ints; final LongBuffer longs; final FloatBuffer floats; final DoubleBuffer doubles; Buffers() { shorts = BufferUtils.createShortBuffer(BUFFERS_SIZE); ints = BufferUtils.createIntBuffer(BUFFERS_SIZE); longs = BufferUtils.createLongBuffer(BUFFERS_SIZE); floats = BufferUtils.createFloatBuffer(BUFFERS_SIZE); doubles = BufferUtils.createDoubleBuffer(BUFFERS_SIZE); } } }lwjgl-2.7.1/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java0000644000175000017500000001123411543426510025034 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.LWJGLException; import java.nio.ByteBuffer; import java.nio.IntBuffer; /** * @author elias_naur * @version $Revision: 3116 $ * $Id: MacOSXContextImplementation.java 3116 2008-08-19 16:46:03Z spasi $ */ final class MacOSXContextImplementation implements ContextImplementation { public ByteBuffer create(PeerInfo peer_info, IntBuffer attribs, ByteBuffer shared_context_handle) throws LWJGLException { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { return nCreate(peer_handle, attribs, shared_context_handle); } finally { peer_info.unlock(); } } private static native ByteBuffer nCreate(ByteBuffer peer_handle, IntBuffer attribs, ByteBuffer shared_context_handle) throws LWJGLException; public void swapBuffers() throws LWJGLException { Context current_context = Context.getCurrentContext(); if ( current_context == null ) throw new IllegalStateException("No context is current"); synchronized ( current_context ) { nSwapBuffers(current_context.getHandle()); } } private static native void nSwapBuffers(ByteBuffer context_handle) throws LWJGLException; public void update(ByteBuffer context_handle) { nUpdate(context_handle); } private static native void nUpdate(ByteBuffer context_handle); public void releaseCurrentContext() throws LWJGLException { nReleaseCurrentContext(); } private static native void nReleaseCurrentContext() throws LWJGLException; public void releaseDrawable(ByteBuffer context_handle) throws LWJGLException { clearDrawable(context_handle); } private static native void clearDrawable(ByteBuffer handle) throws LWJGLException; static void resetView(PeerInfo peer_info, Context context) throws LWJGLException { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { synchronized ( context ) { clearDrawable(context.getHandle()); setView(peer_handle, context.getHandle()); } } finally { peer_info.unlock(); } } public void makeCurrent(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { setView(peer_handle, handle); nMakeCurrent(handle); } finally { peer_info.unlock(); } } private static native void setView(ByteBuffer peer_handle, ByteBuffer context_handle) throws LWJGLException; private static native void nMakeCurrent(ByteBuffer context_handle) throws LWJGLException; public boolean isCurrent(ByteBuffer handle) throws LWJGLException { boolean result = nIsCurrent(handle); return result; } private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException; public void setSwapInterval(int value) { Context current_context = Context.getCurrentContext(); synchronized ( current_context ) { nSetSwapInterval(current_context.getHandle(), value); } } private static native void nSetSwapInterval(ByteBuffer context_handle, int value); public void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { nDestroy(handle); } private static native void nDestroy(ByteBuffer context_handle) throws LWJGLException; } lwjgl-2.7.1/src/java/org/lwjgl/opengl/AWTCanvasImplementation.java0000644000175000017500000000472711543426510024175 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.Canvas; import org.lwjgl.LWJGLException; /** * * @author elias_naur * @version $Revision: 3002 $ * $Id: AWTCanvasImplementation.java 3002 2008-04-10 20:25:54Z elias_naur $ */ interface AWTCanvasImplementation { /** * Return an opaque handle to the canvas peer information required to create a context from it. */ PeerInfo createPeerInfo(Canvas component, PixelFormat pixel_format) throws LWJGLException; /** * Find a proper GraphicsConfiguration from the given GraphicsDevice and PixelFormat. * * @return A GraphicsConfiguration matching the given GraphicsConfiguration and PixelFormat. * @throws LWJGLException if no suitable configuration could be found. */ GraphicsConfiguration findConfiguration(GraphicsDevice device, PixelFormat pixel_format) throws LWJGLException; } lwjgl-2.7.1/src/java/org/lwjgl/opengl/ContextImplementation.java0000644000175000017500000000574011543426510024026 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import java.nio.IntBuffer; import org.lwjgl.LWJGLException; /** *

      * Context implementation interface. *

      * * @author elias_naur * @version $Revision: 3116 $ * $Id: ContextImplementation.java 3116 2008-08-19 16:46:03Z spasi $ */ interface ContextImplementation { /** * Create a context. */ ByteBuffer create(PeerInfo peer_info, IntBuffer attribs, ByteBuffer shared_context_handle) throws LWJGLException; /** * Swap the buffers of the current context. Only valid for double-buffered contexts. */ void swapBuffers() throws LWJGLException; /** * Release the context from its drawable, if any. */ void releaseDrawable(ByteBuffer context_handle) throws LWJGLException; /** * Release the current context (if any). After this call, no context is current. */ void releaseCurrentContext() throws LWJGLException; /** * Update the context. Should be called whenever it's drawable is moved or resized */ void update(ByteBuffer context_handle); /** * Query whether the context is current */ void makeCurrent(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException; /** * Query whether the context is current */ boolean isCurrent(ByteBuffer handle) throws LWJGLException; void setSwapInterval(int value); /** * Destroys the Context. */ void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException; } lwjgl-2.7.1/src/java/org/lwjgl/opengl/Display.java0000644000175000017500000010635411543426510021104 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * This is the abstract class for a Display in LWJGL. LWJGL displays have some * peculiar characteristics: * * - the display may be closeable by the user or operating system, and may be minimized * by the user or operating system * - only one display may ever be open at once * - the operating system may or may not be able to do fullscreen or windowed displays. * * @author foo */ import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.Sys; import org.lwjgl.input.Controllers; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import java.awt.*; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Arrays; import java.util.HashSet; import static org.lwjgl.opengl.GL11.*; public final class Display { private static final Thread shutdown_hook = new Thread() { public void run() { reset(); } }; /** The display implementor */ private static final DisplayImplementation display_impl; /** The initial display mode */ private static final DisplayMode initial_mode; /** The parent, if any */ private static Canvas parent; /** The current display mode, if created */ private static DisplayMode current_mode; /** Timer for sync() */ private static long timeThen; /** X coordinate of the window */ private static int x = -1; /** Cached window icons, for when Display is recreated */ private static ByteBuffer[] cached_icons; /** * Y coordinate of the window. Y in window coordinates is from the top of the display down, * unlike GL, where it is typically at the bottom of the display. */ private static int y = -1; /** Title of the window (never null) */ private static String title = "Game"; /** Fullscreen */ private static boolean fullscreen; /** Swap interval */ private static int swap_interval; /** The Drawable instance that tracks the current Display context */ private static final AbstractDrawable drawable; private static boolean window_created; private static boolean parent_resized; /** Initial Background Color of Display */ private static float r, g, b; private static final ComponentListener component_listener = new ComponentAdapter() { public void componentResized(ComponentEvent e) { synchronized ( GlobalLock.lock ) { parent_resized = true; } } }; static { Sys.initialize(); display_impl = createDisplayImplementation(); try { current_mode = initial_mode = display_impl.init(); LWJGLUtil.log("Initial mode: " + initial_mode); } catch (LWJGLException e) { throw new RuntimeException(e); } drawable = new AbstractDrawable() { public void destroy() { synchronized ( GlobalLock.lock ) { if ( !isCreated() ) return; releaseDrawable(); super.destroy(); destroyWindow(); x = y = -1; cached_icons = null; reset(); removeShutdownHook(); } } }; } /** * Fetch the Drawable from the Display. * * @return the Drawable corresponding to the Display context */ public static Drawable getDrawable() { return drawable; } private static DisplayImplementation createDisplayImplementation() { switch ( LWJGLUtil.getPlatform() ) { case LWJGLUtil.PLATFORM_LINUX: return new LinuxDisplay(); case LWJGLUtil.PLATFORM_WINDOWS: return new WindowsDisplay(); case LWJGLUtil.PLATFORM_MACOSX: return new MacOSXDisplay(); default: throw new IllegalStateException("Unsupported platform"); } } /** Only constructed by ourselves */ private Display() { } /** * Returns the entire list of possible fullscreen display modes as an array, in no * particular order. Although best attempts to filter out invalid modes are done, any * given mode is not guaranteed to be available nor is it guaranteed to be within the * current monitor specs (this is especially a problem with the frequency parameter). * Furthermore, it is not guaranteed that create() will detect an illegal display mode. *

      * The only certain way to check * is to call create() and make sure it works. * Only non-palette-indexed modes are returned (ie. bpp will be 16, 24, or 32). * Only DisplayModes from this call can be used when the Display is in fullscreen * mode. * * @return an array of all display modes the system reckons it can handle. */ public static DisplayMode[] getAvailableDisplayModes() throws LWJGLException { synchronized ( GlobalLock.lock ) { DisplayMode[] unfilteredModes = display_impl.getAvailableDisplayModes(); if ( unfilteredModes == null ) { return new DisplayMode[0]; } // We'll use a HashSet to filter out the duplicated modes HashSet modes = new HashSet(unfilteredModes.length); modes.addAll(Arrays.asList(unfilteredModes)); DisplayMode[] filteredModes = new DisplayMode[modes.size()]; modes.toArray(filteredModes); LWJGLUtil.log("Removed " + (unfilteredModes.length - filteredModes.length) + " duplicate displaymodes"); return filteredModes; } } /** * Return the initial desktop display mode. * * @return The desktop display mode */ public static DisplayMode getDesktopDisplayMode() { return initial_mode; } /** * Return the current display mode, as set by setDisplayMode(). * * @return The current display mode */ public static DisplayMode getDisplayMode() { return current_mode; } /** * Set the current display mode. If no OpenGL context has been created, the given mode will apply to * the context when create() is called, and no immediate mode switching will happen. If there is a * context already, it will be resized according to the given mode. If the context is also a * fullscreen context, the mode will also be switched immediately. The native cursor position * is also reset. * * @param mode The new display mode to set * * @throws LWJGLException if the display mode could not be set */ public static void setDisplayMode(DisplayMode mode) throws LWJGLException { synchronized ( GlobalLock.lock ) { if ( mode == null ) throw new NullPointerException("mode must be non-null"); boolean was_fullscreen = isFullscreen(); current_mode = mode; if ( isCreated() ) { destroyWindow(); // If mode is not fullscreen capable, make sure we are in windowed mode try { if ( was_fullscreen && !isFullscreen() ) display_impl.resetDisplayMode(); else if ( isFullscreen() ) switchDisplayMode(); createWindow(); makeCurrentAndSetSwapInterval(); } catch (LWJGLException e) { drawable.destroy(); display_impl.resetDisplayMode(); throw e; } } } } private static DisplayMode getEffectiveMode() { return !isFullscreen() && parent != null ? new DisplayMode(parent.getWidth(), parent.getHeight()) : current_mode; } private static int getWindowX() { if ( !isFullscreen() && parent == null ) { // if no display location set, center window if ( x == -1 ) { return Math.max(0, (initial_mode.getWidth() - current_mode.getWidth()) / 2); } else { return x; } } else { return 0; } } private static int getWindowY() { if ( !isFullscreen() && parent == null ) { // if no display location set, center window if ( y == -1 ) { return Math.max(0, (initial_mode.getHeight() - current_mode.getHeight()) / 2); } else { return y; } } else { return 0; } } /** * Create the native window peer from the given mode and fullscreen flag. * A native context must exist, and it will be attached to the window. */ private static void createWindow() throws LWJGLException { if ( window_created ) { return; } Canvas tmp_parent = isFullscreen() ? null : parent; if ( tmp_parent != null && !tmp_parent.isDisplayable() ) // Only a best effort check, since the parent can turn undisplayable hereafter throw new LWJGLException("Parent.isDisplayable() must be true"); if ( tmp_parent != null ) { tmp_parent.addComponentListener(component_listener); } DisplayMode mode = getEffectiveMode(); display_impl.createWindow(mode, tmp_parent, getWindowX(), getWindowY()); window_created = true; setTitle(title); initControls(); // set cached window icon if exists if ( cached_icons != null ) { setIcon(cached_icons); } else { setIcon(new ByteBuffer[] { LWJGLUtil.LWJGLIcon32x32, LWJGLUtil.LWJGLIcon16x16 }); } } private static void releaseDrawable() { try { Context context = drawable.context; if ( context != null && context.isCurrent() ) { Context.releaseCurrentContext(); context.releaseDrawable(); } } catch (LWJGLException e) { LWJGLUtil.log("Exception occurred while trying to release context: " + e); } } private static void destroyWindow() { if ( !window_created ) { return; } if ( parent != null ) { parent.removeComponentListener(component_listener); } releaseDrawable(); // Automatically destroy keyboard & mouse if ( Mouse.isCreated() ) { Mouse.destroy(); } if ( Keyboard.isCreated() ) { Keyboard.destroy(); } display_impl.destroyWindow(); window_created = false; } private static void switchDisplayMode() throws LWJGLException { if ( !current_mode.isFullscreenCapable() ) { throw new IllegalStateException("Only modes acquired from getAvailableDisplayModes() can be used for fullscreen display"); } display_impl.switchDisplayMode(current_mode); } /** * Set the display configuration to the specified gamma, brightness and contrast. * The configuration changes will be reset when destroy() is called. * * @param gamma The gamma value * @param brightness The brightness value between -1.0 and 1.0, inclusive * @param contrast The contrast, larger than 0.0. */ public static void setDisplayConfiguration(float gamma, float brightness, float contrast) throws LWJGLException { synchronized ( GlobalLock.lock ) { if ( !isCreated() ) { throw new LWJGLException("Display not yet created."); } if ( brightness < -1.0f || brightness > 1.0f ) throw new IllegalArgumentException("Invalid brightness value"); if ( contrast < 0.0f ) throw new IllegalArgumentException("Invalid contrast value"); int rampSize = display_impl.getGammaRampLength(); if ( rampSize == 0 ) { throw new LWJGLException("Display configuration not supported"); } FloatBuffer gammaRamp = BufferUtils.createFloatBuffer(rampSize); for ( int i = 0; i < rampSize; i++ ) { float intensity = (float)i / (rampSize - 1); // apply gamma float rampEntry = (float)java.lang.Math.pow(intensity, gamma); // apply brightness rampEntry += brightness; // apply contrast rampEntry = (rampEntry - 0.5f) * contrast + 0.5f; // Clamp entry to [0, 1] if ( rampEntry > 1.0f ) rampEntry = 1.0f; else if ( rampEntry < 0.0f ) rampEntry = 0.0f; gammaRamp.put(i, rampEntry); } display_impl.setGammaRamp(gammaRamp); LWJGLUtil.log("Gamma set, gamma = " + gamma + ", brightness = " + brightness + ", contrast = " + contrast); } } private static long timeLate; /** * Best sync method that works reliably. * * @param fps The desired frame rate, in frames per second */ public static void sync(int fps) { long timeNow; long gapTo; long savedTimeLate; synchronized ( GlobalLock.lock ) { gapTo = Sys.getTimerResolution() / fps + timeThen; timeNow = Sys.getTime(); savedTimeLate = timeLate; } try { while ( gapTo > timeNow + savedTimeLate ) { Thread.sleep(1); timeNow = Sys.getTime(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } synchronized ( GlobalLock.lock ) { if ( gapTo < timeNow ) timeLate = timeNow - gapTo; else timeLate = 0; timeThen = timeNow; } } /** @return the title of the window */ public static String getTitle() { synchronized ( GlobalLock.lock ) { return title; } } /** Return the last parent set with setParent(). */ public static Canvas getParent() { synchronized ( GlobalLock.lock ) { return parent; } } /** * Set the parent of the Display. If parent is null, the Display will appear as a top level window. * If parent is not null, the Display is made a child of the parent. A parent's isDisplayable() must be true when * setParent() is called and remain true until setParent() is called again with * null or a different parent. This generally means that the parent component must remain added to it's parent container.

      * It is not advisable to call this method from an AWT thread, since the context will be made current on the thread * and it is difficult to predict which AWT thread will process any given AWT event.

      * While the Display is in fullscreen mode, the current parent will be ignored. Additionally, when a non null parent is specified, * the Dispaly will inherit the size of the parent, disregarding the currently set display mode.

      */ public static void setParent(Canvas parent) throws LWJGLException { synchronized ( GlobalLock.lock ) { if ( Display.parent != parent ) { Display.parent = parent; if ( !isCreated() ) return; destroyWindow(); try { if ( isFullscreen() ) { switchDisplayMode(); } else { display_impl.resetDisplayMode(); } createWindow(); makeCurrentAndSetSwapInterval(); } catch (LWJGLException e) { drawable.destroy(); display_impl.resetDisplayMode(); throw e; } } } } /** * Set the fullscreen mode of the context. If no context has been created through create(), * the mode will apply when create() is called. If fullscreen is true, the context will become * a fullscreen context and the display mode is switched to the mode given by getDisplayMode(). If * fullscreen is false, the context will become a windowed context with the dimensions given in the * mode returned by getDisplayMode(). The native cursor position is also reset. * * @param fullscreen Specify the fullscreen mode of the context. * * @throws LWJGLException If fullscreen is true, and the current DisplayMode instance is not * from getAvailableDisplayModes() or if the mode switch fails. */ public static void setFullscreen(boolean fullscreen) throws LWJGLException { setDisplayModeAndFullscreenInternal(fullscreen, current_mode); } /** * Set the mode of the context. If no context has been created through create(), * the mode will apply when create() is called. If mode.isFullscreenCapable() is true, the context will become * a fullscreen context and the display mode is switched to the mode given by getDisplayMode(). If * mode.isFullscreenCapable() is false, the context will become a windowed context with the dimensions given in the * mode returned by getDisplayMode(). The native cursor position is also reset. * * @param mode The new display mode to set. Must be non-null. * * @throws LWJGLException If the mode switch fails. */ public static void setDisplayModeAndFullscreen(DisplayMode mode) throws LWJGLException { setDisplayModeAndFullscreenInternal(mode.isFullscreenCapable(), mode); } private static void setDisplayModeAndFullscreenInternal(boolean fullscreen, DisplayMode mode) throws LWJGLException { synchronized ( GlobalLock.lock ) { if ( mode == null ) throw new NullPointerException("mode must be non-null"); DisplayMode old_mode = current_mode; current_mode = mode; boolean was_fullscreen = isFullscreen(); Display.fullscreen = fullscreen; if ( was_fullscreen != isFullscreen() || !mode.equals(old_mode) ) { if ( !isCreated() ) return; destroyWindow(); try { if ( isFullscreen() ) { switchDisplayMode(); } else { display_impl.resetDisplayMode(); } createWindow(); makeCurrentAndSetSwapInterval(); } catch (LWJGLException e) { drawable.destroy(); display_impl.resetDisplayMode(); throw e; } } } } /** @return whether the Display is in fullscreen mode */ public static boolean isFullscreen() { synchronized ( GlobalLock.lock ) { return fullscreen && current_mode.isFullscreenCapable(); } } /** * Set the title of the window. This may be ignored by the underlying OS. * * @param newTitle The new window title */ public static void setTitle(String newTitle) { synchronized ( GlobalLock.lock ) { if ( newTitle == null ) { newTitle = ""; } title = newTitle; if ( isCreated() ) display_impl.setTitle(title); } } /** @return true if the user or operating system has asked the window to close */ public static boolean isCloseRequested() { synchronized ( GlobalLock.lock ) { if ( !isCreated() ) throw new IllegalStateException("Cannot determine close requested state of uncreated window"); return display_impl.isCloseRequested(); } } /** @return true if the window is visible, false if not */ public static boolean isVisible() { synchronized ( GlobalLock.lock ) { if ( !isCreated() ) throw new IllegalStateException("Cannot determine minimized state of uncreated window"); return display_impl.isVisible(); } } /** @return true if window is active, that is, the foreground display of the operating system. */ public static boolean isActive() { synchronized ( GlobalLock.lock ) { if ( !isCreated() ) throw new IllegalStateException("Cannot determine focused state of uncreated window"); return display_impl.isActive(); } } /** * Determine if the window's contents have been damaged by external events. * If you are writing a straightforward game rendering loop and simply paint * every frame regardless, you can ignore this flag altogether. If you are * trying to be kind to other processes you can check this flag and only * redraw when it returns true. The flag is cleared when update() or isDirty() is called. * * @return true if the window has been damaged by external changes * and needs to repaint itself */ public static boolean isDirty() { synchronized ( GlobalLock.lock ) { if ( !isCreated() ) throw new IllegalStateException("Cannot determine dirty state of uncreated window"); return display_impl.isDirty(); } } /** * Process operating system events. Call this to update the Display's state and to receive new * input device events. This method is called from update(), so it is not necessary to call * this method if update() is called periodically. */ public static void processMessages() { synchronized ( GlobalLock.lock ) { if ( !isCreated() ) throw new IllegalStateException("Display not created"); display_impl.update(); } pollDevices(); } /** * Swap the display buffers. This method is called from update(), and should normally not be called by * the application. * * @throws OpenGLException if an OpenGL error has occured since the last call to glGetError() */ public static void swapBuffers() throws LWJGLException { synchronized ( GlobalLock.lock ) { if ( !isCreated() ) throw new IllegalStateException("Display not created"); if ( LWJGLUtil.DEBUG ) Util.checkGLError(); Context.swapBuffers(); } } /** * Update the window. If the window is visible clears * the dirty flag and calls swapBuffers() and finally * polls the input devices. */ public static void update() { update(true); } /** * Update the window. If the window is visible clears * the dirty flag and calls swapBuffers() and finally * polls the input devices if processMessages is true. * * @param processMessages Poll input devices if true */ public static void update(boolean processMessages) { synchronized ( GlobalLock.lock ) { if ( !isCreated() ) throw new IllegalStateException("Display not created"); // We paint only when the window is visible or dirty if ( display_impl.isVisible() || display_impl.isDirty() ) { try { swapBuffers(); } catch (LWJGLException e) { throw new RuntimeException(e); } } if ( parent_resized ) { reshape(); parent_resized = false; } if ( processMessages ) processMessages(); } } static void pollDevices() { // Poll the input devices while we're here if ( Mouse.isCreated() ) { Mouse.poll(); Mouse.updateCursor(); } if ( Keyboard.isCreated() ) { Keyboard.poll(); } if ( Controllers.isCreated() ) { Controllers.poll(); } } /** * Release the Display context. * * @throws LWJGLException If the context could not be released */ public static void releaseContext() throws LWJGLException { drawable.releaseContext(); } /** Returns true if the Display's context is current in the current thread. */ public static boolean isCurrent() throws LWJGLException { return drawable.isCurrent(); } /** * Make the Display the current rendering context for GL calls. * * @throws LWJGLException If the context could not be made current */ public static void makeCurrent() throws LWJGLException { drawable.makeCurrent(); } private static void removeShutdownHook() { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { Runtime.getRuntime().removeShutdownHook(shutdown_hook); return null; } }); } private static void registerShutdownHook() { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { Runtime.getRuntime().addShutdownHook(shutdown_hook); return null; } }); } /** * Create the OpenGL context. If isFullscreen() is true or if windowed * context are not supported on the platform, the display mode will be switched to the mode returned by * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be * created with the given parameters, a LWJGLException will be thrown. *

      *

      The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates. * * @throws LWJGLException */ public static void create() throws LWJGLException { synchronized ( GlobalLock.lock ) { create(new PixelFormat()); } } /** * Create the OpenGL context with the given minimum parameters. If isFullscreen() is true or if windowed * context are not supported on the platform, the display mode will be switched to the mode returned by * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be * created with the given parameters, a LWJGLException will be thrown. *

      *

      The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates. * * @param pixel_format Describes the minimum specifications the context must fulfill. * * @throws LWJGLException */ public static void create(PixelFormat pixel_format) throws LWJGLException { synchronized ( GlobalLock.lock ) { create(pixel_format, null, null); } } /** * Create the OpenGL context with the given minimum parameters. If isFullscreen() is true or if windowed * context are not supported on the platform, the display mode will be switched to the mode returned by * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be * created with the given parameters, a LWJGLException will be thrown. *

      *

      The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates. * * @param pixel_format Describes the minimum specifications the context must fulfill. * @param shared_drawable The Drawable to share context with. (optional, may be null) * * @throws LWJGLException */ public static void create(PixelFormat pixel_format, Drawable shared_drawable) throws LWJGLException { synchronized ( GlobalLock.lock ) { create(pixel_format, shared_drawable, null); } } /** * Create the OpenGL context with the given minimum parameters. If isFullscreen() is true or if windowed * context are not supported on the platform, the display mode will be switched to the mode returned by * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be * created with the given parameters, a LWJGLException will be thrown. *

      *

      The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates. * * @param pixel_format Describes the minimum specifications the context must fulfill. * @param attribs The ContextAttribs to use when creating the context. (optional, may be null) * * @throws LWJGLException */ public static void create(PixelFormat pixel_format, ContextAttribs attribs) throws LWJGLException { synchronized ( GlobalLock.lock ) { create(pixel_format, null, attribs); } } /** * Create the OpenGL context with the given minimum parameters. If isFullscreen() is true or if windowed * context are not supported on the platform, the display mode will be switched to the mode returned by * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be * created with the given parameters, a LWJGLException will be thrown. *

      *

      The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates. * * @param pixel_format Describes the minimum specifications the context must fulfill. * @param shared_drawable The Drawable to share context with. (optional, may be null) * @param attribs The ContextAttribs to use when creating the context. (optional, may be null) * * @throws LWJGLException */ public static void create(PixelFormat pixel_format, Drawable shared_drawable, ContextAttribs attribs) throws LWJGLException { synchronized ( GlobalLock.lock ) { if ( isCreated() ) throw new IllegalStateException("Only one LWJGL context may be instantiated at any one time."); if ( pixel_format == null ) throw new NullPointerException("pixel_format cannot be null"); removeShutdownHook(); registerShutdownHook(); if ( isFullscreen() ) switchDisplayMode(); try { drawable.peer_info = display_impl.createPeerInfo(pixel_format); try { createWindow(); try { drawable.context = new Context(drawable.peer_info, attribs, shared_drawable != null ? ((AbstractDrawable)shared_drawable).getContext() : null); try { makeCurrentAndSetSwapInterval(); initContext(); } catch (LWJGLException e) { drawable.destroy(); throw e; } } catch (LWJGLException e) { destroyWindow(); throw e; } } catch (LWJGLException e) { drawable.destroy(); throw e; } } catch (LWJGLException e) { display_impl.resetDisplayMode(); throw e; } } } /** * Set the initial color of the Display. This method is called before the Display is created and will set the * background color to the one specified in this method. * * @param red - color value between 0 - 1 * @param green - color value between 0 - 1 * @param blue - color value between 0 - 1 */ public static void setInitialBackground(float red, float green, float blue) { r = red; g = green; b = blue; } private static void makeCurrentAndSetSwapInterval() throws LWJGLException { makeCurrent(); try { Util.checkGLError(); } catch (OpenGLException e) { LWJGLUtil.log("OpenGL error during context creation: " + e.getMessage()); } setSwapInterval(swap_interval); } private static void initContext() { // set background clear color glClearColor(r, g, b, 0.0f); // Clear window to avoid the desktop "showing through" glClear(GL_COLOR_BUFFER_BIT); update(); } static DisplayImplementation getImplementation() { return display_impl; } /** Gets a boolean property as a privileged action. */ static boolean getPrivilegedBoolean(final String property_name) { return AccessController.doPrivileged(new PrivilegedAction() { public Boolean run() { return Boolean.getBoolean(property_name); } }); } private static void initControls() { // Automatically create mouse, keyboard and controller if ( !getPrivilegedBoolean("org.lwjgl.opengl.Display.noinput") ) { if ( !Mouse.isCreated() && !getPrivilegedBoolean("org.lwjgl.opengl.Display.nomouse") ) { try { Mouse.create(); } catch (LWJGLException e) { if ( LWJGLUtil.DEBUG ) { e.printStackTrace(System.err); } else { LWJGLUtil.log("Failed to create Mouse: " + e); } } } if ( !Keyboard.isCreated() && !getPrivilegedBoolean("org.lwjgl.opengl.Display.nokeyboard") ) { try { Keyboard.create(); } catch (LWJGLException e) { if ( LWJGLUtil.DEBUG ) { e.printStackTrace(System.err); } else { LWJGLUtil.log("Failed to create Keyboard: " + e); } } } } } /** * Destroy the Display. After this call, there will be no current GL rendering context, * regardless of whether the Display was the current rendering context. */ public static void destroy() { drawable.destroy(); } /* * Reset display mode if fullscreen. This method is also called from the shutdown hook added * in the static constructor */ private static void reset() { display_impl.resetDisplayMode(); current_mode = initial_mode; } /** @return true if the window's native peer has been created */ public static boolean isCreated() { synchronized ( GlobalLock.lock ) { return window_created; } } /** * Set the buffer swap interval. This call is a best-attempt at changing * the monitor swap interval, which is the minimum periodicity of color buffer swaps, * measured in video frame periods, and is not guaranteed to be successful. *

      * A video frame period is the time required to display a full frame of video data. * * @param value The swap interval in frames, 0 to disable */ public static void setSwapInterval(int value) { synchronized ( GlobalLock.lock ) { swap_interval = value; if ( isCreated() ) Context.setSwapInterval(swap_interval); } } /** * Enable or disable vertical monitor synchronization. This call is a best-attempt at changing * the vertical refresh synchronization of the monitor, and is not guaranteed to be successful. * * @param sync true to synchronize; false to ignore synchronization */ public static void setVSyncEnabled(boolean sync) { synchronized ( GlobalLock.lock ) { setSwapInterval(sync ? 1 : 0); } } /** * Set the window's location. This is a no-op on fullscreen windows or when getParent() != null. * The window is clamped to remain entirely on the screen. If you attempt * to position the window such that it would extend off the screen, the window * is simply placed as close to the edge as possible. *
      noteIf no location has been specified (or x == y == -1) the window will be centered * * @param new_x The new window location on the x axis * @param new_y The new window location on the y axis */ public static void setLocation(int new_x, int new_y) { synchronized ( GlobalLock.lock ) { // cache position x = new_x; y = new_y; // offset if already created if ( isCreated() && !isFullscreen() ) { reshape(); } } } private static void reshape() { DisplayMode mode = getEffectiveMode(); display_impl.reshape(getWindowX(), getWindowY(), mode.getWidth(), mode.getHeight()); } /** * Get the driver adapter string. This is a unique string describing the actual card's hardware, eg. "Geforce2", "PS2", * "Radeon9700". If the adapter cannot be determined, this function returns null. * * @return a String */ public static String getAdapter() { synchronized ( GlobalLock.lock ) { return display_impl.getAdapter(); } } /** * Get the driver version. This is a vendor/adapter specific version string. If the version cannot be determined, * this function returns null. * * @return a String */ public static String getVersion() { synchronized ( GlobalLock.lock ) { return display_impl.getVersion(); } } /** * Sets one or more icons for the Display. *

        *
      • On Windows you should supply at least one 16x16 icon and one 32x32.
      • *
      • Linux (and similar platforms) expect one 32x32 icon.
      • *
      • Mac OS X should be supplied one 128x128 icon
      • *
      * The implementation will use the supplied ByteBuffers with image data in RGBA and perform any conversions nescesarry for the specific platform. *

      * NOTE: The display will make a deep copy of the supplied byte buffer array, for the purpose * of recreating the icons when you go back and forth fullscreen mode. You therefore only need to * set the icon once per instance. * * @param icons Array of icons in RGBA mode. Pass the icons in order of preference. * * @return number of icons used, or 0 if display hasn't been created */ public static int setIcon(ByteBuffer[] icons) { synchronized ( GlobalLock.lock ) { // make deep copy so we dont rely on the supplied buffers later on // don't recache! if ( cached_icons != icons ) { cached_icons = new ByteBuffer[icons.length]; for ( int i = 0; i < icons.length; i++ ) { cached_icons[i] = BufferUtils.createByteBuffer(icons[i].capacity()); int old_position = icons[i].position(); cached_icons[i].put(icons[i]); icons[i].position(old_position); cached_icons[i].flip(); } } if ( Display.isCreated() && parent == null ) { return display_impl.setIcon(cached_icons); } else { return 0; } } } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/Pbuffer.java0000644000175000017500000003013211543426510021056 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; /** *

      * Pbuffer encapsulates an OpenGL pbuffer. *

      * * This class is thread-safe. * * @author elias_naur * @version $Revision: 3334 $ * $Id: Pbuffer.java 3334 2010-04-22 23:21:48Z spasi $ */ public final class Pbuffer extends AbstractDrawable { /** * Indicates that Pbuffers can be created. */ public static final int PBUFFER_SUPPORTED = 1 << 0; /** * Indicates that Pbuffers can be used as render-textures. */ public static final int RENDER_TEXTURE_SUPPORTED = 1 << 1; /** * Indicates that Pbuffers can be used as non-power-of-two render-textures. */ public static final int RENDER_TEXTURE_RECTANGLE_SUPPORTED = 1 << 2; /** * Indicates that Pbuffers can be used as depth render-textures. */ public static final int RENDER_DEPTH_TEXTURE_SUPPORTED = 1 << 3; /** * The render-to-texture mipmap level attribute. */ public static final int MIPMAP_LEVEL = RenderTexture.WGL_MIPMAP_LEVEL_ARB; /** * The render-to-texture cube map face attribute. */ public static final int CUBE_MAP_FACE = RenderTexture.WGL_CUBE_MAP_FACE_ARB; /** * The render-to-texture cube map positive X face value. */ public static final int TEXTURE_CUBE_MAP_POSITIVE_X = RenderTexture.WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB; /** * The render-to-texture cube map negative X face value. */ public static final int TEXTURE_CUBE_MAP_NEGATIVE_X = RenderTexture.WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB; /** * The render-to-texture cube map positive Y face value. */ public static final int TEXTURE_CUBE_MAP_POSITIVE_Y = RenderTexture.WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB; /** * The render-to-texture cube map negative Y face value. */ public static final int TEXTURE_CUBE_MAP_NEGATIVE_Y = RenderTexture.WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB; /** * The render-to-texture cube map positive Z face value. */ public static final int TEXTURE_CUBE_MAP_POSITIVE_Z = RenderTexture.WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB; /** * The render-to-texture cube map negative Z face value. */ public static final int TEXTURE_CUBE_MAP_NEGATIVE_Z = RenderTexture.WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB; /** * The Pbuffer front left buffer. */ public static final int FRONT_LEFT_BUFFER = RenderTexture.WGL_FRONT_LEFT_ARB; /** * The Pbuffer front right buffer. */ public static final int FRONT_RIGHT_BUFFER = RenderTexture.WGL_FRONT_RIGHT_ARB; /** * The Pbuffer back left buffer. */ public static final int BACK_LEFT_BUFFER = RenderTexture.WGL_BACK_LEFT_ARB; /** * The Pbuffer back right buffer. */ public static final int BACK_RIGHT_BUFFER = RenderTexture.WGL_BACK_RIGHT_ARB; /** * The Pbuffer depth buffer. */ public static final int DEPTH_BUFFER = RenderTexture.WGL_DEPTH_COMPONENT_NV; /** * Width */ private final int width; /** * Height */ private final int height; static { Sys.initialize(); } /** * Create an instance of a Pbuffer with a unique OpenGL context. The buffer is single-buffered. *

      * NOTE: The Pbuffer will have its own context that shares display lists and textures with shared_context, * or, if shared_context is null, the Display context if it is created. The Pbuffer * will have its own OpenGL state. Therefore, state changes to a pbuffer will not be seen in the window context and vice versa. *

      * * @param width Pbuffer width * @param height Pbuffer height * @param pixel_format Minimum Pbuffer context properties * @param shared_drawable If non-null the Pbuffer will share display lists and textures with it. Otherwise, the Pbuffer will share * with the Display context (if created). */ public Pbuffer(int width, int height, PixelFormat pixel_format, Drawable shared_drawable) throws LWJGLException { this(width, height, pixel_format, null, shared_drawable); } /** * Create an instance of a Pbuffer with a unique OpenGL context. The buffer is single-buffered. *

      * NOTE: The Pbuffer will have its own context that shares display lists and textures with shared_context, * or, if shared_context is null, the Display context if it is created. The Pbuffer * will have its own OpenGL state. Therefore, state changes to a pbuffer will not be seen in the window context and vice versa. *

      * The renderTexture parameter defines the necessary state for enabling render-to-texture. When this parameter is null, * render-to-texture is not available. Before using render-to-texture, the Pbuffer capabilities must be queried to ensure that * it is supported. Currently only windows platform can support this feature, so it is recommended that EXT_framebuffer_object * or similar is used if available, for maximum portability. *

      * * @param width Pbuffer width * @param height Pbuffer height * @param pixel_format Minimum Pbuffer context properties * @param renderTexture * @param shared_drawable If non-null the Pbuffer will share display lists and textures with it. Otherwise, the Pbuffer will share * with the Display context (if created). */ public Pbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture, Drawable shared_drawable) throws LWJGLException { this(width, height, pixel_format, renderTexture, shared_drawable, null); } /** * Create an instance of a Pbuffer with a unique OpenGL context. The buffer is single-buffered. *

      * NOTE: The Pbuffer will have its own context that shares display lists and textures with shared_context, * or, if shared_context is null, the Display context if it is created. The Pbuffer * will have its own OpenGL state. Therefore, state changes to a pbuffer will not be seen in the window context and vice versa. *

      * The renderTexture parameter defines the necessary state for enabling render-to-texture. When this parameter is null, * render-to-texture is not available. Before using render-to-texture, the Pbuffer capabilities must be queried to ensure that * it is supported. Currently only windows platform can support this feature, so it is recommended that EXT_framebuffer_object * or similar is used if available, for maximum portability. *

      * * @param width Pbuffer width * @param height Pbuffer height * @param pixel_format Minimum Pbuffer context properties * @param renderTexture * @param shared_drawable If non-null the Pbuffer will share display lists and textures with it. Otherwise, the Pbuffer will share * with the Display context (if created). * @param attribs The ContextAttribs to use when creating the context. (optional, may be null) */ public Pbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture, Drawable shared_drawable, ContextAttribs attribs) throws LWJGLException { if (pixel_format == null) throw new NullPointerException("Pixel format must be non-null"); this.width = width; this.height = height; this.peer_info = createPbuffer(width, height, pixel_format, renderTexture); Context shared_context; if (shared_drawable != null) shared_context = ((DrawableLWJGL)shared_drawable).getContext(); else shared_context = ((DrawableLWJGL)Display.getDrawable()).getContext(); // May be null this.context = new Context(peer_info, attribs, shared_context); } private static PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture) throws LWJGLException { if ( renderTexture == null ) { // Though null is a perfectly valid argument, Matrox Parhelia drivers expect // a 0 terminated list, or else they crash. Supplying NULL or 0, should // cause the drivers to use default settings IntBuffer defaultAttribs = BufferUtils.createIntBuffer(1); return Display.getImplementation().createPbuffer(width, height, pixel_format, null, defaultAttribs); } else return Display.getImplementation().createPbuffer(width, height, pixel_format, renderTexture.pixelFormatCaps, renderTexture.pBufferAttribs); } /** * Method to test for validity of the buffer. If this function returns true, the buffer contents is lost. The buffer can still * be used, but the results are undefined. The application is expected to release the buffer if needed, destroy it and recreate * a new buffer. * * @return true if the buffer is lost and destroyed, false if the buffer is valid. */ public synchronized boolean isBufferLost() { checkDestroyed(); return Display.getImplementation().isBufferLost(peer_info); } /** * Gets the Pbuffer capabilities. * * @return a bitmask of Pbuffer capabilities. */ public static int getCapabilities() { return Display.getImplementation().getPbufferCapabilities(); } // ----------------------------------------------------------------------------------------- // ------------------------------- Render-to-Texture Methods ------------------------------- // ----------------------------------------------------------------------------------------- /** * Sets a render-to-texture attribute. *

      * The attrib parameter can be one of MIPMAP_LEVEL and CUBE_MAP_FACE. When the attrib parameter is CUBE_MAP_FACE then the value * parameter can be on of the following: *

      * TEXTURE_CUBE_MAP_POSITIVE_X TEXTURE_CUBE_MAP_NEGATIVE_X TEXTURE_CUBE_MAP_POSITIVE_Y TEXTURE_CUBE_MAP_NEGATIVE_Y * TEXTURE_CUBE_MAP_POSITIVE_Z TEXTURE_CUBE_MAP_NEGATIVE_Z * * @param attrib * @param value */ public synchronized void setAttrib(int attrib, int value) { checkDestroyed(); Display.getImplementation().setPbufferAttrib(peer_info, attrib, value); } /** * Binds the currently bound texture to the buffer specified. The buffer can be one of the following: *

      * FRONT_LEFT_BUFFER FRONT_RIGHT_BUFFER BACK_LEFT_BUFFER BACK_RIGHT_BUFFER DEPTH_BUFFER * * @param buffer */ public synchronized void bindTexImage(int buffer) { checkDestroyed(); Display.getImplementation().bindTexImageToPbuffer(peer_info, buffer); } /** * Releases the currently bound texture from the buffer specified. * * @param buffer */ public synchronized void releaseTexImage(int buffer) { checkDestroyed(); Display.getImplementation().releaseTexImageFromPbuffer(peer_info, buffer); } /** * @return Returns the height. */ public synchronized int getHeight() { checkDestroyed(); return height; } /** * @return Returns the width. */ public synchronized int getWidth() { checkDestroyed(); return width; } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/LinuxPbufferPeerInfo.java0000644000175000017500000000563111543426510023534 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; /** * * @author elias_naur * @version $Revision: 3116 $ * $Id: LinuxPbufferPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ */ final class LinuxPbufferPeerInfo extends LinuxPeerInfo { LinuxPbufferPeerInfo(int width, int height, PixelFormat pixel_format) throws LWJGLException { LinuxDisplay.lockAWT(); try { GLContext.loadOpenGLLibrary(); try { LinuxDisplay.incDisplay(); try { nInitHandle(LinuxDisplay.getDisplay(), LinuxDisplay.getDefaultScreen(), getHandle(), width, height, pixel_format); } catch (LWJGLException e) { LinuxDisplay.decDisplay(); throw e; } } catch (LWJGLException e) { GLContext.unloadOpenGLLibrary(); throw e; } } finally { LinuxDisplay.unlockAWT(); } } private static native void nInitHandle(long display, int screen, ByteBuffer handle, int width, int height, PixelFormat pixel_format) throws LWJGLException; public void destroy() { LinuxDisplay.lockAWT(); nDestroy(getHandle()); LinuxDisplay.decDisplay(); GLContext.unloadOpenGLLibrary(); LinuxDisplay.unlockAWT(); } private static native void nDestroy(ByteBuffer handle); protected void doLockAndInitHandle() throws LWJGLException { // NO-OP } protected void doUnlock() throws LWJGLException { // NO-OP } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/WindowsContextImplementation.java0000644000175000017500000001046311543426510025377 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import java.nio.ByteBuffer; import java.nio.IntBuffer; /** * @author elias_naur * @version $Revision: 3412 $ * $Id: WindowsContextImplementation.java 3412 2010-09-26 23:43:24Z spasi $ */ final class WindowsContextImplementation implements ContextImplementation { public ByteBuffer create(PeerInfo peer_info, IntBuffer attribs, ByteBuffer shared_context_handle) throws LWJGLException { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { return nCreate(peer_handle, attribs, shared_context_handle); } finally { peer_info.unlock(); } } private static native ByteBuffer nCreate(ByteBuffer peer_handle, IntBuffer attribs_handle, ByteBuffer shared_context_handle) throws LWJGLException; native long getHGLRC(ByteBuffer context_handle); native long getHDC(ByteBuffer peer_info_handle); public void swapBuffers() throws LWJGLException { Context current_context = Context.getCurrentContext(); if ( current_context == null ) throw new IllegalStateException("No context is current"); synchronized ( current_context ) { PeerInfo current_peer_info = current_context.getPeerInfo(); ByteBuffer peer_handle = current_peer_info.lockAndGetHandle(); try { nSwapBuffers(peer_handle); } finally { current_peer_info.unlock(); } } } private static native void nSwapBuffers(ByteBuffer peer_info_handle) throws LWJGLException; public void releaseDrawable(ByteBuffer context_handle) throws LWJGLException { } public void update(ByteBuffer context_handle) { } public void releaseCurrentContext() throws LWJGLException { nReleaseCurrentContext(); } private static native void nReleaseCurrentContext() throws LWJGLException; public void makeCurrent(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { nMakeCurrent(peer_handle, handle); } finally { peer_info.unlock(); } } private static native void nMakeCurrent(ByteBuffer peer_handle, ByteBuffer context_handle) throws LWJGLException; public boolean isCurrent(ByteBuffer handle) throws LWJGLException { boolean result = nIsCurrent(handle); return result; } private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException; public void setSwapInterval(int value) { boolean success = nSetSwapInterval(value); if ( !success ) LWJGLUtil.log("Failed to set swap interval"); Util.checkGLError(); } private static native boolean nSetSwapInterval(int value); public void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { nDestroy(handle); } private static native void nDestroy(ByteBuffer context_handle) throws LWJGLException; } lwjgl-2.7.1/src/java/org/lwjgl/opengl/SharedDrawable.java0000644000175000017500000000420711543426510022341 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.LWJGLException; /** * @author Spasi */ /** * A Drawable implementation that shares its context with another Drawable. This is useful * for background loading of resources. See org.lwjgl.test.opengl.multithread.BackgroundLoad * for an example. * * @author Spasi */ public final class SharedDrawable extends AbstractDrawable { public SharedDrawable(final Drawable drawable) throws LWJGLException { this.context = ((DrawableLWJGL)drawable).createSharedContext(); } public Context createSharedContext() { throw new UnsupportedOperationException(); } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/LinuxPeerInfo.java0000644000175000017500000000423111543426510022215 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; /** * * @author elias_naur * @version $Revision: 3116 $ * $Id: LinuxPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ */ abstract class LinuxPeerInfo extends PeerInfo { LinuxPeerInfo() { super(createHandle()); } private static native ByteBuffer createHandle(); public final long getDisplay() { return nGetDisplay(getHandle()); } private static native long nGetDisplay(ByteBuffer handle); public final long getDrawable() { return nGetDrawable(getHandle()); } private static native long nGetDrawable(ByteBuffer handle); } lwjgl-2.7.1/src/java/org/lwjgl/opengl/FastIntMap.java0000644000175000017500000001261311543426510021477 0ustar zero79zero79/* * Copyright 2002-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the * License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ package org.lwjgl.opengl; import java.util.Iterator; /** * A hash map using primitive ints as keys rather than objects. * * @author Justin Couch * @author Alex Chaffee (alex@apache.org) * @author Stephen Colebourne * @author Nathan Sweet */ final class FastIntMap implements Iterable> { private Entry[] table; private int size, mask, capacity, threshold; /** Same as: FastIntMap(16, 0.75f); */ FastIntMap() { this(16, 0.75f); } /** Same as: FastIntMap(initialCapacity, 0.75f); */ FastIntMap(int initialCapacity) { this(initialCapacity, 0.75f); } FastIntMap(int initialCapacity, float loadFactor) { if ( initialCapacity > 1 << 30 ) throw new IllegalArgumentException("initialCapacity is too large."); if ( initialCapacity < 0 ) throw new IllegalArgumentException("initialCapacity must be greater than zero."); if ( loadFactor <= 0 ) throw new IllegalArgumentException("initialCapacity must be greater than zero."); capacity = 1; while ( capacity < initialCapacity ) capacity <<= 1; this.threshold = (int)(capacity * loadFactor); this.table = new Entry[capacity]; this.mask = capacity - 1; } private int index(final int key) { return index(key, mask); } private static int index(final int key, final int mask) { return key & mask; } public V put(int key, V value) { final Entry[] table = this.table; int index = index(key); // Check if key already exists. for ( Entry e = table[index]; e != null; e = e.next ) { if ( e.key != key ) continue; V oldValue = e.value; e.value = value; return oldValue; } table[index] = new Entry(key, value, table[index]); if ( size++ >= threshold ) rehash(table); return null; } private void rehash(final Entry[] table) { final int newCapacity = 2 * capacity; final int newMask = newCapacity - 1; final Entry[] newTable = new Entry[newCapacity]; for ( int i = 0, index; i < table.length; i++ ) { Entry e = table[i]; if ( e == null ) continue; do { final Entry next = e.next; index = index(e.key, newMask); e.next = newTable[index]; newTable[index] = e; e = next; } while ( e != null ); } this.table = newTable; capacity = newCapacity; mask = newMask; threshold *= 2; } public V get(int key) { final int index = index(key); for ( Entry e = table[index]; e != null; e = e.next ) if ( e.key == key ) return e.value; return null; } public boolean containsValue(Object value) { final Entry[] table = this.table; for ( int i = table.length - 1; i >= 0; i-- ) for ( Entry e = table[i]; e != null; e = e.next ) if ( e.value.equals(value) ) return true; return false; } public boolean containsKey(int key) { final int index = index(key); for ( Entry e = table[index]; e != null; e = e.next ) if ( e.key == key ) return true; return false; } public V remove(int key) { final int index = index(key); Entry prev = table[index]; Entry e = prev; while ( e != null ) { Entry next = e.next; if ( e.key == key ) { size--; if ( prev == e ) table[index] = next; else prev.next = next; return e.value; } prev = e; e = next; } return null; } public int size() { return size; } public boolean isEmpty() { return size == 0; } public void clear() { final Entry[] table = this.table; for ( int index = table.length - 1; index >= 0; index-- ) table[index] = null; size = 0; } public EntryIterator iterator() { return new EntryIterator(); } public class EntryIterator implements Iterator> { private int nextIndex; private Entry current; EntryIterator() { reset(); } public void reset() { current = null; // Find first bucket. final Entry[] table = FastIntMap.this.table; int i; for ( i = table.length - 1; i >= 0; i-- ) if ( table[i] != null ) break; nextIndex = i; } public boolean hasNext() { if ( nextIndex >= 0 ) return true; Entry e = current; return e != null && e.next != null; } public Entry next() { // Next entry in current bucket. Entry e = current; if ( e != null ) { e = e.next; if ( e != null ) { current = e; return e; } } // Use the bucket at nextIndex and find the next nextIndex. final Entry[] table = FastIntMap.this.table; int i = nextIndex; e = current = table[i]; while ( --i >= 0 ) if ( table[i] != null ) break; nextIndex = i; return e; } public void remove() { FastIntMap.this.remove(current.key); } } static final class Entry { final int key; T value; Entry next; Entry(int key, T value, Entry next) { this.key = key; this.value = value; this.next = next; } public int getKey() { return key; } public T getValue() { return value; } } }lwjgl-2.7.1/src/java/org/lwjgl/opengl/MacOSXAWTGLCanvasPeerInfo.java0000644000175000017500000000425011543426510024144 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.LWJGLException; import java.awt.Canvas; /** * * @author elias_naur * @version $Revision: 3116 $ * $Id: MacOSXAWTGLCanvasPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ */ final class MacOSXAWTGLCanvasPeerInfo extends MacOSXCanvasPeerInfo { private final Canvas component; MacOSXAWTGLCanvasPeerInfo(Canvas component, PixelFormat pixel_format, boolean support_pbuffer) throws LWJGLException { super(pixel_format, support_pbuffer); this.component = component; } protected void doLockAndInitHandle() throws LWJGLException { initHandle(component); } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/CallbackUtil.java0000644000175000017500000001217211543426510022023 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.util.HashMap; import java.util.Map; /** * Utility class that handles OpenGL API callbacks. * * @author Spasi */ final class CallbackUtil { /** Context -> Long */ private static final Map contextUserParamsARB = new HashMap(); /** Context -> Long */ private static final Map contextUserParamsAMD = new HashMap(); private CallbackUtil() {} /** * Creates a new global reference to the specified Object. * * @param obj the Object * * @return the GlobalRef memory address or 0 if the Object is null. */ static long createGlobalRef(final Object obj) { return obj == null ? 0 : ncreateGlobalRef(obj); } /** * Creates a new global reference to the specified Object. * * @param obj the Object * * @return the GlobalRef memory address. */ private static native long ncreateGlobalRef(Object obj); /** * Deletes a global reference. * * @param ref the GlobalRef memory address. */ private static native void deleteGlobalRef(long ref); // --------- [ XXX_debug_output ] --------- /** * Associates the current OpenGL context with the specified global reference. If there * is no context current, the global reference is deleted and an exception is thrown. * Any previous callback registrations will be cleared. * * @param userParam the global reference pointer */ private static void registerContextCallback(final long userParam, final Map contextUserData) { Context context = Context.getCurrentContext(); if ( context == null ) { deleteGlobalRef(userParam); throw new IllegalStateException("No context is current."); } final Long userParam_old = contextUserData.remove(context); if ( userParam_old != null ) deleteGlobalRef(userParam_old); if ( userParam != 0 ) contextUserData.put(context, userParam); } /** * Releases references to any callbacks associated with the specified GL context. * * @param context the Context to unregister */ static void unregisterCallbacks(final Context context) { Long userParam = contextUserParamsARB.remove(context); if ( userParam != null ) deleteGlobalRef(userParam); userParam = contextUserParamsAMD.remove(context); if ( userParam != null ) deleteGlobalRef(userParam); } // --------- [ ARB_debug_output ] --------- /** * Returns the memory address of the native function we pass to glDebugMessageCallbackARB. * * @return the callback function address */ static native long getDebugOutputCallbackARB(); /** * Associates the current OpenGL context with the specified global reference. If there * is no context current, the global reference is deleted and an exception is thrown. * Any previous callback registrations will be cleared. * * @param userParam the global reference pointer */ static void registerContextCallbackARB(final long userParam) { registerContextCallback(userParam, contextUserParamsARB); } // --------- [ AMD_debug_output ] --------- /** * Returns the memory address of the native function we pass to glDebugMessageCallbackAMD. * * @return the callback function address */ static native long getDebugOutputCallbackAMD(); /** * Associates the current OpenGL context with the specified global reference. If there * is no context current, the global reference is deleted and an exception is thrown. * Any previous callback registrations will be cleared. * * @param userParam the global reference pointer */ static void registerContextCallbackAMD(final long userParam) { registerContextCallback(userParam, contextUserParamsAMD); } }lwjgl-2.7.1/src/java/org/lwjgl/opengl/WindowsDisplayPeerInfo.java0000644000175000017500000000476411543426510024111 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; /** * * @author elias_naur * @version $Revision: 3116 $ * $Id: WindowsDisplayPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ */ final class WindowsDisplayPeerInfo extends WindowsPeerInfo { private final PixelFormat pixel_format; WindowsDisplayPeerInfo(PixelFormat pixel_format) throws LWJGLException { this.pixel_format = pixel_format; GLContext.loadOpenGLLibrary(); } PixelFormat getPixelFormat() { return pixel_format; } void initDC(long hwnd, long hdc) throws LWJGLException { nInitDC(getHandle(), hwnd, hdc); } private static native void nInitDC(ByteBuffer peer_info_handle, long hwnd, long hdc); protected void doLockAndInitHandle() throws LWJGLException { // NO-OP } protected void doUnlock() throws LWJGLException { // NO-OP } public void destroy() { super.destroy(); GLContext.unloadOpenGLLibrary(); } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java0000644000175000017500000000673611543426510023614 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * An AWT implementation of a LWJGL compatible Mouse event queue. * @author elias_naur */ import java.awt.Component; import java.awt.Point; import java.awt.Rectangle; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; final class MacOSXMouseEventQueue extends MouseEventQueue { private final IntBuffer delta_buffer = BufferUtils.createIntBuffer(2); private boolean skip_event; private static boolean is_grabbed; MacOSXMouseEventQueue(Component component) { super(component); } public void setGrabbed(boolean grab) { if (is_grabbed != grab) { super.setGrabbed(grab); warpCursor(); grabMouse(grab); } } private static synchronized void grabMouse(boolean grab) { is_grabbed = grab; if (!grab) nGrabMouse(grab); } protected void resetCursorToCenter() { super.resetCursorToCenter(); /* Clear accumulated deltas */ getMouseDeltas(delta_buffer); } protected void updateDeltas(long nanos) { super.updateDeltas(nanos); synchronized ( this ) { getMouseDeltas(delta_buffer); int dx = delta_buffer.get(0); int dy = -delta_buffer.get(1); if (skip_event) { skip_event = false; nGrabMouse(isGrabbed()); return; } if ( dx != 0 || dy != 0 ) { putMouseEventWithCoords((byte)-1, (byte)0, dx, dy, 0, nanos); addDelta(dx, dy); } } } void warpCursor() { synchronized (this) { // If we're going to warp the cursor position, we'll skip the next event to avoid bogus delta values skip_event = isGrabbed(); } /* if (isGrabbed()) { Rectangle bounds = getComponent().getBounds(); Point location_on_screen = getComponent().getLocationOnScreen(); int x = location_on_screen.x + bounds.width/2; int y = location_on_screen.y + bounds.height/2; nWarpCursor(x, y); }*/ } private static native void getMouseDeltas(IntBuffer delta_buffer); private static native void nWarpCursor(int x, int y); static native void nGrabMouse(boolean grab); } lwjgl-2.7.1/src/java/org/lwjgl/opengl/GlobalLock.java0000644000175000017500000000335211543426510021502 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * This class contains the global lock that LWJGL will use to * synchronize access to Display. */ final class GlobalLock { static final Object lock = new Object(); } lwjgl-2.7.1/src/java/org/lwjgl/opengl/LinuxKeycodes.java0000644000175000017500000010271011543426510022255 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * @author elias_naur */ import org.lwjgl.input.Keyboard; final class LinuxKeycodes { public static final int XK_Kanji = 0xff21; public static final int XK_ISO_Left_Tab = 0xfe20; public static final int XK_dead_grave = 0xfe50; public static final int XK_dead_acute = 0xfe51; public static final int XK_dead_circumflex = 0xfe52; public static final int XK_dead_tilde = 0xfe53; public static final int XK_dead_macron = 0xfe54; public static final int XK_dead_breve = 0xfe55; public static final int XK_dead_abovedot = 0xfe56; public static final int XK_dead_diaeresis = 0xfe57; public static final int XK_dead_abovering = 0xfe58; public static final int XK_dead_doubleacute = 0xfe59; public static final int XK_dead_caron = 0xfe5a; public static final int XK_dead_cedilla = 0xfe5b; public static final int XK_dead_ogonek = 0xfe5c; public static final int XK_dead_iota = 0xfe5d; public static final int XK_dead_voiced_sound = 0xfe5e; public static final int XK_dead_semivoiced_sound = 0xfe5f; public static final int XK_dead_belowdot = 0xfe60; public static final int XK_dead_hook = 0xfe61; public static final int XK_dead_horn = 0xfe62; public static final int XK_BackSpace = 0xff08; public static final int XK_Tab = 0xff09; public static final int XK_Linefeed = 0xff0a; public static final int XK_Clear = 0xff0b; public static final int XK_Return = 0xff0d; public static final int XK_Pause = 0xff13; public static final int XK_Scroll_Lock = 0xff14; public static final int XK_Sys_Req = 0xff15; public static final int XK_Escape = 0xff1b; public static final int XK_Delete = 0xffff; public static final int XK_Home = 0xff50; public static final int XK_Left = 0xff51; public static final int XK_Up = 0xff52; public static final int XK_Right = 0xff53; public static final int XK_Down = 0xff54; public static final int XK_Prior = 0xff55; public static final int XK_Page_Up = 0xff55; public static final int XK_Next = 0xff56; public static final int XK_Page_Down = 0xff56; public static final int XK_End = 0xff57; public static final int XK_Begin = 0xff58; /* Misc functions */ public static final int XK_Select = 0xff60; public static final int XK_Print = 0xff61; public static final int XK_Execute = 0xff62; public static final int XK_Insert = 0xff63; public static final int XK_Undo = 0xff65; public static final int XK_Redo = 0xff66; public static final int XK_Menu = 0xff67; public static final int XK_Find = 0xff68; public static final int XK_Cancel = 0xff69; public static final int XK_Help = 0xff6a; public static final int XK_Break = 0xff6b; public static final int XK_Mode_switch = 0xff7e; public static final int XK_script_switch = 0xff7e; public static final int XK_Num_Lock = 0xff7f; /* Keypad functions, keypad numbers cleverly chosen to map to ASCII */ public static final int XK_KP_Space = 0xff80; public static final int XK_KP_Tab = 0xff89; public static final int XK_KP_Enter = 0xff8d; public static final int XK_KP_F1 = 0xff91; public static final int XK_KP_F2 = 0xff92; public static final int XK_KP_F3 = 0xff93; public static final int XK_KP_F4 = 0xff94; public static final int XK_KP_Home = 0xff95; public static final int XK_KP_Left = 0xff96; public static final int XK_KP_Up = 0xff97; public static final int XK_KP_Right = 0xff98; public static final int XK_KP_Down = 0xff99; public static final int XK_KP_Prior = 0xff9a; public static final int XK_KP_Page_Up = 0xff9a; public static final int XK_KP_Next = 0xff9b; public static final int XK_KP_Page_Down = 0xff9b; public static final int XK_KP_End = 0xff9c; public static final int XK_KP_Begin = 0xff9d; public static final int XK_KP_Insert = 0xff9e; public static final int XK_KP_Delete = 0xff9f; public static final int XK_KP_Equal = 0xffbd; public static final int XK_KP_Multiply = 0xffaa; public static final int XK_KP_Add = 0xffab; public static final int XK_KP_Separator = 0xffac; public static final int XK_KP_Subtract = 0xffad; public static final int XK_KP_Decimal = 0xffae; public static final int XK_KP_Divide = 0xffaf; public static final int XK_KP_0 = 0xffb0; public static final int XK_KP_1 = 0xffb1; public static final int XK_KP_2 = 0xffb2; public static final int XK_KP_3 = 0xffb3; public static final int XK_KP_4 = 0xffb4; public static final int XK_KP_5 = 0xffb5; public static final int XK_KP_6 = 0xffb6; public static final int XK_KP_7 = 0xffb7; public static final int XK_KP_8 = 0xffb8; public static final int XK_KP_9 = 0xffb9; /* * Auxilliary functions; note the duplicate definitions for left and right * function keys; Sun keyboards and a few other manufactures have such * function key groups on the left and/or right sides of the keyboard. * We've not found a keyboard with more than 35 function keys total. */ public static final int XK_F1 = 0xffbe; public static final int XK_F2 = 0xffbf; public static final int XK_F3 = 0xffc0; public static final int XK_F4 = 0xffc1; public static final int XK_F5 = 0xffc2; public static final int XK_F6 = 0xffc3; public static final int XK_F7 = 0xffc4; public static final int XK_F8 = 0xffc5; public static final int XK_F9 = 0xffc6; public static final int XK_F10 = 0xffc7; public static final int XK_F11 = 0xffc8; public static final int XK_L1 = 0xffc8; public static final int XK_F12 = 0xffc9; public static final int XK_L2 = 0xffc9; public static final int XK_F13 = 0xffca; public static final int XK_L3 = 0xffca; public static final int XK_F14 = 0xffcb; public static final int XK_L4 = 0xffcb; public static final int XK_F15 = 0xffcc; public static final int XK_L5 = 0xffcc; public static final int XK_F16 = 0xffcd; public static final int XK_L6 = 0xffcd; public static final int XK_F17 = 0xffce; public static final int XK_L7 = 0xffce; public static final int XK_F18 = 0xffcf; public static final int XK_L8 = 0xffcf; public static final int XK_F19 = 0xffd0; public static final int XK_L9 = 0xffd0; public static final int XK_F20 = 0xffd1; public static final int XK_L10 = 0xffd1; public static final int XK_F21 = 0xffd2; public static final int XK_R1 = 0xffd2; public static final int XK_F22 = 0xffd3; public static final int XK_R2 = 0xffd3; public static final int XK_F23 = 0xffd4; public static final int XK_R3 = 0xffd4; public static final int XK_F24 = 0xffd5; public static final int XK_R4 = 0xffd5; public static final int XK_F25 = 0xffd6; public static final int XK_R5 = 0xffd6; public static final int XK_F26 = 0xffd7; public static final int XK_R6 = 0xffd7; public static final int XK_F27 = 0xffd8; public static final int XK_R7 = 0xffd8; public static final int XK_F28 = 0xffd9; public static final int XK_R8 = 0xffd9; public static final int XK_F29 = 0xffda; public static final int XK_R9 = 0xffda; public static final int XK_F30 = 0xffdb; public static final int XK_R10 = 0xffdb; public static final int XK_F31 = 0xffdc; public static final int XK_R11 = 0xffdc; public static final int XK_F32 = 0xffdd; public static final int XK_R12 = 0xffdd; public static final int XK_F33 = 0xffde; public static final int XK_R13 = 0xffde; public static final int XK_F34 = 0xffdf; public static final int XK_R14 = 0xffdf; public static final int XK_F35 = 0xffe0; public static final int XK_R15 = 0xffe0; /* Modifiers */ public static final int XK_Shift_L = 0xffe1; public static final int XK_Shift_R = 0xffe2; public static final int XK_Control_L = 0xffe3; public static final int XK_Control_R = 0xffe4; public static final int XK_Caps_Lock = 0xffe5; public static final int XK_Shift_Lock = 0xffe6; public static final int XK_Meta_L = 0xffe7; public static final int XK_Meta_R = 0xffe8; public static final int XK_Alt_L = 0xffe9; public static final int XK_Alt_R = 0xffea; public static final int XK_Super_L = 0xffeb; public static final int XK_Super_R = 0xffec; public static final int XK_Hyper_L = 0xffed; public static final int XK_Hyper_R = 0xffee; public static final int XK_space = 0x0020; public static final int XK_exclam = 0x0021; public static final int XK_quotedbl = 0x0022; public static final int XK_numbersign = 0x0023; public static final int XK_dollar = 0x0024; public static final int XK_percent = 0x0025; public static final int XK_ampersand = 0x0026; public static final int XK_apostrophe = 0x0027; public static final int XK_quoteright = 0x0027; public static final int XK_parenleft = 0x0028; public static final int XK_parenright = 0x0029; public static final int XK_asterisk = 0x002a; public static final int XK_plus = 0x002b; public static final int XK_comma = 0x002c; public static final int XK_minus = 0x002d; public static final int XK_period = 0x002e; public static final int XK_slash = 0x002f; public static final int XK_0 = 0x0030; public static final int XK_1 = 0x0031; public static final int XK_2 = 0x0032; public static final int XK_3 = 0x0033; public static final int XK_4 = 0x0034; public static final int XK_5 = 0x0035; public static final int XK_6 = 0x0036; public static final int XK_7 = 0x0037; public static final int XK_8 = 0x0038; public static final int XK_9 = 0x0039; public static final int XK_colon = 0x003a; public static final int XK_semicolon = 0x003b; public static final int XK_less = 0x003c; public static final int XK_equal = 0x003d; public static final int XK_greater = 0x003e; public static final int XK_question = 0x003f; public static final int XK_at = 0x0040; public static final int XK_A = 0x0041; public static final int XK_B = 0x0042; public static final int XK_C = 0x0043; public static final int XK_D = 0x0044; public static final int XK_E = 0x0045; public static final int XK_F = 0x0046; public static final int XK_G = 0x0047; public static final int XK_H = 0x0048; public static final int XK_I = 0x0049; public static final int XK_J = 0x004a; public static final int XK_K = 0x004b; public static final int XK_L = 0x004c; public static final int XK_M = 0x004d; public static final int XK_N = 0x004e; public static final int XK_O = 0x004f; public static final int XK_P = 0x0050; public static final int XK_Q = 0x0051; public static final int XK_R = 0x0052; public static final int XK_S = 0x0053; public static final int XK_T = 0x0054; public static final int XK_U = 0x0055; public static final int XK_V = 0x0056; public static final int XK_W = 0x0057; public static final int XK_X = 0x0058; public static final int XK_Y = 0x0059; public static final int XK_Z = 0x005a; public static final int XK_bracketleft = 0x005b; public static final int XK_backslash = 0x005c; public static final int XK_bracketright = 0x005d; public static final int XK_asciicircum = 0x005e; public static final int XK_underscore = 0x005f; public static final int XK_grave = 0x0060; public static final int XK_quoteleft = 0x0060; public static final int XK_a = 0x0061; public static final int XK_b = 0x0062; public static final int XK_c = 0x0063; public static final int XK_d = 0x0064; public static final int XK_e = 0x0065; public static final int XK_f = 0x0066; public static final int XK_g = 0x0067; public static final int XK_h = 0x0068; public static final int XK_i = 0x0069; public static final int XK_j = 0x006a; public static final int XK_k = 0x006b; public static final int XK_l = 0x006c; public static final int XK_m = 0x006d; public static final int XK_n = 0x006e; public static final int XK_o = 0x006f; public static final int XK_p = 0x0070; public static final int XK_q = 0x0071; public static final int XK_r = 0x0072; public static final int XK_s = 0x0073; public static final int XK_t = 0x0074; public static final int XK_u = 0x0075; public static final int XK_v = 0x0076; public static final int XK_w = 0x0077; public static final int XK_x = 0x0078; public static final int XK_y = 0x0079; public static final int XK_z = 0x007a; public static final int XK_braceleft = 0x007b; public static final int XK_bar = 0x007c; public static final int XK_braceright = 0x007d; public static final int XK_asciitilde = 0x007e; public static final int XK_nobreakspace = 0x00a0; public static final int XK_exclamdown = 0x00a1; public static final int XK_cent = 0x00a2; public static final int XK_sterling = 0x00a3; public static final int XK_currency = 0x00a4; public static final int XK_yen = 0x00a5; public static final int XK_brokenbar = 0x00a6; public static final int XK_section = 0x00a7; public static final int XK_diaeresis = 0x00a8; public static final int XK_copyright = 0x00a9; public static final int XK_ordfeminine = 0x00aa; public static final int XK_guillemotleft = 0x00ab; public static final int XK_notsign = 0x00ac; public static final int XK_hyphen = 0x00ad; public static final int XK_registered = 0x00ae; public static final int XK_macron = 0x00af; public static final int XK_degree = 0x00b0; public static final int XK_plusminus = 0x00b1; public static final int XK_twosuperior = 0x00b2; public static final int XK_threesuperior = 0x00b3; public static final int XK_acute = 0x00b4; public static final int XK_mu = 0x00b5; public static final int XK_paragraph = 0x00b6; public static final int XK_periodcentered = 0x00b7; public static final int XK_cedilla = 0x00b8; public static final int XK_onesuperior = 0x00b9; public static final int XK_masculine = 0x00ba; public static final int XK_guillemotright = 0x00bb; public static final int XK_onequarter = 0x00bc; public static final int XK_onehalf = 0x00bd; public static final int XK_threequarters = 0x00be; public static final int XK_questiondown = 0x00bf; public static final int XK_Agrave = 0x00c0; public static final int XK_Aacute = 0x00c1; public static final int XK_Acircumflex = 0x00c2; public static final int XK_Atilde = 0x00c3; public static final int XK_Adiaeresis = 0x00c4; public static final int XK_Aring = 0x00c5; public static final int XK_AE = 0x00c6; public static final int XK_Ccedilla = 0x00c7; public static final int XK_Egrave = 0x00c8; public static final int XK_Eacute = 0x00c9; public static final int XK_Ecircumflex = 0x00ca; public static final int XK_Ediaeresis = 0x00cb; public static final int XK_Igrave = 0x00cc; public static final int XK_Iacute = 0x00cd; public static final int XK_Icircumflex = 0x00ce; public static final int XK_Idiaeresis = 0x00cf; public static final int XK_ETH = 0x00d0; public static final int XK_Eth = 0x00d0; public static final int XK_Ntilde = 0x00d1; public static final int XK_Ograve = 0x00d2; public static final int XK_Oacute = 0x00d3; public static final int XK_Ocircumflex = 0x00d4; public static final int XK_Otilde = 0x00d5; public static final int XK_Odiaeresis = 0x00d6; public static final int XK_multiply = 0x00d7; public static final int XK_Oslash = 0x00d8; public static final int XK_Ooblique = 0x00d8; public static final int XK_Ugrave = 0x00d9; public static final int XK_Uacute = 0x00da; public static final int XK_Ucircumflex = 0x00db; public static final int XK_Udiaeresis = 0x00dc; public static final int XK_Yacute = 0x00dd; public static final int XK_THORN = 0x00de; public static final int XK_Thorn = 0x00de; public static final int XK_ssharp = 0x00df; public static final int XK_agrave = 0x00e0; public static final int XK_aacute = 0x00e1; public static final int XK_acircumflex = 0x00e2; public static final int XK_atilde = 0x00e3; public static final int XK_adiaeresis = 0x00e4; public static final int XK_aring = 0x00e5; public static final int XK_ae = 0x00e6; public static final int XK_ccedilla = 0x00e7; public static final int XK_egrave = 0x00e8; public static final int XK_eacute = 0x00e9; public static final int XK_ecircumflex = 0x00ea; public static final int XK_ediaeresis = 0x00eb; public static final int XK_igrave = 0x00ec; public static final int XK_iacute = 0x00ed; public static final int XK_icircumflex = 0x00ee; public static final int XK_idiaeresis = 0x00ef; public static final int XK_eth = 0x00f0; public static final int XK_ntilde = 0x00f1; public static final int XK_ograve = 0x00f2; public static final int XK_oacute = 0x00f3; public static final int XK_ocircumflex = 0x00f4; public static final int XK_otilde = 0x00f5; public static final int XK_odiaeresis = 0x00f6; public static final int XK_division = 0x00f7; public static final int XK_oslash = 0x00f8; public static final int XK_ooblique = 0x00f8; public static final int XK_ugrave = 0x00f9; public static final int XK_uacute = 0x00fa; public static final int XK_ucircumflex = 0x00fb; public static final int XK_udiaeresis = 0x00fc; public static final int XK_yacute = 0x00fd; public static final int XK_thorn = 0x00fe; public static final int XK_ydiaeresis = 0x00ff; public static final int XK_ISO_Level3_Shift = 0xfe03; public static int mapKeySymToLWJGLKeyCode(long keysym) { switch ((int)keysym) { case XK_BackSpace: return Keyboard.KEY_BACK; case XK_ISO_Left_Tab: case XK_Tab: return Keyboard.KEY_TAB; case XK_Return: return Keyboard.KEY_RETURN; case XK_Pause: return Keyboard.KEY_PAUSE; case XK_Scroll_Lock: return Keyboard.KEY_SCROLL; case XK_Sys_Req: return Keyboard.KEY_SYSRQ; case XK_Escape: return Keyboard.KEY_ESCAPE; case XK_Delete: return Keyboard.KEY_DELETE; /* Japanese keyboard support */ case XK_Kanji: return Keyboard.KEY_KANJI; /* Cursor control & motion */ case XK_Home: return Keyboard.KEY_HOME; case XK_Left: return Keyboard.KEY_LEFT; case XK_Up: return Keyboard.KEY_UP; case XK_Right: return Keyboard.KEY_RIGHT; case XK_Down: return Keyboard.KEY_DOWN; case XK_Page_Up: return Keyboard.KEY_PRIOR; case XK_Page_Down: return Keyboard.KEY_NEXT; case XK_End: return Keyboard.KEY_END; /* Misc Functions */ case XK_Break: return Keyboard.KEY_PAUSE; case XK_Insert: return Keyboard.KEY_INSERT; case XK_Num_Lock: return Keyboard.KEY_NUMLOCK; /* Keypad Functions, keypad numbers cleverly chosen to map to ascii */ case XK_KP_Space: return Keyboard.KEY_SPACE; case XK_KP_Tab: return Keyboard.KEY_TAB; case XK_KP_Enter: return Keyboard.KEY_NUMPADENTER; case XK_KP_F1: return Keyboard.KEY_F1; case XK_KP_F2: return Keyboard.KEY_F2; case XK_KP_F3: return Keyboard.KEY_F3; case XK_KP_F4: return Keyboard.KEY_F4; case XK_KP_Home: return Keyboard.KEY_HOME; case XK_KP_Left: return Keyboard.KEY_LEFT; case XK_KP_Up: return Keyboard.KEY_UP; case XK_KP_Right: return Keyboard.KEY_RIGHT; case XK_KP_Down: return Keyboard.KEY_DOWN; case XK_KP_Page_Up: return Keyboard.KEY_PRIOR; case XK_KP_Page_Down: return Keyboard.KEY_NEXT; case XK_KP_End: return Keyboard.KEY_END; case XK_KP_Insert: return Keyboard.KEY_INSERT; case XK_KP_Delete: return Keyboard.KEY_DELETE; case XK_KP_Equal: return Keyboard.KEY_NUMPADEQUALS; case XK_KP_Multiply: return Keyboard.KEY_MULTIPLY; case XK_KP_Add: return Keyboard.KEY_ADD; case XK_KP_Subtract: return Keyboard.KEY_SUBTRACT; case XK_KP_Decimal: return Keyboard.KEY_DECIMAL; case XK_KP_Divide: return Keyboard.KEY_DIVIDE; case XK_KP_0: return Keyboard.KEY_NUMPAD0; case XK_KP_1: return Keyboard.KEY_NUMPAD1; case XK_KP_2: return Keyboard.KEY_NUMPAD2; case XK_KP_3: return Keyboard.KEY_NUMPAD3; case XK_KP_4: return Keyboard.KEY_NUMPAD4; case XK_KP_5: return Keyboard.KEY_NUMPAD5; case XK_KP_6: return Keyboard.KEY_NUMPAD6; case XK_KP_7: return Keyboard.KEY_NUMPAD7; case XK_KP_8: return Keyboard.KEY_NUMPAD8; case XK_KP_9: return Keyboard.KEY_NUMPAD9; /* * Auxilliary Functions; note the duplicate definitions for left and right * function keys; Sun keyboards and a few other manufactures have such * function key groups on the left and/or right sides of the keyboard. * We've not found a keyboard with more than 35 function keys total. */ case XK_F1: return Keyboard.KEY_F1; case XK_F2: return Keyboard.KEY_F2; case XK_F3: return Keyboard.KEY_F3; case XK_F4: return Keyboard.KEY_F4; case XK_F5: return Keyboard.KEY_F5; case XK_F6: return Keyboard.KEY_F6; case XK_F7: return Keyboard.KEY_F7; case XK_F8: return Keyboard.KEY_F8; case XK_F9: return Keyboard.KEY_F9; case XK_F10: return Keyboard.KEY_F10; case XK_F11: return Keyboard.KEY_F11; case XK_F12: return Keyboard.KEY_F12; case XK_F13: return Keyboard.KEY_F13; case XK_F14: return Keyboard.KEY_F14; case XK_F15: return Keyboard.KEY_F15; /* Modifiers */ case XK_Shift_L: return Keyboard.KEY_LSHIFT; case XK_Shift_R: return Keyboard.KEY_RSHIFT; case XK_Control_L: return Keyboard.KEY_LCONTROL; case XK_Control_R: return Keyboard.KEY_RCONTROL; case XK_Caps_Lock: return Keyboard.KEY_CAPITAL; case XK_Meta_L: return Keyboard.KEY_LMENU; case XK_ISO_Level3_Shift: case XK_Meta_R: return Keyboard.KEY_RMENU; case XK_Alt_L: return Keyboard.KEY_LMENU; case XK_Alt_R: return Keyboard.KEY_RMENU; case XK_dead_grave: return Keyboard.KEY_GRAVE; case XK_dead_circumflex: return Keyboard.KEY_CIRCUMFLEX; /* * Latin 1 * Byte 3 = 0 */ case XK_space: return Keyboard.KEY_SPACE; case XK_apostrophe: return Keyboard.KEY_APOSTROPHE; case XK_comma: return Keyboard.KEY_COMMA; case XK_minus: return Keyboard.KEY_MINUS; case XK_period: return Keyboard.KEY_PERIOD; case XK_slash: return Keyboard.KEY_SLASH; case XK_0: return Keyboard.KEY_0; case XK_1: return Keyboard.KEY_1; case XK_2: return Keyboard.KEY_2; case XK_3: return Keyboard.KEY_3; case XK_4: return Keyboard.KEY_4; case XK_5: return Keyboard.KEY_5; case XK_6: return Keyboard.KEY_6; case XK_7: return Keyboard.KEY_7; case XK_8: return Keyboard.KEY_8; case XK_9: return Keyboard.KEY_9; case XK_colon: return Keyboard.KEY_COLON; case XK_semicolon: return Keyboard.KEY_SEMICOLON; case XK_equal: return Keyboard.KEY_EQUALS; case XK_at: return Keyboard.KEY_AT; case XK_bracketleft: return Keyboard.KEY_LBRACKET; case XK_bracketright: return Keyboard.KEY_RBRACKET; case XK_asciicircum: return Keyboard.KEY_CIRCUMFLEX; case XK_underscore: return Keyboard.KEY_UNDERLINE; case XK_grave: return Keyboard.KEY_GRAVE; case XK_a: case XK_A: return Keyboard.KEY_A; case XK_b: case XK_B: return Keyboard.KEY_B; case XK_c: case XK_C: return Keyboard.KEY_C; case XK_d: case XK_D: return Keyboard.KEY_D; case XK_e: case XK_E: return Keyboard.KEY_E; case XK_f: case XK_F: return Keyboard.KEY_F; case XK_g: case XK_G: return Keyboard.KEY_G; case XK_h: case XK_H: return Keyboard.KEY_H; case XK_i: case XK_I: return Keyboard.KEY_I; case XK_j: case XK_J: return Keyboard.KEY_J; case XK_k: case XK_K: return Keyboard.KEY_K; case XK_l: case XK_L: return Keyboard.KEY_L; case XK_m: case XK_M: return Keyboard.KEY_M; case XK_n: case XK_N: return Keyboard.KEY_N; case XK_o: case XK_O: return Keyboard.KEY_O; case XK_p: case XK_P: return Keyboard.KEY_P; case XK_q: case XK_Q: return Keyboard.KEY_Q; case XK_r: case XK_R: return Keyboard.KEY_R; case XK_s: case XK_S: return Keyboard.KEY_S; case XK_t: case XK_T: return Keyboard.KEY_T; case XK_u: case XK_U: return Keyboard.KEY_U; case XK_v: case XK_V: return Keyboard.KEY_V; case XK_w: case XK_W: return Keyboard.KEY_W; case XK_x: case XK_X: return Keyboard.KEY_X; case XK_y: case XK_Y: return Keyboard.KEY_Y; case XK_z: case XK_Z: return Keyboard.KEY_Z; default: return Keyboard.KEY_NONE; } } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/LinuxContextImplementation.java0000644000175000017500000001303511543426510025042 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.LWJGLException; import java.nio.ByteBuffer; import java.nio.IntBuffer; /** * @author elias_naur * @version $Revision: 3412 $ * $Id: LinuxContextImplementation.java 3412 2010-09-26 23:43:24Z spasi $ */ final class LinuxContextImplementation implements ContextImplementation { public ByteBuffer create(PeerInfo peer_info, IntBuffer attribs, ByteBuffer shared_context_handle) throws LWJGLException { LinuxDisplay.lockAWT(); try { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { return nCreate(peer_handle, attribs, shared_context_handle); } finally { peer_info.unlock(); } } finally { LinuxDisplay.unlockAWT(); } } private static native ByteBuffer nCreate(ByteBuffer peer_handle, IntBuffer attribs, ByteBuffer shared_context_handle) throws LWJGLException; native long getGLXContext(ByteBuffer context_handle); native long getDisplay(ByteBuffer peer_info_handle); public void releaseDrawable(ByteBuffer context_handle) throws LWJGLException { } public void swapBuffers() throws LWJGLException { Context current_context = Context.getCurrentContext(); if ( current_context == null ) throw new IllegalStateException("No context is current"); synchronized ( current_context ) { PeerInfo current_peer_info = current_context.getPeerInfo(); LinuxDisplay.lockAWT(); try { ByteBuffer peer_handle = current_peer_info.lockAndGetHandle(); try { nSwapBuffers(peer_handle); } finally { current_peer_info.unlock(); } } finally { LinuxDisplay.unlockAWT(); } } } private static native void nSwapBuffers(ByteBuffer peer_info_handle) throws LWJGLException; public void releaseCurrentContext() throws LWJGLException { Context current_context = Context.getCurrentContext(); if ( current_context == null ) throw new IllegalStateException("No context is current"); synchronized ( current_context ) { PeerInfo current_peer_info = current_context.getPeerInfo(); LinuxDisplay.lockAWT(); try { ByteBuffer peer_handle = current_peer_info.lockAndGetHandle(); try { nReleaseCurrentContext(peer_handle); } finally { current_peer_info.unlock(); } } finally { LinuxDisplay.unlockAWT(); } } } private static native void nReleaseCurrentContext(ByteBuffer peer_info_handle) throws LWJGLException; public void update(ByteBuffer context_handle) { } public void makeCurrent(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { LinuxDisplay.lockAWT(); try { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { nMakeCurrent(peer_handle, handle); } finally { peer_info.unlock(); } } finally { LinuxDisplay.unlockAWT(); } } private static native void nMakeCurrent(ByteBuffer peer_handle, ByteBuffer context_handle) throws LWJGLException; public boolean isCurrent(ByteBuffer handle) throws LWJGLException { LinuxDisplay.lockAWT(); try { boolean result = nIsCurrent(handle); return result; } finally { LinuxDisplay.unlockAWT(); } } private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException; public void setSwapInterval(int value) { Context current_context = Context.getCurrentContext(); if ( current_context == null ) throw new IllegalStateException("No context is current"); synchronized ( current_context ) { LinuxDisplay.lockAWT(); nSetSwapInterval(current_context.getHandle(), value); LinuxDisplay.unlockAWT(); } } private static native void nSetSwapInterval(ByteBuffer context_handle, int value); public void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { LinuxDisplay.lockAWT(); try { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { nDestroy(peer_handle, handle); } finally { peer_info.unlock(); } } finally { LinuxDisplay.unlockAWT(); } } private static native void nDestroy(ByteBuffer peer_handle, ByteBuffer context_handle) throws LWJGLException; } lwjgl-2.7.1/src/java/org/lwjgl/opengl/PixelFormat.java0000644000175000017500000003230311543426510021721 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * This class describes pixel format properties for an OpenGL context. Instances * of this class is used as arguments to Display.create(), Pbuffer.create() and * AWTGLCanvas, to indicate minimum required properties. *

      * Instants of this class are immutable. An example of the expected way to set * the PixelFormat property values is the following: * PixelFormat pf = new PixelFormat().withDepth(24).withSamples(4).withSRGB(true); *

      * WARNING: Some pixel formats are known to cause troubles on certain buggy drivers. * Example: Under Windows, specifying samples != 0 will enable the ARB * pixel format selection path, which could trigger a crash. * * @author elias_naur@sourceforge.net * @version $Revision: 3355 $ */ public final class PixelFormat { /** * The number of bits per pixel, exluding alpha. * This parameter is ignored in Display.create(). */ private int bpp; /** The number of alpha bits. */ private int alpha; /** The number of depth buffer bits */ private int depth; /** The number of stencil bits */ private int stencil; /** * The number of samples to use in anti-aliasing. * 0 means that anti-aliasing is disabled. */ private int samples; /** * The number of COLOR_SAMPLES_NV to use for Coverage Sample Anti-aliasing (CSAA). * When this number is greater than 0, the {@code samples} property will be treated * as if it were the COVERAGE_SAMPLES_NV property. *

      * This property is currently a no-op for the MacOS implementation. */ private int colorSamples; /** The number of auxiliary buffers */ private int num_aux_buffers; /** The number of bits per pixel in the accumulation buffer */ private int accum_bpp; /** The number of alpha bits in the accumulation buffer */ private int accum_alpha; /** Whether this format requires a stereo buffer */ private boolean stereo; /** Whether this format specifies a floating point format */ private boolean floating_point; /** * Whether this format specifies a packed floating point format (32 bit unsigned - R11F_G11F_B10F) * This property is currently a no-op for the MacOS implementation. */ private boolean floating_point_packed; /** * Whether this format specifies an sRGB format * This property is currently a no-op for the MacOS implementation. */ private boolean sRGB; /** * Default pixel format is minimum 8 bits depth, and no alpha * nor stencil requirements. */ public PixelFormat() { this(0, 8, 0); } public PixelFormat(int alpha, int depth, int stencil) { this(alpha, depth, stencil, 0); } public PixelFormat(int alpha, int depth, int stencil, int samples) { this(0, alpha, depth, stencil, samples); } public PixelFormat(int bpp, int alpha, int depth, int stencil, int samples) { this(bpp, alpha, depth, stencil, samples, 0, 0, 0, false); } public PixelFormat(int bpp, int alpha, int depth, int stencil, int samples, int num_aux_buffers, int accum_bpp, int accum_alpha, boolean stereo) { this(bpp, alpha, depth, stencil, samples, num_aux_buffers, accum_bpp, accum_alpha, stereo, false); } public PixelFormat(int bpp, int alpha, int depth, int stencil, int samples, int num_aux_buffers, int accum_bpp, int accum_alpha, boolean stereo, boolean floating_point) { this.bpp = bpp; this.alpha = alpha; this.depth = depth; this.stencil = stencil; this.samples = samples; this.num_aux_buffers = num_aux_buffers; this.accum_bpp = accum_bpp; this.accum_alpha = accum_alpha; this.stereo = stereo; this.floating_point = floating_point; this.floating_point_packed = false; this.sRGB = false; } private PixelFormat(final PixelFormat pf) { this.bpp = pf.bpp; this.alpha = pf.alpha; this.depth = pf.depth; this.stencil = pf.stencil; this.samples = pf.samples; this.colorSamples = pf.colorSamples; this.num_aux_buffers = pf.num_aux_buffers; this.accum_bpp = pf.accum_bpp; this.accum_alpha = pf.accum_alpha; this.stereo = pf.stereo; this.floating_point = pf.floating_point; this.floating_point_packed = pf.floating_point_packed; this.sRGB = pf.sRGB; } public int getBitsPerPixel() { return bpp; } /** * Returns a new PixelFormat object with the same properties as this PixelFormat and the new bits per pixel value. * * @param bpp the new bits per pixel value. * * @return the new PixelFormat */ public PixelFormat withBitsPerPixel(final int bpp) { if ( bpp < 0 ) throw new IllegalArgumentException("Invalid number of bits per pixel specified: " + bpp); final PixelFormat pf = new PixelFormat(this); pf.bpp = bpp; return pf; } public int getAlphaBits() { return alpha; } /** * Returns a new PixelFormat object with the same properties as this PixelFormat and the new alpha bits value. * * @param alpha the new alpha bits value. * * @return the new PixelFormat */ public PixelFormat withAlphaBits(final int alpha) { if ( alpha < 0 ) throw new IllegalArgumentException("Invalid number of alpha bits specified: " + alpha); final PixelFormat pf = new PixelFormat(this); pf.alpha = alpha; return pf; } public int getDepthBits() { return depth; } /** * Returns a new PixelFormat object with the same properties as this PixelFormat and the new depth bits value. * * @param depth the new depth bits value. * * @return the new PixelFormat */ public PixelFormat withDepthBits(final int depth) { if ( depth < 0 ) throw new IllegalArgumentException("Invalid number of depth bits specified: " + depth); final PixelFormat pf = new PixelFormat(this); pf.depth = depth; return pf; } public int getStencilBits() { return stencil; } /** * Returns a new PixelFormat object with the same properties as this PixelFormat and the new stencil bits value. * * @param stencil the new stencil bits value. * * @return the new PixelFormat */ public PixelFormat withStencilBits(final int stencil) { if ( stencil < 0 ) throw new IllegalArgumentException("Invalid number of stencil bits specified: " + stencil); final PixelFormat pf = new PixelFormat(this); pf.stencil = stencil; return pf; } public int getSamples() { return samples; } /** * Returns a new PixelFormat object with the same properties as this PixelFormat and the new samples value. * * @param samples the new samples value. * * @return the new PixelFormat */ public PixelFormat withSamples(final int samples) { if ( samples < 0 ) throw new IllegalArgumentException("Invalid number of samples specified: " + samples); final PixelFormat pf = new PixelFormat(this); pf.samples = samples; return pf; } /** * Returns a new PixelFormat object with the same properties as this PixelFormat and the new color samples values. * A value greater than 0 is valid only if the {@code samples} property is also greater than 0. Additionally, the * color samples value needs to be lower than or equal to the {@code samples} property. * * @param colorSamples the new color samples value. * * @return the new PixelFormat */ public PixelFormat withCoverageSamples(final int colorSamples) { return withCoverageSamples(colorSamples, samples); } /** * Returns a new PixelFormat object with the same properties as this PixelFormat and the new color samples * and coverage samples values. * * @param colorSamples the new color samples value. This value must be lower than or equal to the coverage samples value. * @param coverageSamples the new coverage samples value. * * @return the new PixelFormat */ public PixelFormat withCoverageSamples(final int colorSamples, final int coverageSamples) { if ( coverageSamples < 0 || colorSamples < 0 || (coverageSamples == 0 && 0 < colorSamples) || coverageSamples < colorSamples ) throw new IllegalArgumentException("Invalid number of coverage samples specified: " + coverageSamples + " - " + colorSamples); final PixelFormat pf = new PixelFormat(this); pf.samples = coverageSamples; pf.colorSamples = colorSamples; return pf; } public int getAuxBuffers() { return num_aux_buffers; } /** * Returns a new PixelFormat object with the same properties as this PixelFormat and the new auxiliary buffers value. * * @param num_aux_buffers the new auxiliary buffers value. * * @return the new PixelFormat */ public PixelFormat withAuxBuffers(final int num_aux_buffers) { if ( num_aux_buffers < 0 ) throw new IllegalArgumentException("Invalid number of auxiliary buffers specified: " + num_aux_buffers); final PixelFormat pf = new PixelFormat(this); pf.num_aux_buffers = num_aux_buffers; return pf; } public int getAccumulationBitsPerPixel() { return accum_bpp; } /** * Returns a new PixelFormat object with the same properties as this PixelFormat and the new bits per pixel in the accumulation buffer value. * * @param accum_bpp the new bits per pixel in the accumulation buffer value. * * @return the new PixelFormat */ public PixelFormat withAccumulationBitsPerPixel(final int accum_bpp) { if ( accum_bpp < 0 ) throw new IllegalArgumentException("Invalid number of bits per pixel in the accumulation buffer specified: " + accum_bpp); final PixelFormat pf = new PixelFormat(this); pf.accum_bpp = accum_bpp; return pf; } public int getAccumulationAlpha() { return accum_alpha; } /** * Returns a new PixelFormat object with the same properties as this PixelFormat and the new alpha bits in the accumulation buffer value. * * @param accum_alpha the new alpha bits in the accumulation buffer value. * * @return the new PixelFormat */ public PixelFormat withAccumulationAlpha(final int accum_alpha) { if ( accum_alpha < 0 ) throw new IllegalArgumentException("Invalid number of alpha bits in the accumulation buffer specified: " + accum_alpha); final PixelFormat pf = new PixelFormat(this); pf.accum_alpha = accum_alpha; return pf; } public boolean isStereo() { return stereo; } /** * Returns a new PixelFormat object with the same properties as this PixelFormat and the new stereo value. * * @param stereo the new stereo value. * * @return the new PixelFormat */ public PixelFormat withStereo(final boolean stereo) { final PixelFormat pf = new PixelFormat(this); pf.stereo = stereo; return pf; } public boolean isFloatingPoint() { return floating_point; } /** * Returns a new PixelFormat object with the same properties as this PixelFormat and the new floating point value. * If floating_point is true, floating_point_packed will be reset to false. * * @param floating_point the new floating point value. * * @return the new PixelFormat */ public PixelFormat withFloatingPoint(final boolean floating_point) { final PixelFormat pf = new PixelFormat(this); pf.floating_point = floating_point; if ( floating_point ) pf.floating_point_packed = false; return pf; } /** * Returns a new PixelFormat object with the same properties as this PixelFormat and the new packed floating point value. * If floating_point_packed is true, floating_point will be reset to false. * * @param floating_point_packed the new packed floating point value. * * @return the new PixelFormat */ public PixelFormat withFloatingPointPacked(final boolean floating_point_packed) { final PixelFormat pf = new PixelFormat(this); pf.floating_point_packed = floating_point_packed; if ( floating_point_packed ) pf.floating_point = false; return pf; } public boolean isSRGB() { return sRGB; } /** * Returns a new PixelFormat object with the same properties as this PixelFormat and the new sRGB value. * * @param sRGB the new floating point value. * * @return the new PixelFormat */ public PixelFormat withSRGB(final boolean sRGB) { final PixelFormat pf = new PixelFormat(this); pf.sRGB = sRGB; return pf; } }lwjgl-2.7.1/src/java/org/lwjgl/opengl/DrawableLWJGL.java0000644000175000017500000000073611543426510022015 0ustar zero79zero79package org.lwjgl.opengl; import org.lwjgl.LWJGLException; /** * @author Spasi */ interface DrawableLWJGL extends Drawable { /** * [INTERNAL USE ONLY] Returns the Drawable's Context. * * @return the Drawable's Context */ Context getContext(); /** * [INTERNAL USE ONLY] Creates a new Context that is shared with the Drawable's Context. * * @return a Context shared with the Drawable's Context. */ Context createSharedContext() throws LWJGLException; } lwjgl-2.7.1/src/java/org/lwjgl/opengl/XRandR.java0000644000175000017500000001757111543426510020637 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * Redistributions in binary form must reproduce the * above copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * Neither the name of 'LWJGL' nor the names * of its contributors may be used to endorse or promote products * derived from this software without specific prior written * permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ package org.lwjgl.opengl; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.lwjgl.LWJGLUtil; /** * Utility for working with the xrandr commmand-line utility. Assumes * xrandr v1.2 or higher. * * @author ryanm */ public class XRandR { private static Screen[] current; private static Map screens; private static void populate() { if( screens == null ) { screens = new HashMap(); // ProcessBuilder pb = new ProcessBuilder( "xrandr", "-q" ); // pb.redirectErrorStream(); try { // Process p= pb.start(); Process p = Runtime.getRuntime().exec( new String[] { "xrandr", "-q" } ); List currentList = new ArrayList(); List possibles = new ArrayList(); String name = null; BufferedReader br = new BufferedReader( new InputStreamReader( p.getInputStream() ) ); String line; while( ( line = br.readLine() ) != null ) { line = line.trim(); String[] sa = line.split( "\\s+" ); if( "connected".equals(sa[1]) ) { // found a new screen block if( name != null ) { screens.put( name, possibles.toArray( new Screen[ possibles.size() ] ) ); possibles.clear(); } name = sa[ 0 ]; // record the current config parseScreen( currentList, name, sa[ 2 ] ); } else if( Pattern.matches( "\\d*x\\d*", sa[ 0 ] ) ) { // found a new mode line parseScreen( possibles, name, sa[ 0 ] ); } } screens.put( name, possibles.toArray( new Screen[ possibles.size() ] ) ); current = currentList.toArray(new Screen[currentList.size()]); } catch( Throwable e ) { LWJGLUtil.log( "Exception in XRandR.populate(): " + e.getMessage() ); screens.clear(); current = new Screen[ 0 ]; } } } /** * @return The current screen configuration, or an empty array if * xrandr is not supported */ public static Screen[] getConfiguration() { populate(); return current.clone(); } /** * @param screens * The desired screen set, may not be null * @throws IllegalArgumentException * if no screens are specified */ public static void setConfiguration(Screen... screens) { if( screens.length == 0 ) throw new IllegalArgumentException( "Must specify at least one screen" ); List cmd = new ArrayList(); cmd.add( "xrandr" ); // switch off those in the current set not in the new set for ( Screen screen : current ) { boolean found = false; for ( Screen screen1 : screens ) { if ( screen1.name.equals(screen.name) ) { found = true; break; } } if ( !found ) { cmd.add("--output"); cmd.add(screen.name); cmd.add("--off"); } } // set up new set for ( Screen screen : screens ) screen.getArgs(cmd); try { // ProcessBuilder pb = new ProcessBuilder( cmd ); // pb.redirectErrorStream(); // Process p = pb.start(); Process p = Runtime.getRuntime().exec( cmd.toArray( new String[ cmd.size() ] ) ); // no output is expected, but check anyway BufferedReader br = new BufferedReader( new InputStreamReader( p.getInputStream() ) ); String line; while( ( line = br.readLine() ) != null ) { LWJGLUtil.log( "Unexpected output from xrandr process: " + line ); } current = screens; } catch( IOException e ) { LWJGLUtil.log( "XRandR exception in setConfiguration(): " + e.getMessage() ); } } /** * @return the name of connected screens, or an empty array if * xrandr is not supported */ public static String[] getScreenNames() { populate(); return screens.keySet().toArray( new String[ screens.size() ] ); } /** * @param name * @return the possible resolutions of the named screen, or * null if there is no such screen */ public static Screen[] getResolutions( String name ) { populate(); // clone the array to prevent held copies being altered return screens.get(name).clone(); } private static final Pattern SCREEN_PATTERN1 = Pattern.compile( "^(\\d+)x(\\d+)\\+(\\d+)\\+(\\d+)$" ); private static final Pattern SCREEN_PATTERN2 = Pattern.compile( "^(\\d+)x(\\d+)$" ); /** * Parses a screen configuration and adds it to the list if it's * valid. * * @param list * the list to add the Screen to if it's valid * @param name * the name of this screen * @param what * config string, format either widthxheight or * widthxheight+xPos+yPos */ private static void parseScreen( List list, String name, String what ) { Matcher m = SCREEN_PATTERN1.matcher( what ); if( !m.matches() ) { m = SCREEN_PATTERN2.matcher( what ); if( !m.matches() ) { LWJGLUtil.log( "Did not match: " + what ); return; } } int width = Integer.parseInt( m.group( 1 ) ); int height = Integer.parseInt( m.group( 2 ) ); int xpos, ypos; if( m.groupCount() > 3 ) { xpos = Integer.parseInt( m.group( 3 ) ); ypos = Integer.parseInt( m.group( 4 ) ); } else { xpos = 0; ypos = 0; } list.add( new Screen( name, width, height, xpos, ypos ) ); } /** * Encapsulates the configuration of a monitor. Resolution is * fixed, position is mutable * * @author ryanm */ public static class Screen implements Cloneable { /** * Name for this output */ public final String name; /** * Width in pixels */ public final int width; /** * Height in pixels */ public final int height; /** * Position on the x-axis, in pixels */ public int xPos; /** * Position on the y-axis, in pixels */ public int yPos; private Screen( String name, int width, int height, int xPos, int yPos ) { this.name = name; this.width = width; this.height = height; this.xPos = xPos; this.yPos = yPos; } private void getArgs( List argList ) { argList.add( "--output" ); argList.add( name ); argList.add( "--mode" ); argList.add( width + "x" + height ); argList.add( "--pos" ); argList.add( xPos + "x" + yPos ); } //@Override public String toString() { return name + " " + width + "x" + height + " @ " + xPos + "x" + yPos; } } }lwjgl-2.7.1/src/java/org/lwjgl/opengl/ARBDebugOutputCallback.java0000644000175000017500000001470111543426510023702 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.PointerWrapperAbstract; /** * Instances of this class are needed to use the callback functionality of the ARB_debug_output extension. * A debug context must be current before creating instances of this class. Users of this class may provide * implementations of the {@code Handler} interface to receive notifications. The same {@code Handler} * instance may be used by different contexts but it is not recommended. Handler notifications are synchronized. * * @author Spasi */ public final class ARBDebugOutputCallback extends PointerWrapperAbstract { /** Severity levels. */ private static final int GL_DEBUG_SEVERITY_HIGH_ARB = 0x9146, GL_DEBUG_SEVERITY_MEDIUM_ARB = 0x9147, GL_DEBUG_SEVERITY_LOW_ARB = 0x9148; /** Sources. */ private static final int GL_DEBUG_SOURCE_API_ARB = 0x8246, GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB = 0x8247, GL_DEBUG_SOURCE_SHADER_COMPILER_ARB = 0x8248, GL_DEBUG_SOURCE_THIRD_PARTY_ARB = 0x8249, GL_DEBUG_SOURCE_APPLICATION_ARB = 0x824A, GL_DEBUG_SOURCE_OTHER_ARB = 0x824B; /** Types. */ private static final int GL_DEBUG_TYPE_ERROR_ARB = 0x824C, GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB = 0x824D, GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB = 0x824E, GL_DEBUG_TYPE_PORTABILITY_ARB = 0x824F, GL_DEBUG_TYPE_PERFORMANCE_ARB = 0x8250, GL_DEBUG_TYPE_OTHER_ARB = 0x8251; private static final long CALLBACK_POINTER; static { long pointer = 0; try { // Call reflectively so that we can compile this class for the Generator. pointer = (Long)Class.forName("org.lwjgl.opengl.CallbackUtil").getDeclaredMethod("getDebugOutputCallbackARB").invoke(null); } catch (Exception e) { // ignore } CALLBACK_POINTER = pointer; } private final Handler handler; /** * Creates an ARBDebugOutputCallback with a default callback handler. * The default handler will simply print the message on System.err. */ public ARBDebugOutputCallback() { this(new Handler() { public void handleMessage(final int source, final int type, final int id, final int severity, final String message) { System.err.println("[LWJGL] ARB_debug_output message"); System.err.println("\tID: " + id); String description; switch ( source ) { case GL_DEBUG_SOURCE_API_ARB: description = "API"; break; case GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB: description = "WINDOW SYSTEM"; break; case GL_DEBUG_SOURCE_SHADER_COMPILER_ARB: description = "SHADER COMPILER"; break; case GL_DEBUG_SOURCE_THIRD_PARTY_ARB: description = "THIRD PARTY"; break; case GL_DEBUG_SOURCE_APPLICATION_ARB: description = "APPLICATION"; break; case GL_DEBUG_SOURCE_OTHER_ARB: description = "OTHER"; break; default: description = "Unknown (" + Integer.toHexString(source) + ")"; } System.err.println("\tSource: " + description); switch ( type ) { case GL_DEBUG_TYPE_ERROR_ARB: description = "ERROR"; break; case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB: description = "DEPRECATED BEHAVIOR"; break; case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB: description = "UNDEFINED BEHAVIOR"; break; case GL_DEBUG_TYPE_PORTABILITY_ARB: description = "PORTABILITY"; break; case GL_DEBUG_TYPE_PERFORMANCE_ARB: description = "PERFORMANCE"; break; case GL_DEBUG_TYPE_OTHER_ARB: description = "OTHER"; break; default: description = "Unknown (" + Integer.toHexString(source) + ")"; } System.err.println("\tType: " + description); switch ( severity ) { case GL_DEBUG_SEVERITY_HIGH_ARB: description = "HIGH"; break; case GL_DEBUG_SEVERITY_MEDIUM_ARB: description = "MEDIUM"; break; case GL_DEBUG_SEVERITY_LOW_ARB: description = "LOW"; break; default: description = "Unknown (" + Integer.toHexString(source) + ")"; } System.err.println("\tSeverity: " + description); System.err.println("\tMessage: " + message); } }); } /** * Creates an ARBDebugOutputCallback with the specified callback handler. * The handler's {@code handleMessage} method will be called whenever * debug output is generated by the GL. * * @param handler the callback handler */ public ARBDebugOutputCallback(final Handler handler) { super(CALLBACK_POINTER); this.handler = handler; } Handler getHandler() { return handler; } /** Implementations of this interface can be used to receive ARB_debug_output notifications. */ public interface Handler { /** * This method will be called when an ARB_debug_output message is generated. * * @param id the message ID * @param source the message source * @param type the message type * @param severity the message severity * @param message the string representation of the message. */ void handleMessage(int source, int type, int id, int severity, String message); } }lwjgl-2.7.1/src/java/org/lwjgl/opengl/ContextAttribs.java0000644000175000017500000002470611543426510022454 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLUtil; import java.nio.IntBuffer; /** * This class represents the context attributes passed to CreateContextAttribs of the ARB_create_context and * ARB_create_context_profile extensions. * These attributes can be used to indicate at context creation which OpenGL interface will be used. This includes the * OpenGL version, the layer plane on which rendering takes place and also optional debug and forward combatibility modes. * (read the ARB_create_context spec for details) *

      * Use of this class is optional. If an OpenGL context is created without passing an instance of this class * (or ARB_create_context is not supported), the old context creation code will be used. Support for debug and forward * compatible mobes is not guaranteed by the OpenGL implementation. Developers may encounter debug contexts being the same * as non-debug contexts or forward compatible contexts having support for deprecated functionality. *

      * If the forwardCompatible * attribute is used, LWJGL will not load the deprecated functionality (as defined in the OpenGL 3.0 specification). This * means that developers can start working on cleaning up their applications without an OpenGL 3.0 complaint driver. * * @author spasi */ public final class ContextAttribs { // Same values for GLX & WGL private static final int CONTEXT_ES2_PROFILE_BIT_EXT = 0x00000004; private static final int CONTEXT_ROBUST_ACCESS_BIT_ARB = 0x00000004; private static final int CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB = 0x8256; private static final int NO_RESET_NOTIFICATION_ARB = 0x8261, LOSE_CONTEXT_ON_RESET_ARB = 0x8252; private int majorVersion; private int minorVersion; private int layerPlane; private boolean debug; private boolean forwardCompatible; private boolean robustAccess; private boolean profileCore; private boolean profileCompatibility; private boolean profileES; private boolean loseContextOnReset; public ContextAttribs() { this(1, 0); } public ContextAttribs(final int majorVersion, final int minorVersion) { if ( majorVersion < 0 || 4 < majorVersion || minorVersion < 0 || (majorVersion == 4 && 0 < minorVersion) || (majorVersion == 3 && 3 < minorVersion) || (majorVersion == 2 && 1 < minorVersion) || (majorVersion == 1 && 5 < minorVersion) ) throw new IllegalArgumentException("Invalid OpenGL version specified: " + majorVersion + '.' + minorVersion); this.majorVersion = majorVersion; this.minorVersion = minorVersion; } private ContextAttribs(final ContextAttribs attribs) { this.majorVersion = attribs.majorVersion; this.minorVersion = attribs.minorVersion; this.layerPlane = attribs.layerPlane; this.debug = attribs.debug; this.forwardCompatible = attribs.forwardCompatible; this.robustAccess = attribs.robustAccess; this.profileCore = attribs.profileCore; this.profileCompatibility = attribs.profileCompatibility; this.profileES = attribs.profileES; this.loseContextOnReset = attribs.loseContextOnReset; } public int getMajorVersion() { return majorVersion; } public int getMinorVersion() { return minorVersion; } public int getLayerPlane() { return layerPlane; } public boolean isDebug() { return debug; } public boolean isForwardCompatible() { return forwardCompatible; } public boolean isProfileCore() { return profileCore; } public boolean isProfileCompatibility() { return profileCompatibility; } public boolean isProfileES() { return profileES; } public ContextAttribs withLayer(final int layerPlane) { if ( layerPlane < 0 ) throw new IllegalArgumentException("Invalid layer plane specified: " + layerPlane); if ( layerPlane == this.layerPlane ) return this; final ContextAttribs attribs = new ContextAttribs(this); attribs.layerPlane = layerPlane; return attribs; } public ContextAttribs withDebug(final boolean debug) { if ( debug == this.debug ) return this; final ContextAttribs attribs = new ContextAttribs(this); attribs.debug = debug; return attribs; } public ContextAttribs withForwardCompatible(final boolean forwardCompatible) { if ( forwardCompatible == this.forwardCompatible ) return this; final ContextAttribs attribs = new ContextAttribs(this); attribs.forwardCompatible = forwardCompatible; return attribs; } public ContextAttribs withProfileCore(final boolean profileCore) { if ( majorVersion < 3 || (majorVersion == 3 && minorVersion < 2) ) throw new IllegalArgumentException("Profiles are only supported on OpenGL version 3.2 or higher."); if ( profileCore == this.profileCore ) return this; final ContextAttribs attribs = new ContextAttribs(this); attribs.profileCore = profileCore; if ( profileCore ) attribs.profileCompatibility = false; return attribs; } public ContextAttribs withProfileCompatibility(final boolean profileCompatibility) { if ( majorVersion < 3 || (majorVersion == 3 && minorVersion < 2) ) throw new IllegalArgumentException("Profiles are only supported on OpenGL version 3.2 or higher."); if ( profileCompatibility == this.profileCompatibility ) return this; final ContextAttribs attribs = new ContextAttribs(this); attribs.profileCompatibility = profileCompatibility; if ( profileCompatibility ) attribs.profileCore = false; return attribs; } public ContextAttribs withProfileES(final boolean profileES) { if ( !(majorVersion == 2 && minorVersion == 0) ) throw new IllegalArgumentException("The OpenGL ES profiles is only supported for OpenGL version 2.0."); if ( profileES == this.profileES ) return this; final ContextAttribs attribs = new ContextAttribs(this); attribs.profileES = profileES; return attribs; } /** * Returns a ContextAttribs instance with CONTEXT_RESET_NOTIFICATION_STRATEGY set * to LOSE_CONTEXT_ON_RESET if the parameter is true or to NO_RESET_NOTIFICATION * if the parameter is false. * * @param loseContextOnReset * * @return the new ContextAttribs */ public ContextAttribs withLoseContextOnReset(final boolean loseContextOnReset) { if ( loseContextOnReset == this.loseContextOnReset ) return this; final ContextAttribs attribs = new ContextAttribs(this); attribs.loseContextOnReset = loseContextOnReset; return attribs; } private static ContextAttribsImplementation getImplementation() { switch ( LWJGLUtil.getPlatform() ) { case LWJGLUtil.PLATFORM_LINUX: return new LinuxContextAttribs(); case LWJGLUtil.PLATFORM_WINDOWS: return new WindowsContextAttribs(); case LWJGLUtil.PLATFORM_MACOSX: return new MacOSXContextAttribs(); default: throw new IllegalStateException("Unsupported platform"); } } IntBuffer getAttribList() { ContextAttribsImplementation implementation = getImplementation(); int attribCount = 0; if ( !(majorVersion == 1 && minorVersion == 0) ) attribCount += 2; if ( 0 < layerPlane ) attribCount++; int flags = 0; if ( debug ) flags |= implementation.getDebugBit(); if ( forwardCompatible ) flags |= implementation.getForwardCompatibleBit(); if ( robustAccess ) flags |= CONTEXT_ROBUST_ACCESS_BIT_ARB; if ( 0 < flags ) attribCount++; int profileMask = 0; if ( profileCore ) profileMask |= implementation.getProfileCoreBit(); else if ( profileCompatibility ) profileMask |= implementation.getProfileCompatibilityBit(); else if ( profileES ) profileMask |= CONTEXT_ES2_PROFILE_BIT_EXT; if ( 0 < profileMask ) attribCount++; if ( attribCount == 0 ) return null; final IntBuffer attribs = BufferUtils.createIntBuffer((attribCount * 2) + 1); if ( !(majorVersion == 1 && minorVersion == 0) ) { attribs.put(implementation.getMajorVersionAttrib()).put(majorVersion); attribs.put(implementation.getMinorVersionAttrib()).put(minorVersion); } if ( 0 < layerPlane ) attribs.put(implementation.getLayerPlaneAttrib()).put(layerPlane); if ( 0 < flags ) attribs.put(implementation.getFlagsAttrib()).put(flags); if ( 0 < profileMask ) attribs.put(implementation.getProfileMaskAttrib()).put(profileMask); if ( loseContextOnReset ) attribs.put(CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB).put(LOSE_CONTEXT_ON_RESET_ARB); attribs.put(0); attribs.rewind(); return attribs; } public String toString() { StringBuilder sb = new StringBuilder(32); sb.append("ContextAttribs:"); sb.append(" Version=").append(majorVersion).append('.').append(minorVersion); sb.append(" - Layer=").append(layerPlane); sb.append(" - Debug=").append(debug); sb.append(" - ForwardCompatible=").append(forwardCompatible); sb.append(" - RobustAccess=").append(robustAccess); if ( robustAccess ) sb.append(" (").append(loseContextOnReset ? "LOSE_CONTEXT_ON_RESET" : "NO_RESET_NOTIFICATION"); sb.append(" - Profile="); if ( profileCore ) sb.append("Core"); else if ( profileCompatibility ) sb.append("Compatibility"); else sb.append("None"); return sb.toString(); } }lwjgl-2.7.1/src/java/org/lwjgl/opengl/AWTSurfaceLock.java0000644000175000017500000000727411543426510022255 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.awt.Canvas; import java.nio.ByteBuffer; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; /** * * @author elias_naur * @version $Revision: 3418 $ * $Id: AWTSurfaceLock.java 3418 2010-09-28 21:11:35Z spasi $ */ final class AWTSurfaceLock { private static final int WAIT_DELAY_MILLIS = 100; private final ByteBuffer lock_buffer; private boolean firstLockSucceeded; AWTSurfaceLock() { lock_buffer = createHandle(); } private static native ByteBuffer createHandle(); public ByteBuffer lockAndGetHandle(Canvas component) throws LWJGLException { while (!privilegedLockAndInitHandle(component)) { LWJGLUtil.log("Could not get drawing surface info, retrying..."); try { Thread.sleep(WAIT_DELAY_MILLIS); } catch (InterruptedException e) { LWJGLUtil.log("Interrupted while retrying: " + e); } } return lock_buffer; } private boolean privilegedLockAndInitHandle(final Canvas component) throws LWJGLException { // Workaround for Sun JDK bug 4796548 which still exists in java for OS X // We need to elevate privileges because of an AWT bug. Please see // http://192.18.37.44/forums/index.php?topic=10572 for a discussion. // It is only needed on first call, so we avoid it on all subsequent calls // due to performance. if (firstLockSucceeded) return lockAndInitHandle(lock_buffer, component); else try { firstLockSucceeded = AccessController.doPrivileged(new PrivilegedExceptionAction() { public Boolean run() throws LWJGLException { return lockAndInitHandle(lock_buffer, component); } }); return firstLockSucceeded; } catch (PrivilegedActionException e) { throw (LWJGLException) e.getException(); } } private static native boolean lockAndInitHandle(ByteBuffer lock_buffer, Canvas component) throws LWJGLException; void unlock() throws LWJGLException { nUnlock(lock_buffer); } private static native void nUnlock(ByteBuffer lock_buffer) throws LWJGLException; } lwjgl-2.7.1/src/java/org/lwjgl/opengl/WindowsFileVersion.java0000644000175000017500000000416511543426510023274 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * @author elias_naur */ final class WindowsFileVersion { private final int product_version_ms; private final int product_version_ls; WindowsFileVersion(int product_version_ms, int product_version_ls) { this.product_version_ms = product_version_ms; this.product_version_ls = product_version_ls; } public String toString() { int f1 = (product_version_ms >> 16) & 0xFFFF; int f2 = product_version_ms & 0xFFFF; int f3 = (product_version_ls >> 16) & 0xFFFF; int f4 = product_version_ls & 0xFFFF; return f1 + "." + f2 + "." + f3 + "." + f4; } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/GLSync.java0000644000175000017500000000350011543426510020623 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.PointerWrapperAbstract; /** * This class is a wrapper around a GLsync pointer. * * @author spasi */ public final class GLSync extends PointerWrapperAbstract { GLSync(final long sync) { super(sync); } }lwjgl-2.7.1/src/java/org/lwjgl/opengl/Drawable.java0000644000175000017500000000557311543426510021221 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.LWJGLException; import org.lwjgl.PointerBuffer; /** * The Drawable interface describes an OpenGL drawable with an associated * Context. * * @author elias_naur */ public interface Drawable { /** Returns true if the Drawable's context is current in the current thread. */ boolean isCurrent() throws LWJGLException; /** * Makes the Drawable's context current in the current thread. * * @throws LWJGLException */ void makeCurrent() throws LWJGLException; /** * If the Drawable's context is current in the current thread, no context will be current after a call to this method. * * @throws LWJGLException */ void releaseContext() throws LWJGLException; /** Destroys the Drawable. */ void destroy(); /** * Sets the appropriate khr_gl_sharing properties in the target PointerBuffer, * so that if it is used in a clCreateContext(FromType) call, the created CL * context will be sharing objects with this Drawable's GL context. After a * call to this method, the target buffer position will have advanced by 2 to 4 positions, * depending on the implementation. * * @param properties The target properties buffer. It must have at least 4 positions remaining. */ void setCLSharingProperties(PointerBuffer properties) throws LWJGLException; } lwjgl-2.7.1/src/java/org/lwjgl/opengl/MacOSXCanvasListener.java0000644000175000017500000000646011543426510023430 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * The AWT compatible Canvas for Mac OS X. * @author elias_naur */ import java.awt.Canvas; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.event.HierarchyEvent; import java.awt.event.HierarchyListener; final class MacOSXCanvasListener implements ComponentListener, HierarchyListener { private final Canvas canvas; private int width; private int height; private boolean context_update; MacOSXCanvasListener(Canvas canvas) { this.canvas = canvas; canvas.addComponentListener(this); canvas.addHierarchyListener(this); setUpdate(); } public void disableListeners() { // Mac OS X applets will hang in Display.destroy() when parented when removing the listeners directly java.awt.EventQueue.invokeLater(new Runnable() { public void run() { canvas.removeComponentListener(MacOSXCanvasListener.this); canvas.removeHierarchyListener(MacOSXCanvasListener.this); } }); } public boolean syncShouldUpdateContext() { boolean should_update; synchronized ( this ) { should_update = context_update; context_update = false; } return should_update; } private synchronized void setUpdate() { synchronized ( this ) { width = canvas.getWidth(); height = canvas.getHeight(); context_update = true; } } public int syncGetWidth() { synchronized ( this ) { return width; } } public int syncGetHeight() { synchronized ( this ) { return height; } } public void componentShown(ComponentEvent e) { } public void componentHidden(ComponentEvent e) { } public void componentResized(ComponentEvent e) { setUpdate(); } public void componentMoved(ComponentEvent e) { setUpdate(); } public void hierarchyChanged(HierarchyEvent e) { setUpdate(); } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java0000644000175000017500000000550011543426510024503 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; import java.awt.Canvas; /** * * @author elias_naur * @version $Revision: 3418 $ * $Id: WindowsAWTGLCanvasPeerInfo.java 3418 2010-09-28 21:11:35Z spasi $ */ final class WindowsAWTGLCanvasPeerInfo extends WindowsPeerInfo { private final Canvas component; private final AWTSurfaceLock awt_surface = new AWTSurfaceLock(); private final PixelFormat pixel_format; private boolean has_pixel_format; WindowsAWTGLCanvasPeerInfo(Canvas component, PixelFormat pixel_format) { this.component = component; this.pixel_format = pixel_format; } protected void doLockAndInitHandle() throws LWJGLException { nInitHandle(awt_surface.lockAndGetHandle(component), getHandle()); if (!has_pixel_format && pixel_format != null) { // If we haven't applied a pixel format yet, do it now int format = choosePixelFormat(getHdc(), component.getX(), component.getY(), pixel_format, null, true, true, false, true); setPixelFormat(getHdc(), format); has_pixel_format = true; } } private static native void nInitHandle(ByteBuffer surface_buffer, ByteBuffer peer_info_handle) throws LWJGLException; protected void doUnlock() throws LWJGLException { awt_surface.unlock(); } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/WindowsMouse.java0000644000175000017500000001420211543426510022130 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * This is the Windows implementation of the Mouse. * @author elias_naur */ import java.nio.ByteBuffer; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.input.Mouse; final class WindowsMouse { private final long hwnd; private final int mouse_button_count; private final boolean has_wheel; private final EventQueue event_queue = new EventQueue(Mouse.EVENT_SIZE); private final ByteBuffer mouse_event = ByteBuffer.allocate(Mouse.EVENT_SIZE); private final Object blank_cursor; private boolean mouse_grabbed; private byte[] button_states; private int accum_dx; private int accum_dy; private int accum_dwheel; private int last_x; private int last_y; WindowsMouse(long hwnd) throws LWJGLException { this.hwnd = hwnd; this.mouse_button_count = WindowsDisplay.getSystemMetrics(WindowsDisplay.SM_CMOUSEBUTTONS); this.has_wheel = WindowsDisplay.getSystemMetrics(WindowsDisplay.SM_MOUSEWHEELPRESENT) != 0; this.blank_cursor = createBlankCursor(); this.button_states = new byte[mouse_button_count]; } private Object createBlankCursor() throws LWJGLException { int width = WindowsDisplay.getSystemMetrics(WindowsDisplay.SM_CXCURSOR); int height = WindowsDisplay.getSystemMetrics(WindowsDisplay.SM_CYCURSOR); IntBuffer pixels = BufferUtils.createIntBuffer(width*height); return WindowsDisplay.doCreateCursor(width, height, 0, 0, 1, pixels, null); } public boolean isGrabbed() { return mouse_grabbed; } public boolean hasWheel() { return has_wheel; } public int getButtonCount() { return mouse_button_count; } public void poll(IntBuffer coord_buffer, ByteBuffer buttons) { for (int i = 0; i < coord_buffer.remaining(); i++) coord_buffer.put(coord_buffer.position() + i, 0); int num_buttons = mouse_button_count; coord_buffer.put(coord_buffer.position() + 2, accum_dwheel); if (num_buttons > button_states.length) num_buttons = button_states.length; for (int j = 0; j < num_buttons; j++) { buttons.put(buttons.position() + j, button_states[j]); } if (isGrabbed()) { coord_buffer.put(coord_buffer.position() + 0, accum_dx); coord_buffer.put(coord_buffer.position() + 1, accum_dy); } else { coord_buffer.put(coord_buffer.position() + 0, last_x); coord_buffer.put(coord_buffer.position() + 1, last_y); } accum_dx = accum_dy = accum_dwheel = 0; } private void putMouseEventWithCoords(byte button, byte state, int coord1, int coord2, int dz, long nanos) { mouse_event.clear(); mouse_event.put(button).put(state).putInt(coord1).putInt(coord2).putInt(dz).putLong(nanos); mouse_event.flip(); event_queue.putEvent(mouse_event); } private void putMouseEvent(byte button, byte state, int dz, long nanos) { if (mouse_grabbed) putMouseEventWithCoords(button, state, 0, 0, dz, nanos); else putMouseEventWithCoords(button, state, last_x, last_y, dz, nanos); } public void read(ByteBuffer buffer) { event_queue.copyEvents(buffer); } public Object getBlankCursor() { return blank_cursor; } public void grab(boolean grab, boolean should_center) { if (grab) { if (!mouse_grabbed) { mouse_grabbed = true; if (should_center) { try { WindowsDisplay.setupCursorClipping(hwnd); } catch (LWJGLException e) { LWJGLUtil.log("Failed to setup cursor clipping: " + e); } centerCursor(); } } } else { if (mouse_grabbed) { mouse_grabbed = false; WindowsDisplay.resetCursorClipping(); } } event_queue.clearEvents(); } public void handleMouseScrolled(int event_dwheel, long millis) { accum_dwheel += event_dwheel; putMouseEvent((byte)-1, (byte)0, event_dwheel, millis*1000000); } private void centerCursor() { WindowsDisplay.centerCursor(hwnd); } public void setPosition(int x, int y) { this.last_x = x; this.last_y = y; } public void destroy() { WindowsDisplay.doDestroyCursor(blank_cursor); } public void handleMouseMoved(int x, int y, long millis, boolean should_center) { int dx = x - last_x; int dy = y - last_y; if (dx != 0 || dy != 0) { accum_dx += dx; accum_dy += dy; last_x = x; last_y = y; long nanos = millis*1000000; if (mouse_grabbed) { putMouseEventWithCoords((byte)-1, (byte)0, dx, dy, 0, nanos); if (should_center) centerCursor(); } else { putMouseEventWithCoords((byte)-1, (byte)0, x, y, 0, nanos); } } } public void handleMouseButton(byte button, byte state, long millis) { putMouseEvent(button, state, 0, millis*1000000); if (button < button_states.length) button_states[button] = state != 0 ? (byte)1 : (byte)0; } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/AbstractDrawable.java0000644000175000017500000000355011543426510022676 0ustar zero79zero79package org.lwjgl.opengl; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.PointerBuffer; /** * @author Spasi */ abstract class AbstractDrawable implements DrawableLWJGL { /** Handle to the native GL rendering context */ protected PeerInfo peer_info; /** The OpenGL Context. */ protected Context context; protected AbstractDrawable() { } public Context getContext() { synchronized ( GlobalLock.lock ) { return context; } } public Context createSharedContext() throws LWJGLException { synchronized ( GlobalLock.lock ) { checkDestroyed(); return new Context(peer_info, context.getContextAttribs(), context); } } public boolean isCurrent() throws LWJGLException { synchronized ( GlobalLock.lock ) { checkDestroyed(); return context.isCurrent(); } } public void makeCurrent() throws LWJGLException { synchronized ( GlobalLock.lock ) { checkDestroyed(); context.makeCurrent(); } } public void releaseContext() throws LWJGLException { synchronized ( GlobalLock.lock ) { checkDestroyed(); if ( context.isCurrent() ) Context.releaseCurrentContext(); } } public void destroy() { synchronized ( GlobalLock.lock ) { if ( context == null ) return; try { releaseContext(); context.forceDestroy(); context = null; if ( peer_info != null ) { peer_info.destroy(); peer_info = null; } } catch (LWJGLException e) { LWJGLUtil.log("Exception occurred while destroying Drawable: " + e); } } } public void setCLSharingProperties(final PointerBuffer properties) throws LWJGLException { synchronized ( GlobalLock.lock ) { checkDestroyed(); context.setCLSharingProperties(properties); } } protected final void checkDestroyed() { if ( context == null ) throw new IllegalStateException("The Drawable has no context available."); } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/GLUConstants.java0000644000175000017500000000420311543426510022011 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import static org.lwjgl.opengl.GL11.*; /** *

      * GLU constants. * * @author cix_foo * @version $Revision: 3418 $ * $Id: GLUConstants.java 3418 2010-09-28 21:11:35Z spasi $ */ public interface GLUConstants { /* Errors: (return value 0 = no error) */ int GLU_INVALID_ENUM = 100900; int GLU_INVALID_VALUE = 100901; int GLU_OUT_OF_MEMORY = 100902; int GLU_INCOMPATIBLE_GL_VERSION = 100903; /* StringName */ int GLU_VERSION = 100800; int GLU_EXTENSIONS = 100801; /* Boolean */ int GLU_TRUE = GL_TRUE; int GLU_FALSE = GL_FALSE; } lwjgl-2.7.1/src/java/org/lwjgl/opengl/WindowsRegistry.java0000644000175000017500000000476111543426510022661 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * This is an interface to the windows registry * @author elias_naur */ import org.lwjgl.LWJGLException; import org.lwjgl.Sys; final class WindowsRegistry { static final int HKEY_CLASSES_ROOT = 1; static final int HKEY_CURRENT_USER = 2; static final int HKEY_LOCAL_MACHINE = 3; static final int HKEY_USERS = 4; static { Sys.initialize(); } /** * Query the registry value specified by the root key, subkey, value tuple */ static String queryRegistrationKey(int root_key, String subkey, String value) throws LWJGLException { switch (root_key) { case HKEY_CLASSES_ROOT: case HKEY_CURRENT_USER: case HKEY_LOCAL_MACHINE: case HKEY_USERS: break; default: throw new IllegalArgumentException("Invalid enum: " + root_key); } return nQueryRegistrationKey(root_key, subkey, value); } private static native String nQueryRegistrationKey(int root_key, String subkey, String value) throws LWJGLException; } lwjgl-2.7.1/src/java/org/lwjgl/opengl/WindowsPeerInfo.java0000644000175000017500000000570511543426510022557 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import java.nio.IntBuffer; import org.lwjgl.LWJGLException; /** * * @author elias_naur * @version $Revision: 3116 $ * $Id: WindowsPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ */ abstract class WindowsPeerInfo extends PeerInfo { protected WindowsPeerInfo() { super(createHandle()); } private static native ByteBuffer createHandle(); protected static int choosePixelFormat(long hdc, int origin_x, int origin_y, PixelFormat pixel_format, IntBuffer pixel_format_caps, boolean use_hdc_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException { return nChoosePixelFormat(hdc, origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, support_window, support_pbuffer, double_buffered); } private static native int nChoosePixelFormat(long hdc, int origin_x, int origin_y, PixelFormat pixel_format, IntBuffer pixel_format_caps, boolean use_hdc_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException; protected static native void setPixelFormat(long hdc, int pixel_format) throws LWJGLException; public final long getHdc() { return nGetHdc(getHandle()); } private static native long nGetHdc(ByteBuffer handle); public final long getHwnd() { return nGetHwnd(getHandle()); } private static native long nGetHwnd(ByteBuffer handle); } lwjgl-2.7.1/src/java/org/lwjgl/opengl/ReferencesStack.java0000644000175000017500000000533711543426510022545 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import static org.lwjgl.opengl.GL11.*; class ReferencesStack { private References[] references_stack; private int stack_pos; public References getReferences() { return references_stack[stack_pos]; } public void pushState() { int pos = ++stack_pos; if (pos == references_stack.length) { growStack(); } references_stack[pos].copy(references_stack[pos - 1], GL_ALL_CLIENT_ATTRIB_BITS); } public References popState(int mask) { References result = references_stack[stack_pos--]; references_stack[stack_pos].copy(result, ~mask); result.clear(); return result; } private void growStack() { References[] new_references_stack = new References[references_stack.length + 1]; System.arraycopy(references_stack, 0, new_references_stack, 0, references_stack.length); references_stack = new_references_stack; references_stack[references_stack.length - 1] = new References(GLContext.getCapabilities()); } ReferencesStack() { ContextCapabilities caps = GLContext.getCapabilities(); references_stack = new References[1]; stack_pos = 0; for (int i = 0; i < references_stack.length; i++) references_stack[i] = new References(caps); } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/OpenGLException.java0000644000175000017500000000536611543426510022503 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** *

      * Thrown by the debug build library of the LWJGL if any OpenGL operation causes an error. * * @author cix_foo * @version $Revision: 2983 $ * $Id: OpenGLException.java 2983 2008-04-07 18:36:09Z matzon $ */ public class OpenGLException extends RuntimeException { private static final long serialVersionUID = 1L; /** Constructor for OpenGLException. */ public OpenGLException(int gl_error_code) { this(createErrorMessage(gl_error_code)); } private static String createErrorMessage(int gl_error_code) { String error_string = Util.translateGLErrorString(gl_error_code); return error_string + " (" + gl_error_code + ")"; } /** Constructor for OpenGLException. */ public OpenGLException() { super(); } /** * Constructor for OpenGLException. * * @param message */ public OpenGLException(String message) { super(message); } /** * Constructor for OpenGLException. * * @param message * @param cause */ public OpenGLException(String message, Throwable cause) { super(message, cause); } /** * Constructor for OpenGLException. * * @param cause */ public OpenGLException(Throwable cause) { super(cause); } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/MacOSXContextAttribs.java0000644000175000017500000000625411543426510023465 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * An implementation of ContextAttribs for MacOS X. *

      * ---- WIP - No XGL_create_context has been defined for MacOS X yet ---- * * @author spasi */ final class MacOSXContextAttribs implements ContextAttribsImplementation { private static final int XGL_CONTEXT_MAJOR_VERSION_ARB = 0x2091; private static final int XGL_CONTEXT_MINOR_VERSION_ARB = 0x2092; private static final int XGL_CONTEXT_LAYER_PLANE_ARB = 0x2093; private static final int XGL_CONTEXT_FLAGS_ARB = 0x2094; private static final int XGL_CONTEXT_PROFILE_MASK_ARB = 0x9126; private static final int XGL_CONTEXT_DEBUG_BIT_ARB = 0x0001; private static final int XGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002; private static final int XGL_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001; private static final int XGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002; MacOSXContextAttribs() { } public int getMajorVersionAttrib() { return XGL_CONTEXT_MAJOR_VERSION_ARB; } public int getMinorVersionAttrib() { return XGL_CONTEXT_MINOR_VERSION_ARB; } public int getLayerPlaneAttrib() { return XGL_CONTEXT_LAYER_PLANE_ARB; } public int getFlagsAttrib() { return XGL_CONTEXT_FLAGS_ARB; } public int getDebugBit() { return XGL_CONTEXT_DEBUG_BIT_ARB; } public int getForwardCompatibleBit() { return XGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; } public int getProfileMaskAttrib() { return XGL_CONTEXT_PROFILE_MASK_ARB; } public int getProfileCoreBit() { return XGL_CONTEXT_CORE_PROFILE_BIT_ARB; } public int getProfileCompatibilityBit() { return XGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; } }lwjgl-2.7.1/src/java/org/lwjgl/opengl/MacOSXPbufferPeerInfo.java0000644000175000017500000000457711543426510023537 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; /** * * @author elias_naur * @version $Revision: 3116 $ * $Id: MacOSXPbufferPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ */ final class MacOSXPbufferPeerInfo extends MacOSXPeerInfo { MacOSXPbufferPeerInfo(int width, int height, PixelFormat pixel_format) throws LWJGLException { super(pixel_format, false, false, true, false); nCreate(getHandle(), width, height); } private static native void nCreate(ByteBuffer handle, int width, int height) throws LWJGLException; public void destroy() { nDestroy(getHandle()); } private static native void nDestroy(ByteBuffer handle); protected void doLockAndInitHandle() throws LWJGLException { // NO-OP } protected void doUnlock() throws LWJGLException { // NO-OP } } lwjgl-2.7.1/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java0000644000175000017500000000546511543426510024162 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import java.awt.Canvas; /** * * @author elias_naur * @version $Revision: 3116 $ * $Id: LinuxAWTGLCanvasPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ */ final class LinuxAWTGLCanvasPeerInfo extends LinuxPeerInfo { private final Canvas component; private final AWTSurfaceLock awt_surface = new AWTSurfaceLock(); private int screen = -1; LinuxAWTGLCanvasPeerInfo(Canvas component) { this.component = component; } protected void doLockAndInitHandle() throws LWJGLException { ByteBuffer surface_handle = awt_surface.lockAndGetHandle(component); if (screen == -1) { try { screen = getScreenFromSurfaceInfo(surface_handle); } catch (LWJGLException e) { LWJGLUtil.log("Got exception while trying to determine screen: " + e); screen = 0; } } nInitHandle(screen, surface_handle, getHandle()); } private static native int getScreenFromSurfaceInfo(ByteBuffer surface_handle) throws LWJGLException; private static native void nInitHandle(int screen, ByteBuffer surface_buffer, ByteBuffer peer_info_handle) throws LWJGLException; protected void doUnlock() throws LWJGLException { awt_surface.unlock(); } } lwjgl-2.7.1/src/java/org/lwjgl/LWJGLUtil.java0000644000175000017500000010366011543426510017725 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl; import java.io.File; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.nio.ByteBuffer; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.*; /** *

      * Internal library methods *

      * * @author Brian Matzon * @version $Revision: 3475 $ * $Id: LWJGLUtil.java 3475 2011-01-23 07:48:50Z matzon $ */ public class LWJGLUtil { public static final int PLATFORM_LINUX = 1; public static final int PLATFORM_MACOSX = 2; public static final int PLATFORM_WINDOWS = 3; public static final String PLATFORM_LINUX_NAME = "linux"; public static final String PLATFORM_MACOSX_NAME = "macosx"; public static final String PLATFORM_WINDOWS_NAME = "windows"; /** LWJGL Logo - 16 by 16 pixels */ public static final ByteBuffer LWJGLIcon16x16 = BufferUtils.createByteBuffer(16 * 16 * 4).put(new byte[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -62, -41, -24, -1, 116, -92, -53, -1, 80, -117, -67, -1, 84, -114, -65, -1, -122, -81, -46, -1, -25, -17, -10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -11, -11, -11, -1, -115, -113, -111, -1, 118, -126, -115, -1, 125, -115, -101, -1, -124, -103, -86, -1, -108, -73, -43, -1, 58, 125, -75, -1, 72, -122, -70, -1, -38, -25, -15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -12, -8, -5, -1, -100, -98, -96, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -28, -28, -28, -1, -124, -83, -48, -1, 58, 125, -75, -1, 91, -110, -63, -1, -4, -3, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -111, -74, -43, -1, 95, 95, 95, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 34, 34, 34, -1, -1, -1, -1, -1, -24, -16, -10, -1, 57, 124, -75, -1, 58, 125, -75, -1, -60, -40, -23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -58, -39, -23, -1, -127, -85, -50, -1, 29, 29, 29, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 102, 102, 102, -1, -1, -1, -1, -1, -48, -32, -19, -1, 58, 125, -75, -1, 58, 125, -75, -1, -115, -76, -44, -1, -1, -1, -1, -1, -14, -14, -14, -1, -91, -91, -91, -1, -33, -33, -33, -1, -94, -63, -36, -1, -80, -59, -42, -1, 10, 10, 10, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -88, -88, -88, -1, -1, -1, -1, -1, -105, -70, -40, -1, 58, 125, -75, -1, 58, 125, -75, -1, 113, -95, -54, -1, -1, -1, -1, -1, -95, -95, -95, -1, 0, 0, 0, -1, 1, 1, 1, -1, 35, 35, 35, -1, -52, -52, -52, -1, -48, -48, -48, -1, -91, -91, -91, -1, -124, -124, -124, -1, 92, 92, 92, -1, -17, -17, -17, -1, -1, -1, -1, -1, 96, -106, -61, -1, 58, 125, -75, -1, 58, 125, -75, -1, 109, -98, -56, -1, -1, -1, -1, -1, 94, 94, 94, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -49, -49, -49, -1, 31, 31, 31, -1, 3, 3, 3, -1, 43, 43, 43, -1, 108, 108, 108, -1, -58, -58, -58, -1, -6, -4, -3, -1, -98, -65, -38, -1, 119, -91, -52, -1, 76, -119, -68, -1, 124, -88, -50, -1, -1, -1, -1, -1, 27, 27, 27, -1, 0, 0, 0, -1, 0, 0, 0, -1, 23, 23, 23, -1, -42, -42, -42, -1, 1, 1, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 82, 82, 82, -1, -27, -27, -27, -1, 61, 61, 61, -1, 104, 104, 104, -1, -90, -90, -89, -1, -38, -34, -31, -1, -1, -1, -1, -1, 116, 116, 116, -1, 14, 14, 14, -1, 0, 0, 0, -1, 89, 89, 89, -1, -107, -107, -107, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -111, -111, -111, -1, -101, -101, -101, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 2, 2, 2, -1, 67, 67, 67, -1, -1, -1, -1, -1, -18, -18, -18, -1, -116, -116, -116, -1, -65, -65, -65, -1, 86, 86, 86, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -45, -45, -45, -1, 88, 88, 88, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 51, 51, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -4, -3, -2, -1, -1, -1, -1, -1, -64, -64, -64, -1, 64, 64, 64, -1, 2, 2, 2, -1, 0, 0, 0, -1, 27, 27, 27, -1, -5, -5, -5, -1, 23, 23, 23, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 120, 120, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -46, -31, -18, -1, 126, -87, -50, -1, -32, -22, -13, -1, -1, -1, -1, -1, -44, -44, -44, -1, 109, 109, 109, -1, -124, -124, -124, -1, -45, -45, -45, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -67, -67, -67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -1, 102, -102, -59, -1, 61, 127, -74, -1, -126, -84, -48, -1, -28, -19, -11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -27, -27, -27, -1, 45, 45, 45, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 12, 12, 12, -1, -10, -10, -10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -30, -20, -12, -1, 77, -119, -68, -1, 58, 125, -75, -1, 62, -128, -74, -1, -121, -80, -46, -1, -25, -17, -10, -1, -1, -1, -1, -1, -2, -2, -2, -1, -68, -68, -68, -1, 79, 79, 79, -1, 3, 3, 3, -1, 74, 74, 74, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -21, -14, -8, -1, -116, -77, -44, -1, 86, -112, -64, -1, 80, -116, -67, -1, 119, -91, -52, -1, -19, -13, -8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -33, -33, -33, -1, -26, -26, -26, -1, -1, -1, -1, -1 }); /** LWJGL Logo - 32 by 32 pixels */ public static final ByteBuffer LWJGLIcon32x32 = BufferUtils.createByteBuffer(32 * 32 * 4).put(new byte[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -6, -4, -3, -1, -53, -35, -20, -1, -109, -73, -42, -1, 111, -96, -55, -1, 92, -109, -62, -1, 96, -106, -61, -1, 122, -89, -51, -1, -84, -56, -32, -1, -19, -13, -8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -4, -3, -2, -1, -75, -50, -29, -1, 90, -110, -63, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 69, -123, -71, -1, -95, -63, -36, -1, -4, -3, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -4, -4, -4, -1, -30, -22, -15, -1, -72, -49, -29, -1, -82, -55, -32, -1, -93, -62, -36, -1, -104, -70, -40, -1, -116, -77, -45, -1, -127, -84, -49, -1, 110, -97, -56, -1, 61, 127, -74, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 114, -94, -54, -1, -11, -8, -5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -40, -40, -40, -1, 49, 49, 49, -1, 36, 36, 36, -1, 49, 49, 49, -1, 64, 64, 64, -1, 82, 82, 82, -1, 101, 101, 101, -1, 116, 116, 116, -1, -113, -113, -113, -1, -9, -8, -8, -1, -84, -56, -33, -1, 59, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 121, -89, -51, -1, -4, -3, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -1, 104, 104, 104, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -74, -74, -74, -1, -2, -2, -2, -1, -122, -82, -47, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, -82, -54, -31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -45, -30, -18, -1, -31, -22, -14, -1, 40, 40, 40, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 2, 2, 2, -1, -34, -34, -34, -1, -1, -1, -1, -1, -11, -8, -5, -1, 91, -110, -63, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 72, -122, -70, -1, -12, -8, -5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -20, -13, -8, -1, 100, -103, -59, -1, -41, -39, -37, -1, 5, 5, 5, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 36, 36, 36, -1, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -64, -43, -25, -1, 57, 124, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, -85, -56, -32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, 120, -90, -52, -1, 123, -89, -51, -1, -98, -98, -98, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 101, 101, 101, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -30, -20, -12, -1, 55, 123, -76, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 102, -102, -59, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -61, -41, -24, -1, 57, 125, -75, -1, -78, -52, -31, -1, 88, 88, 88, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -87, -87, -87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -68, -46, -27, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 64, -127, -73, -1, -18, -12, -7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -6, -4, -3, -1, 90, -110, -63, -1, 61, 127, -74, -1, -35, -27, -19, -1, 28, 28, 28, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 7, 7, 7, -1, -25, -25, -25, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -123, -82, -47, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 57, 125, -75, -1, -52, -34, -20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -70, -46, -27, -1, 58, 125, -75, -1, 87, -112, -65, -1, -48, -47, -47, -1, 3, 3, 3, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 51, 51, 51, -1, -3, -3, -3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -5, -4, -3, -1, 80, -117, -67, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 57, 125, -75, -1, -79, -52, -30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -54, -54, -54, -1, 55, 55, 55, -1, 97, 97, 97, -1, -94, -94, -94, -1, -35, -35, -35, -1, -28, -20, -13, -1, -79, -53, -31, -1, -76, -51, -30, -1, -26, -26, -26, -1, 35, 35, 35, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 114, 114, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -40, -27, -16, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, -96, -64, -37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 102, 102, 102, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 6, 6, 6, -1, 39, 39, 39, -1, 102, 102, 102, -1, -44, -44, -44, -1, -1, -1, -1, -1, -10, -10, -10, -1, -48, -48, -48, -1, -105, -105, -105, -1, 94, 94, 94, -1, 39, 39, 39, -1, 4, 4, 4, -1, 0, 0, 0, -1, 3, 3, 3, -1, -64, -64, -64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -94, -63, -37, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, -98, -65, -38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -5, -5, -5, -1, 37, 37, 37, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 92, 92, 92, -1, -1, -1, -1, -1, -22, -22, -22, -1, -113, -113, -113, -1, -75, -75, -75, -1, -23, -23, -23, -1, -3, -3, -3, -1, -25, -25, -25, -1, -78, -78, -78, -1, -67, -67, -67, -1, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, -99, -57, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, -95, -63, -36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -37, -37, -37, -1, 3, 3, 3, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -125, -125, -125, -1, -1, -1, -1, -1, 95, 95, 95, -1, 0, 0, 0, -1, 0, 0, 0, -1, 11, 11, 11, -1, 55, 55, 55, -1, 118, 118, 118, -1, -73, -73, -73, -1, -16, -16, -16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -16, -11, -7, -1, 75, -120, -69, -1, 61, 127, -74, -1, 57, 124, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, -78, -52, -30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -102, -102, -102, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -59, -59, -59, -1, -9, -9, -9, -1, 29, 29, 29, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 7, 7, 7, -1, 60, 60, 60, -1, -33, -33, -33, -1, -1, -1, -1, -1, -5, -4, -3, -1, -4, -3, -2, -1, -13, -9, -6, -1, -52, -35, -21, -1, -98, -66, -38, -1, 114, -95, -55, -1, 76, -119, -69, -1, 58, 125, -75, -1, -55, -36, -21, -1, -1, -1, -1, -1, -1, -1, -1, -1, 86, 86, 86, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 15, 15, 15, -1, -7, -7, -7, -1, -47, -47, -47, -1, 3, 3, 3, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -114, -114, -114, -1, -1, -1, -1, -1, -7, -7, -7, -1, -124, -124, -124, -1, 112, 112, 112, -1, -80, -80, -80, -1, -22, -22, -22, -1, -1, -1, -1, -1, -7, -5, -4, -1, -36, -24, -14, -1, -10, -7, -4, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, 21, 21, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 78, 78, 78, -1, -1, -1, -1, -1, -111, -111, -111, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -69, -69, -69, -1, -1, -1, -1, -1, -98, -98, -98, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 4, 4, 4, -1, 47, 47, 47, -1, 112, 112, 112, -1, -80, -80, -80, -1, -26, -26, -26, -1, -2, -2, -2, -1, -1, -1, -1, -1, 57, 57, 57, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -112, -112, -112, -1, -1, -1, -1, -1, 77, 77, 77, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 16, 16, 16, -1, -16, -16, -16, -1, -1, -1, -1, -1, 90, 90, 90, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 9, 9, 9, -1, 50, 50, 50, -1, -79, -79, -79, -1, -10, -10, -10, -1, -95, -95, -95, -1, 53, 53, 53, -1, 2, 2, 2, -1, 0, 0, 0, -1, 0, 0, 0, -1, 2, 2, 2, -1, -47, -47, -47, -1, -11, -11, -11, -1, 19, 19, 19, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 69, 69, 69, -1, -2, -2, -2, -1, -8, -8, -8, -1, 29, 29, 29, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 43, 43, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -4, -4, -4, -1, -66, -66, -66, -1, 80, 80, 80, -1, 5, 5, 5, -1, 37, 37, 37, -1, -7, -7, -7, -1, -62, -62, -62, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -122, -122, -122, -1, -1, -1, -1, -1, -46, -46, -46, -1, 1, 1, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 67, 67, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -1, -36, -36, -36, -1, -32, -32, -32, -1, -1, -1, -1, -1, -107, -107, -107, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 1, 1, 1, -1, -56, -56, -56, -1, -1, -1, -1, -1, -114, -114, -114, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -120, -120, -120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -33, -33, -33, -1, 41, 41, 41, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 24, 24, 24, -1, -11, -11, -11, -1, -1, -1, -1, -1, 74, 74, 74, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -49, -49, -49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -15, -10, -6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -7, -7, -7, -1, -75, -75, -75, -1, 75, 75, 75, -1, 6, 6, 6, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 82, 82, 82, -1, -1, -1, -1, -1, -8, -8, -8, -1, 16, 16, 16, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 28, 28, 28, -1, -8, -8, -8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -122, -81, -47, -1, -112, -75, -43, -1, -22, -15, -9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -37, -37, -37, -1, 120, 120, 120, -1, 27, 27, 27, -1, 0, 0, 0, -1, 0, 0, 0, -1, -106, -106, -106, -1, -1, -1, -1, -1, -58, -58, -58, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 90, 90, 90, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -61, -40, -23, -1, 58, 125, -75, -1, 67, -125, -72, -1, -108, -72, -42, -1, -19, -13, -8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -12, -12, -12, -1, -89, -89, -89, -1, -123, -123, -123, -1, -12, -12, -12, -1, -1, -1, -1, -1, -122, -122, -122, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -99, -99, -99, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -6, -5, -3, -1, 93, -108, -62, -1, 58, 125, -75, -1, 58, 125, -75, -1, 70, -123, -71, -1, -104, -69, -40, -1, -17, -12, -7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -101, -101, -101, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 5, 5, 5, -1, -35, -35, -35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -59, -39, -23, -1, 59, 126, -74, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 72, -122, -70, -1, -98, -66, -38, -1, -14, -10, -6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -5, -5, -5, -1, -114, -114, -114, -1, 37, 37, 37, -1, 1, 1, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 44, 44, 44, -1, -4, -4, -4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -113, -75, -43, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 74, -121, -69, -1, -93, -62, -36, -1, -13, -9, -6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -6, -6, -6, -1, -80, -80, -80, -1, 69, 69, 69, -1, 4, 4, 4, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 110, 110, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -4, -3, -2, -1, -123, -81, -47, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 77, -119, -68, -1, -88, -59, -34, -1, -10, -7, -4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -1, -46, -46, -46, -1, 104, 104, 104, -1, 14, 14, 14, -1, 0, 0, 0, -1, 1, 1, 1, -1, -72, -72, -72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -1, -1, -79, -53, -30, -1, 76, -119, -68, -1, 57, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 77, -119, -68, -1, -65, -44, -25, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -20, -20, -20, -1, -109, -109, -109, -1, -101, -101, -101, -1, -3, -3, -3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -13, -9, -6, -1, -75, -50, -29, -1, -127, -84, -48, -1, 101, -103, -59, -1, 97, -105, -60, -1, 108, -98, -56, -1, -113, -75, -43, -1, -59, -39, -23, -1, -9, -6, -4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }); /** Debug flag. */ public static final boolean DEBUG = getPrivilegedBoolean("org.lwjgl.util.Debug"); public static final boolean CHECKS = !getPrivilegedBoolean("org.lwjgl.util.NoChecks"); private static final int PLATFORM; static { LWJGLIcon16x16.flip(); LWJGLIcon32x32.flip(); final String osName = getPrivilegedProperty("os.name"); if ( osName.startsWith("Windows") ) PLATFORM = PLATFORM_WINDOWS; else if ( osName.startsWith("Linux") || osName.startsWith("FreeBSD") || osName.startsWith("SunOS") ) PLATFORM = PLATFORM_LINUX; else if ( osName.startsWith("Mac OS X") || osName.startsWith("Darwin") ) PLATFORM = PLATFORM_MACOSX; else throw new LinkageError("Unknown platform: " + osName); } /** * @see #PLATFORM_WINDOWS * @see #PLATFORM_LINUX * @see #PLATFORM_MACOSX * @return the current platform type */ public static int getPlatform() { return PLATFORM; } /** * @see #PLATFORM_WINDOWS_NAME * @see #PLATFORM_LINUX_NAME * @see #PLATFORM_MACOSX_NAME * @return current platform name */ public static String getPlatformName() { switch (LWJGLUtil.getPlatform()) { case LWJGLUtil.PLATFORM_LINUX: return PLATFORM_LINUX_NAME; case LWJGLUtil.PLATFORM_MACOSX: return PLATFORM_MACOSX_NAME; case LWJGLUtil.PLATFORM_WINDOWS: return PLATFORM_WINDOWS_NAME; default: return "unknown"; } } /** * Locates the paths required by a library. * * @param libname Local Library Name to search the classloader with ("openal"). * @param platform_lib_name The native library name ("libopenal.so") * @param classloader The classloader to ask for library paths * @return Paths to located libraries, if any */ public static String[] getLibraryPaths(String libname, String platform_lib_name, ClassLoader classloader) { return getLibraryPaths(libname, new String[]{platform_lib_name}, classloader); } /** * Locates the paths required by a library. * * @param libname Local Library Name to search the classloader with ("openal"). * @param platform_lib_names The list of possible library names ("libopenal.so") * @param classloader The classloader to ask for library paths * @return Paths to located libraries, if any */ public static String[] getLibraryPaths(String libname, String[] platform_lib_names, ClassLoader classloader) { // need to pass path of possible locations of library to native side List possible_paths = new ArrayList(); String classloader_path = getPathFromClassLoader(libname, classloader); if (classloader_path != null) { log("getPathFromClassLoader: Path found: " + classloader_path); possible_paths.add(classloader_path); } for ( String platform_lib_name : platform_lib_names ) { String lwjgl_classloader_path = getPathFromClassLoader("lwjgl", classloader); if ( lwjgl_classloader_path != null ) { log("getPathFromClassLoader: Path found: " + lwjgl_classloader_path); possible_paths.add(lwjgl_classloader_path.substring(0, lwjgl_classloader_path.lastIndexOf(File.separator)) + File.separator + platform_lib_name); } // add Installer path String alternative_path = getPrivilegedProperty("org.lwjgl.librarypath"); if ( alternative_path != null ) { possible_paths.add(alternative_path + File.separator + platform_lib_name); } // Add all possible paths from java.library.path String java_library_path = getPrivilegedProperty("java.library.path"); StringTokenizer st = new StringTokenizer(java_library_path, File.pathSeparator); while ( st.hasMoreTokens() ) { String path = st.nextToken(); possible_paths.add(path + File.separator + platform_lib_name); } //add current path String current_dir = getPrivilegedProperty("user.dir"); possible_paths.add(current_dir + File.separator + platform_lib_name); //add pure library (no path, let OS search) possible_paths.add(platform_lib_name); } //create needed string array return possible_paths.toArray(new String[possible_paths.size()]); } static void execPrivileged(final String[] cmd_array) throws Exception { try { Process process = AccessController.doPrivileged(new PrivilegedExceptionAction() { public Process run() throws Exception { return Runtime.getRuntime().exec(cmd_array); } }); // Close unused streams to make sure the child process won't hang process.getInputStream().close(); process.getOutputStream().close(); process.getErrorStream().close(); } catch (PrivilegedActionException e) { throw (Exception)e.getCause(); } } private static String getPrivilegedProperty(final String property_name) { return AccessController.doPrivileged(new PrivilegedAction() { public String run() { return System.getProperty(property_name); } }); } /** * Tries to locate named library from the current ClassLoader * This method exists because native libraries are loaded from native code, and as such * is exempt from ClassLoader library loading rutines. It therefore always fails. * We therefore invoke the protected method of the ClassLoader to see if it can * locate it. * * @param libname Name of library to search for * @param classloader Classloader to use * @return Absolute path to library if found, otherwise null */ private static String getPathFromClassLoader(final String libname, final ClassLoader classloader) { try { log("getPathFromClassLoader: searching for: " + libname); Class c = classloader.getClass(); while (c != null) { final Class clazz = c; try { return AccessController.doPrivileged(new PrivilegedExceptionAction() { public String run() throws Exception { Method findLibrary = clazz.getDeclaredMethod("findLibrary", String.class); findLibrary.setAccessible(true); String path = (String)findLibrary.invoke(classloader, libname); return path; } }); } catch (PrivilegedActionException e) { log("Failed to locate findLibrary method: " + e.getCause()); c = c.getSuperclass(); } } } catch (Exception e) { log("Failure locating " + e + " using classloader:" + e); } return null; } /** * Gets a boolean property as a privileged action. */ private static boolean getPrivilegedBoolean(final String property_name) { Boolean value = AccessController.doPrivileged(new PrivilegedAction() { public Boolean run() { return Boolean.getBoolean(property_name); } }); return value; } /** * Prints the given message to System.err if DEBUG is true. * * @param msg Message to print */ public static void log(String msg) { if (DEBUG) { System.err.println(msg); } } /** * Method to determine if the current system is running a version of * Mac OS X better than the given version. This is only useful for Mac OS X * specific code and will not work for any other platform. */ public static boolean isMacOSXEqualsOrBetterThan(int major_required, int minor_required) { String os_version = getPrivilegedProperty("os.version"); StringTokenizer version_tokenizer = new StringTokenizer(os_version, "."); int major; int minor; try { String major_str = version_tokenizer.nextToken(); String minor_str = version_tokenizer.nextToken(); major = Integer.parseInt(major_str); minor = Integer.parseInt(minor_str); } catch (Exception e) { LWJGLUtil.log("Exception occurred while trying to determine OS version: " + e); // Best guess, no return false; } return major > major_required || (major == major_required && minor >= minor_required); } /** * Returns a map of public static final integer fields in the specified classes, to their String representations. * An optional filter can be specified to only include specific fields. The target map may be null, in which * case a new map is allocated and returned. *

      * This method is useful when debugging to quickly identify values returned from the AL/GL/CL APIs. * * @param filter the filter to use (optional) * @param target the target map (optional) * @param tokenClasses an array of classes to get tokens from * * @return the token map */ public static Map getClassTokens(final TokenFilter filter, final Map target, final Class ... tokenClasses) { return getClassTokens(filter, target, Arrays.asList(tokenClasses)); } /** * Returns a map of public static final integer fields in the specified classes, to their String representations. * An optional filter can be specified to only include specific fields. The target map may be null, in which * case a new map is allocated and returned. *

      * This method is useful when debugging to quickly identify values returned from the AL/GL/CL APIs. * * @param filter the filter to use (optional) * @param target the target map (optional) * @param tokenClasses the classes to get tokens from * * @return the token map */ public static Map getClassTokens(final TokenFilter filter, Map target, final Iterable tokenClasses) { if ( target == null ) target = new HashMap(); final int TOKEN_MODIFIERS = Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL; for ( final Class tokenClass : tokenClasses ) { for ( final Field field : tokenClass.getDeclaredFields() ) { // Get only fields. if ( (field.getModifiers() & TOKEN_MODIFIERS) == TOKEN_MODIFIERS && field.getType() == int.class ) { try { final int value = field.getInt(null); if ( filter != null && !filter.accept(field, value) ) continue; if ( target.containsKey(value) ) // Print colliding tokens in their hex representation. target.put(value, toHexString(value)); else target.put(value, field.getName()); } catch (IllegalAccessException e) { // Ignore } } } } return target; } /** * Returns a string representation of the integer argument as an * unsigned integer in base 16. The string will be uppercase * and will have a leading '0x'. * * @param value the integer value * * @return the hex string representation */ public static String toHexString(final int value) { return "0x" + Integer.toHexString(value).toUpperCase(); } /** Simple interface for Field filtering. */ public interface TokenFilter { /** * Should return true if the specified Field passes the filter. * * @param field the Field to test * @param value the integer value of the field * * @result true if the Field is accepted */ boolean accept(Field field, int value); } }lwjgl-2.7.1/src/java/org/lwjgl/MacOSXSysImplementation.java0000644000175000017500000000444511543426510022710 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl; import java.awt.Toolkit; import com.apple.eio.FileManager; /** * * @author elias_naur * @version $Revision: 3418 $ * $Id: MacOSXSysImplementation.java 3418 2010-09-28 21:11:35Z spasi $ */ final class MacOSXSysImplementation extends J2SESysImplementation { private static final int JNI_VERSION = 19; static { // Make sure AWT is properly initialized. This avoids hangs on Mac OS X 10.3 Toolkit.getDefaultToolkit(); } public int getRequiredJNIVersion() { return JNI_VERSION; } public boolean openURL(String url) { try { FileManager.openURL(url); return true; } catch (Exception e) { LWJGLUtil.log("Exception occurred while trying to invoke browser: " + e); return false; } } } lwjgl-2.7.1/src/java/org/lwjgl/NondirectBufferWrapper.java0000644000175000017500000003143211543426510022625 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl; import java.nio.ByteBuffer; import java.nio.ShortBuffer; import java.nio.IntBuffer; import java.nio.FloatBuffer; import java.nio.LongBuffer; import java.nio.DoubleBuffer; import java.nio.ByteOrder; /** * Utility class to cache thread local direct buffers so when we are passed a non-direct buffer, * we can put its contents into a cached direct buffer and use that at the native side instead. * * Internal class, don't use. * @author elias_naur * @version $Revision: 2762 $ * $Id: BufferChecks.java 2762 2007-04-11 16:13:05Z elias_naur $ */ public final class NondirectBufferWrapper { private static final int INITIAL_BUFFER_SIZE = 1; private static final ThreadLocal thread_buffer = new ThreadLocal() { protected CachedBuffers initialValue() { return new CachedBuffers(INITIAL_BUFFER_SIZE); } }; private static CachedBuffers getCachedBuffers(int minimum_byte_size) { CachedBuffers buffers = thread_buffer.get(); int current_byte_size = buffers.byte_buffer.capacity(); if (minimum_byte_size > current_byte_size) { buffers = new CachedBuffers(minimum_byte_size); thread_buffer.set(buffers); } return buffers; } public static ByteBuffer wrapNoCopyBuffer(ByteBuffer buf, int size) { BufferChecks.checkBufferSize(buf, size); return wrapNoCopyDirect(buf); } public static ShortBuffer wrapNoCopyBuffer(ShortBuffer buf, int size) { BufferChecks.checkBufferSize(buf, size); return wrapNoCopyDirect(buf); } public static IntBuffer wrapNoCopyBuffer(IntBuffer buf, int size) { BufferChecks.checkBufferSize(buf, size); return wrapNoCopyDirect(buf); } public static LongBuffer wrapNoCopyBuffer(LongBuffer buf, int size) { BufferChecks.checkBufferSize(buf, size); return wrapNoCopyDirect(buf); } public static FloatBuffer wrapNoCopyBuffer(FloatBuffer buf, int size) { BufferChecks.checkBufferSize(buf, size); return wrapNoCopyDirect(buf); } public static DoubleBuffer wrapNoCopyBuffer(DoubleBuffer buf, int size) { BufferChecks.checkBufferSize(buf, size); return wrapNoCopyDirect(buf); } public static ByteBuffer wrapBuffer(ByteBuffer buf, int size) { BufferChecks.checkBufferSize(buf, size); return wrapDirect(buf); } public static ShortBuffer wrapBuffer(ShortBuffer buf, int size) { BufferChecks.checkBufferSize(buf, size); return wrapDirect(buf); } public static IntBuffer wrapBuffer(IntBuffer buf, int size) { BufferChecks.checkBufferSize(buf, size); return wrapDirect(buf); } public static LongBuffer wrapBuffer(LongBuffer buf, int size) { BufferChecks.checkBufferSize(buf, size); return wrapDirect(buf); } public static FloatBuffer wrapBuffer(FloatBuffer buf, int size) { BufferChecks.checkBufferSize(buf, size); return wrapDirect(buf); } public static DoubleBuffer wrapBuffer(DoubleBuffer buf, int size) { BufferChecks.checkBufferSize(buf, size); return wrapDirect(buf); } public static ByteBuffer wrapDirect(ByteBuffer buffer) { if (!buffer.isDirect()) return doWrap(buffer); return buffer; } public static ShortBuffer wrapDirect(ShortBuffer buffer) { if (!buffer.isDirect()) return doWrap(buffer); return buffer; } public static FloatBuffer wrapDirect(FloatBuffer buffer) { if (!buffer.isDirect()) return doWrap(buffer); return buffer; } public static IntBuffer wrapDirect(IntBuffer buffer) { if (!buffer.isDirect()) return doWrap(buffer); return buffer; } public static LongBuffer wrapDirect(LongBuffer buffer) { if (!buffer.isDirect()) return doWrap(buffer); return buffer; } public static DoubleBuffer wrapDirect(DoubleBuffer buffer) { if (!buffer.isDirect()) return doWrap(buffer); return buffer; } public static ByteBuffer wrapNoCopyDirect(ByteBuffer buffer) { if (!buffer.isDirect()) return doNoCopyWrap(buffer); return buffer; } public static ShortBuffer wrapNoCopyDirect(ShortBuffer buffer) { if (!buffer.isDirect()) return doNoCopyWrap(buffer); return buffer; } public static FloatBuffer wrapNoCopyDirect(FloatBuffer buffer) { if (!buffer.isDirect()) return doNoCopyWrap(buffer); return buffer; } public static IntBuffer wrapNoCopyDirect(IntBuffer buffer) { if (!buffer.isDirect()) return doNoCopyWrap(buffer); return buffer; } public static LongBuffer wrapNoCopyDirect(LongBuffer buffer) { if (!buffer.isDirect()) return doNoCopyWrap(buffer); return buffer; } public static DoubleBuffer wrapNoCopyDirect(DoubleBuffer buffer) { if (!buffer.isDirect()) return doNoCopyWrap(buffer); return buffer; } public static void copy(ByteBuffer src, ByteBuffer dst) { if (dst != null && !dst.isDirect()) { int saved_position = dst.position(); dst.put(src); dst.position(saved_position); } } public static void copy(ShortBuffer src, ShortBuffer dst) { if (dst != null && !dst.isDirect()) { int saved_position = dst.position(); dst.put(src); dst.position(saved_position); } } public static void copy(IntBuffer src, IntBuffer dst) { if (dst != null && !dst.isDirect()) { int saved_position = dst.position(); dst.put(src); dst.position(saved_position); } } public static void copy(FloatBuffer src, FloatBuffer dst) { if (dst != null && !dst.isDirect()) { int saved_position = dst.position(); dst.put(src); dst.position(saved_position); } } public static void copy(LongBuffer src, LongBuffer dst) { if (dst != null && !dst.isDirect()) { int saved_position = dst.position(); dst.put(src); dst.position(saved_position); } } public static void copy(DoubleBuffer src, DoubleBuffer dst) { if (dst != null && !dst.isDirect()) { int saved_position = dst.position(); dst.put(src); dst.position(saved_position); } } private static ByteBuffer doNoCopyWrap(ByteBuffer buffer) { ByteBuffer direct_buffer = lookupBuffer(buffer); direct_buffer.limit(buffer.limit()); direct_buffer.position(buffer.position()); return direct_buffer; } private static ShortBuffer doNoCopyWrap(ShortBuffer buffer) { ShortBuffer direct_buffer = lookupBuffer(buffer); direct_buffer.limit(buffer.limit()); direct_buffer.position(buffer.position()); return direct_buffer; } private static IntBuffer doNoCopyWrap(IntBuffer buffer) { IntBuffer direct_buffer = lookupBuffer(buffer); direct_buffer.limit(buffer.limit()); direct_buffer.position(buffer.position()); return direct_buffer; } private static FloatBuffer doNoCopyWrap(FloatBuffer buffer) { FloatBuffer direct_buffer = lookupBuffer(buffer); direct_buffer.limit(buffer.limit()); direct_buffer.position(buffer.position()); return direct_buffer; } private static LongBuffer doNoCopyWrap(LongBuffer buffer) { LongBuffer direct_buffer = lookupBuffer(buffer); direct_buffer.limit(buffer.limit()); direct_buffer.position(buffer.position()); return direct_buffer; } private static DoubleBuffer doNoCopyWrap(DoubleBuffer buffer) { DoubleBuffer direct_buffer = lookupBuffer(buffer); direct_buffer.limit(buffer.limit()); direct_buffer.position(buffer.position()); return direct_buffer; } private static ByteBuffer lookupBuffer(ByteBuffer buffer) { return getCachedBuffers(buffer.remaining()).byte_buffer; } private static ByteBuffer doWrap(ByteBuffer buffer) { ByteBuffer direct_buffer = lookupBuffer(buffer); direct_buffer.clear(); int saved_position = buffer.position(); direct_buffer.put(buffer); buffer.position(saved_position); direct_buffer.flip(); return direct_buffer; } private static ShortBuffer lookupBuffer(ShortBuffer buffer) { CachedBuffers buffers = getCachedBuffers(buffer.remaining()*2); return buffer.order() == ByteOrder.LITTLE_ENDIAN ? buffers.short_buffer_little : buffers.short_buffer_big; } private static ShortBuffer doWrap(ShortBuffer buffer) { ShortBuffer direct_buffer = lookupBuffer(buffer); direct_buffer.clear(); int saved_position = buffer.position(); direct_buffer.put(buffer); buffer.position(saved_position); direct_buffer.flip(); return direct_buffer; } private static FloatBuffer lookupBuffer(FloatBuffer buffer) { CachedBuffers buffers = getCachedBuffers(buffer.remaining()*4); return buffer.order() == ByteOrder.LITTLE_ENDIAN ? buffers.float_buffer_little : buffers.float_buffer_big; } private static FloatBuffer doWrap(FloatBuffer buffer) { FloatBuffer direct_buffer = lookupBuffer(buffer); direct_buffer.clear(); int saved_position = buffer.position(); direct_buffer.put(buffer); buffer.position(saved_position); direct_buffer.flip(); return direct_buffer; } private static IntBuffer lookupBuffer(IntBuffer buffer) { CachedBuffers buffers = getCachedBuffers(buffer.remaining()*4); return buffer.order() == ByteOrder.LITTLE_ENDIAN ? buffers.int_buffer_little : buffers.int_buffer_big; } private static IntBuffer doWrap(IntBuffer buffer) { IntBuffer direct_buffer = lookupBuffer(buffer); direct_buffer.clear(); int saved_position = buffer.position(); direct_buffer.put(buffer); buffer.position(saved_position); direct_buffer.flip(); return direct_buffer; } private static LongBuffer lookupBuffer(LongBuffer buffer) { CachedBuffers buffers = getCachedBuffers(buffer.remaining()*8); return buffer.order() == ByteOrder.LITTLE_ENDIAN ? buffers.long_buffer_little : buffers.long_buffer_big; } private static LongBuffer doWrap(LongBuffer buffer) { LongBuffer direct_buffer = lookupBuffer(buffer); direct_buffer.clear(); int saved_position = buffer.position(); direct_buffer.put(buffer); buffer.position(saved_position); direct_buffer.flip(); return direct_buffer; } private static DoubleBuffer lookupBuffer(DoubleBuffer buffer) { CachedBuffers buffers = getCachedBuffers(buffer.remaining()*8); return buffer.order() == ByteOrder.LITTLE_ENDIAN ? buffers.double_buffer_little : buffers.double_buffer_big; } private static DoubleBuffer doWrap(DoubleBuffer buffer) { DoubleBuffer direct_buffer = lookupBuffer(buffer); direct_buffer.clear(); int saved_position = buffer.position(); direct_buffer.put(buffer); buffer.position(saved_position); direct_buffer.flip(); return direct_buffer; } private static final class CachedBuffers { private final ByteBuffer byte_buffer; private final ShortBuffer short_buffer_big; private final IntBuffer int_buffer_big; private final FloatBuffer float_buffer_big; private final LongBuffer long_buffer_big; private final DoubleBuffer double_buffer_big; private final ShortBuffer short_buffer_little; private final IntBuffer int_buffer_little; private final FloatBuffer float_buffer_little; private final LongBuffer long_buffer_little; private final DoubleBuffer double_buffer_little; private CachedBuffers(int size) { this.byte_buffer = ByteBuffer.allocateDirect(size); this.short_buffer_big = byte_buffer.asShortBuffer(); this.int_buffer_big = byte_buffer.asIntBuffer(); this.float_buffer_big = byte_buffer.asFloatBuffer(); this.long_buffer_big = byte_buffer.asLongBuffer(); this.double_buffer_big = byte_buffer.asDoubleBuffer(); this.byte_buffer.order(ByteOrder.LITTLE_ENDIAN); this.short_buffer_little = byte_buffer.asShortBuffer(); this.int_buffer_little = byte_buffer.asIntBuffer(); this.float_buffer_little = byte_buffer.asFloatBuffer(); this.long_buffer_little = byte_buffer.asLongBuffer(); this.double_buffer_little = byte_buffer.asDoubleBuffer(); } } } lwjgl-2.7.1/src/java/org/lwjgl/BufferChecks.java0000644000175000017500000002175111543426510020542 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl; import java.nio.*; /** *

      A class to check buffer boundaries in general. If there is unsufficient space * in the buffer when the call is made then a buffer overflow would otherwise * occur and cause unexpected behaviour, a crash, or worse, a security risk. * * Internal class, don't use. *

      * @author cix_foo * @author elias_naur * @version $Revision: 3419 $ * $Id: BufferChecks.java 3419 2010-09-30 17:21:50Z spasi $ */ public class BufferChecks { /** Static methods only! */ private BufferChecks() { } /** * Helper methods to ensure a function pointer is not-null (0) */ public static void checkFunctionAddress(long pointer) { if (LWJGLUtil.CHECKS && pointer == 0) { throw new IllegalStateException("Function is not supported"); } } /** * Helper methods to ensure a ByteBuffer is null-terminated */ public static void checkNullTerminated(ByteBuffer buf) { if ( LWJGLUtil.CHECKS && buf.get(buf.limit() - 1) != 0) { throw new IllegalArgumentException("Missing null termination"); } } public static void checkNullTerminated(ByteBuffer buf, int count) { if ( LWJGLUtil.CHECKS ) { int nullFound = 0; for ( int i = buf.position(); i < buf.limit(); i++ ) { if ( buf.get(i) == 0 ) nullFound++; } if ( nullFound < count ) throw new IllegalArgumentException("Missing null termination"); } } /** Helper method to ensure an IntBuffer is null-terminated */ public static void checkNullTerminated(IntBuffer buf) { if ( LWJGLUtil.CHECKS && buf.get(buf.limit() - 1) != 0 ) { throw new IllegalArgumentException("Missing null termination"); } } /** Helper method to ensure a LongBuffer is null-terminated */ public static void checkNullTerminated(LongBuffer buf) { if ( LWJGLUtil.CHECKS && buf.get(buf.limit() - 1) != 0 ) { throw new IllegalArgumentException("Missing null termination"); } } /** Helper method to ensure a PointerBuffer is null-terminated */ public static void checkNullTerminated(PointerBuffer buf) { if ( LWJGLUtil.CHECKS && buf.get(buf.limit() - 1) != 0 ) { throw new IllegalArgumentException("Missing null termination"); } } public static void checkNotNull(Object o) { if ( LWJGLUtil.CHECKS && o == null) throw new IllegalArgumentException("Null argument"); } /** * Helper methods to ensure a buffer is direct (and, implicitly, non-null). */ public static void checkDirect(ByteBuffer buf) { if ( LWJGLUtil.CHECKS && !buf.isDirect()) { throw new IllegalArgumentException("ByteBuffer is not direct"); } } public static void checkDirect(ShortBuffer buf) { if ( LWJGLUtil.CHECKS && !buf.isDirect()) { throw new IllegalArgumentException("ShortBuffer is not direct"); } } public static void checkDirect(IntBuffer buf) { if ( LWJGLUtil.CHECKS && !buf.isDirect()) { throw new IllegalArgumentException("IntBuffer is not direct"); } } public static void checkDirect(LongBuffer buf) { if ( LWJGLUtil.CHECKS && !buf.isDirect()) { throw new IllegalArgumentException("LongBuffer is not direct"); } } public static void checkDirect(FloatBuffer buf) { if ( LWJGLUtil.CHECKS && !buf.isDirect()) { throw new IllegalArgumentException("FloatBuffer is not direct"); } } public static void checkDirect(DoubleBuffer buf) { if ( LWJGLUtil.CHECKS && !buf.isDirect()) { throw new IllegalArgumentException("DoubleBuffer is not direct"); } } public static void checkDirect(PointerBuffer buf) { // NO-OP, PointerBuffer is always direct. } public static void checkArray(Object[] array) { if ( LWJGLUtil.CHECKS && (array == null || array.length == 0) ) throw new IllegalArgumentException("Invalid array"); } /** * This is a separate call to help inline checkBufferSize. */ private static void throwBufferSizeException(Buffer buf, int size) { throw new IllegalArgumentException("Number of remaining buffer elements is " + buf.remaining() + ", must be at least " + size); } private static void throwBufferSizeException(PointerBuffer buf, int size) { throw new IllegalArgumentException("Number of remaining pointer buffer elements is " + buf.remaining() + ", must be at least " + size); } private static void throwArraySizeException(Object[] array, int size) { throw new IllegalArgumentException("Number of array elements is " + array.length + ", must be at least " + size); } private static void throwArraySizeException(long[] array, int size) { throw new IllegalArgumentException("Number of array elements is " + array.length + ", must be at least " + size); } /** * Helper method to ensure a buffer is big enough to receive data from a * glGet* operation. * * @param buf * The buffer to check * @param size * The minimum buffer size * @throws IllegalArgumentException */ public static void checkBufferSize(Buffer buf, int size) { if ( LWJGLUtil.CHECKS && buf.remaining() < size) { throwBufferSizeException(buf, size); } } /** * Detects the buffer type and performs the corresponding check * and also returns the buffer position in bytes. * * @param buffer the buffer to check * @param size the size to check * * @return the buffer position in bytes */ public static int checkBuffer(final Buffer buffer, final int size) { final int posShift; if ( buffer instanceof ByteBuffer ) { BufferChecks.checkBuffer((ByteBuffer)buffer, size); posShift = 0; } else if ( buffer instanceof ShortBuffer ) { BufferChecks.checkBuffer((ShortBuffer)buffer, size); posShift = 1; } else if ( buffer instanceof IntBuffer ) { BufferChecks.checkBuffer((IntBuffer)buffer, size); posShift = 2; } else if ( buffer instanceof LongBuffer ) { BufferChecks.checkBuffer((LongBuffer)buffer, size); posShift = 4; } else if ( buffer instanceof FloatBuffer ) { BufferChecks.checkBuffer((FloatBuffer)buffer, size); posShift = 2; } else if ( buffer instanceof DoubleBuffer ) { BufferChecks.checkBuffer((DoubleBuffer)buffer, size); posShift = 4; } else throw new IllegalArgumentException("Unsupported Buffer type specified: " + buffer.getClass()); return buffer.position() << posShift; } public static void checkBuffer(ByteBuffer buf, int size) { if ( LWJGLUtil.CHECKS ) { checkBufferSize(buf, size); checkDirect(buf); } } public static void checkBuffer(ShortBuffer buf, int size) { if ( LWJGLUtil.CHECKS ) { checkBufferSize(buf, size); checkDirect(buf); } } public static void checkBuffer(IntBuffer buf, int size) { if ( LWJGLUtil.CHECKS ) { checkBufferSize(buf, size); checkDirect(buf); } } public static void checkBuffer(LongBuffer buf, int size) { if ( LWJGLUtil.CHECKS ) { checkBufferSize(buf, size); checkDirect(buf); } } public static void checkBuffer(FloatBuffer buf, int size) { if ( LWJGLUtil.CHECKS ) { checkBufferSize(buf, size); checkDirect(buf); } } public static void checkBuffer(DoubleBuffer buf, int size) { if ( LWJGLUtil.CHECKS ) { checkBufferSize(buf, size); checkDirect(buf); } } public static void checkBuffer(PointerBuffer buf, int size) { if ( LWJGLUtil.CHECKS && buf.remaining() < size ) { throwBufferSizeException(buf, size); } } public static void checkArray(Object[] array, int size) { if ( LWJGLUtil.CHECKS && array.length < size ) throwArraySizeException(array, size); } public static void checkArray(long[] array, int size) { if ( LWJGLUtil.CHECKS && array.length < size ) throwArraySizeException(array, size); } }lwjgl-2.7.1/src/java/org/lwjgl/LinuxSysImplementation.java0000644000175000017500000000507311543426510022713 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl; /** * * @author elias_naur * @version $Revision: 3418 $ * $Id: LinuxSysImplementation.java 3418 2010-09-28 21:11:35Z spasi $ */ final class LinuxSysImplementation extends J2SESysImplementation { private static final int JNI_VERSION = 19; static { java.awt.Toolkit.getDefaultToolkit(); // This will make sure libjawt.so is loaded } public int getRequiredJNIVersion() { return JNI_VERSION; } public boolean openURL(final String url) { // Linux may as well resort to pure Java hackery, as there's no Linux native way of doing it // right anyway. String[] browsers = {"xdg-open", "firefox", "mozilla", "opera", "konqueror", "nautilus", "galeon", "netscape"}; for ( final String browser : browsers ) { try { LWJGLUtil.execPrivileged(new String[] { browser, url }); return true; } catch (Exception e) { // Ignore e.printStackTrace(System.err); } } // Seems to have failed return false; } public boolean has64Bit() { return true; } } lwjgl-2.7.1/src/java/org/lwjgl/BufferUtils.java0000644000175000017500000001427211543426510020442 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.CharBuffer; import java.nio.DoubleBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.LongBuffer; import java.nio.ShortBuffer; /** * Some often-used Buffer code for creating native buffers of the appropriate size. * * @author $Author: matzon $ * @version $Revision: 3456 $ * $Id: BufferUtils.java 3456 2010-11-24 21:48:23Z matzon $ */ public final class BufferUtils { /** * Construct a direct native-ordered bytebuffer with the specified size. * @param size The size, in bytes * @return a ByteBuffer */ public static ByteBuffer createByteBuffer(int size) { return ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder()); } /** * Construct a direct native-order shortbuffer with the specified number * of elements. * @param size The size, in shorts * @return a ShortBuffer */ public static ShortBuffer createShortBuffer(int size) { return createByteBuffer(size << 1).asShortBuffer(); } /** * Construct a direct native-order charbuffer with the specified number * of elements. * @param size The size, in chars * @return an CharBuffer */ public static CharBuffer createCharBuffer(int size) { return createByteBuffer(size << 1).asCharBuffer(); } /** * Construct a direct native-order intbuffer with the specified number * of elements. * @param size The size, in ints * @return an IntBuffer */ public static IntBuffer createIntBuffer(int size) { return createByteBuffer(size << 2).asIntBuffer(); } /** * Construct a direct native-order longbuffer with the specified number * of elements. * @param size The size, in longs * @return an LongBuffer */ public static LongBuffer createLongBuffer(int size) { return createByteBuffer(size << 3).asLongBuffer(); } /** * Construct a direct native-order floatbuffer with the specified number * of elements. * @param size The size, in floats * @return a FloatBuffer */ public static FloatBuffer createFloatBuffer(int size) { return createByteBuffer(size << 2).asFloatBuffer(); } /** * Construct a direct native-order doublebuffer with the specified number * of elements. * @param size The size, in floats * @return a FloatBuffer */ public static DoubleBuffer createDoubleBuffer(int size) { return createByteBuffer(size << 3).asDoubleBuffer(); } /** * Construct a PointerBuffer with the specified number * of elements. * @param size The size, in memory addresses * @return a PointerBuffer */ public static PointerBuffer createPointerBuffer(int size) { return PointerBuffer.allocateDirect(size); } /** * @return n, where buffer_element_size=2^n. */ public static int getElementSizeExponent(Buffer buf) { if (buf instanceof ByteBuffer) return 0; else if (buf instanceof ShortBuffer || buf instanceof CharBuffer) return 1; else if (buf instanceof FloatBuffer || buf instanceof IntBuffer) return 2; else if (buf instanceof LongBuffer || buf instanceof DoubleBuffer) return 3; else throw new IllegalStateException("Unsupported buffer type: " + buf); } /** * A helper function which is used to get the byte offset in an arbitrary buffer * based on its position * @return the position of the buffer, in BYTES */ public static int getOffset(Buffer buffer) { return buffer.position() << getElementSizeExponent(buffer); } /** Fill buffer with zeros from position to remaining */ public static void zeroBuffer(ByteBuffer b) { zeroBuffer0(b, b.position(), b.remaining()); } /** Fill buffer with zeros from position to remaining */ public static void zeroBuffer(ShortBuffer b) { zeroBuffer0(b, b.position()*2L, b.remaining()*2L); } /** Fill buffer with zeros from position to remaining */ public static void zeroBuffer(CharBuffer b) { zeroBuffer0(b, b.position()*2L, b.remaining()*2L); } /** Fill buffer with zeros from position to remaining */ public static void zeroBuffer(IntBuffer b) { zeroBuffer0(b, b.position()*4L, b.remaining()*4L); } /** Fill buffer with zeros from position to remaining */ public static void zeroBuffer(FloatBuffer b) { zeroBuffer0(b, b.position()*4L, b.remaining()*4L); } /** Fill buffer with zeros from position to remaining */ public static void zeroBuffer(LongBuffer b) { zeroBuffer0(b, b.position()*8L, b.remaining()*8L); } /** Fill buffer with zeros from position to remaining */ public static void zeroBuffer(DoubleBuffer b) { zeroBuffer0(b, b.position()*8L, b.remaining()*8L); } /** Fill buffer with zeros from position to remaining */ private static native void zeroBuffer0(Buffer b, long off, long size); } lwjgl-2.7.1/src/java/org/lwjgl/test/0000755000175000017500000000000011543426510016316 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/test/NativeTest.java0000644000175000017500000000426711543426510021260 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test; import org.lwjgl.Sys; import java.awt.Toolkit; /** *
      * Simple test that just checks that the native library loads * * @author Brian Matzon * @version $Revision: 2983 $ * $Id: SysTest.java 2983 2008-04-07 18:36:09Z matzon $ */ public class NativeTest { public void invokeSys() { Sys.getVersion(); } /** * Entry point for test * * @param args ignored */ public static void main(String[] args) { // try to "load" awt - work around for headless issue on linux Toolkit.getDefaultToolkit(); new NativeTest().invokeSys(); System.out.println("OK"); } } lwjgl-2.7.1/src/java/org/lwjgl/test/glu/0000755000175000017500000000000011523635574017117 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/test/glu/tessellation/0000755000175000017500000000000011543426510021613 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/test/glu/tessellation/TessCallback.java0000644000175000017500000000533611543426510025020 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.glu.tessellation; import org.lwjgl.util.glu.GLUtessellatorCallbackAdapter; import static org.lwjgl.opengl.GL11.*; public class TessCallback extends GLUtessellatorCallbackAdapter { public void begin(int type) { glBegin(type); } public void combine(double[] coords, Object[] data, float[] weight, Object[] outData) { for (int i=0;i platforms = CLPlatform.getPlatforms(); if ( platforms == null ) throw new RuntimeException("No OpenCL platforms found."); for ( CLPlatform platform : platforms ) { System.out.println("\n-------------------------"); System.out.println("NEW PLATFORM: " + platform.getPointer()); System.out.println(CLCapabilities.getPlatformCapabilities(platform)); System.out.println("-------------------------"); printPlatformInfo(platform, "CL_PLATFORM_PROFILE", CL_PLATFORM_PROFILE); printPlatformInfo(platform, "CL_PLATFORM_VERSION", CL_PLATFORM_VERSION); printPlatformInfo(platform, "CL_PLATFORM_NAME", CL_PLATFORM_NAME); printPlatformInfo(platform, "CL_PLATFORM_VENDOR", CL_PLATFORM_VENDOR); printPlatformInfo(platform, "CL_PLATFORM_EXTENSIONS", CL_PLATFORM_EXTENSIONS); System.out.println(""); final PointerBuffer ctxProps = BufferUtils.createPointerBuffer(3); ctxProps.put(CL_CONTEXT_PLATFORM).put(platform.getPointer()).put(0).flip(); final List devices = platform.getDevices(CL_DEVICE_TYPE_ALL); for ( CLDevice device : devices ) { final CLDeviceCapabilities caps = CLCapabilities.getDeviceCapabilities(device); System.out.println("\n\tNEW DEVICE: " + device.getPointer()); System.out.println(caps); System.out.println("\t-------------------------"); System.out.println("\tCL_DEVICE_TYPE = " + device.getInfoInt(CL_DEVICE_TYPE)); System.out.println("\tCL_DEVICE_VENDOR_ID = " + device.getInfoInt(CL_DEVICE_VENDOR_ID)); System.out.println("\tCL_DEVICE_MAX_COMPUTE_UNITS = " + device.getInfoInt(CL_DEVICE_MAX_COMPUTE_UNITS)); System.out.println("\tCL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = " + device.getInfoInt(CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS)); //CL10.clGetDeviceInfo(device, CL10.CL_DEVICE_MAX_WORK_ITEM_SIZES, info, size_ret); //System.out.println("\tCL_DEVICE_MAX_WORK_ITEM_SIZES = " + info.getInt(0)); System.out.println("\tCL_DEVICE_MAX_WORK_GROUP_SIZE = " + device.getInfoSize(CL_DEVICE_MAX_WORK_GROUP_SIZE)); System.out.println("\tCL_DEVICE_MAX_CLOCK_FREQUENCY = " + device.getInfoInt(CL_DEVICE_MAX_CLOCK_FREQUENCY)); System.out.println("\tCL_DEVICE_ADDRESS_BITS = " + device.getInfoInt(CL_DEVICE_ADDRESS_BITS)); System.out.println("\tCL_DEVICE_AVAILABLE = " + device.getInfoBoolean(CL_DEVICE_AVAILABLE)); System.out.println("\tCL_DEVICE_COMPILER_AVAILABLE = " + device.getInfoBoolean(CL_DEVICE_COMPILER_AVAILABLE)); printDeviceInfo(device, "CL_DEVICE_NAME", CL_DEVICE_NAME); printDeviceInfo(device, "CL_DEVICE_VENDOR", CL_DEVICE_VENDOR); printDeviceInfo(device, "CL_DRIVER_VERSION", CL_DRIVER_VERSION); printDeviceInfo(device, "CL_DEVICE_PROFILE", CL_DEVICE_PROFILE); printDeviceInfo(device, "CL_DEVICE_VERSION", CL_DEVICE_VERSION); printDeviceInfo(device, "CL_DEVICE_EXTENSIONS", CL_DEVICE_EXTENSIONS); if ( caps.OpenCL11 ) printDeviceInfo(device, "CL_DEVICE_OPENCL_C_VERSION", CL_DEVICE_OPENCL_C_VERSION); CLContext context = clCreateContext(ctxProps, device, new CLContextCallback() { protected void handleMessage(final String errinfo, final ByteBuffer private_info) { System.out.println("IN CLContextCallback :: " + errinfo); } }, null); CLMem buffer = clCreateBuffer(context, CL_MEM_READ_ONLY, 128, null); if ( caps.OpenCL11 ) { clSetMemObjectDestructorCallback(buffer, new CLMemObjectDestructorCallback() { protected void handleMessage(final long memobj) { System.out.println("FIRST Buffer destructed: " + memobj); } }); clSetMemObjectDestructorCallback(buffer, new CLMemObjectDestructorCallback() { protected void handleMessage(final long memobj) { System.out.println("SECOND Buffer destructed: " + memobj); } }); } if ( caps.OpenCL11 ) { CLMem subbuffer = buffer.createSubBuffer(CL_MEM_READ_ONLY, CL_BUFFER_CREATE_TYPE_REGION, new CLBufferRegion(0, 64), null); clSetMemObjectDestructorCallback(subbuffer, new CLMemObjectDestructorCallback() { protected void handleMessage(final long memobj) { System.out.println("Sub Buffer destructed: " + memobj); } }); } clRetainMemObject(buffer); if ( LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_MACOSX ) { // TODO: Native kernels crash on MacOSX, disable this until we can debug properly. final long exec_caps = device.getInfoLong(CL_DEVICE_EXECUTION_CAPABILITIES); if ( (exec_caps & CL_EXEC_NATIVE_KERNEL) == CL_EXEC_NATIVE_KERNEL ) { System.out.println("-TRYING TO EXEC NATIVE KERNEL-"); final CLCommandQueue queue = clCreateCommandQueue(context, device, 0, null); clEnqueueNativeKernel(queue, new CLNativeKernel() { protected void execute(final ByteBuffer[] memobjs) { if ( memobjs == null ) System.out.println("OK, it's null"); else { System.out.println("memobjs = " + memobjs.length); for ( int k = 0; k < memobjs.length; k++ ) { System.out.println("memobjs[" + k + "].remaining() = " + memobjs[k].remaining()); for ( int l = memobjs[k].position(); l < memobjs[k].limit(); l++ ) { memobjs[k].put(l, (byte)l); } } } } }, new CLMem[] { buffer }, new long[] { 128 }, null, null); clFinish(queue); } } clReleaseMemObject(buffer); clReleaseContext(context); } } } catch (LWJGLException le) { die("Init", le.getMessage()); } CL.destroy(); } private static void printPlatformInfo(final CLPlatform platform, final String param_name, final int param) { System.out.println("\t" + param_name + " = " + platform.getInfoString(param)); } private static void printDeviceInfo(final CLDevice device, final String param_name, final int param) { System.out.println("\t" + param_name + " = " + device.getInfoString(param)); } private static void die(String kind, String description) { System.out.println(kind + " error " + description + " occured"); } /** * main entry point * * @param args String array containing arguments */ public static void main(String[] args) { new HelloOpenCL().execute(); } }lwjgl-2.7.1/src/java/org/lwjgl/test/opencl/gl/0000755000175000017500000000000011543426510020200 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl0000644000175000017500000000466611543426510022623 0ustar zero79zero79#ifdef DOUBLE_FP #ifdef AMD_FP #pragma OPENCL EXTENSION cl_amd_fp64 : enable #else #pragma OPENCL EXTENSION cl_khr_fp64 : enable #endif #define varfloat double #define _255 255.0 #else #define varfloat float #define _255 255.0f #endif #ifdef USE_TEXTURE #define OUTPUT_TYPE __write_only image2d_t #else #define OUTPUT_TYPE global uint * #endif /** * For a description of this algorithm please refer to * http://en.wikipedia.org/wiki/Mandelbrot_set * @author Michael Bien */ kernel void mandelbrot( const int width, const int height, const varfloat x0, const varfloat y0, const varfloat rangeX, const varfloat rangeY, OUTPUT_TYPE output, global uint *colorMap, const int colorMapSize, const int maxIterations ) { unsigned int ix = get_global_id(0); unsigned int iy = get_global_id(1); varfloat r = x0 + ix * rangeX / width; varfloat i = y0 + iy * rangeY / height; varfloat x = 0; varfloat y = 0; varfloat magnitudeSquared = 0; int iteration = 0; while ( magnitudeSquared < 4 && iteration < maxIterations ) { varfloat x2 = x*x; varfloat y2 = y*y; y = 2 * x * y + i; x = x2 - y2 + r; magnitudeSquared = x2+y2; iteration++; } if ( iteration == maxIterations ) { #ifdef USE_TEXTURE write_imagef(output, (int2)(ix, iy), (float4)0); #else output[iy * width + ix] = 0; #endif } else { varfloat alpha = (varfloat)iteration / maxIterations; int colorIndex = (int)(alpha * colorMapSize); #ifdef USE_TEXTURE // We could have changed colorMap to a texture + sampler, but the // unpacking below has minimal overhead and it's kinda interesting. // We could also use an R32UI texture and do the unpacking in GLSL, // but then we'd require OpenGL 3.0 (GLSL 1.30). uint c = colorMap[colorIndex]; float4 oc = (float4)( (c & 0xFF) >> 0, (c & 0xFF00) >> 8, (c & 0xFF0000) >> 16, _255 ); write_imagef(output, (int2)(ix, iy), oc / _255); #else output[iy * width + ix] = colorMap[colorIndex]; #endif // monochrom //output[iy * width + ix] = 255*iteration/maxIterations; } }lwjgl-2.7.1/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java0000644000175000017500000006715511543426510023242 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.opencl.gl; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.PointerBuffer; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opencl.*; import org.lwjgl.opencl.api.Filter; import org.lwjgl.opengl.*; import org.lwjgl.util.Color; import org.lwjgl.util.ReadableColor; import java.io.*; import java.net.URL; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.HashSet; import java.util.List; import java.util.Set; import static java.lang.Math.*; import static org.lwjgl.opencl.CL10.*; import static org.lwjgl.opencl.CL10GL.*; import static org.lwjgl.opencl.KHRGLEvent.*; import static org.lwjgl.opengl.AMDDebugOutput.*; import static org.lwjgl.opengl.ARBCLEvent.*; import static org.lwjgl.opengl.ARBDebugOutput.*; import static org.lwjgl.opengl.ARBSync.*; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL15.*; import static org.lwjgl.opengl.GL20.*; import static org.lwjgl.opengl.GL21.*; /* THIS DEMO USES CODE PORTED FROM JogAmp.org Original code: http://github.com/mbien/jocl-demos Original author: Michael Bien ___ ___ ___ / /\ / /\ ___ / /\ http://jocl.jogamp.org/ / /:/ / /::\ /__/\ / /::\ a http://jogamp.org/ project. /__/::\ / /:/\:\ \ \:\ / /:/\:\ \__\/\:\ / /:/~/::\ \ \:\ / /:/~/::\ \ \:\ /__/:/ /:/\:\ ___ \__\:\/__/:/ /:/\:\ \__\:\\ \:\/:/__\//__/\ | |:|\ \:\/:/__\/ / /:/ \ \::/ \ \:\| |:| \ \::/ /__/:/ \ \:\ \ \:\__|:| \ \:\ \__\/ \ \:\ \__\::::/ \ \:\ \__\/ ~~~~ \__\/ ___ ___ ___ ___ ___ / /\ / /\ / /\ /__/\ / /\ / /::\ / /::\ / /:/_ \ \:\ / /:/ / /:/\:\ / /:/\:\ / /:/ /\ \ \:\ / /:/ ___ ___ / /:/ \:\ / /:/~/:// /:/ /:/_ _____\__\:\ / /:/ ___ /__/\ / /\ /__/:/ \__\:\/__/:/ /://__/:/ /:/ /\/__/::::::::\/__/:/ / /\\ \:\ / /:/ \ \:\ / /:/\ \:\/:/ \ \:\/:/ /:/\ \:\~~\~~\/\ \:\ / /:/ \ \:\ /:/ \ \:\ /:/ \ \::/ \ \::/ /:/ \ \:\ ~~~ \ \:\ /:/ \ \:\/:/ \ \:\/:/ \ \:\ \ \:\/:/ \ \:\ \ \:\/:/ \ \::/ \ \::/ \ \:\ \ \::/ \ \:\ \ \::/ \__\/ \__\/ \__\/ \__\/ \__\/ \__\/ _____ ___ ___ ___ ___ / /::\ / /\ /__/\ / /\ / /\ / /:/\:\ / /:/_ | |::\ / /::\ / /:/_ / /:/ \:\ / /:/ /\ | |:|:\ / /:/\:\ / /:/ /\ /__/:/ \__\:| / /:/ /:/_ __|__|:|\:\ / /:/ \:\ / /:/ /::\ \ \:\ / /:/ /__/:/ /:/ /\ /__/::::| \:\ /__/:/ \__\:\ /__/:/ /:/\:\ \ \:\ /:/ \ \:\/:/ /:/ \ \:\~~\__\/ \ \:\ / /:/ \ \:\/:/~/:/ \ \:\/:/ \ \::/ /:/ \ \:\ \ \:\ /:/ \ \::/ /:/ \ \::/ \ \:\/:/ \ \:\ \ \:\/:/ \__\/ /:/ \__\/ \ \::/ \ \:\ \ \::/ /__/:/ \__\/ \__\/ \__\/ \__\/ */ /** * Computes the Mandelbrot set with OpenCL using multiple GPUs and renders the result with OpenGL. * A shared PBO is used as storage for the fractal image.
      * http://en.wikipedia.org/wiki/Mandelbrot_set *

      * controls:
      * keys 1-9 control parallelism level
      * space enables/disables slice seperator
      * 'd' toggles between 32/64bit floatingpoint precision
      * mouse/mousewheel to drag and zoom
      * 'Home' to reset the viewport
      *

      * * @author Michael Bien, Spasi */ public class DemoFractal { // max number of used GPUs private static final int MAX_PARALLELISM_LEVEL = 8; private static final int COLOR_MAP_SIZE = 32 * 2 * 4; private Set params; private CLContext clContext; private CLCommandQueue[] queues; private CLKernel[] kernels; private CLProgram[] programs; private CLMem[] glBuffers; private IntBuffer glIDs; private boolean useTextures; // Texture rendering private int dlist; private int vsh; private int fsh; private int program; private CLMem[] colorMap; private final PointerBuffer kernel2DGlobalWorkSize; // max per pixel iterations to compute the fractal private int maxIterations = 500; private int width = 512; private int height = 512; private double minX = -2f; private double minY = -1.2f; private double maxX = 0.6f; private double maxY = 1.3f; private boolean dragging; private double dragX; private double dragY; private double dragMinX; private double dragMinY; private double dragMaxX; private double dragMaxY; private int mouseX; private int mouseY; private int slices; private boolean drawSeparator; private boolean doublePrecision = true; private boolean buffersInitialized; private boolean rebuild; private boolean run = true; // EVENT SYNCING private final PointerBuffer syncBuffer = BufferUtils.createPointerBuffer(1); private boolean syncGLtoCL; // true if we can make GL wait on events generated from CL queues. private CLEvent[] clEvents; private GLSync[] clSyncs; private boolean syncCLtoGL; // true if we can make CL wait on sync objects generated from GL. private GLSync glSync; private CLEvent glEvent; public DemoFractal(final String[] args) { params = new HashSet(); for ( int i = 0; i < args.length; i++ ) { final String arg = args[i]; if ( arg.charAt(0) != '-' && arg.charAt(0) != '/' ) throw new IllegalArgumentException("Invalid command-line argument: " + args[i]); final String param = arg.substring(1); if ( "forcePBO".equalsIgnoreCase(param) ) params.add("forcePBO"); else if ( "forceCPU".equalsIgnoreCase(param) ) params.add("forceCPU"); else if ( "debugGL".equalsIgnoreCase(param) ) params.add("debugGL"); else if ( "iterations".equalsIgnoreCase(param) ) { if ( args.length < i + 1 + 1 ) throw new IllegalArgumentException("Invalid iterations argument specified."); try { this.maxIterations = Integer.parseInt(args[++i]); } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid number of iterations specified."); } } else if ( "res".equalsIgnoreCase(param) ) { if ( args.length < i + 2 + 1 ) throw new IllegalArgumentException("Invalid res argument specified."); try { this.width = Integer.parseInt(args[++i]); this.height = Integer.parseInt(args[++i]); if ( width < 1 || height < 1 ) throw new IllegalArgumentException("Invalid res dimensions specified."); } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid res dimensions specified."); } } } kernel2DGlobalWorkSize = BufferUtils.createPointerBuffer(2); } public static void main(String args[]) { DemoFractal demo = new DemoFractal(args); demo.init(); demo.run(); } public void init() { try { CL.create(); Display.setDisplayMode(new DisplayMode(width, height)); Display.setTitle("OpenCL Fractal Demo"); Display.setSwapInterval(0); Display.create(new PixelFormat(), new ContextAttribs().withDebug(params.contains("debugGL"))); } catch (LWJGLException e) { throw new RuntimeException(e); } try { initCL(Display.getDrawable()); } catch (Exception e) { if ( clContext != null ) clReleaseContext(clContext); Display.destroy(); throw new RuntimeException(e); } glDisable(GL_DEPTH_TEST); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); initView(Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight()); initGLObjects(); glFinish(); setKernelConstants(); } private void initCL(Drawable drawable) throws Exception { // Find a platform List platforms = CLPlatform.getPlatforms(); if ( platforms == null ) throw new RuntimeException("No OpenCL platforms found."); final CLPlatform platform = platforms.get(0); // just grab the first one // Find devices with GL sharing support final Filter glSharingFilter = new Filter() { public boolean accept(final CLDevice device) { final CLDeviceCapabilities caps = CLCapabilities.getDeviceCapabilities(device); return caps.CL_KHR_gl_sharing; } }; int device_type = params.contains("forceCPU") ? CL_DEVICE_TYPE_CPU : CL_DEVICE_TYPE_GPU; List devices = platform.getDevices(device_type, glSharingFilter); if ( devices == null ) { device_type = CL_DEVICE_TYPE_CPU; devices = platform.getDevices(device_type, glSharingFilter); if ( devices == null ) throw new RuntimeException("No OpenCL devices found with KHR_gl_sharing support."); } // Create the context clContext = CLContext.create(platform, devices, new CLContextCallback() { protected void handleMessage(final String errinfo, final ByteBuffer private_info) { System.out.println("[CONTEXT MESSAGE] " + errinfo); } }, drawable, null); slices = min(devices.size(), MAX_PARALLELISM_LEVEL); // create command queues for every GPU, setup colormap and init kernels queues = new CLCommandQueue[slices]; kernels = new CLKernel[slices]; colorMap = new CLMem[slices]; for ( int i = 0; i < slices; i++ ) { colorMap[i] = clCreateBuffer(clContext, CL_MEM_READ_ONLY, COLOR_MAP_SIZE, null); colorMap[i].checkValid(); // create command queue and upload color map buffer on each used device queues[i] = clCreateCommandQueue(clContext, devices.get(i), CL_QUEUE_PROFILING_ENABLE, null); queues[i].checkValid(); final ByteBuffer colorMapBuffer = clEnqueueMapBuffer(queues[i], colorMap[i], CL_TRUE, CL_MAP_WRITE, 0, COLOR_MAP_SIZE, null, null, null); initColorMap(colorMapBuffer.asIntBuffer(), 32, Color.BLUE, Color.GREEN, Color.RED); clEnqueueUnmapMemObject(queues[i], colorMap[i], colorMapBuffer, null, null); } // check if we have 64bit FP support on all devices // if yes we can use only one program for all devices + one kernel per device. // if not we will have to create (at least) one program for 32 and one for 64bit devices. // since there are different vendor extensions for double FP we use one program per device. // (OpenCL spec is not very clear about this usecases) boolean all64bit = true; for ( CLDevice device : devices ) { if ( !isDoubleFPAvailable(device) ) { all64bit = false; break; } } // load program(s) programs = new CLProgram[all64bit ? 1 : slices]; final ContextCapabilities caps = GLContext.getCapabilities(); if ( !caps.OpenGL20 ) throw new RuntimeException("OpenGL 2.0 is required to run this demo."); else if ( device_type == CL_DEVICE_TYPE_CPU && !caps.OpenGL21 ) throw new RuntimeException("OpenGL 2.1 is required to run this demo."); if ( params.contains("debugGL") ) { if ( caps.GL_ARB_debug_output ) glDebugMessageCallbackARB(new ARBDebugOutputCallback()); else if ( caps.GL_AMD_debug_output ) glDebugMessageCallbackAMD(new AMDDebugOutputCallback()); } if ( device_type == CL_DEVICE_TYPE_GPU ) System.out.println("OpenCL Device Type: GPU (Use -forceCPU to use CPU)"); else System.out.println("OpenCL Device Type: CPU"); for ( int i = 0; i < devices.size(); i++ ) System.out.println("OpenCL Device #" + (i + 1) + " supports KHR_gl_event = " + CLCapabilities.getDeviceCapabilities(devices.get(i)).CL_KHR_gl_event); System.out.println("\nMax Iterations: " + maxIterations + " (Use -iterations to change)"); System.out.println("Display resolution: " + width + "x" + height + " (Use -res to change)"); System.out.println("\nOpenGL caps.GL_ARB_sync = " + caps.GL_ARB_sync); System.out.println("OpenGL caps.GL_ARB_cl_event = " + caps.GL_ARB_cl_event); // Use PBO if we're on a CPU implementation useTextures = device_type == CL_DEVICE_TYPE_GPU && (!caps.OpenGL21 || !params.contains("forcePBO")); if ( useTextures ) { System.out.println("\nCL/GL Sharing method: TEXTURES (use -forcePBO to use PBO + DrawPixels)"); System.out.println("Rendering method: Shader on a fullscreen quad"); } else { System.out.println("\nCL/GL Sharing method: PIXEL BUFFER OBJECTS"); System.out.println("Rendering method: DrawPixels"); } buildPrograms(); // Detect GLtoCL synchronization method syncGLtoCL = caps.GL_ARB_cl_event; // GL3.2 or ARB_sync implied if ( syncGLtoCL ) { clEvents = new CLEvent[slices]; clSyncs = new GLSync[slices]; System.out.println("\nGL to CL sync: Using OpenCL events"); } else System.out.println("\nGL to CL sync: Using clFinish"); // Detect CLtoGL synchronization method syncCLtoGL = caps.OpenGL32 || caps.GL_ARB_sync; if ( syncCLtoGL ) { for ( CLDevice device : devices ) { if ( !CLCapabilities.getDeviceCapabilities(device).CL_KHR_gl_event ) { syncCLtoGL = false; break; } } } if ( syncCLtoGL ) { System.out.println("CL to GL sync: Using OpenGL sync objects"); } else System.out.println("CL to GL sync: Using glFinish"); if ( useTextures ) { dlist = glGenLists(1); glNewList(dlist, GL_COMPILE); glBegin(GL_QUADS); { glTexCoord2f(0.0f, 0.0f); glVertex2f(0, 0); glTexCoord2f(0.0f, 1.0f); glVertex2i(0, height); glTexCoord2f(1.0f, 1.0f); glVertex2f(width, height); glTexCoord2f(1.0f, 0.0f); glVertex2f(width, 0); } glEnd(); glEndList(); vsh = glCreateShader(GL_VERTEX_SHADER); glShaderSource(vsh, "varying vec2 texCoord;\n" + "\n" + "void main(void) {\n" + "\tgl_Position = ftransform();\n" + "\ttexCoord = gl_MultiTexCoord0.xy;\n" + "}"); glCompileShader(vsh); fsh = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(fsh, "uniform sampler2D mandelbrot;\n" + "\n" + "varying vec2 texCoord;\n" + "\n" + "void main(void) {\n" + "\tgl_FragColor = texture2D(mandelbrot, texCoord);" + "}"); glCompileShader(fsh); program = glCreateProgram(); glAttachShader(program, vsh); glAttachShader(program, fsh); glLinkProgram(program); glUseProgram(program); glUniform1i(glGetUniformLocation(program, "mandelbrot"), 0); } System.out.println(""); } private void buildPrograms() { /* * workaround: The driver keeps using the old binaries for some reason. * to solve this we simple create a new program and release the old. * however rebuilding programs should be possible -> remove when drivers are fixed. * (again: the spec is not very clear about this kind of usages) */ if ( programs[0] != null ) { for ( CLProgram program : programs ) clReleaseProgram(program); } try { createPrograms(); } catch (IOException e) { throw new RuntimeException(e); } // disable 64bit floating point math if not available for ( int i = 0; i < programs.length; i++ ) { final CLDevice device = queues[i].getCLDevice(); final StringBuilder options = new StringBuilder(useTextures ? "-D USE_TEXTURE" : ""); final CLDeviceCapabilities caps = CLCapabilities.getDeviceCapabilities(device); if ( doublePrecision && isDoubleFPAvailable(device) ) { //cl_khr_fp64 options.append(" -D DOUBLE_FP"); //amd's verson of double precision floating point math if ( !caps.CL_KHR_fp64 && caps.CL_AMD_fp64 ) options.append(" -D AMD_FP"); } System.out.println("\nOpenCL COMPILER OPTIONS: " + options); try { clBuildProgram(programs[i], device, options, null); } finally { System.out.println("BUILD LOG: " + programs[i].getBuildInfoString(device, CL_PROGRAM_BUILD_LOG)); } } rebuild = false; // init kernel with constants for ( int i = 0; i < kernels.length; i++ ) kernels[i] = clCreateKernel(programs[min(i, programs.length)], "mandelbrot", null); } private void initGLObjects() { if ( glBuffers == null ) { glBuffers = new CLMem[slices]; glIDs = BufferUtils.createIntBuffer(slices); } else { for ( CLMem mem : glBuffers ) clReleaseMemObject(mem); if ( useTextures ) glDeleteTextures(glIDs); else glDeleteBuffers(glIDs); } if ( useTextures ) glGenTextures(glIDs); else glGenBuffers(glIDs); if ( useTextures ) { // Init textures for ( int i = 0; i < slices; i++ ) { glBindTexture(GL_TEXTURE_2D, glIDs.get(i)); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width / slices, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (ByteBuffer)null); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glBuffers[i] = clCreateFromGLTexture2D(clContext, CL_MEM_WRITE_ONLY, GL_TEXTURE_2D, 0, glIDs.get(i), null); } glBindTexture(GL_TEXTURE_2D, 0); } else { // setup one empty PBO per slice for ( int i = 0; i < slices; i++ ) { glBindBuffer(GL_PIXEL_UNPACK_BUFFER, glIDs.get(i)); glBufferData(GL_PIXEL_UNPACK_BUFFER, width * height * 4 / slices, GL_STREAM_DRAW); glBuffers[i] = clCreateFromGLBuffer(clContext, CL_MEM_WRITE_ONLY, glIDs.get(i), null); } glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); } buffersInitialized = true; } // init kernels with constants private void setKernelConstants() { for ( int i = 0; i < slices; i++ ) { kernels[i] .setArg(6, glBuffers[i]) .setArg(7, colorMap[i]) .setArg(8, COLOR_MAP_SIZE) .setArg(9, maxIterations); } } // rendering cycle private void run() { long startTime = System.currentTimeMillis() + 5000; long fps = 0; while ( run ) { if ( !Display.isVisible() ) Thread.yield(); handleIO(); display(); Display.update(); if ( Display.isCloseRequested() ) break; if ( startTime > System.currentTimeMillis() ) { fps++; } else { long timeUsed = 5000 + (startTime - System.currentTimeMillis()); startTime = System.currentTimeMillis() + 5000; System.out.println(fps + " frames in 5 seconds = " + (fps / (timeUsed / 1000f))); fps = 0; } } clReleaseContext(clContext); if ( useTextures ) { glDeleteProgram(program); glDeleteShader(fsh); glDeleteShader(vsh); glDeleteLists(dlist, 1); } CL.destroy(); Display.destroy(); } public void display() { // TODO: Need to clean-up events, test when ARB_cl_events & KHR_gl_event are implemented. // make sure GL does not use our objects before we start computing if ( syncCLtoGL && glEvent != null ) { for ( final CLCommandQueue queue : queues ) clEnqueueWaitForEvents(queue, glEvent); } else glFinish(); if ( !buffersInitialized ) { initGLObjects(); setKernelConstants(); } if ( rebuild ) { buildPrograms(); setKernelConstants(); } compute(doublePrecision); render(); } // OpenCL private void compute(final boolean is64bit) { int sliceWidth = (int)(width / (float)slices); double rangeX = (maxX - minX) / slices; double rangeY = (maxY - minY); kernel2DGlobalWorkSize.put(0, sliceWidth).put(1, height); // start computation for ( int i = 0; i < slices; i++ ) { kernels[i].setArg(0, sliceWidth).setArg(1, height); if ( !is64bit || !isDoubleFPAvailable(queues[i].getCLDevice()) ) { kernels[i] .setArg(2, (float)(minX + rangeX * i)).setArg(3, (float)minY) .setArg(4, (float)rangeX).setArg(5, (float)rangeY); } else { kernels[i] .setArg(2, minX + rangeX * i).setArg(3, minY) .setArg(4, rangeX).setArg(5, rangeY); } // acquire GL objects, and enqueue a kernel with a probe from the list clEnqueueAcquireGLObjects(queues[i], glBuffers[i], null, null); clEnqueueNDRangeKernel(queues[i], kernels[i], 2, null, kernel2DGlobalWorkSize, null, null, null); clEnqueueReleaseGLObjects(queues[i], glBuffers[i], null, syncGLtoCL ? syncBuffer : null); if ( syncGLtoCL ) { clEvents[i] = queues[i].getCLEvent(syncBuffer.get(0)); clSyncs[i] = glCreateSyncFromCLeventARB(queues[i].getParent(), clEvents[i], 0); } } // block until done (important: finish before doing further gl work) if ( !syncGLtoCL ) { for ( int i = 0; i < slices; i++ ) clFinish(queues[i]); } } // OpenGL private void render() { glClear(GL_COLOR_BUFFER_BIT); if ( syncGLtoCL ) { for ( int i = 0; i < slices; i++ ) glWaitSync(clSyncs[i], 0, 0); } //draw slices int sliceWidth = width / slices; if ( useTextures ) { for ( int i = 0; i < slices; i++ ) { int seperatorOffset = drawSeparator ? i : 0; glBindTexture(GL_TEXTURE_2D, glIDs.get(i)); glCallList(dlist); } } else { for ( int i = 0; i < slices; i++ ) { int seperatorOffset = drawSeparator ? i : 0; glBindBuffer(GL_PIXEL_UNPACK_BUFFER, glIDs.get(i)); glRasterPos2i(sliceWidth * i + seperatorOffset, 0); glDrawPixels(sliceWidth, height, GL_RGBA, GL_UNSIGNED_BYTE, 0); } glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); } if ( syncCLtoGL ) { glSync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); glEvent = clCreateEventFromGLsyncKHR(clContext, glSync, null); } //draw info text /* textRenderer.beginRendering(width, height, false); textRenderer.draw("device/time/precision", 10, height - 15); for ( int i = 0; i < slices; i++ ) { CLDevice device = queues[i].getDevice(); boolean doubleFP = doublePrecision && isDoubleFPAvailable(device); CLEvent event = probes.getEvent(i); long start = event.getProfilingInfo(START); long end = event.getProfilingInfo(END); textRenderer.draw(device.getType().toString() + i + " " + (int)((end - start) / 1000000.0f) + "ms @" + (doubleFP ? "64bit" : "32bit"), 10, height - (20 + 16 * (slices - i))); } textRenderer.endRendering(); */ } private void handleIO() { if ( Keyboard.getNumKeyboardEvents() != 0 ) { while ( Keyboard.next() ) { if ( Keyboard.getEventKeyState() ) continue; final int key = Keyboard.getEventKey(); if ( Keyboard.KEY_1 <= key && key <= Keyboard.KEY_8 ) { int number = key - Keyboard.KEY_1 + 1; slices = min(number, min(queues.length, MAX_PARALLELISM_LEVEL)); System.out.println("NEW PARALLELISM LEVEL: " + slices); buffersInitialized = false; } else { switch ( Keyboard.getEventKey() ) { case Keyboard.KEY_SPACE: drawSeparator = !drawSeparator; System.out.println("SEPARATOR DRAWING IS NOW: " + (drawSeparator ? "ON" : "OFF")); break; case Keyboard.KEY_D: doublePrecision = !doublePrecision; System.out.println("DOUBLE PRECISION IS NOW: " + (doublePrecision ? "ON" : "OFF")); rebuild = true; break; case Keyboard.KEY_HOME: minX = -2f; minY = -1.2f; maxX = 0.6f; maxY = 1.3f; break; case Keyboard.KEY_ESCAPE: run = false; break; } } } } while ( Mouse.next() ) { final int eventBtn = Mouse.getEventButton(); final int x = Mouse.getX(); final int y = Mouse.getY(); if ( Mouse.isButtonDown(0) && (x != mouseX || y != mouseY) ) { if ( !dragging ) { dragging = true; dragX = mouseX; dragY = mouseY; dragMinX = minX; dragMinY = minY; dragMaxX = maxX; dragMaxY = maxY; } double offsetX = (x - dragX) * (maxX - minX) / width; double offsetY = (y - dragY) * (maxY - minY) / height; minX = dragMinX - offsetX; minY = dragMinY - offsetY; maxX = dragMaxX - offsetX; maxY = dragMaxY - offsetY; } else { if ( dragging ) dragging = false; if ( eventBtn == -1 ) { final int dwheel = Mouse.getEventDWheel(); if ( dwheel != 0 ) { double scaleFactor = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL) ? 0.25 : 0.05; double scale = dwheel > 0 ? scaleFactor : -scaleFactor; double deltaX = scale * (maxX - minX); double deltaY = scale * (maxY - minY); // offset for "zoom to cursor" double offsetX = (x / (double)width - 0.5) * deltaX * 2.0; double offsetY = (y / (double)height - 0.5) * deltaY * 2.0; minX += deltaX + offsetX; minY += deltaY - offsetY; maxX += -deltaX + offsetX; maxY += -deltaY - offsetY; } } } mouseX = x; mouseY = y; } } private static boolean isDoubleFPAvailable(CLDevice device) { final CLDeviceCapabilities caps = CLCapabilities.getDeviceCapabilities(device); return caps.CL_KHR_fp64 || caps.CL_AMD_fp64; } private void createPrograms() throws IOException { final String source = getProgramSource("org/lwjgl/test/opencl/gl/Mandelbrot.cl"); for ( int i = 0; i < programs.length; i++ ) programs[i] = clCreateProgramWithSource(clContext, source, null); } private String getProgramSource(final String file) throws IOException { InputStream source = null; URL sourceURL = Thread.currentThread().getContextClassLoader().getResource(file); if(sourceURL != null) { source = sourceURL.openStream(); } if ( source == null ) // dev-mode source = new FileInputStream("src/java/" + file); final BufferedReader reader = new BufferedReader(new InputStreamReader(source)); final StringBuilder sb = new StringBuilder(); String line; try { while ( (line = reader.readLine()) != null ) sb.append(line).append("\n"); } finally { source.close(); } return sb.toString(); } private static void initColorMap(IntBuffer colorMap, int stepSize, ReadableColor... colors) { for ( int n = 0; n < colors.length - 1; n++ ) { ReadableColor color = colors[n]; int r0 = color.getRed(); int g0 = color.getGreen(); int b0 = color.getBlue(); color = colors[n + 1]; int r1 = color.getRed(); int g1 = color.getGreen(); int b1 = color.getBlue(); int deltaR = r1 - r0; int deltaG = g1 - g0; int deltaB = b1 - b0; for ( int step = 0; step < stepSize; step++ ) { float alpha = (float)step / (stepSize - 1); int r = (int)(r0 + alpha * deltaR); int g = (int)(g0 + alpha * deltaG); int b = (int)(b0 + alpha * deltaB); colorMap.put((r << 0) | (g << 8) | (b << 16)); } } } private static void initView(int width, int height) { glViewport(0, 0, width, height); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, width, 0.0, height, 0.0, 1.0); } }lwjgl-2.7.1/src/java/org/lwjgl/test/WindowCreationTest.java0000644000175000017500000002227011543426510022760 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test; import org.lwjgl.LWJGLException; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import org.lwjgl.opengl.GL11; import static org.lwjgl.opengl.GL11.*; /** * Small class for testing that the Window is creatable * If this class can't run, LWJGL wont work! * * @author Brian Matzon */ public class WindowCreationTest { /** Locatable modes */ private DisplayMode[] located_modes; /** Fixed selectable modes */ private DisplayMode[] fixed_modes = new DisplayMode[10]; /** Window position x */ private int window_x; /** Window position y */ private int window_y; /** Color being cleared to */ private float color = 0f; /** Direction moving clearing color */ private int direction = 1; /** Whether we're running */ private boolean running; /** Whether we're in fullscreen mode */ private boolean fullscreen; /** * Initializes the test * @return true if initialization was successfull */ public boolean initialize() { try { // get available modes, and print out located_modes = Display.getAvailableDisplayModes(); System.out.println("Found " + located_modes.length + " display modes"); // get 640x480, 800x600, 1024x768 modes findFixedModes(); // create default windowed display 640*480 @ 100, 100 setDefaultDisplayMode(); window_x = window_y = 100; Display.setLocation(window_x, window_y); Display.create(); return true; } catch (LWJGLException le) { le.printStackTrace(); } return false; } /** Locate fixed modes */ private void findFixedModes() { // get 640*480 modes fixed_modes[0] = getDisplayMode(640, 480, 16, -1); fixed_modes[1] = getDisplayMode(640, 480, 24, -1); fixed_modes[2] = getDisplayMode(640, 480, 32, -1); // get 800*600*16*60 fixed_modes[3] = getDisplayMode(800, 600, 16, -1); fixed_modes[4] = getDisplayMode(800, 600, 24, -1); fixed_modes[5] = getDisplayMode(800, 600, 32, -1); // get 1024*768*16*60 fixed_modes[6] = getDisplayMode(1024, 768, 16, -1); fixed_modes[7] = getDisplayMode(1024, 768, 24, -1); fixed_modes[8] = getDisplayMode(1024, 768, 32, -1); } /** * Executes the test */ private void execute() { running = true; // wait for user to close window while (!Display.isCloseRequested() && running) { // handle input accordingly handleInput(); // render something render(); // update display as needed Display.update(); // no need to run at full speed try { Thread.sleep(100); } catch (Exception e) { e.printStackTrace(); } } } /** * Destroys any resources used while running test */ public void destroy() { // nuke window and get out Display.destroy(); } /** * Handles the input */ private void handleInput() { while (Keyboard.next()) { // we only want key down events if (!Keyboard.getEventKeyState()) { continue; } // check for exit if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { running = false; } // check for listing of modes if (Keyboard.getEventKey() == Keyboard.KEY_L) { for(int i=0;i 1f) { color = 1f; direction = -1 * direction; } else if (color < 0f) { direction = -1 * direction; color = 0f; } } /** * Main entry point * * @param args ignored params to app */ public static void main(String[] args) throws LWJGLException { System.out.println("The following keys are available:\n" + "ESCAPE:\t\tExit test\n" + "ARROW Keys:\tMove window when in non-fullscreen mode\n" + "L:\t\tList selectable display modes\n" + "0-8:\t\tSelection of display modes\n" + "F:\t\tToggle fullscreen\n" + "SHIFT-F:\tToggle fullscreen with Display.destroy()/create() cycle"); WindowCreationTest wct = new WindowCreationTest(); if (wct.initialize()) { wct.execute(); wct.destroy(); } System.exit(0); } /** * Sets the display mode for fullscreen mode */ protected boolean setDefaultDisplayMode() { try { // get modes DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, -1, -1); org.lwjgl.util.Display.setDisplayMode(dm, new String[] { "width=" + 640, "height=" + 480, "freq=" + 60, "bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel()}); return true; } catch (Exception e) { e.printStackTrace(); } return false; } /** * Gets a specific display mode */ private DisplayMode getDisplayMode(int width, int height, int bpp, int freq) { DisplayMode[] dm = null; try { dm = org.lwjgl.util.Display.getAvailableDisplayModes(width, height, width, height, bpp, bpp, freq, freq); if(dm == null || dm.length == 0) { System.out.println("Problem retrieving mode with " + width + "x" + height + "x" + bpp + "@" + freq); } } catch (LWJGLException le) { le.printStackTrace(); System.out.println("Problem retrieving mode with " + width + "x" + height + "x" + bpp + "@" + freq); } return (dm != null && dm.length != 0) ? dm[0] : null; } } lwjgl-2.7.1/src/java/org/lwjgl/test/applet/0000755000175000017500000000000011543426510017603 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/test/applet/AppletLoaderTest.java0000644000175000017500000000445711543426510023674 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.applet; import java.applet.Applet; import java.awt.BorderLayout; import java.awt.Canvas; public class AppletLoaderTest extends Applet { Test test; public void destroy() { super.destroy(); System.out.println("*** destroy ***"); } public void start() { super.start(); System.out.println("*** start ***"); } public void stop() { super.stop(); System.out.println("*** stop ***"); test.stop(); } public void init() { System.out.println("*** init ***"); setLayout(new BorderLayout()); try { test = (Test) Class.forName(getParameter("test")).newInstance(); Canvas canvas = (Canvas) test; canvas.setSize(getWidth(), getHeight()); add(canvas); } catch (Exception e) { e.printStackTrace(); } test.start(); } } lwjgl-2.7.1/src/java/org/lwjgl/test/applet/GearsApplet.java0000644000175000017500000003050011543426510022653 0ustar zero79zero79package org.lwjgl.test.applet; import java.applet.Applet; import java.awt.BorderLayout; import java.awt.Canvas; import java.nio.FloatBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.Sys; import org.lwjgl.opengl.Display; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GLContext; import static org.lwjgl.opengl.ARBTransposeMatrix.*; import static org.lwjgl.opengl.GL11.*; public class GearsApplet extends Applet { /** The Canvas where the LWJGL Display is added */ Canvas display_parent; /** Thread which runs the main game loop */ Thread gameThread; /** is the game loop running */ boolean running; /** variables used to rotate the view */ private float view_rotx = 20.0f; private float view_roty = 30.0f; private float view_rotz; private int gear1; private int gear2; private int gear3; private float angle; boolean keyDown; private int prevMouseX, prevMouseY; private boolean mouseButtonDown; /** * Once the Canvas is created its add notify method will call this method to * start the LWJGL Display and game loop in another thread. */ public void startLWJGL() { gameThread = new Thread() { public void run() { running = true; try { Display.setParent(display_parent); //Display.setVSyncEnabled(true); Display.create(); initGL(); } catch (LWJGLException e) { e.printStackTrace(); } gameLoop(); } }; gameThread.start(); } /** * Tell game loop to stop running, after which the LWJGL Display will be destoryed. * The main thread will wait for the Display.destroy() to complete */ private void stopLWJGL() { running = false; try { gameThread.join(); } catch (InterruptedException e) { e.printStackTrace(); } } public void start() { } public void stop() { } /** * Applet Destroy method will remove the canvas, before canvas is destroyed it will notify * stopLWJGL() to stop main game loop and to destroy the Display */ public void destroy() { remove(display_parent); super.destroy(); System.out.println("Clear up"); } /** * initialise applet by adding a canvas to it, this canvas will start the LWJGL Display and game loop * in another thread. It will also stop the game loop and destroy the display on canvas removal when * applet is destroyed. */ public void init() { setLayout(new BorderLayout()); try { display_parent = new Canvas() { public void addNotify() { super.addNotify(); startLWJGL(); } public void removeNotify() { stopLWJGL(); super.removeNotify(); } }; display_parent.setSize(getWidth(),getHeight()); add(display_parent); display_parent.setFocusable(true); display_parent.requestFocus(); display_parent.setIgnoreRepaint(true); //setResizable(true); setVisible(true); } catch (Exception e) { System.err.println(e); throw new RuntimeException("Unable to create display"); } } public void gameLoop() { long startTime = System.currentTimeMillis() + 5000; long fps = 0; while(running) { angle += 2.0f; // draw the gears drawLoop(); Display.update(); if (startTime > System.currentTimeMillis()) { fps++; } else { long timeUsed = 5000 + (startTime - System.currentTimeMillis()); startTime = System.currentTimeMillis() + 5000; System.out.println(fps + " frames 2 in " + timeUsed / 1000f + " seconds = " + (fps / (timeUsed / 1000f))); fps = 0; } if (Mouse.isButtonDown(0)) { if (!mouseButtonDown) { prevMouseX = Mouse.getX(); prevMouseY= Mouse.getY(); } mouseButtonDown = true; } else { mouseButtonDown = false; } if (mouseButtonDown) { int x = Mouse.getX(); int y = Mouse.getY(); float thetaY = 360.0f * ( (float)(x-prevMouseX)/(float)display_parent.getWidth()); float thetaX = 360.0f * ( (float)(prevMouseY-y)/(float)display_parent.getHeight()); prevMouseX = x; prevMouseY = y; view_rotx += thetaX; view_roty += thetaY; } // F Key Pressed (i.e. released) if (keyDown && !Keyboard.isKeyDown(Keyboard.KEY_F)) { keyDown = false; try { if (Display.isFullscreen()) { Display.setFullscreen(false); } else { Display.setFullscreen(true); } } catch (LWJGLException e) { e.printStackTrace(); } } } Display.destroy(); } public void drawLoop() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glRotatef(view_rotx, 1.0f, 0.0f, 0.0f); glRotatef(view_roty, 0.0f, 1.0f, 0.0f); glRotatef(view_rotz, 0.0f, 0.0f, 1.0f); glPushMatrix(); glTranslatef(-3.0f, -2.0f, 0.0f); glRotatef(angle, 0.0f, 0.0f, 1.0f); glCallList(gear1); glPopMatrix(); glPushMatrix(); glTranslatef(3.1f, -2.0f, 0.0f); glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f); glCallList(gear2); glPopMatrix(); glPushMatrix(); glTranslatef(-3.1f, 4.2f, 0.0f); glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f); glCallList(gear3); glPopMatrix(); glPopMatrix(); } protected void initGL() { try { // setup ogl FloatBuffer pos = BufferUtils.createFloatBuffer(4).put(new float[] { 5.0f, 5.0f, 10.0f, 0.0f}); FloatBuffer red = BufferUtils.createFloatBuffer(4).put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f}); FloatBuffer green = BufferUtils.createFloatBuffer(4).put(new float[] { 0.0f, 0.8f, 0.2f, 1.0f}); FloatBuffer blue = BufferUtils.createFloatBuffer(4).put(new float[] { 0.2f, 0.2f, 1.0f, 1.0f}); pos.flip(); red.flip(); green.flip(); blue.flip(); glLight(GL_LIGHT0, GL_POSITION, pos); glEnable(GL_CULL_FACE); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); /* make the gears */ gear1 = glGenLists(1); glNewList(gear1, GL_COMPILE); glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); gear(1.0f, 4.0f, 1.0f, 20, 0.7f); glEndList(); gear2 = glGenLists(1); glNewList(gear2, GL_COMPILE); glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); gear(0.5f, 2.0f, 2.0f, 10, 0.7f); glEndList(); gear3 = glGenLists(1); glNewList(gear3, GL_COMPILE); glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); gear(1.3f, 2.0f, 0.5f, 10, 0.7f); glEndList(); glEnable(GL_NORMALIZE); glMatrixMode(GL_PROJECTION); System.err.println("LWJGL: " + Sys.getVersion() + " / " + LWJGLUtil.getPlatformName()); System.err.println("GL_VENDOR: " + glGetString(GL_VENDOR)); System.err.println("GL_RENDERER: " + glGetString(GL_RENDERER)); System.err.println("GL_VERSION: " + glGetString(GL_VERSION)); System.err.println(); System.err.println("glLoadTransposeMatrixfARB() supported: " + GLContext.getCapabilities().GL_ARB_transpose_matrix); if (!GLContext.getCapabilities().GL_ARB_transpose_matrix) { // --- not using extensions glLoadIdentity(); } else { // --- using extensions final FloatBuffer identityTranspose = BufferUtils.createFloatBuffer(16).put( new float[] { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}); identityTranspose.flip(); glLoadTransposeMatrixARB(identityTranspose); } float h = (float) display_parent.getHeight() / (float) display_parent.getWidth(); glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0f, 0.0f, -40.0f); } catch (Exception e) { System.err.println(e); running = false; } } /** * Draw a gear wheel. You'll probably want to call this function when * building a display list since we do a lot of trig here. * * @param inner_radius radius of hole at center * @param outer_radius radius at center of teeth * @param width width of gear * @param teeth number of teeth * @param tooth_depth depth of tooth */ private void gear(float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) { int i; float r0, r1, r2; float angle, da; float u, v, len; r0 = inner_radius; r1 = outer_radius - tooth_depth / 2.0f; r2 = outer_radius + tooth_depth / 2.0f; da = 2.0f * (float) Math.PI / teeth / 4.0f; glShadeModel(GL_FLAT); glNormal3f(0.0f, 0.0f, 1.0f); /* draw front face */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); if (i < teeth) { glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f); } } glEnd(); /* draw front sides of teeth */ glBegin(GL_QUADS); for (i = 0; i < teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + 2.0f * da), r2 * (float) Math.sin(angle + 2.0f * da), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f); } glEnd(); /* draw back face */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); } glEnd(); /* draw back sides of teeth */ glBegin(GL_QUADS); for (i = 0; i < teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); } glEnd(); /* draw outward faces of teeth */ glBegin(GL_QUAD_STRIP); for (i = 0; i < teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); u = r2 * (float) Math.cos(angle + da) - r1 * (float) Math.cos(angle); v = r2 * (float) Math.sin(angle + da) - r1 * (float) Math.sin(angle); len = (float) Math.sqrt(u * u + v * v); u /= len; v /= len; glNormal3f(v, -u, 0.0f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f); glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f); glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f); u = r1 * (float) Math.cos(angle + 3 * da) - r2 * (float) Math.cos(angle + 2 * da); v = r1 * (float) Math.sin(angle + 3 * da) - r2 * (float) Math.sin(angle + 2 * da); glNormal3f(v, -u, 0.0f); glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f); } glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), width * 0.5f); glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), -width * 0.5f); glEnd(); glShadeModel(GL_SMOOTH); /* draw inside radius cylinder */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glNormal3f(-(float) Math.cos(angle), -(float) Math.sin(angle), 0.0f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); } glEnd(); } }lwjgl-2.7.1/src/java/org/lwjgl/test/applet/OpenAL.java0000644000175000017500000001224311543426510021566 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.applet; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.openal.AL; import org.lwjgl.openal.AL10; import org.lwjgl.opengl.AWTGLCanvas; import org.lwjgl.opengl.Display; import org.lwjgl.util.WaveData; import static org.lwjgl.opengl.GL11.*; public class OpenAL extends AWTGLCanvas implements Test { float angle; // create 1 buffer and 1 source IntBuffer buffers = BufferUtils.createIntBuffer(1); IntBuffer sources = BufferUtils.createIntBuffer(1); public OpenAL() throws LWJGLException { try { AL.create(); } catch (Exception e) { System.out.println("Unable to create OpenAL.\nPlease make sure that OpenAL is available on this system. Exception: " + e); return; } Thread t = new Thread() { public void run() { while (true) { if (isVisible()) repaint(); Display.sync(60); } } }; t.setDaemon(true); t.start(); } private void playOpenAL() { int lastError; // al generate buffers and sources buffers.position(0).limit(1); AL10.alGenBuffers(buffers); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } sources.position(0).limit(1); AL10.alGenSources(sources); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } // load wave data from buffer WaveData wavefile = WaveData.create(getClass().getClassLoader().getResourceAsStream("Footsteps.wav")); //copy to buffers AL10.alBufferData(buffers.get(0), wavefile.format, wavefile.data, wavefile.samplerate); //unload file again wavefile.dispose(); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //set up source input AL10.alSourcei(sources.get(0), AL10.AL_BUFFER, buffers.get(0)); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //lets loop the sound AL10.alSourcei(sources.get(0), AL10.AL_LOOPING, AL10.AL_TRUE); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //play source 0 AL10.alSourcePlay(sources.get(0)); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } } private void exit(int error) { System.out.println("OpenAL Error: " + AL10.alGetString(error)); } public void paintGL() { glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_PROJECTION_MATRIX); glLoadIdentity(); glOrtho(0, 640, 0, 480, 1, -1); glMatrixMode(GL_MODELVIEW_MATRIX); glPushMatrix(); glTranslatef(320, 240, 0.0f); glRotatef(angle, 0, 0, 1.0f); glBegin(GL_QUADS); glVertex2i(-50, -50); glVertex2i(50, -50); glVertex2i(50, 50); glVertex2i(-50, 50); glEnd(); glPopMatrix(); angle += 1; try { swapBuffers(); } catch (Exception e) {/*OK*/ } } public void start() { playOpenAL(); } public void stop() { int lastError; //stop source 0 AL10.alSourceStop(sources.get(0)); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //delete buffers and sources sources.position(0).limit(1); AL10.alDeleteSources(sources); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } buffers.position(0).limit(1); AL10.alDeleteBuffers(buffers); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } AL.destroy(); } } lwjgl-2.7.1/src/java/org/lwjgl/test/applet/Test.java0000644000175000017500000000317211543426510021370 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.applet; public interface Test { void start(); void stop(); } lwjgl-2.7.1/src/java/org/lwjgl/test/applet/Speed.java0000644000175000017500000000550111543426510021507 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.applet; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.AWTGLCanvas; import static org.lwjgl.opengl.GL11.*; public class Speed extends AWTGLCanvas implements Test { private float angle; private long startTime = System.currentTimeMillis() + 5000; private long fps; public Speed() throws LWJGLException { } public void paintGL() { glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_PROJECTION_MATRIX); glLoadIdentity(); glOrtho(0, 640, 0, 480, 1, -1); glMatrixMode(GL_MODELVIEW_MATRIX); glPushMatrix(); glTranslatef(320, 240, 0.0f); glRotatef(angle, 0, 0, 1.0f); glBegin(GL_QUADS); glVertex2i(-50, -50); glVertex2i(50, -50); glVertex2i(50, 50); glVertex2i(-50, 50); glEnd(); glPopMatrix(); angle += 1; try { swapBuffers(); if (isVisible()) { Thread.yield(); // Helps input responsiveness on linux repaint(); } } catch (Exception e) {/*OK*/ } if (startTime > System.currentTimeMillis()) { fps++; } else { long timeUsed = 5000 + (startTime - System.currentTimeMillis()); startTime = System.currentTimeMillis() + 5000; System.out.println(fps + " frames in " + timeUsed / 1000f + " seconds = " + (fps / (timeUsed / 1000f))); fps = 0; } } public void start() { } public void stop() { } } lwjgl-2.7.1/src/java/org/lwjgl/test/applet/ControllersTest.java0000644000175000017500000000375211543426510023623 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.applet; import java.awt.Canvas; import org.lwjgl.LWJGLException; import org.lwjgl.input.Controllers; public class ControllersTest extends Canvas implements Test { public void start() { try { Controllers.create(); } catch (LWJGLException e) { e.printStackTrace(); return; } System.out.println("Controllers.getControllerCount() = " + Controllers.getControllerCount()); } public void stop() { } } lwjgl-2.7.1/src/java/org/lwjgl/test/applet/OpenGL.java0000644000175000017500000000720411543426510021575 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.applet; import org.lwjgl.LWJGLException; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.AWTGLCanvas; import static org.lwjgl.opengl.GL11.*; public class OpenGL extends AWTGLCanvas implements Test { float angle; float x; float y; public OpenGL() throws LWJGLException { } public void initGL() { glMatrixMode(GL_PROJECTION_MATRIX); glLoadIdentity(); glOrtho(0, 640, 0, 480, 1, -1); x = 320; y = 240; glMatrixMode(GL_MODELVIEW_MATRIX); setVSyncEnabled(true); } public void paintGL() { glClear(GL_COLOR_BUFFER_BIT); glPushMatrix(); glTranslatef(x, y, 0.0f); glRotatef(angle, 0, 0, 1.0f); glBegin(GL_QUADS); glVertex2i(-50, -50); glVertex2i(50, -50); glVertex2i(50, 50); glVertex2i(-50, 50); glEnd(); glPopMatrix(); angle += 1; if (Mouse.isCreated()) { Mouse.poll(); while (Mouse.next()) { x += Mouse.getEventDX(); y += Mouse.getEventDY(); } } if (Keyboard.isCreated()) { Keyboard.poll(); } while (Keyboard.isCreated() && Keyboard.next()) { if (Keyboard.getEventKey() != Keyboard.KEY_NONE) { String key_name = Keyboard.getKeyName(Keyboard.getEventKey()); if (Keyboard.getEventKeyState()) { switch (Keyboard.getEventKey()) { case Keyboard.KEY_G: Mouse.setGrabbed(!Mouse.isGrabbed()); break; default: break; } System.out.println("Pressed: " + key_name); } else System.out.println("Released: " + key_name); } if (Keyboard.getEventCharacter() != Keyboard.CHAR_NONE) System.out.println("Typed: " + Keyboard.getEventCharacter()); } if (Keyboard.isCreated()) { if (Keyboard.isKeyDown(Keyboard.KEY_UP)) y += 5; else if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) y -= 5; if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) x -= 5; else if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) x += 5; } try { swapBuffers(); if (isVisible()) { Thread.yield(); // Helps input responsiveness on linux repaint(); } } catch (Exception e) {/*OK*/ } } public void start() { } public void stop() { } } lwjgl-2.7.1/src/java/org/lwjgl/test/openal/0000755000175000017500000000000011543426510017574 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/test/openal/PlayTestMemory.java0000644000175000017500000001736411543426510023410 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.openal; import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.openal.AL10; import org.lwjgl.util.WaveData; /** * * This is a basic play test * Yes, over zealous use of getError ;) * * @author Brian Matzon * @version $Revision: 2983 $ * $Id: PlayTestMemory.java 2983 2008-04-07 18:36:09Z matzon $ */ public class PlayTestMemory extends BasicTest { private boolean usingVorbis; /** * Creates an instance of PlayTestMemory */ public PlayTestMemory() { super(); } /** * Runs the actual test, using supplied arguments */ protected void execute(String[] args) { if(args.length < 1) { System.out.println("no argument supplied, assuming Footsteps.wav"); args = new String[] {"Footsteps.wav"}; } if(args[0].endsWith(".ogg")) { System.out.print("Attempting to load Ogg Vorbis file, checking for extension..."); if(AL10.alIsExtensionPresent("AL_EXT_vorbis")) { System.out.println("found"); usingVorbis = true; } else { System.out.println("not supported"); alExit(); System.exit(-1); } } int lastError; //create 1 buffer and 1 source IntBuffer buffers = BufferUtils.createIntBuffer(1); IntBuffer sources = BufferUtils.createIntBuffer(1); // al generate buffers and sources buffers.position(0).limit(1); AL10.alGenBuffers(buffers); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } sources.position(0).limit(1); AL10.alGenSources(sources); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //load wave data ByteBuffer filebuffer = getData(args[0]); if(filebuffer == null) { System.out.println("Error loading file: " + args[0]); System.exit(-1); } System.out.println("loaded " + filebuffer.capacity()); //ALUTLoadWAVData file = alut.loadWAVMemory(Sys.getDirectBufferAddress(filebuffer)); if(usingVorbis) { // pass directly to buffer data AL10.alBufferData(buffers.get(0), AL10.AL_FORMAT_VORBIS_EXT, filebuffer, -1); filebuffer.clear(); } else { // load wave data from buffer WaveData wavefile = WaveData.create(filebuffer.array()); //copy to buffers AL10.alBufferData(buffers.get(0), wavefile.format, wavefile.data, wavefile.samplerate); //unload file again wavefile.dispose(); } // check for errors if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //set up source input AL10.alSourcei(sources.get(0), AL10.AL_BUFFER, buffers.get(0)); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //lets loop the sound AL10.alSourcei(sources.get(0), AL10.AL_LOOPING, AL10.AL_TRUE); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //play source 0 AL10.alSourcePlay(sources.get(0)); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //wait 5 secs try { System.out.println("Waiting 5 seconds for sound to complete"); Thread.sleep(5000); } catch (InterruptedException inte) { } //stop source 0 AL10.alSourceStop(sources.get(0)); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //delete buffers and sources sources.position(0).limit(1); AL10.alDeleteSources(sources); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } buffers.position(0).limit(1); AL10.alDeleteBuffers(buffers); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //no errorchecking from now on, since our context is gone. alExit(); } /** * Reads the file into a ByteBuffer * * @param filename Name of file to load * @return ByteBuffer containing file data */ protected ByteBuffer getData(String filename) { ByteBuffer buffer = null; System.out.println("Attempting to load: " + filename); try { BufferedInputStream bis = new BufferedInputStream(WaveData.class.getClassLoader().getResourceAsStream(filename)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); int bufferLength = 4096; byte[] readBuffer = new byte[bufferLength]; int read = -1; while((read = bis.read(readBuffer, 0, bufferLength)) != -1) { baos.write(readBuffer, 0, read); } //done reading, close bis.close(); // if ogg vorbis data, we need to pass it unmodified to alBufferData if(usingVorbis) { buffer = ByteBuffer.allocateDirect(baos.size()); } else { buffer = ByteBuffer.allocate(baos.size()); } buffer.order(ByteOrder.nativeOrder()); buffer.put(baos.toByteArray()); buffer.rewind(); } catch (Exception ioe) { ioe.printStackTrace(); } return buffer; } /** * main entry point * * @param args String array containing arguments */ public static void main(String[] args) { PlayTestMemory playTestMemory = new PlayTestMemory(); playTestMemory.execute(args); System.exit(0); } } lwjgl-2.7.1/src/java/org/lwjgl/test/openal/EFX10Test.java0000644000175000017500000004774011543426510022076 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.openal; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.openal.AL; import org.lwjgl.openal.AL10; import org.lwjgl.openal.AL11; import org.lwjgl.openal.ALC10; import org.lwjgl.openal.ALCcontext; import org.lwjgl.openal.ALCdevice; import org.lwjgl.openal.EFX10; import org.lwjgl.openal.EFXUtil; import org.lwjgl.util.WaveData; /** * Class with a few examples testing and demonstrating the use of the OpenAL extension ALC_EXT_EFX. *

      * This class is not compatible with the LWJGL debug build (lwjgl-debug.jar), as the debug build * throws exceptions instead of alGetError checks. The redundant exception handling code was not * added in order to keep these examples simple. * * @author Ciardhubh * @version $Revision$ * $Id$ */ public final class EFX10Test { public static void main(final String[] args) throws Exception { silentTests(); playbackTest(); efxUtilTest(); } /** * Loads OpenAL and makes sure ALC_EXT_EFX is supported. */ private static void setupEfx() throws Exception { // Load and create OpenAL if (!AL.isCreated()) { AL.create(); } // Query for Effect Extension if (!ALC10.alcIsExtensionPresent(AL.getDevice(), EFX10.ALC_EXT_EFX_NAME)) { throw new Exception("No ALC_EXT_EFX supported by driver."); } System.out.println("ALC_EXT_EFX found."); } /** * Runs a series of API calls similar to the tutorials in the Effects Extension Guide of the * OpenAL SDK. Nothing is played in this method. */ private static void silentTests() throws Exception { setupEfx(); final ALCdevice device = AL.getDevice(); // Create context (only necessary if LWJGL context isn't sufficient, done as example) final IntBuffer contextAttribList = BufferUtils.createIntBuffer(8); contextAttribList.put(ALC10.ALC_FREQUENCY); contextAttribList.put(44100); contextAttribList.put(ALC10.ALC_REFRESH); contextAttribList.put(60); contextAttribList.put(ALC10.ALC_SYNC); contextAttribList.put(ALC10.ALC_FALSE); contextAttribList.rewind(); // ALC_MAX_AUXILIARY_SENDS won't go above compile-time max. Set to compile-time max if // greater. contextAttribList.put(EFX10.ALC_MAX_AUXILIARY_SENDS); contextAttribList.put(2); final ALCcontext newContext = ALC10.alcCreateContext(device, contextAttribList); if (newContext == null) { throw new Exception("Failed to create context."); } final int contextCurResult = ALC10.alcMakeContextCurrent(newContext); if (contextCurResult == ALC10.ALC_FALSE) { throw new Exception("Failed to make context current."); } // Query EFX ALC values System.out.println("AL_VERSION: " + AL10.alGetString(AL10.AL_VERSION)); final IntBuffer buff = BufferUtils.createIntBuffer(1); ALC10.alcGetInteger(device, EFX10.ALC_EFX_MAJOR_VERSION, buff); System.out.println("ALC_EFX_MAJOR_VERSION: " + buff.get(0)); ALC10.alcGetInteger(device, EFX10.ALC_EFX_MINOR_VERSION, buff); System.out.println("ALC_EFX_MINOR_VERSION: " + buff.get(0)); ALC10.alcGetInteger(device, EFX10.ALC_MAX_AUXILIARY_SENDS, buff); final int maxAuxSends = buff.get(0); System.out.println("ALC_MAX_AUXILIARY_SENDS: " + maxAuxSends); // Try to create 4 Auxiliary Effect Slots int numAuxSlots = 0; final int[] auxEffectSlots = new int[4]; // try more to test AL10.alGetError(); for (numAuxSlots = 0; numAuxSlots < 4; numAuxSlots++) { auxEffectSlots[numAuxSlots] = EFX10.alGenAuxiliaryEffectSlots(); if (AL10.alGetError() != AL10.AL_NO_ERROR) { break; } } System.out.println("Created " + numAuxSlots + " aux effect slots."); // Try to create 2 Effects int numEffects = 0; final int[] effects = new int[2]; for (numEffects = 0; numEffects < 2; numEffects++) { effects[numEffects] = EFX10.alGenEffects(); if (AL10.alGetError() != AL10.AL_NO_ERROR) { break; } } System.out.println("Created " + numEffects + " effects."); // Set first Effect Type to Reverb and change Decay Time AL10.alGetError(); if (EFX10.alIsEffect(effects[0])) { EFX10.alEffecti(effects[0], EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_REVERB); if (AL10.alGetError() != AL10.AL_NO_ERROR) { System.out.println("Reverb effect not supported."); } else { EFX10.alEffectf(effects[0], EFX10.AL_REVERB_DECAY_TIME, 5.0f); System.out.println("Reverb effect created."); } } else { throw new Exception("First effect not a valid effect."); } // Set second Effect Type to Flanger and change Phase AL10.alGetError(); if (EFX10.alIsEffect(effects[1])) { EFX10.alEffecti(effects[1], EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_FLANGER); if (AL10.alGetError() != AL10.AL_NO_ERROR) { System.out.println("Flanger effect not support."); } else { EFX10.alEffecti(effects[1], EFX10.AL_FLANGER_PHASE, 180); System.out.println("Flanger effect created."); } } else { throw new Exception("Second effect not a valid effect."); } // Try to create a Filter AL10.alGetError(); final int filter = EFX10.alGenFilters(); if (AL10.alGetError() != AL10.AL_NO_ERROR) { throw new Exception("Failed to create filter."); } System.out.println("Generated a filter."); if (EFX10.alIsFilter(filter)) { // Set Filter type to Low-Pass and set parameters EFX10.alFilteri(filter, EFX10.AL_FILTER_TYPE, EFX10.AL_FILTER_LOWPASS); if (AL10.alGetError() != AL10.AL_NO_ERROR) { System.out.println("Low pass filter not supported."); } else { EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAIN, 0.5f); EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAINHF, 0.5f); System.out.println("Low pass filter created."); } } // Attach Effect to Auxiliary Effect Slot AL10.alGetError(); EFX10.alAuxiliaryEffectSloti(auxEffectSlots[0], EFX10.AL_EFFECTSLOT_EFFECT, effects[0]); if (AL10.alGetError() != AL10.AL_NO_ERROR) { throw new Exception("Failed to attach effect to aux effect slot."); } System.out.println("Successfully loaded effect into effect slot."); // Configure Source Auxiliary Effect Slot Sends final int source = AL10.alGenSources(); // Set Source Send 0 to feed auxEffectSlots[0] without filtering AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, auxEffectSlots[0], 0, EFX10.AL_FILTER_NULL); if (AL10.alGetError() != AL10.AL_NO_ERROR) { throw new Exception("Failed to configure Source Send 0"); } System.out.println("Linked aux effect slot to soutce slot 0"); // Set Source Send 1 to feed uiEffectSlot[1] with filter filter AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, auxEffectSlots[1], 1, filter); if (AL10.alGetError() != AL10.AL_NO_ERROR) { // e.g. if only 1 send per source is available throw new Exception("Failed to configure Source Send 1"); } System.out.println("Linked aux effect slot to soutce slot 1"); // Disable Send 0 AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, EFX10.AL_EFFECTSLOT_NULL, 0, EFX10.AL_FILTER_NULL); if (AL10.alGetError() != AL10.AL_NO_ERROR) { throw new Exception("Failed to disable Source Send 0"); } System.out.println("Disabled source send 0"); // Disable Send 1 AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, EFX10.AL_EFFECTSLOT_NULL, 1, EFX10.AL_FILTER_NULL); if (AL10.alGetError() != AL10.AL_NO_ERROR) { throw new Exception("Failed to disable Source Send 1"); } System.out.println("Disabled source send 1"); // Filter 'source', a generated Source AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, filter); if (AL10.alGetError() == AL10.AL_NO_ERROR) { { System.out.println("Successfully applied a direct path filter"); // Remove filter from 'source' AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, EFX10.AL_FILTER_NULL); if (AL10.alGetError() == AL10.AL_NO_ERROR) { System.out.println("Successfully removed direct filter"); } } // Filter the Source send 0 from 'source' to Auxiliary Effect Slot auxEffectSlot[0] // using Filter uiFilter[0] AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, auxEffectSlots[0], 0, filter); if (AL10.alGetError() == AL10.AL_NO_ERROR) { { System.out.println("Successfully applied aux send filter"); // Remove Filter from Source Auxiliary Send AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, auxEffectSlots[0], 0, EFX10.AL_FILTER_NULL); if (AL10.alGetError() == AL10.AL_NO_ERROR) { System.out.println("Successfully removed filter"); } } } } // Set Source Cone Outer Gain HF value AL10.alSourcef(source, EFX10.AL_CONE_OUTER_GAINHF, 0.5f); if (AL10.alGetError() == AL10.AL_NO_ERROR) { System.out.println("Successfully set cone outside gain filter"); } // Set distance units to be in feet AL10.alListenerf(EFX10.AL_METERS_PER_UNIT, 0.3f); if (AL10.alGetError() == AL10.AL_NO_ERROR) { System.out.println("Successfully set distance units"); } // Cleanup final IntBuffer auxEffectSlotsBuf = (IntBuffer) BufferUtils.createIntBuffer( auxEffectSlots.length).put(auxEffectSlots).rewind(); EFX10.alDeleteAuxiliaryEffectSlots(auxEffectSlotsBuf); final IntBuffer effectsBuf = (IntBuffer) BufferUtils.createIntBuffer( effects.length).put(effects).rewind(); EFX10.alDeleteEffects(effectsBuf); EFX10.alDeleteFilters(filter); AL.destroy(); } /** * Plays a sound with various effects applied to it. */ private static void playbackTest() throws Exception { setupEfx(); // Create a source and buffer audio data final int source = AL10.alGenSources(); final int buffer = AL10.alGenBuffers(); WaveData waveFile = WaveData.create("Footsteps.wav"); if (waveFile == null) { System.out.println("Failed to load Footsteps.wav! Skipping playback test."); AL.destroy(); return; } AL10.alBufferData(buffer, waveFile.format, waveFile.data, waveFile.samplerate); waveFile.dispose(); AL10.alSourcei(source, AL10.AL_BUFFER, buffer); AL10.alSourcei(source, AL10.AL_LOOPING, AL10.AL_TRUE); System.out.println("Playing sound unaffected by EFX ..."); AL10.alSourcePlay(source); Thread.sleep(7500); // Add reverb effect final int effectSlot = EFX10.alGenAuxiliaryEffectSlots(); final int reverbEffect = EFX10.alGenEffects(); EFX10.alEffecti(reverbEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_REVERB); EFX10.alEffectf(reverbEffect, EFX10.AL_REVERB_DECAY_TIME, 5.0f); EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, reverbEffect); AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0, EFX10.AL_FILTER_NULL); System.out.println("Playing sound with reverb ..."); AL10.alSourcePlay(source); Thread.sleep(7500); // Add low-pass filter directly to source final int filter = EFX10.alGenFilters(); EFX10.alFilteri(filter, EFX10.AL_FILTER_TYPE, EFX10.AL_FILTER_LOWPASS); EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAIN, 0.5f); EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAINHF, 0.5f); AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, filter); System.out.println("Playing sound with reverb and direct low pass filter ..."); AL10.alSourcePlay(source); Thread.sleep(7500); AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, EFX10.AL_FILTER_NULL); // Add low-pass filter to source send //AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0, filter); // //System.out.println("Playing sound with reverb and aux send low pass filter ..."); //AL10.alSourcePlay(source); //Thread.sleep(7500); // Cleanup AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, EFX10.AL_EFFECTSLOT_NULL, 0, EFX10.AL_FILTER_NULL); EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, EFX10.AL_EFFECT_NULL); EFX10.alDeleteEffects(reverbEffect); EFX10.alDeleteFilters(filter); // Echo effect final int echoEffect = EFX10.alGenEffects(); EFX10.alEffecti(echoEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_ECHO); //EFX10.alEffectf(echoEffect, EFX10.AL_ECHO_DELAY, 5.0f); EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, echoEffect); AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0, EFX10.AL_FILTER_NULL); System.out.println("Playing sound with echo effect ..."); AL10.alSourcePlay(source); Thread.sleep(7500); AL.destroy(); } /** * Checks OpenAL for every EFX 1.0 effect and filter and prints the result to the console. */ private static void efxUtilTest() throws Exception { setupEfx(); System.out.println(); System.out.println("Checking supported effects ..."); if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_NULL)) { System.out.println("AL_EFFECT_NULL is supported."); } else { System.out.println("AL_EFFECT_NULL is NOT supported."); } if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_EAXREVERB)) { System.out.println("AL_EFFECT_EAXREVERB is supported."); } else { System.out.println("AL_EFFECT_EAXREVERB is NOT supported."); } if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_REVERB)) { System.out.println("AL_EFFECT_REVERB is supported."); } else { System.out.println("AL_EFFECT_REVERB is NOT supported."); } if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_CHORUS)) { System.out.println("AL_EFFECT_CHORUS is supported."); } else { System.out.println("AL_EFFECT_CHORUS is NOT supported."); } if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_DISTORTION)) { System.out.println("AL_EFFECT_DISTORTION is supported."); } else { System.out.println("AL_EFFECT_DISTORTION is NOT supported."); } if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_ECHO)) { System.out.println("AL_EFFECT_ECHO is supported."); } else { System.out.println("AL_EFFECT_ECHO is NOT supported."); } if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_FLANGER)) { System.out.println("AL_EFFECT_FLANGER is supported."); } else { System.out.println("AL_EFFECT_FLANGER is NOT supported."); } if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_FREQUENCY_SHIFTER)) { System.out.println("AL_EFFECT_FREQUENCY_SHIFTER is supported."); } else { System.out.println("AL_EFFECT_FREQUENCY_SHIFTER is NOT supported."); } if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_VOCAL_MORPHER)) { System.out.println("AL_EFFECT_VOCAL_MORPHER is supported."); } else { System.out.println("AL_EFFECT_VOCAL_MORPHER is NOT supported."); } if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_PITCH_SHIFTER)) { System.out.println("AL_EFFECT_PITCH_SHIFTER is supported."); } else { System.out.println("AL_EFFECT_PITCH_SHIFTER is NOT supported."); } if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_RING_MODULATOR)) { System.out.println("AL_EFFECT_RING_MODULATOR is supported."); } else { System.out.println("AL_EFFECT_RING_MODULATOR is NOT supported."); } if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_AUTOWAH)) { System.out.println("AL_EFFECT_AUTOWAH is supported."); } else { System.out.println("AL_EFFECT_AUTOWAH is NOT supported."); } if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_COMPRESSOR)) { System.out.println("AL_EFFECT_COMPRESSOR is supported."); } else { System.out.println("AL_EFFECT_COMPRESSOR is NOT supported."); } if (EFXUtil.isEffectSupported(EFX10.AL_EFFECT_EQUALIZER)) { System.out.println("AL_EFFECT_EQUALIZER is supported."); } else { System.out.println("AL_EFFECT_EQUALIZER is NOT supported."); } System.out.println(); System.out.println("Checking supported filters ..."); if (EFXUtil.isFilterSupported(EFX10.AL_FILTER_NULL)) { System.out.println("AL_FILTER_NULL is supported."); } else { System.out.println("AL_FILTER_NULL is NOT supported."); } if (EFXUtil.isFilterSupported(EFX10.AL_FILTER_LOWPASS)) { System.out.println("AL_FILTER_LOWPASS is supported."); } else { System.out.println("AL_FILTER_LOWPASS is NOT supported."); } if (EFXUtil.isFilterSupported(EFX10.AL_FILTER_HIGHPASS)) { System.out.println("AL_FILTER_HIGHPASS is supported."); } else { System.out.println("AL_FILTER_HIGHPASS is NOT supported."); } if (EFXUtil.isFilterSupported(EFX10.AL_FILTER_BANDPASS)) { System.out.println("AL_FILTER_BANDPASS is supported."); } else { System.out.println("AL_FILTER_BANDPASS is NOT supported."); } } } lwjgl-2.7.1/src/java/org/lwjgl/test/openal/ALCCaptureTest.java0000644000175000017500000001176411543426510023233 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.openal; import java.nio.ByteBuffer; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.openal.AL; import org.lwjgl.openal.AL10; import org.lwjgl.openal.ALC10; import org.lwjgl.openal.ALC11; import org.lwjgl.openal.ALCdevice; import org.lwjgl.openal.OpenALException; /** * * This is a test for the ALC part of OpenAL * * @author Brian Matzon * @version $Revision: 2286 $ * $Id: ALCTest.java 2286 2006-03-23 19:32:21Z matzon $ */ public class ALCCaptureTest extends BasicTest { /** * Creates an instance of ALCTest */ public ALCCaptureTest() { super(); } /** * Runs the actual test, using supplied arguments */ protected void execute(String[] args) { int lastError = ALC10.ALC_NO_ERROR; IntBuffer sampleCount = BufferUtils.createIntBuffer(1); int state = AL10.AL_PLAYING; int FMT = AL10.AL_FORMAT_MONO16; int FMTSIZE = 16/8; int FREQ = 44100; int TIME = 5; int SAMPS = (FREQ * TIME); ByteBuffer buf = BufferUtils.createByteBuffer(SAMPS * FMTSIZE); // check that capture is available if(!ALC10.alcIsExtensionPresent(AL.getDevice(), "ALC_EXT_CAPTURE")) { throw new OpenALException("ALC_EXT_CAPTURE extension not available"); } // get list of devices String[] captureDevices = ALC10.alcGetString(null, ALC11.ALC_CAPTURE_DEVICE_SPECIFIER).split("\0"); System.out.println("Available Capture Devices: "); for(int i=0; i * @version $Revision: 2983 $ * $Id: PlayTest.java 2983 2008-04-07 18:36:09Z matzon $ */ public class PlayTest extends BasicTest { private boolean usingVorbis; /** * Creates an instance of PlayTest */ public PlayTest() { super(); } /** * Runs the actual test, using supplied arguments */ protected void execute(String[] args) { if(args.length < 1) { System.out.println("no argument supplied, assuming Footsteps.wav"); args = new String[] {"Footsteps.wav"}; } if(args[0].endsWith(".ogg")) { System.out.print("Attempting to load Ogg Vorbis file, checking for extension..."); if(AL10.alIsExtensionPresent("AL_EXT_vorbis")) { System.out.println("found"); usingVorbis = true; } else { System.out.println("not supported"); alExit(); System.exit(-1); } } int lastError; //create 1 buffer and 1 source IntBuffer buffers = BufferUtils.createIntBuffer(1); IntBuffer sources = BufferUtils.createIntBuffer(1); // al generate buffers and sources buffers.position(0).limit(1); AL10.alGenBuffers(buffers); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } sources.position(0).limit(1); AL10.alGenSources(sources); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } if(usingVorbis) { ByteBuffer filebuffer = getData(args[0]); // pass directly to buffer data AL10.alBufferData(buffers.get(0), AL10.AL_FORMAT_VORBIS_EXT, filebuffer, -1); filebuffer.clear(); } else { // load wave data from buffer WaveData wavefile = WaveData.create(args[0]); //copy to buffers AL10.alBufferData(buffers.get(0), wavefile.format, wavefile.data, wavefile.samplerate); //unload file again wavefile.dispose(); } if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //set up source input AL10.alSourcei(sources.get(0), AL10.AL_BUFFER, buffers.get(0)); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //lets loop the sound AL10.alSourcei(sources.get(0), AL10.AL_LOOPING, AL10.AL_TRUE); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //play source 0 AL10.alSourcePlay(sources.get(0)); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //wait 5 secs try { System.out.println("Waiting 5 seconds for sound to complete"); Thread.sleep(5000); } catch (InterruptedException inte) { } //stop source 0 AL10.alSourceStop(sources.get(0)); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //delete buffers and sources sources.position(0).limit(1); AL10.alDeleteSources(sources); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } buffers.position(0).limit(1); AL10.alDeleteBuffers(buffers); if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //no errorchecking from now on, since our context is gone. //shutdown alExit(); } /** * Reads the file into a ByteBuffer * * @param filename Name of file to load * @return ByteBuffer containing file data */ protected ByteBuffer getData(String filename) { ByteBuffer buffer = null; System.out.println("Attempting to load: " + filename); try { BufferedInputStream bis = new BufferedInputStream(WaveData.class.getClassLoader().getResourceAsStream(filename)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); int bufferLength = 4096; byte[] readBuffer = new byte[bufferLength]; int read = -1; while((read = bis.read(readBuffer, 0, bufferLength)) != -1) { baos.write(readBuffer, 0, read); } //done reading, close bis.close(); // if ogg vorbis data, we need to pass it unmodified to alBufferData buffer = ByteBuffer.allocateDirect(baos.size()); buffer.order(ByteOrder.nativeOrder()); buffer.put(baos.toByteArray()); buffer.rewind(); } catch (Exception ioe) { ioe.printStackTrace(); } return buffer; } /** * main entry point * * @param args String array containing arguments */ public static void main(String[] args) { PlayTest playTest = new PlayTest(); playTest.execute(args); System.exit(0); } } lwjgl-2.7.1/src/java/org/lwjgl/test/openal/MovingSoundTest.java0000644000175000017500000001502211543426510023547 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.openal; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.input.Keyboard; import org.lwjgl.openal.AL10; import org.lwjgl.opengl.Display; import org.lwjgl.util.WaveData; import org.lwjgl.util.vector.Vector3f; /** * * This test simulates a listener positioned in the center, and * a source moving around the listener using the keyboard * * @author Brian Matzon * @version $Revision: 2983 $ * $Id: MovingSoundTest.java 2983 2008-04-07 18:36:09Z matzon $ */ public class MovingSoundTest extends BasicTest { public static float MOVEMENT = 50.00f; /** * Creates an instance of MovingSoundTest */ public MovingSoundTest() { super(); } /** * Runs the actual test, using supplied arguments */ protected void execute(String[] args) { if (args.length < 1) { System.out.println("no argument supplied, assuming Footsteps.wav"); args = new String[] {"Footsteps.wav"}; } try { setDisplayMode(); Display.create(); } catch (Exception e) { e.printStackTrace(); } int lastError; Vector3f sourcePosition = new Vector3f(); Vector3f listenerPosition = new Vector3f(); //initialize keyboard try { Keyboard.create(); } catch (Exception e) { e.printStackTrace(); exit(-1); } //create 1 buffer and 1 source IntBuffer buffers = BufferUtils.createIntBuffer(1); IntBuffer sources = BufferUtils.createIntBuffer(1); // al generate buffers and sources buffers.position(0).limit(1); AL10.alGenBuffers(buffers); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } sources.position(0).limit(1); AL10.alGenSources(sources); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //load wave data WaveData wavefile = WaveData.create(args[0]); //copy to buffers AL10.alBufferData( buffers.get(0), wavefile.format, wavefile.data, wavefile.samplerate); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //unload file again wavefile.dispose(); //set up source input AL10.alSourcei(sources.get(0), AL10.AL_BUFFER, buffers.get(0)); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } AL10.alSourcef(sources.get(0), AL10.AL_REFERENCE_DISTANCE, 1024.0f); AL10.alSourcef(sources.get(0), AL10.AL_ROLLOFF_FACTOR, 0.5f); //lets loop the sound AL10.alSourcei(sources.get(0), AL10.AL_LOOPING, AL10.AL_TRUE); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //play source 0 AL10.alSourcePlay(sources.get(0)); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } System.out.println("Move source with arrow keys\nMove listener with right shift and arrowkeys\nExit with ESC"); while(!Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) { Display.update(); Keyboard.poll(); if(Keyboard.isKeyDown(Keyboard.KEY_LEFT)) { if(Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) { listenerPosition.x -= MOVEMENT; AL10.alListener3f(AL10.AL_POSITION, listenerPosition.x, listenerPosition.y, listenerPosition.z); System.out.println("listenerx: " + listenerPosition.x); } else { sourcePosition.x -= MOVEMENT; AL10.alSource3f(sources.get(0), AL10.AL_POSITION, sourcePosition.x, sourcePosition.y, sourcePosition.z); System.out.println("sourcex: " + sourcePosition.x); } } if(Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) { if(Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) { listenerPosition.x += MOVEMENT; AL10.alListener3f(AL10.AL_POSITION, listenerPosition.x, listenerPosition.y, listenerPosition.z); System.out.println("listenerx: " + listenerPosition.x); } else { sourcePosition.x += MOVEMENT; AL10.alSource3f(sources.get(0), AL10.AL_POSITION, sourcePosition.x, sourcePosition.y, sourcePosition.z); System.out.println("sourcex: " + sourcePosition.x); } } if(Display.isCloseRequested()) { break; } try { Thread.sleep(100); } catch (InterruptedException inte) { } } //stop source 0 AL10.alSourceStop(sources.get(0)); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //delete buffers and sources sources.position(0).limit(1); AL10.alDeleteSources(sources); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } buffers.position(0).limit(1); AL10.alDeleteBuffers(buffers); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //shutdown alExit(); } /** * main entry point * * @param args String array containing arguments */ public static void main(String[] args) { MovingSoundTest movingSoundTest = new MovingSoundTest(); movingSoundTest.execute(args); System.exit(0); } } lwjgl-2.7.1/src/java/org/lwjgl/test/openal/OpenALInfo.java0000644000175000017500000002006611543426510022375 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.openal; import java.nio.IntBuffer; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.Map.Entry; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.openal.AL; import org.lwjgl.openal.AL10; import org.lwjgl.openal.ALC10; import org.lwjgl.openal.ALC11; import org.lwjgl.openal.ALCdevice; import org.lwjgl.openal.EFX10; import org.lwjgl.openal.EFXUtil; /** * * idea from openal-info * * @author Brian Matzon * @version $Revision: 2983 $ * $Id$ */ public class OpenALInfo { /** * Creates an instance of OpenALInfo */ public OpenALInfo() { } /** * Runs the actual test, using supplied arguments */ protected void execute(String[] args) { try { AL.create(null, -1, 60, false); checkForErrors(); } catch (LWJGLException le) { die("Init", le.getMessage()); } printALCInfo(); printALInfo(); printEFXInfo(); checkForErrors(); AL.destroy(); } private void printALCInfo() { IntBuffer version = BufferUtils.createIntBuffer(2); ALCdevice device; if(ALC10.alcIsExtensionPresent(null, "ALC_ENUMERATION_EXT")) { if(ALC10.alcIsExtensionPresent(null, "ALC_ENUMERATE_ALL_EXT")) { printDevices(ALC11.ALC_ALL_DEVICES_SPECIFIER, "playback"); } else { printDevices(ALC10.ALC_DEVICE_SPECIFIER, "playback"); } printDevices(ALC11.ALC_CAPTURE_DEVICE_SPECIFIER, "capture"); } else { System.out.println("No device enumeration available"); } device = ALC10.alcGetContextsDevice(ALC10.alcGetCurrentContext()); checkForErrors(); System.out.println("Default playback device: " + ALC10.alcGetString(device, ALC10.ALC_DEFAULT_DEVICE_SPECIFIER)); System.out.println("Default capture device: " + ALC10.alcGetString(device, ALC11.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER)); ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MAJOR_VERSION, version); ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MINOR_VERSION, (IntBuffer) version.position(1)); checkForErrors(); System.out.println("ALC version: " + version.get(0) + "." + version.get(1)); System.out.println("ALC extensions:"); String[] extensions = ALC10.alcGetString(device, ALC10.ALC_EXTENSIONS).split(" "); for ( String extension : extensions ) { if ( extension.trim().length() == 0 ) { continue; } System.out.println(" " + extension); } checkForErrors(); } private void printALInfo() { System.out.println("OpenAL vendor string: " + AL10.alGetString(AL10.AL_VENDOR)); System.out.println("OpenAL renderer string: " + AL10.alGetString(AL10.AL_RENDERER)); System.out.println("OpenAL version string: " + AL10.alGetString(AL10.AL_VERSION)); System.out.println("AL extensions:"); String[] extensions = AL10.alGetString(AL10.AL_EXTENSIONS).split(" "); for ( String extension : extensions ) { if ( extension.trim().length() == 0 ) { continue; } System.out.println(" " + extension); } checkForErrors(); } private void printEFXInfo() { if(!EFXUtil.isEfxSupported()) { System.out.println("EFX not available"); return; } ALCdevice device = AL.getDevice(); IntBuffer major = BufferUtils.createIntBuffer(1); IntBuffer minor = BufferUtils.createIntBuffer(1); IntBuffer sends = BufferUtils.createIntBuffer(1); ALC10.alcGetInteger(device, EFX10.ALC_EFX_MAJOR_VERSION, major); ALC10.alcGetInteger(device, EFX10.ALC_EFX_MINOR_VERSION, minor); if(ALC10.alcGetError(device) == ALC10.ALC_NO_ERROR) { System.out.println("EFX version: " + major.get() + "." + minor.get()); } ALC10.alcGetInteger(device, EFX10.ALC_MAX_AUXILIARY_SENDS, sends); if(ALC10.alcGetError(device) == ALC10.ALC_NO_ERROR) { System.out.println("Max auxiliary sends: " + sends.get()); } System.out.println("Supported filters: "); HashMap filters = new HashMap(); filters.put("Low-pass", EFX10.AL_FILTER_LOWPASS); filters.put("High-pass", EFX10.AL_FILTER_HIGHPASS); filters.put("Band-pass", EFX10.AL_FILTER_BANDPASS); Set> entries = filters.entrySet(); for ( final Entry entry : entries ) { String key = entry.getKey(); if ( EFXUtil.isFilterSupported(entry.getValue()) ) System.out.println(" " + entry.getKey()); } System.out.println("Supported effects: "); HashMap effects = new HashMap(); effects.put("EAX Reverb", EFX10.AL_EFFECT_EAXREVERB); effects.put("Reverb", EFX10.AL_EFFECT_REVERB); effects.put("Chorus", EFX10.AL_EFFECT_CHORUS); effects.put("Distortion", EFX10.AL_EFFECT_DISTORTION); effects.put("Echo", EFX10.AL_EFFECT_ECHO); effects.put("Flanger", EFX10.AL_EFFECT_FLANGER); effects.put("Frequency Shifter", EFX10.AL_EFFECT_FREQUENCY_SHIFTER); effects.put("Vocal Morpher", EFX10.AL_EFFECT_VOCAL_MORPHER); effects.put("Pitch Shifter", EFX10.AL_EFFECT_PITCH_SHIFTER); effects.put("Ring Modulator", EFX10.AL_EFFECT_RING_MODULATOR); effects.put("Autowah", EFX10.AL_EFFECT_AUTOWAH); effects.put("Compressor", EFX10.AL_EFFECT_COMPRESSOR); effects.put("Equalizer", EFX10.AL_EFFECT_EQUALIZER); entries = effects.entrySet(); for ( final Entry entry : entries ) { if ( EFXUtil.isEffectSupported(entry.getValue()) ) System.out.println(" " + entry.getKey()); } } private void printDevices(int which, String kind) { String[] devices = ALC10.alcGetString(null, which).split("\0"); checkForErrors(); System.out.println("Available " + kind + " devices: "); for ( String device : devices ) { System.out.println(" " + device); } } private void die(String kind, String description) { System.out.println(kind + " error " + description + " occured"); } private void checkForErrors() { { ALCdevice device = ALC10.alcGetContextsDevice(ALC10.alcGetCurrentContext()); int error = ALC10.alcGetError(device); if(error != ALC10.ALC_NO_ERROR) { die("ALC", ALC10.alcGetString(device, error)); } } { int error = AL10.alGetError(); if(error != AL10.AL_NO_ERROR) { die("AL", AL10.alGetString(error)); } } } /** * main entry point * * @param args String array containing arguments */ public static void main(String[] args) { OpenALInfo openalInfo = new OpenALInfo(); openalInfo.execute(args); System.exit(0); } }lwjgl-2.7.1/src/java/org/lwjgl/test/openal/OpenALCreationTest.java0000644000175000017500000001345511543426510024112 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.openal; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; import org.lwjgl.openal.AL; import org.lwjgl.openal.AL10; import org.lwjgl.util.WaveData; /** *
      * Performs a creation test, by creating and destroying OpenAL twice. * We cannot inherit from BasicTest since it follows another structure. * * @author Brian Matzon * @version $Revision: 2983 $ * $Id: OpenALCreationTest.java 2983 2008-04-07 18:36:09Z matzon $ */ public class OpenALCreationTest { /** * Creates an instance of OpenALCreationTest */ public OpenALCreationTest() { } public void alInitialize() { try { AL.create(); } catch (Exception e) { e.printStackTrace(); return; } } public 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: " + AL10.alGetString(error)); alExit(); System.exit(-1); } /** * Runs the actual test, using supplied arguments */ protected void execute(String[] args) { int lastError; //initialize AL, using ALC System.out.print("initialize..."); alInitialize(); System.out.println("success"); //do some audio executeAudioTest(); //shutdown System.out.print("shutdown..."); alExit(); System.out.println("success"); //initialize AL, using ALC System.out.print("initialize..."); alInitialize(); System.out.println("success"); //do some audio executeAudioTest(); //shutdown System.out.print("shutdown..."); alExit(); System.out.println("success"); } /** * Executes the audio test, which just plays some sound */ private void executeAudioTest() { int lastError; //create 1 buffer and 1 source IntBuffer buffers = createIntBuffer(1); IntBuffer sources = createIntBuffer(1); // al generate buffers and sources buffers.position(0).limit(1); AL10.alGenBuffers(buffers); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } sources.position(0).limit(1); AL10.alGenSources(sources); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //load wave data WaveData wavefile = WaveData.create("Footsteps.wav"); //copy to buffers AL10.alBufferData( buffers.get(0), wavefile.format, wavefile.data, wavefile.samplerate); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //unload file again wavefile.dispose(); //set up source input AL10.alSourcei(sources.get(0), AL10.AL_BUFFER, buffers.get(0)); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //lets loop the sound AL10.alSourcei(sources.get(0), AL10.AL_LOOPING, AL10.AL_TRUE); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //play source 0 AL10.alSourcePlay(sources.get(0)); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //wait 5 secs try { System.out.print("Playing 'Footsteps.wav' for 2 seconds..."); Thread.sleep(2000); } catch (InterruptedException inte) { } System.out.println("done"); //stop source 0 AL10.alSourceStop(sources.get(0)); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } //delete buffers and sources sources.position(0).limit(1); AL10.alDeleteSources(sources); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } buffers.position(0).limit(1); AL10.alDeleteBuffers(buffers); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { exit(lastError); } } /** * main entry point * * @param args String array containing arguments */ public static void main(String[] args) { OpenALCreationTest oalCreationTest = new OpenALCreationTest(); oalCreationTest.execute(args); System.exit(0); } } lwjgl-2.7.1/src/java/org/lwjgl/test/openal/PositionTest.java0000644000175000017500000004272211543426510023112 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.openal; import java.nio.FloatBuffer; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLUtil; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.openal.AL; import org.lwjgl.opengl.Display; import org.lwjgl.util.WaveData; import static org.lwjgl.openal.AL10.*; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; /** *
      * This test demonstrates OpenAL positioning Based on the example by Chad Armstrong * (http://www.edenwaith.com/products/pige/tutorials/openal.php) * * @author Brian Matzon * @version $Revision: 3418 $ * $Id: PositionTest.java 3418 2010-09-28 21:11:35Z spasi $ */ public class PositionTest extends BasicTest { /** *Small* glut implementation :) */ private GLUT glut; /** Width of window */ public static final int WINDOW_WIDTH = 640; /** Height of window */ public static final int WINDOW_HEIGHT = 480; /** LEFT enumeration */ public static final int LEFT = 0; /** CENTER enumeration */ public static final int CENTER = 1; /** RIGHT enumeration */ public static final int RIGHT = 2; /** Whether the demo is done */ private boolean finished; /** Whether in pause mode */ private boolean pauseMode; // OpenAL stuff // =================================================== /** OpenAL buffers */ private IntBuffer soundBuffers = BufferUtils.createIntBuffer(3); /** OpenAL sources */ private IntBuffer soundSources = BufferUtils.createIntBuffer(3); /** Position of listener */ private FloatBuffer listenerPosition = createFloatBuffer(new float[] { 0.0f, 0.0f, 0.0f }); /** Velocity of listener */ private FloatBuffer listenerVelocity = createFloatBuffer(new float[] { 0.0f, 0.0f, 0.0f }); /** Orientation of listener */ private FloatBuffer listenerOrientation = createFloatBuffer(new float[] { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }); /** Position of left sound */ private FloatBuffer leftPosition = createFloatBuffer(new float[] { -2.0f, 0.0f, 0.0f }); /** Velocity of left sound */ private FloatBuffer leftVelocity = createFloatBuffer(new float[] { 0.0f, 0.0f, 0.0f }); /** Position of center sound */ private FloatBuffer centerPosition = createFloatBuffer(new float[] { 0.0f, 0.0f, -4.0f }); /** Velocity of center sound */ private FloatBuffer centerVelocity = createFloatBuffer(new float[] { 0.0f, 0.0f, 0.0f }); /** Position of right sound */ private FloatBuffer rightPosition = createFloatBuffer(new float[] { 2.0f, 0.0f, 0.0f }); /** Velocity of right sound */ private FloatBuffer rightVelocity = createFloatBuffer(new float[] { 0.0f, 0.0f, 0.0f }); // --------------------------------------------------- /** * Runs the actual test, using supplied arguments */ protected void execute(String[] args) { // Setup needed stuff try { setup(); } catch (Exception e) { System.out.println("Error setting up demonstration: "); e.printStackTrace(); System.exit(-1); } // run the actual demonstration run(); // shutdown shutdown(); } /** * Performs setup of demonstration */ private void setup() throws Exception { // Setup Window // ===================================================== LWJGLUtil.log("Setting up window"); // calc center int centerX = (Display.getDisplayMode().getWidth() - WINDOW_WIDTH) / 2; int centerY = (Display.getDisplayMode().getHeight() - WINDOW_HEIGHT) / 2; // setup window setDisplayMode(); Display.create(); // ----------------------------------------------------- // Setup OpenGL // ===================================================== LWJGLUtil.log("Setting up OpenGL"); glViewport(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(50.0f, (float) WINDOW_WIDTH / WINDOW_HEIGHT, 0.0f, 50.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0f, 0.0f, -6.6f); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glut = this.new GLUT(); Display.setVSyncEnabled(true); // ----------------------------------------------------- // Setup OpenAL // ===================================================== LWJGLUtil.log("Setting up OpenAL"); alListener(AL_POSITION, listenerPosition); alListener(AL_VELOCITY, listenerVelocity); alListener(AL_ORIENTATION, listenerOrientation); // creating buffers LWJGLUtil.log("Creating buffers"); alGenBuffers(soundBuffers); soundBuffers.rewind(); // creating sources alGenSources(soundSources); soundSources.rewind(); // load sound files (left, center, right).wav LWJGLUtil.log("Loading soundfiles..."); LWJGLUtil.log("Loading left.wav"); WaveData left = WaveData.create("left.wav"); alBufferData(soundBuffers.get(LEFT), left.format, left.data, left.samplerate); alSourcef(soundSources.get(LEFT), AL_PITCH, 1.0f); alSourcef(soundSources.get(LEFT), AL_GAIN, 1.0f); alSource(soundSources.get(LEFT), AL_POSITION, leftPosition); alSource(soundSources.get(LEFT), AL_VELOCITY, leftVelocity); alSourcei(soundSources.get(LEFT), AL_BUFFER, soundBuffers.get(LEFT)); alSourcei(soundSources.get(LEFT), AL_LOOPING, AL_TRUE); LWJGLUtil.log("Loading center.wav"); WaveData center = WaveData.create("center.wav"); alBufferData(soundBuffers.get(CENTER), center.format, center.data, center.samplerate); alSourcef(soundSources.get(CENTER), AL_PITCH, 1.0f); alSourcef(soundSources.get(CENTER), AL_GAIN, 1.0f); alSource(soundSources.get(CENTER), AL_POSITION, centerPosition); alSource(soundSources.get(CENTER), AL_VELOCITY, centerVelocity); alSourcei(soundSources.get(CENTER), AL_BUFFER, soundBuffers.get(CENTER)); alSourcei(soundSources.get(CENTER), AL_LOOPING, AL_TRUE); LWJGLUtil.log("Loading right.wav"); WaveData right = WaveData.create("right.wav"); alBufferData(soundBuffers.get(RIGHT), right.format, right.data, right.samplerate); alSourcef(soundSources.get(RIGHT), AL_PITCH, 1.0f); alSourcef(soundSources.get(RIGHT), AL_GAIN, 1.0f); alSource(soundSources.get(RIGHT), AL_POSITION, rightPosition); alSource(soundSources.get(RIGHT), AL_VELOCITY, rightVelocity); alSourcei(soundSources.get(RIGHT), AL_BUFFER, soundBuffers.get(RIGHT)); alSourcei(soundSources.get(RIGHT), AL_LOOPING, AL_TRUE); LWJGLUtil.log("Soundfiles loaded successfully"); // ----------------------------------------------------- Mouse.setGrabbed(true); } /** * Runs the actual demonstration */ private void run() { boolean firstRun = true; System.out.println("Press 1/4 (left), 2/5 (center) or 3/6 (right) to toggle sound"); System.out.println("Press LEFT/RIGHT to move along x axis"); System.out.println("Press SHIFT and either UP/DOWN to move along y axis"); System.out.println("Press UP/DOWN to move along z axis"); System.out.println("Move along the x and y axis with the mouse"); System.out.println("Press LEFT or RIGHT mouse button to move along z axis"); System.out.println("Press ESC to exit demo"); LWJGLUtil.log( "Listener position: " + listenerPosition.get(0) + ", " + listenerPosition.get(1) + ", " + listenerPosition.get(2)); LWJGLUtil.log("Left position: " + leftPosition.get(0) + ", " + leftPosition.get(1) + ", " + leftPosition.get(2)); LWJGLUtil.log("Center position: " + centerPosition.get(0) + ", " + centerPosition.get(1) + ", " + centerPosition.get(2)); LWJGLUtil.log("Right position: " + rightPosition.get(0) + ", " + rightPosition.get(1) + ", " + rightPosition.get(2)); while (!finished) { // handle any input handleInput(); // allow window to process internal messages Display.update(); // render and paint if !minimized and not dirty if(Display.isVisible()) { render(); } else { // sleeeeeep pause(100); } // act on pause mode paused(!(Display.isVisible() || Display.isActive())); // start sound after first paint, since we don't want // the delay before something is painted on the screen if (firstRun && !pauseMode) { firstRun = false; // start sounds with delays startSounds(); } } } /** * Starts playing the sounds at different times */ private void startSounds() { alSourcePlay(soundSources.get(LEFT)); pause(300); alSourcePlay(soundSources.get(CENTER)); pause(500); alSourcePlay(soundSources.get(RIGHT)); } /** * Handles any changes in pause mode * * @param paused Which pause mode to enter */ private void paused(boolean paused) { // if requesting pause, and not paused - pause and stop sound if(paused && !pauseMode) { pauseMode = true; alSourcePause(soundSources); System.out.println("pauseMode = true"); } // else go out of pause mode and start sounds else if(!paused && pauseMode) { pauseMode = false; startSounds(); System.out.println("pauseMode = false"); } } /** * Handles any input */ private void handleInput() { // User wants to exit? finished = Display.isCloseRequested() || Keyboard.isKeyDown(Keyboard.KEY_ESCAPE); if (finished) { return; } boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); // Test for play // ============================================ if (Keyboard.isKeyDown(Keyboard.KEY_1)) { alSourcePlay(soundSources.get(LEFT)); LWJGLUtil.log("Playing left.wav"); } if (Keyboard.isKeyDown(Keyboard.KEY_2)) { alSourcePlay(soundSources.get(CENTER)); LWJGLUtil.log("Playing center.wav"); } if (Keyboard.isKeyDown(Keyboard.KEY_3)) { alSourcePlay(soundSources.get(RIGHT)); LWJGLUtil.log("Playing right.wav"); } // -------------------------------------------- // Test for stop // ============================================ if (Keyboard.isKeyDown(Keyboard.KEY_4)) { alSourceStop(soundSources.get(LEFT)); LWJGLUtil.log("Stopped left.wav"); } if (Keyboard.isKeyDown(Keyboard.KEY_5)) { alSourceStop(soundSources.get(CENTER)); LWJGLUtil.log("Stopped center.wav"); } if (Keyboard.isKeyDown(Keyboard.KEY_6)) { alSourceStop(soundSources.get(RIGHT)); LWJGLUtil.log("Stopped right.wav"); } // -------------------------------------------- // Test for movement with keyboard // ============================================ if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) { listenerPosition.put(0, listenerPosition.get(0) - 0.1f); alListener(AL_POSITION, listenerPosition); } if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) { listenerPosition.put(0, listenerPosition.get(0) + 0.1f); alListener(AL_POSITION, listenerPosition); } if (Keyboard.isKeyDown(Keyboard.KEY_UP)) { if (shift) { listenerPosition.put(1, listenerPosition.get(1) + 0.1f); } else { listenerPosition.put(2, listenerPosition.get(2) - 0.1f); } alListener(AL_POSITION, listenerPosition); } if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) { if (shift) { listenerPosition.put(1, listenerPosition.get(1) - 0.1f); } else { listenerPosition.put(2, listenerPosition.get(2) + 0.1f); } alListener(AL_POSITION, listenerPosition); } // -------------------------------------------- // Test for movement with Mouse // ============================================ listenerPosition.put(0, listenerPosition.get(0) + (0.01f * Mouse.getDX())); listenerPosition.put(1, listenerPosition.get(1) + (0.01f * Mouse.getDY())); if (Mouse.isButtonDown(0)) { listenerPosition.put(2, listenerPosition.get(2) - 0.1f); } if (Mouse.isButtonDown(1)) { listenerPosition.put(2, listenerPosition.get(2) + 0.1f); } alListener(AL_POSITION, listenerPosition); // empty mouse buffer while(Mouse.next()); } /** * Render the scene */ private void render() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); { glRotatef(20.0f, 1.0f, 1.0f, 0.0f); // left glPushMatrix(); { glTranslatef(leftPosition.get(0), leftPosition.get(1), leftPosition.get(2)); glColor3f(1.0f, 0.0f, 0.0f); glut.glutWireCube(0.5f); } glPopMatrix(); // center glPushMatrix(); { glTranslatef(centerPosition.get(0), centerPosition.get(1), centerPosition.get(2)); glColor3f(0.0f, 0.0f, 1.0f); glut.glutWireCube(0.5f); } glPopMatrix(); // right glPushMatrix(); { glTranslatef(rightPosition.get(0), rightPosition.get(1), rightPosition.get(2)); glColor3f(0.0f, 1.0f, 0.0f); glut.glutWireCube(0.5f); } glPopMatrix(); // listener glPushMatrix(); { glTranslatef(listenerPosition.get(0), listenerPosition.get(1), listenerPosition.get(2)); glColor3f(1.0f, 1.0f, 1.0f); glut.glutSolidCube(0.5f); } glPopMatrix(); } glPopMatrix(); } /** * Shutdown of demonstration */ private void shutdown() { LWJGLUtil.log("Shutting down OpenAL"); alSourceStop(soundSources); alDeleteSources(soundSources); alDeleteBuffers(soundBuffers); AL.destroy(); LWJGLUtil.log("Shutting down Window"); Display.destroy(); } /** * main entry point * * @param args * String array containing arguments */ public static void main(String[] args) { PositionTest positionTest = new PositionTest(); positionTest.execute(args); System.exit(0); } /** * Minute implementation of GLUT:
      COPYRIGHT: * * The OpenGL Utility Toolkit distribution for Win32 (Windows NT & Windows * 95) contains source code modified from the original source code for GLUT * version 3.3 which was developed by Mark J. Kilgard. The original source * code for GLUT is Copyright 1997 by Mark J. Kilgard. GLUT for Win32 is * Copyright 1997 by Nate Robins and is not in the public domain, but it is * freely distributable without licensing fees. It is provided without * guarantee or warrantee expressed or implied. It was ported with the * permission of Mark J. Kilgard by Nate Robins. * * THIS SOURCE CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OR MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. */ class GLUT { float n[][] = new float[][] { { -1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, { 1.0f, 0.0f, 0.0f }, { 0.0f, -1.0f, 0.0f }, { 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, -1.0f } }; int faces[][] = new int[][] { { 0, 1, 2, 3 }, { 3, 2, 6, 7 }, { 7, 6, 5, 4 }, { 4, 5, 1, 0 }, { 5, 6, 2, 1 }, { 7, 4, 0, 3 } }; float v[][] = new float[8][3]; public void glutWireCube(float size) { drawBox(size, GL_LINE_LOOP); } public void glutSolidCube(float size) { drawBox(size, GL_QUADS); } private void drawBox(float size, int type) { v[0][0] = v[1][0] = v[2][0] = v[3][0] = -size / 2; v[4][0] = v[5][0] = v[6][0] = v[7][0] = size / 2; v[0][1] = v[1][1] = v[4][1] = v[5][1] = -size / 2; v[2][1] = v[3][1] = v[6][1] = v[7][1] = size / 2; v[0][2] = v[3][2] = v[4][2] = v[7][2] = -size / 2; v[1][2] = v[2][2] = v[5][2] = v[6][2] = size / 2; for (int i = 5; i >= 0; i--) { glBegin(type); glNormal3f(n[i][0], n[i][1], n[i][2]); glVertex3f(v[faces[i][0]][0], v[faces[i][0]][1], v[faces[i][0]][2]); glVertex3f(v[faces[i][1]][0], v[faces[i][1]][1], v[faces[i][1]][2]); glVertex3f(v[faces[i][2]][0], v[faces[i][2]][1], v[faces[i][2]][2]); glVertex3f(v[faces[i][3]][0], v[faces[i][3]][1], v[faces[i][3]][2]); glEnd(); } } } } lwjgl-2.7.1/src/java/org/lwjgl/test/openal/BasicTest.java0000644000175000017500000001023511543426510022321 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.openal; import java.nio.FloatBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.openal.AL; import org.lwjgl.openal.AL10; import org.lwjgl.openal.ALC10; import org.lwjgl.opengl.DisplayMode; /** * * This is a basic test, which contains the most used stuff * * @author Brian Matzon * @version $Revision: 3418 $ * $Id: BasicTest.java 3418 2010-09-28 21:11:35Z spasi $ */ public abstract class BasicTest { /** * Creates an instance of PlayTest */ protected BasicTest() { try { AL.create(); System.out.println("Default device: " + ALC10.alcGetString(null, ALC10.ALC_DEFAULT_DEVICE_SPECIFIER)); if(ALC10.alcIsExtensionPresent(null, "ALC_ENUMERATION_EXT")) { String[] devices = ALC10.alcGetString(null, ALC10.ALC_DEVICE_SPECIFIER).split("\0"); System.out.println("Available devices: "); for(int i=0; i * @version $Revision: 2983 $ * $Id: StressTest.java 2983 2008-04-07 18:36:09Z matzon $ */ public class StressTest extends BasicTest { /** Buffer containing sources */ private IntBuffer sources; /** Buffer containing buffers */ private IntBuffer buffers; /** * Creates an instance of StressTest */ public StressTest() { super(); } /** * Runs the actual test, using supplied arguments */ protected void execute(String[] args) { createSources(); createBuffers(); try { loadSamples(); runTest(); } catch (Exception e) { e.printStackTrace(); } alExit(); } private void createSources() { sources = BufferUtils.createIntBuffer(4); sources.position(0).limit(4); AL10.alGenSources(sources); if (AL10.alGetError() != AL10.AL_NO_ERROR) { System.out.println("Unable to create 4 sources"); alExit(); } } private void createBuffers() { buffers = BufferUtils.createIntBuffer(10); buffers.position(0).limit(10); AL10.alGenBuffers(buffers); if (AL10.alGetError() != AL10.AL_NO_ERROR) { System.out.println("Unable to create 10 buffers"); sources.position(0).limit(4); AL10.alDeleteSources(sources); alExit(); } } private void loadSamples() throws Exception { AL10.alGetError(); WaveData data = WaveData.create("ding.wav"); for (int i = 1; i <= 10; i++) { AL10.alBufferData( buffers.get(i - 1), data.format, data.data, data.samplerate); if (AL10.alGetError() != AL10.AL_NO_ERROR) { System.out.println("Failed to load " + i + ".wav into buffer"); sources.position(0).limit(4); AL10.alDeleteSources(sources); buffers.position(0).limit(10); AL10.alDeleteBuffers(buffers); alExit(); } } data.dispose(); } public void runTest() { int iterations = 0; int randomBuffer; int startSlot = 1; int nextSlot = startSlot; long startTime = System.currentTimeMillis(); //mark background source as looping AL10.alSourcei(sources.get(0), AL10.AL_LOOPING, AL10.AL_TRUE); //play background AL10.alSourcei(sources.get(0), AL10.AL_BUFFER, buffers.get(0)); AL10.alSourcePlay(sources.get(0)); while (System.currentTimeMillis() - startTime < (2000)) { randomBuffer = getRandomBuffer(); System.out.println("random:" + randomBuffer); //stop source at slot AL10.alSourceStop(sources.get(nextSlot)); if (AL10.alGetError() != AL10.AL_NO_ERROR) { System.out.println("Error stopping source."); } System.out.println("Stopped source: " + nextSlot); //link source<->buffer AL10.alSourcei(sources.get(nextSlot), AL10.AL_BUFFER, buffers.get(randomBuffer)); if (AL10.alGetError() != AL10.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); AL10.alSourcePlay(sources.get(nextSlot++)); if (nextSlot == 4) { nextSlot = startSlot; } //pause try { Thread.sleep(500); } catch (InterruptedException inte) { } //debug info if ((++iterations % 10) == 0) { System.out.println("========================"); System.out.println("MaxMemory: " + Runtime.getRuntime().maxMemory() / 1024); System.out.println("FreeMemory: " + Runtime.getRuntime().freeMemory() / 1024); System.out.println("TotalMemory: " + Runtime.getRuntime().totalMemory() / 1024); System.out.println("========================"); } } //stop all sources for (int i = 0; i < 4; i++) { AL10.alSourceStop(sources.get(i)); System.out.println("Stopping source " + (i+1)); } //test done - ask for user input try { System.out.println("Test completed"); System.out.println("========================"); System.out.println("MaxMemory: " + Runtime.getRuntime().maxMemory() / 1024); System.out.println("FreeMemory: " + Runtime.getRuntime().freeMemory() / 1024); System.out.println("TotalMemory: " + Runtime.getRuntime().totalMemory() / 1024); System.out.println("========================"); System.out.println("Push any key to exit..."); System.in.read(); } catch (Exception e) { } sources.position(0).limit(4); AL10.alDeleteSources(sources); buffers.position(0).limit(10); AL10.alDeleteBuffers(buffers); } private int getRandomBuffer() { return (int) (Math.random() * 10.0); } /** * main entry point * * @param args String array containing arguments */ public static void main(String[] args) { StressTest stressTest = new StressTest(); stressTest.execute(args); System.exit(0); } } lwjgl-2.7.1/src/java/org/lwjgl/test/openal/ALCTest.java0000644000175000017500000000715511543426510021706 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.openal; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.openal.AL; import org.lwjgl.openal.ALC10; /** * * This is a test for the ALC part of OpenAL * * @author Brian Matzon * @version $Revision: 2983 $ * $Id: ALCTest.java 2983 2008-04-07 18:36:09Z matzon $ */ public class ALCTest extends BasicTest { /** * Creates an instance of ALCTest */ public ALCTest() { super(); } /** * Runs the actual test, using supplied arguments */ protected void execute(String[] args) { //error stuff int lastError = ALC10.ALC_NO_ERROR; //create attribute list for context creation IntBuffer buffer = BufferUtils.createIntBuffer(7); if ((lastError = ALC10.alcGetError(AL.getDevice())) != ALC10.ALC_NO_ERROR) { System.out.println("ALC Error: " + ALC10.alcGetString(AL.getDevice(), lastError)); System.exit(-1); } //query System.out.println( "DEFAULT_DEVICE_SPECIFIER: " + ALC10.alcGetString(AL.getDevice(), ALC10.ALC_DEFAULT_DEVICE_SPECIFIER)); System.out.println( "DEVICE_SPECIFIER: " + ALC10.alcGetString(AL.getDevice(), ALC10.ALC_DEVICE_SPECIFIER)); System.out.println("EXTENSIONS: " + ALC10.alcGetString(AL.getDevice(), ALC10.ALC_EXTENSIONS)); //mo query buffer.rewind(); buffer.position(0); ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MAJOR_VERSION, buffer); ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MINOR_VERSION, (IntBuffer) buffer.position(1)); System.out.println("ALC_MAJOR_VERSION: " + buffer.get(0)); System.out.println("ALC_MINOR_VERSION: " + buffer.get(1)); //no check for ALC_ALL_ATTRIBUTES / ALC_ATTRIBUTES_SIZE since it //is buggy on win32 - my dev platform //get an enumerstion value System.out.println( "Value of ALC_MAJOR_VERSION: " + ALC10.alcGetEnumValue(AL.getDevice(), "ALC_MAJOR_VERSION")); alExit(); } /** * main entry point * * @param args String array containing arguments */ public static void main(String[] args) { ALCTest alcTest = new ALCTest(); alcTest.execute(args); System.exit(0); } }lwjgl-2.7.1/src/java/org/lwjgl/test/openal/SourceLimitTest.java0000644000175000017500000001151311543426510023537 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.openal; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.openal.AL10; import org.lwjgl.openal.OpenALException; /** * * Simple test for testing the number of available sources * * @author Brian Matzon * @version $Revision: 2983 $ * $Id: SourceLimitTest.java 2983 2008-04-07 18:36:09Z matzon $ */ public class SourceLimitTest extends BasicTest { /** Sources to create */ protected int sourcesToCreate = 64; /** * Creates an instance of SourceLimitTest */ public SourceLimitTest() { super(); } /** * Runs the actual test, using supplied arguments */ protected void execute(String[] args) { //parse 1st arg to sourcecount if (args.length > 0) { try { sourcesToCreate = Integer.parseInt(args[0]); } catch (NumberFormatException nfe) { System.out.println( "Unable to parse parameter to integer. Defaulting to 64 sources."); } } System.out.print("Creating " + sourcesToCreate + " in one go..."); try { CreateAllSources(); } catch(OpenALException oale) { oale.printStackTrace(); } System.out.print("Creating " + sourcesToCreate + " one at a time..."); try { CreateSourcesStep(); } catch(Exception e) { e.printStackTrace(); } //shutdown alExit(); } /** * Tests the creation of n sources in on go */ protected void CreateAllSources() { int lastError; //make bytbuffer that can hold sourcesToCreate sources IntBuffer sources = BufferUtils.createIntBuffer(sourcesToCreate); //Create sourcesToCreate sources in one fell swoop try { sources.position(0).limit(sourcesToCreate); AL10.alGenSources(sources); //delete sources sources.position(0).limit(sourcesToCreate); AL10.alDeleteSources(sources); System.out.println("created " + sourcesToCreate + " sources successfully!"); } catch (OpenALException oale) { System.out.println("Unable to create " + sourcesToCreate + " sources"); } } /** * Tests if n sources can be created one at a time */ protected void CreateSourcesStep() { int lastError; int sourcesCreated = 0; //make bytbuffer that can hold sourcesToCreate sources IntBuffer[] sources = new IntBuffer[sourcesToCreate]; //create the sources try { for (int i = 0; i < sourcesToCreate; i++) { sources[i] = BufferUtils.createIntBuffer(1); sources[i].position(0).limit(1); AL10.alGenSources(sources[i]); if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) { break; } sourcesCreated++; } } catch (OpenALException oale) { System.out.println("failed to create source: " + (sourcesCreated + 1)); } //delete allocated sources for (int i = 0; i < sourcesCreated; i++) { //delete buffers and sources sources[i].position(0).limit(1); AL10.alDeleteSources(sources[i]); } if(sourcesCreated != sourcesToCreate) { System.out.println("created " + sourcesCreated + " sources before failing"); } else { System.out.println("created " + sourcesCreated + " sources successfully!"); } } /** * main entry point * * @param args String array containing arguments */ public static void main(String[] args) { SourceLimitTest sourceLimitTest = new SourceLimitTest(); sourceLimitTest.execute(args); System.exit(0); } } lwjgl-2.7.1/src/java/org/lwjgl/test/input/0000755000175000017500000000000011543426510017455 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/test/input/HWCursorTest.java0000644000175000017500000002450511543426510022702 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.input; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; import org.lwjgl.input.Cursor; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; /** * * Tests switching between windowed and fullscreen - including hardware cursor test * * @author Brian Matzon * @version $Revision: 3418 $ * $Id: HWCursorTest.java 3418 2010-09-28 21:11:35Z spasi $ */ public class HWCursorTest { /** The native cursor */ private static Cursor[] cursors; /** The mouse cursor position */ private static int mouse_x; private static int mouse_y; private static int mouse_btn; /** * Executes the test */ public void execute() { initialize(); mainLoop(); cleanup(); } /** * Sets the display mode for fullscreen mode */ protected boolean setDisplayMode() { try { // get modes DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60); org.lwjgl.util.Display.setDisplayMode(dm, new String[] { "width=" + 640, "height=" + 480, "freq=" + 60, "bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel() }); return true; } catch (Exception e) { e.printStackTrace(); } return false; } /** * Initializes the test */ private void initialize() { try { // start of in windowed mode setDisplayMode(); Display.create(); glInit(); initNativeCursors(); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } } private static void initNativeCursors() throws Exception { if ((Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) == 0) { System.out.println("No HW cursor support!"); System.exit(0); } cursors = new Cursor[3]; int cursorImageCount = 1; int cursorWidth = Math.min(64, Cursor.getMaxCursorSize()); int cursorHeight = cursorWidth; IntBuffer cursorImages; IntBuffer cursorDelays; // Create a single cursor // ================================== cursorImages = ByteBuffer.allocateDirect(cursorWidth*cursorHeight*cursorImageCount*4).order(ByteOrder.nativeOrder()).asIntBuffer(); cursorDelays = null; for(int j=0; j= centerLeft && j < centerRight && l >= centerLeft && l < centerRight) { cursorImages.put(offColor); } else { cursorImages.put(onColor); } } } } cursorDelays.put(2000).put(2000).put(2000); cursorDelays.flip(); cursorImages.flip(); cursors[1] = new Cursor(cursorWidth, cursorHeight, cursorWidth/2, cursorHeight/2, cursorImageCount, cursorImages, cursorDelays); // ---------------------------------- // Create a 20 piece animation // ================================== cursorImageCount = 20; cursorImages = ByteBuffer.allocateDirect(cursorWidth*cursorHeight*cursorImageCount*4).order(ByteOrder.nativeOrder()).asIntBuffer(); cursorDelays = ByteBuffer.allocateDirect(cursorImageCount*4).order(ByteOrder.nativeOrder()).asIntBuffer(); cursorDelays.put( new int[] { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }); float step = 0xffffffff / 20.0f; for(int i=0; i= 0 && button < 3 && Mouse.getEventButtonState()) { mouse_btn = Mouse.getEventButton(); switchCursor(); } } } /** * Processes keyboard input */ private void processKeyboard() { //check for fullscreen key if (Keyboard.isKeyDown(Keyboard.KEY_F)) { try { try { Mouse.setNativeCursor(null); } catch (Exception e) { e.printStackTrace(); System.exit(1); } for ( Cursor aCursor : cursors ) { aCursor.destroy(); } Display.setFullscreen(true); glInit(); initNativeCursors(); } catch (Exception e) { e.printStackTrace(); } } //check for window key if (Keyboard.isKeyDown(Keyboard.KEY_W)) { try { try { Mouse.setNativeCursor(null); } catch (Exception e) { e.printStackTrace(); System.exit(1); } for ( Cursor cursor : cursors ) { cursor.destroy(); } Display.setFullscreen(false); glInit(); initNativeCursors(); } catch (Exception e) { e.printStackTrace(); } } if (Keyboard.isKeyDown(Keyboard.KEY_M)) { try { Mouse.setNativeCursor(null); } catch (Exception e) { e.printStackTrace(); } } if (Keyboard.isKeyDown(Keyboard.KEY_N)) { switchCursor(); } while(Keyboard.next()) { if(Keyboard.getEventKey() == Keyboard.KEY_SPACE && Keyboard.getEventKeyState()) { Mouse.setGrabbed(!Mouse.isGrabbed()); } } } private void switchCursor() { try { Mouse.setNativeCursor(cursors[mouse_btn]); } catch (Exception e) { e.printStackTrace(); } } /** * Cleans up the test */ private void cleanup() { try { Mouse.setNativeCursor(null); } catch (Exception e) { e.printStackTrace(); System.exit(1); } for ( Cursor cursor : cursors ) { cursor.destroy(); } Display.destroy(); } /** * Initializes OGL */ private void glInit() { // Go into orthographic projection mode. glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight()); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight()); //set clear color to black glClearColor(0.0f, 0.0f, 0.0f, 0.0f); //sync frame (only works on windows) Display.setVSyncEnabled(true); } /** * Test entry point */ public static void main(String[] args) { System.out.println("Change between fullscreen and windowed mode, by pressing F and W respectively. Enable hw cursor with N and disable it with M."); HWCursorTest cursorTest = new HWCursorTest(); cursorTest.execute(); System.exit(0); } } lwjgl-2.7.1/src/java/org/lwjgl/test/input/KeyboardTest.java0000644000175000017500000001462211543426510022725 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.input; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import org.lwjgl.util.vector.Vector2f; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; /** *
      * Keyboard test * * @author Brian Matzon * @version $Revision: 3418 $ * $Id: KeyboardTest.java 3418 2010-09-28 21:11:35Z spasi $ */ public class KeyboardTest { /** position of quad to draw */ private Vector2f position = new Vector2f(320.0f, 240.0f); /** Display mode selected */ private DisplayMode displayMode; /** Creates a new instance of MouseTest */ public KeyboardTest() { } private void initialize() { // create display and opengl setupDisplay(false); try { Keyboard.create(); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } } /** * Sets the display mode for fullscreen mode */ protected boolean setDisplayMode() { try { // get modes DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60); org.lwjgl.util.Display.setDisplayMode(dm, new String[] { "width=" + 640, "height=" + 480, "freq=" + 60, "bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel() }); return true; } catch (Exception e) { e.printStackTrace(); } return false; } private void setupDisplay(boolean fullscreen) { try { setDisplayMode(); Display.create(); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } initializeOpenGL(); } private void initializeOpenGL() { glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight()); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight()); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); } public void executeTest() { initialize(); createKeyboard(); wiggleKeyboard(); Keyboard.destroy(); Display.destroy(); } private void createKeyboard() { try { Keyboard.create(); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } } private void wiggleKeyboard() { while (!Display.isCloseRequested()) { Display.update(); if (!Display.isVisible()) { try { Thread.sleep(100); } catch (InterruptedException inte) { inte.printStackTrace(); } continue; } //check keys, buffered Keyboard.poll(); int count = Keyboard.getNumKeyboardEvents(); while (Keyboard.next()) { int character_code = ((int)Keyboard.getEventCharacter()) & 0xffff; System.out.println("Checking key:" + Keyboard.getKeyName(Keyboard.getEventKey())); System.out.println("Pressed:" + Keyboard.getEventKeyState()); System.out.println("Key character code: 0x" + Integer.toHexString(character_code)); System.out.println("Key character: " + Keyboard.getEventCharacter()); System.out.println("Repeat event: " + Keyboard.isRepeatEvent()); if (Keyboard.getEventKey() == Keyboard.KEY_R && Keyboard.getEventKeyState()) { Keyboard.enableRepeatEvents(!Keyboard.areRepeatEventsEnabled()); } if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { return; } } if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) { position.x += 1; } if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) { position.x -= 1; } if (Keyboard.isKeyDown(Keyboard.KEY_UP)) { position.y += 1; } if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) { position.y -= 1; } if (count > 0) { System.out.println(); } if (position.x < 0) { position.x = 0; } else if (position.x > 640 - 60) { position.x = 640 - 60; } if (position.y < 0) { position.y = 0; } else if (position.y > 480 - 30) { position.y = 480 - 30; } render(); try { Thread.sleep(0); } catch (Exception e) { } } } private void render() { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_POLYGON); { float color = 1.0f; glColor3f(color, color, color); glVertex2f(position.x + 0.0f, position.y + 0.0f); glVertex2f(position.x + 0.0f, position.y + 30.0f); glVertex2f(position.x + 40.0f, position.y + 30.0f); glVertex2f(position.x + 60.0f, position.y + 15.f); glVertex2f(position.x + 40.0f, position.y + 0.0f); } glEnd(); } /** * @param args the command line arguments */ public static void main(String[] args) { KeyboardTest kt = new KeyboardTest(); kt.executeTest(); System.exit(0); } } lwjgl-2.7.1/src/java/org/lwjgl/test/input/TestControllers.java0000644000175000017500000001322211543426510023466 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.input; import java.awt.Dimension; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; import org.lwjgl.input.Controller; import org.lwjgl.input.Controllers; /** * Oops. Forgot to document this one. * * @author Kevin Glass */ public class TestControllers extends JPanel { public static int total; private JTextField[] values; private JTextField[] names; private Controller controller; private int buttonCount; private int itemCount; public TestControllers(int index) { controller = Controllers.getController(index); setLayout(null); buttonCount = controller.getButtonCount(); itemCount = controller.getButtonCount() + controller.getAxisCount() + 2; values = new JTextField[itemCount]; names = new JTextField[itemCount]; for (int i=0;i * Mouse test * * @author Brian Matzon * @version $Revision: 3418 $ * $Id: MouseTest.java 3418 2010-09-28 21:11:35Z spasi $ */ public class MouseTest { /** Direction mouse has moved */ private int direction; /** Last button pressed */ private int lastButton; /** Last direction we scrolled in */ private int lastScrollDirection = -1; /** Width of window */ private static int WINDOW_WIDTH = 640; /** Height of window */ private static int WINDOW_HEIGHT = 640; /** Triangle size */ private Vector2f triangleSize = new Vector2f(120, 100); /** Triangle color */ private Vector3f triangleColors[] = new Vector3f[] { new Vector3f(1,1,1), new Vector3f(1,0,0), new Vector3f(0,1,0), new Vector3f(0,0,1) }; private Vector3f quadColors[] = new Vector3f[] { new Vector3f(1,1,1), new Vector3f(1,0,0), new Vector3f(0,1,0), new Vector3f(0,0,1) }; /** Triangles to paint */ private Vector2f[] triangles = { new Vector2f(WINDOW_WIDTH/2, WINDOW_HEIGHT - triangleSize.y), new Vector2f(triangleSize.y, WINDOW_HEIGHT/2), new Vector2f(WINDOW_WIDTH/2, triangleSize.y), new Vector2f(WINDOW_WIDTH-triangleSize.y, WINDOW_HEIGHT/2) }; /** Whether the test is closing */ private boolean closing; /** Fullscreen or not */ public static final boolean FULLSCREEN = false; /** Creates a new instance of MouseTest */ public MouseTest() { } private void initialize() { // create display and opengl setupDisplay(); setupMouse(); setupKeyboard(); } /** * Setup display */ private void setupDisplay() { try { setDisplayMode(); Display.setFullscreen(FULLSCREEN); Display.setVSyncEnabled(true); Display.create(); Mouse.setGrabbed(true); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } initializeOpenGL(); } /** * Sets the display mode for fullscreen mode */ protected boolean setDisplayMode() { // get modes DisplayMode dm = new DisplayMode(WINDOW_WIDTH, WINDOW_HEIGHT); try { Display.setDisplayMode(dm); return true; } catch (Exception e) { e.printStackTrace(); } return false; } /** * Initializes OpenGL * */ private void initializeOpenGL() { glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight()); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight()); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); } /** * Executes the actual test */ public void executeTest() { initialize(); runTest(); Display.destroy(); } /** * Creates the mouse */ private void setupMouse() { } /** * Creates the keyboard */ private void setupKeyboard() { } /** * Runs the test */ private void runTest() { // while not exiting while (!closing) { handleWindow(); // secondary check if(!closing) { // poll and check keyboard and mouse handleKeyboard(); handleMouse(); // pause and continue if minimized if(!Display.isVisible()) { if(Display.isDirty()) { render(); } pause(100); continue; } // render and flip logic(); render(); } Thread.yield(); } } /** * Pauses the current thread for a specified time * * @param time milliseconds to pause */ private void pause(long time) { try { Thread.sleep(time); } catch (InterruptedException inte) { inte.printStackTrace(); } } /** * Handles the window */ private void handleWindow() { Display.update(); closing = Display.isCloseRequested(); } /** * handles the mouse */ private void handleMouse() { readBufferedMouse(); Display.setTitle("x: " + Mouse.getX() + ", y: " + Mouse.getY() + ", [0]: " + Mouse.isButtonDown(0) + ", [1]: " + Mouse.isButtonDown(1) + ", [2]: " + Mouse.isButtonDown(2) + ", inside: " + Mouse.isInsideWindow()); } /** * reads a mouse in buffered mode */ private void readBufferedMouse() { // iterate all events, use the last button down while(Mouse.next()) { if(Mouse.getEventButton() != -1 && Mouse.getEventButtonState()) { lastButton = Mouse.getEventButton(); } } updateState(); } /** * Updates our "model" * */ private void updateState() { direction = -1; int dx = Mouse.getDX(); int dy = Mouse.getDY(); int dw = Mouse.getDWheel(); // get out if no movement if (dx == dy && dx == 0 && dw == 0) { return; } // determine direction moved // ============================ if(dx > 0) { direction = 3; } if(dx < 0) { direction = 1; } if(dy > 0) { direction = 0; } if(dy < 0) { direction = 2; } // ---------------------------- if(direction > -1) { // based on which button was last pushed, update model switch(lastButton) { case -1: break; case 1: triangleColors[direction].y = 1; break; case 2: triangleColors[direction].z = 1; break; case 3: triangleColors[direction].x = 1; triangleColors[direction].y = 1; triangleColors[direction].z = 1; break; case 0: // fall through default: triangleColors[direction].x = 1; break; } } // get direction to update in if (dw > 0) { lastScrollDirection++; } else if (dw < 0) { lastScrollDirection--; } else if (dw == 0) { return; } // over/underflow if(lastScrollDirection < 0) { lastScrollDirection = 3; } if(lastScrollDirection > 3) { lastScrollDirection = 0; } // update colors quadColors[lastScrollDirection].x = (float) Math.random(); quadColors[lastScrollDirection].y = (float) Math.random(); quadColors[lastScrollDirection].z = (float) Math.random(); } /** * Handles the keyboard */ private void handleKeyboard() { while(Keyboard.next()) { // closing on ESCAPE if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState()) { closing = true; } if(Keyboard.getEventKey() == Keyboard.KEY_SPACE && Keyboard.getEventKeyState()) { Mouse.setGrabbed(!Mouse.isGrabbed()); } } } /** * Does the "model logic" */ private void logic() { // "we fade to black" // =========================================== for ( Vector3f color : triangleColors ) { color.x -= 0.01; color.y -= 0.01; color.z -= 0.01; } for ( Vector3f color : quadColors ) { color.x -= 0.01; color.y -= 0.01; color.z -= 0.01; } // ------------------------------------------- } /** * Render our triangles */ private void render() { glClear(GL_COLOR_BUFFER_BIT); // for each triangle, render it at position, rotating degrees for each for(int i=0; i * Mouse test * * @author Brian Matzon * @version $Revision: 3418 $ * $Id: MouseCreationTest.java 3418 2010-09-28 21:11:35Z spasi $ */ public class MouseCreationTest { /** position of quad to draw */ private Vector2f position = new Vector2f(320.0f, 240.0f); /** Creates a new instance of MouseTest */ public MouseCreationTest() { } private void initialize(boolean fullscreen) { try { setDisplayMode(); Display.setFullscreen(fullscreen); Display.create(); Mouse.setGrabbed(true); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } initializeOpenGL(); } /** * Sets the display mode for fullscreen mode */ protected boolean setDisplayMode() { try { // get modes DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60); org.lwjgl.util.Display.setDisplayMode(dm, new String[] { "width=" + 640, "height=" + 480, "freq=" + 60, "bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel() }); return true; } catch (Exception e) { e.printStackTrace(); } return false; } private void initializeOpenGL() { glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Put the window into orthographic projection mode with 1:1 pixel ratio. // We haven't used GLU here to do this to avoid an unnecessary dependency. glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, Display.getDisplayMode().getWidth(), 0.0, Display.getDisplayMode().getHeight(), -1.0, 1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight()); } public void executeTest() { initialize(false); System.out.println("Test ready:\n"); // windowed mode System.out.println("=========== WINDOWED MODE =============="); for(int i=0; i<2; i++) { System.out.println("Test " + (i+1) + ":"); wiggleMouse(); System.out.println(""); } // recreate display in fullscreen mode System.out.print("Destroying display..."); System.out.println("success"); System.out.print("Entering fullscreen mode..."); try { Display.destroy(); initialize(true); } catch (Exception e) { e.printStackTrace(); } System.out.println("success"); // fullscreen mode System.out.println("=========== FULLSCREEN MODE =============="); for(int i=0; i<2; i++) { System.out.println("Test " + (i+3) + ":"); wiggleMouse(); System.out.println(""); } System.out.println("Test completed successfully!"); System.out.print("Shutting down..."); Display.destroy(); System.out.println("shutdown complete"); } private void wiggleMouse() { System.out.print("Please move the mouse around"); long statustime = Sys.getTime(); long endtime = Sys.getTime() + Sys.getTimerResolution() * 5; while (Sys.getTime() < endtime) { Display.update(); // empty mouse buffer while(Mouse.next()); position.x += Mouse.getDX(); position.y += Mouse.getDY(); if(position.x<0) { position.x = 0; } else if (position.x>640-60) { position.x = 640-60; } if(position.y < 0) { position.y = 0; } else if (position.y>480-30) { position.y = 480-30; } render(); if (Sys.getTime() - statustime > Sys.getTimerResolution()) { System.out.print("."); statustime = Sys.getTime(); } } System.out.println("thank you"); } private void render() { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_POLYGON); { float color = 1.0f; int buttonDown = 0; for(int i=0;i * Test class for Sys * * @author Brian Matzon * @version $Revision: 2983 $ * $Id: SysTest.java 2983 2008-04-07 18:36:09Z matzon $ */ public class SysTest { /** * Creates a new SysTest */ public SysTest() { } /** * Runs the tests */ public void executeTest() { testAlert(); testDebug(); testTimer(); testUrl(); testClipboard(); } /** * Tests debug mode */ private void testDebug() { System.out.println("==== Test Debug ===="); if (LWJGLUtil.DEBUG) { LWJGLUtil.log("Debug is enabled, you should now see output from LWJGL during the following tests."); } else { System.out.println("Debug is not enabled. Please set the org.lwjgl.Sys.debug property to true to enable debugging"); System.out.println("Example:\n java -Dorg.lwjgl.util.Debug=true ..."); System.out.println("You will not see any debug output in the following tests."); } // get some display modes, to force some debug info try { Display.getAvailableDisplayModes(); } catch (LWJGLException e) { throw new RuntimeException(e); } System.out.println("---- Test Debug ----\n"); } /** * Tests the timer */ private void testTimer() { long resolution = Sys.getTimerResolution(); long time = Sys.getTime(); System.out.println("==== Test Timer ===="); System.out.println("Resolution of timer (ticks per second): " + resolution); System.out.println("Current time: " + time); System.out.println("Sleeping for 2 seconds, using Thread.sleep()"); pause(2000); long time2 = Sys.getTime(); System.out.println("Current time: " + time2); System.out.println("Actually slept for: " + ((time2 - time) / (float) resolution) + " seconds"); System.out.println("---- Test Timer ----\n"); } /** * Tests the alert */ private void testAlert() { System.out.println("==== Test Alert ===="); System.out.println("Opening native alert window"); Sys.alert("SysTest", "Hello World!"); System.out.println("---- Test Alert ----\n"); } /** * Tests the openUrl */ private void testUrl() { System.out.println("==== Test URL ===="); System.out.println("Opening a browser window to http://www.lwjgl.org"); Sys.openURL("http://www.lwjgl.org"); System.out.println("---- Test URL ----\n"); } /** * Busy waits for a specified number of seconds * * @param priority Priority to busy wait in * @param seconds Number of seconds to busy wait * @param message Message to print to user */ private void busyWait(int priority, int seconds, String message) { long future = Sys.getTime() + (Sys.getTimerResolution() * seconds); System.out.print(message); // waste some cycles while (Sys.getTime() < future) { } System.out.println("done"); } /** * Pause current thread for a specified time * * @param time milliseconds to sleep */ private void pause(long time) { try { Thread.sleep(time); } catch (InterruptedException inte) { } } /** * Tests the clipboard. Helps to have something in it first... */ private void testClipboard() { System.out.println("Contents of clipboard: '"+Sys.getClipboard()+"'"); } /** * Tests the Sys class, and serves as basic usage test * * @param args ignored */ public static void main(String[] args) { new SysTest().executeTest(); System.exit(0); } } lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/0000755000175000017500000000000011543426510017602 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/multithread/0000755000175000017500000000000011543426510022124 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoadTest.java0000644000175000017500000002071211543426510026510 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.opengl.multithread; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.*; import org.lwjgl.util.glu.Sphere; import java.nio.FloatBuffer; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; /** * A test of loading textures in a background thread. This can be achieved in 2 ways: *
      * a) A dummy Pbuffer is created and its context shares the rendering context.
      * b) A SharedDrawable is used.
      *
      * When the test starts, there's no texture created and rendering is done with texturing disabled. * 2 seconds later a "dummy" texture is created in the background thread and texturing is enabled. This dummy texture * can by anything the developer wants to have as a placeholder while textures are being loaded. * Finally, 5 seconds later the "true" texture is loaded and displayed. This texture will change every 5 seconds after * that, until the test is terminated (ESC key). * * @author Spasi */ public final class BackgroundLoadTest { private static boolean run = true; private static BackgroundLoader backgroundLoader; private static Sphere sphere; private BackgroundLoadTest() { } public static void main(String[] args) { initialize(args); Util.checkGLError(); try { backgroundLoader.start(); } catch (LWJGLException e) { kill("Failed to start background thread.", e); } Util.checkGLError(); while ( run ) { if ( !Display.isVisible() ) Thread.yield(); else { handleIO(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderObject(); Util.checkGLError(); // Restore camera position. glPopMatrix(); glPushMatrix(); } Display.update(); if ( Display.isCloseRequested() ) break; } cleanup(); System.exit(0); } private static void initialize(String[] args) { if ( args.length != 1 ) argsError(); DisplayMode displayMode = null; try { DisplayMode[] modes = Display.getAvailableDisplayModes(); displayMode = chooseMode(modes, 1024, 768); if ( displayMode == null ) displayMode = chooseMode(modes, 800, 600); if ( displayMode == null ) displayMode = chooseMode(modes, 640, 480); if ( displayMode == null ) kill("Failed to set an appropriate display mode."); System.out.println("Setting display mode to: " + displayMode); Display.setDisplayMode(displayMode); Display.setTitle("Background Loading Test"); Display.create(new PixelFormat(8, 24, 0)); } catch (LWJGLException e) { kill(e.getMessage()); } glViewport(0, 0, displayMode.getWidth(), displayMode.getHeight()); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45, displayMode.getWidth() / (float)displayMode.getHeight(), 1.0f, 10.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Setup camera position. glTranslatef(0.0f, 0.0f, -4.0f); glRotatef(90.0f, 1.0f, 0.0f, 0.0f); glPushMatrix(); glClearDepth(1.0f); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glFrontFace(GL_CCW); glPolygonMode(GL_FRONT, GL_FILL); glCullFace(GL_BACK); glEnable(GL_CULL_FACE); glAlphaFunc(GL_GREATER, 0.0f); glEnable(GL_ALPHA_TEST); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDisable(GL_BLEND); glShadeModel(GL_SMOOTH); final FloatBuffer vectorBuffer = BufferUtils.createFloatBuffer(4); vectorBuffer.clear(); vectorBuffer.put(0, 1.0f).put(1, 1.0f).put(2, 1.0f).put(3, 1.0f); glLight(GL_LIGHT0, GL_DIFFUSE, vectorBuffer); vectorBuffer.put(0, 1.0f).put(1, 1.0f).put(2, 1.0f).put(3, 1.0f); glLight(GL_LIGHT0, GL_AMBIENT, vectorBuffer); vectorBuffer.put(0, 1.0f).put(1, 1.0f).put(2, 0.5f).put(3, 1.0f); glLight(GL_LIGHT0, GL_SPECULAR, vectorBuffer); vectorBuffer.put(0, -1.0f / 3.0f).put(1, 1.0f / 3.0f).put(2, 1.0f / 3.0f).put(3, 0.0f); // Infinite glLight(GL_LIGHT0, GL_POSITION, vectorBuffer); vectorBuffer.put(0, 0.2f).put(1, 0.2f).put(2, 0.2f).put(3, 1.0f); glLightModel(GL_LIGHT_MODEL_AMBIENT, vectorBuffer); glEnable(GL_LIGHT0); glEnable(GL_LIGHTING); sphere = new Sphere(); if ( "PB".equalsIgnoreCase(args[0]) ) { backgroundLoader = new BackgroundLoader() { Drawable getDrawable() throws LWJGLException { return new Pbuffer(2, 2, new PixelFormat(8, 24, 0), Display.getDrawable()); } }; } else if ( "SD".equalsIgnoreCase(args[0]) ) { backgroundLoader = new BackgroundLoader() { Drawable getDrawable() throws LWJGLException { return new SharedDrawable(Display.getDrawable()); } }; } else { argsError(); } } private static void handleIO() { if ( Keyboard.getNumKeyboardEvents() != 0 ) { while ( Keyboard.next() ) { if ( Keyboard.getEventKeyState() ) continue; switch ( Keyboard.getEventKey() ) { case Keyboard.KEY_ESCAPE: run = false; break; } } } while ( Mouse.next() ) ; } static void renderObject() { glColor3f(1.0f, 1.0f, 1.0f); int texID = backgroundLoader.getTexID(); if ( texID == 0 ) { sphere.setTextureFlag(false); glDisable(GL_TEXTURE_2D); } else { sphere.setTextureFlag(true); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texID); } sphere.draw(1.0f, 32, 32); if ( texID != 0 ) { // Unbind so we can update from the background thread. glBindTexture(GL_TEXTURE_2D, 0); glDisable(GL_TEXTURE_2D); } } private static DisplayMode chooseMode(DisplayMode[] modes, int width, int height) { DisplayMode bestMode = null; for ( DisplayMode mode : modes ) { if ( mode.getWidth() == width && mode.getHeight() == height && mode.getFrequency() <= 85 ) { if ( bestMode == null || (mode.getBitsPerPixel() >= bestMode.getBitsPerPixel() && mode.getFrequency() > bestMode.getFrequency()) ) bestMode = mode; } } return bestMode; } private static void cleanup() { backgroundLoader.cleanup(); Thread.yield(); // Let background thread finish. if ( Display.isCreated() ) Display.destroy(); } private static void argsError() { System.out.println("\nInvalid program arguments."); System.out.println("\nUsage: BackgroundLoadTest , where argument can be one of the following:\n"); System.out.println("PB\t- Use a Pbuffer context for the background thread."); System.out.println("SD\t- Use a SharedDrawable context for the background thread."); cleanup(); System.exit(-1); } static void kill(String reason) { System.out.println("The BackgroundLoadTest program was terminated because an error occured.\n"); System.out.println("Reason: " + (reason == null ? "Unknown" : reason)); cleanup(); System.exit(-1); } static void kill(String reason, Throwable t) { System.out.println("The BackgroundLoadTest program was terminated because an exception occured.\n"); System.out.println("Reason: " + (reason == null ? "Unknown" : reason)); System.out.println("Exception message: " + t.getMessage()); cleanup(); System.exit(-1); } }lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoader.java0000644000175000017500000001312511543426510026177 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Created by LWJGL. * User: spasi * Date: 2004-03-30 * Time: 8:41:42 pm */ package org.lwjgl.test.opengl.multithread; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.Drawable; import org.lwjgl.util.Color; import org.lwjgl.util.ReadableColor; import java.nio.ByteBuffer; import static org.lwjgl.opengl.GL11.*; abstract class BackgroundLoader { private static final int WIDTH = 32; private static final int HEIGHT = 32; private static final Object lock = new Object(); private Drawable drawable; private boolean running; private ByteBuffer texture; private int texID; protected BackgroundLoader() { running = true; texture = BufferUtils.createByteBuffer(WIDTH * HEIGHT * 3); } abstract Drawable getDrawable() throws LWJGLException; void cleanup() { running = false; } void start() throws LWJGLException { new Thread(new Runnable() { public void run() { System.out.println("-- Background Thread started --"); System.out.println("** Sleeping, no texture created yet **"); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } try { drawable = getDrawable(); drawable.makeCurrent(); } catch (LWJGLException e) { throw new RuntimeException(e); } System.out.println("** Drawable created **"); synchronized ( lock ) { // Create a "dummy" texture while we wait for texture IO createCheckerTexture(Color.RED, Color.WHITE, 2); texID = glGenTextures(); glBindTexture(GL_TEXTURE_2D, texID); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, WIDTH, HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, texture); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glBindTexture(GL_TEXTURE_2D, 0); } System.out.println("** Dummy texture created **"); long lastTextureCreated = System.currentTimeMillis(); // Delay first texture creation int count = 0; while ( running ) { long time = System.currentTimeMillis(); if ( time - lastTextureCreated < 5000 ) { // Update the texture every 5 seconds try { Thread.sleep(200); } catch (InterruptedException e) { e.printStackTrace(); } continue; } // Create the "true" texture if ( count % 2 == 0 ) createGradientTexture(Color.RED, Color.BLUE); else createGradientTexture(Color.GREEN, Color.YELLOW); glBindTexture(GL_TEXTURE_2D, texID); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, WIDTH, HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, texture); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glBindTexture(GL_TEXTURE_2D, 0); System.out.println("** Created new gradient texture **"); lastTextureCreated = System.currentTimeMillis(); count++; } drawable.destroy(); System.out.println("-- Background Thread finished --"); } }).start(); } int getTexID() { synchronized ( lock ) { return texID; } } private void createCheckerTexture(final ReadableColor a, final ReadableColor b, final int size) { int i = 0; for ( int y = 0; y < HEIGHT; y++ ) { for ( int x = 0; x < WIDTH; x++ ) { ReadableColor c = (x / size) % 2 == 0 ? ((y / size) % 2 == 0 ? a : b) : ((y / size) % 2 == 0 ? b : a); texture.put(i + 0, c.getRedByte()); texture.put(i + 1, c.getGreenByte()); texture.put(i + 2, c.getBlueByte()); i += 3; } } } private void createGradientTexture(final ReadableColor a, final ReadableColor b) { float l = 0.0f; int i = 0; for ( int y = 0; y < HEIGHT; y++ ) { for ( int x = 0; x < WIDTH; x++ ) { texture.put(i + 0, lerp(a.getRed(), b.getRed(), l)); texture.put(i + 1, lerp(a.getGreen(), b.getGreen(), l)); texture.put(i + 2, lerp(a.getBlue(), b.getBlue(), l)); i += 3; } l += (1.0f / (HEIGHT - 1)); } } private static byte lerp(final int a, final int b, final float l) { return (byte)Math.round(((1.0f - l) * a + l * b)); } }lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/shaders/0000755000175000017500000000000011543426510021233 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/shaders/Shader.java0000644000175000017500000001116411543426510023307 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Created by LWJGL. * User: spasi * Date: 2004-03-30 * Time: 8:41:42 pm */ package org.lwjgl.test.opengl.shaders; import org.lwjgl.BufferUtils; import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import static org.lwjgl.opengl.ARBProgram.*; import static org.lwjgl.opengl.ARBShaderObjects.*; import static org.lwjgl.opengl.GL11.*; abstract class Shader { protected static ByteBuffer fileBuffer = BufferUtils.createByteBuffer(1024 * 10); protected Shader() { } abstract void render(); abstract void cleanup(); protected static String getShaderText(String file) { String shader = null; try { InputStream source = ShadersTest.class.getResourceAsStream(file); if ( source == null ) // dev-mode source = new FileInputStream("src/java/org/lwjgl/test/opengl/shaders/" + file); BufferedInputStream stream = new BufferedInputStream(source); byte character; while ( (character = (byte)stream.read()) != -1 ) fileBuffer.put(character); stream.close(); fileBuffer.flip(); byte[] array = new byte[fileBuffer.remaining()]; fileBuffer.get(array); shader = new String(array); fileBuffer.clear(); } catch (IOException e) { ShadersTest.kill("Failed to read the shader source file: " + file, e); } return shader; } protected static void checkProgramError(String programFile, String programSource) { if ( glGetError() == GL_INVALID_OPERATION ) { final int errorPos = glGetInteger(GL_PROGRAM_ERROR_POSITION_ARB); int lineStart = 0; int lineEnd = -1; for ( int i = 0; i < programSource.length(); i++ ) { if ( programSource.charAt(i) == '\n' ) { if ( i <= errorPos ) { lineStart = i + 1; } else { lineEnd = i; break; } } } if ( lineEnd == -1 ) lineEnd = programSource.length(); ShadersTest.kill("Low-level program error in file: " + programFile + "\n\tError line: " + programSource.substring(lineStart, lineEnd) + "\n\tError message: " + glGetString(GL_PROGRAM_ERROR_STRING_ARB)); } } protected static int getUniformLocation(int ID, String name) { final int location = glGetUniformLocationARB(ID, name); if ( location == -1 ) throw new IllegalArgumentException("The uniform \"" + name + "\" does not exist in the Shader Program."); return location; } protected static void printShaderObjectInfoLog(String file, int ID) { final int logLength = glGetObjectParameteriARB(ID, GL_OBJECT_INFO_LOG_LENGTH_ARB); if ( logLength <= 1 ) return; System.out.println("\nInfo Log of Shader Object: " + file); System.out.println("--------------------------"); System.out.println(glGetInfoLogARB(ID, logLength)); } protected static void printShaderProgramInfoLog(int ID) { final int logLength = glGetObjectParameteriARB(ID, GL_OBJECT_INFO_LOG_LENGTH_ARB); if ( logLength <= 1 ) return; System.out.println("\nShader Program Info Log: "); System.out.println("--------------------------"); System.out.println(glGetInfoLogARB(ID, logLength)); } } lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java0000644000175000017500000002336111543426510024334 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Created by LWJGL. * User: spasi * Date: 2004-03-30 * Time: 8:41:42 pm */ package org.lwjgl.test.opengl.shaders; import java.nio.FloatBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.*; import org.lwjgl.util.glu.Sphere; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; public final class ShadersTest { private static DisplayMode displayMode; private static boolean run = true; private static final FloatBuffer vectorBuffer = BufferUtils.createFloatBuffer(4); private static Sphere sphere; private static Shader shader; private static float frameTime; private static float angle; private static float sin; private static int specularity = 4; private ShadersTest() { } public static void main(String[] args) { initialize(args); long frameStart; long lastFrameTime = 0; while ( run ) { if (!Display.isVisible() ) Thread.yield(); else { // This is the current frame time. frameStart = Sys.getTime(); // How many seconds passed since last frame. frameTime = (float)((frameStart - lastFrameTime) / (double)Sys.getTimerResolution()); lastFrameTime = frameStart; //angle += frameTime * 90.0f; angle += 0.1f; sin = (float)Math.sin(Math.toRadians(angle)); handleIO(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if ( shader != null ) shader.render(); else renderObject(); // Restore camera position. glPopMatrix(); glPushMatrix(); } Display.update(); if ( Display.isCloseRequested() ) break; } cleanup(); System.exit(0); } private static void initialize(String[] args) { if ( args.length != 1 ) argsError(); try { DisplayMode[] modes = Display.getAvailableDisplayModes(); DisplayMode displayMode; displayMode = chooseMode(modes, 1024, 768); if ( displayMode == null ) displayMode = chooseMode(modes, 800, 600); if ( displayMode == null ) displayMode = chooseMode(modes, 640, 480); if ( displayMode == null ) kill("Failed to set an appropriate display mode."); System.out.println("Setting display mode to: " + displayMode); Display.setDisplayMode(displayMode); Display.create(new PixelFormat(8, 24, 0), "UNI".equalsIgnoreCase(args[0]) ? new ContextAttribs(3, 1) : null); ShadersTest.displayMode = displayMode; } catch (LWJGLException e) { kill(e.getMessage()); } final ContextCapabilities caps = GLContext.getCapabilities(); if ( "NONE".equalsIgnoreCase(args[0]) ) { shader = null; } else if ( "VP".equalsIgnoreCase(args[0]) ) { if ( !caps.GL_ARB_vertex_program ) kill("The ARB_vertex_program extension is not supported."); shader = new ShaderVP("shaderVP.vp"); } else if ( "FP".equalsIgnoreCase(args[0]) ) { if ( !caps.GL_ARB_vertex_program ) kill("The ARB_vertex_program extension is not supported."); if ( !caps.GL_ARB_fragment_program ) kill("The ARB_fragment_program extension is not supported."); shader = new ShaderFP("shaderFP.vp", "shaderFP.fp"); } else if ( "VSH".equalsIgnoreCase(args[0]) ) { if ( !caps.GL_ARB_vertex_shader ) kill("The ARB_vertex_shader extension is not supported."); shader = new ShaderVSH("shaderVSH.vsh"); } else if ( "FSH".equalsIgnoreCase(args[0]) ) { if ( !caps.GL_ARB_vertex_shader ) kill("The ARB_vertex_shader extension is not supported."); if ( !caps.GL_ARB_fragment_shader ) kill("The ARB_fragment_shader extension is not supported."); shader = new ShaderFSH("shaderFSH.vsh", "shaderFSH.fsh"); } else if ("UNI".equalsIgnoreCase(args[0]) ) { if ( !(caps.OpenGL31 || caps.GL_ARB_uniform_buffer_object) ) kill("Neither OpenGL version 3.1 nor ARB_uniform_buffer_object are supported."); shader = new ShaderUNI("shaderUNI.vsh"); } else { argsError(); } glViewport(0, 0, displayMode.getWidth(), displayMode.getHeight()); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45, displayMode.getWidth() / (float)displayMode.getHeight(), 1.0f, 10.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Setup camera position. glTranslatef(0.0f, 0.0f, -4.0f); glRotatef(15.0f, 1.0f, 0.0f, 0.0f); glPushMatrix(); glClearDepth(1.0f); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glFrontFace(GL_CCW); glPolygonMode(GL_FRONT, GL_FILL); glCullFace(GL_BACK); glEnable(GL_CULL_FACE); glAlphaFunc(GL_NOTEQUAL, 0.0f); glEnable(GL_ALPHA_TEST); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); // Setup lighting for when we have fixed function fragment rendering. glShadeModel(GL_SMOOTH); if ( shader == null ) { glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); } vectorBuffer.clear(); vectorBuffer.put(1.0f).put(1.0f).put(1.0f).put(1.0f); vectorBuffer.clear(); glLight(GL_LIGHT0, GL_DIFFUSE, vectorBuffer); vectorBuffer.put(1.0f).put(1.0f).put(1.0f).put(1.0f); vectorBuffer.clear(); glLight(GL_LIGHT0, GL_AMBIENT, vectorBuffer); vectorBuffer.put(1.0f).put(1.0f).put(0.5f).put(1.0f); vectorBuffer.clear(); glLight(GL_LIGHT0, GL_SPECULAR, vectorBuffer); vectorBuffer.put(-1.0f / 3.0f).put(1.0f / 3.0f).put(1.0f / 3.0f).put(0.0f); // Infinite vectorBuffer.clear(); glLight(GL_LIGHT0, GL_POSITION, vectorBuffer); vectorBuffer.put(0.2f).put(0.2f).put(0.2f).put(1.0f); vectorBuffer.clear(); glLightModel(GL_LIGHT_MODEL_AMBIENT, vectorBuffer); sphere = new Sphere(); } private static void handleIO() { if ( Keyboard.getNumKeyboardEvents() != 0 ) { while ( Keyboard.next() ) { if ( Keyboard.getEventKeyState() ) continue; switch ( Keyboard.getEventKey() ) { case Keyboard.KEY_EQUALS: if ( specularity < 8 ) specularity++; break; case Keyboard.KEY_MINUS: if ( specularity > 1 ) specularity--; break; case Keyboard.KEY_ESCAPE: run = false; break; } } } while ( Mouse.next() ) ; } static int getDisplayWidth() { return displayMode.getWidth(); } static int getDisplayHeight() { return displayMode.getHeight(); } static float getSin() { return sin; } static int getSpecularity() { return specularity; } static void renderObject() { glColor3b((byte)255, (byte)255, (byte)255); sphere.draw(1.0f, 32, 32); } private static DisplayMode chooseMode(DisplayMode[] modes, int width, int height) { DisplayMode bestMode = null; for ( DisplayMode mode : modes ) { if ( mode.getWidth() == width && mode.getHeight() == height && mode.getFrequency() <= 85 ) { if ( bestMode == null || (mode.getBitsPerPixel() >= bestMode.getBitsPerPixel() && mode.getFrequency() > bestMode.getFrequency()) ) bestMode = mode; } } return bestMode; } private static void cleanup() { // This is not necessary, just showing how to properly delete a program/shader. if ( shader != null ) shader.cleanup(); if ( Display.isCreated() ) Display.destroy(); } private static void argsError() { System.out.println("\nInvalid program arguments."); System.out.println("\nUsage: ShadersTest , where argument can be one of the following:\n"); System.out.println("none\t- Use fixed function rendering."); System.out.println("vp\t- Use ARB_vertex_program (low-level) only."); System.out.println("vsh\t- Use ARB_vertex_shader (GLSL) only."); System.out.println("fp\t- Use ARB_vertex_program + ARB_fragment_program (low-level)."); System.out.println("fsh\t- Use ARB_vertex_shader + ARB_fragment_shader (GLSL)."); System.out.println("uni\t- Use ARB_uniform_buffer_object to update shader uniforms (GLSL)."); cleanup(); System.exit(-1); } static void kill(String reason) { System.out.println("The ShaderTest program was terminated because an error occured.\n"); System.out.println("Reason: " + (reason == null ? "Unknown" : reason)); cleanup(); System.exit(-1); } static void kill(String reason, Throwable t) { System.out.println("The ShaderTest program was terminated because an exception occured.\n"); System.out.println("Reason: " + reason == null ? "Unknown" : reason); System.out.println("Exception message: " + t.getMessage()); cleanup(); System.exit(-1); } } lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/shaders/shaderVP.vp0000644000175000017500000000275311543426510023325 0ustar zero79zero79!!ARBvp1.0 ATTRIB iPos = vertex.position; ATTRIB iNormal = vertex.normal; PARAM mvp[4] = { state.matrix.mvp }; PARAM mvIT[4] = { state.matrix.modelview.invtrans }; PARAM ambience = state.lightmodel.ambient; PARAM lightDir = state.light[0].position; PARAM halfDir = state.light[0].half; PARAM diffuseColor = state.light[0].diffuse; PARAM specularColor = state.light[0].specular; PARAM UNIFORMS = program.local[0]; TEMP temp, temp2, normal, dots; OUTPUT oPos = result.position; OUTPUT oColor = result.color; # Transform the vertex to clip coordinates. DP4 oPos.x, mvp[0], iPos; DP4 oPos.y, mvp[1], iPos; DP4 oPos.z, mvp[2], iPos; DP4 oPos.w, mvp[3], iPos; # Transform the normal to eye coordinates. DP3 normal.x, mvIT[0], iNormal; DP3 normal.y, mvIT[1], iNormal; DP3 normal.z, mvIT[2], iNormal; # Compute diffuse and specular dot products and use LIT to compute # lighting coefficients. DP3 dots.x, normal, lightDir; DP3 dots.y, normal, halfDir; MOV dots.w, UNIFORMS.y; LIT dots, dots; # Normalize position, to get a {-1..1} value for each vertex. DP3 temp.w, iPos, iPos; RSQ temp.w, temp.w; MUL temp.xyz, iPos, temp.w; # Multiply with current sin. MUL temp.xyz, temp, UNIFORMS.x; # {-1..1} => {0..1} MAD temp.xyz, temp, 0.5, 0.5; # Intensify colors. MUL temp.xyz, temp, 2.0; # Accumulate color contributions. MAD temp.xyz, dots.y, temp, ambience; MAD oColor.xyz, dots.z, specularColor, temp; MOV oColor.w, 1.0; ENDlwjgl-2.7.1/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java0000644000175000017500000000724111543426510023536 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Created by LWJGL. * User: spasi * Date: 2004-03-30 * Time: 9:55:38 pm */ package org.lwjgl.test.opengl.shaders; import org.lwjgl.opengl.ARBFragmentProgram; import org.lwjgl.opengl.ARBVertexProgram; import static org.lwjgl.opengl.ARBProgram.*; import static org.lwjgl.opengl.GL11.*; final class ShaderFP extends Shader { final String vpFile; final String vpSource; final int vpID; final String fpFile; final String fpSource; final int fpID; ShaderFP(final String vpShaderFile, final String fpShaderFile) { // Initialize the vertex program. vpFile = vpShaderFile; vpSource = getShaderText(vpShaderFile); vpID = glGenProgramsARB(); glBindProgramARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, vpID); glProgramStringARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, vpSource); checkProgramError(vpFile, vpSource); // Initialize the fragment program. fpFile = fpShaderFile; fpSource = getShaderText(fpShaderFile); fpID = glGenProgramsARB(); glBindProgramARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, fpID); glProgramStringARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, fpSource); checkProgramError(fpFile, fpSource); } void render() { glEnable(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB); glBindProgramARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, vpID); glEnable(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB); glBindProgramARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, fpID); glProgramLocalParameter4fARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, 0, ShadersTest.getSin(), ShadersTest.getSpecularity() * 8.0f, 0.0f, 0.0f); glProgramLocalParameter4fARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, 0, ShadersTest.getSin(), ShadersTest.getSpecularity() * 8.0f, -ShadersTest.getDisplayWidth() * 0.5f, -ShadersTest.getDisplayHeight() * 0.5f); ShadersTest.renderObject(); glDisable(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB); glDisable(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB); } void cleanup() { glDeleteProgramsARB(vpID); glDeleteProgramsARB(fpID); } }lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/shaders/shaderFSH.fsh0000644000175000017500000000116311543426510023545 0ustar zero79zero79uniform vec4 UNIFORMS; varying vec2 dots; void main(void) { // Offset window-space fragment position. vec3 color2D = vec3(gl_FragCoord + UNIFORMS.zwxx); // Normalize position. // Multiply with current sin. color2D.xy = normalize(color2D).xy * UNIFORMS.x; // {-1..1} => {0..1} & Intensify colors. color2D.xy = (vec2(color2D) * 0.5 + 0.5) * 2.0; color2D.z = 1.0; // Accumulate color contributions. // Hardcoded ambience and specular color, due to buggy drivers. color2D = dots.x * color2D + vec3(0.2, 0.2, 0.2); gl_FragColor.rgb = pow(dots.y, UNIFORMS.y) * vec3(1.0, 1.0, 0.5) + color2D; gl_FragColor.a = 1.0; }lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/shaders/shaderUNI.vsh0000644000175000017500000000161011543426510023575 0ustar zero79zero79#version 140 #extension GL_ARB_uniform_buffer_object : enable layout(std140) uniform test { vec2 uniformA; vec3 uniformB; }; void main(void) { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; vec3 normal = gl_NormalMatrix * gl_Normal; float diffuseDot = max(dot(normal, vec3(gl_LightSource[0].position)), 0.0); float specularDot = max(dot(normal, vec3(gl_LightSource[0].halfVector)), 0.0); specularDot = pow(specularDot, uniformA.y); // Normalize position, to get a {-1..1} value for each vertex. // Multiply with current sin. vec3 color3D = normalize(vec3(gl_Vertex)) * uniformA.x; // {-1..1} => {0..1} & Intensify colors. color3D = (color3D * 0.5 + 0.5) * 2.0; // Accumulate color contributions. color3D = diffuseDot * (uniformB + color3D) + vec3(gl_LightModel.ambient); gl_FrontColor.rgb = specularDot * vec3(gl_LightSource[0].specular) + color3D; gl_FrontColor.a = 1.0; }lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/shaders/shaderFP.fp0000644000175000017500000000156711543426510023267 0ustar zero79zero79!!ARBfp1.0 OPTION ARB_precision_hint_fastest; ATTRIB winPos = fragment.position; ATTRIB iDots = fragment.texcoord[0]; PARAM ambience = state.lightmodel.ambient; PARAM specularColor = state.light[0].specular; PARAM UNIFORMS = program.local[0]; TEMP temp; OUTPUT oColor = result.color; # Offset window-space fragment position. ADD temp.xyz, winPos, UNIFORMS.zwxx; # Normalize position. DP3 temp.w, temp, temp; RSQ temp.w, temp.w; MUL temp.xy, temp, temp.w; # Multiply with current sin. MUL temp.xy, temp, UNIFORMS.x; # {-1..1} => {0..1} MAD temp.xy, temp, 0.5, 0.5; # Intensify colors. MUL temp.xy, temp, 2.0; MOV temp.z, 1.0; # Accumulate color contributions. MAD temp.xyz, iDots.x, temp, ambience; # Calculate ^ POW temp.w, iDots.y, UNIFORMS.y; MAD oColor.xyz, temp.w, specularColor, temp; MOV oColor.w, 1.0; ENDlwjgl-2.7.1/src/java/org/lwjgl/test/opengl/shaders/ShaderVSH.java0000644000175000017500000000611111543426510023664 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Created by LWJGL. * User: spasi * Date: 2004-03-30 * Time: 9:55:38 pm */ package org.lwjgl.test.opengl.shaders; import static org.lwjgl.opengl.ARBShaderObjects.*; import static org.lwjgl.opengl.ARBVertexShader.*; import static org.lwjgl.opengl.GL11.*; final class ShaderVSH extends Shader { final String file; final String source; final int shaderID; final int programID; final int uniformLocation; ShaderVSH(final String shaderFile) { file = shaderFile; source = getShaderText(shaderFile); shaderID = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); glShaderSourceARB(shaderID, source); glCompileShaderARB(shaderID); printShaderObjectInfoLog(file, shaderID); if ( glGetObjectParameteriARB(shaderID, GL_OBJECT_COMPILE_STATUS_ARB) == GL_FALSE ) ShadersTest.kill("A compilation error occured in a vertex shader."); programID = glCreateProgramObjectARB(); glAttachObjectARB(programID, shaderID); glLinkProgramARB(programID); printShaderProgramInfoLog(programID); if ( glGetObjectParameteriARB(programID, GL_OBJECT_LINK_STATUS_ARB) == GL_FALSE ) ShadersTest.kill("A linking error occured in a shader program."); uniformLocation = getUniformLocation(programID, "UNIFORMS"); } void render() { glUseProgramObjectARB(programID); glUniform2fARB(uniformLocation, ShadersTest.getSin(), ShadersTest.getSpecularity() * 8.0f); ShadersTest.renderObject(); glUseProgramObjectARB(0); } void cleanup() { glDetachObjectARB(programID, shaderID); glDeleteObjectARB(shaderID); glDeleteObjectARB(programID); } }lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/shaders/shaderFP.vp0000644000175000017500000000161211543426510023276 0ustar zero79zero79!!ARBvp1.0 ATTRIB iPos = vertex.position; ATTRIB iNormal = vertex.normal; PARAM mvp[4] = { state.matrix.mvp }; PARAM mvIT[4] = { state.matrix.modelview.invtrans }; PARAM lightDir = state.light[0].position; PARAM halfDir = state.light[0].half; PARAM UNIFORMS = program.local[0]; TEMP normal, dots; OUTPUT oPos = result.position; OUTPUT oDots = result.texcoord[0]; # Transform the vertex to clip coordinates. DP4 oPos.x, mvp[0], iPos; DP4 oPos.y, mvp[1], iPos; DP4 oPos.z, mvp[2], iPos; DP4 oPos.w, mvp[3], iPos; # Transform the normal to eye coordinates. DP3 normal.x, mvIT[0], iNormal; DP3 normal.y, mvIT[1], iNormal; DP3 normal.z, mvIT[2], iNormal; # Compute diffuse and specular dot products and clamp them. DP3 dots.x, normal, lightDir; MAX oDots.x, dots.x, 0.0; DP3 dots.y, normal, halfDir; MAX oDots.y, dots.y, 0.0; ENDlwjgl-2.7.1/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java0000644000175000017500000001240211543426510023657 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Created by LWJGL. * User: spasi * Date: 2009-12-04 */ package org.lwjgl.test.opengl.shaders; import org.lwjgl.BufferUtils; import org.lwjgl.opengl.*; import java.nio.FloatBuffer; import java.nio.IntBuffer; import static org.lwjgl.opengl.ARBUniformBufferObject.*; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL15.*; import static org.lwjgl.opengl.GL20.*; final class ShaderUNI extends Shader { final String file; final String source; final int shaderID; final int programID; final int bufferID; final FloatBuffer buffer; final int uniformA_index; final int uniformA_offset; final int uniformB_index; final int uniformB_offset; ShaderUNI(final String shaderFile) { file = shaderFile; source = getShaderText(shaderFile); shaderID = glCreateShader(GL_VERTEX_SHADER); glShaderSource(shaderID, source); glCompileShader(shaderID); printShaderObjectInfoLog(file, shaderID); if ( glGetShader(shaderID, GL_COMPILE_STATUS) == GL_FALSE ) ShadersTest.kill("A compilation error occured in a vertex shader."); programID = glCreateProgram(); glAttachShader(programID, shaderID); glLinkProgram(programID); printShaderProgramInfoLog(programID); if ( glGetProgram(programID, GL_LINK_STATUS) == GL_FALSE ) ShadersTest.kill("A linking error occured in a shader program."); final String[] uniformNames = { "uniformA", "uniformB" }; // Get uniform block index and data size final int blockIndex = glGetUniformBlockIndex(programID, "test"); final int blockSize = glGetActiveUniformBlock(programID, blockIndex, GL_UNIFORM_BLOCK_DATA_SIZE); System.out.println("blockSize = " + blockSize); // Create uniform buffer object and allocate a ByteBuffer bufferID = glGenBuffers(); glBindBuffer(GL_UNIFORM_BUFFER, bufferID); glBufferData(GL_UNIFORM_BUFFER, blockSize, GL_DYNAMIC_DRAW); buffer = BufferUtils.createFloatBuffer(blockSize); // Attach UBO and associate uniform block to binding point 0 glBindBufferBase(GL_UNIFORM_BUFFER, 0, bufferID); glUniformBlockBinding(programID, blockIndex, 0); // Get uniform information IntBuffer indexes = BufferUtils.createIntBuffer(uniformNames.length); IntBuffer params = BufferUtils.createIntBuffer(uniformNames.length); glGetUniformIndices(programID, uniformNames, indexes); uniformA_index = indexes.get(0); uniformB_index = indexes.get(1); glGetActiveUniforms(programID, indexes, GL_UNIFORM_OFFSET, params); uniformA_offset = params.get(0); uniformB_offset = params.get(1); System.out.println("\nuniformA index = " + uniformA_index); System.out.println("uniformB index = " + uniformB_index); System.out.println("\nuniformA offset = " + uniformA_offset + " - should be 0 for std140"); System.out.println("uniformB offset = " + uniformB_offset + " - should be 16 for std140"); Util.checkGLError(); } void render() { glUseProgram(programID); //* -- std140 layout // Uniform A buffer.put(0, ShadersTest.getSin()).put(1, ShadersTest.getSpecularity() * 8.0f); // Uniform B - str140 alignment at 16 bytes buffer.put(4, 0.0f).put(5, 0.7f).put(6, 0.0f); glBindBuffer(GL_UNIFORM_BUFFER, bufferID); glBufferData(GL_UNIFORM_BUFFER, buffer, GL_DYNAMIC_DRAW); //*/ /* -- non-std140 layout // Uniform A buffer.put(ShadersTest.getSin()).put(ShadersTest.getSpecularity() * 8.0f); buffer.flip(); glBufferSubData(GL_UNIFORM_BUFFER, uniformA_offset, buffer); // Uniform B buffer.clear(); buffer.put(0.0f).put(0.7f).put(0.0f); buffer.flip(); glBufferSubData(GL_UNIFORM_BUFFER, uniformB_offset, buffer); //*/ ShadersTest.renderObject(); glUseProgram(0); } void cleanup() { glDeleteBuffers(bufferID); glDetachShader(programID, shaderID); glDeleteShader(shaderID); glDeleteProgram(programID); } }lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/shaders/shaderFSH.vsh0000644000175000017500000000054211543426510023565 0ustar zero79zero79uniform vec4 UNIFORMS; varying vec2 dots; void main(void) { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; vec3 normal = gl_NormalMatrix * gl_Normal; // Pass the dot products to the fragment shader. dots.x = max(dot(normal, vec3(gl_LightSource[0].position)), 0.0); dots.y = max(dot(normal, vec3(gl_LightSource[0].halfVector)), 0.0); }lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/shaders/ShaderVP.java0000644000175000017500000000477711543426510023571 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Created by LWJGL. * User: spasi * Date: 2004-03-30 * Time: 9:55:38 pm */ package org.lwjgl.test.opengl.shaders; import static org.lwjgl.opengl.ARBVertexProgram.*; import static org.lwjgl.opengl.GL11.*; final class ShaderVP extends Shader { final String file; final String source; final int ID; ShaderVP(final String shaderFile) { file = shaderFile; source = getShaderText(shaderFile); ID = glGenProgramsARB(); glBindProgramARB(GL_VERTEX_PROGRAM_ARB, ID); glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, source); checkProgramError(file, source); } void render() { glEnable(GL_VERTEX_PROGRAM_ARB); glBindProgramARB(GL_VERTEX_PROGRAM_ARB, ID); glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 0, ShadersTest.getSin(), ShadersTest.getSpecularity() * 8.0f, 0.0f, 0.0f); ShadersTest.renderObject(); glDisable(GL_VERTEX_PROGRAM_ARB); } void cleanup() { glDeleteProgramsARB(ID); } }lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/shaders/shaderVSH.vsh0000644000175000017500000000142611543426510023607 0ustar zero79zero79uniform vec2 UNIFORMS; void main(void) { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; vec3 normal = gl_NormalMatrix * gl_Normal; float diffuseDot = max(dot(normal, vec3(gl_LightSource[0].position)), 0.0); float specularDot = max(dot(normal, vec3(gl_LightSource[0].halfVector)), 0.0); specularDot = pow(specularDot, UNIFORMS.y); // Normalize position, to get a {-1..1} value for each vertex. // Multiply with current sin. vec3 color3D = normalize(vec3(gl_Vertex)) * UNIFORMS.x; // {-1..1} => {0..1} & Intensify colors. color3D = (color3D * 0.5 + 0.5) * 2.0; // Accumulate color contributions. color3D = diffuseDot * color3D + vec3(gl_LightModel.ambient); gl_FrontColor.rgb = specularDot * vec3(gl_LightSource[0].specular) + color3D; gl_FrontColor.a = 1.0; }lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/shaders/ShaderFSH.java0000644000175000017500000000765211543426510023657 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Created by LWJGL. * User: spasi * Date: 2004-03-30 * Time: 9:55:38 pm */ package org.lwjgl.test.opengl.shaders; import static org.lwjgl.opengl.ARBFragmentShader.*; import static org.lwjgl.opengl.ARBShaderObjects.*; import static org.lwjgl.opengl.ARBVertexShader.*; import static org.lwjgl.opengl.GL11.*; final class ShaderFSH extends Shader { final String vshFile; final String vshSource; final int vshID; final String fshFile; final String fshSource; final int fshID; final int programID; final int uniformLocation; ShaderFSH(final String vshFile, final String fshFile) { // Initialize the vertex shader. this.vshFile = vshFile; vshSource = getShaderText(vshFile); vshID = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); glShaderSourceARB(vshID, vshSource); glCompileShaderARB(vshID); printShaderObjectInfoLog(this.vshFile, vshID); if ( glGetObjectParameteriARB(vshID, GL_OBJECT_COMPILE_STATUS_ARB) == GL_FALSE ) ShadersTest.kill("A compilation error occured in a vertex shader."); // Initialize the fragment shader. this.fshFile = fshFile; fshSource = getShaderText(fshFile); fshID = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); glShaderSourceARB(fshID, fshSource); glCompileShaderARB(fshID); printShaderObjectInfoLog(this.fshFile, fshID); if ( glGetObjectParameteriARB(fshID, GL_OBJECT_COMPILE_STATUS_ARB) == GL_FALSE ) ShadersTest.kill("A compilation error occured in a fragment shader."); // Initialize the shader program. programID = glCreateProgramObjectARB(); glAttachObjectARB(programID, vshID); glAttachObjectARB(programID, fshID); glLinkProgramARB(programID); printShaderProgramInfoLog(programID); if ( glGetObjectParameteriARB(programID, GL_OBJECT_LINK_STATUS_ARB) == GL_FALSE ) ShadersTest.kill("A linking error occured in a shader program."); uniformLocation = getUniformLocation(programID, "UNIFORMS"); } void render() { glUseProgramObjectARB(programID); glUniform4fARB(uniformLocation, ShadersTest.getSin(), ShadersTest.getSpecularity() * 8.0f, -ShadersTest.getDisplayWidth() * 0.5f, -ShadersTest.getDisplayHeight() * 0.5f); ShadersTest.renderObject(); glUseProgramObjectARB(0); } void cleanup() { glDetachObjectARB(programID, vshID); glDetachObjectARB(programID, fshID); glDeleteObjectARB(vshID); glDeleteObjectARB(fshID); glDeleteObjectARB(programID); } }lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/VBOTest.java0000644000175000017500000001503411543426510021736 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: VBOTest.java 3418 2010-09-28 21:11:35Z spasi $ * * Simple java test program. * * @author elias_naur * @version $Revision: 3418 $ */ package org.lwjgl.test.opengl; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import org.lwjgl.Sys; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import org.lwjgl.opengl.GLContext; import static org.lwjgl.opengl.ARBBufferObject.*; import static org.lwjgl.opengl.ARBVertexBufferObject.*; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; public final class VBOTest { static { try { //find first display mode that allows us 640*480*16 int mode = -1; DisplayMode[] modes = Display.getAvailableDisplayModes(); for ( int i = 0; i < modes.length; i++ ) { if ( modes[i].getWidth() == 640 && modes[i].getHeight() == 480 && modes[i].getBitsPerPixel() >= 16 ) { mode = i; break; } } if ( mode != -1 ) { //select above found displaymode System.out.println("Setting display mode to " + modes[mode]); Display.setDisplayMode(modes[mode]); System.out.println("Created display."); } } catch (Exception e) { System.err.println("Failed to create display due to " + e); } } static { try { Display.create(); System.out.println("Created OpenGL."); } catch (Exception e) { System.err.println("Failed to create OpenGL due to " + e); System.exit(1); } } /** * Is the game finished? */ private static boolean finished; /** * A rotating square! */ private static float angle; private static int buffer_id; private static FloatBuffer vertices; private static ByteBuffer mapped_buffer; private static FloatBuffer mapped_float_buffer; public static void main(String[] arguments) { try { init(); while ( !finished ) { Display.update(); if ( !Display.isVisible() ) Thread.sleep(200); else if ( Display.isCloseRequested() ) System.exit(0); mainLoop(); render(); } } catch (Throwable t) { t.printStackTrace(); } finally { cleanup(); } System.exit(0); } /** * All calculations are done in here */ private static void mainLoop() { angle += 1f; if ( angle > 360.0f ) angle = 0.0f; if ( Mouse.getDX() != 0 || Mouse.getDY() != 0 || Mouse.getDWheel() != 0 ) System.out.println("Mouse moved " + Mouse.getDX() + " " + Mouse.getDY() + " " + Mouse.getDWheel()); for ( int i = 0; i < Mouse.getButtonCount(); i++ ) if ( Mouse.isButtonDown(i) ) System.out.println("Button " + i + " down"); if ( Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) ) finished = true; for ( int i = 0; i < Keyboard.getNumKeyboardEvents(); i++ ) { Keyboard.next(); if ( Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState() ) finished = true; if ( Keyboard.getEventKey() == Keyboard.KEY_T && Keyboard.getEventKeyState() ) System.out.println("Current time: " + Sys.getTime()); } } /** * All rendering is done in here */ private static void render() { glClear(GL_COLOR_BUFFER_BIT); glPushMatrix(); glTranslatef(Display.getDisplayMode().getWidth() / 2, Display.getDisplayMode().getHeight() / 2, 0.0f); glRotatef(angle, 0, 0, 1.0f); ByteBuffer new_mapped_buffer = glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB, mapped_buffer); if ( new_mapped_buffer != mapped_buffer ) mapped_float_buffer = new_mapped_buffer.order(ByteOrder.nativeOrder()).asFloatBuffer(); mapped_buffer = new_mapped_buffer; mapped_float_buffer.rewind(); vertices.rewind(); mapped_float_buffer.put(vertices); if ( glUnmapBufferARB(GL_ARRAY_BUFFER_ARB) ) glDrawArrays(GL_QUADS, 0, 4); glPopMatrix(); } /** * Initialize */ private static void init() throws Exception { System.out.println("Timer resolution: " + Sys.getTimerResolution()); // Go into orthographic projection mode. glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight()); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight()); if ( !GLContext.getCapabilities().GL_ARB_vertex_buffer_object ) { System.out.println("ARB VBO not supported!"); System.exit(1); } buffer_id = glGenBuffersARB(); glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffer_id); vertices = ByteBuffer.allocateDirect(2 * 4 * 4).order(ByteOrder.nativeOrder()).asFloatBuffer(); vertices.put(-50).put(-50).put(50).put(-50).put(50).put(50).put(-50).put(50); glBufferDataARB(GL_ARRAY_BUFFER_ARB, 2 * 4 * 4, GL_STREAM_DRAW_ARB); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, 0); } /** * Cleanup */ private static void cleanup() { glDeleteBuffersARB(buffer_id); Display.destroy(); } } lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java0000644000175000017500000001705711543426510025062 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.opengl; import org.lwjgl.LWJGLException; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import org.lwjgl.util.vector.Vector2f; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; /** * * Tests switching between windowed and fullscreen * * @author Brian Matzon * @version $Revision: 3418 $ * $Id: FullScreenWindowedTest.java 3418 2010-09-28 21:11:35Z spasi $ */ public class FullScreenWindowedTest { /** Intended deiplay mode */ private DisplayMode mode; /** our quad moving around */ private Vector2f quadPosition; /** our quadVelocity */ private Vector2f quadVelocity; /** angle of quad */ private float angle; /** degrees to rotate per frame */ private float angleRotation = 1.0f; /** Max speed of all changable attributes */ private static final float MAX_SPEED = 20.0f; /** * Creates a FullScreenWindowedTest */ public FullScreenWindowedTest() { } /** * Executes the test */ public void execute() { initialize(); mainLoop(); cleanup(); } private void switchMode() throws LWJGLException { mode = findDisplayMode(800, 600, Display.getDisplayMode().getBitsPerPixel()); Display.setDisplayModeAndFullscreen(mode); } /** * Initializes the test */ private void initialize() { try { //find displaymode switchMode(); // start of in windowed mode Display.create(); glInit(); quadPosition = new Vector2f(100f, 100f); quadVelocity = new Vector2f(1.0f, 1.0f); } catch (Exception e) { e.printStackTrace(); } } /** * Runs the main loop of the "test" */ private void mainLoop() { while (!Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) && !Display.isCloseRequested()) { if (Display.isVisible()) { // check keyboard input processKeyboard(); // do "game" logic, and render it logic(); render(); } else { // no need to render/paint if nothing has changed (ie. window // dragged over) if (Display.isDirty()) { render(); } // don't waste cpu time, sleep more try { Thread.sleep(100); } catch (InterruptedException inte) { } } // Update window Display.update(); } } /** * Performs the logic */ private void logic() { angle += angleRotation; if (angle > 90.0f) { angle = 0.0f; } quadPosition.x += quadVelocity.x; quadPosition.y += quadVelocity.y; //check colision with vertical border border if (quadPosition.x + 50 >= mode.getWidth() || quadPosition.x - 50 <= 0) { quadVelocity.x *= -1; } //check collision with horizontal border if (quadPosition.y + 50 >= mode.getHeight() || quadPosition.y - 50 <= 0) { quadVelocity.y *= -1; } } private void render() { //clear background glClear(GL_COLOR_BUFFER_BIT); // draw white quad glPushMatrix(); { glTranslatef(quadPosition.x, quadPosition.y, 0); glRotatef(angle, 0.0f, 0.0f, 1.0f); glColor3f(1.0f, 1.0f, 1.0f); glBegin(GL_QUADS); { glVertex2i(-50, -50); glVertex2i(50, -50); glVertex2i(50, 50); glVertex2i(-50, 50); } glEnd(); } glPopMatrix(); } /** * Processes keyboard input */ private void processKeyboard() { //check for fullscreen key if (Keyboard.isKeyDown(Keyboard.KEY_F)) { try { switchMode(); } catch (Exception e) { e.printStackTrace(); } } //check for window key if (Keyboard.isKeyDown(Keyboard.KEY_W)) { try { mode = new DisplayMode(640, 480); Display.setDisplayModeAndFullscreen(mode); glInit(); } catch (Exception e) { e.printStackTrace(); } } //check for speed changes if (Keyboard.isKeyDown(Keyboard.KEY_UP)) { quadVelocity.y += 0.1f; } if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) { quadVelocity.y -= 0.1f; } if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) { quadVelocity.x += 0.1f; } if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) { quadVelocity.x -= 0.1f; } if (Keyboard.isKeyDown(Keyboard.KEY_ADD)) { angleRotation += 0.1f; } if (Keyboard.isKeyDown(Keyboard.KEY_SUBTRACT)) { angleRotation -= 0.1f; } //throttle if (quadVelocity.x < -MAX_SPEED) { quadVelocity.x = -MAX_SPEED; } if (quadVelocity.x > MAX_SPEED) { quadVelocity.x = MAX_SPEED; } if (quadVelocity.y < -MAX_SPEED) { quadVelocity.y = -MAX_SPEED; } if (quadVelocity.y > MAX_SPEED) { quadVelocity.y = MAX_SPEED; } if (angleRotation < 0.0f) { angleRotation = 0.0f; } if (angleRotation > MAX_SPEED) { angleRotation = MAX_SPEED; } while ( Mouse.next() ); } /** * Cleans up the test */ private void cleanup() { Display.destroy(); } /** * Retrieves a displaymode, if one such is available * * @param width * Required width * @param height * Required height * @param bpp * Minimum required bits per pixel * @return */ private DisplayMode findDisplayMode(int width, int height, int bpp) throws LWJGLException { DisplayMode[] modes = Display.getAvailableDisplayModes(); for ( DisplayMode mode : modes ) { if ( mode.getWidth() == width && mode.getHeight() == height && mode.getBitsPerPixel() >= bpp && mode.getFrequency() <= 60 ) { return mode; } } return Display.getDesktopDisplayMode(); } /** * Initializes OGL */ private void glInit() { // Go into orthographic projection mode. glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0, mode.getWidth(), 0, mode.getHeight()); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glViewport(0, 0, mode.getWidth(), mode.getHeight()); //set clear color to black glClearColor(0.0f, 0.0f, 0.0f, 0.0f); //sync frame (only works on windows) Display.setVSyncEnabled(true); } /** * Test entry point */ public static void main(String[] args) { System.out.println("Change between fullscreen and windowed mode, by pressing F and W respectively"); System.out.println("Move quad using arrowkeys, and change rotation using +/-"); FullScreenWindowedTest fswTest = new FullScreenWindowedTest(); fswTest.execute(); System.exit(0); } } lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/VBOIndexTest.java0000644000175000017500000001772611543426510022740 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: VBOIndexTest.java 3418 2010-09-28 21:11:35Z spasi $ * * Simple java test program. * * @author elias_naur * @version $Revision: 3418 $ */ package org.lwjgl.test.opengl; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.nio.IntBuffer; import org.lwjgl.Sys; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import org.lwjgl.opengl.GLContext; import static org.lwjgl.opengl.ARBBufferObject.*; import static org.lwjgl.opengl.ARBVertexBufferObject.*; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; public final class VBOIndexTest { static { try { //find first display mode that allows us 640*480*16 int mode = -1; DisplayMode[] modes = Display.getAvailableDisplayModes(); for ( int i = 0; i < modes.length; i++ ) { if ( modes[i].getWidth() == 640 && modes[i].getHeight() == 480 && modes[i].getBitsPerPixel() >= 16 ) { mode = i; break; } } if ( mode != -1 ) { //select above found displaymode System.out.println("Setting display mode to " + modes[mode]); Display.setDisplayMode(modes[mode]); System.out.println("Created display."); } } catch (Exception e) { System.err.println("Failed to create display due to " + e); } } static { try { Display.create(); System.out.println("Created OpenGL."); } catch (Exception e) { System.err.println("Failed to create OpenGL due to " + e); System.exit(1); } } /** * Is the game finished? */ private static boolean finished; /** * A rotating square! */ private static float angle; private static int buffer_id; private static int indices_buffer_id; private static FloatBuffer vertices; private static ByteBuffer mapped_buffer; private static FloatBuffer mapped_float_buffer; private static IntBuffer indices; private static ByteBuffer mapped_indices_buffer; private static IntBuffer mapped_indices_int_buffer; public static void main(String[] arguments) { try { init(); while ( !finished ) { Display.update(); if ( !Display.isVisible() ) Thread.sleep(200); else if ( Display.isCloseRequested() ) System.exit(0); mainLoop(); render(); } } catch (Throwable t) { t.printStackTrace(); } finally { cleanup(); } System.exit(0); } /** * All calculations are done in here */ private static void mainLoop() { angle += 1f; if ( angle > 360.0f ) angle = 0.0f; if ( Mouse.getDX() != 0 || Mouse.getDY() != 0 || Mouse.getDWheel() != 0 ) System.out.println("Mouse moved " + Mouse.getDX() + " " + Mouse.getDY() + " " + Mouse.getDWheel()); for ( int i = 0; i < Mouse.getButtonCount(); i++ ) if ( Mouse.isButtonDown(i) ) System.out.println("Button " + i + " down"); if ( Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) ) finished = true; for ( int i = 0; i < Keyboard.getNumKeyboardEvents(); i++ ) { Keyboard.next(); if ( Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState() ) finished = true; if ( Keyboard.getEventKey() == Keyboard.KEY_T && Keyboard.getEventKeyState() ) System.out.println("Current time: " + Sys.getTime()); } } /** * All rendering is done in here */ private static void render() { glClear(GL_COLOR_BUFFER_BIT); glPushMatrix(); glTranslatef(Display.getDisplayMode().getWidth() / 2, Display.getDisplayMode().getHeight() / 2, 0.0f); glRotatef(angle, 0, 0, 1.0f); ByteBuffer new_mapped_buffer = glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB, mapped_buffer); if ( new_mapped_buffer != mapped_buffer ) mapped_float_buffer = new_mapped_buffer.order(ByteOrder.nativeOrder()).asFloatBuffer(); mapped_buffer = new_mapped_buffer; new_mapped_buffer = glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB, mapped_indices_buffer); if ( new_mapped_buffer != mapped_indices_buffer ) mapped_indices_int_buffer = new_mapped_buffer.order(ByteOrder.nativeOrder()).asIntBuffer(); mapped_indices_buffer = new_mapped_buffer; mapped_float_buffer.rewind(); vertices.rewind(); mapped_float_buffer.put(vertices); mapped_indices_int_buffer.rewind(); indices.rewind(); mapped_indices_int_buffer.put(indices); if ( glUnmapBufferARB(GL_ARRAY_BUFFER_ARB) && glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB) ) { glDrawElements(GL_QUADS, 4, GL_UNSIGNED_INT, 0); } glPopMatrix(); } /** * Initialize */ private static void init() throws Exception { System.out.println("Timer resolution: " + Sys.getTimerResolution()); // Go into orthographic projection mode. glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight()); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight()); if ( !GLContext.getCapabilities().GL_ARB_vertex_buffer_object ) { System.out.println("ARB VBO not supported!"); System.exit(1); } IntBuffer int_buffer = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()).asIntBuffer(); glGenBuffersARB(int_buffer); buffer_id = int_buffer.get(0); indices_buffer_id = int_buffer.get(1); glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffer_id); glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indices_buffer_id); vertices = ByteBuffer.allocateDirect(2 * 4 * 4).order(ByteOrder.nativeOrder()).asFloatBuffer(); vertices.put(-50).put(-50).put(50).put(-50).put(50).put(50).put(-50).put(50); vertices.rewind(); indices = ByteBuffer.allocateDirect(4 * 4).order(ByteOrder.nativeOrder()).asIntBuffer(); indices.put(0).put(1).put(2).put(3); indices.rewind(); glBufferDataARB(GL_ARRAY_BUFFER_ARB, 2 * 4 * 4, GL_STREAM_DRAW_ARB); glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 4 * 4, GL_STREAM_DRAW_ARB); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, 0); } /** * Cleanup */ private static void cleanup() { IntBuffer int_buffer = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()).asIntBuffer(); int_buffer.put(0, buffer_id); int_buffer.put(1, indices_buffer_id); glDeleteBuffersARB(int_buffer); Display.destroy(); } } lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/awt/0000755000175000017500000000000011543426510020375 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/awt/AWTGearsCanvas.java0000644000175000017500000002601611543426510024016 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.opengl.awt; import java.nio.FloatBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.AWTGLCanvas; import org.lwjgl.opengl.GLContext; import org.lwjgl.test.applet.Test; import static org.lwjgl.opengl.ARBTransposeMatrix.*; import static org.lwjgl.opengl.GL11.*; /** *

      * AWT version of the gears demo *

      * @version $Revision$ * @author Brian Matzon * $Id$ */ public class AWTGearsCanvas extends AWTGLCanvas implements Test { private float view_rotx = 20.0f; private float view_roty = 30.0f; private float view_rotz; private int gear1; private int gear2; private int gear3; private float angle; long startTime; long fps; int current_width; int current_height; /** * C'tor */ public AWTGearsCanvas() throws LWJGLException { super(); } public void paintGL() { if(startTime == 0) { setup(); startTime = System.currentTimeMillis() + 5000; } try { angle += 2.0f; if (getWidth() != current_width || getHeight() != current_height) { current_width = getWidth(); current_height = getHeight(); glViewport(0, 0, current_width, current_height); } glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glRotatef(view_rotx, 1.0f, 0.0f, 0.0f); glRotatef(view_roty, 0.0f, 1.0f, 0.0f); glRotatef(view_rotz, 0.0f, 0.0f, 1.0f); glPushMatrix(); glTranslatef(-3.0f, -2.0f, 0.0f); glRotatef(angle, 0.0f, 0.0f, 1.0f); glCallList(gear1); glPopMatrix(); glPushMatrix(); glTranslatef(3.1f, -2.0f, 0.0f); glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f); glCallList(gear2); glPopMatrix(); glPushMatrix(); glTranslatef(-3.1f, 4.2f, 0.0f); glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f); glCallList(gear3); glPopMatrix(); glPopMatrix(); swapBuffers(); repaint(); } catch (LWJGLException e) { throw new RuntimeException(e); } if (startTime > System.currentTimeMillis()) { fps++; } else { long timeUsed = 5000 + (startTime - System.currentTimeMillis()); startTime = System.currentTimeMillis() + 5000; System.out.println(fps + " frames in " + timeUsed / 1000f + " seconds = " + (fps / (timeUsed / 1000f))); fps = 0; } } private void setup() { // setup ogl FloatBuffer pos = BufferUtils.createFloatBuffer(4).put(new float[] { 5.0f, 5.0f, 10.0f, 0.0f}); FloatBuffer red = BufferUtils.createFloatBuffer(4).put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f}); FloatBuffer green = BufferUtils.createFloatBuffer(4).put(new float[] { 0.0f, 0.8f, 0.2f, 1.0f}); FloatBuffer blue = BufferUtils.createFloatBuffer(4).put(new float[] { 0.2f, 0.2f, 1.0f, 1.0f}); pos.flip(); red.flip(); green.flip(); blue.flip(); glLight(GL_LIGHT0, GL_POSITION, pos); glEnable(GL_CULL_FACE); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); /* make the gears */ gear1 = glGenLists(1); glNewList(gear1, GL_COMPILE); glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); gear(1.0f, 4.0f, 1.0f, 20, 0.7f); glEndList(); gear2 = glGenLists(1); glNewList(gear2, GL_COMPILE); glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); gear(0.5f, 2.0f, 2.0f, 10, 0.7f); glEndList(); gear3 = glGenLists(1); glNewList(gear3, GL_COMPILE); glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); gear(1.3f, 2.0f, 0.5f, 10, 0.7f); glEndList(); glEnable(GL_NORMALIZE); glMatrixMode(GL_PROJECTION); System.err.println("GL_VENDOR: " + glGetString(GL_VENDOR)); System.err.println("GL_RENDERER: " + glGetString(GL_RENDERER)); System.err.println("GL_VERSION: " + glGetString(GL_VERSION)); System.err.println(); System.err.println("glLoadTransposeMatrixfARB() supported: " + GLContext.getCapabilities().GL_ARB_transpose_matrix); if (!GLContext.getCapabilities().GL_ARB_transpose_matrix) { // --- not using extensions glLoadIdentity(); } else { // --- using extensions final FloatBuffer identityTranspose = BufferUtils.createFloatBuffer(16).put( new float[] { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}); identityTranspose.flip(); glLoadTransposeMatrixARB(identityTranspose); } float h = (float) 300 / (float) 300; glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0f, 0.0f, -40.0f); } /** * Draw a gear wheel. You'll probably want to call this function when * building a display list since we do a lot of trig here. * * @param inner_radius radius of hole at center * @param outer_radius radius at center of teeth * @param width width of gear * @param teeth number of teeth * @param tooth_depth depth of tooth */ private void gear(float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) { int i; float r0, r1, r2; float angle, da; float u, v, len; r0 = inner_radius; r1 = outer_radius - tooth_depth / 2.0f; r2 = outer_radius + tooth_depth / 2.0f; da = 2.0f * (float) Math.PI / teeth / 4.0f; glShadeModel(GL_FLAT); glNormal3f(0.0f, 0.0f, 1.0f); /* draw front face */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); if (i < teeth) { glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f); } } glEnd(); /* draw front sides of teeth */ glBegin(GL_QUADS); for (i = 0; i < teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + 2.0f * da), r2 * (float) Math.sin(angle + 2.0f * da), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f); } glEnd(); /* draw back face */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); } glEnd(); /* draw back sides of teeth */ glBegin(GL_QUADS); for (i = 0; i < teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); } glEnd(); /* draw outward faces of teeth */ glBegin(GL_QUAD_STRIP); for (i = 0; i < teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); u = r2 * (float) Math.cos(angle + da) - r1 * (float) Math.cos(angle); v = r2 * (float) Math.sin(angle + da) - r1 * (float) Math.sin(angle); len = (float) Math.sqrt(u * u + v * v); u /= len; v /= len; glNormal3f(v, -u, 0.0f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f); glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f); glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f); u = r1 * (float) Math.cos(angle + 3 * da) - r2 * (float) Math.cos(angle + 2 * da); v = r1 * (float) Math.sin(angle + 3 * da) - r2 * (float) Math.sin(angle + 2 * da); glNormal3f(v, -u, 0.0f); glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f); } glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), width * 0.5f); glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), -width * 0.5f); glEnd(); glShadeModel(GL_SMOOTH); /* draw inside radius cylinder */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glNormal3f(-(float) Math.cos(angle), -(float) Math.sin(angle), 0.0f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); } glEnd(); } /* * @see org.lwjgl.test.applet.Test#start() */ public void start() { } /* * @see org.lwjgl.test.applet.Test#stop() */ public void stop() { } }lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/awt/AWTGears.java0000644000175000017500000002404611543426510022663 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.opengl.awt; import java.awt.Frame; import java.awt.Color; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.nio.FloatBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.Sys; import org.lwjgl.opengl.AWTGLCanvas; import org.lwjgl.opengl.GLContext; import static org.lwjgl.opengl.ARBTransposeMatrix.*; import static org.lwjgl.opengl.GL11.*; /** *

      * AWT version of the gears demo *

      * @version $Revision$ * @author Brian Matzon * $Id$ */ public class AWTGears extends Frame { /** AWT GL canvas */ private AWTGLCanvas canvas0; private float view_rotx = 20.0f; private float view_roty = 30.0f; private float view_rotz; private int gear1; private int gear2; private int gear3; private float angle; /** * C'tor */ public AWTGears() throws LWJGLException { setTitle("Gears"); setBackground(Color.BLACK); AWTGearsCanvas canvas = new AWTGearsCanvas(); canvas.setSize(300, 300); add(canvas); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { dispose(); System.exit(0); } }); setResizable(true); pack(); setVisible(true); } private void setup() { // setup ogl FloatBuffer pos = BufferUtils.createFloatBuffer(4).put(new float[] { 5.0f, 5.0f, 10.0f, 0.0f}); FloatBuffer red = BufferUtils.createFloatBuffer(4).put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f}); FloatBuffer green = BufferUtils.createFloatBuffer(4).put(new float[] { 0.0f, 0.8f, 0.2f, 1.0f}); FloatBuffer blue = BufferUtils.createFloatBuffer(4).put(new float[] { 0.2f, 0.2f, 1.0f, 1.0f}); pos.flip(); red.flip(); green.flip(); blue.flip(); glLight(GL_LIGHT0, GL_POSITION, pos); glEnable(GL_CULL_FACE); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); /* make the gears */ gear1 = glGenLists(1); glNewList(gear1, GL_COMPILE); glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); gear(1.0f, 4.0f, 1.0f, 20, 0.7f); glEndList(); gear2 = glGenLists(1); glNewList(gear2, GL_COMPILE); glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); gear(0.5f, 2.0f, 2.0f, 10, 0.7f); glEndList(); gear3 = glGenLists(1); glNewList(gear3, GL_COMPILE); glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); gear(1.3f, 2.0f, 0.5f, 10, 0.7f); glEndList(); glEnable(GL_NORMALIZE); glMatrixMode(GL_PROJECTION); System.err.println("LWJGL: " + Sys.getVersion() + " / " + LWJGLUtil.getPlatformName()); System.err.println("GL_VENDOR: " + glGetString(GL_VENDOR)); System.err.println("GL_RENDERER: " + glGetString(GL_RENDERER)); System.err.println("GL_VERSION: " + glGetString(GL_VERSION)); System.err.println(); System.err.println("glLoadTransposeMatrixfARB() supported: " + GLContext.getCapabilities().GL_ARB_transpose_matrix); if (!GLContext.getCapabilities().GL_ARB_transpose_matrix) { // --- not using extensions glLoadIdentity(); } else { // --- using extensions final FloatBuffer identityTranspose = BufferUtils.createFloatBuffer(16).put( new float[] { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}); identityTranspose.flip(); glLoadTransposeMatrixARB(identityTranspose); } float h = (float) 300 / (float) 300; glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0f, 0.0f, -40.0f); } /** * Draw a gear wheel. You'll probably want to call this function when * building a display list since we do a lot of trig here. * * @param inner_radius radius of hole at center * @param outer_radius radius at center of teeth * @param width width of gear * @param teeth number of teeth * @param tooth_depth depth of tooth */ private void gear(float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) { int i; float r0, r1, r2; float angle, da; float u, v, len; r0 = inner_radius; r1 = outer_radius - tooth_depth / 2.0f; r2 = outer_radius + tooth_depth / 2.0f; da = 2.0f * (float) Math.PI / teeth / 4.0f; glShadeModel(GL_FLAT); glNormal3f(0.0f, 0.0f, 1.0f); /* draw front face */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); if (i < teeth) { glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f); } } glEnd(); /* draw front sides of teeth */ glBegin(GL_QUADS); for (i = 0; i < teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + 2.0f * da), r2 * (float) Math.sin(angle + 2.0f * da), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f); } glEnd(); /* draw back face */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); } glEnd(); /* draw back sides of teeth */ glBegin(GL_QUADS); for (i = 0; i < teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); } glEnd(); /* draw outward faces of teeth */ glBegin(GL_QUAD_STRIP); for (i = 0; i < teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); u = r2 * (float) Math.cos(angle + da) - r1 * (float) Math.cos(angle); v = r2 * (float) Math.sin(angle + da) - r1 * (float) Math.sin(angle); len = (float) Math.sqrt(u * u + v * v); u /= len; v /= len; glNormal3f(v, -u, 0.0f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f); glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f); glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f); u = r1 * (float) Math.cos(angle + 3 * da) - r2 * (float) Math.cos(angle + 2 * da); v = r1 * (float) Math.sin(angle + 3 * da) - r2 * (float) Math.sin(angle + 2 * da); glNormal3f(v, -u, 0.0f); glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f); } glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), width * 0.5f); glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), -width * 0.5f); glEnd(); glShadeModel(GL_SMOOTH); /* draw inside radius cylinder */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glNormal3f(-(float) Math.cos(angle), -(float) Math.sin(angle), 0.0f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); } glEnd(); } public static void main(String[] args) throws LWJGLException { new AWTGears(); } } lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/awt/DisplayParentTest.java0000644000175000017500000001041311543426510024656 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.opengl.awt; import java.awt.Canvas; import java.awt.Frame; import java.awt.GridLayout; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import org.lwjgl.LWJGLException; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.Display; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; /** *

      * Tests Display.setParent() *

      * @version $Revision: 3418 $ * @author $Author: spasi $ * $Id: DisplayParentTest.java 3418 2010-09-28 21:11:35Z spasi $ */ public class DisplayParentTest extends Frame { boolean killswitch; public DisplayParentTest() throws LWJGLException { setTitle("LWJGL Display Parent Test"); setSize(640, 320); setLayout(new GridLayout(1, 2)); final Canvas display_parent = new Canvas(); display_parent.setFocusable(true); display_parent.setIgnoreRepaint(true); add(display_parent); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { killswitch = true; } }); setResizable(true); setVisible(true); Display.setParent(display_parent); Display.setVSyncEnabled(true); Display.create(); float angle = 0f; while (isVisible() && !killswitch) { angle += 1.0f; int width; int height; if (!Display.isFullscreen()) { width = display_parent.getWidth(); height = display_parent.getHeight(); } else { width = Display.getDisplayMode().getWidth(); height = Display.getDisplayMode().getHeight(); } if(width < 1 || height < 1) { continue; } glViewport(0, 0, width, height); glClearColor(0.0f, 1.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0f, (float) width, 0.0f, (float) height); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glTranslatef(width / 2.0f, height / 2.0f, 0.0f); glRotatef(2*angle, 0f, 0f, -1.0f); glRectf(-50.0f, -50.0f, 50.0f, 50.0f); glPopMatrix(); Display.update(); while(Keyboard.next()) { // closing on ESCAPE if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState()) { Display.destroy(); dispose(); break; } if(Keyboard.getEventKey() == Keyboard.KEY_SPACE && Keyboard.getEventKeyState()) { Mouse.setGrabbed(!Mouse.isGrabbed()); } if(Keyboard.getEventKey() == Keyboard.KEY_F && Keyboard.getEventKeyState()) { Display.setFullscreen(!Display.isFullscreen()); } } /* while (Mouse.next()) { System.out.println(" Mouse.getEventX() = " + Mouse.getEventX() + " | Mouse.getEventY() = " + Mouse.getEventY()); }*/ } Display.destroy(); dispose(); } public static void main(String[] args) throws LWJGLException { new DisplayParentTest(); } } lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/awt/AWTTest.java0000644000175000017500000001061111543426510022532 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.opengl.awt; import java.awt.Frame; import java.awt.GridLayout; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.AWTGLCanvas; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; /** *

      * Tests AWTGLCanvas functionality *

      * @version $Revision: 3418 $ * @author $Author: spasi $ * $Id: AWTTest.java 3418 2010-09-28 21:11:35Z spasi $ */ public class AWTTest extends Frame { /** AWT GL canvas */ private AWTGLCanvas canvas0, canvas1; private volatile float angle; /** * C'tor */ public AWTTest() throws LWJGLException { setTitle("LWJGL AWT Canvas Test"); setSize(640, 320); setLayout(new GridLayout(1, 2)); add(canvas0 = new AWTGLCanvas() { int current_height; int current_width; public void paintGL() { try { if (getWidth() != current_width || getHeight() != current_height) { current_width = getWidth(); current_height = getHeight(); glViewport(0, 0, current_width, current_height); } glViewport(0, 0, getWidth(), getHeight()); glClearColor(1.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0f, (float) getWidth(), 0.0f, (float) getHeight()); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glColor3f(1f, 1f, 0f); glTranslatef(getWidth() / 2.0f, getHeight() / 2.0f, 0.0f); glRotatef(angle, 0f, 0f, 1.0f); glRectf(-50.0f, -50.0f, 50.0f, 50.0f); glPopMatrix(); swapBuffers(); repaint(); } catch (LWJGLException e) { throw new RuntimeException(e); } } }); add(canvas1 = new AWTGLCanvas() { int current_height; int current_width; public void paintGL() { try { angle += 1.0f; if (getWidth() != current_width || getHeight() != current_height) { current_width = getWidth(); current_height = getHeight(); glViewport(0, 0, current_width, current_height); } glViewport(0, 0, getWidth(), getHeight()); glClearColor(0.0f, 1.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0f, (float) getWidth(), 0.0f, (float) getHeight()); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glTranslatef(getWidth() / 2.0f, getHeight() / 2.0f, 0.0f); glRotatef(2*angle, 0f, 0f, -1.0f); glRectf(-50.0f, -50.0f, 50.0f, 50.0f); glPopMatrix(); swapBuffers(); repaint(); } catch (LWJGLException e) { throw new RuntimeException(e); } } }); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { dispose(); System.exit(0); } }); setResizable(true); setVisible(true); } public static void main(String[] args) throws LWJGLException { new AWTTest(); } } lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/awt/DemoBox.java0000644000175000017500000004353211543426510022604 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.opengl.awt; import java.awt.BorderLayout; import java.awt.Button; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Label; import java.awt.List; import java.awt.Panel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.nio.FloatBuffer; import java.util.Enumeration; import java.util.Hashtable; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.AWTGLCanvas; import org.lwjgl.opengl.GLContext; import static org.lwjgl.opengl.ARBTransposeMatrix.*; import static org.lwjgl.opengl.GL11.*; /** *

      *

      * @version $Revision$ * @author Brian Matzon * $Id$ */ public class DemoBox extends Frame { /** GL canvas */ private DemoBoxGLCanvas demoCanvas; /** Demo selection panel */ private Panel selectionPanel; /** Hashtable of demos */ private Hashtable selectableDemos; /** * Creates a new demo box instance */ public DemoBox() { selectableDemos = new Hashtable(); selectableDemos.put("default", new NullDemoBox()); selectableDemos.put("clear_color", new ClearColorDemoBox()); selectableDemos.put("gears", new GearsDemoBox()); } /** * @return */ public boolean initialize() { setTitle("LWJGL - Demo Box"); setSize(640, 480); setLayout(new GridBagLayout()); // Setup selection panel // ================================= selectionPanel = new Panel(); selectionPanel.setLayout(new BorderLayout()); selectionPanel.add(new Label("Demo", Label.CENTER), BorderLayout.NORTH); Button fullScreen = new Button("Fullscreen"); fullScreen.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { toggleFullscreen(); } }); selectionPanel.add(fullScreen, BorderLayout.SOUTH); final List demos = new List(); for (Enumeration e = selectableDemos.keys(); e.hasMoreElements();) { demos.add(e.nextElement().toString()); } selectionPanel.add(demos, BorderLayout.CENTER); demos.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent event) { demoSelected(event.getItemSelectable().getSelectedObjects()[0].toString()); } }); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.fill = java.awt.GridBagConstraints.BOTH; gbc.weightx = 0.05; gbc.weighty = 1.0; add(selectionPanel, gbc); // --------------------------------- // setup demo canvas // ================================= try { demoCanvas = new DemoBoxGLCanvas(this); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.fill = java.awt.GridBagConstraints.BOTH; gbc.weightx = 0.95; gbc.weighty = 1.0; add(demoCanvas, gbc); } catch (LWJGLException le) { le.printStackTrace(); return false; } // --------------------------------- addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { demoCanvas.destroyCanvas(); dispose(); System.exit(0); } }); //demos.select(0); //demoSelected(demos.getSelectedItem()); return true; } public void updateFPS(float fps) { if(fps != -1) { setTitle("LWJGL - Demo Box (FPS: " + fps + ")"); } else { setTitle("LWJGL - Demo Box"); } } /** * Enter fullscreen mode for this demo */ protected void toggleFullscreen() { System.out.println("Toggle Fullscreen"); } /** * Selected a demo * @param demo Name of demo that was selected */ protected void demoSelected(String demo) { System.out.println("Selecting demo: " + demo); demoCanvas.setActiveDemo(selectableDemos.get(demo)); } /** * @param args * @throws LWJGLException */ public static void main(String[] args) throws LWJGLException { DemoBox demo = new DemoBox(); demo.initialize(); demo.setVisible(true); } /** * Interface for a demo */ public interface Demo { boolean isInitialized(); boolean initialize(); void render(); void destroy(); } /** * */ private class DemoBoxGLCanvas extends AWTGLCanvas implements Runnable { /** Parent demo box */ DemoBox parent; /** Currently active demo */ Demo activeDemo; /** last active demo */ Demo lastActiveDemo; /** Render thread */ private Thread renderThread; private DemoBoxGLCanvas(DemoBox parent) throws LWJGLException { super(); this.parent = parent; } // FPS long startTime; long fps; protected void paintGL() { synchronized (this) { if (lastActiveDemo != null && lastActiveDemo != activeDemo) { lastActiveDemo.destroy(); lastActiveDemo = null; if (activeDemo != null) { activeDemo.initialize(); startTime = System.currentTimeMillis() + 5000; } else { parent.updateFPS(-1); } } if (activeDemo != null) { if(!activeDemo.isInitialized()) { activeDemo.initialize(); } activeDemo.render(); try { swapBuffers(); } catch (LWJGLException le) { le.printStackTrace(); } if (startTime > System.currentTimeMillis()) { fps++; } else { long timeUsed = 5000 + (startTime - System.currentTimeMillis()); startTime = System.currentTimeMillis() + 5000; parent.updateFPS((fps / (timeUsed / 1000f))); fps = 0; } } } } public void destroyCanvas() { setActiveDemo(null); renderThread = null; } public void setActiveDemo(Demo activeDemo) { synchronized (this) { // setting no current demo if (activeDemo == null) { lastActiveDemo = this.activeDemo; this.activeDemo = null; return; } // setting to new demo lastActiveDemo = this.activeDemo; this.activeDemo = activeDemo; } if (renderThread == null) { renderThread = new Thread(this); renderThread.setName("DemoBox-Renderer"); renderThread.start(); } } private DemoBoxGLCanvas() throws LWJGLException { super(); } public void run() { long sleep_time = 1000; while (renderThread != null) { // check for change of demo synchronized (this) { // if no demo set, just sleep if (activeDemo == null) { sleep_time = 1000; } else { // we have a demo! sleep_time = 16; repaint(); } } sleep(sleep_time); } System.out.println("dead"); } private void sleep(long time) { try { Thread.sleep(time); } catch (InterruptedException inte) { } } } // Demo box demo // ======================================================== public class ClearColorDemoBox implements Demo { private boolean initialized; int direction = 1; float color; public boolean isInitialized() { return initialized; } public boolean initialize() { return initialized = true; } public void render() { glClearColor(color, color, color, 1f); glClear(GL_COLOR_BUFFER_BIT); color += direction * .05f; if (color > 1f) { color = 1f; direction = -1 * direction; } else if (color < 0f) { direction = -1 * direction; color = 0f; } } public void destroy() { initialized = false; } } // -------------------------------------------------------- // Demo box demo // ======================================================== public class NullDemoBox implements Demo { private boolean initialized; public boolean isInitialized() { return initialized; } public boolean initialize() { glClearColor(0, 0, 0, 1f); return true; } public void render() { glClear(GL_COLOR_BUFFER_BIT); } public void destroy() { initialized = false; } } // -------------------------------------------------------- // Demo box demo // ======================================================== public class GearsDemoBox implements Demo { private boolean initialized; private float view_rotx = 20.0f; private float view_roty = 30.0f; private float view_rotz; private int gear1; private int gear2; private int gear3; private float angle; public boolean isInitialized() { return initialized; } public boolean initialize() { // setup ogl FloatBuffer pos = BufferUtils.createFloatBuffer(4).put(new float[] { 5.0f, 5.0f, 10.0f, 0.0f}); FloatBuffer red = BufferUtils.createFloatBuffer(4).put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f}); FloatBuffer green = BufferUtils.createFloatBuffer(4).put(new float[] { 0.0f, 0.8f, 0.2f, 1.0f}); FloatBuffer blue = BufferUtils.createFloatBuffer(4).put(new float[] { 0.2f, 0.2f, 1.0f, 1.0f}); pos.flip(); red.flip(); green.flip(); blue.flip(); glClearColor(0, 0, 0, 1f); glLight(GL_LIGHT0, GL_POSITION, pos); glEnable(GL_CULL_FACE); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); /* make the gears */ gear1 = glGenLists(1); glNewList(gear1, GL_COMPILE); glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); gear(1.0f, 4.0f, 1.0f, 20, 0.7f); glEndList(); gear2 = glGenLists(1); glNewList(gear2, GL_COMPILE); glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); gear(0.5f, 2.0f, 2.0f, 10, 0.7f); glEndList(); gear3 = glGenLists(1); glNewList(gear3, GL_COMPILE); glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); gear(1.3f, 2.0f, 0.5f, 10, 0.7f); glEndList(); glEnable(GL_NORMALIZE); glMatrixMode(GL_PROJECTION); System.err.println("GL_VENDOR: " + glGetString(GL_VENDOR)); System.err.println("GL_RENDERER: " + glGetString(GL_RENDERER)); System.err.println("GL_VERSION: " + glGetString(GL_VERSION)); System.err.println(); System.err.println("glLoadTransposeMatrixfARB() supported: " + GLContext.getCapabilities().GL_ARB_transpose_matrix); if (!GLContext.getCapabilities().GL_ARB_transpose_matrix) { // --- not using extensions glLoadIdentity(); } else { // --- using extensions final FloatBuffer identityTranspose = BufferUtils.createFloatBuffer(16).put( new float[] { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}); identityTranspose.flip(); glLoadTransposeMatrixARB(identityTranspose); } float h = (float) 300 / (float) 300; glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0f, 0.0f, -40.0f); return initialized = true; } public void render() { angle += 2.0f; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glRotatef(view_rotx, 1.0f, 0.0f, 0.0f); glRotatef(view_roty, 0.0f, 1.0f, 0.0f); glRotatef(view_rotz, 0.0f, 0.0f, 1.0f); glPushMatrix(); glTranslatef(-3.0f, -2.0f, 0.0f); glRotatef(angle, 0.0f, 0.0f, 1.0f); glCallList(gear1); glPopMatrix(); glPushMatrix(); glTranslatef(3.1f, -2.0f, 0.0f); glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f); glCallList(gear2); glPopMatrix(); glPushMatrix(); glTranslatef(-3.1f, 4.2f, 0.0f); glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f); glCallList(gear3); glPopMatrix(); glPopMatrix(); } /** * Draw a gear wheel. You'll probably want to call this function when * building a display list since we do a lot of trig here. * * @param inner_radius radius of hole at center * @param outer_radius radius at center of teeth * @param width width of gear * @param teeth number of teeth * @param tooth_depth depth of tooth */ private void gear(float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) { int i; float r0, r1, r2; float angle, da; float u, v, len; r0 = inner_radius; r1 = outer_radius - tooth_depth / 2.0f; r2 = outer_radius + tooth_depth / 2.0f; da = 2.0f * (float) Math.PI / teeth / 4.0f; glShadeModel(GL_FLAT); glNormal3f(0.0f, 0.0f, 1.0f); /* draw front face */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); if (i < teeth) { glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f); } } glEnd(); /* draw front sides of teeth */ glBegin(GL_QUADS); for (i = 0; i < teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + 2.0f * da), r2 * (float) Math.sin(angle + 2.0f * da), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f); } glEnd(); /* draw back face */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); } glEnd(); /* draw back sides of teeth */ glBegin(GL_QUADS); for (i = 0; i < teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); } glEnd(); /* draw outward faces of teeth */ glBegin(GL_QUAD_STRIP); for (i = 0; i < teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); u = r2 * (float) Math.cos(angle + da) - r1 * (float) Math.cos(angle); v = r2 * (float) Math.sin(angle + da) - r1 * (float) Math.sin(angle); len = (float) Math.sqrt(u * u + v * v); u /= len; v /= len; glNormal3f(v, -u, 0.0f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f); glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f); glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f); u = r1 * (float) Math.cos(angle + 3 * da) - r2 * (float) Math.cos(angle + 2 * da); v = r1 * (float) Math.sin(angle + 3 * da) - r2 * (float) Math.sin(angle + 2 * da); glNormal3f(v, -u, 0.0f); glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f); } glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), width * 0.5f); glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), -width * 0.5f); glEnd(); glShadeModel(GL_SMOOTH); /* draw inside radius cylinder */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glNormal3f(-(float) Math.cos(angle), -(float) Math.sin(angle), 0.0f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); } glEnd(); } public void destroy() { glDeleteLists(gear1, 1); glDeleteLists(gear2, 1); glDeleteLists(gear3, 1); initialized = false; } } // -------------------------------------------------------- } lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/SyncTest.java0000644000175000017500000001352211543426510022224 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.opengl; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import org.lwjgl.opengl.*; import java.util.Random; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL32.*; /** @author spasi */ public final class SyncTest { private SyncTest() { } public static void main(String[] args) { runTest(args); cleanup(); System.exit(0); } private static void runTest(String[] args) { if ( args.length < 2 ) argsError("Insufficient number of arguments."); int clears = 1; int timeout = 0; try { clears = Integer.parseInt(args[0]); timeout = Integer.parseInt(args[1]); } catch (NumberFormatException e) { argsError("Invalid number format."); } ContextAttribs ca = new ContextAttribs(); try { DisplayMode[] modes = Display.getAvailableDisplayModes(); DisplayMode displayMode = chooseMode(modes, 1024, 768); if ( displayMode == null ) displayMode = chooseMode(modes, 800, 600); if ( displayMode == null ) displayMode = chooseMode(modes, 640, 480); if ( displayMode == null ) kill("Failed to set an appropriate display mode."); System.out.println("Setting display mode to: " + displayMode); Display.setDisplayMode(displayMode); Display.create(new PixelFormat(8, 24, 0), ca); } catch (LWJGLException e) { kill(e.getMessage()); } System.out.println("\n---------\n"); final String version = glGetString(GL_VERSION); System.out.println("GL Version: " + version); System.out.println("ARB_sync: " + GLContext.getCapabilities().GL_ARB_sync); if ( !GLContext.getCapabilities().OpenGL32 && !GLContext.getCapabilities().GL_ARB_sync ) kill("OpenGL3.2 or ARB_sync support is required for this test."); System.out.println("\n---------\n"); System.out.println("Clearing the framebuffer a gazillion times..."); Random rand = new Random(System.currentTimeMillis()); for ( int i = 0; i < clears; i++ ) { glClearColor(rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), 1.0f); glClear(GL_COLOR_BUFFER_BIT); } GLSync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); System.out.println("\nWaiting on fence..."); long time = Sys.getTime(); int status = glClientWaitSync(sync, 0, timeout < 0 ? GL_TIMEOUT_IGNORED : timeout * 1000 * 1000); System.out.println("\nFence sync complete after: " + ((Sys.getTime() - time) / (double)Sys.getTimerResolution()) + " seconds."); System.out.print("\nWait Status: "); switch ( status ) { case GL_ALREADY_SIGNALED: System.out.println("ALREADY_SIGNALED"); break; case GL_CONDITION_SATISFIED: System.out.println("CONDITION_SATISFIED"); break; case GL_TIMEOUT_EXPIRED: System.out.println("TIMEOUT_EXPIRED"); break; case GL_WAIT_FAILED: System.out.println("WAIT_FAILED"); break; default: System.out.println("Unexpected wait status: 0x" + Integer.toHexString(status)); } System.out.println("Sync Status: " + (glGetSync(sync, GL_SYNC_STATUS) == GL_UNSIGNALED ? "UNSIGNALED" : "SIGNALED")); glDeleteSync(sync); int error = glGetError(); if ( error != 0 ) System.out.println("\nTest failed with OpenGL error: " + error); else System.out.println("\nTest completed successfully."); } private static DisplayMode chooseMode(DisplayMode[] modes, int width, int height) { DisplayMode bestMode = null; for ( DisplayMode mode : modes ) { if ( mode.getWidth() == width && mode.getHeight() == height && mode.getFrequency() <= 85 ) { if ( bestMode == null || (mode.getBitsPerPixel() >= bestMode.getBitsPerPixel() && mode.getFrequency() > bestMode.getFrequency()) ) bestMode = mode; } } return bestMode; } private static void cleanup() { if ( Display.isCreated() ) Display.destroy(); } private static void argsError(final String msg) { System.out.println("\nInvalid arguments error: " + msg); System.out.println("\nUsage: SyncTest :\n"); System.out.println("clears\t- Number of times to clear the framebuffer."); System.out.println("timeout\t- WaitSync timeout in milliseconds."); cleanup(); System.exit(-1); } static void kill(String reason) { System.out.println("The SyncTest program was terminated because an error occured.\n"); System.out.println("Reason: " + (reason == null ? "Unknown" : reason)); cleanup(); System.exit(-1); } }lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/pbuffers/0000755000175000017500000000000011543426510021416 5ustar zero79zero79lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRenderer.java0000644000175000017500000000504111543426510025216 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.opengl.pbuffers; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.Pbuffer; import org.lwjgl.opengl.PixelFormat; import static org.lwjgl.opengl.GL11.*; final class UniqueRenderer extends TextureRenderer { UniqueRenderer(final int width, final int height, final int texID) { super(width, height, texID); } protected Pbuffer init(final int width, final int height, final int texID) { Pbuffer pbuffer = null; try { pbuffer = new Pbuffer(width, height, new PixelFormat(16, 0, 0, 0, 0), null, null); // Initialise state of the pbuffer context. pbuffer.makeCurrent(); PbufferTest.initGLState(width, height, 0.5f); glBindTexture(GL_TEXTURE_2D, texID); Display.makeCurrent(); } catch (LWJGLException e) { e.printStackTrace(); System.exit(-1); } return pbuffer; } public void updateTexture() { // Copy the pbuffer contents to the texture. glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, width, height, 0); } } lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java0000644000175000017500000002574511543426510024527 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.opengl.pbuffers; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import org.lwjgl.opengl.Pbuffer; import org.lwjgl.opengl.PixelFormat; import org.lwjgl.util.vector.Vector2f; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; /** *

      * Tests Pbuffers * * @author elias_naur * @version $Revision: 3418 $ * $Id: PbufferTest.java 3418 2010-09-28 21:11:35Z spasi $ */ public final class PbufferTest { /** * Texture and pbuffer size */ private static final int TEXTURE_SIZE = 512; /** * Size of the animated quad */ private static final int QUAD_SIZE = 64; /** * The renderer to use when rendering to texture. */ private TextureRenderer texRenderer; /** * Intended deiplay mode */ private DisplayMode mode; /** * our quad moving around */ private Vector2f quadPosition; /** * For positioning our quad in the texture */ private float texScaleX, texScaleY; /** * our quadVelocity */ private Vector2f quadVelocity; /** * angle of quad */ private float angle; /** * degrees to rotate per frame */ private float angleRotation = 1.0f; /** * Max speed of all changable attributes */ private static final float MAX_SPEED = 20.0f; /** * The shared texture */ private static int texID; public PbufferTest(final int renderMode) { try { //find displaymode mode = findDisplayMode(800, 600, 16); Display.setDisplayMode(mode); Display.create(new PixelFormat(16, 0, 0, 0, 0)); glInit(); if ( (Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) == 0 ) { System.out.println("No Pbuffer support!"); System.exit(-1); } System.out.println("Pbuffer support detected. Initializing...\n"); switch ( renderMode ) { case 1: System.out.print("Creating pbuffer with unique context..."); texRenderer = new UniqueRenderer(TEXTURE_SIZE, TEXTURE_SIZE, texID); break; case 2: System.out.print("Creating render-to-texture pbuffer with unique context..."); texRenderer = new UniqueRendererRTT(TEXTURE_SIZE, TEXTURE_SIZE, texID); break; } System.out.println("OK"); quadPosition = new Vector2f(100f, 100f); quadVelocity = new Vector2f(1.0f, 1.0f); texScaleX = TEXTURE_SIZE / (float)mode.getWidth(); texScaleY = TEXTURE_SIZE / (float)mode.getHeight(); } catch (Exception e) { e.printStackTrace(); } } /** * Executes the test */ public void execute() { mainLoop(); cleanup(); } /** * Runs the main loop of the "test" */ private void mainLoop() { while ( !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) && !Display.isCloseRequested() ) { if ( Display.isVisible() ) { // check keyboard input processKeyboard(); // do "game" logic, and render it logic(); render(); } else { // no need to render/paint if nothing has changed (ie. window dragged over) if ( Display.isDirty() ) render(); // don't waste cpu time, sleep more try { Thread.sleep(100); } catch (InterruptedException inte) { } } // Update window Display.update(); // Sync Display.sync(100); } } /** * Performs the logic */ private void logic() { angle += angleRotation; if ( angle > 360.0f ) angle -= 360.0f; quadPosition.x += quadVelocity.x; quadPosition.y += quadVelocity.y; // check colision with vertical border border if ( quadPosition.x + QUAD_SIZE >= mode.getWidth() || quadPosition.x - QUAD_SIZE <= 0 ) quadVelocity.x *= -1; // check collision with horizontal border if ( quadPosition.y + QUAD_SIZE >= mode.getHeight() || quadPosition.y - QUAD_SIZE <= 0 ) quadVelocity.y *= -1; } private void render() { // ----------------------------------------------------------- // -------------------- Pbuffer rendering -------------------- // ----------------------------------------------------------- // Tell the pbuffer to get ready for rendering texRenderer.enable(); // Clear the background glClear(GL_COLOR_BUFFER_BIT); // Draw quad with gradient glPushMatrix(); { glTranslatef(quadPosition.x * texScaleX, quadPosition.y * texScaleY, 0); glRotatef(angle, 0.0f, 0.0f, 1.0f); glBegin(GL_QUADS); { glColor3f(1.0f, 0.0f, 0.0f); glVertex2i(-QUAD_SIZE, -QUAD_SIZE); glVertex2i(QUAD_SIZE, -QUAD_SIZE); glColor3f(0.0f, 0.0f, 1.0f); glVertex2i(QUAD_SIZE, QUAD_SIZE); glVertex2i(-QUAD_SIZE, QUAD_SIZE); } glEnd(); } glPopMatrix(); // Refresh the texture texRenderer.updateTexture(); // ----------------------------------------------------------- // -------------------- Display rendering -------------------- // ----------------------------------------------------------- try { Display.makeCurrent(); } catch (LWJGLException e) { throw new RuntimeException(e); } glClear(GL_COLOR_BUFFER_BIT); // draw white quad glPushMatrix(); { glTranslatef(quadPosition.x, quadPosition.y, 0); glRotatef(angle, 0.0f, 0.0f, 1.0f); glColor3f(1.0f, 1.0f, 1.0f); glBegin(GL_QUADS); { glTexCoord2f(0f, 0f); glVertex2i(-QUAD_SIZE, -QUAD_SIZE); glTexCoord2f(1f, 0f); glVertex2i(QUAD_SIZE, -QUAD_SIZE); glTexCoord2f(1f, 1f); glVertex2i(QUAD_SIZE, QUAD_SIZE); glTexCoord2f(0f, 1f); glVertex2i(-QUAD_SIZE, QUAD_SIZE); } glEnd(); } glPopMatrix(); } /** * Processes keyboard input */ private void processKeyboard() { Keyboard.poll(); //check for fullscreen key if ( Keyboard.isKeyDown(Keyboard.KEY_F) ) { try { Display.setDisplayMode(mode); Display.setFullscreen(true); } catch (Exception e) { e.printStackTrace(); } } //check for window key if ( Keyboard.isKeyDown(Keyboard.KEY_W) ) { try { Display.setFullscreen(false); } catch (Exception e) { e.printStackTrace(); } } //check for speed changes if ( Keyboard.isKeyDown(Keyboard.KEY_UP) ) quadVelocity.y += 0.1f; if ( Keyboard.isKeyDown(Keyboard.KEY_DOWN) ) quadVelocity.y -= 0.1f; if ( Keyboard.isKeyDown(Keyboard.KEY_RIGHT) ) quadVelocity.x += 0.1f; if ( Keyboard.isKeyDown(Keyboard.KEY_LEFT) ) quadVelocity.x -= 0.1f; if ( Keyboard.isKeyDown(Keyboard.KEY_ADD) ) angleRotation += 0.1f; if ( Keyboard.isKeyDown(Keyboard.KEY_SUBTRACT) ) angleRotation -= 0.1f; //throttle if ( quadVelocity.x < -MAX_SPEED ) quadVelocity.x = -MAX_SPEED; if ( quadVelocity.x > MAX_SPEED ) quadVelocity.x = MAX_SPEED; if ( quadVelocity.y < -MAX_SPEED ) quadVelocity.y = -MAX_SPEED; if ( quadVelocity.y > MAX_SPEED ) quadVelocity.y = MAX_SPEED; if ( angleRotation < 0.0f ) angleRotation = 0.0f; if ( angleRotation > MAX_SPEED ) angleRotation = MAX_SPEED; } /** * Cleans up the test */ private void cleanup() { // Destroy texture IntBuffer buffer = BufferUtils.createIntBuffer(1); buffer.put(0, texID); glDeleteTextures(buffer); texRenderer.destroy(); Display.destroy(); } /** * Retrieves a displaymode, if one such is available * * @param width Required width * @param height Required height * @param bpp Minimum required bits per pixel * * @return */ private DisplayMode findDisplayMode(int width, int height, int bpp) throws LWJGLException { DisplayMode[] modes = Display.getAvailableDisplayModes(); for ( DisplayMode mode : modes ) { if ( mode.getWidth() == width && mode.getHeight() == height && mode.getBitsPerPixel() >= bpp ) return mode; } return null; } static void initGLState(int width, int height, float color) { glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0, width, 0, height); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glViewport(0, 0, width, height); //set clear color glClearColor(color, color, color, 0.0f); } /** * Initializes OGL */ private void glInit() { // Sync frame (only works on windows) Display.setVSyncEnabled(true); // Create shared texture IntBuffer buffer = BufferUtils.createIntBuffer(1); glGenTextures(buffer); texID = buffer.get(0); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texID); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); initGLState(mode.getWidth(), mode.getHeight(), 0.0f); } /** * Test entry point */ public static void main(String[] args) { if ( args.length != 1 ) kill("Invalid arguments length."); int mode = -1; try { mode = Integer.parseInt(args[0]); } catch (NumberFormatException e) { kill("Invalid mode."); } if ( mode != 1 && mode != 2 ) kill("Invalid mode."); System.out.println("Change between fullscreen and windowed mode, by pressing F and W respectively"); System.out.println("Move quad using arrowkeys, and change rotation using +/-"); PbufferTest test = new PbufferTest(mode); test.execute(); System.exit(0); } private static void kill(final String msg) { System.out.println(msg); System.out.println("-------"); System.out.println("Usage: java org.lwjgl.test.opengl.pbuffer.PbufferTest "); System.out.println("\n."); System.out.println("\t1: no render-to-texture"); System.out.println("\t2: with render-to-texture"); System.exit(-1); } } lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/pbuffers/TextureRenderer.java0000644000175000017500000000603011543426510025407 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.opengl.pbuffers; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.Pbuffer; /** * Implementations of this class should create a pbuffer and implement "render-to-texture" accordingly. */ abstract class TextureRenderer { protected final int width; protected final int height; private final int texID; protected Pbuffer pbuffer; protected TextureRenderer(final int width, final int height, final int texID) { this.width = width; this.height = height; this.texID = texID; try { pbuffer = init(width, height, texID); } catch (LWJGLException e) { e.printStackTrace(); System.exit(-1); } } /** * Create and initialize the pbuffer. * * @param width * @param height * @param texID * @return * @throws LWJGLException */ protected abstract Pbuffer init(int width, int height, int texID) throws LWJGLException; /** * This will be called before rendering to the renderer. Implementations should setup the pbuffer context as necessary. */ void enable() { try { if ( pbuffer.isBufferLost() ) { System.out.println("Buffer contents lost - recreating the pbuffer"); pbuffer.destroy(); pbuffer = init(width, height, texID); } pbuffer.makeCurrent(); } catch (LWJGLException e) { throw new RuntimeException(e); } } /** * Implementations should update the texture contents here. */ abstract void updateTexture(); /** * Clean-up resources held by the renderer */ final void destroy() { pbuffer.destroy(); } }lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRendererRTT.java0000644000175000017500000000550411543426510025614 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.opengl.pbuffers; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.Pbuffer; import org.lwjgl.opengl.PixelFormat; import org.lwjgl.opengl.RenderTexture; import static org.lwjgl.opengl.GL11.*; final class UniqueRendererRTT extends TextureRenderer { UniqueRendererRTT(final int width, final int height, final int texID) { super(width, height, texID); } // Initialize texture renderer protected Pbuffer init(final int width, final int height, final int texID) { Pbuffer pbuffer = null; try { final RenderTexture rt = new RenderTexture(true, false, false, false, RenderTexture.RENDER_TEXTURE_2D, 0); pbuffer = new Pbuffer(width, height, new PixelFormat(16, 0, 0, 0, 0), rt, null); // Initialise state of the pbuffer context. pbuffer.makeCurrent(); PbufferTest.initGLState(width, height, 0.5f); glBindTexture(GL_TEXTURE_2D, texID); Display.makeCurrent(); } catch (LWJGLException e) { e.printStackTrace(); System.exit(-1); } return pbuffer; } void enable() { super.enable(); // Put the renderer contents to the texture pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER); } void updateTexture() { // Bind the texture after rendering. pbuffer.bindTexImage(Pbuffer.FRONT_LEFT_BUFFER); } } lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/Gears.java0000644000175000017500000002656611543426510021525 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * 3-D gear wheels. Originally by Brian Paul */ package org.lwjgl.test.opengl; import java.nio.FloatBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.Sys; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import org.lwjgl.opengl.GLContext; import static org.lwjgl.opengl.ARBTransposeMatrix.*; import static org.lwjgl.opengl.GL11.*; /** *

      * This is the OpenGL "standard" Gears demo, originally by Brian Paul *

      * @author Brian Matzon * @version $Revision: 3418 $ * $Id: Gears.java 3418 2010-09-28 21:11:35Z spasi $ */ public class Gears { private float view_rotx = 20.0f; private float view_roty = 30.0f; private float view_rotz; private int gear1; private int gear2; private int gear3; private float angle; public static void main(String[] args) { new Gears().execute(); System.exit(0); } /** * */ private void execute() { try { init(); } catch (LWJGLException le) { le.printStackTrace(); System.out.println("Failed to initialize Gears."); return; } loop(); destroy(); } /** * */ private void destroy() { Display.destroy(); } /** * */ private void loop() { long startTime = System.currentTimeMillis() + 5000; long fps = 0; while (!Display.isCloseRequested()) { angle += 2.0f; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glRotatef(view_rotx, 1.0f, 0.0f, 0.0f); glRotatef(view_roty, 0.0f, 1.0f, 0.0f); glRotatef(view_rotz, 0.0f, 0.0f, 1.0f); glPushMatrix(); glTranslatef(-3.0f, -2.0f, 0.0f); glRotatef(angle, 0.0f, 0.0f, 1.0f); glCallList(gear1); glPopMatrix(); glPushMatrix(); glTranslatef(3.1f, -2.0f, 0.0f); glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f); glCallList(gear2); glPopMatrix(); glPushMatrix(); glTranslatef(-3.1f, 4.2f, 0.0f); glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f); glCallList(gear3); glPopMatrix(); glPopMatrix(); Display.update(); if (startTime > System.currentTimeMillis()) { fps++; } else { long timeUsed = 5000 + (startTime - System.currentTimeMillis()); startTime = System.currentTimeMillis() + 5000; System.out.println(fps + " frames in " + timeUsed / 1000f + " seconds = " + (fps / (timeUsed / 1000f))); fps = 0; } } } /** * */ private void init() throws LWJGLException { // create Window of size 300x300 Display.setLocation((Display.getDisplayMode().getWidth() - 300) / 2, (Display.getDisplayMode().getHeight() - 300) / 2); Display.setDisplayMode(new DisplayMode(300, 300)); Display.setTitle("Gears"); Display.create(); // setup ogl FloatBuffer pos = BufferUtils.createFloatBuffer(4).put(new float[] { 5.0f, 5.0f, 10.0f, 0.0f}); FloatBuffer red = BufferUtils.createFloatBuffer(4).put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f}); FloatBuffer green = BufferUtils.createFloatBuffer(4).put(new float[] { 0.0f, 0.8f, 0.2f, 1.0f}); FloatBuffer blue = BufferUtils.createFloatBuffer(4).put(new float[] { 0.2f, 0.2f, 1.0f, 1.0f}); pos.flip(); red.flip(); green.flip(); blue.flip(); glLight(GL_LIGHT0, GL_POSITION, pos); glEnable(GL_CULL_FACE); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); /* make the gears */ gear1 = glGenLists(1); glNewList(gear1, GL_COMPILE); glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); gear(1.0f, 4.0f, 1.0f, 20, 0.7f); glEndList(); gear2 = glGenLists(1); glNewList(gear2, GL_COMPILE); glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); gear(0.5f, 2.0f, 2.0f, 10, 0.7f); glEndList(); gear3 = glGenLists(1); glNewList(gear3, GL_COMPILE); glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); gear(1.3f, 2.0f, 0.5f, 10, 0.7f); glEndList(); glEnable(GL_NORMALIZE); glMatrixMode(GL_PROJECTION); System.err.println("LWJGL: " + Sys.getVersion() + " / " + LWJGLUtil.getPlatformName()); System.err.println("GL_VENDOR: " + glGetString(GL_VENDOR)); System.err.println("GL_RENDERER: " + glGetString(GL_RENDERER)); System.err.println("GL_VERSION: " + glGetString(GL_VERSION)); System.err.println(); System.err.println("glLoadTransposeMatrixfARB() supported: " + GLContext.getCapabilities().GL_ARB_transpose_matrix); if (!GLContext.getCapabilities().GL_ARB_transpose_matrix) { // --- not using extensions glLoadIdentity(); } else { // --- using extensions final FloatBuffer identityTranspose = BufferUtils.createFloatBuffer(16).put( new float[] { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}); identityTranspose.flip(); glLoadTransposeMatrixARB(identityTranspose); } float h = (float) 300 / (float) 300; glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0f, 0.0f, -40.0f); } /** * Draw a gear wheel. You'll probably want to call this function when * building a display list since we do a lot of trig here. * * @param inner_radius radius of hole at center * @param outer_radius radius at center of teeth * @param width width of gear * @param teeth number of teeth * @param tooth_depth depth of tooth */ private void gear(float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) { int i; float r0, r1, r2; float angle, da; float u, v, len; r0 = inner_radius; r1 = outer_radius - tooth_depth / 2.0f; r2 = outer_radius + tooth_depth / 2.0f; da = 2.0f * (float) Math.PI / teeth / 4.0f; glShadeModel(GL_FLAT); glNormal3f(0.0f, 0.0f, 1.0f); /* draw front face */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); if (i < teeth) { glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f); } } glEnd(); /* draw front sides of teeth */ glBegin(GL_QUADS); for (i = 0; i < teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + 2.0f * da), r2 * (float) Math.sin(angle + 2.0f * da), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f); } glEnd(); /* draw back face */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); } glEnd(); /* draw back sides of teeth */ glBegin(GL_QUADS); for (i = 0; i < teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); } glEnd(); /* draw outward faces of teeth */ glBegin(GL_QUAD_STRIP); for (i = 0; i < teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); u = r2 * (float) Math.cos(angle + da) - r1 * (float) Math.cos(angle); v = r2 * (float) Math.sin(angle + da) - r1 * (float) Math.sin(angle); len = (float) Math.sqrt(u * u + v * v); u /= len; v /= len; glNormal3f(v, -u, 0.0f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f); glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f); glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), width * 0.5f); glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f); u = r1 * (float) Math.cos(angle + 3 * da) - r2 * (float) Math.cos(angle + 2 * da); v = r1 * (float) Math.sin(angle + 3 * da) - r2 * (float) Math.sin(angle + 2 * da); glNormal3f(v, -u, 0.0f); glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), width * 0.5f); glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f); } glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), width * 0.5f); glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), -width * 0.5f); glEnd(); glShadeModel(GL_SMOOTH); /* draw inside radius cylinder */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; glNormal3f(-(float) Math.cos(angle), -(float) Math.sin(angle), 0.0f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); } glEnd(); } } lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/PbufferTest.java0000644000175000017500000002472311543426510022706 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.opengl; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; import org.lwjgl.LWJGLException; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import org.lwjgl.opengl.Pbuffer; import org.lwjgl.opengl.PixelFormat; import org.lwjgl.util.vector.Vector2f; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.util.glu.GLU.*; /** * * Tests Pbuffers * * @author elias_naur * @version $Revision: 3418 $ * $Id: PbufferTest.java 3418 2010-09-28 21:11:35Z spasi $ */ public class PbufferTest { /** Intended deiplay mode */ private DisplayMode mode; /** our quad moving around */ private Vector2f quadPosition; /** our quadVelocity */ private Vector2f quadVelocity; /** angle of quad */ private float angle; /** degrees to rotate per frame */ private float angleRotation = 1.0f; /** Max speed of all changable attributes */ private static final float MAX_SPEED = 20.0f; /** Pbuffer instance */ private static Pbuffer pbuffer; /** The shared texture */ private static int tex_handle; /** * Executes the test */ public void execute() { initialize(); mainLoop(); cleanup(); } /** * Initializes the test */ private void initialize() { try { //find displaymode pbuffer = new Pbuffer(512, 512, new PixelFormat(), null, null); mode = findDisplayMode(800, 600, 16); Display.setDisplayMode(mode); // start of in windowed mode Display.create(); // gl = new GLWindow("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); if ((Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) == 0) { System.out.println("No Pbuffer support!"); System.exit(1); } System.out.println("Pbuffer support detected"); glInit(); initPbuffer(); Keyboard.create(); quadPosition = new Vector2f(100f, 100f); quadVelocity = new Vector2f(1.0f, 1.0f); } catch (Exception e) { e.printStackTrace(); } } /** * Runs the main loop of the "test" */ private void mainLoop() { while (!Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) && !Display.isCloseRequested()) { if (Display.isVisible()) { // check keyboard input processKeyboard(); // do "game" logic, and render it logic(); render(); } else { // no need to render/paint if nothing has changed (ie. window // dragged over) if (Display.isDirty()) { render(); } // don't waste cpu time, sleep more try { Thread.sleep(100); } catch (InterruptedException inte) { } } // Update window Display.update(); } } /** * Performs the logic */ private void logic() { angle += angleRotation; if (angle > 90.0f) { angle = 0.0f; } quadPosition.x += quadVelocity.x; quadPosition.y += quadVelocity.y; //check colision with vertical border border if (quadPosition.x + 50 >= mode.getWidth() || quadPosition.x - 50 <= 0) { quadVelocity.x *= -1; } //check collision with horizontal border if (quadPosition.y + 50 >= mode.getHeight() || quadPosition.y - 50 <= 0) { quadVelocity.y *= -1; } } private void render() { if (pbuffer.isBufferLost()) { System.out.println("Buffer contents lost - will recreate the buffer"); pbuffer.destroy(); try { pbuffer = new Pbuffer(512, 512, new PixelFormat(), null, null); initPbuffer(); } catch (LWJGLException e) { e.printStackTrace(); } } try { pbuffer.makeCurrent(); } catch (LWJGLException e) { throw new RuntimeException(e); } // Pbuffer rendering //clear background glClear(GL_COLOR_BUFFER_BIT); // draw white quad glPushMatrix(); { glTranslatef(quadPosition.x, quadPosition.y, 0); glRotatef(angle, 0.0f, 0.0f, 1.0f); glColor3f(1.0f, 1.0f, 1.0f); glBegin(GL_QUADS); { glVertex2i(-50, -50); glVertex2i(50, -50); glVertex2i(50, 50); glVertex2i(-50, 50); } glEnd(); } glPopMatrix(); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 512, 512, 0); try { Display.makeCurrent(); } catch (LWJGLException e) { throw new RuntimeException(e); } // OpenGL window rendering glClear(GL_COLOR_BUFFER_BIT); // draw white quad glPushMatrix(); { glTranslatef(quadPosition.x, quadPosition.y, 0); glRotatef(angle, 0.0f, 0.0f, 1.0f); glColor3f(1.0f, 1.0f, 0.0f); glBegin(GL_QUADS); { glTexCoord2f(0f, 0f); glVertex2i(-50, -50); glTexCoord2f(1f, 0f); glVertex2i(50, -50); glTexCoord2f(1f, 1f); glVertex2i(50, 50); glTexCoord2f(0f, 1f); glVertex2i(-50, 50); } glEnd(); } glPopMatrix(); } private void initPbuffer() { try { pbuffer.makeCurrent(); initGLState(256, 256, 0.5f); glBindTexture(GL_TEXTURE_2D, tex_handle); Display.makeCurrent(); } catch (Exception e) { e.printStackTrace(); } } /** * Processes keyboard input */ private void processKeyboard() { Keyboard.poll(); //check for fullscreen key if (Keyboard.isKeyDown(Keyboard.KEY_F)) { try { Display.setDisplayMode(mode); Display.setFullscreen(true); } catch (Exception e) { e.printStackTrace(); } } //check for window key if (Keyboard.isKeyDown(Keyboard.KEY_W)) { try { Display.setFullscreen(false); } catch (Exception e) { e.printStackTrace(); } } //check for speed changes if (Keyboard.isKeyDown(Keyboard.KEY_UP)) { quadVelocity.y += 0.1f; } if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) { quadVelocity.y -= 0.1f; } if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) { quadVelocity.x += 0.1f; } if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) { quadVelocity.x -= 0.1f; } if (Keyboard.isKeyDown(Keyboard.KEY_ADD)) { angleRotation += 0.1f; } if (Keyboard.isKeyDown(Keyboard.KEY_SUBTRACT)) { angleRotation -= 0.1f; } //throttle if (quadVelocity.x < -MAX_SPEED) { quadVelocity.x = -MAX_SPEED; } if (quadVelocity.x > MAX_SPEED) { quadVelocity.x = MAX_SPEED; } if (quadVelocity.y < -MAX_SPEED) { quadVelocity.y = -MAX_SPEED; } if (quadVelocity.y > MAX_SPEED) { quadVelocity.y = MAX_SPEED; } if (angleRotation < 0.0f) { angleRotation = 0.0f; } if (angleRotation > MAX_SPEED) { angleRotation = MAX_SPEED; } } private void destroyTexture() { IntBuffer buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer(); buffer.put(0, tex_handle); glDeleteTextures(buffer); } /** * Cleans up the test */ private void cleanup() { destroyTexture(); pbuffer.destroy(); Display.destroy(); } /** * Retrieves a displaymode, if one such is available * * @param width Required width * @param height Required height * @param bpp Minimum required bits per pixel * @return */ private DisplayMode findDisplayMode(int width, int height, int bpp) throws LWJGLException { DisplayMode[] modes = Display.getAvailableDisplayModes(); for ( DisplayMode mode : modes ) { if ( mode.getWidth() == width && mode.getHeight() == height && mode.getBitsPerPixel() >= bpp ) return mode; } return null; } private void initGLState(int width, int height, float color) { glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0, mode.getWidth(), 0, mode.getHeight()); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glViewport(0, 0, width, height); //set clear color to black glClearColor(color, color, color, 0.0f); } /** * Initializes OGL */ private void glInit() { //sync frame (only works on windows) Display.setVSyncEnabled(true); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glEnable(GL_TEXTURE_2D); // Create shared texture IntBuffer buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer(); glGenTextures(buffer); tex_handle = buffer.get(0); glBindTexture(GL_TEXTURE_2D, tex_handle); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); initGLState(mode.getWidth(), mode.getHeight(), 0f); } /** * Test entry point */ public static void main(String[] args) { System.out.println( "Change between fullscreen and windowed mode, by pressing F and W respectively"); System.out.println("Move quad using arrowkeys, and change rotation using +/-"); PbufferTest fswTest = new PbufferTest(); fswTest.execute(); System.exit(0); } } lwjgl-2.7.1/src/java/org/lwjgl/test/opengl/VersionTest.java0000644000175000017500000002373111543426510022740 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test.opengl; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.*; import java.util.StringTokenizer; import java.util.regex.Pattern; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL32.*; /** * Tests the ARB_create_context extension through the use of the ContextAttribs class. * * @author Spasi */ public final class VersionTest { private VersionTest() { } public static void main(String[] args) { initialize(args); cleanup(); System.exit(0); } private static void initialize(String[] args) { if ( args.length < 2 ) argsError("Insufficient number of arguments"); int majorInput = 1; int minorInput = 0; try { majorInput = Integer.parseInt(args[0]); minorInput = Integer.parseInt(args[1]); } catch (NumberFormatException e) { argsError("Invalid number format"); } ContextAttribs ca = new ContextAttribs(majorInput, minorInput); if ( 2 < args.length ) { for ( int i = 2; i < args.length; i++ ) { if ( Pattern.matches("[0-9]+", args[i]) ) ca = ca.withLayer(Integer.parseInt(args[i])); else if ( "debug".equalsIgnoreCase(args[i]) ) ca = ca.withDebug(true); else if ( "fc".equalsIgnoreCase(args[i]) ) ca = ca.withForwardCompatible(true); else if ( "core".equalsIgnoreCase(args[i]) ) ca = ca.withProfileCore(true); else if ( "compatibility".equalsIgnoreCase(args[i]) ) ca = ca.withProfileCompatibility(true); else if ( "es".equalsIgnoreCase(args[i]) ) ca = ca.withProfileES(true); else argsError("Unknown argument: \'" + args[i] + "\'"); } } try { DisplayMode[] modes = Display.getAvailableDisplayModes(); DisplayMode displayMode; displayMode = chooseMode(modes, 1024, 768); if ( displayMode == null ) displayMode = chooseMode(modes, 800, 600); if ( displayMode == null ) displayMode = chooseMode(modes, 640, 480); if ( displayMode == null ) kill("Failed to set an appropriate display mode."); System.out.println("Setting display mode to: " + displayMode); Display.setDisplayMode(displayMode); Display.create(new PixelFormat(8, 24, 0), ca); } catch (LWJGLException e) { kill(e.getMessage()); } System.out.println("\n---------\n"); System.out.println("Requested " + ca); final String version = glGetString(GL_VERSION); boolean deprecated = false; try { glVertex3f(0.0f, 0.0f, 0.0f); deprecated = true; } catch (Throwable t) {} final StringTokenizer version_tokenizer = new StringTokenizer(version, ". "); int majorVersion = Integer.parseInt(version_tokenizer.nextToken()); int minorVersion = Integer.parseInt(version_tokenizer.nextToken()); final boolean compatibilityProfile; final boolean coreProfile; if ( 3 < majorVersion || (majorVersion == 3 && 2 <= minorVersion) ) { final int profileMask = glGetInteger(GL_CONTEXT_PROFILE_MASK); compatibilityProfile = (profileMask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) != 0; coreProfile = (profileMask & GL_CONTEXT_CORE_PROFILE_BIT) != 0; } else { compatibilityProfile = false; coreProfile = false; } System.out.println("\nGL_VERSION returned : " + version); System.out.println("\tCore profile: " + coreProfile); System.out.println("\tCompatibility profile: " + compatibilityProfile); System.out.println("ARB_compatibility present: " + GLContext.getCapabilities().GL_ARB_compatibility); System.out.println("Deprecated functionality present: " + deprecated); if ( !deprecated && GLContext.getCapabilities().GL_ARB_compatibility ) System.out.println("\tARB_compatibility is present, but LWJGL has enabled pseudo-forward compatible mode."); System.out.println("\n---------"); boolean success = false; boolean check; if ( majorInput < 3 || (majorInput == 3 && minorInput == 0) ) { System.out.println("\nA version less than or equal to 3.0 is requested, the context\n" + "returned may implement any of the following versions:"); System.out.println("\n1) Any version no less than that requested and no greater than 3.0."); check = (majorInput < majorVersion || (majorInput == majorVersion && minorInput <= minorVersion)) // Satisfies requested version && (majorVersion < 3 || (majorVersion == 3 && minorVersion == 0)); // 3.0 or earlier System.out.println("\t" + check); success |= check; System.out.println("\n2) Version 3.1, if the GL_ARB_compatibility extension is also implemented."); check = majorVersion == 3 && minorVersion == 1 && GLContext.getCapabilities().GL_ARB_compatibility; System.out.println("\t" + check); success |= check; System.out.println("\n3) The compatibility profile of version 3.2 or greater."); check = compatibilityProfile; // No need to check version, profiles are only available with 3.2+. System.out.println("\t" + check); success |= check; System.out.println("\nTEST " + (success ? "SUCCEEDED" : "FAILED")); if ( !success && ca.isForwardCompatible() ) System.out.println("\t(probably because the forward compatible flag was set)"); } else if ( majorInput == 3 && minorInput == 1 ) { System.out.println("\nVersion 3.1 is requested, the context returned may implement\n" + "any of the following versions:"); System.out.println("\n1) Version 3.1. The GL_ARB_compatibility extension may or may not\n" + "be implemented, as determined by the implementation."); check = majorVersion == 3 && minorVersion == 1; System.out.println("\t" + check); success |= check; System.out.println("\n2) The core profile of version 3.2 or greater."); check = coreProfile; // No need to check version, profiles are only available with 3.2+. System.out.println("\t" + check); success |= check; System.out.println("\nTEST " + (success ? "SUCCEEDED" : "FAILED")); } else { System.out.println("\nVersion 3.2 or greater is requested, the context returned may\n" + "implement any of the following versions:"); System.out.println("\n1) The requested profile of the requested version."); check = majorInput == majorVersion && minorInput == minorVersion && (!ca.isProfileCompatibility() || compatibilityProfile) && (!ca.isProfileCore() || coreProfile); System.out.println("\t" + check); success |= check; System.out.println("\n2) The requested profile of any later version, so long as no\n" + "features have been removed from that later version and profile."); check = majorInput < majorVersion || (majorInput == majorVersion && minorInput < minorVersion) && (!ca.isProfileCompatibility() || compatibilityProfile) && (!ca.isProfileCore() || coreProfile); System.out.println("\t" + check); success |= check; System.out.println("\nTEST " + (success ? "SUCCEEDED" : "FAILED")); } } private static DisplayMode chooseMode(DisplayMode[] modes, int width, int height) { DisplayMode bestMode = null; for ( DisplayMode mode : modes ) { if ( mode.getWidth() == width && mode.getHeight() == height && mode.getFrequency() <= 85 ) { if ( bestMode == null || (mode.getBitsPerPixel() >= bestMode.getBitsPerPixel() && mode.getFrequency() > bestMode.getFrequency()) ) bestMode = mode; } } return bestMode; } private static void cleanup() { if ( Display.isCreated() ) Display.destroy(); } private static void argsError(final String msg) { System.out.println("\nInvalid arguments error: " + msg); System.out.println("\nUsage: VersionTest {'core'|'compatibility', , 'debug', 'fc'}:\n"); System.out.println("majorVersion\t- Major OpenGL version."); System.out.println("majorVersion\t- Minor OpenGL version."); System.out.println("core\t- Sets the Core Profile bit (optional, requires 3.2+)."); System.out.println("compatibility\t- Sets the Compatibility Profile bit (optional, requires 3.2+)."); System.out.println("ws\t- Sets the OpenGL ES Profile bit (optional, requires 2.0)."); System.out.println("layer\t- Layer plane (optional)."); System.out.println("debug\t- Enables debug mode (optional)."); System.out.println("fc\t- Enables forward compatibility mode (optional, requires 3.0+)."); cleanup(); System.exit(-1); } static void kill(String reason) { System.out.println("The VersionTest program was terminated because an error occured.\n"); System.out.println("Reason: " + (reason == null ? "Unknown" : reason)); cleanup(); System.exit(-1); } } lwjgl-2.7.1/src/java/org/lwjgl/test/DisplayTest.java0000644000175000017500000001654111543426510021435 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.test; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; /** *
      * Test class for Display & DisplayMode * * @author Brian Matzon * @version $Revision: 3418 $ * $Id: DisplayTest.java 3418 2010-09-28 21:11:35Z spasi $ */ public class DisplayTest { /** * Creates a new DisplayTest */ public DisplayTest() { } /** * Runs the tests */ public void executeTest() throws LWJGLException { currentTest(); queryModesTest(); setDisplayModeTest(); setDisplayConfigurationTest(); } /** * Prints some info about the current mode */ private void currentTest() { System.out.println("==== Test Current ===="); System.out.println("Info about current:"); System.out.println("Graphics card: " + Display.getAdapter() + ", version: " + Display.getVersion()); System.out.println("Resolution: " + Display.getDisplayMode().getWidth() + "x" + Display.getDisplayMode().getHeight() + "x" + Display.getDisplayMode().getBitsPerPixel() + "@" + Display.getDisplayMode().getFrequency() + "Hz"); System.out.println("---- Test Current ----"); } /** * Tests querying for modes */ private void queryModesTest() throws LWJGLException { DisplayMode[] modes = null; System.out.println("==== Test query ===="); System.out.println("Retrieving available displaymodes"); modes = Display.getAvailableDisplayModes(); // no modes check if (modes == null) { System.out.println("FATAL: unable to find any modes!"); System.exit(-1); } // write some info System.out.println("Found " + modes.length + " modes"); System.out.println("The first 5 are:"); for(int i=0;i * Test class WaveDataTest * * @author Brian Matzon */ public class WaveDataTest { String filePath = "Footsteps.wav"; /** * Creates a new DisplayTest */ public WaveDataTest() { } /** * Runs the tests */ public void executeTest() throws LWJGLException { executeCreationTest(); executeBrokenCreationTest(); executeMidStreamCreationTest(); } private void executeCreationTest() { WaveData wd = WaveData.create(filePath); if(wd != null) { System.out.println("executeCreationTest::success"); } } private void executeBrokenCreationTest() { WaveData wd = WaveData.create(""); if(wd == null) { System.out.println("executeBrokenCreationTest::success"); } } private void executeStreamCreationTest() { try { AudioInputStream ais = AudioSystem.getAudioInputStream(new File(filePath)); WaveData wd = WaveData.create(ais); if(wd == null) { System.out.println("executeMidStreamCreationTest::success"); } } catch (Exception e) { e.printStackTrace(); } } private void executeMidStreamCreationTest() { try { AudioInputStream ais = AudioSystem.getAudioInputStream(WaveDataTest.class.getClassLoader().getResource(filePath)); int totalSize = ais.getFormat().getChannels() * (int) ais.getFrameLength() * ais.getFormat().getSampleSizeInBits() / 8; // skip 1/4 of the stream int skip = totalSize / 4; long skipped = ais.skip(skip); WaveData wd = WaveData.create(ais); if(wd == null) { System.out.println("executeMidStreamCreationTest::success"); } } catch (Exception e) { e.printStackTrace(); } } /** * Pause current thread for a specified time * * @param time milliseconds to sleep */ private void pause(long time) { try { Thread.sleep(time); } catch (InterruptedException inte) { /* ignored */ } } /** * Tests the Sys class, and serves as basic usage test * * @param args ignored */ public static void main(String[] args) throws LWJGLException { new WaveDataTest().executeTest(); System.exit(0); } } lwjgl-2.7.1/src/java/org/lwjgl/PointerWrapperAbstract.java0000644000175000017500000000600511543426510022650 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl; /** * Base PointerWrapper implementation. * * @author Spasi */ public abstract class PointerWrapperAbstract implements PointerWrapper { protected final long pointer; protected PointerWrapperAbstract(final long pointer) { this.pointer = pointer; } /** * Returns true if this object represents a valid pointer. * The pointer might be invalid because it is NULL or because * some other action has deleted the object that this pointer * represents. * * @return true if the pointer is valid */ public boolean isValid() { return pointer != 0; } /** * Checks if the pointer is valid and throws an IllegalStateException if * it is not. This method is a NO-OP, unless the org.lwjgl.util.Debug * property has been set to true. */ public final void checkValid() { if ( LWJGLUtil.DEBUG && !isValid() ) throw new IllegalStateException("This " + getClass().getSimpleName() + " pointer is not valid."); } public final long getPointer() { checkValid(); return pointer; } public boolean equals(final Object o) { if ( this == o ) return true; if ( !(o instanceof PointerWrapperAbstract) ) return false; final PointerWrapperAbstract that = (PointerWrapperAbstract)o; if ( pointer != that.pointer ) return false; return true; } public int hashCode() { return (int)(pointer ^ (pointer >>> 32)); } public String toString() { return getClass().getSimpleName() + " pointer (0x" + Long.toHexString(pointer).toUpperCase() + ")"; } }lwjgl-2.7.1/src/java/org/lwjgl/WindowsSysImplementation.java0000644000175000017500000000743511543426510023252 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl; import java.security.PrivilegedExceptionAction; import java.security.PrivilegedActionException; import java.security.AccessController; import java.lang.reflect.Method; import org.lwjgl.opengl.Display; /** *

      * @author $Author: spasi $ * @version $Revision: 3418 $ * $Id: WindowsSysImplementation.java 3418 2010-09-28 21:11:35Z spasi $ */ final class WindowsSysImplementation extends DefaultSysImplementation { private static final int JNI_VERSION = 23; static { Sys.initialize(); } public int getRequiredJNIVersion() { return JNI_VERSION; } public long getTimerResolution() { return 1000; } public long getTime() { return nGetTime(); } private static native long nGetTime(); public boolean has64Bit() { return true; } private static long getHwnd() { if (!Display.isCreated()) return 0; /* Use reflection since we can't make Display.getImplementation * public */ try { return AccessController.doPrivileged(new PrivilegedExceptionAction() { public Long run() throws Exception { Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation"); getImplementation_method.setAccessible(true); Object display_impl = getImplementation_method.invoke(null); Class WindowsDisplay_class = Class.forName("org.lwjgl.opengl.WindowsDisplay"); Method getHwnd_method = WindowsDisplay_class.getDeclaredMethod("getHwnd"); getHwnd_method.setAccessible(true); return (Long)getHwnd_method.invoke(display_impl); } }); } catch (PrivilegedActionException e) { throw new Error(e); } } public void alert(String title, String message) { if(!Display.isCreated()) { initCommonControls(); } nAlert(getHwnd(), title, message); } private static native void nAlert(long parent_hwnd, String title, String message); private static native void initCommonControls(); public boolean openURL(final String url) { try { LWJGLUtil.execPrivileged(new String[]{"rundll32", "url.dll,FileProtocolHandler", url}); return true; } catch (Exception e) { LWJGLUtil.log("Failed to open url (" + url + "): " + e.getMessage()); return false; } } public String getClipboard() { return nGetClipboard(); } private static native String nGetClipboard(); } lwjgl-2.7.1/src/java/org/lwjgl/DefaultSysImplementation.java0000644000175000017500000000421511543426510023175 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl; /** * * @author elias_naur * @version $Revision: 3426 $ * $Id: DefaultSysImplementation.java 3426 2010-10-01 22:20:14Z spasi $ */ abstract class DefaultSysImplementation implements SysImplementation { public native int getJNIVersion(); public native int getPointerSize(); public native void setDebug(boolean debug); public long getTimerResolution() { return 1000; } public boolean has64Bit() { return false; } public abstract long getTime(); public abstract void alert(String title, String message); public abstract String getClipboard(); } lwjgl-2.7.1/src/java/org/lwjgl/SysImplementation.java0000644000175000017500000000504311543426510021670 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl; /** * * System class platform specific method interface * * @author cix_foo * @author elias_naur * @version $Revision: 3426 $ * $Id: SysImplementation.java 3426 2010-10-01 22:20:14Z spasi $ */ interface SysImplementation { /** * Return the required version of the native library */ int getRequiredJNIVersion(); /** * Return the version of the native library */ int getJNIVersion(); /** * Returns the platform's pointer size in bytes */ int getPointerSize(); void setDebug(boolean debug); /** * Obtains the number of ticks that the hires timer does in a second. * * @return timer resolution in ticks per second or 0 if no timer is present. */ long getTimerResolution(); long getTime(); void alert(String title, String message); boolean openURL(String url); String getClipboard(); /** * Returns true there exists a separate 64 bit library * on the platform */ boolean has64Bit(); } lwjgl-2.7.1/src/java/org/lwjgl/PointerBuffer.java0000644000175000017500000007063211543426510020764 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl; import java.lang.reflect.Method; import java.nio.*; /** * This class is a container for architecture independent pointer data. * The interface mirrors the NIO LongBuffer API for convenience. * * @author Spasi */ public class PointerBuffer implements Comparable { private static final boolean is64Bit; static { // Use reflection so that we can compile this class for the Generator. boolean is64 = false; try { Method m = Class.forName("org.lwjgl.Sys").getDeclaredMethod("is64Bit", (Class[])null); is64 = (Boolean)m.invoke(null, (Object[])null); } catch (Throwable t) { // ignore } finally { is64Bit = is64; } } protected final ByteBuffer pointers; protected final Buffer view; protected final IntBuffer view32; protected final LongBuffer view64; /** * Creates a new PointerBuffer with the specified capacity. * * @param capacity the PointerBuffer size, in number of pointers */ public PointerBuffer(final int capacity) { this(BufferUtils.createByteBuffer(capacity * getPointerSize())); } /** * Creates a new PointerBuffer using the specified ByteBuffer as its pointer * data source. This is useful for users that do their own memory management * over a big ByteBuffer, instead of allocating many small ones. * * @param source the source buffer */ public PointerBuffer(final ByteBuffer source) { if ( !source.isDirect() ) throw new IllegalArgumentException("ByteBuffer is not direct"); pointers = source.slice().order(source.order()); if ( is64Bit ) { view32 = null; view = view64 = pointers.asLongBuffer(); } else { view = view32 = pointers.asIntBuffer(); view64 = null; } } /** * Returns the ByteBuffer that backs this PointerBuffer. * * @return the pointer ByteBuffer */ public ByteBuffer getBuffer() { return pointers; } /** Returns true if the underlying architecture is 64bit. */ public static boolean is64Bit() { return is64Bit; } /** * Returns the pointer size in bytes, based on the underlying architecture. * * @return The pointer size in bytes */ public static int getPointerSize() { return is64Bit ? 8 : 4; } /** * Returns this buffer's capacity.

      * * @return The capacity of this buffer */ public final int capacity() { return view.capacity(); } /** * Returns this buffer's position.

      * * @return The position of this buffer */ public final int position() { return view.position(); } /** * Returns this buffer's position, in bytes.

      * * @return The position of this buffer in bytes. */ public final int positionByte() { return position() * getPointerSize(); } /** * Sets this buffer's position. If the mark is defined and larger than the * new position then it is discarded.

      * * @param newPosition The new position value; must be non-negative * and no larger than the current limit * * @return This buffer * * @throws IllegalArgumentException If the preconditions on newPosition do not hold */ public final PointerBuffer position(int newPosition) { view.position(newPosition); return this; } /** * Returns this buffer's limit.

      * * @return The limit of this buffer */ public final int limit() { return view.limit(); } /** * Sets this buffer's limit. If the position is larger than the new limit * then it is set to the new limit. If the mark is defined and larger than * the new limit then it is discarded.

      * * @param newLimit The new limit value; must be non-negative * and no larger than this buffer's capacity * * @return This buffer * * @throws IllegalArgumentException If the preconditions on newLimit do not hold */ public final PointerBuffer limit(int newLimit) { view.limit(newLimit); return this; } /** * Sets this buffer's mark at its position.

      * * @return This buffer */ public final PointerBuffer mark() { view.mark(); return this; } /** * Resets this buffer's position to the previously-marked position. *

      *

      Invoking this method neither changes nor discards the mark's * value.

      * * @return This buffer * * @throws java.nio.InvalidMarkException If the mark has not been set */ public final PointerBuffer reset() { view.reset(); return this; } /** * Clears this buffer. The position is set to zero, the limit is set to * the capacity, and the mark is discarded. *

      *

      Invoke this method before using a sequence of channel-read or * put operations to fill this buffer. For example: *

      *

      	 * buf.clear();     // Prepare buffer for reading
      	 * in.read(buf);    // Read data
      *

      *

      This method does not actually erase the data in the buffer, but it * is named as if it did because it will most often be used in situations * in which that might as well be the case.

      * * @return This buffer */ public final PointerBuffer clear() { view.clear(); return this; } /** * Flips this buffer. The limit is set to the current position and then * the position is set to zero. If the mark is defined then it is * discarded. *

      *

      After a sequence of channel-read or put operations, invoke * this method to prepare for a sequence of channel-write or relative * get operations. For example: *

      *

      	 * buf.put(magic);    // Prepend header
      	 * in.read(buf);      // Read data into rest of buffer
      	 * buf.flip();        // Flip buffer
      	 * out.write(buf);    // Write header + data to channel
      *

      *

      This method is often used in conjunction with the {@link * java.nio.ByteBuffer#compact compact} method when transferring data from * one place to another.

      * * @return This buffer */ public final PointerBuffer flip() { view.flip(); return this; } /** * Rewinds this buffer. The position is set to zero and the mark is * discarded. *

      *

      Invoke this method before a sequence of channel-write or get * operations, assuming that the limit has already been set * appropriately. For example: *

      *

      	 * out.write(buf);    // Write remaining data
      	 * buf.rewind();      // Rewind buffer
      	 * buf.get(array);    // Copy data into array
      * * @return This buffer */ public final PointerBuffer rewind() { view.rewind(); return this; } /** * Returns the number of elements between the current position and the * limit.

      * * @return The number of elements remaining in this buffer */ public final int remaining() { return view.remaining(); } /** * Returns the number of bytes between the current position and the * limit.

      * * @return The number of bytes remaining in this buffer */ public final int remainingByte() { return remaining() * getPointerSize(); } /** * Tells whether there are any elements between the current position and * the limit.

      * * @return true if, and only if, there is at least one element * remaining in this buffer */ public final boolean hasRemaining() { return view.hasRemaining(); } /** * Allocates a new pointer buffer. *

      *

      The new buffer's position will be zero, its limit will be its * capacity, and its mark will be undefined.

      * * @param capacity The new buffer's capacity, in pointers * * @return The new pointer buffer * * @throws IllegalArgumentException If the capacity is a negative integer */ public static PointerBuffer allocateDirect(int capacity) { return new PointerBuffer(capacity); } /** * This method is used in slice and duplicate instead of normal object construction, * so that subclasses can return themselves. * * @param source * * @return A new PointerBuffer instance */ protected PointerBuffer newInstance(final ByteBuffer source) { return new PointerBuffer(source); } /** * Creates a new pointer buffer whose content is a shared subsequence of * this buffer's content. *

      *

      The content of the new buffer will start at this buffer's current * position. Changes to this buffer's content will be visible in the new * buffer, and vice versa; the two buffers' position, limit, and mark * values will be independent. *

      *

      The new buffer's position will be zero, its capacity and its limit * will be the number of longs remaining in this buffer, and its mark * will be undefined. The new buffer will be direct if, and only if, this * buffer is direct, and it will be read-only if, and only if, this buffer * is read-only.

      * * @return The new pointer buffer */ public PointerBuffer slice() { final int pointerSize = getPointerSize(); pointers.position(view.position() * pointerSize); pointers.limit(view.limit() * pointerSize); try { // We're slicing in the constructor. return newInstance(pointers); } finally { pointers.clear(); } } /** * Creates a new pointer buffer that shares this buffer's content. *

      *

      The content of the new buffer will be that of this buffer. Changes * to this buffer's content will be visible in the new buffer, and vice * versa; the two buffers' position, limit, and mark values will be * independent. *

      *

      The new buffer's capacity, limit and position will be * identical to those of this buffer. The new buffer will be direct if, * and only if, this buffer is direct, and it will be read-only if, and * only if, this buffer is read-only.

      * * @return The new pointer buffer */ public PointerBuffer duplicate() { final PointerBuffer buffer = newInstance(pointers); buffer.position(view.position()); buffer.limit(view.limit()); return buffer; } /** * Creates a new, read-only pointer buffer that shares this buffer's * content. *

      *

      The content of the new buffer will be that of this buffer. Changes * to this buffer's content will be visible in the new buffer; the new * buffer itself, however, will be read-only and will not allow the shared * content to be modified. The two buffers' position, limit, and mark * values will be independent. *

      *

      The new buffer's capacity, limit and position will be * identical to those of this buffer. *

      *

      If this buffer is itself read-only then this method behaves in * exactly the same way as the {@link #duplicate duplicate} method.

      * * @return The new, read-only pointer buffer */ public PointerBuffer asReadOnlyBuffer() { final PointerBuffer buffer = new PointerBufferR(pointers); buffer.position(view.position()); buffer.limit(view.limit()); return buffer; } public boolean isReadOnly() { return false; } /** * Relative get method. Reads the long at this buffer's * current position, and then increments the position.

      * * @return The long at the buffer's current position * * @throws BufferUnderflowException If the buffer's current position is not smaller than its limit */ public long get() { if ( is64Bit ) return view64.get(); else return view32.get() & 0x00000000FFFFFFFFL; } /** * Relative put method  (optional operation). *

      *

      Writes the given long into this buffer at the current * position, and then increments the position.

      * * @param l The long to be written * * @return This buffer * * @throws BufferOverflowException If this buffer's current position is not smaller than its limit * @throws ReadOnlyBufferException If this buffer is read-only */ public PointerBuffer put(long l) { if ( is64Bit ) view64.put(l); else view32.put((int)l); return this; } /** * Convenience put that accepts PointerWrapper objects. * * @see #put(long) */ public PointerBuffer put(final PointerWrapper pointer) { return put(pointer.getPointer()); } /** * Convenience put on a target ByteBuffer. * * @param target the target ByteBuffer * @param l the long value to be written */ public static void put(final ByteBuffer target, long l) { if ( is64Bit ) target.putLong(l); else target.putInt((int)l); } /** * Absolute get method. Reads the long at the given * index.

      * * @param index The index from which the long will be read * * @return The long at the given index * * @throws IndexOutOfBoundsException If index is negative * or not smaller than the buffer's limit */ public long get(int index) { if ( is64Bit ) return view64.get(index); else return view32.get(index) & 0x00000000FFFFFFFFL; } /** * Absolute put method  (optional operation). *

      *

      Writes the given long into this buffer at the given * index.

      * * @param index The index at which the long will be written * @param l The long value to be written * * @return This buffer * * @throws IndexOutOfBoundsException If index is negative * or not smaller than the buffer's limit * @throws ReadOnlyBufferException If this buffer is read-only */ public PointerBuffer put(int index, long l) { if ( is64Bit ) view64.put(index, l); else view32.put(index, (int)l); return this; } /** * Convenience put that accepts PointerWrapper objects. * * @see #put(int, long) */ public PointerBuffer put(int index, PointerWrapper pointer) { return put(index, pointer.getPointer()); } /** * Convenience put on a target ByteBuffer. * * @param target the target ByteBuffer * @param index the index at which the long will be written * @param l the long value to be written */ public static void put(final ByteBuffer target, int index, long l) { if ( is64Bit ) target.putLong(index * 8, l); else target.putInt(index * 4, (int)l); } // -- Bulk get operations -- /** * Relative bulk get method. *

      *

      This method transfers longs from this buffer into the given * destination array. If there are fewer longs remaining in the * buffer than are required to satisfy the request, that is, if * length > remaining(), then no * longs are transferred and a {@link BufferUnderflowException} is * thrown. *

      *

      Otherwise, this method copies length longs from this * buffer into the given array, starting at the current position of this * buffer and at the given offset in the array. The position of this * buffer is then incremented by length. *

      *

      In other words, an invocation of this method of the form * src.get(dst, off, len) has exactly the same effect as * the loop *

      *

      	 *     for (int i = off; i < off + len; i++)
      	 *         dst[i] = src.get(); 
      *

      * except that it first checks that there are sufficient longs in * this buffer and it is potentially much more efficient.

      * * @param dst The array into which longs are to be written * @param offset The offset within the array of the first long to be * written; must be non-negative and no larger than * dst.length * @param length The maximum number of longs to be written to the given * array; must be non-negative and no larger than * dst.length - offset * * @return This buffer * * @throws BufferUnderflowException If there are fewer than length longs * remaining in this buffer * @throws IndexOutOfBoundsException If the preconditions on the offset and length * parameters do not hold */ public PointerBuffer get(long[] dst, int offset, int length) { if ( is64Bit ) view64.get(dst, offset, length); else { checkBounds(offset, length, dst.length); if ( length > view32.remaining() ) throw new BufferUnderflowException(); int end = offset + length; for ( int i = offset; i < end; i++ ) dst[i] = view32.get() & 0x00000000FFFFFFFFL; } return this; } /** * Relative bulk get method. *

      *

      This method transfers longs from this buffer into the given * destination array. An invocation of this method of the form * src.get(a) behaves in exactly the same way as the invocation *

      *

      	 *     src.get(a, 0, a.length) 
      * * @return This buffer * * @throws BufferUnderflowException If there are fewer than length longs * remaining in this buffer */ public PointerBuffer get(long[] dst) { return get(dst, 0, dst.length); } /** * Relative bulk put method  (optional operation). *

      *

      This method transfers the longs remaining in the given source * buffer into this buffer. If there are more longs remaining in the * source buffer than in this buffer, that is, if * src.remaining() > remaining(), * then no longs are transferred and a {@link * BufferOverflowException} is thrown. *

      *

      Otherwise, this method copies * n = src.remaining() longs from the given * buffer into this buffer, starting at each buffer's current position. * The positions of both buffers are then incremented by n. *

      *

      In other words, an invocation of this method of the form * dst.put(src) has exactly the same effect as the loop *

      *

      	 *     while (src.hasRemaining())
      	 *         dst.put(src.get()); 
      *

      * except that it first checks that there is sufficient space in this * buffer and it is potentially much more efficient.

      * * @param src The source buffer from which longs are to be read; * must not be this buffer * * @return This buffer * * @throws BufferOverflowException If there is insufficient space in this buffer * for the remaining longs in the source buffer * @throws IllegalArgumentException If the source buffer is this buffer * @throws ReadOnlyBufferException If this buffer is read-only */ public PointerBuffer put(PointerBuffer src) { if ( is64Bit ) view64.put(src.view64); else view32.put(src.view32); return this; } /** * Relative bulk put method  (optional operation). *

      *

      This method transfers longs into this buffer from the given * source array. If there are more longs to be copied from the array * than remain in this buffer, that is, if * length > remaining(), then no * longs are transferred and a {@link BufferOverflowException} is * thrown. *

      *

      Otherwise, this method copies length longs from the * given array into this buffer, starting at the given offset in the array * and at the current position of this buffer. The position of this buffer * is then incremented by length. *

      *

      In other words, an invocation of this method of the form * dst.put(src, off, len) has exactly the same effect as * the loop *

      *

      	 *     for (int i = off; i < off + len; i++)
      	 *         dst.put(a[i]); 
      *

      * except that it first checks that there is sufficient space in this * buffer and it is potentially much more efficient.

      * * @param src The array from which longs are to be read * @param offset The offset within the array of the first long to be read; * must be non-negative and no larger than array.length * @param length The number of longs to be read from the given array; * must be non-negative and no larger than * array.length - offset * * @return This buffer * * @throws BufferOverflowException If there is insufficient space in this buffer * @throws IndexOutOfBoundsException If the preconditions on the offset and length * parameters do not hold * @throws ReadOnlyBufferException If this buffer is read-only */ public PointerBuffer put(long[] src, int offset, int length) { if ( is64Bit ) view64.put(src, offset, length); else { checkBounds(offset, length, src.length); if ( length > view32.remaining() ) throw new BufferOverflowException(); int end = offset + length; for ( int i = offset; i < end; i++ ) view32.put((int)src[i]); } return this; } /** * Relative bulk put method  (optional operation). *

      *

      This method transfers the entire content of the given source * long array into this buffer. An invocation of this method of the * form dst.put(a) behaves in exactly the same way as the * invocation *

      *

      	 *     dst.put(a, 0, a.length) 
      * * @return This buffer * * @throws BufferOverflowException If there is insufficient space in this buffer * @throws ReadOnlyBufferException If this buffer is read-only */ public final PointerBuffer put(long[] src) { return put(src, 0, src.length); } /** * Compacts this buffer  (optional operation). *

      *

      The longs between the buffer's current position and its limit, * if any, are copied to the beginning of the buffer. That is, the * long at index p = position() is copied * to index zero, the long at index p + 1 is copied * to index one, and so forth until the long at index * limit() - 1 is copied to index * n = limit() - 1 - p. * The buffer's position is then set to n+1 and its limit is set to * its capacity. The mark, if defined, is discarded. *

      *

      The buffer's position is set to the number of longs copied, * rather than to zero, so that an invocation of this method can be * followed immediately by an invocation of another relative put * method.

      * * @return This buffer * * @throws ReadOnlyBufferException If this buffer is read-only */ public PointerBuffer compact() { if ( is64Bit ) view64.compact(); else view32.compact(); return this; } /** * Retrieves this buffer's byte order. *

      *

      The byte order of a pointer buffer created by allocation or by * wrapping an existing long array is the {@link * ByteOrder#nativeOrder native order} of the underlying * hardware. The byte order of a pointer buffer created as a view of a byte buffer is that of the * byte buffer at the moment that the view is created.

      * * @return This buffer's byte order */ public ByteOrder order() { if ( is64Bit ) return view64.order(); else return view32.order(); } /** * Returns a string summarizing the state of this buffer.

      * * @return A summary string */ public String toString() { StringBuilder sb = new StringBuilder(48); sb.append(getClass().getName()); sb.append("[pos="); sb.append(position()); sb.append(" lim="); sb.append(limit()); sb.append(" cap="); sb.append(capacity()); sb.append("]"); return sb.toString(); } /** * Returns the current hash code of this buffer. *

      *

      The hash code of a pointer buffer depends only upon its remaining * elements; that is, upon the elements from position() up to, and * including, the element at limit() - 1. *

      *

      Because buffer hash codes are content-dependent, it is inadvisable * to use buffers as keys in hash maps or similar data structures unless it * is known that their contents will not change.

      * * @return The current hash code of this buffer */ public int hashCode() { int h = 1; int p = position(); for ( int i = limit() - 1; i >= p; i-- ) h = 31 * h + (int)get(i); return h; } /** * Tells whether or not this buffer is equal to another object. *

      *

      Two pointer buffers are equal if, and only if, *

      *

        *

        *

      1. They have the same element type,

      2. *

        *

      3. They have the same number of remaining elements, and *

      4. *

        *

      5. The two sequences of remaining elements, considered * independently of their starting positions, are pointwise equal. *

      6. *

        *

      *

      *

      A pointer buffer is not equal to any other type of object.

      * * @param ob The object to which this buffer is to be compared * * @return true if, and only if, this buffer is equal to the * given object */ public boolean equals(Object ob) { if ( !(ob instanceof PointerBuffer) ) return false; PointerBuffer that = (PointerBuffer)ob; if ( this.remaining() != that.remaining() ) return false; int p = this.position(); for ( int i = this.limit() - 1, j = that.limit() - 1; i >= p; i--, j-- ) { long v1 = this.get(i); long v2 = that.get(j); if ( v1 != v2 ) { return false; } } return true; } /** * Compares this buffer to another. *

      *

      Two pointer buffers are compared by comparing their sequences of * remaining elements lexicographically, without regard to the starting * position of each sequence within its corresponding buffer. *

      *

      A pointer buffer is not comparable to any other type of object. * * @return A negative integer, zero, or a positive integer as this buffer * is less than, equal to, or greater than the given buffer */ public int compareTo(Object o) { final PointerBuffer that = (PointerBuffer)o; int n = this.position() + Math.min(this.remaining(), that.remaining()); for ( int i = this.position(), j = that.position(); i < n; i++, j++ ) { long v1 = this.get(i); long v2 = that.get(j); if ( v1 == v2 ) continue; if ( v1 < v2 ) return -1; return +1; } return this.remaining() - that.remaining(); } private static void checkBounds(int off, int len, int size) { if ( (off | len | (off + len) | (size - (off + len))) < 0 ) throw new IndexOutOfBoundsException(); } /** * Read-only version of PointerBuffer. * * @author Spasi */ private static final class PointerBufferR extends PointerBuffer { PointerBufferR(final ByteBuffer source) { super(source); } public boolean isReadOnly() { return true; } protected PointerBuffer newInstance(final ByteBuffer source) { return new PointerBufferR(source); } public PointerBuffer asReadOnlyBuffer() { return duplicate(); } public PointerBuffer put(final long l) { throw new ReadOnlyBufferException(); } public PointerBuffer put(final int index, final long l) { throw new ReadOnlyBufferException(); } public PointerBuffer put(final PointerBuffer src) { throw new ReadOnlyBufferException(); } public PointerBuffer put(final long[] src, final int offset, final int length) { throw new ReadOnlyBufferException(); } public PointerBuffer compact() { throw new ReadOnlyBufferException(); } } }lwjgl-2.7.1/src/native/0000755000175000017500000000000011523636776014015 5ustar zero79zero79lwjgl-2.7.1/src/native/macosx/0000755000175000017500000000000011543426510015270 5ustar zero79zero79lwjgl-2.7.1/src/native/macosx/context.m0000644000175000017500000001447111543426510017141 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: context.m 3116 2008-08-19 16:46:03Z spasi $ * * @author elias_naur * @version $Revision: 3116 $ */ #import #import "context.h" static CFBundleRef opengl_bundle = NULL; void *extgl_GetProcAddress(const char *name) { CFStringRef cf_name = CFStringCreateWithCString(NULL, name, kCFStringEncodingUTF8); void *address = CFBundleGetFunctionPointerForName(opengl_bundle, cf_name); CFRelease(cf_name); if (address == NULL) printfDebug("Could not locate symbol %s\n", name); return address; } static CFBundleRef loadFramework(JNIEnv *env) { CFStringRef framework_path = CFSTR("/System/Library/Frameworks/OpenGL.framework"); if (framework_path == NULL) { printfDebugJava(env, "Failed to allocate string"); return NULL; } CFURLRef url = CFURLCreateWithFileSystemPath(NULL, framework_path, kCFURLPOSIXPathStyle, TRUE); if (url == NULL) { printfDebugJava(env, "Failed to allocate URL"); return NULL; } CFBundleRef opengl_bundle = CFBundleCreate(NULL, url); CFRelease(url); return opengl_bundle; } bool extgl_Open(JNIEnv *env) { if (opengl_bundle != NULL) return true; opengl_bundle = loadFramework(env); if (opengl_bundle != NULL) { return true; } else { throwException(env, "Could not load OpenGL library"); return false; } } void extgl_Close(void) { if (opengl_bundle != NULL) { CFRelease(opengl_bundle); opengl_bundle = NULL; } } NSOpenGLPixelFormat *choosePixelFormat(JNIEnv *env, jobject pixel_format, bool use_display_bpp, bool support_window, bool support_pbuffer, bool double_buffered) { int bpp; jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); if (use_display_bpp) bpp = CGDisplayBitsPerPixel(kCGDirectMainDisplay); else bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); // TODO: Add floating_point_packed attribute below bool floating_point_packed = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); // TODO: Add sRGB attribute below bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); attrib_list_t attribs; jboolean allow_software_acceleration = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); initAttribList(&attribs); if (!allow_software_acceleration) putAttrib(&attribs, NSOpenGLPFAAccelerated); if (double_buffered) putAttrib(&attribs, NSOpenGLPFADoubleBuffer); putAttrib(&attribs, NSOpenGLPFAMinimumPolicy); putAttrib(&attribs, NSOpenGLPFAColorSize); putAttrib(&attribs, bpp); putAttrib(&attribs, NSOpenGLPFAAlphaSize); putAttrib(&attribs, alpha); putAttrib(&attribs, NSOpenGLPFADepthSize); putAttrib(&attribs, depth); putAttrib(&attribs, NSOpenGLPFAStencilSize); putAttrib(&attribs, stencil); putAttrib(&attribs, NSOpenGLPFAAccumSize); putAttrib(&attribs, accum_bpp + accum_alpha); putAttrib(&attribs, NSOpenGLPFASampleBuffers); putAttrib(&attribs, samples > 0 ? 1 : 0); putAttrib(&attribs, NSOpenGLPFASamples); putAttrib(&attribs, samples); putAttrib(&attribs, NSOpenGLPFAAuxBuffers); putAttrib(&attribs, num_aux_buffers); if (support_window) putAttrib(&attribs, NSOpenGLPFAWindow); if (support_pbuffer) putAttrib(&attribs, NSOpenGLPFAPixelBuffer); if (stereo) putAttrib(&attribs, NSOpenGLPFAStereo); if (floating_point) putAttrib(&attribs, NSOpenGLPFAColorFloat); putAttrib(&attribs, 0); NSOpenGLPixelFormat* fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:(NSOpenGLPixelFormatAttribute *)attribs.attribs]; if (fmt == nil) { throwException(env, "Could not create pixel format"); return NULL; } return fmt; } lwjgl-2.7.1/src/native/macosx/macosx_al.c0000644000175000017500000001022611543426510017403 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include #include #include #include #include #include #include "extal.h" #include "common_tools.h" /** * $Id: macosx_al.c 3416 2010-09-27 00:25:59Z spasi $ * * This file contains the AL extension assigning mechanism * * @author Brian Matzon * @version $Revision: 3416 $ */ static const struct mach_header* handleOAL = NULL; static CFBundleRef openal_bundle = NULL; void *extal_NativeGetFunctionPointer(const char *function) { void *address = NULL; if (handleOAL != NULL) { char *mac_symbol_name = (char *)malloc((strlen(function) + 2)*sizeof(char)); if (mac_symbol_name == NULL) return NULL; mac_symbol_name[0] = '_'; strcpy(&(mac_symbol_name[1]), function); NSSymbol symbol = NSLookupSymbolInImage(handleOAL, mac_symbol_name, NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); free(mac_symbol_name); if (symbol != NULL) { address = NSAddressOfSymbol(symbol); } } else if (openal_bundle != NULL) { CFStringRef cf_function = CFStringCreateWithCString(NULL, function, kCFStringEncodingUTF8); address = CFBundleGetFunctionPointerForName(openal_bundle, cf_function); CFRelease(cf_function); } return address; } static CFBundleRef tryLoadFramework(JNIEnv *env) { CFStringRef framework_path = CFSTR("/System/Library/Frameworks/OpenAL.framework"); if (framework_path == NULL) { printfDebugJava(env, "Failed to allocate string"); return NULL; } CFURLRef url = CFURLCreateWithFileSystemPath(NULL, framework_path, kCFURLPOSIXPathStyle, TRUE); if (url == NULL) { printfDebugJava(env, "Failed to allocate URL"); return NULL; } CFBundleRef openal_bundle = CFBundleCreate(NULL, url); CFRelease(url); return openal_bundle; } void extal_LoadLibrary(JNIEnv *env, jstring path) { const char *path_str = (*env)->GetStringUTFChars(env, path, NULL); printfDebugJava(env, "Testing '%s'", path_str); handleOAL = NSAddImage(path_str, NSADDIMAGE_OPTION_RETURN_ON_ERROR); if (handleOAL != NULL) { printfDebugJava(env, "Found OpenAL at '%s'", path_str); } else { throwException(env, "Could not load OpenAL library"); } (*env)->ReleaseStringUTFChars(env, path, path_str); } /** * Unloads the OpenAL Library */ void extal_UnloadLibrary() { if (openal_bundle != NULL) { CFRelease(openal_bundle); openal_bundle = NULL; } } JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_nCreateDefault(JNIEnv *env, jclass clazz) { openal_bundle = tryLoadFramework(env); if (openal_bundle != NULL) printfDebugJava(env, "Found OpenAL Bundle"); else throwException(env, "Could not load OpenAL framework"); } lwjgl-2.7.1/src/native/macosx/org_lwjgl_opengl_MacOSXPeerInfo.m0000644000175000017500000000626211543426510023610 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_MacOSXPeerInfo.m 2985 2008-04-07 18:42:36Z matzon $ * * @author elias_naur * @version $Revision: 2985 $ */ #import #import #import "org_lwjgl_opengl_MacOSXPeerInfo.h" #import "context.h" #import "common_tools.h" JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXPeerInfo_createHandle (JNIEnv *env, jclass clazz) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; jobject handle = newJavaManagedByteBuffer(env, sizeof(MacOSXPeerInfo)); [pool release]; return handle; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPeerInfo_nChoosePixelFormat (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject pixel_format, jboolean use_display_bpp, jboolean support_window, jboolean support_pbuffer, jboolean double_buffered) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); NSOpenGLPixelFormat *macosx_pixel_format = choosePixelFormat(env, pixel_format, use_display_bpp, support_window, support_pbuffer, double_buffered); if (pixel_format == nil) { throwException(env, "Could not find pixel format"); return; } peer_info->pixel_format = macosx_pixel_format; [pool release]; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPeerInfo_nDestroy (JNIEnv *env, jclass clazz, jobject peer_info_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); [peer_info->pixel_format release]; [pool release]; } lwjgl-2.7.1/src/native/macosx/org_lwjgl_opengl_Display.m0000644000175000017500000000602611543426510022471 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_Display.m 3055 2008-04-30 14:58:47Z elias_naur $ * * Mac OS X specific display functions. * * @author elias_naur * @version $Revision: 3055 $ */ #import #import #import #import #import //#import "display.h" #import "common_tools.h" #import "org_lwjgl_opengl_MacOSXDisplay.h" #import "org_lwjgl_MacOSXSysImplementation.h" #define WAIT_DELAY 100 JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion (JNIEnv *env, jobject ignored) { return org_lwjgl_MacOSXSysImplementation_JNI_VERSION; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_restoreGamma(JNIEnv *env, jobject this) { CGDisplayRestoreColorSyncSettings(); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_setGammaRamp(JNIEnv *env, jobject this, jobject gamma_buffer) { const CGGammaValue *values = (*env)->GetDirectBufferAddress(env, gamma_buffer); CGTableCount table_size = (*env)->GetDirectBufferCapacity(env, gamma_buffer); CGDisplayErr err = CGSetDisplayTransferByTable(kCGDirectMainDisplay, table_size, values, values, values); if (err != CGDisplayNoErr) { throwException(env, "Could not set display gamma"); } } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nHideUI(JNIEnv *env, jobject this, jboolean hide) { if (hide == JNI_TRUE) { SetSystemUIMode(kUIModeContentSuppressed, 0); } else { SetSystemUIMode(kUIModeNormal, 0); } } lwjgl-2.7.1/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.m0000644000175000017500000001527311543426510026435 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_MacOSXContextImplementation.m 3116 2008-08-19 16:46:03Z spasi $ * * @author elias_naur * @version $Revision: 3116 $ */ #import #import #import "org_lwjgl_opengl_MacOSXContextImplementation.h" #import "context.h" #import "common_tools.h" typedef struct { NSOpenGLContext *context; } MacOSXContext; JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nCreate (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject attribs, jobject shared_context_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXPeerInfo *peer_info; MacOSXContext *shared_context_info; MacOSXContext *context_info; NSOpenGLContext *context; NSOpenGLContext *shared_context = NULL; jobject context_handle = newJavaManagedByteBuffer(env, sizeof(MacOSXContext)); if (context_handle == NULL) { throwException(env, "Could not create handle buffer"); return NULL; } peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); if (shared_context_handle != NULL) { shared_context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, shared_context_handle); shared_context = shared_context_info->context; } context = [[NSOpenGLContext alloc] initWithFormat:peer_info->pixel_format shareContext:shared_context]; if (context == NULL) { throwException(env, "Could not create context"); return NULL; } context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); context_info->context = context; [pool release]; return context_handle; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nSwapBuffers (JNIEnv *env, jclass clazz, jobject context_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXContext *peer_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); [peer_info->context flushBuffer]; [pool release]; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nUpdate (JNIEnv *env, jclass clazz, jobject context_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); [context_info->context update]; [pool release]; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_clearDrawable (JNIEnv *env, jclass clazz, jobject context_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); [context_info->context clearDrawable]; [pool release]; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nReleaseCurrentContext (JNIEnv *env, jclass clazz) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [NSOpenGLContext clearCurrentContext]; [pool release]; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_setView (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject context_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); if (peer_info->window) { [context_info->context setView: peer_info->nsview]; } else { [context_info->context setPixelBuffer:peer_info->pbuffer cubeMapFace:0 mipMapLevel:0 currentVirtualScreen:0]; } [pool release]; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nMakeCurrent (JNIEnv *env, jclass clazz, jobject context_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); [context_info->context makeCurrentContext]; [pool release]; } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nIsCurrent (JNIEnv *env, jclass clazz, jobject context_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); bool result = context_info->context == [NSOpenGLContext currentContext]; [pool release]; return result ? JNI_TRUE : JNI_FALSE; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nSetSwapInterval (JNIEnv *env, jclass clazz, jobject context_handle, jint int_value) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); GLint value = int_value; [context_info->context setValues:&value forParameter:NSOpenGLCPSwapInterval]; [pool release]; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nDestroy (JNIEnv *env, jclass clazz, jobject context_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); [context_info->context clearDrawable]; [context_info->context release]; [pool release]; } lwjgl-2.7.1/src/native/macosx/org_lwjgl_input_Mouse.c0000644000175000017500000000551311543426510022015 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_input_Mouse.c 2985 2008-04-07 18:42:36Z matzon $ * * Mac OS X mouse handling. * * @author elias_naur * @version $Revision: 2985 $ */ #include #include #include "org_lwjgl_opengl_MacOSXMouseEventQueue.h" #include "common_tools.h" JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_nGrabMouse(JNIEnv *env, jclass unused, jboolean grab) { CGAssociateMouseAndMouseCursorPosition(grab == JNI_TRUE ? FALSE : TRUE); if (grab) CGDisplayHideCursor(kCGDirectMainDisplay); else CGDisplayShowCursor(kCGDirectMainDisplay); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_nWarpCursor(JNIEnv *env, jclass unused, jint x, jint y) { CGPoint p; p.x = x; p.y = y; CGWarpMouseCursorPosition(p); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_getMouseDeltas(JNIEnv *env, jclass unused, jobject delta_buffer) { CGMouseDelta dx, dy; CGGetLastMouseDelta(&dx, &dy); int buffer_length = (*env)->GetDirectBufferCapacity(env, delta_buffer); if (buffer_length != 2) { printfDebugJava(env, "Delta buffer not large enough!"); return; } jint *buffer = (*env)->GetDirectBufferAddress(env, delta_buffer); buffer[0] = dx; buffer[1] = dy; } lwjgl-2.7.1/src/native/macosx/org_lwjgl_opengl_MacOSXPbufferPeerInfo.m0000644000175000017500000000622311543426510025117 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_MacOSXPbufferPeerInfo.m 2985 2008-04-07 18:42:36Z matzon $ * * @author elias_naur * @version $Revision: 2985 $ */ #import #import #import "org_lwjgl_opengl_MacOSXPbufferPeerInfo.h" #import "context.h" #import "common_tools.h" JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPbufferPeerInfo_nCreate(JNIEnv *env, jclass clazz, jobject peer_info_handle, jint width, jint height) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSOpenGLPixelBuffer *pbuffer = nil; // check if the texture is power of 2 if ( (( width > 0 ) && ( width & ( width-1)) == 0) || (( height > 0 ) && ( height & ( height-1)) == 0) ) { pbuffer = [[NSOpenGLPixelBuffer alloc] initWithTextureTarget:GL_TEXTURE_2D textureInternalFormat:GL_RGBA textureMaxMipMapLevel:0 pixelsWide:width pixelsHigh:height]; } else { pbuffer = [[NSOpenGLPixelBuffer alloc] initWithTextureTarget:GL_TEXTURE_RECTANGLE_EXT textureInternalFormat:GL_RGBA textureMaxMipMapLevel:0 pixelsWide:width pixelsHigh:height]; } MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); peer_info->pbuffer = pbuffer; peer_info->window = false; [pool release]; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPbufferPeerInfo_nDestroy (JNIEnv *env, jclass clazz, jobject peer_info_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); [peer_info->pbuffer release]; [pool release]; } lwjgl-2.7.1/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m0000644000175000017500000000477211543426510024750 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_MacOSXCanvasPeerInfo.m 2985 2008-04-07 18:42:36Z matzon $ * * @author elias_naur * @version $Revision: 2985 $ */ #include #include #include "awt_tools.h" #include "org_lwjgl_opengl_MacOSXCanvasPeerInfo.h" #include "context.h" #include "common_tools.h" JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nInitHandle (JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject peer_info_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); AWTSurfaceLock *surface = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); JAWT_MacOSXDrawingSurfaceInfo *macosx_dsi = (JAWT_MacOSXDrawingSurfaceInfo *)surface->dsi->platformInfo; peer_info->nsview = macosx_dsi->cocoaViewRef; peer_info->window = true; [pool release]; } lwjgl-2.7.1/src/native/macosx/macosx_cl.c0000644000175000017500000000776311543426510017421 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include #include #include #include #include #include #include "extcl.h" #include "common_tools.h" /** * OpenCL library management */ static const struct mach_header* handleOCL = NULL; static CFBundleRef opencl_bundle = NULL; void *extcl_NativeGetFunctionPointer(const char *function) { void *address = NULL; if (handleOCL != NULL) { char *mac_symbol_name = (char *)malloc((strlen(function) + 2)*sizeof(char)); if (mac_symbol_name == NULL) return NULL; mac_symbol_name[0] = '_'; strcpy(&(mac_symbol_name[1]), function); NSSymbol symbol = NSLookupSymbolInImage(handleOCL, mac_symbol_name, NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); free(mac_symbol_name); if (symbol != NULL) { address = NSAddressOfSymbol(symbol); } } else if (opencl_bundle != NULL) { CFStringRef cf_function = CFStringCreateWithCString(NULL, function, kCFStringEncodingUTF8); address = CFBundleGetFunctionPointerForName(opencl_bundle, cf_function); CFRelease(cf_function); } return address; } static CFBundleRef tryLoadFramework(JNIEnv *env) { CFStringRef framework_path = CFSTR("/System/Library/Frameworks/OpenCL.framework"); if (framework_path == NULL) { printfDebugJava(env, "Failed to allocate string"); return NULL; } CFURLRef url = CFURLCreateWithFileSystemPath(NULL, framework_path, kCFURLPOSIXPathStyle, TRUE); if (url == NULL) { printfDebugJava(env, "Failed to allocate URL"); return NULL; } CFBundleRef opencl_bundle = CFBundleCreate(NULL, url); CFRelease(url); return opencl_bundle; } void extcl_LoadLibrary(JNIEnv *env, jstring path) { const char *path_str = (*env)->GetStringUTFChars(env, path, NULL); printfDebugJava(env, "Testing '%s'", path_str); handleOCL = NSAddImage(path_str, NSADDIMAGE_OPTION_RETURN_ON_ERROR); if (handleOCL != NULL) { printfDebugJava(env, "Found OpenCL at '%s'", path_str); } else { throwException(env, "Could not load OpenCL library"); } (*env)->ReleaseStringUTFChars(env, path, path_str); } /** * Unloads the OpenCL Library */ void extcl_UnloadLibrary() { if (opencl_bundle != NULL) { CFRelease(opencl_bundle); opencl_bundle = NULL; } } JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nCreateDefault(JNIEnv *env, jclass clazz) { opencl_bundle = tryLoadFramework(env); if (opencl_bundle != NULL) printfDebugJava(env, "Found OpenCL Bundle"); else throwException(env, "Could not load OpenCL framework"); } lwjgl-2.7.1/src/native/macosx/context.h0000644000175000017500000000426311543426510017132 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: context.h 2985 2008-04-07 18:42:36Z matzon $ * * Base Win32 display * * @author cix_foo * @version $Revision: 2985 $ */ #ifndef __LWJGL_CONTEXT_H #define __LWJGL_CONTEXT_H #include #include #include #include "common_tools.h" typedef struct { NSOpenGLPixelFormat *pixel_format; bool window; union { NSView *nsview; NSOpenGLPixelBuffer *pbuffer; }; } MacOSXPeerInfo; NSOpenGLPixelFormat *choosePixelFormat(JNIEnv *env, jobject pixel_format, bool use_display_bpp, bool support_window, bool support_pbuffer, bool double_buffered); #endif lwjgl-2.7.1/src/native/linux/0000755000175000017500000000000011543426510015135 5ustar zero79zero79lwjgl-2.7.1/src/native/linux/org_lwjgl_opengl_LinuxMouse.c0000644000175000017500000001050511543426510023024 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_input_Keyboard.c 2399 2006-06-30 19:28:00Z elias_naur $ * * Linux mouse handling. * * @author elias_naur * @version $Revision: 2399 $ */ #include #include #include #include "common_tools.h" #include "org_lwjgl_opengl_LinuxMouse.h" static void getWindowAttributes(jlong display_ptr, jlong window_ptr, XWindowAttributes *attr) { Display *disp = (Display *)(intptr_t)display_ptr; Window win = (Window)window_ptr; XGetWindowAttributes(disp, win, attr); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxMouse_nGetWindowHeight(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { XWindowAttributes window_attributes; getWindowAttributes(display_ptr, window_ptr, &window_attributes); return window_attributes.height; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxMouse_nGetWindowWidth(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { XWindowAttributes window_attributes; getWindowAttributes(display_ptr, window_ptr, &window_attributes); return window_attributes.width; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxMouse_nWarpCursor(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jint x, jint y) { Display *disp = (Display *)(intptr_t)display_ptr; Window win = (Window)window_ptr; XWarpPointer(disp, None, win, 0, 0, 0, 0, x, y); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxMouse_nQueryPointer(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jobject result_buffer) { Display *disp = (Display *)(intptr_t)display_ptr; Window win = (Window)window_ptr; Window root_return, child_return; int root_x, root_y, win_x, win_y; unsigned int mask_return; jint *result = (jint *)(*env)->GetDirectBufferAddress(env, result_buffer); int result_size = (*env)->GetDirectBufferCapacity(env, result_buffer); if (result_size < 4) { throwFormattedException(env, "Not enough space in result buffer (%d)", result_size); return (intptr_t)NULL; } XQueryPointer(disp, win, &root_return, &child_return, &root_x, &root_y, &win_x, &win_y, &mask_return); result[0] = root_x; result[1] = root_y; result[2] = win_x; result[3] = win_y; return root_return; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxMouse_nSendWarpEvent(JNIEnv *env, jclass unusued, jlong display_ptr, jlong window_ptr, jlong warp_atom_ptr, jint x, jint y) { Atom warp_atom = (Atom)warp_atom_ptr; Display *disp = (Display *)(intptr_t)display_ptr; Window win = (Window)window_ptr; XEvent warp_event; warp_event.type = ClientMessage; warp_event.xclient.window = win; warp_event.xclient.message_type = warp_atom; warp_event.xclient.format = 32; warp_event.xclient.data.l[0] = x; warp_event.xclient.data.l[1] = y; XSendEvent(disp, win, False, 0, &warp_event); } lwjgl-2.7.1/src/native/linux/context.c0000644000175000017500000004207011543426510016770 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: context.c 3357 2010-06-02 23:35:38Z spasi $ * * Include file to access public window features * * @author elias_naur * @version $Revision: 3357 $ */ #include #include #include #include #include "extgl_glx.h" #include "context.h" XVisualInfo *getVisualInfoFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info) { XVisualInfo *vis_info; if (!peer_info->glx13) { XVisualInfo template; template.visualid = peer_info->config.glx_config.visualid; template.depth = peer_info->config.glx_config.depth; template.screen = peer_info->screen; int num_infos; vis_info = XGetVisualInfo(peer_info->display, VisualIDMask | VisualScreenMask | VisualDepthMask, &template, &num_infos); if (vis_info == NULL) { throwException(env, "Could not find VisualInfo from peer info"); return NULL; } // Check the assumption from GLX 1.3 docs that a VisualInfo is uniquely identified by its // {VisualID, screen, depth} tuple if (num_infos != 1) { XFree(vis_info); throwException(env, "No unique VisualInfo matches peer info"); return NULL; } } else { GLXFBConfig *configs = getFBConfigFromPeerInfo(env, peer_info); if (configs == NULL) return NULL; vis_info = lwjgl_glXGetVisualFromFBConfig(peer_info->display, configs[0]); if (vis_info == NULL) throwException(env, "Could not get VisualInfo from GLX 1.3 config"); XFree(configs); } return vis_info; } GLXFBConfig *getFBConfigFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info) { int attribs[] = {GLX_FBCONFIG_ID, peer_info->config.glx13_config.config_id, None, None}; int num_elements; GLXFBConfig *configs = lwjgl_glXChooseFBConfig(peer_info->display, peer_info->screen, attribs, &num_elements); if (configs == NULL) { throwException(env, "Could not find GLX 1.3 config from peer info"); return NULL; } // Check that only one FBConfig matches the config id if (num_elements != 1) { XFree(configs); throwException(env, "No unique GLX 1.3 config matches peer info"); return NULL; } return configs; } static int convertToBPE(int bpp) { int bpe; switch (bpp) { case 0: bpe = 0; break; case 32: case 24: bpe = 8; break; case 16: /* Fall through */ default: bpe = 4; break; } return bpe; } static GLXFBConfig *chooseVisualGLX13FromBPP(JNIEnv *env, Display *disp, int screen, jobject pixel_format, int bpp, int drawable_type, bool double_buffer) { jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); bool floating_point_packed = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); int bpe = convertToBPE(bpp); int accum_bpe = convertToBPE(accum_bpp); attrib_list_t attrib_list; initAttribList(&attrib_list); int render_type; if ( floating_point ) render_type = GLX_RGBA_FLOAT_BIT; else if ( floating_point_packed ) render_type = GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT; else render_type = GLX_RGBA_BIT; putAttrib(&attrib_list, GLX_RENDER_TYPE); putAttrib(&attrib_list, render_type); putAttrib(&attrib_list, GLX_DOUBLEBUFFER); putAttrib(&attrib_list, double_buffer ? True : False); putAttrib(&attrib_list, GLX_DRAWABLE_TYPE); putAttrib(&attrib_list, drawable_type); putAttrib(&attrib_list, GLX_DEPTH_SIZE); putAttrib(&attrib_list, depth); putAttrib(&attrib_list, GLX_RED_SIZE); putAttrib(&attrib_list, bpe); putAttrib(&attrib_list, GLX_GREEN_SIZE); putAttrib(&attrib_list, bpe); putAttrib(&attrib_list, GLX_BLUE_SIZE); putAttrib(&attrib_list, bpe); putAttrib(&attrib_list, GLX_ALPHA_SIZE); putAttrib(&attrib_list, alpha); putAttrib(&attrib_list, GLX_STENCIL_SIZE); putAttrib(&attrib_list, stencil); putAttrib(&attrib_list, GLX_AUX_BUFFERS); putAttrib(&attrib_list, num_aux_buffers); putAttrib(&attrib_list, GLX_ACCUM_RED_SIZE); putAttrib(&attrib_list, accum_bpe); putAttrib(&attrib_list, GLX_ACCUM_GREEN_SIZE); putAttrib(&attrib_list, accum_bpe); putAttrib(&attrib_list, GLX_ACCUM_BLUE_SIZE); putAttrib(&attrib_list, accum_bpe); putAttrib(&attrib_list, GLX_ACCUM_ALPHA_SIZE); putAttrib(&attrib_list, accum_alpha); if (stereo) { putAttrib(&attrib_list, GLX_STEREO); putAttrib(&attrib_list, True); } // Assume the caller has checked support for multisample if (samples > 0) { putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); // GLX_COVERAGE_SAMPLES_NV if colorSamples > 0 if ( colorSamples > 0 ) { putAttrib(&attrib_list, GLX_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples); } } if (sRGB) { putAttrib(&attrib_list, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB); putAttrib(&attrib_list, True); } putAttrib(&attrib_list, None); putAttrib(&attrib_list, None); int num_formats = 0; GLXFBConfig* configs = lwjgl_glXChooseFBConfig(disp, screen, attrib_list.attribs, &num_formats); if (num_formats > 0) { return configs; } else { if (configs != NULL) XFree(configs); return NULL; } } GLXFBConfig *chooseVisualGLX13(JNIEnv *env, Display *disp, int screen, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffer) { jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); int bpp; if (use_display_bpp) { bpp = XDefaultDepthOfScreen(XScreenOfDisplay(disp, screen)); GLXFBConfig *configs = chooseVisualGLX13FromBPP(env, disp, screen, pixel_format, bpp, drawable_type, double_buffer); if (configs != NULL) return configs; else bpp = 16; } else bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); return chooseVisualGLX13FromBPP(env, disp, screen, pixel_format, bpp, drawable_type, double_buffer); } static XVisualInfo *chooseVisualGLXFromBPP(JNIEnv *env, Display *disp, int screen, jobject pixel_format, int bpp, bool double_buffer) { jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); int bpe = convertToBPE(bpp); int accum_bpe = convertToBPE(accum_bpp); attrib_list_t attrib_list; initAttribList(&attrib_list); putAttrib(&attrib_list, GLX_RGBA); putAttrib(&attrib_list, GLX_DOUBLEBUFFER); putAttrib(&attrib_list, GLX_DEPTH_SIZE); putAttrib(&attrib_list, depth); putAttrib(&attrib_list, GLX_RED_SIZE); putAttrib(&attrib_list, bpe); putAttrib(&attrib_list, GLX_GREEN_SIZE); putAttrib(&attrib_list, bpe); putAttrib(&attrib_list, GLX_BLUE_SIZE); putAttrib(&attrib_list, bpe); putAttrib(&attrib_list, GLX_ALPHA_SIZE); putAttrib(&attrib_list, alpha); putAttrib(&attrib_list, GLX_STENCIL_SIZE); putAttrib(&attrib_list, stencil); putAttrib(&attrib_list, GLX_AUX_BUFFERS); putAttrib(&attrib_list, num_aux_buffers); putAttrib(&attrib_list, GLX_ACCUM_RED_SIZE); putAttrib(&attrib_list, accum_bpe); putAttrib(&attrib_list, GLX_ACCUM_GREEN_SIZE); putAttrib(&attrib_list, accum_bpe); putAttrib(&attrib_list, GLX_ACCUM_BLUE_SIZE); putAttrib(&attrib_list, accum_bpe); putAttrib(&attrib_list, GLX_ACCUM_ALPHA_SIZE); putAttrib(&attrib_list, accum_alpha); if (stereo) putAttrib(&attrib_list, GLX_STEREO); // Assume the caller has checked support for multisample if (samples > 0) { putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); // GLX_COVERAGE_SAMPLES_NV if colorSamples > 0 if ( colorSamples > 0 ) putAttrib(&attrib_list, GLX_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples); } if (sRGB) putAttrib(&attrib_list, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB); putAttrib(&attrib_list, None); return lwjgl_glXChooseVisual(disp, screen, attrib_list.attribs); } XVisualInfo *chooseVisualGLX(JNIEnv *env, Display *disp, int screen, jobject pixel_format, bool use_display_bpp, bool double_buffer) { jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); int bpp; if (use_display_bpp) { bpp = XDefaultDepthOfScreen(XScreenOfDisplay(disp, screen)); XVisualInfo *vis_info = chooseVisualGLXFromBPP(env, disp, screen, pixel_format, bpp, double_buffer); if (vis_info != NULL) return vis_info; else bpp = 16; } else bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); return chooseVisualGLXFromBPP(env, disp, screen, pixel_format, bpp, double_buffer); } static void dumpVisualInfo(JNIEnv *env, Display *display, GLXExtensions *extension_flags, XVisualInfo *vis_info) { int alpha, depth, stencil, r, g, b; int sample_buffers = 0; int samples = 0; lwjgl_glXGetConfig(display, vis_info, GLX_RED_SIZE, &r); lwjgl_glXGetConfig(display, vis_info, GLX_GREEN_SIZE, &g); lwjgl_glXGetConfig(display, vis_info, GLX_BLUE_SIZE, &b); lwjgl_glXGetConfig(display, vis_info, GLX_ALPHA_SIZE, &alpha); lwjgl_glXGetConfig(display, vis_info, GLX_DEPTH_SIZE, &depth); lwjgl_glXGetConfig(display, vis_info, GLX_STENCIL_SIZE, &stencil); if (extension_flags->GLX_ARB_multisample) { lwjgl_glXGetConfig(display, vis_info, GLX_SAMPLE_BUFFERS_ARB, &sample_buffers); lwjgl_glXGetConfig(display, vis_info, GLX_SAMPLES_ARB, &samples); } printfDebugJava(env, "Pixel format info: r = %d, g = %d, b = %d, a = %d, depth = %d, stencil = %d, sample buffers = %d, samples = %d", r, g, b, alpha, depth, stencil, sample_buffers, samples); } bool initPeerInfo(JNIEnv *env, jobject peer_info_handle, Display *display, int screen, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffered, bool force_glx13) { if ((*env)->GetDirectBufferCapacity(env, peer_info_handle) < sizeof(X11PeerInfo)) { throwException(env, "Handle too small"); return false; } X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); GLXExtensions extension_flags; if (!extgl_InitGLX(display, screen, &extension_flags)) { throwException(env, "Could not init GLX"); return false; } if (!extension_flags.GLX13 && force_glx13) { throwException(env, "GLX13 is required, but is not available"); return false; } jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); if (samples > 0 && !extension_flags.GLX_ARB_multisample) { throwException(env, "Samples > 0 specified but there's no support for GLX_ARB_multisample"); return false; } int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); if (colorSamples > 0 && !extension_flags.GLX_NV_multisample_coverage) { throwException(env, "Color samples > 0 specified but there's no support for GLX_NV_multisample_coverage"); return false; } bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); if (floating_point && !(extension_flags.GLX13 && extension_flags.GLX_ARB_fbconfig_float)) { // We need GLX13 to support floating point throwException(env, "Floating point specified but there's no support for GLX_ARB_fbconfig_float"); return false; } bool floating_point_packed = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); if (floating_point_packed && !(extension_flags.GLX13 && extension_flags.GLX_EXT_fbconfig_packed_float)) { // We need GLX13 to support packed floating point throwException(env, "Packed floating point specified but there's no support for GLX_EXT_fbconfig_packed_float"); return false; } bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); if (sRGB && !extension_flags.GLX_ARB_framebuffer_sRGB) { throwException(env, "sRGB specified but there's no support for GLX_ARB_framebuffer_sRGB"); return false; } peer_info->glx13 = extension_flags.GLX13; if (peer_info->glx13) { GLXFBConfig *configs = chooseVisualGLX13(env, display, screen, pixel_format, use_display_bpp, drawable_type, double_buffered); if (configs == NULL) { throwException(env, "Could not choose GLX13 config"); return false; } if (isDebugEnabled()) { XVisualInfo *vis_info = lwjgl_glXGetVisualFromFBConfig(display, configs[0]); if (vis_info != NULL) { dumpVisualInfo(env, display, &extension_flags, vis_info); XFree(vis_info); } } int config_id; int result = lwjgl_glXGetFBConfigAttrib(display, configs[0], GLX_FBCONFIG_ID, &config_id); XFree(configs); if (result != Success) { throwException(env, "Could not get GLX_FBCONFIG_ID from GLXFBConfig"); return false; } peer_info->config.glx13_config.config_id = config_id; } else { XVisualInfo *vis_info = chooseVisualGLX(env, display, screen, pixel_format, use_display_bpp, double_buffered); if (vis_info == NULL) { throwException(env, "Could not choose visual"); return false; } peer_info->config.glx_config.visualid = vis_info->visualid; peer_info->config.glx_config.depth = vis_info->depth; peer_info->screen = vis_info->screen; if (isDebugEnabled()) dumpVisualInfo(env, display, &extension_flags, vis_info); XFree(vis_info); } peer_info->display = display; peer_info->screen = screen; peer_info->drawable = None; return true; } lwjgl-2.7.1/src/native/linux/org_lwjgl_input_Cursor.c0000644000175000017500000001142111543426510022042 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_input_Cursor.c 2985 2008-04-07 18:42:36Z matzon $ * * Linux cursor handling. * * @author elias_naur * @version $Revision: 2985 $ */ #include #include #include #include "org_lwjgl_input_Cursor.h" #include "org_lwjgl_opengl_LinuxDisplay.h" #include "common_tools.h" JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetNativeCursorCapabilities (JNIEnv *env, jclass clazz, jlong display) { Display *disp = (Display *)(intptr_t)display; int caps = 0; XcursorBool argb_supported = XcursorSupportsARGB(disp); XcursorBool anim_supported = XcursorSupportsAnim(disp); if (argb_supported) caps |= org_lwjgl_input_Cursor_CURSOR_8_BIT_ALPHA | org_lwjgl_input_Cursor_CURSOR_ONE_BIT_TRANSPARENCY; if (anim_supported) caps |= org_lwjgl_input_Cursor_CURSOR_ANIMATION; return caps; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetMinCursorSize (JNIEnv *env, jclass clazz, jlong display, jlong window_ptr) { Display *disp = (Display *)(intptr_t)display; Window window = (Window)window_ptr; unsigned int width_return = 0; unsigned int height_return = 0; XQueryBestCursor(disp, window, 1, 1, &width_return, &height_return); return width_return > height_return ? width_return : height_return; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetMaxCursorSize (JNIEnv *env, jclass clazz, jlong display, jlong window_ptr) { Display *disp = (Display *)(intptr_t)display; Window window = (Window)window_ptr; unsigned int width_return = 0; unsigned int height_return = 0; XQueryBestCursor(disp, window, 0xffffffff, 0xffffffff, &width_return, &height_return); return width_return > height_return ? height_return : width_return; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateCursor (JNIEnv *env, jclass clazz, jlong display, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset) { Display *disp = (Display *)(intptr_t)display; const int *delays = NULL; if (delay_buffer != NULL) delays = (const int *)(*env)->GetDirectBufferAddress(env, delay_buffer) + delays_offset; XcursorPixel *pixels = (XcursorPixel *)(*env)->GetDirectBufferAddress(env, image_buffer) + images_offset; int stride = width*height; XcursorImages *cursor_images = XcursorImagesCreate(num_images); if (cursor_images == NULL) { throwException(env, "Could not allocate cursor."); return None; } cursor_images->nimage = num_images; int i; for (i = 0; i < num_images; i++) { XcursorImage *cursor_image = XcursorImageCreate(width, height); cursor_image->xhot = x_hotspot; cursor_image->yhot = y_hotspot; cursor_image->pixels = &(pixels[stride*i]); if (num_images > 1) cursor_image->delay = delays[i]; cursor_images->images[i] = cursor_image; } Cursor cursor = XcursorImagesLoadCursor(disp, cursor_images); XcursorImagesDestroy(cursor_images); return cursor; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyCursor (JNIEnv *env, jclass clazz, jlong display, jlong cursor_ptr) { Display *disp = (Display *)(intptr_t)display; Cursor cursor = (Cursor)cursor_ptr; XFreeCursor(disp, cursor); } lwjgl-2.7.1/src/native/linux/org_lwjgl_opengl_LinuxContextImplementation.c0000644000175000017500000002065611543426510026276 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_LinuxContextImplementation.c 3412 2010-09-26 23:43:24Z spasi $ * * @author elias_naur * @version $Revision: 3412 $ */ #include #include #include #include #include "org_lwjgl_opengl_LinuxContextImplementation.h" #include "extgl_glx.h" #include "context.h" #include "common_tools.h" typedef struct { GLXExtensions extension_flags; GLXContext context; } X11Context; static bool checkContext(JNIEnv *env, Display *display, GLXContext context) { if (context == NULL) { throwException(env, "Could not create GLX context"); return false; } /* * Ditched the requirement that contexts have to be direct. It was * never true that all accelerated contexts are direct, but it * was a reasonable test until the appearance of Xgl and AIGLX. * Now the test is at best useless, and at worst wrong, * in case the current X server accelerates indirect rendering. */ /* jboolean allow_software_acceleration = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); if (!allow_software_acceleration && lwjgl_glXIsDirect(display, context) == False) { lwjgl_glXDestroyContext(display, context); throwException(env, "Could not create a direct GLX context"); return false; }*/ return true; } static void createContextGLX13(JNIEnv *env, X11PeerInfo *peer_info, X11Context *context_info, jobject attribs, GLXContext shared_context) { GLXFBConfig *config = getFBConfigFromPeerInfo(env, peer_info); if (config == NULL) return; GLXContext context; if (attribs) { const int *attrib_list = (const int *)(*env)->GetDirectBufferAddress(env, attribs); context = lwjgl_glXCreateContextAttribsARB(peer_info->display, *config, shared_context, True, attrib_list); } else { int render_type; if (lwjgl_glXGetFBConfigAttrib(peer_info->display, *config, GLX_RENDER_TYPE, &render_type) != 0) { throwException(env, "Could not get GLX_RENDER_TYPE attribute"); return; } int context_render_type = (render_type & GLX_RGBA_FLOAT_BIT) != 0 ? GLX_RGBA_FLOAT_TYPE : GLX_RGBA_TYPE; context = lwjgl_glXCreateNewContext(peer_info->display, *config, context_render_type, shared_context, True); } XFree(config); if (!checkContext(env, peer_info->display, context)) return; context_info->context = context; } static void createContextGLX(JNIEnv *env, X11PeerInfo *peer_info, X11Context *context_info, GLXContext shared_context) { XVisualInfo *vis_info = getVisualInfoFromPeerInfo(env, peer_info); if (vis_info == NULL) return; GLXContext context = lwjgl_glXCreateContext(peer_info->display, vis_info, shared_context, True); XFree(vis_info); if (!checkContext(env, peer_info->display, context)) return; context_info->context = context; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_getGLXContext(JNIEnv *env, jclass clazz, jobject context_handle) { X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); return (intptr_t)context_info->context; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_getDisplay(JNIEnv *env, jclass clazz, jobject peer_info_handle) { X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); return (intptr_t)peer_info->display; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nSetSwapInterval (JNIEnv *env, jclass clazz, jobject context_handle, jint value) { X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); if (context_info->extension_flags.GLX_SGI_swap_control) { lwjgl_glXSwapIntervalSGI(value); } } JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nCreate (JNIEnv *env , jclass clazz, jobject peer_handle, jobject attribs, jobject shared_context_handle) { jobject context_handle = newJavaManagedByteBuffer(env, sizeof(X11Context)); if (context_handle == NULL) { throwException(env, "Could not allocate handle buffer"); return NULL; } X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_handle); X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); GLXExtensions extension_flags; if (!extgl_InitGLX(peer_info->display, peer_info->screen, &extension_flags)) { throwException(env, "Could not initialize GLX"); return NULL; } GLXContext shared_context = NULL; if (shared_context_handle != NULL) { X11Context *shared_context_info = (*env)->GetDirectBufferAddress(env, shared_context_handle); shared_context = shared_context_info->context; } if (peer_info->glx13) { createContextGLX13(env, peer_info, context_info, extension_flags.GLX_ARB_create_context ? attribs : NULL, shared_context); } else { createContextGLX(env, peer_info, context_info, shared_context); } context_info->extension_flags = extension_flags; return context_handle; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nDestroy (JNIEnv *env, jclass clazz, jobject peer_handle, jobject context_handle) { X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_handle); X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); lwjgl_glXDestroyContext(peer_info->display, context_info->context); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nReleaseCurrentContext (JNIEnv *env , jclass clazz, jobject peer_info_handle) { X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); Bool result; if (peer_info->glx13) { result = lwjgl_glXMakeContextCurrent(peer_info->display, None, None, NULL); } else { result = lwjgl_glXMakeCurrent(peer_info->display, None, NULL); } if (!result) throwException(env, "Could not release current context"); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nMakeCurrent (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject context_handle) { X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); Bool result; if (peer_info->glx13) { result = lwjgl_glXMakeContextCurrent(peer_info->display, peer_info->drawable, peer_info->drawable, context_info->context); } else { result = lwjgl_glXMakeCurrent(peer_info->display, peer_info->drawable, context_info->context); } if (!result) throwException(env, "Could not make context current"); } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nIsCurrent (JNIEnv *env, jclass clazz, jobject context_handle) { X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); return context_info->context == lwjgl_glXGetCurrentContext(); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nSwapBuffers (JNIEnv *env, jclass clazz, jobject peer_info_handle) { X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); lwjgl_glXSwapBuffers(peer_info->display, peer_info->drawable); } lwjgl-2.7.1/src/native/linux/org_lwjgl_opengl_Pbuffer.c0000644000175000017500000000730011543426510022304 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_Pbuffer.c 3358 2010-06-03 15:49:26Z spasi $ * * Linux Pbuffer. * * @author elias_naur * @version $Revision: 3358 $ */ #include #include "org_lwjgl_opengl_LinuxPbufferPeerInfo.h" #include "org_lwjgl_opengl_Pbuffer.h" #include "extgl.h" #include "context.h" #include "common_tools.h" JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetPbufferCapabilities (JNIEnv *env, jclass clazz, jlong display, jint screen) { Display *disp = (Display *)(intptr_t)display; GLXExtensions extension_flags; if (!extgl_InitGLX(disp, screen, &extension_flags)) return 0; // Only support the GLX 1.3 Pbuffers and ignore the GLX_SGIX_pbuffer extension return extension_flags.GLX13 ? org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED : 0; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxPbufferPeerInfo_nInitHandle (JNIEnv *env, jclass clazz, jlong display, jint screen, jobject peer_info_handle, jint width, jint height, jobject pixel_format) { Display *disp = (Display *)(intptr_t)display; GLXExtensions extension_flags; if (!extgl_InitGLX(disp, screen, &extension_flags) || !extension_flags.GLX13) { throwException(env, "No Pbuffer support"); return; } bool result = initPeerInfo(env, peer_info_handle, disp, screen, pixel_format, false, GLX_PBUFFER_BIT, false, true); if (!result) return; const int buffer_attribs[] = {GLX_PBUFFER_WIDTH, width, GLX_PBUFFER_HEIGHT, height, GLX_PRESERVED_CONTENTS, True, GLX_LARGEST_PBUFFER, False, None, None}; X11PeerInfo *peer_info = (X11PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); GLXFBConfig *config = getFBConfigFromPeerInfo(env, peer_info); if (config != NULL) { GLXPbuffer buffer = lwjgl_glXCreatePbuffer(peer_info->display, *config, buffer_attribs); XFree(config); peer_info->drawable = buffer; } } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxPbufferPeerInfo_nDestroy (JNIEnv *env, jclass clazz, jobject peer_info_handle) { X11PeerInfo *peer_info = (X11PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); lwjgl_glXDestroyPbuffer(peer_info->display, peer_info->drawable); } lwjgl-2.7.1/src/native/linux/lwjgl.map0000644000175000017500000000010111543426510016743 0ustar zero79zero79{ global: Java_*; JNI_OnLoad; JNI_OnUnload; local: *; }; lwjgl-2.7.1/src/native/linux/linux_cl.c0000644000175000017500000000436211543426510017123 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include #include #include "extcl.h" #include "common_tools.h" #include static void* handleOCL; void *extcl_NativeGetFunctionPointer(const char *function) { return dlsym(handleOCL, function); } void extcl_LoadLibrary(JNIEnv *env, jstring path) { char *path_str = GetStringNativeChars(env, path); printfDebugJava(env, "Testing '%s'", path_str); handleOCL = dlopen(path_str, RTLD_LAZY); if (handleOCL != NULL) { printfDebugJava(env, "Found OpenCL at '%s'", path_str); } else { throwException(env, "Could not load OpenCL library"); } free(path_str); } void extcl_UnloadLibrary() { if (handleOCL != NULL) { dlclose(handleOCL); handleOCL = NULL; } } lwjgl-2.7.1/src/native/linux/org_lwjgl_opengl_Display.c0000644000175000017500000005473211543426510022333 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_Display.c 3453 2010-10-28 21:39:55Z kappa1 $ * * Linux specific display functions. * * @author elias_naur * @version $Revision: 3453 $ */ #include #include #include #include #include #include #include #include #include #include "common_tools.h" #include "extgl.h" #include "extgl_glx.h" #include "context.h" #include "org_lwjgl_opengl_LinuxDisplay.h" #include "org_lwjgl_opengl_LinuxDisplayPeerInfo.h" #include "org_lwjgl_LinuxSysImplementation.h" #define ERR_MSG_SIZE 1024 typedef struct { unsigned long flags; unsigned long functions; unsigned long decorations; long input_mode; unsigned long status; } MotifWmHints; #define MWM_HINTS_DECORATIONS (1L << 1) static GLXWindow glx_window = None; static Colormap cmap; static int current_depth; static Pixmap current_icon_pixmap; static Pixmap current_icon_mask_pixmap; static Visual *current_visual; static bool checkXError(JNIEnv *env, Display *disp) { XSync(disp, False); return (*env)->ExceptionCheck(env) == JNI_FALSE; } static int global_error_handler(Display *disp, XErrorEvent *error) { JNIEnv *env = getThreadEnv(); if (env != NULL) { jclass org_lwjgl_LinuxDisplay_class = (*env)->FindClass(env, "org/lwjgl/opengl/LinuxDisplay"); if (org_lwjgl_LinuxDisplay_class == NULL) { // Don't propagate error (*env)->ExceptionClear(env); return 0; } jmethodID handler_method = (*env)->GetStaticMethodID(env, org_lwjgl_LinuxDisplay_class, "globalErrorHandler", "(JJJJJJJ)I"); if (handler_method == NULL) return 0; return (*env)->CallStaticIntMethod(env, org_lwjgl_LinuxDisplay_class, handler_method, (jlong)(intptr_t)disp, (jlong)(intptr_t)error, (jlong)(intptr_t)error->display, (jlong)error->serial, (jlong)error->error_code, (jlong)error->request_code, (jlong)error->minor_code); } else return 0; } static jlong openDisplay(JNIEnv *env) { Display *display_connection = XOpenDisplay(NULL); if (display_connection == NULL) { throwException(env, "Could not open X display connection"); return (intptr_t)NULL; } return (intptr_t)display_connection; } JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion (JNIEnv *env, jobject ignored) { return org_lwjgl_LinuxSysImplementation_JNI_VERSION; } JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getErrorText(JNIEnv *env, jclass unused, jlong display_ptr, jlong error_code) { Display *disp = (Display *)(intptr_t)display_ptr; char err_msg_buffer[ERR_MSG_SIZE]; XGetErrorText(disp, error_code, err_msg_buffer, ERR_MSG_SIZE); err_msg_buffer[ERR_MSG_SIZE - 1] = '\0'; return NewStringNativeWithLength(env, err_msg_buffer, strlen(err_msg_buffer)); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_callErrorHandler(JNIEnv *env, jclass unused, jlong handler_ptr, jlong display_ptr, jlong event_ptr) { XErrorHandler handler = (XErrorHandler)(intptr_t)handler_ptr; Display *disp = (Display *)(intptr_t)display_ptr; XErrorEvent *event = (XErrorEvent *)(intptr_t)event_ptr; return (jint)handler(disp, event); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setErrorHandler(JNIEnv *env, jclass unused) { return (intptr_t)XSetErrorHandler(global_error_handler); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_resetErrorHandler(JNIEnv *env, jclass unused, jlong handler_ptr) { XErrorHandler handler = (XErrorHandler)(intptr_t)handler_ptr; return (intptr_t)XSetErrorHandler(handler); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_sync(JNIEnv *env, jclass unused, jlong display_ptr, jboolean throw_away_events) { Display *disp = (Display *)(intptr_t)display_ptr; XSync(disp, throw_away_events ? True : False); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetDefaultScreen(JNIEnv *env, jclass unused, jlong display_ptr) { Display *disp = (Display *)(intptr_t)display_ptr; return XDefaultScreen(disp); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nInternAtom(JNIEnv *env, jclass unused, jlong display_ptr, jstring atom_name_obj, jboolean only_if_exists) { Display *disp = (Display *)(intptr_t)display_ptr; char *atom_name = GetStringNativeChars(env, atom_name_obj); if (atom_name == NULL) return 0; Atom atom = XInternAtom(disp, atom_name, only_if_exists ? True : False); free(atom_name); return atom; } static void setDecorations(Display *disp, Window window, int dec) { Atom motif_hints_atom = XInternAtom(disp, "_MOTIF_WM_HINTS", False); MotifWmHints motif_hints; motif_hints.flags = MWM_HINTS_DECORATIONS; motif_hints.decorations = dec; XChangeProperty(disp, window, motif_hints_atom, motif_hints_atom, 32, PropModeReplace, (unsigned char *)&motif_hints, sizeof(MotifWmHints)/sizeof(long)); } static bool isLegacyFullscreen(jint window_mode) { return window_mode == org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_LEGACY; } static void setWindowTitle(Display *disp, Window window, const char *title) { XStoreName(disp, window, title); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_openDisplay(JNIEnv *env, jclass clazz) { return openDisplay(env); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_closeDisplay(JNIEnv *env, jclass clazz, jlong display) { Display *disp = (Display *)(intptr_t)display; XCloseDisplay(disp); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDrawable(JNIEnv *env, jclass clazz, jlong window, jobject peer_info_handle) { X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); if (peer_info->glx13) peer_info->drawable = glx_window; else peer_info->drawable = window; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDefaultPeerInfo(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject peer_info_handle, jobject pixel_format) { Display *disp = (Display *)(intptr_t)display; initPeerInfo(env, peer_info_handle, disp, screen, pixel_format, true, GLX_WINDOW_BIT, true, false); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetTitle(JNIEnv * env, jclass clazz, jlong display, jlong window_ptr, jstring title_obj) { Display *disp = (Display *)(intptr_t)display; Window window = (Window)window_ptr; char * title = GetStringNativeChars(env, title_obj); setWindowTitle(disp, window, title); free(title); } static void freeIconPixmap(Display *disp) { if (current_icon_mask_pixmap != 0) { XFreePixmap(disp, current_icon_mask_pixmap); current_icon_mask_pixmap = 0; } if (current_icon_pixmap != 0) { XFreePixmap(disp, current_icon_pixmap); current_icon_pixmap = 0; } } static void destroyWindow(JNIEnv *env, Display *disp, Window window) { if (glx_window != None) { lwjgl_glXDestroyWindow(disp, glx_window); glx_window = None; } XDestroyWindow(disp, window); XFreeColormap(disp, cmap); freeIconPixmap(disp); } static bool isNetWMFullscreenSupported(JNIEnv *env, Display *disp, int screen) { unsigned long nitems; Atom actual_type; int actual_format; unsigned long bytes_after; Atom *supported_list; Atom netwm_supported_atom = XInternAtom(disp, "_NET_SUPPORTED", False); int result = XGetWindowProperty(disp, RootWindow(disp, screen), netwm_supported_atom, 0, 10000, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, (void *)&supported_list); if (result != Success) { throwException(env, "Unable to query _NET_SUPPORTED window property"); return false; } Atom fullscreen_atom = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False); bool supported = false; unsigned long i; for (i = 0; i < nitems; i++) { if (fullscreen_atom == supported_list[i]) { supported = true; break; } } XFree(supported_list); return supported; } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsNetWMFullscreenSupported(JNIEnv *env, jclass unused, jlong display, jint screen) { Display *disp = (Display *)(intptr_t)display; return isNetWMFullscreenSupported(env, disp, screen) ? JNI_TRUE : JNI_FALSE; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReshape(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jint x, jint y, jint width, jint height) { Display *disp = (Display *)(intptr_t)display; Window window = (Window)window_ptr; XMoveWindow(disp, window, x, y); XResizeWindow(disp, window, width, height); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_synchronize(JNIEnv *env, jclass clazz, jlong display, jboolean synchronize) { Display *disp = (Display *)(intptr_t)display; XSynchronize(disp, synchronize ? True : False); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getRootWindow(JNIEnv *env, jclass clazz, jlong display, jint screen) { Display *disp = (Display *)(intptr_t)display; return RootWindow(disp, screen); } static void updateWindowHints(JNIEnv *env, Display *disp, Window window) { XWMHints* win_hints = XAllocWMHints(); if (win_hints == NULL) { throwException(env, "XAllocWMHints failed"); return; } win_hints->flags = InputHint; win_hints->input = True; if (current_icon_pixmap != 0) { win_hints->flags |= IconPixmapHint; win_hints->icon_pixmap = current_icon_pixmap; } if (current_icon_mask_pixmap != 0) { win_hints->flags |= IconMaskHint; win_hints->icon_mask = current_icon_mask_pixmap; } XSetWMHints(disp, window, win_hints); XFree(win_hints); XFlush(disp); } static Window createWindow(JNIEnv* env, Display *disp, int screen, jint window_mode, X11PeerInfo *peer_info, int x, int y, int width, int height, jboolean undecorated, long parent_handle) { Window parent = (Window)parent_handle; Window win; XSetWindowAttributes attribs; int attribmask; XVisualInfo *vis_info = getVisualInfoFromPeerInfo(env, peer_info); if (vis_info == NULL) return false; cmap = XCreateColormap(disp, parent, vis_info->visual, AllocNone); attribs.colormap = cmap; attribs.border_pixel = 0; attribs.event_mask = ExposureMask | FocusChangeMask | VisibilityChangeMask | StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask| EnterWindowMask | LeaveWindowMask; attribmask = CWColormap | CWEventMask | CWBorderPixel; if (isLegacyFullscreen(window_mode)) { attribmask |= CWOverrideRedirect; attribs.override_redirect = True; } win = XCreateWindow(disp, parent, x, y, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs); current_depth = vis_info->depth; current_visual = vis_info->visual; XFree(vis_info); if (!checkXError(env, disp)) { XFreeColormap(disp, cmap); return false; } // printfDebugJava(env, "Created window"); if (undecorated) { // Use Motif decoration hint property and hope the window manager respects them setDecorations(disp, win, 0); } XSizeHints * size_hints = XAllocSizeHints(); size_hints->flags = PMinSize | PMaxSize; size_hints->min_width = width; size_hints->max_width = width; size_hints->min_height = height; size_hints->max_height = height; XSetWMNormalHints(disp, win, size_hints); updateWindowHints(env, disp, win); XFree(size_hints); #define NUM_ATOMS 1 Atom protocol_atoms[NUM_ATOMS] = {XInternAtom(disp, "WM_DELETE_WINDOW", False)/*, XInternAtom(disp, "WM_TAKE_FOCUS", False)*/}; XSetWMProtocols(disp, win, protocol_atoms, NUM_ATOMS); if (window_mode == org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_NETWM) { Atom fullscreen_atom = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False); XChangeProperty(disp, win, XInternAtom(disp, "_NET_WM_STATE", False), XInternAtom(disp, "ATOM", False), 32, PropModeReplace, (const unsigned char*)&fullscreen_atom, 1); } if (!checkXError(env, disp)) { destroyWindow(env, disp, win); return 0; } return win; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_reparentWindow(JNIEnv *env, jclass unused, jlong display, jlong window_ptr, jlong parent_ptr, jint x, jint y) { Display *disp = (Display *)(intptr_t)display; Window window = (Window)window_ptr; Window parent = (Window)parent_ptr; XReparentWindow(disp, window, parent, x, y); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_mapRaised(JNIEnv *env, jclass unused, jlong display, jlong window_ptr) { Display *disp = (Display *)(intptr_t)display; Window window = (Window)window_ptr; XMapRaised(disp, window); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getParentWindow(JNIEnv *env, jclass unused, jlong display, jlong window_ptr) { Display *disp = (Display *)(intptr_t)display; Window window = (Window)window_ptr; Window root, parent; Window *children; unsigned int nchildren; if (XQueryTree(disp, window, &root, &parent, &children, &nchildren) == 0) { throwException(env, "XQueryTree failed"); return None; } if (children != NULL) XFree(children); return parent; } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_hasProperty(JNIEnv *env, jclass unusued, jlong display, jlong window_ptr, jlong property_ptr) { Display *disp = (Display *)(intptr_t)display; Window window = (Window)window_ptr; Atom property = (Atom)property_ptr; int num_props; Atom *properties = XListProperties(disp, window, &num_props); if (properties == NULL) return JNI_FALSE; jboolean result = JNI_FALSE; for (int i = 0; i < num_props; i++) { if (properties[i] == property) { result = JNI_TRUE; break; } } XFree(properties); return result; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setInputFocus(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jlong time) { Display *disp = (Display *)(intptr_t)display; Window window = (Window)window_ptr; XSetInputFocus(disp, window, RevertToParent, time); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateWindow(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject peer_info_handle, jobject mode, jint window_mode, jint x, jint y, jboolean undecorated, jlong parent_handle) { Display *disp = (Display *)(intptr_t)display; X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); GLXFBConfig *fb_config = NULL; if (peer_info->glx13) { fb_config = getFBConfigFromPeerInfo(env, peer_info); if (fb_config == NULL) return 0; } jclass cls_displayMode = (*env)->GetObjectClass(env, mode); jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I"); jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I"); int width = (*env)->GetIntField(env, mode, fid_width); int height = (*env)->GetIntField(env, mode, fid_height); Window win = createWindow(env, disp, screen, window_mode, peer_info, x, y, width, height, undecorated, parent_handle); if ((*env)->ExceptionOccurred(env)) { return 0; } if (peer_info->glx13) { glx_window = lwjgl_glXCreateWindow(disp, *fb_config, win, NULL); XFree(fb_config); } if (!checkXError(env, disp)) { lwjgl_glXDestroyWindow(disp, glx_window); destroyWindow(env, disp, win); } return win; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyWindow(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr) { Display *disp = (Display *)(intptr_t)display; Window window = (Window)window_ptr; destroyWindow(env, disp, window); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nLockAWT(JNIEnv *env, jclass clazz) { JAWT jawt; jawt.version = JAWT_VERSION_1_4; if (JAWT_GetAWT(env, &jawt) != JNI_TRUE) { throwException(env, "GetAWT failed"); return; } jawt.Lock(env); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUnlockAWT(JNIEnv *env, jclass clazz) { JAWT jawt; jawt.version = JAWT_VERSION_1_4; if (JAWT_GetAWT(env, &jawt) != JNI_TRUE) { throwException(env, "GetAWT failed"); return; } jawt.Unlock(env); } static Pixmap createPixmapFromBuffer(JNIEnv *env, Display *disp, Window window, char *data, int data_size, int width, int height, int format, int depth) { Pixmap pixmap = XCreatePixmap(disp, window, width, height, depth); /* We need to copy the image data since XDestroyImage will also free its data buffer, which can't be allowed * since the data buffer is managed by the jvm (it's the storage for the direct ByteBuffer) */ char *icon_copy = (char *)malloc(sizeof(*icon_copy)*data_size); if (icon_copy == NULL) { XFreePixmap(disp, pixmap); throwException(env, "malloc failed"); return None; } memcpy(icon_copy, data, data_size); XImage *image = XCreateImage(disp, current_visual, depth, format, 0, icon_copy, width, height, 32, 0); if (image == NULL) { XFreePixmap(disp, pixmap); free(icon_copy); throwException(env, "XCreateImage failed"); return None; } GC gc = XCreateGC(disp, pixmap, 0, NULL); XPutImage(disp, pixmap, gc, image, 0, 0, 0, 0, width, height); XFreeGC(disp, gc); XDestroyImage(image); // We won't free icon_copy because it is freed by XDestroyImage return pixmap; } static void setIcon(JNIEnv *env, Display *disp, Window window, char *rgb_data, int rgb_size, char *mask_data, int mask_size, int width, int height) { freeIconPixmap(disp); current_icon_pixmap = createPixmapFromBuffer(env, disp, window, rgb_data, rgb_size, width, height, ZPixmap, current_depth); if ((*env)->ExceptionCheck(env)) return; current_icon_mask_pixmap = createPixmapFromBuffer(env, disp, window, mask_data, mask_size, width, height, XYPixmap, 1); if ((*env)->ExceptionCheck(env)) { freeIconPixmap(disp); return; } updateWindowHints(env, disp, window); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetWindowIcon (JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jobject icon_rgb_buffer, jint rgb_size, jobject icon_mask_buffer, jint mask_size, jint width, jint height) { Display *disp = (Display *)(intptr_t)display; Window window = (Window)window_ptr; char *rgb_data= (char *)(*env)->GetDirectBufferAddress(env, icon_rgb_buffer); char *mask_data= (char *)(*env)->GetDirectBufferAddress(env, icon_mask_buffer); setIcon(env, disp, window, rgb_data, rgb_size, mask_data, mask_size, width, height); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUngrabKeyboard(JNIEnv *env, jclass unused, jlong display_ptr) { Display *disp = (Display *)(intptr_t)display_ptr; return XUngrabKeyboard(disp, CurrentTime); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabKeyboard(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { Display *disp = (Display *)(intptr_t)display_ptr; Window win = (Window)window_ptr; return XGrabKeyboard(disp, win, False, GrabModeAsync, GrabModeAsync, CurrentTime); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabPointer(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jlong cursor_ptr) { Display *disp = (Display *)(intptr_t)display_ptr; Window win = (Window)window_ptr; Cursor cursor = (Cursor)cursor_ptr; int grab_mask = PointerMotionMask | ButtonPressMask | ButtonReleaseMask; return XGrabPointer(disp, win, False, grab_mask, GrabModeAsync, GrabModeAsync, win, cursor, CurrentTime); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetViewPort(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jint screen) { Display *disp = (Display *)(intptr_t)display_ptr; Window win = (Window)window_ptr; XWindowAttributes win_attribs; XGetWindowAttributes(disp, win, &win_attribs); XF86VidModeSetViewPort(disp, screen, win_attribs.x, win_attribs.y); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUngrabPointer(JNIEnv *env, jclass unused, jlong display_ptr) { Display *disp = (Display *)(intptr_t)display_ptr; return XUngrabPointer(disp, CurrentTime); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDefineCursor(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jlong cursor_ptr) { Display *disp = (Display *)(intptr_t)display_ptr; Window win = (Window)window_ptr; Cursor cursor = (Cursor)cursor_ptr; XDefineCursor(disp, win, cursor); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateBlankCursor(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { Display *disp = (Display *)(intptr_t)display_ptr; Window win = (Window)window_ptr; unsigned int best_width, best_height; if (XQueryBestCursor(disp, win, 1, 1, &best_width, &best_height) == 0) { throwException(env, "Could not query best cursor size"); return false; } Pixmap mask = XCreatePixmap(disp, win, best_width, best_height, 1); XGCValues gc_values; gc_values.foreground = 0; GC gc = XCreateGC(disp, mask, GCForeground, &gc_values); XFillRectangle(disp, mask, gc, 0, 0, best_width, best_height); XFreeGC(disp, gc); XColor dummy_color; Cursor cursor = XCreatePixmapCursor(disp, mask, mask, &dummy_color, &dummy_color, 0, 0); XFreePixmap(disp, mask); return cursor; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetInputFocus(JNIEnv *env, jclass unused, jlong display_ptr) { Display *disp = (Display *)(intptr_t)display_ptr; int revert_mode; Window win; XGetInputFocus(disp, &win, &revert_mode); return win; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIconifyWindow(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jint screen) { Display *disp = (Display *)(intptr_t)display_ptr; Window win = (Window)window_ptr; XIconifyWindow(disp, win, screen); } lwjgl-2.7.1/src/native/linux/linux_al.c0000644000175000017500000000442311543426510017117 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include #include #include "org_lwjgl_openal_AL.h" #include "extal.h" #include "common_tools.h" #include static void* handleOAL; void *extal_NativeGetFunctionPointer(const char *function) { return dlsym(handleOAL, function); } void extal_LoadLibrary(JNIEnv *env, jstring path) { char *path_str = GetStringNativeChars(env, path); printfDebugJava(env, "Testing '%s'", path_str); handleOAL = dlopen(path_str, RTLD_LAZY); if (handleOAL != NULL) { printfDebugJava(env, "Found OpenAL at '%s'", path_str); } else { throwException(env, "Could not load OpenAL library"); } free(path_str); } void extal_UnloadLibrary() { if (handleOAL != NULL) { dlclose(handleOAL); handleOAL = NULL; } } lwjgl-2.7.1/src/native/linux/extgl_glx.c0000644000175000017500000002437511543426510017311 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include "extgl_glx.h" glXGetFBConfigsPROC lwjgl_glXGetFBConfigs = NULL; glXChooseFBConfigPROC lwjgl_glXChooseFBConfig = NULL; glXGetFBConfigAttribPROC lwjgl_glXGetFBConfigAttrib = NULL; glXGetVisualFromFBConfigPROC lwjgl_glXGetVisualFromFBConfig = NULL; glXCreateWindowPROC lwjgl_glXCreateWindow = NULL; glXDestroyWindowPROC lwjgl_glXDestroyWindow = NULL; glXCreatePixmapPROC lwjgl_glXCreatePixmap = NULL; glXDestroyPixmapPROC lwjgl_glXDestroyPixmap = NULL; glXCreatePbufferPROC lwjgl_glXCreatePbuffer = NULL; glXDestroyPbufferPROC lwjgl_glXDestroyPbuffer = NULL; glXQueryDrawablePROC lwjgl_glXQueryDrawable = NULL; glXCreateNewContextPROC lwjgl_glXCreateNewContext = NULL; glXMakeContextCurrentPROC lwjgl_glXMakeContextCurrent = NULL; glXGetCurrentReadDrawablePROC lwjgl_glXGetCurrentReadDrawable = NULL; glXGetCurrentDisplayPROC lwjgl_glXGetCurrentDisplay = NULL; glXQueryContextPROC lwjgl_glXQueryContext = NULL; glXSelectEventPROC lwjgl_glXSelectEvent = NULL; glXGetSelectedEventPROC lwjgl_glXGetSelectedEvent = NULL; glXChooseVisualPROC lwjgl_glXChooseVisual = NULL; glXCopyContextPROC lwjgl_glXCopyContext = NULL; glXCreateContextPROC lwjgl_glXCreateContext = NULL; glXCreateGLXPixmapPROC lwjgl_glXCreateGLXPixmap = NULL; glXDestroyContextPROC lwjgl_glXDestroyContext = NULL; glXDestroyGLXPixmapPROC lwjgl_glXDestroyGLXPixmap = NULL; glXGetConfigPROC lwjgl_glXGetConfig = NULL; glXGetCurrentContextPROC lwjgl_glXGetCurrentContext = NULL; glXGetCurrentDrawablePROC lwjgl_glXGetCurrentDrawable = NULL; glXIsDirectPROC lwjgl_glXIsDirect = NULL; glXMakeCurrentPROC lwjgl_glXMakeCurrent = NULL; glXQueryExtensionPROC lwjgl_glXQueryExtension = NULL; glXQueryVersionPROC lwjgl_glXQueryVersion = NULL; glXSwapBuffersPROC lwjgl_glXSwapBuffers = NULL; glXUseXFontPROC lwjgl_glXUseXFont = NULL; glXWaitGLPROC lwjgl_glXWaitGL = NULL; glXWaitXPROC lwjgl_glXWaitX = NULL; glXGetClientStringPROC lwjgl_glXGetClientString = NULL; glXQueryServerStringPROC lwjgl_glXQueryServerString = NULL; glXQueryExtensionsStringPROC lwjgl_glXQueryExtensionsString = NULL; /* GLX_SGI_swap_control */ glXSwapIntervalSGIPROC lwjgl_glXSwapIntervalSGI = NULL; /* GLX_ARB_create_context */ glXCreateContextAttribsARBPROC lwjgl_glXCreateContextAttribsARB = NULL; static void * lib_gl_handle = NULL; typedef void * (APIENTRY * glXGetProcAddressARBPROC) (const GLubyte *procName); static glXGetProcAddressARBPROC lwjgl_glXGetProcAddressARB; static GLXExtensions symbols_flags; /** returns true if the extention is available */ static bool GLXQueryExtension(Display *disp, int screen, const char *name) { const GLubyte *exts = (const GLubyte *)lwjgl_glXQueryExtensionsString(disp, screen); return extgl_QueryExtension(exts, name); } static void extgl_InitGLX13() { ExtFunction functions[] = { {"glXGetFBConfigs", (void*)&lwjgl_glXGetFBConfigs}, {"glXChooseFBConfig", (void*)&lwjgl_glXChooseFBConfig}, {"glXGetFBConfigAttrib", (void*)&lwjgl_glXGetFBConfigAttrib}, {"glXGetVisualFromFBConfig", (void*)&lwjgl_glXGetVisualFromFBConfig}, {"glXCreateWindow", (void*)&lwjgl_glXCreateWindow}, {"glXDestroyWindow", (void*)&lwjgl_glXDestroyWindow}, {"glXCreatePixmap", (void*)&lwjgl_glXCreatePixmap}, {"glXDestroyPixmap", (void*)&lwjgl_glXDestroyPixmap}, {"glXCreatePbuffer", (void*)&lwjgl_glXCreatePbuffer}, {"glXDestroyPbuffer", (void*)&lwjgl_glXDestroyPbuffer}, {"glXQueryDrawable", (void*)&lwjgl_glXQueryDrawable}, {"glXCreateNewContext", (void*)&lwjgl_glXCreateNewContext}, {"glXMakeContextCurrent", (void*)&lwjgl_glXMakeContextCurrent}, {"glXGetCurrentReadDrawable", (void*)&lwjgl_glXGetCurrentReadDrawable}, {"glXGetCurrentDisplay", (void*)&lwjgl_glXGetCurrentDisplay}, {"glXQueryContext", (void*)&lwjgl_glXQueryContext}, {"glXSelectEvent", (void*)&lwjgl_glXSelectEvent}, {"glXGetSelectedEvent", (void*)&lwjgl_glXGetSelectedEvent}}; symbols_flags.GLX13 = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } static void extgl_InitGLX12(void) { ExtFunction functions[] = { {"glXChooseVisual", (void*)&lwjgl_glXChooseVisual}, {"glXCopyContext", (void*)&lwjgl_glXCopyContext}, {"glXCreateContext", (void*)&lwjgl_glXCreateContext}, {"glXCreateGLXPixmap", (void*)&lwjgl_glXCreateGLXPixmap}, {"glXDestroyContext", (void*)&lwjgl_glXDestroyContext}, {"glXDestroyGLXPixmap", (void*)&lwjgl_glXDestroyGLXPixmap}, {"glXGetConfig", (void*)&lwjgl_glXGetConfig}, {"glXGetCurrentContext", (void*)&lwjgl_glXGetCurrentContext}, {"glXGetCurrentDrawable", (void*)&lwjgl_glXGetCurrentDrawable}, {"glXIsDirect", (void*)&lwjgl_glXIsDirect}, {"glXMakeCurrent", (void*)&lwjgl_glXMakeCurrent}, {"glXQueryExtension", (void*)&lwjgl_glXQueryExtension}, {"glXQueryVersion", (void*)&lwjgl_glXQueryVersion}, {"glXSwapBuffers", (void*)&lwjgl_glXSwapBuffers}, {"glXUseXFont", (void*)&lwjgl_glXUseXFont}, {"glXWaitGL", (void*)&lwjgl_glXWaitGL}, {"glXWaitX", (void*)&lwjgl_glXWaitX}, {"glXGetClientString", (void*)&lwjgl_glXGetClientString}, {"glXQueryServerString", (void*)&lwjgl_glXQueryServerString}, {"glXQueryExtensionsString", (void*)&lwjgl_glXQueryExtensionsString}}; symbols_flags.GLX12 = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } static void extgl_InitGLXSGISwapControl() { ExtFunction functions[] = { {"glXSwapIntervalSGI", (void*)&lwjgl_glXSwapIntervalSGI}}; symbols_flags.GLX_SGI_swap_control = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } static void extgl_InitGLXARBCreateContext() { ExtFunction functions[] = { {"glXCreateContextAttribsARB", (void*)&lwjgl_glXCreateContextAttribsARB}}; symbols_flags.GLX_ARB_create_context = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } static void extgl_InitGLXSupportedExtensions(Display *disp, int screen, GLXExtensions *extension_flags) { /* extension_flags.GLX_EXT_visual_info = GLXQueryExtension(disp, screen, "GLX_EXT_visual_info"); extension_flags.GLX_EXT_visual_rating = GLXQueryExtension(disp, screen, "GLX_EXT_visual_rating");*/ extension_flags->GLX_SGI_swap_control = symbols_flags.GLX_SGI_swap_control && GLXQueryExtension(disp, screen, "GLX_SGI_swap_control"); extension_flags->GLX_ARB_multisample = GLXQueryExtension(disp, screen, "GLX_ARB_multisample"); extension_flags->GLX_ARB_fbconfig_float = GLXQueryExtension(disp, screen, "GLX_ARB_fbconfig_float"); extension_flags->GLX_EXT_fbconfig_packed_float = GLXQueryExtension(disp, screen, "GLX_EXT_fbconfig_packed_float"); extension_flags->GLX_ARB_framebuffer_sRGB = GLXQueryExtension(disp, screen, "GLX_ARB_framebuffer_sRGB") || GLXQueryExtension(disp, screen, "GLX_EXT_framebuffer_sRGB"); extension_flags->GLX_ARB_create_context = GLXQueryExtension(disp, screen, "GLX_ARB_create_context"); extension_flags->GLX_NV_multisample_coverage = GLXQueryExtension(disp, screen, "GLX_NV_multisample_coverage"); } bool extgl_Open(JNIEnv *env) { if (lib_gl_handle != NULL) return true; /* * Actually we don't need the RTLD_GLOBAL flag, since the symbols * we load should be private to us. However, according to the * documentation at * * http://dri.sourceforge.net/doc/DRIuserguide.html * * DRI drivers need this flag to work properly */ lib_gl_handle = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); if (lib_gl_handle == NULL) { throwFormattedException(env, "Error loading libGL.so.1: %s", dlerror()); return false; } lwjgl_glXGetProcAddressARB = (glXGetProcAddressARBPROC)dlsym(lib_gl_handle, "glXGetProcAddressARB"); if (lwjgl_glXGetProcAddressARB == NULL) { extgl_Close(); throwException(env, "Could not get address of glXGetProcAddressARB"); return false; } /* Unlike Windows, GLX function addresses are context-independent * so we only have to initialize the addresses once at load */ extgl_InitGLX12(); extgl_InitGLX13(); extgl_InitGLXSGISwapControl(); extgl_InitGLXARBCreateContext(); return true; } void *extgl_GetProcAddress(const char *name) { void *t = (void*)lwjgl_glXGetProcAddressARB((const GLubyte*)name); if (t == NULL) { t = dlsym(lib_gl_handle, name); if (t == NULL) { printfDebug("Could not locate symbol %s\n", name); } } return t; } void extgl_Close(void) { dlclose(lib_gl_handle); lib_gl_handle = NULL; } bool extgl_InitGLX(Display *disp, int screen, GLXExtensions *extension_flags) { int major, minor; /* Assume glx ver >= 1.2 */ // Check GLX 1.2 symbols available if (!symbols_flags.GLX12) return false; if (lwjgl_glXQueryVersion(disp, &major, &minor) != True) return false; bool glx12 = major > 1 || (major == 1 && minor >= 2); // Check GLX 1.2 version if (!glx12) return false; extension_flags->GLX12 = glx12; extension_flags->GLX13 = major > 1 || (major == 1 && minor >= 3); extension_flags->GLX14 = major > 1 || (major == 1 && minor >= 4); extgl_InitGLXSupportedExtensions(disp, screen, extension_flags); return true; } lwjgl-2.7.1/src/native/linux/org_lwjgl_opengl_LinuxKeyboard.c0000644000175000017500000001524411543426510023501 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_input_Keyboard.c 2399 2006-06-30 19:28:00Z elias_naur $ * * Linux keyboard handling. * * @author elias_naur * @version $Revision: 2399 $ */ #include #include #include #include #include #include "common_tools.h" #include "org_lwjgl_opengl_LinuxKeyboard.h" JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_getModifierMapping(JNIEnv *env, jclass unused, jlong display_ptr) { Display *disp = (Display *)(intptr_t)display_ptr; XModifierKeymap *modifier_map = XGetModifierMapping(disp); return (intptr_t)modifier_map; } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_nSetDetectableKeyRepeat(JNIEnv *env, jclass unused, jlong display_ptr, jboolean set_enabled) { Display *disp = (Display *)(intptr_t)display_ptr; Bool enabled = set_enabled == JNI_TRUE ? True : False; Bool result = XkbSetDetectableAutoRepeat(disp, enabled, NULL); return result == enabled ? JNI_TRUE : JNI_FALSE; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_freeModifierMapping(JNIEnv *env, jclass unused, jlong mapping_ptr) { XModifierKeymap *modifier_map = (XModifierKeymap *)(intptr_t)mapping_ptr; XFreeModifiermap(modifier_map); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_getMaxKeyPerMod(JNIEnv *env, jclass unsused, jlong mapping_ptr) { XModifierKeymap *modifier_map = (XModifierKeymap *)(intptr_t)mapping_ptr; return modifier_map->max_keypermod; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_lookupModifierMap(JNIEnv *env, jclass unused, jlong mapping_ptr, jint index) { XModifierKeymap *modifier_map = (XModifierKeymap *)(intptr_t)mapping_ptr; KeyCode key_code = modifier_map->modifiermap[index]; return key_code; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_keycodeToKeySym(JNIEnv *env, jclass unused, jlong display_ptr, jint key_code) { Display *disp = (Display *)(intptr_t)display_ptr; KeySym key_sym = XKeycodeToKeysym(disp, key_code, 0); return key_sym; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_openIM(JNIEnv *env, jclass unused, jlong display_ptr) { Display *disp = (Display *)(intptr_t)display_ptr; XIM xim = XOpenIM(disp, NULL, NULL, NULL); return (intptr_t)xim; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_createIC(JNIEnv *env, jclass unused, jlong xim_ptr, jlong window_ptr) { Window win = (Window)window_ptr; XIM xim = (XIM)(intptr_t)xim_ptr; XIC xic = XCreateIC(xim, XNClientWindow, win, XNFocusWindow, win, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, NULL); return (intptr_t)xic; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_setupIMEventMask(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jlong xic_ptr) { Display *disp = (Display *)(intptr_t)display_ptr; Window win = (Window)window_ptr; XIC xic = (XIC)(intptr_t)xic_ptr; long im_event_mask; XWindowAttributes win_attributes; XGetWindowAttributes(disp, win, &win_attributes); XGetICValues(xic, XNFilterEvents, &im_event_mask, NULL); XSelectInput(disp, win, win_attributes.your_event_mask | im_event_mask); XSetICFocus(xic); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_destroyIC(JNIEnv *env, jclass unused, jlong xic_ptr) { XIC xic = (XIC)(intptr_t)xic_ptr; XDestroyIC(xic); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_closeIM(JNIEnv *env, jclass unused, jlong xim_ptr) { XIM xim = (XIM)(intptr_t)xim_ptr; XCloseIM(xim); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_lookupKeysym(JNIEnv *env, jclass unused, jlong event_ptr, jint index) { XKeyEvent *event = (XKeyEvent *)(intptr_t)event_ptr; return XLookupKeysym(event, index); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_toUpper(JNIEnv *env, jclass unused, jlong keysym) { KeySym lower_case, upper_case; XConvertCase(keysym, &lower_case, &upper_case); return upper_case; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_lookupString(JNIEnv *env, jclass unused, jlong event_ptr, jobject buffer_obj, jobject compose_status_obj) { XKeyEvent *event = (XKeyEvent *)(intptr_t)event_ptr; char *buffer = (char *)(*env)->GetDirectBufferAddress(env, buffer_obj); int capacity = (*env)->GetDirectBufferCapacity(env, buffer_obj); XComposeStatus *status = (XComposeStatus *)(*env)->GetDirectBufferAddress(env, compose_status_obj); return XLookupString(event, buffer, capacity, NULL, status); } JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_allocateComposeStatus(JNIEnv *env, jclass unused) { return newJavaManagedByteBuffer(env, sizeof(XComposeStatus)); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_utf8LookupString(JNIEnv *env, jclass unused, jlong xic_ptr, jlong event_ptr, jobject buffer_obj, jint buffer_position, jint buffer_size) { XIC xic = (XIC)(intptr_t)xic_ptr; XKeyEvent *event = (XKeyEvent *)(intptr_t)event_ptr; char *buffer = buffer_position + (char *)(*env)->GetDirectBufferAddress(env, buffer_obj); Status status; size_t num_bytes = Xutf8LookupString(xic, event, buffer, buffer_size, NULL, &status); positionBuffer(env, buffer_obj, num_bytes); return status; } lwjgl-2.7.1/src/native/linux/extgl_glx.h0000644000175000017500000004533711543426510017317 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef EXTGL_GLX_H #define EXTGL_GLX_H #include #include "extgl.h" /* * Names for attributes to lwjgl_glXGetConfig. */ #define GLX_USE_GL 1 /* support GLX rendering */ #define GLX_BUFFER_SIZE 2 /* depth of the color buffer */ #define GLX_LEVEL 3 /* level in plane stacking */ #define GLX_RGBA 4 /* true if RGBA mode */ #define GLX_DOUBLEBUFFER 5 /* double buffering supported */ #define GLX_STEREO 6 /* stereo buffering supported */ #define GLX_AUX_BUFFERS 7 /* number of aux buffers */ #define GLX_RED_SIZE 8 /* number of red component bits */ #define GLX_GREEN_SIZE 9 /* number of green component bits */ #define GLX_BLUE_SIZE 10 /* number of blue component bits */ #define GLX_ALPHA_SIZE 11 /* number of alpha component bits */ #define GLX_DEPTH_SIZE 12 /* number of depth bits */ #define GLX_STENCIL_SIZE 13 /* number of stencil bits */ #define GLX_ACCUM_RED_SIZE 14 /* number of red accum bits */ #define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */ #define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */ #define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */ #define GLX_SAMPLE_BUFFERS_ARB 100000 /* number of multisample buffers */ #define GLX_SAMPLES_ARB 100001 /* number of multisample samples */ /* * FBConfig-specific attributes */ #define GLX_X_VISUAL_TYPE 0x22 #define GLX_CONFIG_CAVEAT 0x20 /* Like visual_info VISUAL_CAVEAT */ #define GLX_TRANSPARENT_TYPE 0x23 #define GLX_TRANSPARENT_INDEX_VALUE 0x24 #define GLX_TRANSPARENT_RED_VALUE 0x25 #define GLX_TRANSPARENT_GREEN_VALUE 0x26 #define GLX_TRANSPARENT_BLUE_VALUE 0x27 #define GLX_TRANSPARENT_ALPHA_VALUE 0x28 #define GLX_DRAWABLE_TYPE 0x8010 #define GLX_RENDER_TYPE 0x8011 #define GLX_X_RENDERABLE 0x8012 #define GLX_FBCONFIG_ID 0x8013 #define GLX_MAX_PBUFFER_WIDTH 0x8016 #define GLX_MAX_PBUFFER_HEIGHT 0x8017 #define GLX_MAX_PBUFFER_PIXELS 0x8018 #define GLX_VISUAL_ID 0x800B #define GLX_DRAWABLE_TYPE_SGIX GLX_DRAWABLE_TYPE #define GLX_RENDER_TYPE_SGIX GLX_RENDER_TYPE #define GLX_X_RENDERABLE_SGIX GLX_X_RENDERABLE #define GLX_FBCONFIG_ID_SGIX GLX_FBCONFIG_ID #define GLX_MAX_PBUFFER_WIDTH_SGIX GLX_MAX_PBUFFER_WIDTH #define GLX_MAX_PBUFFER_HEIGHT_SGIX GLX_MAX_PBUFFER_HEIGHT #define GLX_MAX_PBUFFER_PIXELS_SGIX GLX_MAX_PBUFFER_PIXELS #define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 #define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A /* * Error return values from lwjgl_glXGetConfig. Success is indicated by * a value of 0. */ #define GLX_BAD_SCREEN 1 /* screen # is bad */ #define GLX_BAD_ATTRIBUTE 2 /* attribute to get is bad */ #define GLX_NO_EXTENSION 3 /* no glx extension on server */ #define GLX_BAD_VISUAL 4 /* visual # not known by GLX */ #define GLX_BAD_CONTEXT 5 #define GLX_BAD_VALUE 6 #define GLX_BAD_ENUM 7 /* FBConfig attribute values */ /* * Generic "don't care" value for lwjgl_glX ChooseFBConfig attributes (except * GLX_LEVEL). */ #define GLX_DONT_CARE 0xFFFFFFFF /* GLX_RENDER_TYPE bits */ #define GLX_RGBA_BIT 0x00000001 #define GLX_COLOR_INDEX_BIT 0x00000002 #define GLX_RGBA_BIT_SGIX GLX_RGBA_BIT #define GLX_COLOR_INDEX_BIT_SGIX GLX_COLOR_INDEX_BIT /* GLX_DRAWABLE_TYPE bits */ #define GLX_WINDOW_BIT 0x00000001 #define GLX_PIXMAP_BIT 0x00000002 #define GLX_PBUFFER_BIT 0x00000004 #define GLX_WINDOW_BIT_SGIX GLX_WINDOW_BIT #define GLX_PIXMAP_BIT_SGIX GLX_PIXMAP_BIT #define GLX_PBUFFER_BIT_SGIX GLX_PBUFFER_BIT /* GLX_CONFIG_CAVEAT attribute values */ #define GLX_NONE 0x8000 #define GLX_SLOW_CONFIG 0x8001 #define GLX_NON_CONFORMANT_CONFIG 0x800D /* GLX_X_VISUAL_TYPE attribute values */ #define GLX_TRUE_COLOR 0x8002 #define GLX_DIRECT_COLOR 0x8003 #define GLX_PSEUDO_COLOR 0x8004 #define GLX_STATIC_COLOR 0x8005 #define GLX_GRAY_SCALE 0x8006 #define GLX_STATIC_GRAY 0x8007 /* GLX_TRANSPARENT_TYPE attribute values */ /* #define GLX_NONE 0x8000 */ #define GLX_TRANSPARENT_RGB 0x8008 #define GLX_TRANSPARENT_INDEX 0x8009 /* lwjgl_glXCreateGLXPbuffer attributes */ #define GLX_PRESERVED_CONTENTS 0x801B #define GLX_LARGEST_PBUFFER 0x801C #define GLX_PBUFFER_HEIGHT 0x8040 /* New for GLX 1.3 */ #define GLX_PBUFFER_WIDTH 0x8041 /* New for GLX 1.3 */ #define GLX_PRESERVED_CONTENTS_SGIX GLX_PRESERVED_CONTENTS #define GLX_LARGEST_PBUFFER_SGIX GLX_LARGEST_PBUFFER /* lwjgl_glXQueryGLXPBuffer attributes */ #define GLX_WIDTH 0x801D #define GLX_HEIGHT 0x801E #define GLX_EVENT_MASK 0x801F #define GLX_WIDTH_SGIX GLX_WIDTH #define GLX_HEIGHT_SGIX GLX_HEIGHT #define GLX_EVENT_MASK_SGIX GLX_EVENT_MASK /* lwjgl_glXCreateNewContext render_type attribute values */ #define GLX_RGBA_TYPE 0x8014 #define GLX_COLOR_INDEX_TYPE 0x8015 #define GLX_RGBA_TYPE_SGIX GLX_RGBA_TYPE #define GLX_COLOR_INDEX_TYPE_SGIX GLX_COLOR_INDEX_TYPE /* lwjgl_glXQueryContext attributes */ /* #define GLX_FBCONFIG_ID 0x8013 */ /* #define GLX_RENDER_TYPE 0x8011 */ #define GLX_SCREEN 0x800C /* lwjgl_glXSelectEvent event mask bits */ #define GLX_PBUFFER_CLOBBER_MASK 0x08000000 #define GLX_PBUFFER_CLOBBER_MASK_SGIX GLX_PBUFFER_CLOBBER_MASK /* GLXPbufferClobberEvent event_type values */ #define GLX_DAMAGED 0x8020 #define GLX_SAVED 0x8021 #define GLX_DAMAGED_SGIX GLX_DAMAGED #define GLX_SAVED_SGIX GLX_SAVED /* GLXPbufferClobberEvent draw_type values */ #define GLX_WINDOW 0x8022 #define GLX_PBUFFER 0x8023 #define GLX_WINDOW_SGIX GLX_WINDOW #define GLX_PBUFFER_SGIX GLX_PBUFFER /* GLXPbufferClobberEvent buffer_mask bits */ #define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 #define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 #define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 #define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 #define GLX_AUX_BUFFERS_BIT 0x00000010 #define GLX_DEPTH_BUFFER_BIT 0x00000020 #define GLX_STENCIL_BUFFER_BIT 0x00000040 #define GLX_ACCUM_BUFFER_BIT 0x00000080 #define GLX_FRONT_LEFT_BUFFER_BIT_SGIX GLX_FRONT_LEFT_BUFFER_BIT #define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX GLX_FRONT_RIGHT_BUFFER_BIT #define GLX_BACK_LEFT_BUFFER_BIT_SGIX GLX_BACK_LEFT_BUFFER_BIT #define GLX_BACK_RIGHT_BUFFER_BIT_SGIX GLX_BACK_RIGHT_BUFFER_BIT #define GLX_AUX_BUFFERS_BIT_SGIX GLX_AUX_BUFFERS_BIT #define GLX_DEPTH_BUFFER_BIT_SGIX GLX_DEPTH_BUFFER_BIT #define GLX_STENCIL_BUFFER_BIT_SGIX GLX_STENCIL_BUFFER_BIT #define GLX_ACCUM_BUFFER_BIT_SGIX GLX_ACCUM_BUFFER_BIT /* * Extension return values from lwjgl_glXGetConfig. These are also * accepted as parameter values for lwjgl_glXChooseVisual. */ #define GLX_X_VISUAL_TYPE_EXT 0x22 /* visual_info extension type */ #define GLX_TRANSPARENT_TYPE_EXT 0x23 /* visual_info extension */ #define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 /* visual_info extension */ #define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 /* visual_info extension */ #define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 /* visual_info extension */ #define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 /* visual_info extension */ #define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 /* visual_info extension */ /* Property values for visual_type */ #define GLX_TRUE_COLOR_EXT 0x8002 #define GLX_DIRECT_COLOR_EXT 0x8003 #define GLX_PSEUDO_COLOR_EXT 0x8004 #define GLX_STATIC_COLOR_EXT 0x8005 #define GLX_GRAY_SCALE_EXT 0x8006 #define GLX_STATIC_GRAY_EXT 0x8007 /* Property values for transparent pixel */ #define GLX_NONE_EXT 0x8000 #define GLX_TRANSPARENT_RGB_EXT 0x8008 #define GLX_TRANSPARENT_INDEX_EXT 0x8009 /* Property values for visual_rating */ #define GLX_VISUAL_CAVEAT_EXT 0x20 /* visual_rating extension type */ #define GLX_SLOW_VISUAL_EXT 0x8001 #define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D /* * Names for attributes to lwjgl_glXGetClientString. */ #define GLX_VENDOR 0x1 #define GLX_VERSION 0x2 #define GLX_EXTENSIONS 0x3 /* * Names for attributes to lwjgl_glXQueryContextInfoEXT. */ #define GLX_SHARE_CONTEXT_EXT 0x800A /* id of share context */ #define GLX_VISUAL_ID_EXT 0x800B /* id of context's visual */ #define GLX_SCREEN_EXT 0x800C /* screen number */ /* NV_float_buffer */ #define GLX_FLOAT_COMPONENTS_NV 0x20B0 /* GLX_ARB_fbconfig_float */ #define GLX_RGBA_FLOAT_TYPE 0x20B9 #define GLX_RGBA_FLOAT_BIT 0x0004 /* GLX_ARB_fbconfig_float */ #define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1 #define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008 /* GLX_ARB_framebuffer_sRGB */ #define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2 /* GLX_ARB_create_context */ #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 #define GLX_CONTEXT_FLAGS_ARB 0x2094 #define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001 #define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 /* GLX_NV_multisample_coverage */ #define GLX_COVERAGE_SAMPLES_NV 100001 #define GLX_COLOR_SAMPLES_NV 0x20B3 typedef XID GLXContextID; typedef XID GLXPixmap; typedef XID GLXDrawable; typedef XID GLXPbuffer; typedef XID GLXWindow; typedef XID GLXFBConfigID; typedef struct __GLXcontextRec *GLXContext; typedef struct __GLXFBConfigRec *GLXFBConfig; typedef GLXFBConfig * (APIENTRY * glXGetFBConfigsPROC) (Display *dpy, int screen, int *nelements); typedef GLXFBConfig * (APIENTRY * glXChooseFBConfigPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); typedef int (APIENTRY * glXGetFBConfigAttribPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); typedef XVisualInfo * (APIENTRY * glXGetVisualFromFBConfigPROC) (Display *dpy, GLXFBConfig config); typedef GLXWindow (APIENTRY * glXCreateWindowPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); typedef void (APIENTRY * glXDestroyWindowPROC) (Display *dpy, GLXWindow win); typedef GLXPixmap (APIENTRY * glXCreatePixmapPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); typedef void (APIENTRY * glXDestroyPixmapPROC) (Display *dpy, GLXPixmap pixmap); typedef GLXPbuffer (APIENTRY * glXCreatePbufferPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); typedef void (APIENTRY * glXDestroyPbufferPROC) (Display *dpy, GLXPbuffer pbuf); typedef void (APIENTRY * glXQueryDrawablePROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); typedef GLXContext (APIENTRY * glXCreateNewContextPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); typedef Bool (APIENTRY * glXMakeContextCurrentPROC) (Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx); typedef GLXDrawable (APIENTRY * glXGetCurrentReadDrawablePROC) (void); typedef Display * (APIENTRY * glXGetCurrentDisplayPROC) (void); typedef int (APIENTRY * glXQueryContextPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); typedef void (APIENTRY * glXSelectEventPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); typedef void (APIENTRY * glXGetSelectedEventPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); typedef GLXContextID (APIENTRY * glXGetContextIDEXTPROC) (const GLXContext ctx); typedef GLXDrawable (APIENTRY * glXGetCurrentDrawableEXTPROC) (void); typedef GLXContext (APIENTRY * glXImportContextEXTPROC) (Display *dpy, GLXContextID contextID); typedef void (APIENTRY * glXFreeContextEXTPROC) (Display *dpy, GLXContext ctx); typedef int (APIENTRY * glXQueryContextInfoEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); typedef XVisualInfo* (APIENTRY * glXChooseVisualPROC) (Display *dpy, int screen, int *attribList); typedef void (APIENTRY * glXCopyContextPROC) (Display *dpy, GLXContext src, GLXContext dst, unsigned long mask); typedef GLXContext (APIENTRY * glXCreateContextPROC) (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct); typedef GLXPixmap (APIENTRY * glXCreateGLXPixmapPROC) (Display *dpy, XVisualInfo *vis, Pixmap pixmap); typedef void (APIENTRY * glXDestroyContextPROC) (Display *dpy, GLXContext ctx); typedef void (APIENTRY * glXDestroyGLXPixmapPROC) (Display *dpy, GLXPixmap pix); typedef int (APIENTRY * glXGetConfigPROC) (Display *dpy, XVisualInfo *vis, int attrib, int *value); typedef GLXContext (APIENTRY * glXGetCurrentContextPROC) (void); typedef GLXDrawable (APIENTRY * glXGetCurrentDrawablePROC) (void); typedef Bool (APIENTRY * glXIsDirectPROC) (Display *dpy, GLXContext ctx); typedef Bool (APIENTRY * glXMakeCurrentPROC) (Display *dpy, GLXDrawable drawable, GLXContext ctx); typedef Bool (APIENTRY * glXQueryExtensionPROC) (Display *dpy, int *errorBase, int *eventBase); typedef Bool (APIENTRY * glXQueryVersionPROC) (Display *dpy, int *major, int *minor); typedef void (APIENTRY * glXSwapBuffersPROC) (Display *dpy, GLXDrawable drawable); typedef void (APIENTRY * glXUseXFontPROC) (Font font, int first, int count, int listBase); typedef void (APIENTRY * glXWaitGLPROC) (void); typedef void (APIENTRY * glXWaitXPROC) (void); typedef const char * (APIENTRY * glXGetClientStringPROC) (Display *dpy, int name ); typedef const char * (APIENTRY * glXQueryServerStringPROC) (Display *dpy, int screen, int name ); typedef const char * (APIENTRY * glXQueryExtensionsStringPROC) (Display *dpy, int screen ); /* GLX_SGI_swap_control */ typedef void (APIENTRY * glXSwapIntervalSGIPROC)(int interval); /* GLX_ARB_create_context */ typedef GLXContext (APIENTRY * glXCreateContextAttribsARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); typedef struct { bool GLX12; bool GLX13; bool GLX14; /* bool GLX_EXT_visual_info; bool GLX_EXT_visual_rating;*/ bool GLX_SGI_swap_control; bool GLX_ARB_multisample; bool GLX_ARB_fbconfig_float; bool GLX_EXT_fbconfig_packed_float; bool GLX_ARB_framebuffer_sRGB; bool GLX_ARB_create_context; bool GLX_NV_multisample_coverage; } GLXExtensions; /* Add _ to global symbols to avoid symbol clash with the OpenGL library */ extern glXGetFBConfigsPROC lwjgl_glXGetFBConfigs; extern glXChooseFBConfigPROC lwjgl_glXChooseFBConfig; extern glXGetFBConfigAttribPROC lwjgl_glXGetFBConfigAttrib; extern glXGetVisualFromFBConfigPROC lwjgl_glXGetVisualFromFBConfig; extern glXCreateWindowPROC lwjgl_glXCreateWindow; extern glXDestroyWindowPROC lwjgl_glXDestroyWindow; extern glXCreatePixmapPROC lwjgl_glXCreatePixmap; extern glXDestroyPixmapPROC lwjgl_glXDestroyPixmap; extern glXCreatePbufferPROC lwjgl_glXCreatePbuffer; extern glXDestroyPbufferPROC lwjgl_glXDestroyPbuffer; extern glXQueryDrawablePROC lwjgl_glXQueryDrawable; extern glXCreateNewContextPROC lwjgl_glXCreateNewContext; extern glXMakeContextCurrentPROC lwjgl_glXMakeContextCurrent; extern glXGetCurrentReadDrawablePROC lwjgl_glXGetCurrentReadDrawable; extern glXGetCurrentDisplayPROC lwjgl_glXGetCurrentDisplay; extern glXQueryContextPROC lwjgl_glXQueryContext; extern glXSelectEventPROC lwjgl_glXSelectEvent; extern glXGetSelectedEventPROC lwjgl_glXGetSelectedEvent; extern glXChooseVisualPROC lwjgl_glXChooseVisual; extern glXCopyContextPROC lwjgl_glXCopyContext; extern glXCreateContextPROC lwjgl_glXCreateContext; extern glXCreateGLXPixmapPROC lwjgl_glXCreateGLXPixmap; extern glXDestroyContextPROC lwjgl_glXDestroyContext; extern glXDestroyGLXPixmapPROC lwjgl_glXDestroyGLXPixmap; extern glXGetConfigPROC lwjgl_glXGetConfig; extern glXGetCurrentContextPROC lwjgl_glXGetCurrentContext; extern glXGetCurrentDrawablePROC lwjgl_glXGetCurrentDrawable; extern glXIsDirectPROC lwjgl_glXIsDirect; extern glXMakeCurrentPROC lwjgl_glXMakeCurrent; extern glXQueryExtensionPROC lwjgl_glXQueryExtension; extern glXQueryVersionPROC lwjgl_glXQueryVersion; extern glXSwapBuffersPROC lwjgl_glXSwapBuffers; extern glXUseXFontPROC lwjgl_glXUseXFont; extern glXWaitGLPROC lwjgl_glXWaitGL; extern glXWaitXPROC lwjgl_glXWaitX; extern glXGetClientStringPROC lwjgl_glXGetClientString; extern glXQueryServerStringPROC lwjgl_glXQueryServerString; extern glXQueryExtensionsStringPROC lwjgl_glXQueryExtensionsString; extern glXSwapIntervalSGIPROC lwjgl_glXSwapIntervalSGI; extern glXCreateContextAttribsARBPROC lwjgl_glXCreateContextAttribsARB; extern bool extgl_InitGLX(Display *disp, int screen, GLXExtensions *extension_flags); #endif lwjgl-2.7.1/src/native/linux/display.c0000644000175000017500000003706311543426510016757 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: display.c 2985 2008-04-07 18:42:36Z matzon $ * * Linux specific library for display handling. * * @author elias_naur * @version $Revision: 2985 $ */ #include #include #include #include #include #include #include #include #include "common_tools.h" #include "org_lwjgl_opengl_LinuxDisplay.h" #define NUM_XRANDR_RETRIES 5 typedef struct { int width; int height; int freq; union { int size_index; // Data for Xrandr extension XF86VidModeModeInfo xf86vm_modeinfo; // Data for XF86VidMode extension } mode_data; } mode_info; static bool getXF86VidModeVersion(JNIEnv *env, Display *disp, int *major, int *minor) { int event_base, error_base; if (!XF86VidModeQueryExtension(disp, &event_base, &error_base)) { printfDebugJava(env, "XF86VidMode extension not available"); return false; } if (!XF86VidModeQueryVersion(disp, major, minor)) { throwException(env, "Could not query XF86VidMode version"); return false; } printfDebugJava(env, "XF86VidMode extension version %i.%i", *major, *minor); return true; } static bool getXrandrVersion(JNIEnv *env, Display *disp, int *major, int *minor) { int event_base, error_base; if (!XRRQueryExtension(disp, &event_base, &error_base)) { printfDebugJava(env, "Xrandr extension not available"); return false; } if (!XRRQueryVersion(disp, major, minor)) { throwException(env, "Could not query Xrandr version"); return false; } printfDebugJava(env, "Xrandr extension version %i.%i", *major, *minor); return true; } static bool isXrandrSupported(JNIEnv *env, Display *disp) { int major, minor; if (!getXrandrVersion(env, disp, &major, &minor)) return false; return major >= 1; } static bool isXF86VidModeSupported(JNIEnv *env, Display *disp) { int minor_ver, major_ver; if (!getXF86VidModeVersion(env, disp, &major_ver, &minor_ver)) return false; return major_ver >= 2; } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXrandrSupported(JNIEnv *env, jclass unused, jlong display) { Display *disp = (Display *)(intptr_t)display; jboolean result = isXrandrSupported(env, disp) ? JNI_TRUE : JNI_FALSE; return result; } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXF86VidModeSupported(JNIEnv *env, jclass unused, jlong display) { Display *disp = (Display *)(intptr_t)display; jboolean result = isXF86VidModeSupported(env, disp) ? JNI_TRUE : JNI_FALSE; return result; } static mode_info *getXrandrDisplayModes(Display *disp, int screen, int *num_modes) { int num_randr_sizes; XRRScreenSize *sizes = XRRSizes(disp, screen, &num_randr_sizes); mode_info *avail_modes = NULL; int list_size = 0; /* Count number of modes */ int i; int mode_index = 0; for (i = 0; i < num_randr_sizes; i++) { int num_randr_rates; short *freqs = XRRRates(disp, screen, i, &num_randr_rates); int j; for (j = 0; j < num_randr_rates; j++) { if (list_size <= mode_index) { list_size += 1; avail_modes = (mode_info *)realloc(avail_modes, sizeof(mode_info)*list_size); if (avail_modes == NULL) return NULL; } avail_modes[mode_index].width = sizes[i].width; avail_modes[mode_index].height = sizes[i].height; avail_modes[mode_index].freq = freqs[j]; avail_modes[mode_index].mode_data.size_index = i; mode_index++; } } *num_modes = mode_index; return avail_modes; } static mode_info *getXF86VidModeDisplayModes(Display *disp, int screen, int *num_modes) { int num_xf86vm_modes; XF86VidModeModeInfo **avail_xf86vm_modes; XF86VidModeGetAllModeLines(disp, screen, &num_xf86vm_modes, &avail_xf86vm_modes); mode_info *avail_modes = (mode_info *)malloc(sizeof(mode_info)*num_xf86vm_modes); if (avail_modes == NULL) { XFree(avail_xf86vm_modes); return NULL; } int i; for (i = 0; i < num_xf86vm_modes; i++) { avail_modes[i].width = avail_xf86vm_modes[i]->hdisplay; avail_modes[i].height = avail_xf86vm_modes[i]->vdisplay; avail_modes[i].freq = 0; // No frequency support in XF86VidMode avail_modes[i].mode_data.xf86vm_modeinfo = *avail_xf86vm_modes[i]; } XFree(avail_xf86vm_modes); *num_modes = num_xf86vm_modes; return avail_modes; } static mode_info *getDisplayModes(Display *disp, int screen, jint extension, int *num_modes) { switch (extension) { case org_lwjgl_opengl_LinuxDisplay_XF86VIDMODE: return getXF86VidModeDisplayModes(disp, screen, num_modes); case org_lwjgl_opengl_LinuxDisplay_XRANDR: return getXrandrDisplayModes(disp, screen, num_modes); case org_lwjgl_opengl_LinuxDisplay_NONE: // fall through default: return NULL; } } static bool setXF86VidModeMode(Display *disp, int screen, mode_info *mode) { return True == XF86VidModeSwitchToMode(disp, screen, &mode->mode_data.xf86vm_modeinfo); } /* Try to set the mode specified through XRandR. * Return value is the Status code of the mode switch * The timestamp parameter is filled with the latest timestamp returned from XRRConfigTimes */ static Status trySetXrandrMode(Display *disp, int screen, mode_info *mode, Time *timestamp) { Status status; Drawable root_window = RootWindow(disp, screen); XRRScreenConfiguration *screen_configuration = XRRGetScreenInfo(disp, root_window); Time config_time; *timestamp = XRRConfigTimes(screen_configuration, &config_time); Rotation current_rotation; XRRConfigCurrentConfiguration(screen_configuration, ¤t_rotation); status = XRRSetScreenConfigAndRate(disp, screen_configuration, root_window, mode->mode_data.size_index, current_rotation, mode->freq, *timestamp); XRRFreeScreenConfigInfo(screen_configuration); return status; } static bool setXrandrMode(Display *disp, int screen, mode_info *mode) { int iteration; Time timestamp; Status status = trySetXrandrMode(disp, screen, mode, ×tamp); if (status == 0) return true; // Success Time new_timestamp; for (iteration = 0; iteration < NUM_XRANDR_RETRIES; iteration++) { status = trySetXrandrMode(disp, screen, mode, &new_timestamp); if (status == 0) return true; // Success if (new_timestamp == timestamp) { return false; // Failure, and the stamps are equal meaning that the failure is not merely transient } timestamp = new_timestamp; } return false; } static bool setMode(JNIEnv *env, Display *disp, int screen, jint extension, int width, int height, int freq) { int num_modes, i; mode_info *avail_modes = getDisplayModes(disp, screen, extension, &num_modes); if (avail_modes == NULL) { printfDebugJava(env, "Could not get display modes"); return false; } bool result = false; for (i = 0; i < num_modes; ++i) { printfDebugJava(env, "Mode %d: %dx%d @%d", i, avail_modes[i].width, avail_modes[i].height, avail_modes[i].freq); if (avail_modes[i].width == width && avail_modes[i].height == height && avail_modes[i].freq == freq) { switch (extension) { case org_lwjgl_opengl_LinuxDisplay_XF86VIDMODE: if (!setXF86VidModeMode(disp, screen, &avail_modes[i])) { printfDebugJava(env, "Could not switch mode"); continue; } break; case org_lwjgl_opengl_LinuxDisplay_XRANDR: if (!setXrandrMode(disp, screen, &avail_modes[i])) { printfDebugJava(env, "Could not switch mode"); continue; } break; case org_lwjgl_opengl_LinuxDisplay_NONE: // Should never happen, since NONE imply no available display modes default: // Should never happen continue; } result = true; break; } } free(avail_modes); XFlush(disp); return result; } static int getGammaRampLengthOfDisplay(JNIEnv *env, Display *disp, int screen) { int ramp_size; if (XF86VidModeGetGammaRampSize(disp, screen, &ramp_size) == False) { throwException(env, "XF86VidModeGetGammaRampSize call failed"); return 0; } return ramp_size; } JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nConvertToNativeRamp(JNIEnv *env, jclass unused, jobject ramp_buffer, jint buffer_offset, jint length) { const jfloat *ramp_ptr = (const jfloat *)(*env)->GetDirectBufferAddress(env, ramp_buffer) + buffer_offset; jobject native_ramp = newJavaManagedByteBuffer(env, length*3*sizeof(unsigned short)); if (native_ramp == NULL) { throwException(env, "Failed to allocate gamma ramp buffer"); return NULL; } unsigned short *native_ramp_ptr = (unsigned short *)(*env)->GetDirectBufferAddress(env, native_ramp); int i; for (i = 0; i < length; i++) { float scaled_gamma = ramp_ptr[i]*0xffff; short scaled_gamma_short = (unsigned short)roundf(scaled_gamma); native_ramp_ptr[i] = scaled_gamma_short; native_ramp_ptr[i + length] = scaled_gamma_short; native_ramp_ptr[i + length*2] = scaled_gamma_short; } return native_ramp; } JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentGammaRamp(JNIEnv *env, jclass unused, jlong display, jint screen) { Display *disp = (Display *)(intptr_t)display; int ramp_size = getGammaRampLengthOfDisplay(env, disp, screen); jobject ramp_buffer = newJavaManagedByteBuffer(env, sizeof(unsigned short)*3*ramp_size); if (ramp_buffer == NULL) { throwException(env, "Could not allocate gamma ramp buffer"); return NULL; } unsigned short *ramp = (unsigned short *)(*env)->GetDirectBufferAddress(env, ramp_buffer); if (!XF86VidModeGetGammaRamp(disp, screen, ramp_size, ramp, ramp + ramp_size, ramp + ramp_size*2)) { throwException(env, "Could not get the current gamma ramp"); return NULL; } return ramp_buffer; } static void setGamma(JNIEnv *env, Display *disp, int screen, jobject ramp_buffer) { if (ramp_buffer == NULL) return; unsigned short *ramp_ptr = (unsigned short *)(*env)->GetDirectBufferAddress(env, ramp_buffer); jlong capacity = (*env)->GetDirectBufferCapacity(env, ramp_buffer); int size = capacity/(sizeof(unsigned short)*3); if (size == 0) return; if (XF86VidModeSetGammaRamp(disp, screen, size, ramp_ptr, ramp_ptr + size, ramp_ptr + size*2) == False) { throwException(env, "Could not set gamma ramp."); } } static bool switchDisplayMode(JNIEnv * env, Display *disp, int screen, jint extension, jobject mode) { if (mode == NULL) { throwException(env, "mode must be non-null"); return false; } jclass cls_displayMode = (*env)->GetObjectClass(env, mode); jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I"); jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I"); jfieldID fid_freq = (*env)->GetFieldID(env, cls_displayMode, "freq", "I"); int width = (*env)->GetIntField(env, mode, fid_width); int height = (*env)->GetIntField(env, mode, fid_height); int freq = (*env)->GetIntField(env, mode, fid_freq); if (!setMode(env, disp, screen, extension, width, height, freq)) { throwException(env, "Could not switch mode."); return false; } return true; } static jobjectArray getAvailableDisplayModes(JNIEnv * env, Display *disp, int screen, jint extension) { int num_modes, i; mode_info *avail_modes; int bpp = XDefaultDepth(disp, screen); avail_modes = getDisplayModes(disp, screen, extension, &num_modes); if (avail_modes == NULL) { printfDebugJava(env, "Could not get display modes"); return NULL; } // Allocate an array of DisplayModes big enough jclass displayModeClass = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode"); jobjectArray ret = (*env)->NewObjectArray(env, num_modes, displayModeClass, NULL); jmethodID displayModeConstructor = (*env)->GetMethodID(env, displayModeClass, "", "(IIII)V"); for (i = 0; i < num_modes; i++) { jobject displayMode = (*env)->NewObject(env, displayModeClass, displayModeConstructor, avail_modes[i].width, avail_modes[i].height, bpp, avail_modes[i].freq); (*env)->SetObjectArrayElement(env, ret, i, displayMode); } free(avail_modes); return ret; } static jobject getCurrentXRandrMode(JNIEnv * env, Display *disp, int screen) { Drawable root_window = RootWindow(disp, screen); XRRScreenConfiguration *config = XRRGetScreenInfo(disp, root_window); if (config == NULL) { throwException(env, "Could not get current screen configuration."); return NULL; } short rate = XRRConfigCurrentRate(config); Rotation current_rotation; SizeID size_index = XRRConfigCurrentConfiguration(config, ¤t_rotation); int n_sizes; XRRScreenSize *sizes = XRRConfigSizes(config, &n_sizes); if (size_index >= n_sizes) { throwFormattedException(env, "Xrandr current index (%d) is larger than or equals to the number of sizes (%d).", size_index, n_sizes); XRRFreeScreenConfigInfo(config); return NULL; } XRRScreenSize current_size = sizes[size_index]; XRRFreeScreenConfigInfo(config); int bpp = XDefaultDepth(disp, screen); jclass displayModeClass = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode"); jmethodID displayModeConstructor = (*env)->GetMethodID(env, displayModeClass, "", "(IIII)V"); jobject displayMode = (*env)->NewObject(env, displayModeClass, displayModeConstructor, current_size.width, current_size.height, bpp, rate); return displayMode; } JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentXRandrMode(JNIEnv *env, jclass unused, jlong display, jint screen) { Display *disp = (Display *)(intptr_t)display; return getCurrentXRandrMode(env, disp, screen); } JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetAvailableDisplayModes(JNIEnv *env, jclass clazz, jlong display, jint screen, jint extension) { Display *disp = (Display *)(intptr_t)display; return getAvailableDisplayModes(env, disp, screen, extension); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSwitchDisplayMode(JNIEnv *env, jclass clazz, jlong display, jint screen, jint extension, jobject mode) { Display *disp = (Display *)(intptr_t)display; switchDisplayMode(env, disp, screen, extension, mode); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetGammaRampLength(JNIEnv *env, jclass clazz, jlong display_ptr, jint screen) { Display *disp = (Display *)(intptr_t)display_ptr; return (jint)getGammaRampLengthOfDisplay(env, disp, screen); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetGammaRamp(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject gamma_buffer) { Display *disp = (Display *)(intptr_t)display; setGamma(env, disp, screen, gamma_buffer); } lwjgl-2.7.1/src/native/linux/org_lwjgl_opengl_LinuxCanvasImplementation.c0000644000175000017500000000503711543426510026061 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_LinuxCanvasImplementation.c 2985 2008-04-07 18:42:36Z matzon $ * * @author elias_naur * @version $Revision: 2985 $ */ #include #include #include #include #include "org_lwjgl_opengl_LinuxCanvasImplementation.h" #include "extgl_glx.h" #include "context.h" JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxCanvasImplementation_nFindVisualIDFromFormat (JNIEnv *env, jclass clazz, jlong display, jint screen, jobject pixel_format) { Display *disp = (Display *)(intptr_t)display; GLXExtensions extension_flags; if (!extgl_InitGLX(disp, screen, &extension_flags)) { throwException(env, "Could not initialize GLX"); return -1; } XVisualInfo *vis_info = chooseVisualGLX(env, disp, screen, pixel_format, true, true); if (vis_info == NULL) { throwException(env, "Could not choose a VisualInfo"); return -1; } VisualID vis_id = vis_info->visualid; XFree(vis_info); return vis_id; } lwjgl-2.7.1/src/native/linux/org_lwjgl_opengl_LinuxEvent.c0000644000175000017500000002057411543426510023024 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_LinuxEvent.c 2598 2006-10-24 08:33:09Z elias_naur $ * * @author elias_naur * @version $Revision: 2598 $ */ #include #include #include #include #include "common_tools.h" #include "org_lwjgl_opengl_LinuxEvent.h" JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxEvent_createEventBuffer(JNIEnv *env, jclass unused) { return newJavaManagedByteBuffer(env, sizeof(XEvent)); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_getPending(JNIEnv *env, jclass unused, jlong display_ptr) { Display *disp = (Display *)(intptr_t)display_ptr; return XPending(disp); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxEvent_nSetWindow(JNIEnv *env, jclass unused, jobject event_buffer, jlong window_ptr) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); Window window = (Window)window_ptr; event->xany.window = window; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxEvent_nSendEvent(JNIEnv *env, jclass unused, jobject event_buffer, jlong display_ptr, jlong window_ptr, jboolean propagate, jlong eventmask) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); Display *disp = (Display *)(intptr_t)display_ptr; Window window = (Window)window_ptr; XSendEvent(disp, window, propagate == JNI_TRUE ? True : False, eventmask, event); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetFocusDetail(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xfocus.detail; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetFocusMode(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xfocus.mode; } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxEvent_nFilterEvent(JNIEnv *env, jclass unused, jobject event_buffer, jlong window_ptr) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); Window window = (Window)window_ptr; return XFilterEvent(event, window) == True ? JNI_TRUE : JNI_FALSE; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxEvent_nNextEvent(JNIEnv *env, jclass unused, jlong display_ptr, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); Display *disp = (Display *)(intptr_t)display_ptr; XNextEvent(disp, event); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetType(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->type; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetWindow(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xany.window; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetClientMessageType(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xclient.message_type; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetClientData(JNIEnv *env, jclass unused, jobject event_buffer, jint index) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xclient.data.l[index]; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetClientFormat(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xclient.format; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonTime(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xbutton.time; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonState(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xbutton.state; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonType(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xbutton.type; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonButton(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xbutton.button; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonRoot(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xbutton.root; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonXRoot(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xbutton.x_root; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonYRoot(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xbutton.y_root; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonX(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xbutton.x; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonY(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xbutton.y; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyAddress(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); XKeyEvent *key_event = &(event->xkey); return (jlong)(intptr_t)key_event; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyTime(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xkey.time; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyType(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xkey.type; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyKeyCode(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xkey.keycode; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyState(JNIEnv *env, jclass unused, jobject event_buffer) { XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer); return event->xkey.state; } lwjgl-2.7.1/src/native/linux/org_lwjgl_opengl_LinuxPeerInfo.c0000644000175000017500000000466211543426510023452 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_LinuxPeerInfo.c 3358 2010-06-03 15:49:26Z spasi $ * * @author elias_naur * @version $Revision: 3358 $ */ #include #include "org_lwjgl_opengl_LinuxPeerInfo.h" #include "context.h" #include "common_tools.h" JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxPeerInfo_createHandle (JNIEnv *env, jclass clazz) { return newJavaManagedByteBuffer(env, sizeof(X11PeerInfo)); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxPeerInfo_nGetDisplay(JNIEnv *env, jclass unused, jobject handle) { X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, handle); return (jlong)(intptr_t)peer_info->display; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxPeerInfo_nGetDrawable(JNIEnv *env, jclass unused, jobject handle) { X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, handle); return peer_info->drawable; } lwjgl-2.7.1/src/native/linux/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c0000644000175000017500000000673511543426510025410 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c 2985 2008-04-07 18:42:36Z matzon $ * * @author elias_naur * @version $Revision: 2985 $ */ #include #include #include #include #include #include "awt_tools.h" #include "org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.h" #include "context.h" JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo_getScreenFromSurfaceInfo (JNIEnv *env, jclass clazz, jobject lock_buffer_handle) { const AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); // Get the platform-specific drawing info JAWT_X11DrawingSurfaceInfo *dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)awt_lock->dsi->platformInfo; XVisualInfo template; int num_infos; template.visualid = dsi_x11->visualID; template.depth = dsi_x11->depth; XVisualInfo *vis_info = XGetVisualInfo(dsi_x11->display, VisualIDMask | VisualDepthMask, &template, &num_infos); if (vis_info == NULL) { throwException(env, "Could not determine screen"); return -1; } int screen = vis_info[0].screen; XFree(vis_info); return screen; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo_nInitHandle (JNIEnv *env, jclass clazz, int screen, jobject lock_buffer_handle, jobject peer_info_handle) { const AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); X11PeerInfo *peer_info = (X11PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); // Get the platform-specific drawing info JAWT_X11DrawingSurfaceInfo *dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)awt_lock->dsi->platformInfo; peer_info->display = dsi_x11->display; peer_info->screen = screen; peer_info->drawable = dsi_x11->drawable; peer_info->glx13 = false; peer_info->config.glx_config.visualid = dsi_x11->visualID; peer_info->config.glx_config.depth = dsi_x11->depth; } lwjgl-2.7.1/src/native/linux/context.h0000644000175000017500000000577611543426510017011 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: context.h 2985 2008-04-07 18:42:36Z matzon $ * * Include file to access public window features * * @author elias_naur * @version $Revision: 2985 $ */ #ifndef _LWJGL_CONTEXT_H_INCLUDED_ #define _LWJGL_CONTEXT_H_INCLUDED_ #include #include #include #include #include "extgl_glx.h" typedef struct { VisualID visualid; int depth; } GLXConfig; typedef struct { GLXFBConfigID config_id; } GLX13Config; typedef struct { Display *display; int screen; GLXDrawable drawable; // This flag determines the appropriate glx struct bool glx13; union { GLXConfig glx_config; GLX13Config glx13_config; } config; } X11PeerInfo; /* GLX 1.3 chooser */ extern GLXFBConfig *chooseVisualGLX13(JNIEnv *env, Display *disp, int screen, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffer); /* Default GLX chooser*/ extern XVisualInfo *chooseVisualGLX(JNIEnv *env, Display *disp, int screen, jobject pixel_format, bool use_display_bpp, bool double_buffer); extern XVisualInfo *getVisualInfoFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info); extern GLXFBConfig *getFBConfigFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info); extern bool initPeerInfo(JNIEnv *env, jobject peer_info_handle, Display *display, int screen, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffered, bool force_glx13); #endif /* _LWJGL_CONTEXT_H_INCLUDED_ */ lwjgl-2.7.1/src/native/common/0000755000175000017500000000000011543426510015266 5ustar zero79zero79lwjgl-2.7.1/src/native/common/extcl.c0000644000175000017500000000522111543426510016551 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include "extcl.h" typedef CL_API_ENTRY void * (CL_API_CALL *clGetExtensionFunctionAddressPROC) (const char * func_name); static clGetExtensionFunctionAddressPROC clGetExtensionFunctionAddress; /** * Retrieves a pointer to the named function * * @param function Name of function * @return pointer to named function, or NULL if not found */ void* extcl_GetProcAddress(const char * function) { void *p = NULL; if ( clGetExtensionFunctionAddress == NULL ) clGetExtensionFunctionAddress = extcl_NativeGetFunctionPointer("clGetExtensionFunctionAddress"); p = clGetExtensionFunctionAddress(function); if ( p == NULL ) p = extcl_NativeGetFunctionPointer(function); return p; } void extcl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions) { ext_InitializeClass(env, clazz, &extcl_GetProcAddress, num_functions, functions); } int extcl_CalculateImageSize(const size_t *region, size_t row_pitch, size_t slice_pitch) { if ( slice_pitch == 0 ) return region[1] * row_pitch; else return region[2] * slice_pitch; } lwjgl-2.7.1/src/native/common/extal.h0000644000175000017500000001031411543426510016553 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _AL_TEST_H #define _AL_TEST_H #ifdef _WIN32 #include #endif #include #include "common_tools.h" #ifdef __cplusplus extern "C" { #endif #if defined(_WIN32) #ifdef _OPENAL32LIB #define ALCAPI __declspec(dllexport) #else #define ALCAPI __declspec(dllimport) #endif #define ALCAPIENTRY __cdecl #else #define ALCAPI #define ALCAPIENTRY #endif #ifdef _WIN32 #ifdef _OPENAL32LIB #define ALAPI __declspec(dllexport) #else #define ALAPI __declspec(dllimport) #endif #define ALAPIENTRY __cdecl #define AL_CALLBACK #else #define ALAPI #define ALAPIENTRY #define AL_CALLBACK #endif #define INITGUID #define OPENAL // ALC typedefs typedef struct ALCdevice_struct ALCdevice; typedef struct ALCcontext_struct ALCcontext; /** 8-bit boolean */ typedef char ALCboolean; /** character */ typedef char ALCchar; /** signed 8-bit 2's complement integer */ typedef char ALCbyte; /** unsigned 8-bit integer */ typedef unsigned char ALCubyte; /** signed 16-bit 2's complement integer */ typedef short ALCshort; /** unsigned 16-bit integer */ typedef unsigned short ALCushort; /** signed 32-bit 2's complement integer */ typedef int ALCint; /** unsigned 32-bit integer */ typedef unsigned int ALCuint; /** non-negative 32-bit binary integer size */ typedef int ALCsizei; /** enumerated 32-bit value */ typedef int ALCenum; /** 32-bit IEEE754 floating-point */ typedef float ALCfloat; /** 64-bit IEEE754 floating-point */ typedef double ALCdouble; /** void type (for opaque pointers only) */ typedef void ALCvoid; // AL typedefs /** 8-bit boolean */ typedef char ALboolean; /** character */ typedef char ALchar; /** signed 8-bit 2's complement integer */ typedef char ALbyte; /** unsigned 8-bit integer */ typedef unsigned char ALubyte; /** signed 16-bit 2's complement integer */ typedef short ALshort; /** unsigned 16-bit integer */ typedef unsigned short ALushort; /** signed 32-bit 2's complement integer */ typedef int ALint; /** unsigned 32-bit integer */ typedef unsigned int ALuint; /** non-negative 32-bit binary integer size */ typedef int ALsizei; /** enumerated 32-bit value */ typedef int ALenum; /** 32-bit IEEE754 floating-point */ typedef float ALfloat; /** 64-bit IEEE754 floating-point */ typedef double ALdouble; /** void type (for opaque pointers only) */ typedef void ALvoid; void* extal_GetProcAddress(const char* function); void extal_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions); /* Platform dependent functions */ void *extal_NativeGetFunctionPointer(const char *function); void extal_LoadLibrary(JNIEnv *env, jstring path); void extal_UnloadLibrary(); #ifdef __cplusplus } #endif #endif lwjgl-2.7.1/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c0000644000175000017500000000657411543426510023635 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_AWTSurfaceLock.c 2985 2008-04-07 18:42:36Z matzon $ * * @author elias_naur * @version $Revision: 2985 $ */ #include #include #include "org_lwjgl_opengl_AWTSurfaceLock.h" #include "awt_tools.h" #include "common_tools.h" JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_AWTSurfaceLock_createHandle (JNIEnv *env, jclass clazz) { return newJavaManagedByteBuffer(env, sizeof(AWTSurfaceLock)); } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_AWTSurfaceLock_lockAndInitHandle (JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject canvas) { JAWT awt; JAWT_DrawingSurface* ds; JAWT_DrawingSurfaceInfo *dsi; AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); awt.version = JAWT_VERSION_1_4; if (JAWT_GetAWT(env, &awt) == JNI_FALSE) { throwException(env, "Could not get the JAWT interface"); return JNI_FALSE; } ds = awt.GetDrawingSurface(env, canvas); if (ds == NULL) { throwException(env, "Could not get the drawing surface"); return JNI_FALSE; } if((ds->Lock(ds) & JAWT_LOCK_ERROR) != 0) { awt.FreeDrawingSurface(ds); throwException(env, "Could not lock the drawing surface"); return JNI_FALSE; } dsi = ds->GetDrawingSurfaceInfo(ds); if (dsi != NULL) { awt_lock->awt = awt; awt_lock->ds = ds; awt_lock->dsi = dsi; return JNI_TRUE; } ds->Unlock(ds); awt.FreeDrawingSurface(ds); return JNI_FALSE; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AWTSurfaceLock_nUnlock (JNIEnv *env, jclass clazz, jobject lock_buffer_handle) { AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); awt_lock->ds->FreeDrawingSurfaceInfo(awt_lock->dsi); awt_lock->ds->Unlock(awt_lock->ds); awt_lock->awt.FreeDrawingSurface(awt_lock->ds); } lwjgl-2.7.1/src/native/common/org_lwjgl_openal_ALC10.c0000644000175000017500000003124211543426510021600 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_openal_ALC.c 2279 2006-02-23 19:22:00Z elias_naur $ * * This is the actual JNI implementation of the OpenAL context/device library. * * @author Brian Matzon * @version $Revision: 2279 $ */ /* OpenAL includes */ #include "extal.h" //alc typedef ALCubyte* (ALCAPIENTRY *alcGetStringPROC)(ALCdevice *device,ALCenum param); typedef ALCvoid (ALCAPIENTRY *alcGetIntegervPROC)(ALCdevice *device,ALCenum param,ALCsizei size,ALCint *data); typedef ALCdevice* (ALCAPIENTRY *alcOpenDevicePROC)(ALCubyte *deviceName); typedef ALCboolean (ALCAPIENTRY *alcCloseDevicePROC)(ALCdevice *device); typedef ALCcontext* (ALCAPIENTRY *alcCreateContextPROC)(ALCdevice *device,ALCint *attrList); typedef ALCenum (ALCAPIENTRY *alcMakeContextCurrentPROC)(ALCcontext *context); typedef ALCvoid (ALCAPIENTRY *alcProcessContextPROC)(ALCcontext *context); typedef ALCdevice* (ALCAPIENTRY *alcGetContextsDevicePROC)(ALCcontext *context); typedef ALCvoid (ALCAPIENTRY *alcSuspendContextPROC)(ALCcontext *context); typedef ALCvoid (ALCAPIENTRY *alcDestroyContextPROC)(ALCcontext *context); typedef ALCenum (ALCAPIENTRY *alcGetErrorPROC)(ALCdevice *device); typedef ALCboolean (ALCAPIENTRY *alcIsExtensionPresentPROC)(ALCdevice *device,ALCubyte *extName); //typedef ALCvoid* (ALCAPIENTRY *alcGetProcAddressPROC)(ALCdevice *device,ALCubyte *funcName); typedef ALCenum (ALCAPIENTRY *alcGetEnumValuePROC)(ALCdevice *device,ALCubyte *enumName); typedef ALCcontext* (ALCAPIENTRY *alcGetCurrentContextPROC)(ALCvoid); static alcGetCurrentContextPROC alcGetCurrentContext = NULL; static alcGetStringPROC alcGetString; static alcGetIntegervPROC alcGetIntegerv; static alcOpenDevicePROC alcOpenDevice; static alcCloseDevicePROC alcCloseDevice; static alcCreateContextPROC alcCreateContext; static alcMakeContextCurrentPROC alcMakeContextCurrent; static alcProcessContextPROC alcProcessContext; static alcGetContextsDevicePROC alcGetContextsDevice; static alcSuspendContextPROC alcSuspendContext; static alcDestroyContextPROC alcDestroyContext; static alcGetErrorPROC alcGetError; static alcIsExtensionPresentPROC alcIsExtensionPresent; //static alcGetProcAddressPROC alcGetProcAddress; static alcGetEnumValuePROC alcGetEnumValue; /** * This function returns strings related to the context. * * C Specification: * ALubyte * alcGetString(ALCdevice *device, ALenum token); */ static jstring JNICALL Java_org_lwjgl_openal_ALC10_nalcGetString (JNIEnv *env, jclass clazz, jlong deviceaddress, jint token) { const char* alcString = (const char*) alcGetString((ALCdevice*)((intptr_t)deviceaddress), (ALenum) token); int length; int i=1; if (alcString == NULL) { return NULL; } // Special treatment of enumeration tokens // These are encoded using \0 between elements and a finishing \0\0 switch(token) { case 0x1005: // ALC_DEVICE_SPECIFIER case 0x310: // ALC_CAPTURE_DEVICE_SPECIFIER // If deviceaddress is not 0, OpenAL returns a single device terminated by a // single \0 character, if token is ALC_DEVICE_SPECIFIER or // ALC_CAPTURE_DEVICE_SPECIFIER. if (deviceaddress != 0) { length = strlen(alcString); break; } case 0x1013: // ALC_ALL_DEVICES_SPECIFIER while (alcString[i - 1] != '\0' || alcString[i] != '\0') { i++; } length = i + 1; break; default: // e.g. ALC_DEFAULT_ALL_DEVICES_SPECIFIER length = strlen(alcString); } return NewStringNativeWithLength(env, alcString, length); } /** * This function returns integers related to the context. * * C Specification: * ALvoid alcGetIntegerv(ALCdevice *device, ALenum token, ALsizei size, ALint *dest); */ static void JNICALL Java_org_lwjgl_openal_ALC10_nalcGetIntegerv (JNIEnv *env, jclass clazz, jlong deviceaddress, jint token, jint size, jobject dest, jint offset) { ALint* address = NULL; if (dest != NULL) { address = offset + (ALint*) (*env)->GetDirectBufferAddress(env, dest); } alcGetIntegerv((ALCdevice*)((intptr_t)deviceaddress), (ALenum) token, (ALsizei) size, address); } /** * This function opens a device by name. * * C Specification: * ALCdevice *alcOpenDevice( const ALubyte *tokstr ); */ static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcOpenDevice (JNIEnv *env, jclass clazz, jstring tokstr) { char * tokenstring; ALCdevice* device; if(tokstr != NULL) { tokenstring = GetStringNativeChars(env, tokstr); } else { tokenstring = NULL; } /* get device */ device = alcOpenDevice((ALubyte *) tokenstring); if(tokenstring != NULL) { free(tokenstring); } return (jlong)((intptr_t)device); } /** * This function closes a device by name. * * C Specification: * bool alcCloseDevice( ALCdevice *dev ); */ static jboolean JNICALL Java_org_lwjgl_openal_ALC10_nalcCloseDevice (JNIEnv *env, jclass clazz, jlong deviceaddress) { return alcCloseDevice((ALCdevice*)((intptr_t)deviceaddress)); } /** * This function creates a context using a specified device. * * C Specification: * ALCcontext* alcCreateContext( ALCdevice *dev, ALint* attrlist ); */ static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcCreateContext (JNIEnv *env, jclass clazz, jlong deviceaddress, jobject attrlist) { ALint* address = NULL; ALCcontext* context; if (attrlist != NULL) { address = (ALint*) safeGetBufferAddress(env, attrlist); } context = alcCreateContext((ALCdevice*)((intptr_t)deviceaddress), address); return (jlong)((intptr_t)context); } /** * This function makes a specified context the current context. * * C Specification: * ALCboolean alcMakeContextCurrent(ALCcontext *context); */ static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcMakeContextCurrent (JNIEnv *env, jclass clazz, jlong contextaddress) { ALCcontext* context = (ALCcontext*)((intptr_t)contextaddress); return alcMakeContextCurrent(context); } /** * This function tells a context to begin processing. * * C Specification: * void alcProcessContext(ALCcontext *context); */ static void JNICALL Java_org_lwjgl_openal_ALC10_nalcProcessContext (JNIEnv *env, jclass clazz, jlong contextaddress) { alcProcessContext((ALCcontext*)((intptr_t)contextaddress)); } /** * This function retrieves the current context. * * C Specification: * ALCcontext* alcGetCurrentContext( ALvoid ); */ static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcGetCurrentContext (JNIEnv *env, jclass clazz) { ALCcontext* context = alcGetCurrentContext(); return (jlong)((intptr_t)context); } /** * This function retrieves the specified contexts device * * C Specification: * ALCdevice* alcGetContextsDevice(ALCcontext *context); */ static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcGetContextsDevice (JNIEnv *env, jclass clazz, jlong contextaddress) { ALCdevice* device = alcGetContextsDevice((ALCcontext*)((intptr_t)contextaddress)); return (jlong)((intptr_t)device); } /** * This function suspends processing on a specified context. * * C Specification: * void alcSuspendContext(ALCcontext *context); */ static void JNICALL Java_org_lwjgl_openal_ALC10_nalcSuspendContext (JNIEnv *env, jclass clazz, jlong contextaddress) { alcSuspendContext((ALCcontext*)((intptr_t)contextaddress)); } /** * This function destroys a context. * * C Specification: * void alcDestroyContext(ALCcontext *context); */ static void JNICALL Java_org_lwjgl_openal_ALC10_nalcDestroyContext (JNIEnv *env, jclass clazz, jlong contextaddress) { alcDestroyContext((ALCcontext*)((intptr_t)contextaddress)); } /** * This function retrieves the specified devices context error state. * * C Specification: * ALCenum alcGetError(ALCdevice *device); */ static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcGetError (JNIEnv *env, jclass clazz, jlong deviceaddress) { return alcGetError((ALCdevice*)((intptr_t)deviceaddress)); } /** * This function queries if a specified context extension is available. * * C Specification: * ALboolean alcIsExtensionPresent(ALCdevice *device, ALubyte *extName); */ static jboolean JNICALL Java_org_lwjgl_openal_ALC10_nalcIsExtensionPresent (JNIEnv *env, jclass clazz, jlong deviceaddress, jstring extName) { /* get extension */ ALubyte* functionname = (ALubyte*) GetStringNativeChars(env, extName); jboolean result = (jboolean) alcIsExtensionPresent((ALCdevice*)((intptr_t)deviceaddress), functionname); free(functionname); return result; } /** * This function retrieves the enum value for a specified enumeration name. * * C Specification: * ALenum alcGetEnumValue(ALCdevice *device, ALubyte *enumName); */ static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcGetEnumValue (JNIEnv *env, jclass clazz, jlong deviceaddress, jstring enumName) { /* get extension */ ALubyte* enumerationname = (ALubyte*) GetStringNativeChars(env, enumName); jint result = (jint) alcGetEnumValue((ALCdevice*)((intptr_t)deviceaddress), enumerationname); free(enumerationname); return result; } /** * Loads the context OpenAL functions * * @return true if all methods were loaded, false if one of the methods could not be loaded */ #ifdef __cplusplus extern "C" { #endif JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC10_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nalcGetString", "(JI)Ljava/lang/String;", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetString, "alcGetString", (void*)&alcGetString}, {"nalcGetIntegerv", "(JIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetIntegerv, "alcGetIntegerv", (void*)&alcGetIntegerv}, {"nalcOpenDevice", "(Ljava/lang/String;)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcOpenDevice, "alcOpenDevice", (void*)&alcOpenDevice}, {"nalcCloseDevice", "(J)Z", (void*)&Java_org_lwjgl_openal_ALC10_nalcCloseDevice, "alcCloseDevice", (void*)&alcCloseDevice}, {"nalcCreateContext", "(JLjava/nio/IntBuffer;)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcCreateContext, "alcCreateContext", (void*)&alcCreateContext}, {"nalcMakeContextCurrent", "(J)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcMakeContextCurrent, "alcMakeContextCurrent", (void*)&alcMakeContextCurrent}, {"nalcProcessContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcProcessContext, "alcProcessContext", (void*)&alcProcessContext}, {"nalcGetCurrentContext", "()J", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetCurrentContext, "alcGetCurrentContext", (void*)&alcGetCurrentContext}, {"nalcGetContextsDevice", "(J)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetContextsDevice, "alcGetContextsDevice", (void*)&alcGetContextsDevice}, {"nalcSuspendContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcSuspendContext, "alcSuspendContext", (void*)&alcSuspendContext}, {"nalcDestroyContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcDestroyContext, "alcDestroyContext", (void*)&alcDestroyContext}, {"nalcGetError", "(J)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetError, "alcGetError", (void*)&alcGetError}, {"nalcIsExtensionPresent", "(JLjava/lang/String;)Z", (void*)&Java_org_lwjgl_openal_ALC10_nalcIsExtensionPresent, "alcIsExtensionPresent", (void*)&alcIsExtensionPresent}, {"nalcGetEnumValue", "(JLjava/lang/String;)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetEnumValue, "alcGetEnumValue", (void*)&alcGetEnumValue} }; int num_functions = NUMFUNCTIONS(functions); extal_InitializeClass(env, clazz, num_functions, functions); } #ifdef __cplusplus } #endif lwjgl-2.7.1/src/native/common/extal.c0000644000175000017500000000555311543426510016557 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include "extal.h" typedef ALvoid* (ALAPIENTRY *alGetProcAddressPROC)(const ALubyte* fname); /* alGetProcAddress is commented out, since we don't use it anyway */ //static alGetProcAddressPROC alGetProcAddress = NULL; /** * Initializes OpenAL by loading the library */ /*void InitializeOpenAL(JNIEnv *env, jstring oalPath) { //load our library if (!extal_LoadLibrary(env, oalPath)) { throwException(env, "Could not load openal library."); return; } alGetProcAddress = (alGetProcAddressPROC)extal_NativeGetFunctionPointer("alGetProcAddress"); if (alGetProcAddress == NULL) { extal_UnloadLibrary(); throwException(env, "Could not load alGetProcAddress function pointer."); return; } }*/ /** * Retrieves a pointer to the named function * * @param function Name of function * @return pointer to named function, or NULL if not found */ void* extal_GetProcAddress(const char* function) { void *p; /* p = alGetProcAddress((const ALubyte*)function); if (p == NULL) {*/ p = extal_NativeGetFunctionPointer(function); if (p == NULL) { printfDebug("Could not locate symbol %s\n", function); } // } return p; } void extal_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions) { ext_InitializeClass(env, clazz, &extal_GetProcAddress, num_functions, functions); } lwjgl-2.7.1/src/native/common/OpenCL/0000755000175000017500000000000011543426510016406 5ustar zero79zero79lwjgl-2.7.1/src/native/common/OpenCL/cl_platform.h0000644000175000017500000003031711543426510021065 0ustar zero79zero79/********************************************************************************** * Copyright (c) 2008-2009 The Khronos Group Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the * "Materials"), to deal in the Materials without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Materials, and to * permit persons to whom the Materials are furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Materials. * * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. **********************************************************************************/ #ifndef __CL_PLATFORM_H #define __CL_PLATFORM_H #ifdef __APPLE__ /* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER below */ #include #endif #ifdef __cplusplus extern "C" { #endif #define CL_API_ENTRY #define CL_API_CALL #ifdef __APPLE__ #define CL_API_SUFFIX__VERSION_1_0 AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER #define CL_EXTENSION_WEAK_LINK __attribute__((weak_import)) #else #define CL_API_SUFFIX__VERSION_1_0 #define CL_EXTENSION_WEAK_LINK #endif #if (defined (WIN32) && (_MSC_VER)) /* scalar types */ typedef signed __int8 cl_char; typedef unsigned __int8 cl_uchar; typedef signed __int16 cl_short; typedef unsigned __int16 cl_ushort; typedef signed __int32 cl_int; typedef unsigned __int32 cl_uint; typedef signed __int64 cl_long; typedef unsigned __int64 cl_ulong; typedef unsigned __int16 cl_half; typedef float cl_float; typedef double cl_double; /* * Vector types * * Note: OpenCL requires that all types be naturally aligned. * This means that vector types must be naturally aligned. * For example, a vector of four floats must be aligned to * a 16 byte boundary (calculated as 4 * the natural 4-byte * alignment of the float). The alignment qualifiers here * will only function properly if your compiler supports them * and if you don't actively work to defeat them. For example, * in order for a cl_float4 to be 16 byte aligned in a struct, * the start of the struct must itself be 16-byte aligned. * * Maintaining proper alignment is the user's responsibility. */ typedef signed __int8 cl_char2[2]; typedef signed __int8 cl_char4[4]; typedef signed __int8 cl_char8[8]; typedef signed __int8 cl_char16[16]; typedef unsigned __int8 cl_uchar2[2]; typedef unsigned __int8 cl_uchar4[4]; typedef unsigned __int8 cl_uchar8[8]; typedef unsigned __int8 cl_uchar16[16]; typedef signed __int16 cl_short2[2]; typedef signed __int16 cl_short4[4]; typedef signed __int16 cl_short8[8]; typedef signed __int16 cl_short16[16]; typedef unsigned __int16 cl_ushort2[2]; typedef unsigned __int16 cl_ushort4[4]; typedef unsigned __int16 cl_ushort8[8]; typedef unsigned __int16 cl_ushort16[16]; typedef signed __int32 cl_int2[2]; typedef signed __int32 cl_int4[4]; typedef signed __int32 cl_int8[8]; typedef signed __int32 cl_int16[16]; typedef unsigned __int32 cl_uint2[2]; typedef unsigned __int32 cl_uint4[4]; typedef unsigned __int32 cl_uint8[8]; typedef unsigned __int32 cl_uint16[16]; typedef signed __int64 cl_long2[2]; typedef signed __int64 cl_long4[4]; typedef signed __int64 cl_long8[8]; typedef signed __int64 cl_long16[16]; typedef unsigned __int64 cl_ulong2[2]; typedef unsigned __int64 cl_ulong4[4]; typedef unsigned __int64 cl_ulong8[8]; typedef unsigned __int64 cl_ulong16[16]; typedef float cl_float2[2]; typedef float cl_float4[4]; typedef float cl_float8[8]; typedef float cl_float16[16]; typedef double cl_double2[2]; typedef double cl_double4[4]; typedef double cl_double8[8]; typedef double cl_double16[16]; /* There are no vector types for half */ #define CL_CHAR_BIT 8 #define CL_SCHAR_MAX 127 #define CL_SCHAR_MIN (-127-1) #define CL_CHAR_MAX CL_SCHAR_MAX #define CL_CHAR_MIN CL_SCHAR_MIN #define CL_UCHAR_MAX 255 #define CL_SHRT_MAX 32767 #define CL_SHRT_MIN (-32767-1) #define CL_USHRT_MAX 65535 #define CL_INT_MAX 2147483647 #define CL_INT_MIN (-2147483647-1) #define CL_UINT_MAX 0xffffffffU #define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL) #define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL) #define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL) #define CL_FLT_DIG 6 #define CL_FLT_MANT_DIG 24 #define CL_FLT_MAX_10_EXP +38 #define CL_FLT_MAX_EXP +128 #define CL_FLT_MIN_10_EXP -37 #define CL_FLT_MIN_EXP -125 #define CL_FLT_RADIX 2 #define CL_FLT_MAX 340282346638528859811704183484516925440.0f #define CL_FLT_MIN 1.175494350822287507969e-38f #define CL_FLT_EPSILON 0x1.0p-23f #define CL_DBL_DIG 15 #define CL_DBL_MANT_DIG 53 #define CL_DBL_MAX_10_EXP +308 #define CL_DBL_MAX_EXP +1024 #define CL_DBL_MIN_10_EXP -307 #define CL_DBL_MIN_EXP -1021 #define CL_DBL_RADIX 2 #define CL_DBL_MAX 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0 #define CL_DBL_MIN 2.225073858507201383090e-308 #define CL_DBL_EPSILON 2.220446049250313080847e-16 #else #include /* scalar types */ typedef int8_t cl_char; typedef uint8_t cl_uchar; typedef int16_t cl_short __attribute__((aligned(2))); typedef uint16_t cl_ushort __attribute__((aligned(2))); typedef int32_t cl_int __attribute__((aligned(4))); typedef uint32_t cl_uint __attribute__((aligned(4))); typedef int64_t cl_long __attribute__((aligned(8))); typedef uint64_t cl_ulong __attribute__((aligned(8))); typedef uint16_t cl_half __attribute__((aligned(2))); typedef float cl_float __attribute__((aligned(4))); typedef double cl_double __attribute__((aligned(8))); /* * Vector types * * Note: OpenCL requires that all types be naturally aligned. * This means that vector types must be naturally aligned. * For example, a vector of four floats must be aligned to * a 16 byte boundary (calculated as 4 * the natural 4-byte * alignment of the float). The alignment qualifiers here * will only function properly if your compiler supports them * and if you don't actively work to defeat them. For example, * in order for a cl_float4 to be 16 byte aligned in a struct, * the start of the struct must itself be 16-byte aligned. * * Maintaining proper alignment is the user's responsibility. */ typedef int8_t cl_char2[2] __attribute__((aligned(2))); typedef int8_t cl_char4[4] __attribute__((aligned(4))); typedef int8_t cl_char8[8] __attribute__((aligned(8))); typedef int8_t cl_char16[16] __attribute__((aligned(16))); typedef uint8_t cl_uchar2[2] __attribute__((aligned(2))); typedef uint8_t cl_uchar4[4] __attribute__((aligned(4))); typedef uint8_t cl_uchar8[8] __attribute__((aligned(8))); typedef uint8_t cl_uchar16[16] __attribute__((aligned(16))); typedef int16_t cl_short2[2] __attribute__((aligned(4))); typedef int16_t cl_short4[4] __attribute__((aligned(8))); typedef int16_t cl_short8[8] __attribute__((aligned(16))); typedef int16_t cl_short16[16] __attribute__((aligned(32))); typedef uint16_t cl_ushort2[2] __attribute__((aligned(4))); typedef uint16_t cl_ushort4[4] __attribute__((aligned(8))); typedef uint16_t cl_ushort8[8] __attribute__((aligned(16))); typedef uint16_t cl_ushort16[16] __attribute__((aligned(32))); typedef int32_t cl_int2[2] __attribute__((aligned(8))); typedef int32_t cl_int4[4] __attribute__((aligned(16))); typedef int32_t cl_int8[8] __attribute__((aligned(32))); typedef int32_t cl_int16[16] __attribute__((aligned(64))); typedef uint32_t cl_uint2[2] __attribute__((aligned(8))); typedef uint32_t cl_uint4[4] __attribute__((aligned(16))); typedef uint32_t cl_uint8[8] __attribute__((aligned(32))); typedef uint32_t cl_uint16[16] __attribute__((aligned(64))); typedef int64_t cl_long2[2] __attribute__((aligned(16))); typedef int64_t cl_long4[4] __attribute__((aligned(32))); typedef int64_t cl_long8[8] __attribute__((aligned(64))); typedef int64_t cl_long16[16] __attribute__((aligned(128))); typedef uint64_t cl_ulong2[2] __attribute__((aligned(16))); typedef uint64_t cl_ulong4[4] __attribute__((aligned(32))); typedef uint64_t cl_ulong8[8] __attribute__((aligned(64))); typedef uint64_t cl_ulong16[16] __attribute__((aligned(128))); typedef float cl_float2[2] __attribute__((aligned(8))); typedef float cl_float4[4] __attribute__((aligned(16))); typedef float cl_float8[8] __attribute__((aligned(32))); typedef float cl_float16[16] __attribute__((aligned(64))); typedef double cl_double2[2] __attribute__((aligned(16))); typedef double cl_double4[4] __attribute__((aligned(32))); typedef double cl_double8[8] __attribute__((aligned(64))); typedef double cl_double16[16] __attribute__((aligned(128))); /* There are no vector types for half */ /******************************************************************************/ // Macro names and corresponding values defined by OpenCL #define CL_CHAR_BIT 8 #define CL_SCHAR_MAX 127 #define CL_SCHAR_MIN (-127-1) #define CL_CHAR_MAX CL_SCHAR_MAX #define CL_CHAR_MIN CL_SCHAR_MIN #define CL_UCHAR_MAX 255 #define CL_SHRT_MAX 32767 #define CL_SHRT_MIN (-32767-1) #define CL_USHRT_MAX 65535 #define CL_INT_MAX 2147483647 #define CL_INT_MIN (-2147483647-1) #define CL_UINT_MAX 0xffffffffU #define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL) #define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL) #define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL) #define CL_FLT_DIG 6 #define CL_FLT_MANT_DIG 24 #define CL_FLT_MAX_10_EXP +38 #define CL_FLT_MAX_EXP +128 #define CL_FLT_MIN_10_EXP -37 #define CL_FLT_MIN_EXP -125 #define CL_FLT_RADIX 2 #define CL_FLT_MAX 0x1.fffffep127f #define CL_FLT_MIN 0x1.0p-126f #define CL_FLT_EPSILON 0x1.0p-23f #define CL_DBL_DIG 15 #define CL_DBL_MANT_DIG 53 #define CL_DBL_MAX_10_EXP +308 #define CL_DBL_MAX_EXP +1024 #define CL_DBL_MIN_10_EXP -307 #define CL_DBL_MIN_EXP -1021 #define CL_DBL_RADIX 2 #define CL_DBL_MAX 0x1.fffffffffffffp1023 #define CL_DBL_MIN 0x1.0p-1022 #define CL_DBL_EPSILON 0x1.0p-52 #endif #include #ifdef __cplusplus } #endif #endif // __CL_PLATFORM_H lwjgl-2.7.1/src/native/common/org_lwjgl_BufferUtils.c0000644000175000017500000000041111543426510021726 0ustar zero79zero79#include "org_lwjgl_BufferUtils.h" JNIEXPORT void JNICALL Java_org_lwjgl_BufferUtils_zeroBuffer0(JNIEnv *env, jclass clazz, jobject buffer, jlong offset, jlong size) { memset((char*)(*env)->GetDirectBufferAddress(env, buffer) + (size_t)offset, 0, (size_t)size); }lwjgl-2.7.1/src/native/common/common_tools.c0000644000175000017500000003063011543426510020144 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: common_tools.c 3449 2010-10-14 19:58:32Z matzon $ * * @author elias_naur * @version $Revision: 3449 $ */ #include #include #include "common_tools.h" #include "org_lwjgl_DefaultSysImplementation.h" static bool debug = false; static JavaVM *jvm; static jmethodID mByteBuffer_asReadOnlyBuffer; static jmethodID mPointerWrapper_getPointer; void initAttribList(attrib_list_t *list) { list->current_index = 0; } void putAttrib(attrib_list_t *list, int attrib) { if (list->current_index == ATTRIB_LIST_SIZE) { printfDebug("Ignoring attrib %d: attrib list size too small", attrib); return; } list->attribs[list->current_index] = attrib; list->current_index++; } JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getPointerSize(JNIEnv *env, jclass clazz) { return (jint)sizeof(void *); } JNIEXPORT void JNICALL Java_org_lwjgl_DefaultSysImplementation_setDebug (JNIEnv *env, jobject ignored, jboolean enable) { debug = enable == JNI_TRUE ? true : false; } bool isDebugEnabled(void) { return debug; } static int do_vsnprintf(char* buffer, size_t buffer_size, const char *format, va_list ap) { #ifdef _MSC_VER return vsnprintf_s(buffer, buffer_size, _TRUNCATE, format, ap); #else va_list cp_ap; va_copy(cp_ap, ap); int res = vsnprintf(buffer, buffer_size, format, cp_ap); va_end(cp_ap); return res; #endif } static jstring sprintfJavaString(JNIEnv *env, const char *format, va_list ap) { int buffer_size = 2048; char *buffer; jstring str; int str_size; buffer = (char *)malloc(sizeof(char)*buffer_size); if (buffer == NULL) return NULL; str_size = do_vsnprintf(buffer, buffer_size, format, ap); if (str_size > buffer_size) { free(buffer); buffer_size = str_size + 1; buffer = (char *)malloc(sizeof(char)*buffer_size); if (buffer == NULL) return NULL; do_vsnprintf(buffer, buffer_size, format, ap); } str = (*env)->NewStringUTF(env, buffer); free(buffer); return str; } void printfDebugJava(JNIEnv *env, const char *format, ...) { jstring str; jclass org_lwjgl_LWJGLUtil_class; jmethodID log_method; va_list ap; if (isDebugEnabled() && !(*env)->ExceptionOccurred(env)) { va_start(ap, format); str = sprintfJavaString(env, format, ap); va_end(ap); org_lwjgl_LWJGLUtil_class = (*env)->FindClass(env, "org/lwjgl/LWJGLUtil"); if (org_lwjgl_LWJGLUtil_class == NULL) return; log_method = (*env)->GetStaticMethodID(env, org_lwjgl_LWJGLUtil_class, "log", "(Ljava/lang/String;)V"); if (log_method == NULL) return; (*env)->CallStaticVoidMethod(env, org_lwjgl_LWJGLUtil_class, log_method, str); } } void printfDebug(const char *format, ...) { va_list ap; va_start(ap, format); if (isDebugEnabled()) vfprintf(stderr, format, ap); va_end(ap); } static void throwFormattedGeneralException(JNIEnv * env, const char *exception_name, const char *format, va_list ap) { jclass cls; jstring str; jmethodID exception_constructor; jobject exception; if ((*env)->ExceptionCheck(env) == JNI_TRUE) return; // The JVM crashes if we try to throw two exceptions from one native call str = sprintfJavaString(env, format, ap); cls = (*env)->FindClass(env, exception_name); exception_constructor = (*env)->GetMethodID(env, cls, "", "(Ljava/lang/String;)V"); exception = (*env)->NewObject(env, cls, exception_constructor, str); (*env)->Throw(env, exception); } void throwGeneralException(JNIEnv * env, const char *exception_name, const char * err) { jclass cls; if ((*env)->ExceptionCheck(env) == JNI_TRUE) return; // The JVM crashes if we try to throw two exceptions from one native call cls = (*env)->FindClass(env, exception_name); (*env)->ThrowNew(env, cls, err); } void throwFMODException(JNIEnv * env, const char * err) { throwGeneralException(env, "org/lwjgl/fmod3/FMODException", err); } void throwFormattedRuntimeException(JNIEnv * env, const char *format, ...) { va_list ap; va_start(ap, format); throwFormattedGeneralException(env, "java/lang/RuntimeException", format, ap); va_end(ap); } void throwFormattedException(JNIEnv * env, const char *format, ...) { va_list ap; va_start(ap, format); throwFormattedGeneralException(env, "org/lwjgl/LWJGLException", format, ap); va_end(ap); } void throwException(JNIEnv * env, const char * err) { throwGeneralException(env, "org/lwjgl/LWJGLException", err); } // retrieves the locale-specific C string char * GetStringNativeChars(JNIEnv *env, jstring jstr) { jbyteArray bytes = 0; jthrowable exc; char *result = 0; jclass jcls_str; jmethodID MID_String_getBytes; /* out of memory error? */ if ((*env)->EnsureLocalCapacity(env, 2) < 0) { return 0; } // aquire getBytes method jcls_str = (*env)->FindClass(env, "java/lang/String"); MID_String_getBytes = (*env)->GetMethodID(env, jcls_str, "getBytes", "()[B"); // get the bytes bytes = (jbyteArray) (*env)->CallObjectMethod(env, jstr, MID_String_getBytes); exc = (*env)->ExceptionOccurred(env); // if no exception occured while getting bytes - continue if (!exc) { jint len = (*env)->GetArrayLength(env, bytes); result = (char *) malloc(len + 1); if (result == 0) { throwGeneralException(env, "java/lang/OutOfMemoryError", NULL); (*env)->DeleteLocalRef(env, bytes); return 0; } (*env)->GetByteArrayRegion(env, bytes, 0, len, (jbyte *) result); result[len] = 0; /* NULL-terminate */ } else { (*env)->DeleteLocalRef(env, exc); } (*env)->DeleteLocalRef(env, bytes); return (char*) result; } /* creates locale specific string, unsigned argument to * match GLuchar and ALuchar types */ jstring NewStringNativeUnsigned(JNIEnv *env, const unsigned char *ustr) { const char *str = (const char *)ustr; if (str == NULL) return NULL; return NewStringNativeWithLength(env, str, strlen(str)); } // creates locale specific string jstring NewStringNativeWithLength(JNIEnv *env, const char *str, int length) { jclass jcls_str; jmethodID jmethod_str; jstring result; jbyteArray bytes; if (str==NULL) { return NULL; } jcls_str = (*env)->FindClass(env,"java/lang/String"); if (jcls_str == NULL) return NULL; jmethod_str = (*env)->GetMethodID(env,jcls_str, "", "([B)V"); if (jmethod_str == NULL) return NULL; bytes = 0; if ((*env)->EnsureLocalCapacity(env,2) < 0) { return NULL; /* out of memory error */ } bytes = (*env)->NewByteArray(env,length); if (bytes != NULL) { (*env)->SetByteArrayRegion(env,bytes, 0, length, (jbyte *)str); result = (jstring)(*env)->NewObject(env,jcls_str, jmethod_str, bytes); (*env)->DeleteLocalRef(env,bytes); return result; } /* else fall through */ return NULL; } bool ext_InitializeFunctions(ExtGetProcAddressPROC gpa, int num_functions, ExtFunction *functions) { int i; void **ext_function_pointer_pointer; for (i = 0; i < num_functions; i++) { ExtFunction *function = functions + i; if (function->ext_function_name != NULL) { void *ext_func_pointer = gpa(function->ext_function_name); if (ext_func_pointer == NULL) return false; ext_function_pointer_pointer = function->ext_function_pointer; *ext_function_pointer_pointer = ext_func_pointer; } } return true; } jobject NewReadOnlyDirectByteBuffer(JNIEnv* env, const void* address, jlong capacity) { jobject buffer = (*env)->NewDirectByteBuffer(env, (void *)address, capacity); return (*env)->CallObjectMethod(env, buffer, mByteBuffer_asReadOnlyBuffer); } jobject newJavaManagedByteBuffer(JNIEnv *env, const int size) { jclass bufferutils_class = (*env)->FindClass(env, "org/lwjgl/BufferUtils"); jmethodID createByteBuffer = (*env)->GetStaticMethodID(env, bufferutils_class, "createByteBuffer", "(I)Ljava/nio/ByteBuffer;"); jobject buffer = (*env)->CallStaticObjectMethod(env, bufferutils_class, createByteBuffer, size); return buffer; } void ext_InitializeClass(JNIEnv *env, jclass clazz, ExtGetProcAddressPROC gpa, int num_functions, JavaMethodAndExtFunction *functions) { JNINativeMethod *methods; JavaMethodAndExtFunction *function; void *ext_func_pointer; void **ext_function_pointer_pointer; JNINativeMethod *method; int i; if (clazz == NULL) { throwException(env, "Null class"); return; } methods = (JNINativeMethod *)malloc(num_functions*sizeof(JNINativeMethod)); for (i = 0; i < num_functions; i++) { function = functions + i; if (function->ext_function_name != NULL) { ext_func_pointer = gpa(function->ext_function_name); if (ext_func_pointer == NULL) { free(methods); throwException(env, "Missing driver symbols"); return; } ext_function_pointer_pointer = function->ext_function_pointer; *ext_function_pointer_pointer = ext_func_pointer; } method = methods + i; method->name = function->method_name; method->signature = function->signature; method->fnPtr = function->method_pointer; } (*env)->RegisterNatives(env, clazz, methods, num_functions); free(methods); } bool getBooleanProperty(JNIEnv *env, const char* propertyName) { jstring property = NewStringNativeWithLength(env, propertyName, strlen(propertyName)); jclass org_lwjgl_LWJGLUtil_class; jmethodID getBoolean; if (property == NULL) return false; org_lwjgl_LWJGLUtil_class = (*env)->FindClass(env, "org/lwjgl/LWJGLUtil"); if (org_lwjgl_LWJGLUtil_class == NULL) return false; getBoolean = (*env)->GetStaticMethodID(env, org_lwjgl_LWJGLUtil_class, "getPrivilegedBoolean", "(Ljava/lang/String;)Z"); if (getBoolean == NULL) return false; return (*env)->CallStaticBooleanMethod(env, org_lwjgl_LWJGLUtil_class, getBoolean, property) ? true : false; } jlong getPointerWrapperAddress(JNIEnv *env, jobject wrapper) { return (*env)->CallLongMethod(env, wrapper, mPointerWrapper_getPointer); } JNIEnv *getThreadEnv() { JNIEnv *env; (*jvm)->GetEnv(jvm, (void *)&env, JNI_VERSION_1_4); return env; } JNIEnv *attachCurrentThread() { JNIEnv *env; (*jvm)->AttachCurrentThread(jvm, (void **)&env, NULL); return env; } void detachCurrentThread() { (*jvm)->DetachCurrentThread(jvm); } JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { JNIEnv *env; jclass clazz; jvm = vm; env = getThreadEnv(); clazz = (*env)->FindClass(env, "java/nio/ByteBuffer"); mByteBuffer_asReadOnlyBuffer = (*env)->GetMethodID(env, clazz, "asReadOnlyBuffer", "()Ljava/nio/ByteBuffer;"); clazz = (*env)->FindClass(env, "org/lwjgl/PointerWrapper"); mPointerWrapper_getPointer = (*env)->GetMethodID(env, clazz, "getPointer", "()J"); return JNI_VERSION_1_4; } JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) { } bool positionBuffer(JNIEnv *env, jobject buffer, jint position) { jclass buffer_class; jmethodID position_method; buffer_class = (*env)->GetObjectClass(env, buffer); if (buffer_class == NULL) return false; position_method = (*env)->GetMethodID(env, buffer_class, "position", "(I)Ljava/nio/Buffer;"); if (position_method == NULL) return false; (*env)->CallObjectMethod(env, buffer, position_method, position); return true; } lwjgl-2.7.1/src/native/common/org_lwjgl_opencl_CallbackUtil.c0000644000175000017500000002173611543426510023403 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * JNI implementation of the AMD_debug_output function callback. * * @author Spasi */ #include #include "common_tools.h" #include "extcl.h" #include "org_lwjgl_opencl_CallbackUtil.h" static jmethodID contextCallbackJ; static jmethodID memObjectDestructorCallbackJ; static jmethodID buildProgramCallbackJ; static jmethodID nativeKernelCallbackJ; static jmethodID eventCallbackJ; JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_ncreateGlobalRef(JNIEnv *env, jclass clazz, jobject obj) { return (intptr_t)(*env)->NewGlobalRef(env, obj); } JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CallbackUtil_deleteGlobalRef(JNIEnv *env, jclass clazz, jlong globalRef) { (*env)->DeleteGlobalRef(env, (jobject)(intptr_t)globalRef); } // ----------------- [ CONTEXT CALLBACK ] ----------------- static void CL_CALLBACK contextCallback(const char *errinfo, const void *private_info, size_t cb, void *user_data) { JNIEnv *env = attachCurrentThread(); jobject private_info_buffer = NULL; if ( env != NULL && !(*env)->ExceptionOccurred(env) && contextCallbackJ != NULL ) { if ( private_info != NULL ) private_info_buffer = NewReadOnlyDirectByteBuffer(env, private_info, cb); (*env)->CallVoidMethod(env, (jobject)user_data, contextCallbackJ, NewStringNativeWithLength(env, errinfo, strlen(errinfo)), private_info_buffer ); } detachCurrentThread(); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getContextCallback(JNIEnv *env, jclass clazz) { // Cache the callback methodID jclass callbackClass; if ( contextCallbackJ == NULL ) { callbackClass = (*env)->FindClass(env, "org/lwjgl/opencl/CLContextCallback"); if ( callbackClass != NULL ) contextCallbackJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(Ljava/lang/String;Ljava/nio/ByteBuffer;)V"); } return (jlong)(intptr_t)&contextCallback; } // ----------------- [ MEM OBJECT DESTRUCTOR CALLBACK ] ----------------- static void CL_CALLBACK memObjectDestructorCallback(cl_mem memobj, void *user_data) { JNIEnv *env = attachCurrentThread(); if ( env != NULL && !(*env)->ExceptionOccurred(env) && memObjectDestructorCallbackJ != NULL ) { (*env)->CallVoidMethod(env, (jobject)user_data, memObjectDestructorCallbackJ, (jlong)(intptr_t)memobj ); (*env)->DeleteGlobalRef(env, (jobject)user_data); } detachCurrentThread(); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getMemObjectDestructorCallback(JNIEnv *env, jclass clazz) { // Cache the callback methodID jclass callbackClass; if ( memObjectDestructorCallbackJ == NULL ) { callbackClass = (*env)->FindClass(env, "org/lwjgl/opencl/CLMemObjectDestructorCallback"); if ( callbackClass != NULL ) memObjectDestructorCallbackJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(J)V"); } return (jlong)(intptr_t)&memObjectDestructorCallback; } // ----------------- [ MEM OBJECT DESTRUCTOR CALLBACK ] ----------------- static void CL_CALLBACK buildProgramCallback(cl_program program, void *user_data) { JNIEnv *env = attachCurrentThread(); if ( env != NULL && !(*env)->ExceptionOccurred(env) && buildProgramCallbackJ != NULL ) { (*env)->CallVoidMethod(env, (jobject)user_data, buildProgramCallbackJ, (jlong)(intptr_t)program ); (*env)->DeleteGlobalRef(env, (jobject)user_data); } detachCurrentThread(); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getBuildProgramCallback(JNIEnv *env, jclass clazz) { // Cache the callback methodID jclass callbackClass; if ( buildProgramCallbackJ == NULL ) { callbackClass = (*env)->FindClass(env, "org/lwjgl/opencl/CLBuildProgramCallback"); if ( callbackClass != NULL ) buildProgramCallbackJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(J)V"); } return (jlong)(intptr_t)&buildProgramCallback; } // ----------------- [ NATIVE KERNEL CALLBACK ] ----------------- static void CL_USER_FUNC_CALLBACK nativeKernelCallback(void *args) { JNIEnv *env = attachCurrentThread(); jobject user_func = (jobject)(intptr_t)*(jlong *)args; jint num_mem_objects = *(jint *)((char *)args + 8); jobjectArray memobjs = NULL; jobject buffer; jint i; if ( env != NULL && !(*env)->ExceptionOccurred(env) && nativeKernelCallbackJ != NULL ) { if ( num_mem_objects > 0 ) { memobjs = (*env)->NewObjectArray(env, num_mem_objects, (*env)->FindClass(env, "java/nio/ByteBuffer"), NULL); for ( i = 0; i < num_mem_objects; i++ ) { buffer = (*env)->NewDirectByteBuffer(env, // Pointer to cl_mem buffer (void *)((char *)args + (12 + 4 + (i * (4 + sizeof(void *))))), // cl_mem buffer size *((jint *)((char *)args + (12 + (i * (4 + sizeof(void *)))))) ); (*env)->SetObjectArrayElement(env, memobjs, i, buffer); } } (*env)->CallVoidMethod(env, user_func, nativeKernelCallbackJ, memobjs); if ( num_mem_objects > 0 ) (*env)->DeleteLocalRef(env, memobjs); (*env)->DeleteGlobalRef(env, user_func); } detachCurrentThread(); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getNativeKernelCallback(JNIEnv *env, jclass clazz) { // Cache the callback methodID jclass callbackClass; if ( nativeKernelCallbackJ == NULL ) { callbackClass = (*env)->FindClass(env, "org/lwjgl/opencl/CLNativeKernel"); if ( callbackClass != NULL ) nativeKernelCallbackJ = (*env)->GetMethodID(env, callbackClass, "execute", "([Ljava/nio/ByteBuffer;)V"); } return (jlong)(intptr_t)&nativeKernelCallback; } // ----------------- [ EVENT CALLBACK ] ----------------- static void CL_CALLBACK eventCallback(cl_event event, cl_int event_command_exec_status, void *user_data) { JNIEnv *env = attachCurrentThread(); if ( env != NULL && !(*env)->ExceptionOccurred(env) && eventCallbackJ != NULL ) { (*env)->CallVoidMethod(env, (jobject)user_data, eventCallbackJ, (jlong)(intptr_t)event, event_command_exec_status ); (*env)->DeleteGlobalRef(env, (jobject)user_data); } detachCurrentThread(); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getEventCallback(JNIEnv *env, jclass clazz) { // Cache the callback methodID jclass callbackClass; if ( eventCallbackJ == NULL ) { callbackClass = (*env)->FindClass(env, "org/lwjgl/opencl/CLEventCallback"); if ( callbackClass != NULL ) eventCallbackJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(JI)V"); } return (jlong)(intptr_t)&eventCallback; } // ----------------- [ APPLE_ContextLoggingFunctions CALLBACKS ] ----------------- JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getLogMessageToSystemLogAPPLE(JNIEnv *env, jclass clazz) { return (jlong)(intptr_t)extcl_GetProcAddress("clLogMessagesToSystemLogAPPLE"); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getLogMessageToStdoutAPPLE(JNIEnv *env, jclass clazz) { return (jlong)(intptr_t)extcl_GetProcAddress("getLogMessageToStdoutAPPLE"); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getLogMessageToStderrAPPLE(JNIEnv *env, jclass clazz) { return (jlong)(intptr_t)extcl_GetProcAddress("getLogMessageToStderrAPPLE"); } lwjgl-2.7.1/src/native/common/org_lwjgl_opengl_GLContext.c0000644000175000017500000000466311543426510022724 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include "common_tools.h" #include "org_lwjgl_opengl_GLContext.h" #include "extgl.h" JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_GLContext_getFunctionAddress(JNIEnv *env, jclass clazz, jstring function_name) { jlong address_jlong; char *function_name_pointer = GetStringNativeChars(env, function_name); void *address = extgl_GetProcAddress(function_name_pointer); free(function_name_pointer); address_jlong = (jlong)(intptr_t)address; return address_jlong; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_nLoadOpenGLLibrary(JNIEnv * env, jclass clazz) { extgl_Open(env); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_nUnloadOpenGLLibrary(JNIEnv * env, jclass clazz) { extgl_Close(); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_resetNativeStubs(JNIEnv *env, jclass clazz, jclass gl_class) { (*env)->UnregisterNatives(env, gl_class); } lwjgl-2.7.1/src/native/common/org_lwjgl_openal_AL.c0000644000175000017500000000400111543426510021325 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include "org_lwjgl_openal_AL.h" #include "extal.h" JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_nCreate(JNIEnv *env, jclass clazz, jstring oalPath) { extal_LoadLibrary(env, oalPath); } JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_nDestroy(JNIEnv *env, jclass clazz) { extal_UnloadLibrary(); } JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_resetNativeStubs(JNIEnv *env, jclass clazz, jclass al_class) { (*env)->UnregisterNatives(env, al_class); } lwjgl-2.7.1/src/native/common/org_lwjgl_opencl_CL.c0000644000175000017500000000506411543426510021343 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include "org_lwjgl_opencl_CL.h" #include "extcl.h" JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nCreate(JNIEnv *env, jclass clazz, jstring oclPath) { extcl_LoadLibrary(env, oclPath); } JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nDestroy(JNIEnv *env, jclass clazz) { extcl_UnloadLibrary(); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CL_getFunctionAddress(JNIEnv *env, jclass clazz, jstring function_name) { jlong address_jlong; char *function_name_pointer = GetStringNativeChars(env, function_name); void *address = extcl_GetProcAddress(function_name_pointer); free(function_name_pointer); address_jlong = (jlong)(intptr_t)address; return address_jlong; } JNIEXPORT jobject JNICALL Java_org_lwjgl_opencl_CL_getHostBuffer(JNIEnv *env, jclass clazz, jlong address, jint size) { return safeNewBuffer(env, (void *)(intptr_t)address, size); } JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_resetNativeStubs(JNIEnv *env, jclass clazz, jclass cl_class) { (*env)->UnregisterNatives(env, cl_class); } lwjgl-2.7.1/src/native/common/extgl_types.h0000644000175000017500000000413311543426510020007 0ustar zero79zero79#if defined(_WIN32) || defined(_WIN64) #define int64_t __int64 #define uint64_t unsigned __int64 #endif #ifdef _MACOSX typedef unsigned long GLenum; typedef unsigned char GLboolean; typedef unsigned long GLbitfield; typedef signed char GLbyte; typedef short GLshort; typedef long GLint; typedef long GLsizei; typedef unsigned char GLubyte; typedef unsigned short GLushort; typedef unsigned long GLuint; typedef float GLfloat; typedef float GLclampf; typedef double GLdouble; typedef double GLclampd; typedef void GLvoid; #else typedef unsigned int GLenum; typedef unsigned char GLboolean; typedef unsigned int GLbitfield; typedef void GLvoid; typedef signed char GLbyte; /* 1-byte signed */ typedef short GLshort; /* 2-byte signed */ typedef int GLint; /* 4-byte signed */ typedef unsigned char GLubyte; /* 1-byte unsigned */ typedef unsigned short GLushort; /* 2-byte unsigned */ typedef unsigned int GLuint; /* 4-byte unsigned */ typedef int GLsizei; /* 4-byte signed */ typedef float GLfloat; /* single precision float */ typedef float GLclampf; /* single precision float in [0,1] */ typedef double GLdouble; /* double precision float */ typedef double GLclampd; /* double precision float in [0,1] */ #endif typedef char GLchar; /* native character */ typedef ptrdiff_t GLintptr; typedef ptrdiff_t GLsizeiptr; typedef ptrdiff_t GLintptrARB; typedef ptrdiff_t GLsizeiptrARB; typedef char GLcharARB; /* native character */ typedef unsigned int GLhandleARB; /* shader object handle */ typedef unsigned short GLhalfARB; typedef unsigned short GLhalfNV; typedef unsigned short GLhalf; typedef int64_t GLint64EXT; typedef uint64_t GLuint64EXT; typedef int64_t GLint64; typedef uint64_t GLuint64; typedef struct __GLsync * GLsync;lwjgl-2.7.1/src/native/common/opencl.h0000644000175000017500000000336511543426510016726 0ustar zero79zero79/******************************************************************************* * Copyright (c) 2008-2010 The Khronos Group Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the * "Materials"), to deal in the Materials without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Materials, and to * permit persons to whom the Materials are furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Materials. * * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. ******************************************************************************/ /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ #ifndef __OPENCL_H #define __OPENCL_H #ifdef __cplusplus extern "C" { #endif #ifdef __APPLE__ #include #include #include #include #else #include #include #include #include #endif #include "common_tools.h" #ifdef __cplusplus } #endif #endif /* __OPENCL_H */ lwjgl-2.7.1/src/native/common/CL/0000755000175000017500000000000011543426510015564 5ustar zero79zero79lwjgl-2.7.1/src/native/common/CL/cl_gl_ext.h0000644000175000017500000000511011543426510017672 0ustar zero79zero79/********************************************************************************** * Copyright (c) 2008-2010 The Khronos Group Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the * "Materials"), to deal in the Materials without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Materials, and to * permit persons to whom the Materials are furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Materials. * * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. **********************************************************************************/ /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ /* cl_gl_ext.h contains vendor (non-KHR) OpenCL extensions which have */ /* OpenGL dependencies. */ #ifndef __OPENCL_CL_GL_EXT_H #define __OPENCL_CL_GL_EXT_H #ifdef __cplusplus extern "C" { #endif #ifdef __APPLE__ #include #else #include #endif /* * For each extension, follow this template * /* cl_VEN_extname extension */ /* #define cl_VEN_extname 1 * ... define new types, if any * ... define new tokens, if any * ... define new APIs, if any * * If you need GLtypes here, mirror them with a cl_GLtype, rather than including a GL header * This allows us to avoid having to decide whether to include GL headers or GLES here. */ /* * cl_khr_gl_event extension * See section 9.9 in the OpenCL 1.1 spec for more information */ #define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D extern CL_API_ENTRY cl_event CL_API_CALL clCreateEventFromGLsyncKHR(cl_context /* context */, cl_GLsync /* cl_GLsync */, cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1; #ifdef __cplusplus } #endif #endif /* __OPENCL_CL_GL_EXT_H */ lwjgl-2.7.1/src/native/common/CL/cl_platform.h0000644000175000017500000011222411543426510020241 0ustar zero79zero79/********************************************************************************** * Copyright (c) 2008-2010 The Khronos Group Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the * "Materials"), to deal in the Materials without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Materials, and to * permit persons to whom the Materials are furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Materials. * * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. **********************************************************************************/ /* $Revision: 11803 $ on $Date: 2010-06-25 10:02:12 -0700 (Fri, 25 Jun 2010) $ */ #ifndef __CL_PLATFORM_H #define __CL_PLATFORM_H #ifdef __APPLE__ /* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER below */ #include #endif #ifdef __cplusplus extern "C" { #endif #if defined(_WIN32) #define CL_API_ENTRY #define CL_API_CALL __stdcall #define CL_CALLBACK __stdcall #else #define CL_API_ENTRY #define CL_API_CALL #define CL_CALLBACK #endif #ifdef __APPLE__ #define CL_EXTENSION_WEAK_LINK __attribute__((weak_import)) #define CL_API_SUFFIX__VERSION_1_0 AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER #define CL_EXT_SUFFIX__VERSION_1_0 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER #define CL_API_SUFFIX__VERSION_1_1 CL_EXTENSION_WEAK_LINK #define CL_EXT_SUFFIX__VERSION_1_1 CL_EXTENSION_WEAK_LINK #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER #else #define CL_EXTENSION_WEAK_LINK #define CL_API_SUFFIX__VERSION_1_0 #define CL_EXT_SUFFIX__VERSION_1_0 #define CL_API_SUFFIX__VERSION_1_1 #define CL_EXT_SUFFIX__VERSION_1_1 #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED #endif #if (defined (_WIN32) && defined(_MSC_VER)) /* scalar types */ typedef signed __int8 cl_char; typedef unsigned __int8 cl_uchar; typedef signed __int16 cl_short; typedef unsigned __int16 cl_ushort; typedef signed __int32 cl_int; typedef unsigned __int32 cl_uint; typedef signed __int64 cl_long; typedef unsigned __int64 cl_ulong; typedef unsigned __int16 cl_half; typedef float cl_float; typedef double cl_double; /* Macro names and corresponding values defined by OpenCL */ #define CL_CHAR_BIT 8 #define CL_SCHAR_MAX 127 #define CL_SCHAR_MIN (-127-1) #define CL_CHAR_MAX CL_SCHAR_MAX #define CL_CHAR_MIN CL_SCHAR_MIN #define CL_UCHAR_MAX 255 #define CL_SHRT_MAX 32767 #define CL_SHRT_MIN (-32767-1) #define CL_USHRT_MAX 65535 #define CL_INT_MAX 2147483647 #define CL_INT_MIN (-2147483647-1) #define CL_UINT_MAX 0xffffffffU #define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL) #define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL) #define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL) #define CL_FLT_DIG 6 #define CL_FLT_MANT_DIG 24 #define CL_FLT_MAX_10_EXP +38 #define CL_FLT_MAX_EXP +128 #define CL_FLT_MIN_10_EXP -37 #define CL_FLT_MIN_EXP -125 #define CL_FLT_RADIX 2 #define CL_FLT_MAX 340282346638528859811704183484516925440.0f #define CL_FLT_MIN 1.175494350822287507969e-38f #define CL_FLT_EPSILON 0x1.0p-23f #define CL_DBL_DIG 15 #define CL_DBL_MANT_DIG 53 #define CL_DBL_MAX_10_EXP +308 #define CL_DBL_MAX_EXP +1024 #define CL_DBL_MIN_10_EXP -307 #define CL_DBL_MIN_EXP -1021 #define CL_DBL_RADIX 2 #define CL_DBL_MAX 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0 #define CL_DBL_MIN 2.225073858507201383090e-308 #define CL_DBL_EPSILON 2.220446049250313080847e-16 #define CL_M_E 2.718281828459045090796 #define CL_M_LOG2E 1.442695040888963387005 #define CL_M_LOG10E 0.434294481903251816668 #define CL_M_LN2 0.693147180559945286227 #define CL_M_LN10 2.302585092994045901094 #define CL_M_PI 3.141592653589793115998 #define CL_M_PI_2 1.570796326794896557999 #define CL_M_PI_4 0.785398163397448278999 #define CL_M_1_PI 0.318309886183790691216 #define CL_M_2_PI 0.636619772367581382433 #define CL_M_2_SQRTPI 1.128379167095512558561 #define CL_M_SQRT2 1.414213562373095145475 #define CL_M_SQRT1_2 0.707106781186547572737 #define CL_M_E_F 2.71828174591064f #define CL_M_LOG2E_F 1.44269502162933f #define CL_M_LOG10E_F 0.43429449200630f #define CL_M_LN2_F 0.69314718246460f #define CL_M_LN10_F 2.30258512496948f #define CL_M_PI_F 3.14159274101257f #define CL_M_PI_2_F 1.57079637050629f #define CL_M_PI_4_F 0.78539818525314f #define CL_M_1_PI_F 0.31830987334251f #define CL_M_2_PI_F 0.63661974668503f #define CL_M_2_SQRTPI_F 1.12837922573090f #define CL_M_SQRT2_F 1.41421353816986f #define CL_M_SQRT1_2_F 0.70710676908493f #define CL_NAN (CL_INFINITY - CL_INFINITY) #define CL_HUGE_VALF ((cl_float) 1e50) #define CL_HUGE_VAL ((cl_double) 1e500) #define CL_MAXFLOAT CL_FLT_MAX #define CL_INFINITY CL_HUGE_VALF #else #include /* scalar types */ typedef int8_t cl_char; typedef uint8_t cl_uchar; typedef int16_t cl_short __attribute__((aligned(2))); typedef uint16_t cl_ushort __attribute__((aligned(2))); typedef int32_t cl_int __attribute__((aligned(4))); typedef uint32_t cl_uint __attribute__((aligned(4))); typedef int64_t cl_long __attribute__((aligned(8))); typedef uint64_t cl_ulong __attribute__((aligned(8))); typedef uint16_t cl_half __attribute__((aligned(2))); typedef float cl_float __attribute__((aligned(4))); typedef double cl_double __attribute__((aligned(8))); /* Macro names and corresponding values defined by OpenCL */ #define CL_CHAR_BIT 8 #define CL_SCHAR_MAX 127 #define CL_SCHAR_MIN (-127-1) #define CL_CHAR_MAX CL_SCHAR_MAX #define CL_CHAR_MIN CL_SCHAR_MIN #define CL_UCHAR_MAX 255 #define CL_SHRT_MAX 32767 #define CL_SHRT_MIN (-32767-1) #define CL_USHRT_MAX 65535 #define CL_INT_MAX 2147483647 #define CL_INT_MIN (-2147483647-1) #define CL_UINT_MAX 0xffffffffU #define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL) #define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL) #define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL) #define CL_FLT_DIG 6 #define CL_FLT_MANT_DIG 24 #define CL_FLT_MAX_10_EXP +38 #define CL_FLT_MAX_EXP +128 #define CL_FLT_MIN_10_EXP -37 #define CL_FLT_MIN_EXP -125 #define CL_FLT_RADIX 2 #define CL_FLT_MAX 0x1.fffffep127f #define CL_FLT_MIN 0x1.0p-126f #define CL_FLT_EPSILON 0x1.0p-23f #define CL_DBL_DIG 15 #define CL_DBL_MANT_DIG 53 #define CL_DBL_MAX_10_EXP +308 #define CL_DBL_MAX_EXP +1024 #define CL_DBL_MIN_10_EXP -307 #define CL_DBL_MIN_EXP -1021 #define CL_DBL_RADIX 2 #define CL_DBL_MAX 0x1.fffffffffffffp1023 #define CL_DBL_MIN 0x1.0p-1022 #define CL_DBL_EPSILON 0x1.0p-52 #define CL_M_E 2.718281828459045090796 #define CL_M_LOG2E 1.442695040888963387005 #define CL_M_LOG10E 0.434294481903251816668 #define CL_M_LN2 0.693147180559945286227 #define CL_M_LN10 2.302585092994045901094 #define CL_M_PI 3.141592653589793115998 #define CL_M_PI_2 1.570796326794896557999 #define CL_M_PI_4 0.785398163397448278999 #define CL_M_1_PI 0.318309886183790691216 #define CL_M_2_PI 0.636619772367581382433 #define CL_M_2_SQRTPI 1.128379167095512558561 #define CL_M_SQRT2 1.414213562373095145475 #define CL_M_SQRT1_2 0.707106781186547572737 #define CL_M_E_F 2.71828174591064f #define CL_M_LOG2E_F 1.44269502162933f #define CL_M_LOG10E_F 0.43429449200630f #define CL_M_LN2_F 0.69314718246460f #define CL_M_LN10_F 2.30258512496948f #define CL_M_PI_F 3.14159274101257f #define CL_M_PI_2_F 1.57079637050629f #define CL_M_PI_4_F 0.78539818525314f #define CL_M_1_PI_F 0.31830987334251f #define CL_M_2_PI_F 0.63661974668503f #define CL_M_2_SQRTPI_F 1.12837922573090f #define CL_M_SQRT2_F 1.41421353816986f #define CL_M_SQRT1_2_F 0.70710676908493f #if defined( __GNUC__ ) #define CL_HUGE_VALF __builtin_huge_valf() #define CL_HUGE_VAL __builtin_huge_val() #define CL_NAN __builtin_nanf( "" ) #else #define CL_HUGE_VALF ((cl_float) 1e50) #define CL_HUGE_VAL ((cl_double) 1e500) float nanf( const char * ); #define CL_NAN nanf( "" ) #endif #define CL_MAXFLOAT CL_FLT_MAX #define CL_INFINITY CL_HUGE_VALF #endif #include /* Mirror types to GL types. Mirror types allow us to avoid deciding which headers to load based on whether we are using GL or GLES here. */ typedef unsigned int cl_GLuint; typedef int cl_GLint; typedef unsigned int cl_GLenum; /* * Vector types * * Note: OpenCL requires that all types be naturally aligned. * This means that vector types must be naturally aligned. * For example, a vector of four floats must be aligned to * a 16 byte boundary (calculated as 4 * the natural 4-byte * alignment of the float). The alignment qualifiers here * will only function properly if your compiler supports them * and if you don't actively work to defeat them. For example, * in order for a cl_float4 to be 16 byte aligned in a struct, * the start of the struct must itself be 16-byte aligned. * * Maintaining proper alignment is the user's responsibility. */ /* Define basic vector types */ #if defined( __VEC__ ) #include /* may be omitted depending on compiler. AltiVec spec provides no way to detect whether the header is required. */ typedef vector unsigned char __cl_uchar16; typedef vector signed char __cl_char16; typedef vector unsigned short __cl_ushort8; typedef vector signed short __cl_short8; typedef vector unsigned int __cl_uint4; typedef vector signed int __cl_int4; typedef vector float __cl_float4; #define __CL_UCHAR16__ 1 #define __CL_CHAR16__ 1 #define __CL_USHORT8__ 1 #define __CL_SHORT8__ 1 #define __CL_UINT4__ 1 #define __CL_INT4__ 1 #define __CL_FLOAT4__ 1 #endif #if defined( __SSE__ ) #if defined( __MINGW64__ ) #include #else #include #endif #if defined( __GNUC__ ) typedef float __cl_float4 __attribute__((vector_size(16))); #else typedef __m128 __cl_float4; #endif #define __CL_FLOAT4__ 1 #endif #if defined( __SSE2__ ) #if defined( __MINGW64__ ) #include #else #include #endif #if defined( __GNUC__ ) typedef cl_uchar __cl_uchar16 __attribute__((vector_size(16))); typedef cl_char __cl_char16 __attribute__((vector_size(16))); typedef cl_ushort __cl_ushort8 __attribute__((vector_size(16))); typedef cl_short __cl_short8 __attribute__((vector_size(16))); typedef cl_uint __cl_uint4 __attribute__((vector_size(16))); typedef cl_int __cl_int4 __attribute__((vector_size(16))); typedef cl_ulong __cl_ulong2 __attribute__((vector_size(16))); typedef cl_long __cl_long2 __attribute__((vector_size(16))); typedef cl_double __cl_double2 __attribute__((vector_size(16))); #else typedef __m128i __cl_uchar16; typedef __m128i __cl_char16; typedef __m128i __cl_ushort8; typedef __m128i __cl_short8; typedef __m128i __cl_uint4; typedef __m128i __cl_int4; typedef __m128i __cl_ulong2; typedef __m128i __cl_long2; typedef __m128d __cl_double2; #endif #define __CL_UCHAR16__ 1 #define __CL_CHAR16__ 1 #define __CL_USHORT8__ 1 #define __CL_SHORT8__ 1 #define __CL_INT4__ 1 #define __CL_UINT4__ 1 #define __CL_ULONG2__ 1 #define __CL_LONG2__ 1 #define __CL_DOUBLE2__ 1 #endif #if defined( __MMX__ ) #include #if defined( __GNUC__ ) typedef cl_uchar __cl_uchar8 __attribute__((vector_size(8))); typedef cl_char __cl_char8 __attribute__((vector_size(8))); typedef cl_ushort __cl_ushort4 __attribute__((vector_size(8))); typedef cl_short __cl_short4 __attribute__((vector_size(8))); typedef cl_uint __cl_uint2 __attribute__((vector_size(8))); typedef cl_int __cl_int2 __attribute__((vector_size(8))); typedef cl_ulong __cl_ulong1 __attribute__((vector_size(8))); typedef cl_long __cl_long1 __attribute__((vector_size(8))); typedef cl_float __cl_float2 __attribute__((vector_size(8))); #else typedef __m64 __cl_uchar8; typedef __m64 __cl_char8; typedef __m64 __cl_ushort4; typedef __m64 __cl_short4; typedef __m64 __cl_uint2; typedef __m64 __cl_int2; typedef __m64 __cl_ulong1; typedef __m64 __cl_long1; typedef __m64 __cl_float2; #endif #define __CL_UCHAR8__ 1 #define __CL_CHAR8__ 1 #define __CL_USHORT4__ 1 #define __CL_SHORT4__ 1 #define __CL_INT2__ 1 #define __CL_UINT2__ 1 #define __CL_ULONG1__ 1 #define __CL_LONG1__ 1 #define __CL_FLOAT2__ 1 #endif #if defined( __AVX__ ) #if defined( __MINGW64__ ) #include #else #include #endif #if defined( __GNUC__ ) typedef cl_float __cl_float8 __attribute__((vector_size(32))); typedef cl_double __cl_double4 __attribute__((vector_size(32))); #else typedef __m256 __cl_float8; typedef __m256d __cl_double4; #endif #define __CL_FLOAT8__ 1 #define __CL_DOUBLE4__ 1 #endif /* Define alignment keys */ #if defined( __GNUC__ ) #define CL_ALIGNED(_x) __attribute__ ((aligned(_x))) #elif defined( _WIN32) && (_MSC_VER) /* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements */ /* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx */ /* #include */ /* #define CL_ALIGNED(_x) _CRT_ALIGN(_x) */ #define CL_ALIGNED(_x) #else #warning Need to implement some method to align data here #define CL_ALIGNED(_x) #endif /* Indicate whether .xyzw, .s0123 and .hi.lo are supported */ #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) /* .xyzw and .s0123...{f|F} are supported */ #define CL_HAS_NAMED_VECTOR_FIELDS 1 /* .hi and .lo are supported */ #define CL_HAS_HI_LO_VECTOR_FIELDS 1 #endif /* Define cl_vector types */ /* ---- cl_charn ---- */ typedef union { cl_char CL_ALIGNED(2) s[2]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_char x, y; }; __extension__ struct{ cl_char s0, s1; }; __extension__ struct{ cl_char lo, hi; }; #endif #if defined( __CL_CHAR2__) __cl_char2 v2; #endif }cl_char2; typedef union { cl_char CL_ALIGNED(4) s[4]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_char x, y, z, w; }; __extension__ struct{ cl_char s0, s1, s2, s3; }; __extension__ struct{ cl_char2 lo, hi; }; #endif #if defined( __CL_CHAR2__) __cl_char2 v2[2]; #endif #if defined( __CL_CHAR4__) __cl_char4 v4; #endif }cl_char4; /* cl_char3 is identical in size, alignment and behavior to cl_char4. See section 6.1.5. */ typedef cl_char4 cl_char3; typedef union { cl_char CL_ALIGNED(8) s[8]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_char x, y, z, w; }; __extension__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7; }; __extension__ struct{ cl_char4 lo, hi; }; #endif #if defined( __CL_CHAR2__) __cl_char2 v2[4]; #endif #if defined( __CL_CHAR4__) __cl_char4 v4[2]; #endif #if defined( __CL_CHAR8__ ) __cl_char8 v8; #endif }cl_char8; typedef union { cl_char CL_ALIGNED(16) s[16]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_char x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; __extension__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; __extension__ struct{ cl_char8 lo, hi; }; #endif #if defined( __CL_CHAR2__) __cl_char2 v2[8]; #endif #if defined( __CL_CHAR4__) __cl_char4 v4[4]; #endif #if defined( __CL_CHAR8__ ) __cl_char8 v8[2]; #endif #if defined( __CL_CHAR16__ ) __cl_char16 v16; #endif }cl_char16; /* ---- cl_ucharn ---- */ typedef union { cl_uchar CL_ALIGNED(2) s[2]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_uchar x, y; }; __extension__ struct{ cl_uchar s0, s1; }; __extension__ struct{ cl_uchar lo, hi; }; #endif #if defined( __cl_uchar2__) __cl_uchar2 v2; #endif }cl_uchar2; typedef union { cl_uchar CL_ALIGNED(4) s[4]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_uchar x, y, z, w; }; __extension__ struct{ cl_uchar s0, s1, s2, s3; }; __extension__ struct{ cl_uchar2 lo, hi; }; #endif #if defined( __CL_UCHAR2__) __cl_uchar2 v2[2]; #endif #if defined( __CL_UCHAR4__) __cl_uchar4 v4; #endif }cl_uchar4; /* cl_uchar3 is identical in size, alignment and behavior to cl_uchar4. See section 6.1.5. */ typedef cl_uchar4 cl_uchar3; typedef union { cl_uchar CL_ALIGNED(8) s[8]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_uchar x, y, z, w; }; __extension__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7; }; __extension__ struct{ cl_uchar4 lo, hi; }; #endif #if defined( __CL_UCHAR2__) __cl_uchar2 v2[4]; #endif #if defined( __CL_UCHAR4__) __cl_uchar4 v4[2]; #endif #if defined( __CL_UCHAR8__ ) __cl_uchar8 v8; #endif }cl_uchar8; typedef union { cl_uchar CL_ALIGNED(16) s[16]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_uchar x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; __extension__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; __extension__ struct{ cl_uchar8 lo, hi; }; #endif #if defined( __CL_UCHAR2__) __cl_uchar2 v2[8]; #endif #if defined( __CL_UCHAR4__) __cl_uchar4 v4[4]; #endif #if defined( __CL_UCHAR8__ ) __cl_uchar8 v8[2]; #endif #if defined( __CL_UCHAR16__ ) __cl_uchar16 v16; #endif }cl_uchar16; /* ---- cl_shortn ---- */ typedef union { cl_short CL_ALIGNED(4) s[2]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_short x, y; }; __extension__ struct{ cl_short s0, s1; }; __extension__ struct{ cl_short lo, hi; }; #endif #if defined( __CL_SHORT2__) __cl_short2 v2; #endif }cl_short2; typedef union { cl_short CL_ALIGNED(8) s[4]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_short x, y, z, w; }; __extension__ struct{ cl_short s0, s1, s2, s3; }; __extension__ struct{ cl_short2 lo, hi; }; #endif #if defined( __CL_SHORT2__) __cl_short2 v2[2]; #endif #if defined( __CL_SHORT4__) __cl_short4 v4; #endif }cl_short4; /* cl_short3 is identical in size, alignment and behavior to cl_short4. See section 6.1.5. */ typedef cl_short4 cl_short3; typedef union { cl_short CL_ALIGNED(16) s[8]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_short x, y, z, w; }; __extension__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7; }; __extension__ struct{ cl_short4 lo, hi; }; #endif #if defined( __CL_SHORT2__) __cl_short2 v2[4]; #endif #if defined( __CL_SHORT4__) __cl_short4 v4[2]; #endif #if defined( __CL_SHORT8__ ) __cl_short8 v8; #endif }cl_short8; typedef union { cl_short CL_ALIGNED(32) s[16]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_short x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; __extension__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; __extension__ struct{ cl_short8 lo, hi; }; #endif #if defined( __CL_SHORT2__) __cl_short2 v2[8]; #endif #if defined( __CL_SHORT4__) __cl_short4 v4[4]; #endif #if defined( __CL_SHORT8__ ) __cl_short8 v8[2]; #endif #if defined( __CL_SHORT16__ ) __cl_short16 v16; #endif }cl_short16; /* ---- cl_ushortn ---- */ typedef union { cl_ushort CL_ALIGNED(4) s[2]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_ushort x, y; }; __extension__ struct{ cl_ushort s0, s1; }; __extension__ struct{ cl_ushort lo, hi; }; #endif #if defined( __CL_USHORT2__) __cl_ushort2 v2; #endif }cl_ushort2; typedef union { cl_ushort CL_ALIGNED(8) s[4]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_ushort x, y, z, w; }; __extension__ struct{ cl_ushort s0, s1, s2, s3; }; __extension__ struct{ cl_ushort2 lo, hi; }; #endif #if defined( __CL_USHORT2__) __cl_ushort2 v2[2]; #endif #if defined( __CL_USHORT4__) __cl_ushort4 v4; #endif }cl_ushort4; /* cl_ushort3 is identical in size, alignment and behavior to cl_ushort4. See section 6.1.5. */ typedef cl_ushort4 cl_ushort3; typedef union { cl_ushort CL_ALIGNED(16) s[8]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_ushort x, y, z, w; }; __extension__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7; }; __extension__ struct{ cl_ushort4 lo, hi; }; #endif #if defined( __CL_USHORT2__) __cl_ushort2 v2[4]; #endif #if defined( __CL_USHORT4__) __cl_ushort4 v4[2]; #endif #if defined( __CL_USHORT8__ ) __cl_ushort8 v8; #endif }cl_ushort8; typedef union { cl_ushort CL_ALIGNED(32) s[16]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_ushort x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; __extension__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; __extension__ struct{ cl_ushort8 lo, hi; }; #endif #if defined( __CL_USHORT2__) __cl_ushort2 v2[8]; #endif #if defined( __CL_USHORT4__) __cl_ushort4 v4[4]; #endif #if defined( __CL_USHORT8__ ) __cl_ushort8 v8[2]; #endif #if defined( __CL_USHORT16__ ) __cl_ushort16 v16; #endif }cl_ushort16; /* ---- cl_intn ---- */ typedef union { cl_int CL_ALIGNED(8) s[2]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_int x, y; }; __extension__ struct{ cl_int s0, s1; }; __extension__ struct{ cl_int lo, hi; }; #endif #if defined( __CL_INT2__) __cl_int2 v2; #endif }cl_int2; typedef union { cl_int CL_ALIGNED(16) s[4]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_int x, y, z, w; }; __extension__ struct{ cl_int s0, s1, s2, s3; }; __extension__ struct{ cl_int2 lo, hi; }; #endif #if defined( __CL_INT2__) __cl_int2 v2[2]; #endif #if defined( __CL_INT4__) __cl_int4 v4; #endif }cl_int4; /* cl_int3 is identical in size, alignment and behavior to cl_int4. See section 6.1.5. */ typedef cl_int4 cl_int3; typedef union { cl_int CL_ALIGNED(32) s[8]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_int x, y, z, w; }; __extension__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7; }; __extension__ struct{ cl_int4 lo, hi; }; #endif #if defined( __CL_INT2__) __cl_int2 v2[4]; #endif #if defined( __CL_INT4__) __cl_int4 v4[2]; #endif #if defined( __CL_INT8__ ) __cl_int8 v8; #endif }cl_int8; typedef union { cl_int CL_ALIGNED(64) s[16]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_int x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; __extension__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; __extension__ struct{ cl_int8 lo, hi; }; #endif #if defined( __CL_INT2__) __cl_int2 v2[8]; #endif #if defined( __CL_INT4__) __cl_int4 v4[4]; #endif #if defined( __CL_INT8__ ) __cl_int8 v8[2]; #endif #if defined( __CL_INT16__ ) __cl_int16 v16; #endif }cl_int16; /* ---- cl_uintn ---- */ typedef union { cl_uint CL_ALIGNED(8) s[2]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_uint x, y; }; __extension__ struct{ cl_uint s0, s1; }; __extension__ struct{ cl_uint lo, hi; }; #endif #if defined( __CL_UINT2__) __cl_uint2 v2; #endif }cl_uint2; typedef union { cl_uint CL_ALIGNED(16) s[4]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_uint x, y, z, w; }; __extension__ struct{ cl_uint s0, s1, s2, s3; }; __extension__ struct{ cl_uint2 lo, hi; }; #endif #if defined( __CL_UINT2__) __cl_uint2 v2[2]; #endif #if defined( __CL_UINT4__) __cl_uint4 v4; #endif }cl_uint4; /* cl_uint3 is identical in size, alignment and behavior to cl_uint4. See section 6.1.5. */ typedef cl_uint4 cl_uint3; typedef union { cl_uint CL_ALIGNED(32) s[8]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_uint x, y, z, w; }; __extension__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7; }; __extension__ struct{ cl_uint4 lo, hi; }; #endif #if defined( __CL_UINT2__) __cl_uint2 v2[4]; #endif #if defined( __CL_UINT4__) __cl_uint4 v4[2]; #endif #if defined( __CL_UINT8__ ) __cl_uint8 v8; #endif }cl_uint8; typedef union { cl_uint CL_ALIGNED(64) s[16]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_uint x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; __extension__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; __extension__ struct{ cl_uint8 lo, hi; }; #endif #if defined( __CL_UINT2__) __cl_uint2 v2[8]; #endif #if defined( __CL_UINT4__) __cl_uint4 v4[4]; #endif #if defined( __CL_UINT8__ ) __cl_uint8 v8[2]; #endif #if defined( __CL_UINT16__ ) __cl_uint16 v16; #endif }cl_uint16; /* ---- cl_longn ---- */ typedef union { cl_long CL_ALIGNED(16) s[2]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_long x, y; }; __extension__ struct{ cl_long s0, s1; }; __extension__ struct{ cl_long lo, hi; }; #endif #if defined( __CL_LONG2__) __cl_long2 v2; #endif }cl_long2; typedef union { cl_long CL_ALIGNED(32) s[4]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_long x, y, z, w; }; __extension__ struct{ cl_long s0, s1, s2, s3; }; __extension__ struct{ cl_long2 lo, hi; }; #endif #if defined( __CL_LONG2__) __cl_long2 v2[2]; #endif #if defined( __CL_LONG4__) __cl_long4 v4; #endif }cl_long4; /* cl_long3 is identical in size, alignment and behavior to cl_long4. See section 6.1.5. */ typedef cl_long4 cl_long3; typedef union { cl_long CL_ALIGNED(64) s[8]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_long x, y, z, w; }; __extension__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7; }; __extension__ struct{ cl_long4 lo, hi; }; #endif #if defined( __CL_LONG2__) __cl_long2 v2[4]; #endif #if defined( __CL_LONG4__) __cl_long4 v4[2]; #endif #if defined( __CL_LONG8__ ) __cl_long8 v8; #endif }cl_long8; typedef union { cl_long CL_ALIGNED(128) s[16]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_long x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; __extension__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; __extension__ struct{ cl_long8 lo, hi; }; #endif #if defined( __CL_LONG2__) __cl_long2 v2[8]; #endif #if defined( __CL_LONG4__) __cl_long4 v4[4]; #endif #if defined( __CL_LONG8__ ) __cl_long8 v8[2]; #endif #if defined( __CL_LONG16__ ) __cl_long16 v16; #endif }cl_long16; /* ---- cl_ulongn ---- */ typedef union { cl_ulong CL_ALIGNED(16) s[2]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_ulong x, y; }; __extension__ struct{ cl_ulong s0, s1; }; __extension__ struct{ cl_ulong lo, hi; }; #endif #if defined( __CL_ULONG2__) __cl_ulong2 v2; #endif }cl_ulong2; typedef union { cl_ulong CL_ALIGNED(32) s[4]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_ulong x, y, z, w; }; __extension__ struct{ cl_ulong s0, s1, s2, s3; }; __extension__ struct{ cl_ulong2 lo, hi; }; #endif #if defined( __CL_ULONG2__) __cl_ulong2 v2[2]; #endif #if defined( __CL_ULONG4__) __cl_ulong4 v4; #endif }cl_ulong4; /* cl_ulong3 is identical in size, alignment and behavior to cl_ulong4. See section 6.1.5. */ typedef cl_ulong4 cl_ulong3; typedef union { cl_ulong CL_ALIGNED(64) s[8]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_ulong x, y, z, w; }; __extension__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7; }; __extension__ struct{ cl_ulong4 lo, hi; }; #endif #if defined( __CL_ULONG2__) __cl_ulong2 v2[4]; #endif #if defined( __CL_ULONG4__) __cl_ulong4 v4[2]; #endif #if defined( __CL_ULONG8__ ) __cl_ulong8 v8; #endif }cl_ulong8; typedef union { cl_ulong CL_ALIGNED(128) s[16]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_ulong x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; __extension__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; __extension__ struct{ cl_ulong8 lo, hi; }; #endif #if defined( __CL_ULONG2__) __cl_ulong2 v2[8]; #endif #if defined( __CL_ULONG4__) __cl_ulong4 v4[4]; #endif #if defined( __CL_ULONG8__ ) __cl_ulong8 v8[2]; #endif #if defined( __CL_ULONG16__ ) __cl_ulong16 v16; #endif }cl_ulong16; /* --- cl_floatn ---- */ typedef union { cl_float CL_ALIGNED(8) s[2]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_float x, y; }; __extension__ struct{ cl_float s0, s1; }; __extension__ struct{ cl_float lo, hi; }; #endif #if defined( __CL_FLOAT2__) __cl_float2 v2; #endif }cl_float2; typedef union { cl_float CL_ALIGNED(16) s[4]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_float x, y, z, w; }; __extension__ struct{ cl_float s0, s1, s2, s3; }; __extension__ struct{ cl_float2 lo, hi; }; #endif #if defined( __CL_FLOAT2__) __cl_float2 v2[2]; #endif #if defined( __CL_FLOAT4__) __cl_float4 v4; #endif }cl_float4; /* cl_float3 is identical in size, alignment and behavior to cl_float4. See section 6.1.5. */ typedef cl_float4 cl_float3; typedef union { cl_float CL_ALIGNED(32) s[8]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_float x, y, z, w; }; __extension__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7; }; __extension__ struct{ cl_float4 lo, hi; }; #endif #if defined( __CL_FLOAT2__) __cl_float2 v2[4]; #endif #if defined( __CL_FLOAT4__) __cl_float4 v4[2]; #endif #if defined( __CL_FLOAT8__ ) __cl_float8 v8; #endif }cl_float8; typedef union { cl_float CL_ALIGNED(64) s[16]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_float x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; __extension__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; __extension__ struct{ cl_float8 lo, hi; }; #endif #if defined( __CL_FLOAT2__) __cl_float2 v2[8]; #endif #if defined( __CL_FLOAT4__) __cl_float4 v4[4]; #endif #if defined( __CL_FLOAT8__ ) __cl_float8 v8[2]; #endif #if defined( __CL_FLOAT16__ ) __cl_float16 v16; #endif }cl_float16; /* --- cl_doublen ---- */ typedef union { cl_double CL_ALIGNED(16) s[2]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_double x, y; }; __extension__ struct{ cl_double s0, s1; }; __extension__ struct{ cl_double lo, hi; }; #endif #if defined( __CL_DOUBLE2__) __cl_double2 v2; #endif }cl_double2; typedef union { cl_double CL_ALIGNED(32) s[4]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_double x, y, z, w; }; __extension__ struct{ cl_double s0, s1, s2, s3; }; __extension__ struct{ cl_double2 lo, hi; }; #endif #if defined( __CL_DOUBLE2__) __cl_double2 v2[2]; #endif #if defined( __CL_DOUBLE4__) __cl_double4 v4; #endif }cl_double4; /* cl_double3 is identical in size, alignment and behavior to cl_double4. See section 6.1.5. */ typedef cl_double4 cl_double3; typedef union { cl_double CL_ALIGNED(64) s[8]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_double x, y, z, w; }; __extension__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7; }; __extension__ struct{ cl_double4 lo, hi; }; #endif #if defined( __CL_DOUBLE2__) __cl_double2 v2[4]; #endif #if defined( __CL_DOUBLE4__) __cl_double4 v4[2]; #endif #if defined( __CL_DOUBLE8__ ) __cl_double8 v8; #endif }cl_double8; typedef union { cl_double CL_ALIGNED(128) s[16]; #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) __extension__ struct{ cl_double x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; __extension__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; __extension__ struct{ cl_double8 lo, hi; }; #endif #if defined( __CL_DOUBLE2__) __cl_double2 v2[8]; #endif #if defined( __CL_DOUBLE4__) __cl_double4 v4[4]; #endif #if defined( __CL_DOUBLE8__ ) __cl_double8 v8[2]; #endif #if defined( __CL_DOUBLE16__ ) __cl_double16 v16; #endif }cl_double16; /* Macro to facilitate debugging * Usage: * Place CL_PROGRAM_STRING_DEBUG_INFO on the line before the first line of your source. * The first line ends with: CL_PROGRAM_STRING_BEGIN \" * Each line thereafter of OpenCL C source must end with: \n\ * The last line ends in "; * * Example: * * const char *my_program = CL_PROGRAM_STRING_BEGIN "\ * kernel void foo( int a, float * b ) \n\ * { \n\ * // my comment \n\ * *b[ get_global_id(0)] = a; \n\ * } \n\ * "; * * This should correctly set up the line, (column) and file information for your source * string so you can do source level debugging. */ #define __CL_STRINGIFY( _x ) # _x #define _CL_STRINGIFY( _x ) __CL_STRINGIFY( _x ) #define CL_PROGRAM_STRING_DEBUG_INFO "#line " _CL_STRINGIFY(__LINE__) " \"" __FILE__ "\" \n\n" #ifdef __cplusplus } #endif #endif /* __CL_PLATFORM_H */ lwjgl-2.7.1/src/native/common/CL/cl_ext.h0000644000175000017500000002333711543426510017223 0ustar zero79zero79/******************************************************************************* * Copyright (c) 2008-2010 The Khronos Group Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the * "Materials"), to deal in the Materials without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Materials, and to * permit persons to whom the Materials are furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Materials. * * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. ******************************************************************************/ /* $Revision: 11928 $ on $Date: 2010-07-13 09:04:56 -0700 (Tue, 13 Jul 2010) $ */ /* cl_ext.h contains OpenCL extensions which don't have external */ /* (OpenGL, D3D) dependencies. */ #ifndef __CL_EXT_H #define __CL_EXT_H #ifdef __cplusplus extern "C" { #endif #ifdef __APPLE__ #include #include #else #include #endif /* cl_khr_fp64 extension - no extension #define since it has no functions */ #define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032 /* cl_khr_fp16 extension - no extension #define since it has no functions */ #define CL_DEVICE_HALF_FP_CONFIG 0x1033 /* Memory object destruction * * Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR * * Registers a user callback function that will be called when the memory object is deleted and its resources * freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback * stack associated with memobj. The registered user callback functions are called in the reverse order in * which they were registered. The user callback functions are called and then the memory object is deleted * and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be * notified when the memory referenced by host_ptr, specified when the memory object is created and used as * the storage bits for the memory object, can be reused or freed. * * The application may not call CL api's with the cl_mem object passed to the pfn_notify. * * Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) * before using. */ #define cl_APPLE_SetMemObjectDestructor 1 cl_int CL_API_ENTRY clSetMemObjectDestructorAPPLE( cl_mem /* memobj */, void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/), void * /*user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; /* Context Logging Functions * * The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext(). * Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) * before using. * * clLogMessagesToSystemLog fowards on all log messages to the Apple System Logger */ #define cl_APPLE_ContextLoggingFunctions 1 extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE( const char * /* errstr */, const void * /* private_info */, size_t /* cb */, void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; /* clLogMessagesToStdout sends all log messages to the file descriptor stdout */ extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE( const char * /* errstr */, const void * /* private_info */, size_t /* cb */, void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; /* clLogMessagesToStderr sends all log messages to the file descriptor stderr */ extern void CL_API_ENTRY clLogMessagesToStderrAPPLE( const char * /* errstr */, const void * /* private_info */, size_t /* cb */, void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; /************************ * cl_khr_icd extension * ************************/ #define cl_khr_icd 1 /* cl_platform_info */ #define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920 /* Additional Error Codes */ #define CL_PLATFORM_NOT_FOUND_KHR -1001 extern CL_API_ENTRY cl_int CL_API_CALL clIcdGetPlatformIDsKHR(cl_uint /* num_entries */, cl_platform_id * /* platforms */, cl_uint * /* num_platforms */); typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)( cl_uint /* num_entries */, cl_platform_id * /* platforms */, cl_uint * /* num_platforms */); /****************************************** * cl_nv_device_attribute_query extension * ******************************************/ /* cl_nv_device_attribute_query extension - no extension #define since it has no functions */ #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001 #define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002 #define CL_DEVICE_WARP_SIZE_NV 0x4003 #define CL_DEVICE_GPU_OVERLAP_NV 0x4004 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005 #define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006 /********************************* * cl_amd_device_attribute_query * *********************************/ #define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036 #ifdef CL_VERSION_1_1 /*********************************** * cl_ext_device_fission extension * ***********************************/ #define cl_ext_device_fission 1 extern CL_API_ENTRY cl_int CL_API_CALL clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; typedef CL_API_ENTRY cl_int (CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; extern CL_API_ENTRY cl_int CL_API_CALL clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; typedef CL_API_ENTRY cl_int (CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; typedef cl_ulong cl_device_partition_property_ext; extern CL_API_ENTRY cl_int CL_API_CALL clCreateSubDevicesEXT( cl_device_id /*in_device*/, const cl_device_partition_property_ext * /* properties */, cl_uint /*num_entries*/, cl_device_id * /*out_devices*/, cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1; typedef CL_API_ENTRY cl_int ( CL_API_CALL * clCreateSubDevicesEXT_fn)( cl_device_id /*in_device*/, const cl_device_partition_property_ext * /* properties */, cl_uint /*num_entries*/, cl_device_id * /*out_devices*/, cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1; /* cl_device_partition_property_ext */ #define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050 #define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051 #define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052 #define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053 /* clDeviceGetInfo selectors */ #define CL_DEVICE_PARENT_DEVICE_EXT 0x4054 #define CL_DEVICE_PARTITION_TYPES_EXT 0x4055 #define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056 #define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057 #define CL_DEVICE_PARTITION_STYLE_EXT 0x4058 /* error codes */ #define CL_DEVICE_PARTITION_FAILED_EXT -1057 #define CL_INVALID_PARTITION_COUNT_EXT -1058 #define CL_INVALID_PARTITION_NAME_EXT -1059 /* CL_AFFINITY_DOMAINs */ #define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1 #define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2 #define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3 #define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4 #define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10 #define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100 /* cl_device_partition_property_ext list terminators */ #define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0) #define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0) #define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1) #endif /* CL_VERSION_1_1 */ #ifdef __cplusplus } #endif #endif /* __CL_EXT_H */ lwjgl-2.7.1/src/native/common/CL/cl_gl.h0000644000175000017500000001507311543426510017023 0ustar zero79zero79/********************************************************************************** * Copyright (c) 2008-2010 The Khronos Group Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the * "Materials"), to deal in the Materials without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Materials, and to * permit persons to whom the Materials are furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Materials. * * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. **********************************************************************************/ /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ /* * cl_gl.h contains Khronos-approved (KHR) OpenCL extensions which have * OpenGL dependencies. The application is responsible for #including * OpenGL or OpenGL ES headers before #including cl_gl.h. */ #ifndef __OPENCL_CL_GL_H #define __OPENCL_CL_GL_H #ifdef __APPLE__ #include #include #else #include #endif #ifdef __cplusplus extern "C" { #endif typedef cl_uint cl_gl_object_type; typedef cl_uint cl_gl_texture_info; typedef cl_uint cl_gl_platform_info; typedef struct __GLsync *cl_GLsync; /* cl_gl_object_type */ #define CL_GL_OBJECT_BUFFER 0x2000 #define CL_GL_OBJECT_TEXTURE2D 0x2001 #define CL_GL_OBJECT_TEXTURE3D 0x2002 #define CL_GL_OBJECT_RENDERBUFFER 0x2003 /* cl_gl_texture_info */ #define CL_GL_TEXTURE_TARGET 0x2004 #define CL_GL_MIPMAP_LEVEL 0x2005 extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLBuffer(cl_context /* context */, cl_mem_flags /* flags */, cl_GLuint /* bufobj */, int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLTexture2D(cl_context /* context */, cl_mem_flags /* flags */, cl_GLenum /* target */, cl_GLint /* miplevel */, cl_GLuint /* texture */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLTexture3D(cl_context /* context */, cl_mem_flags /* flags */, cl_GLenum /* target */, cl_GLint /* miplevel */, cl_GLuint /* texture */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLRenderbuffer(cl_context /* context */, cl_mem_flags /* flags */, cl_GLuint /* renderbuffer */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clGetGLObjectInfo(cl_mem /* memobj */, cl_gl_object_type * /* gl_object_type */, cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clGetGLTextureInfo(cl_mem /* memobj */, cl_gl_texture_info /* param_name */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireGLObjects(cl_command_queue /* command_queue */, cl_uint /* num_objects */, const cl_mem * /* mem_objects */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseGLObjects(cl_command_queue /* command_queue */, cl_uint /* num_objects */, const cl_mem * /* mem_objects */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; /* cl_khr_gl_sharing extension */ #define cl_khr_gl_sharing 1 typedef cl_uint cl_gl_context_info; /* Additional Error Codes */ #define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000 /* cl_gl_context_info */ #define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006 #define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007 /* Additional cl_context_properties */ #define CL_GL_CONTEXT_KHR 0x2008 #define CL_EGL_DISPLAY_KHR 0x2009 #define CL_GLX_DISPLAY_KHR 0x200A #define CL_WGL_HDC_KHR 0x200B #define CL_CGL_SHAREGROUP_KHR 0x200C extern CL_API_ENTRY cl_int CL_API_CALL clGetGLContextInfoKHR(const cl_context_properties * /* properties */, cl_gl_context_info /* param_name */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)( const cl_context_properties * properties, cl_gl_context_info param_name, size_t param_value_size, void * param_value, size_t * param_value_size_ret); #ifdef __cplusplus } #endif #endif /* __OPENCL_CL_GL_H */ lwjgl-2.7.1/src/native/common/CL/cl.h0000644000175000017500000014165311543426510016345 0ustar zero79zero79/******************************************************************************* * Copyright (c) 2008-2010 The Khronos Group Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the * "Materials"), to deal in the Materials without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Materials, and to * permit persons to whom the Materials are furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Materials. * * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. ******************************************************************************/ /* $Revision: 11985 $ on $Date: 2010-07-15 11:16:06 -0700 (Thu, 15 Jul 2010) $ */ #ifndef __OPENCL_CL_H #define __OPENCL_CL_H #ifdef __APPLE__ #include #else #include #endif #ifdef __cplusplus extern "C" { #endif /******************************************************************************/ typedef struct _cl_platform_id * cl_platform_id; typedef struct _cl_device_id * cl_device_id; typedef struct _cl_context * cl_context; typedef struct _cl_command_queue * cl_command_queue; typedef struct _cl_mem * cl_mem; typedef struct _cl_program * cl_program; typedef struct _cl_kernel * cl_kernel; typedef struct _cl_event * cl_event; typedef struct _cl_sampler * cl_sampler; typedef cl_uint cl_bool; /* WARNING! Unlike cl_ types in cl_platform.h, cl_bool is not guaranteed to be the same size as the bool in kernels. */ typedef cl_ulong cl_bitfield; typedef cl_bitfield cl_device_type; typedef cl_uint cl_platform_info; typedef cl_uint cl_device_info; typedef cl_bitfield cl_device_fp_config; typedef cl_uint cl_device_mem_cache_type; typedef cl_uint cl_device_local_mem_type; typedef cl_bitfield cl_device_exec_capabilities; typedef cl_bitfield cl_command_queue_properties; typedef intptr_t cl_context_properties; typedef cl_uint cl_context_info; typedef cl_uint cl_command_queue_info; typedef cl_uint cl_channel_order; typedef cl_uint cl_channel_type; typedef cl_bitfield cl_mem_flags; typedef cl_uint cl_mem_object_type; typedef cl_uint cl_mem_info; typedef cl_uint cl_image_info; typedef cl_uint cl_buffer_create_type; typedef cl_uint cl_addressing_mode; typedef cl_uint cl_filter_mode; typedef cl_uint cl_sampler_info; typedef cl_bitfield cl_map_flags; typedef cl_uint cl_program_info; typedef cl_uint cl_program_build_info; typedef cl_int cl_build_status; typedef cl_uint cl_kernel_info; typedef cl_uint cl_kernel_work_group_info; typedef cl_uint cl_event_info; typedef cl_uint cl_command_type; typedef cl_uint cl_profiling_info; typedef struct _cl_image_format { cl_channel_order image_channel_order; cl_channel_type image_channel_data_type; } cl_image_format; typedef struct _cl_buffer_region { size_t origin; size_t size; } cl_buffer_region; /******************************************************************************/ /* Error Codes */ #define CL_SUCCESS 0 #define CL_DEVICE_NOT_FOUND -1 #define CL_DEVICE_NOT_AVAILABLE -2 #define CL_COMPILER_NOT_AVAILABLE -3 #define CL_MEM_OBJECT_ALLOCATION_FAILURE -4 #define CL_OUT_OF_RESOURCES -5 #define CL_OUT_OF_HOST_MEMORY -6 #define CL_PROFILING_INFO_NOT_AVAILABLE -7 #define CL_MEM_COPY_OVERLAP -8 #define CL_IMAGE_FORMAT_MISMATCH -9 #define CL_IMAGE_FORMAT_NOT_SUPPORTED -10 #define CL_BUILD_PROGRAM_FAILURE -11 #define CL_MAP_FAILURE -12 #define CL_MISALIGNED_SUB_BUFFER_OFFSET -13 #define CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST -14 #define CL_INVALID_VALUE -30 #define CL_INVALID_DEVICE_TYPE -31 #define CL_INVALID_PLATFORM -32 #define CL_INVALID_DEVICE -33 #define CL_INVALID_CONTEXT -34 #define CL_INVALID_QUEUE_PROPERTIES -35 #define CL_INVALID_COMMAND_QUEUE -36 #define CL_INVALID_HOST_PTR -37 #define CL_INVALID_MEM_OBJECT -38 #define CL_INVALID_IMAGE_FORMAT_DESCRIPTOR -39 #define CL_INVALID_IMAGE_SIZE -40 #define CL_INVALID_SAMPLER -41 #define CL_INVALID_BINARY -42 #define CL_INVALID_BUILD_OPTIONS -43 #define CL_INVALID_PROGRAM -44 #define CL_INVALID_PROGRAM_EXECUTABLE -45 #define CL_INVALID_KERNEL_NAME -46 #define CL_INVALID_KERNEL_DEFINITION -47 #define CL_INVALID_KERNEL -48 #define CL_INVALID_ARG_INDEX -49 #define CL_INVALID_ARG_VALUE -50 #define CL_INVALID_ARG_SIZE -51 #define CL_INVALID_KERNEL_ARGS -52 #define CL_INVALID_WORK_DIMENSION -53 #define CL_INVALID_WORK_GROUP_SIZE -54 #define CL_INVALID_WORK_ITEM_SIZE -55 #define CL_INVALID_GLOBAL_OFFSET -56 #define CL_INVALID_EVENT_WAIT_LIST -57 #define CL_INVALID_EVENT -58 #define CL_INVALID_OPERATION -59 #define CL_INVALID_GL_OBJECT -60 #define CL_INVALID_BUFFER_SIZE -61 #define CL_INVALID_MIP_LEVEL -62 #define CL_INVALID_GLOBAL_WORK_SIZE -63 #define CL_INVALID_PROPERTY -64 /* OpenCL Version */ #define CL_VERSION_1_0 1 #define CL_VERSION_1_1 1 /* cl_bool */ #define CL_FALSE 0 #define CL_TRUE 1 /* cl_platform_info */ #define CL_PLATFORM_PROFILE 0x0900 #define CL_PLATFORM_VERSION 0x0901 #define CL_PLATFORM_NAME 0x0902 #define CL_PLATFORM_VENDOR 0x0903 #define CL_PLATFORM_EXTENSIONS 0x0904 /* cl_device_type - bitfield */ #define CL_DEVICE_TYPE_DEFAULT (1 << 0) #define CL_DEVICE_TYPE_CPU (1 << 1) #define CL_DEVICE_TYPE_GPU (1 << 2) #define CL_DEVICE_TYPE_ACCELERATOR (1 << 3) #define CL_DEVICE_TYPE_ALL 0xFFFFFFFF /* cl_device_info */ #define CL_DEVICE_TYPE 0x1000 #define CL_DEVICE_VENDOR_ID 0x1001 #define CL_DEVICE_MAX_COMPUTE_UNITS 0x1002 #define CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS 0x1003 #define CL_DEVICE_MAX_WORK_GROUP_SIZE 0x1004 #define CL_DEVICE_MAX_WORK_ITEM_SIZES 0x1005 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR 0x1006 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT 0x1007 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT 0x1008 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG 0x1009 #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT 0x100A #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE 0x100B #define CL_DEVICE_MAX_CLOCK_FREQUENCY 0x100C #define CL_DEVICE_ADDRESS_BITS 0x100D #define CL_DEVICE_MAX_READ_IMAGE_ARGS 0x100E #define CL_DEVICE_MAX_WRITE_IMAGE_ARGS 0x100F #define CL_DEVICE_MAX_MEM_ALLOC_SIZE 0x1010 #define CL_DEVICE_IMAGE2D_MAX_WIDTH 0x1011 #define CL_DEVICE_IMAGE2D_MAX_HEIGHT 0x1012 #define CL_DEVICE_IMAGE3D_MAX_WIDTH 0x1013 #define CL_DEVICE_IMAGE3D_MAX_HEIGHT 0x1014 #define CL_DEVICE_IMAGE3D_MAX_DEPTH 0x1015 #define CL_DEVICE_IMAGE_SUPPORT 0x1016 #define CL_DEVICE_MAX_PARAMETER_SIZE 0x1017 #define CL_DEVICE_MAX_SAMPLERS 0x1018 #define CL_DEVICE_MEM_BASE_ADDR_ALIGN 0x1019 #define CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE 0x101A #define CL_DEVICE_SINGLE_FP_CONFIG 0x101B #define CL_DEVICE_GLOBAL_MEM_CACHE_TYPE 0x101C #define CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE 0x101D #define CL_DEVICE_GLOBAL_MEM_CACHE_SIZE 0x101E #define CL_DEVICE_GLOBAL_MEM_SIZE 0x101F #define CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE 0x1020 #define CL_DEVICE_MAX_CONSTANT_ARGS 0x1021 #define CL_DEVICE_LOCAL_MEM_TYPE 0x1022 #define CL_DEVICE_LOCAL_MEM_SIZE 0x1023 #define CL_DEVICE_ERROR_CORRECTION_SUPPORT 0x1024 #define CL_DEVICE_PROFILING_TIMER_RESOLUTION 0x1025 #define CL_DEVICE_ENDIAN_LITTLE 0x1026 #define CL_DEVICE_AVAILABLE 0x1027 #define CL_DEVICE_COMPILER_AVAILABLE 0x1028 #define CL_DEVICE_EXECUTION_CAPABILITIES 0x1029 #define CL_DEVICE_QUEUE_PROPERTIES 0x102A #define CL_DEVICE_NAME 0x102B #define CL_DEVICE_VENDOR 0x102C #define CL_DRIVER_VERSION 0x102D #define CL_DEVICE_PROFILE 0x102E #define CL_DEVICE_VERSION 0x102F #define CL_DEVICE_EXTENSIONS 0x1030 #define CL_DEVICE_PLATFORM 0x1031 /* 0x1032 reserved for CL_DEVICE_DOUBLE_FP_CONFIG */ /* 0x1033 reserved for CL_DEVICE_HALF_FP_CONFIG */ #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF 0x1034 #define CL_DEVICE_HOST_UNIFIED_MEMORY 0x1035 #define CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR 0x1036 #define CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT 0x1037 #define CL_DEVICE_NATIVE_VECTOR_WIDTH_INT 0x1038 #define CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG 0x1039 #define CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT 0x103A #define CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE 0x103B #define CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF 0x103C #define CL_DEVICE_OPENCL_C_VERSION 0x103D /* cl_device_fp_config - bitfield */ #define CL_FP_DENORM (1 << 0) #define CL_FP_INF_NAN (1 << 1) #define CL_FP_ROUND_TO_NEAREST (1 << 2) #define CL_FP_ROUND_TO_ZERO (1 << 3) #define CL_FP_ROUND_TO_INF (1 << 4) #define CL_FP_FMA (1 << 5) #define CL_FP_SOFT_FLOAT (1 << 6) /* cl_device_mem_cache_type */ #define CL_NONE 0x0 #define CL_READ_ONLY_CACHE 0x1 #define CL_READ_WRITE_CACHE 0x2 /* cl_device_local_mem_type */ #define CL_LOCAL 0x1 #define CL_GLOBAL 0x2 /* cl_device_exec_capabilities - bitfield */ #define CL_EXEC_KERNEL (1 << 0) #define CL_EXEC_NATIVE_KERNEL (1 << 1) /* cl_command_queue_properties - bitfield */ #define CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE (1 << 0) #define CL_QUEUE_PROFILING_ENABLE (1 << 1) /* cl_context_info */ #define CL_CONTEXT_REFERENCE_COUNT 0x1080 #define CL_CONTEXT_DEVICES 0x1081 #define CL_CONTEXT_PROPERTIES 0x1082 #define CL_CONTEXT_NUM_DEVICES 0x1083 /* cl_context_info + cl_context_properties */ #define CL_CONTEXT_PLATFORM 0x1084 /* cl_command_queue_info */ #define CL_QUEUE_CONTEXT 0x1090 #define CL_QUEUE_DEVICE 0x1091 #define CL_QUEUE_REFERENCE_COUNT 0x1092 #define CL_QUEUE_PROPERTIES 0x1093 /* cl_mem_flags - bitfield */ #define CL_MEM_READ_WRITE (1 << 0) #define CL_MEM_WRITE_ONLY (1 << 1) #define CL_MEM_READ_ONLY (1 << 2) #define CL_MEM_USE_HOST_PTR (1 << 3) #define CL_MEM_ALLOC_HOST_PTR (1 << 4) #define CL_MEM_COPY_HOST_PTR (1 << 5) /* cl_channel_order */ #define CL_R 0x10B0 #define CL_A 0x10B1 #define CL_RG 0x10B2 #define CL_RA 0x10B3 #define CL_RGB 0x10B4 #define CL_RGBA 0x10B5 #define CL_BGRA 0x10B6 #define CL_ARGB 0x10B7 #define CL_INTENSITY 0x10B8 #define CL_LUMINANCE 0x10B9 #define CL_Rx 0x10BA #define CL_RGx 0x10BB #define CL_RGBx 0x10BC /* cl_channel_type */ #define CL_SNORM_INT8 0x10D0 #define CL_SNORM_INT16 0x10D1 #define CL_UNORM_INT8 0x10D2 #define CL_UNORM_INT16 0x10D3 #define CL_UNORM_SHORT_565 0x10D4 #define CL_UNORM_SHORT_555 0x10D5 #define CL_UNORM_INT_101010 0x10D6 #define CL_SIGNED_INT8 0x10D7 #define CL_SIGNED_INT16 0x10D8 #define CL_SIGNED_INT32 0x10D9 #define CL_UNSIGNED_INT8 0x10DA #define CL_UNSIGNED_INT16 0x10DB #define CL_UNSIGNED_INT32 0x10DC #define CL_HALF_FLOAT 0x10DD #define CL_FLOAT 0x10DE /* cl_mem_object_type */ #define CL_MEM_OBJECT_BUFFER 0x10F0 #define CL_MEM_OBJECT_IMAGE2D 0x10F1 #define CL_MEM_OBJECT_IMAGE3D 0x10F2 /* cl_mem_info */ #define CL_MEM_TYPE 0x1100 #define CL_MEM_FLAGS 0x1101 #define CL_MEM_SIZE 0x1102 #define CL_MEM_HOST_PTR 0x1103 #define CL_MEM_MAP_COUNT 0x1104 #define CL_MEM_REFERENCE_COUNT 0x1105 #define CL_MEM_CONTEXT 0x1106 #define CL_MEM_ASSOCIATED_MEMOBJECT 0x1107 #define CL_MEM_OFFSET 0x1108 /* cl_image_info */ #define CL_IMAGE_FORMAT 0x1110 #define CL_IMAGE_ELEMENT_SIZE 0x1111 #define CL_IMAGE_ROW_PITCH 0x1112 #define CL_IMAGE_SLICE_PITCH 0x1113 #define CL_IMAGE_WIDTH 0x1114 #define CL_IMAGE_HEIGHT 0x1115 #define CL_IMAGE_DEPTH 0x1116 /* cl_addressing_mode */ #define CL_ADDRESS_NONE 0x1130 #define CL_ADDRESS_CLAMP_TO_EDGE 0x1131 #define CL_ADDRESS_CLAMP 0x1132 #define CL_ADDRESS_REPEAT 0x1133 #define CL_ADDRESS_MIRRORED_REPEAT 0x1134 /* cl_filter_mode */ #define CL_FILTER_NEAREST 0x1140 #define CL_FILTER_LINEAR 0x1141 /* cl_sampler_info */ #define CL_SAMPLER_REFERENCE_COUNT 0x1150 #define CL_SAMPLER_CONTEXT 0x1151 #define CL_SAMPLER_NORMALIZED_COORDS 0x1152 #define CL_SAMPLER_ADDRESSING_MODE 0x1153 #define CL_SAMPLER_FILTER_MODE 0x1154 /* cl_map_flags - bitfield */ #define CL_MAP_READ (1 << 0) #define CL_MAP_WRITE (1 << 1) /* cl_program_info */ #define CL_PROGRAM_REFERENCE_COUNT 0x1160 #define CL_PROGRAM_CONTEXT 0x1161 #define CL_PROGRAM_NUM_DEVICES 0x1162 #define CL_PROGRAM_DEVICES 0x1163 #define CL_PROGRAM_SOURCE 0x1164 #define CL_PROGRAM_BINARY_SIZES 0x1165 #define CL_PROGRAM_BINARIES 0x1166 /* cl_program_build_info */ #define CL_PROGRAM_BUILD_STATUS 0x1181 #define CL_PROGRAM_BUILD_OPTIONS 0x1182 #define CL_PROGRAM_BUILD_LOG 0x1183 /* cl_build_status */ #define CL_BUILD_SUCCESS 0 #define CL_BUILD_NONE -1 #define CL_BUILD_ERROR -2 #define CL_BUILD_IN_PROGRESS -3 /* cl_kernel_info */ #define CL_KERNEL_FUNCTION_NAME 0x1190 #define CL_KERNEL_NUM_ARGS 0x1191 #define CL_KERNEL_REFERENCE_COUNT 0x1192 #define CL_KERNEL_CONTEXT 0x1193 #define CL_KERNEL_PROGRAM 0x1194 /* cl_kernel_work_group_info */ #define CL_KERNEL_WORK_GROUP_SIZE 0x11B0 #define CL_KERNEL_COMPILE_WORK_GROUP_SIZE 0x11B1 #define CL_KERNEL_LOCAL_MEM_SIZE 0x11B2 #define CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE 0x11B3 #define CL_KERNEL_PRIVATE_MEM_SIZE 0x11B4 /* cl_event_info */ #define CL_EVENT_COMMAND_QUEUE 0x11D0 #define CL_EVENT_COMMAND_TYPE 0x11D1 #define CL_EVENT_REFERENCE_COUNT 0x11D2 #define CL_EVENT_COMMAND_EXECUTION_STATUS 0x11D3 #define CL_EVENT_CONTEXT 0x11D4 /* cl_command_type */ #define CL_COMMAND_NDRANGE_KERNEL 0x11F0 #define CL_COMMAND_TASK 0x11F1 #define CL_COMMAND_NATIVE_KERNEL 0x11F2 #define CL_COMMAND_READ_BUFFER 0x11F3 #define CL_COMMAND_WRITE_BUFFER 0x11F4 #define CL_COMMAND_COPY_BUFFER 0x11F5 #define CL_COMMAND_READ_IMAGE 0x11F6 #define CL_COMMAND_WRITE_IMAGE 0x11F7 #define CL_COMMAND_COPY_IMAGE 0x11F8 #define CL_COMMAND_COPY_IMAGE_TO_BUFFER 0x11F9 #define CL_COMMAND_COPY_BUFFER_TO_IMAGE 0x11FA #define CL_COMMAND_MAP_BUFFER 0x11FB #define CL_COMMAND_MAP_IMAGE 0x11FC #define CL_COMMAND_UNMAP_MEM_OBJECT 0x11FD #define CL_COMMAND_MARKER 0x11FE #define CL_COMMAND_ACQUIRE_GL_OBJECTS 0x11FF #define CL_COMMAND_RELEASE_GL_OBJECTS 0x1200 #define CL_COMMAND_READ_BUFFER_RECT 0x1201 #define CL_COMMAND_WRITE_BUFFER_RECT 0x1202 #define CL_COMMAND_COPY_BUFFER_RECT 0x1203 #define CL_COMMAND_USER 0x1204 /* command execution status */ #define CL_COMPLETE 0x0 #define CL_RUNNING 0x1 #define CL_SUBMITTED 0x2 #define CL_QUEUED 0x3 /* cl_buffer_create_type */ #define CL_BUFFER_CREATE_TYPE_REGION 0x1220 /* cl_profiling_info */ #define CL_PROFILING_COMMAND_QUEUED 0x1280 #define CL_PROFILING_COMMAND_SUBMIT 0x1281 #define CL_PROFILING_COMMAND_START 0x1282 #define CL_PROFILING_COMMAND_END 0x1283 /********************************************************************************************************/ /* Platform API */ extern CL_API_ENTRY cl_int CL_API_CALL clGetPlatformIDs(cl_uint /* num_entries */, cl_platform_id * /* platforms */, cl_uint * /* num_platforms */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clGetPlatformInfo(cl_platform_id /* platform */, cl_platform_info /* param_name */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; /* Device APIs */ extern CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDs(cl_platform_id /* platform */, cl_device_type /* device_type */, cl_uint /* num_entries */, cl_device_id * /* devices */, cl_uint * /* num_devices */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clGetDeviceInfo(cl_device_id /* device */, cl_device_info /* param_name */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; /* Context APIs */ extern CL_API_ENTRY cl_context CL_API_CALL clCreateContext(const cl_context_properties * /* properties */, cl_uint /* num_devices */, const cl_device_id * /* devices */, void (CL_CALLBACK * /* pfn_notify */)(const char *, const void *, size_t, void *), void * /* user_data */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_context CL_API_CALL clCreateContextFromType(const cl_context_properties * /* properties */, cl_device_type /* device_type */, void (CL_CALLBACK * /* pfn_notify*/ )(const char *, const void *, size_t, void *), void * /* user_data */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clRetainContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clReleaseContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clGetContextInfo(cl_context /* context */, cl_context_info /* param_name */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; /* Command Queue APIs */ extern CL_API_ENTRY cl_command_queue CL_API_CALL clCreateCommandQueue(cl_context /* context */, cl_device_id /* device */, cl_command_queue_properties /* properties */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clRetainCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clReleaseCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clGetCommandQueueInfo(cl_command_queue /* command_queue */, cl_command_queue_info /* param_name */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS #warning CL_USE_DEPRECATED_OPENCL_1_0_APIS is defined. These APIs are unsupported and untested in OpenCL 1.1! /* * WARNING: * This API introduces mutable state into the OpenCL implementation. It has been REMOVED * to better facilitate thread safety. The 1.0 API is not thread safe. It is not tested by the * OpenCL 1.1 conformance test, and consequently may not work or may not work dependably. * It is likely to be non-performant. Use of this API is not advised. Use at your own risk. * * Software developers previously relying on this API are instructed to set the command queue * properties when creating the queue, instead. */ extern CL_API_ENTRY cl_int CL_API_CALL clSetCommandQueueProperty(cl_command_queue /* command_queue */, cl_command_queue_properties /* properties */, cl_bool /* enable */, cl_command_queue_properties * /* old_properties */) CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED; #endif /* CL_USE_DEPRECATED_OPENCL_1_0_APIS */ /* Memory Object APIs */ extern CL_API_ENTRY cl_mem CL_API_CALL clCreateBuffer(cl_context /* context */, cl_mem_flags /* flags */, size_t /* size */, void * /* host_ptr */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_mem CL_API_CALL clCreateSubBuffer(cl_mem /* buffer */, cl_mem_flags /* flags */, cl_buffer_create_type /* buffer_create_type */, const void * /* buffer_create_info */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1; extern CL_API_ENTRY cl_mem CL_API_CALL clCreateImage2D(cl_context /* context */, cl_mem_flags /* flags */, const cl_image_format * /* image_format */, size_t /* image_width */, size_t /* image_height */, size_t /* image_row_pitch */, void * /* host_ptr */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_mem CL_API_CALL clCreateImage3D(cl_context /* context */, cl_mem_flags /* flags */, const cl_image_format * /* image_format */, size_t /* image_width */, size_t /* image_height */, size_t /* image_depth */, size_t /* image_row_pitch */, size_t /* image_slice_pitch */, void * /* host_ptr */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clRetainMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clReleaseMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clGetSupportedImageFormats(cl_context /* context */, cl_mem_flags /* flags */, cl_mem_object_type /* image_type */, cl_uint /* num_entries */, cl_image_format * /* image_formats */, cl_uint * /* num_image_formats */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clGetMemObjectInfo(cl_mem /* memobj */, cl_mem_info /* param_name */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clGetImageInfo(cl_mem /* image */, cl_image_info /* param_name */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clSetMemObjectDestructorCallback( cl_mem /* memobj */, void (CL_CALLBACK * /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/), void * /*user_data */ ) CL_API_SUFFIX__VERSION_1_1; /* Sampler APIs */ extern CL_API_ENTRY cl_sampler CL_API_CALL clCreateSampler(cl_context /* context */, cl_bool /* normalized_coords */, cl_addressing_mode /* addressing_mode */, cl_filter_mode /* filter_mode */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clRetainSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clReleaseSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clGetSamplerInfo(cl_sampler /* sampler */, cl_sampler_info /* param_name */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; /* Program Object APIs */ extern CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithSource(cl_context /* context */, cl_uint /* count */, const char ** /* strings */, const size_t * /* lengths */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithBinary(cl_context /* context */, cl_uint /* num_devices */, const cl_device_id * /* device_list */, const size_t * /* lengths */, const unsigned char ** /* binaries */, cl_int * /* binary_status */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clRetainProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clReleaseProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clBuildProgram(cl_program /* program */, cl_uint /* num_devices */, const cl_device_id * /* device_list */, const char * /* options */, void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */), void * /* user_data */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clUnloadCompiler(void) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clGetProgramInfo(cl_program /* program */, cl_program_info /* param_name */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clGetProgramBuildInfo(cl_program /* program */, cl_device_id /* device */, cl_program_build_info /* param_name */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; /* Kernel Object APIs */ extern CL_API_ENTRY cl_kernel CL_API_CALL clCreateKernel(cl_program /* program */, const char * /* kernel_name */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clCreateKernelsInProgram(cl_program /* program */, cl_uint /* num_kernels */, cl_kernel * /* kernels */, cl_uint * /* num_kernels_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clRetainKernel(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clReleaseKernel(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clSetKernelArg(cl_kernel /* kernel */, cl_uint /* arg_index */, size_t /* arg_size */, const void * /* arg_value */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clGetKernelInfo(cl_kernel /* kernel */, cl_kernel_info /* param_name */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clGetKernelWorkGroupInfo(cl_kernel /* kernel */, cl_device_id /* device */, cl_kernel_work_group_info /* param_name */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; /* Event Object APIs */ extern CL_API_ENTRY cl_int CL_API_CALL clWaitForEvents(cl_uint /* num_events */, const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clGetEventInfo(cl_event /* event */, cl_event_info /* param_name */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_event CL_API_CALL clCreateUserEvent(cl_context /* context */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1; extern CL_API_ENTRY cl_int CL_API_CALL clRetainEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clReleaseEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clSetUserEventStatus(cl_event /* event */, cl_int /* execution_status */) CL_API_SUFFIX__VERSION_1_1; extern CL_API_ENTRY cl_int CL_API_CALL clSetEventCallback( cl_event /* event */, cl_int /* command_exec_callback_type */, void (CL_CALLBACK * /* pfn_notify */)(cl_event, cl_int, void *), void * /* user_data */) CL_API_SUFFIX__VERSION_1_1; /* Profiling APIs */ extern CL_API_ENTRY cl_int CL_API_CALL clGetEventProfilingInfo(cl_event /* event */, cl_profiling_info /* param_name */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; /* Flush and Finish APIs */ extern CL_API_ENTRY cl_int CL_API_CALL clFlush(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clFinish(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0; /* Enqueued Commands APIs */ extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadBuffer(cl_command_queue /* command_queue */, cl_mem /* buffer */, cl_bool /* blocking_read */, size_t /* offset */, size_t /* cb */, void * /* ptr */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadBufferRect(cl_command_queue /* command_queue */, cl_mem /* buffer */, cl_bool /* blocking_read */, const size_t * /* buffer_origin */, const size_t * /* host_origin */, const size_t * /* region */, size_t /* buffer_row_pitch */, size_t /* buffer_slice_pitch */, size_t /* host_row_pitch */, size_t /* host_slice_pitch */, void * /* ptr */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteBuffer(cl_command_queue /* command_queue */, cl_mem /* buffer */, cl_bool /* blocking_write */, size_t /* offset */, size_t /* cb */, const void * /* ptr */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteBufferRect(cl_command_queue /* command_queue */, cl_mem /* buffer */, cl_bool /* blocking_write */, const size_t * /* buffer_origin */, const size_t * /* host_origin */, const size_t * /* region */, size_t /* buffer_row_pitch */, size_t /* buffer_slice_pitch */, size_t /* host_row_pitch */, size_t /* host_slice_pitch */, const void * /* ptr */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBuffer(cl_command_queue /* command_queue */, cl_mem /* src_buffer */, cl_mem /* dst_buffer */, size_t /* src_offset */, size_t /* dst_offset */, size_t /* cb */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBufferRect(cl_command_queue /* command_queue */, cl_mem /* src_buffer */, cl_mem /* dst_buffer */, const size_t * /* src_origin */, const size_t * /* dst_origin */, const size_t * /* region */, size_t /* src_row_pitch */, size_t /* src_slice_pitch */, size_t /* dst_row_pitch */, size_t /* dst_slice_pitch */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadImage(cl_command_queue /* command_queue */, cl_mem /* image */, cl_bool /* blocking_read */, const size_t * /* origin[3] */, const size_t * /* region[3] */, size_t /* row_pitch */, size_t /* slice_pitch */, void * /* ptr */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteImage(cl_command_queue /* command_queue */, cl_mem /* image */, cl_bool /* blocking_write */, const size_t * /* origin[3] */, const size_t * /* region[3] */, size_t /* input_row_pitch */, size_t /* input_slice_pitch */, const void * /* ptr */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyImage(cl_command_queue /* command_queue */, cl_mem /* src_image */, cl_mem /* dst_image */, const size_t * /* src_origin[3] */, const size_t * /* dst_origin[3] */, const size_t * /* region[3] */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyImageToBuffer(cl_command_queue /* command_queue */, cl_mem /* src_image */, cl_mem /* dst_buffer */, const size_t * /* src_origin[3] */, const size_t * /* region[3] */, size_t /* dst_offset */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBufferToImage(cl_command_queue /* command_queue */, cl_mem /* src_buffer */, cl_mem /* dst_image */, size_t /* src_offset */, const size_t * /* dst_origin[3] */, const size_t * /* region[3] */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY void * CL_API_CALL clEnqueueMapBuffer(cl_command_queue /* command_queue */, cl_mem /* buffer */, cl_bool /* blocking_map */, cl_map_flags /* map_flags */, size_t /* offset */, size_t /* cb */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY void * CL_API_CALL clEnqueueMapImage(cl_command_queue /* command_queue */, cl_mem /* image */, cl_bool /* blocking_map */, cl_map_flags /* map_flags */, const size_t * /* origin[3] */, const size_t * /* region[3] */, size_t * /* image_row_pitch */, size_t * /* image_slice_pitch */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueUnmapMemObject(cl_command_queue /* command_queue */, cl_mem /* memobj */, void * /* mapped_ptr */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueNDRangeKernel(cl_command_queue /* command_queue */, cl_kernel /* kernel */, cl_uint /* work_dim */, const size_t * /* global_work_offset */, const size_t * /* global_work_size */, const size_t * /* local_work_size */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueTask(cl_command_queue /* command_queue */, cl_kernel /* kernel */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueNativeKernel(cl_command_queue /* command_queue */, void (*user_func)(void *), void * /* args */, size_t /* cb_args */, cl_uint /* num_mem_objects */, const cl_mem * /* mem_list */, const void ** /* args_mem_loc */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueMarker(cl_command_queue /* command_queue */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueWaitForEvents(cl_command_queue /* command_queue */, cl_uint /* num_events */, const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueBarrier(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0; /* Extension function access * * Returns the extension function address for the given function name, * or NULL if a valid function can not be found. The client must * check to make sure the address is not NULL, before using or * calling the returned function address. */ extern CL_API_ENTRY void * CL_API_CALL clGetExtensionFunctionAddress(const char * /* func_name */) CL_API_SUFFIX__VERSION_1_0; #ifdef __cplusplus } #endif #endif /* __OPENCL_CL_H */ lwjgl-2.7.1/src/native/common/CL/cl_d3d10.h0000644000175000017500000001137311543426510017233 0ustar zero79zero79/********************************************************************************** * Copyright (c) 2008-2010 The Khronos Group Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the * "Materials"), to deal in the Materials without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Materials, and to * permit persons to whom the Materials are furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Materials. * * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. **********************************************************************************/ /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ #ifndef __OPENCL_CL_D3D10_H #define __OPENCL_CL_D3D10_H #include #include #include #ifdef __cplusplus extern "C" { #endif /****************************************************************************** * cl_khr_d3d10_sharing */ #define cl_khr_d3d10_sharing 1 typedef cl_uint cl_d3d10_device_source_khr; typedef cl_uint cl_d3d10_device_set_khr; /******************************************************************************/ // Error Codes #define CL_INVALID_D3D10_DEVICE_KHR -1002 #define CL_INVALID_D3D10_RESOURCE_KHR -1003 #define CL_D3D10_RESOURCE_ALREADY_ACQUIRED_KHR -1004 #define CL_D3D10_RESOURCE_NOT_ACQUIRED_KHR -1005 // cl_d3d10_device_source_nv #define CL_D3D10_DEVICE_KHR 0x4010 #define CL_D3D10_DXGI_ADAPTER_KHR 0x4011 // cl_d3d10_device_set_nv #define CL_PREFERRED_DEVICES_FOR_D3D10_KHR 0x4012 #define CL_ALL_DEVICES_FOR_D3D10_KHR 0x4013 // cl_context_info #define CL_CONTEXT_D3D10_DEVICE_KHR 0x4014 #define CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR 0x402C // cl_mem_info #define CL_MEM_D3D10_RESOURCE_KHR 0x4015 // cl_image_info #define CL_IMAGE_D3D10_SUBRESOURCE_KHR 0x4016 // cl_command_type #define CL_COMMAND_ACQUIRE_D3D10_OBJECTS_KHR 0x4017 #define CL_COMMAND_RELEASE_D3D10_OBJECTS_KHR 0x4018 /******************************************************************************/ typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D10KHR_fn)( cl_platform_id platform, cl_d3d10_device_source_khr d3d_device_source, void * d3d_object, cl_d3d10_device_set_khr d3d_device_set, cl_uint num_entries, cl_device_id * devices, cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_0; typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10BufferKHR_fn)( cl_context context, cl_mem_flags flags, ID3D10Buffer * resource, cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture2DKHR_fn)( cl_context context, cl_mem_flags flags, ID3D10Texture2D * resource, UINT subresource, cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture3DKHR_fn)( cl_context context, cl_mem_flags flags, ID3D10Texture3D * resource, UINT subresource, cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D10ObjectsKHR_fn)( cl_command_queue command_queue, cl_uint num_objects, const cl_mem * mem_objects, cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event) CL_API_SUFFIX__VERSION_1_0; typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D10ObjectsKHR_fn)( cl_command_queue command_queue, cl_uint num_objects, cl_mem * mem_objects, cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event) CL_API_SUFFIX__VERSION_1_0; #ifdef __cplusplus } #endif #endif // __OPENCL_CL_D3D10_H lwjgl-2.7.1/src/native/common/extcl.h0000644000175000017500000000650611543426510016565 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef __EXTCL_H__ #define __EXTCL_H__ #include #ifdef __APPLE__ #include #else #include #endif #include "common_tools.h" #ifdef __cplusplus extern "C" { #endif #include "extgl_types.h" #include "extcl_types.h" // -----------------[ OpenGL-dependent typedefs ]----------------- typedef GLsync cl_GLsync; // -----------------[ Callback function typedefs ]----------------- #ifndef CL_CALLBACK #define CL_CALLBACK #endif // TODO: This is a bug in current CL implementations (AMD's only?), remove when fixed. (used for cl_native_kernel_func) #if defined(_WIN32) #define CL_USER_FUNC_CALLBACK __cdecl #else #define CL_USER_FUNC_CALLBACK CL_CALLBACK #endif typedef void (CL_CALLBACK * cl_create_context_callback)(const char *errinfo, const void *private_info, size_t cb, void *user_data); typedef void (CL_CALLBACK * cl_mem_object_destructor_callback)(cl_mem memobj, void *user_data); typedef void (CL_CALLBACK * cl_build_program_callback)(cl_program program, void *user_data); typedef void (CL_CALLBACK * cl_event_callback)(cl_event event, cl_int event_command_exec_status, void *user_data); typedef void (CL_USER_FUNC_CALLBACK * cl_native_kernel_func)(void *args); // -----------------[ Cross-platform functions ]----------------- void* extcl_GetProcAddress(const char* function); void extcl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions); int extcl_CalculateImageSize(const size_t *region, size_t row_pitch, size_t slice_pitch); // -----------------[ Platform dependent functions ]----------------- void *extcl_NativeGetFunctionPointer(const char *function); void extcl_LoadLibrary(JNIEnv *env, jstring path); void extcl_UnloadLibrary(); #ifdef __cplusplus } #endif #endif lwjgl-2.7.1/src/native/common/extgl.h0000644000175000017500000001063011543426510016562 0ustar zero79zero79/* Small parts were taken from Mesa's glext.h and gl.h, here's the license: */ /* * Mesa 3-D graphics library * Version: 6.5.1 * * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Some parts derived from files copyright (c) 2001-2002 Lev Povalahev under this license: */ /* ---------------------------------------------------------------------------- Copyright (c) 2002, Lev Povalahev All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The name of the author may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------*/ /* GL_draw_range_elements support added by Benjamin Karaban Lev Povalahev contact information: levp@gmx.net http://www.uni-karlsruhe.de/~uli2/ */ #ifndef __EXTGL_H__ #define __EXTGL_H__ #include #include #include #ifdef __APPLE__ #include #else #include #endif #include "common_tools.h" #if defined(_WIN32) || defined(_WIN64) #include // fix APIENTRY macro redefinition #endif #ifndef APIENTRY #define APIENTRY #endif #include "extcl_types.h" #include "extgl_types.h" /* AMD_debug_output callback function pointer. */ typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam); /* ARB_debug_output callback function pointer. */ typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam); /* initializes everything, call this right after the rc is created. the function returns true if successful */ extern bool extgl_Open(JNIEnv *env); extern void extgl_Close(void); extern void extgl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions); extern bool extgl_InitializeFunctions(int num_functions, ExtFunction *functions); extern bool extgl_QueryExtension(const GLubyte*extensions, const char *name); extern void *extgl_GetProcAddress(const char *name); #endif /* __EXTGL_H__ */ lwjgl-2.7.1/src/native/common/org_lwjgl_openal_ALC11.c0000644000175000017500000001306511543426510021604 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_openal_ALC.c 2279 2006-02-23 19:22:00Z elias_naur $ * * This is the actual JNI implementation of the OpenAL context/device library. * * @author Brian Matzon * @version $Revision: 2279 $ */ /* OpenAL includes */ #include "extal.h" //alc typedef ALCdevice * (ALCAPIENTRY *alcCaptureOpenDevicePROC)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize ); typedef ALCboolean (ALCAPIENTRY *alcCaptureCloseDevicePROC)( ALCdevice *device ); typedef void (ALCAPIENTRY *alcCaptureStartPROC)( ALCdevice *device ); typedef void (ALCAPIENTRY *alcCaptureStopPROC)( ALCdevice *device ); typedef void (ALCAPIENTRY *alcCaptureSamplesPROC)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples ); static alcCaptureOpenDevicePROC alcCaptureOpenDevice; static alcCaptureCloseDevicePROC alcCaptureCloseDevice; static alcCaptureStartPROC alcCaptureStart; static alcCaptureStopPROC alcCaptureStop; static alcCaptureSamplesPROC alcCaptureSamples; /* * Class: org_lwjgl_openal_ALC11 * Method: nalcCaptureOpenDevice * Signature: (Ljava/lang/String;III)J */ static jlong JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureOpenDevice(JNIEnv *env, jclass clazz, jstring devicename, jint frequency, jint format, jint buffersize) { ALubyte* dev_name = NULL; ALCdevice* device = NULL; if(devicename != NULL) { dev_name = (ALubyte*) GetStringNativeChars(env, devicename); } device = alcCaptureOpenDevice((const char *)dev_name, (unsigned int) frequency, format, buffersize); free(dev_name); return (jlong) ((intptr_t)device); } /* * Class: org_lwjgl_openal_ALC11 * Method: nalcCaptureCloseDevice * Signature: (J)Z */ static jboolean JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureCloseDevice(JNIEnv *env, jclass clazz, jlong device) { return (jboolean) alcCaptureCloseDevice((ALCdevice*) ((intptr_t)device)); } /* * Class: org_lwjgl_openal_ALC11 * Method: nalcCaptureStart * Signature: (J)V */ static void JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureStart(JNIEnv *env, jclass clazz, jlong device) { alcCaptureStart((ALCdevice*) ((intptr_t)device)); } /* * Class: org_lwjgl_openal_ALC11 * Method: nalcCaptureStop * Signature: (J)V */ static void JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureStop(JNIEnv * env, jclass clazz, jlong device) { alcCaptureStop((ALCdevice*) ((intptr_t)device)); } /* * Class: org_lwjgl_openal_ALC11 * Method: nalcCaptureSamples * Signature: (JLjava/nio/ByteBuffer;I)V */ static void JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureSamples(JNIEnv *env, jclass clazz, jlong device, jobject buffer, jint position, jint samples) { ALvoid *buffer_address = ((ALbyte *)(((char*)(*env)->GetDirectBufferAddress(env, buffer)) + position)); alcCaptureSamples((ALCdevice*) ((intptr_t)device), buffer_address, samples); } /** * Loads the context OpenAL functions * * @return true if all methods were loaded, false if one of the methods could not be loaded */ #ifdef __cplusplus extern "C" { #endif JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC11_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nalcCaptureOpenDevice", "(Ljava/lang/String;III)J", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureOpenDevice, "alcCaptureOpenDevice", (void*)&alcCaptureOpenDevice}, {"nalcCaptureCloseDevice", "(J)Z", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureCloseDevice, "alcCaptureCloseDevice", (void*)&alcCaptureCloseDevice}, {"nalcCaptureStart", "(J)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureStart, "alcCaptureStart", (void*)&alcCaptureStart}, {"nalcCaptureStop", "(J)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureStop, "alcCaptureStop", (void*)&alcCaptureStop}, {"nalcCaptureSamples", "(JLjava/nio/ByteBuffer;II)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureSamples, "alcCaptureSamples", (void*)&alcCaptureSamples} }; int num_functions = NUMFUNCTIONS(functions); extal_InitializeClass(env, clazz, num_functions, functions); } #ifdef __cplusplus } #endif lwjgl-2.7.1/src/native/common/awt_tools.h0000644000175000017500000000363211543426510017456 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: awt_tools.h 2985 2008-04-07 18:42:36Z matzon $ * * @author elias_naur * @version $Revision: 2985 $ */ #ifndef __LWJGL_AWT_TOOLS_H #define __LWJGL_AWT_TOOLS_H #include #include typedef struct { JAWT awt; JAWT_DrawingSurface* ds; JAWT_DrawingSurfaceInfo *dsi; } AWTSurfaceLock; #endif lwjgl-2.7.1/src/native/common/extcl_types.h0000644000175000017500000000557511543426510020016 0ustar zero79zero79// -----------------[ Core typedefs ]----------------- typedef struct _cl_platform_id * cl_platform_id; typedef struct _cl_device_id * cl_device_id; typedef struct _cl_context * cl_context; typedef struct _cl_command_queue * cl_command_queue; typedef struct _cl_mem * cl_mem; typedef struct _cl_program * cl_program; typedef struct _cl_kernel * cl_kernel; typedef struct _cl_event * cl_event; typedef struct _cl_sampler * cl_sampler; typedef cl_uint cl_bool; /* WARNING! Unlike cl_ types in cl_platform.h, cl_bool is not guaranteed to be the same size as the bool in kernels. */ typedef cl_ulong cl_bitfield; typedef cl_bitfield cl_device_type; typedef cl_uint cl_platform_info; typedef cl_uint cl_device_info; typedef cl_bitfield cl_device_fp_config; typedef cl_uint cl_device_mem_cache_type; typedef cl_uint cl_device_local_mem_type; typedef cl_bitfield cl_device_exec_capabilities; typedef cl_bitfield cl_command_queue_properties; typedef intptr_t cl_context_properties; typedef cl_uint cl_context_info; typedef cl_uint cl_command_queue_info; typedef cl_uint cl_channel_order; typedef cl_uint cl_channel_type; typedef cl_bitfield cl_mem_flags; typedef cl_uint cl_mem_object_type; typedef cl_uint cl_mem_info; typedef cl_uint cl_image_info; typedef cl_uint cl_buffer_create_type; typedef cl_uint cl_addressing_mode; typedef cl_uint cl_filter_mode; typedef cl_uint cl_sampler_info; typedef cl_bitfield cl_map_flags; typedef cl_uint cl_program_info; typedef cl_uint cl_program_build_info; typedef cl_int cl_build_status; typedef cl_uint cl_kernel_info; typedef cl_uint cl_kernel_work_group_info; typedef cl_uint cl_event_info; typedef cl_uint cl_command_type; typedef cl_uint cl_profiling_info; typedef struct _cl_image_format { cl_channel_order image_channel_order; cl_channel_type image_channel_data_type; } cl_image_format; typedef struct _cl_buffer_region { size_t origin; size_t size; } cl_buffer_region; // cl_gl.h typedef cl_uint cl_gl_platform_info; typedef cl_uint cl_gl_context_info; typedef cl_uint cl_gl_object_type; typedef cl_uint cl_gl_texture_info; // -----------------[ Extension typedefs ]----------------- // EXT_device_fission typedef cl_bitfield cl_device_partition_property_ext; // EXT_migrate_memobject typedef cl_bitfield cl_mem_migration_flags_ext; // -----------------[ Convenience typedefs ]----------------- typedef void cl_void; lwjgl-2.7.1/src/native/common/common_tools.h0000644000175000017500000001224111543426510020147 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: common_tools.h 3412 2010-09-26 23:43:24Z spasi $ * * @author elias_naur * @version $Revision: 3412 $ */ #ifndef _COMMON_TOOLS_H #define _COMMON_TOOLS_H #include #include #include #define ATTRIB_LIST_SIZE (256) typedef struct { int current_index; int attribs[ATTRIB_LIST_SIZE]; } attrib_list_t; #ifndef __cplusplus #ifndef bool typedef enum {false, true} bool; #endif #endif #ifdef _MSC_VER #define inline __inline #include #else #include #endif static inline void * safeGetBufferAddress(JNIEnv *env, jobject buffer) { if (buffer != NULL) { #ifdef __cplusplus return (void *)((char *)env->GetDirectBufferAddress(buffer)); #else return (void *)((char *)(*env)->GetDirectBufferAddress(env, buffer)); #endif } else return NULL; } static inline jobject safeNewBuffer(JNIEnv *env, void *p, int size) { if (p != NULL) { #ifdef __cplusplus return env->NewDirectByteBuffer(p, size); #else return (*env)->NewDirectByteBuffer(env, p, size); #endif } else return NULL; } static inline jobject safeNewBufferCached(JNIEnv *env, void *p, int size, jobject old_buffer) { if (old_buffer != NULL) { void *old_buffer_address = (*env)->GetDirectBufferAddress(env, old_buffer); jlong capacity = (*env)->GetDirectBufferCapacity(env, old_buffer); if (old_buffer_address == p && capacity == size) return old_buffer; } return safeNewBuffer(env, p, size); } static inline void *offsetToPointer(jlong offset) { return (char *)NULL + offset; } typedef void *(* ExtGetProcAddressPROC) (const char *func_name); typedef struct { char *method_name; char *signature; void *method_pointer; char *ext_function_name; void **ext_function_pointer; } JavaMethodAndExtFunction; typedef struct { char *ext_function_name; void **ext_function_pointer; } ExtFunction; #define NUMFUNCTIONS(x) (sizeof(x)/sizeof(JavaMethodAndExtFunction)); #ifdef __cplusplus extern "C" { #endif extern JNIEnv *getThreadEnv(); extern JNIEnv *attachCurrentThread(); extern void detachCurrentThread(); extern void initAttribList(attrib_list_t *list); extern void putAttrib(attrib_list_t *list, int attrib); extern bool isDebugEnabled(void); extern jstring getVersionString(JNIEnv *env); extern void throwGeneralException(JNIEnv * env, const char *exception_name, const char * err); extern void throwFormattedRuntimeException(JNIEnv * env, const char *format, ...); extern void throwException(JNIEnv *env, const char *msg); extern void throwFormattedException(JNIEnv * env, const char *format, ...); extern void throwFMODException(JNIEnv * env, const char * err); extern void setDebugEnabled(bool enable); extern void printfDebugJava(JNIEnv *env, const char *format, ...); extern void printfDebug(const char *format, ...); extern bool getBooleanProperty(JNIEnv *env, const char* propertyName); extern char * GetStringNativeChars(JNIEnv *env, jstring jstr); extern jstring NewStringNativeWithLength(JNIEnv *env, const char *str, int length); extern jstring NewStringNativeUnsigned(JNIEnv *env, const unsigned char *str); extern jobject NewReadOnlyDirectByteBuffer(JNIEnv* env, const void* address, jlong capacity); extern jobject newJavaManagedByteBuffer(JNIEnv *env, const int size); extern bool positionBuffer(JNIEnv *env, jobject buffer, jint position); extern jlong getPointerWrapperAddress(JNIEnv *env, jobject wrapper); extern void ext_InitializeClass(JNIEnv *env, jclass clazz, ExtGetProcAddressPROC gpa, int num_functions, JavaMethodAndExtFunction *functions); extern bool ext_InitializeFunctions(ExtGetProcAddressPROC gpa, int num_functions, ExtFunction *functions); #ifdef __cplusplus } #endif #endif lwjgl-2.7.1/src/native/common/extgl.c0000644000175000017500000000555311543426510016565 0ustar zero79zero79/* ---------------------------------------------------------------------------- Copyright (c) 2001-2002, Lev Povalahev All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The name of the author may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------*/ /* Lev Povalahev levp@gmx.net http://www.uni-karlsruhe.de/~uli2/ */ #include #include #include "extgl.h" #include "common_tools.h" void extgl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions) { ext_InitializeClass(env, clazz, &extgl_GetProcAddress, num_functions, functions); } bool extgl_InitializeFunctions(int num_functions, ExtFunction *functions) { return ext_InitializeFunctions(&extgl_GetProcAddress, num_functions, functions); } bool extgl_QueryExtension(const GLubyte*extensions, const char *name) { const GLubyte *start; GLubyte *where, *terminator; if (extensions == NULL) { printfDebug("NULL extension string\n"); return false; } /* Extension names should not have spaces. */ where = (GLubyte *) strchr(name, ' '); if (where || *name == '\0') return false; /* It takes a bit of care to be fool-proof about parsing the OpenGL extensions string. Don't be fooled by sub-strings, etc. */ start = extensions; for (;;) { where = (GLubyte *) strstr((const char *) start, name); if (!where) break; terminator = where + strlen(name); if (where == start || *(where - 1) == ' ') if (*terminator == ' ' || *terminator == '\0') { return true; } start = terminator; } return false; } lwjgl-2.7.1/src/native/common/org_lwjgl_opengl_CallbackUtil.c0000644000175000017500000001070011543426510023374 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * JNI implementation of the AMD_debug_output function callback. * * @author Spasi */ #include #include "common_tools.h" #include "extgl.h" #include "org_lwjgl_opengl_CallbackUtil.h" static jmethodID debugOutputCallbackARBJ; static jmethodID debugOutputCallbackAMDJ; JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_ncreateGlobalRef(JNIEnv *env, jclass clazz, jobject obj) { return (jlong)(*env)->NewGlobalRef(env, obj); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CallbackUtil_deleteGlobalRef(JNIEnv *env, jclass clazz, jlong globalRef) { (*env)->DeleteGlobalRef(env, (jobject)globalRef); } // ----------------- [ ARB_debug_output ] ----------------- static void APIENTRY debugOutputCallbackARB(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam) { JNIEnv *env = attachCurrentThread(); if ( env != NULL && !(*env)->ExceptionOccurred(env) && debugOutputCallbackARBJ != NULL ) { (*env)->CallVoidMethod(env, (jobject)userParam, debugOutputCallbackARBJ, (jint)source, (jint)type, (jint)id, (jint)severity, NewStringNativeWithLength(env, message, length) ); } detachCurrentThread(); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugOutputCallbackARB(JNIEnv *env, jclass clazz) { // Cache the callback methodID jclass callbackClass; if ( debugOutputCallbackARBJ == NULL ) { callbackClass = (*env)->FindClass(env, "org/lwjgl/opengl/ARBDebugOutputCallback$Handler"); if ( callbackClass != NULL ) debugOutputCallbackARBJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(IIIILjava/lang/String;)V"); } return (jlong)(intptr_t)&debugOutputCallbackARB; } // ----------------- [ AMD_debug_output ] ----------------- static void APIENTRY debugOutputCallbackAMD(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam) { JNIEnv *env = attachCurrentThread(); if ( env != NULL && !(*env)->ExceptionOccurred(env) && debugOutputCallbackAMDJ != NULL ) { (*env)->CallVoidMethod(env, (jobject)userParam, debugOutputCallbackAMDJ, (jint)id, (jint)category, (jint)severity, NewStringNativeWithLength(env, message, length) ); } detachCurrentThread(); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugOutputCallbackAMD(JNIEnv *env, jclass clazz) { // Cache the callback methodID jclass callbackClass; if ( debugOutputCallbackAMDJ == NULL ) { callbackClass = (*env)->FindClass(env, "org/lwjgl/opengl/AMDDebugOutputCallback$Handler"); if ( callbackClass != NULL ) debugOutputCallbackAMDJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(IIILjava/lang/String;)V"); } return (jlong)(intptr_t)&debugOutputCallbackAMD; }lwjgl-2.7.1/src/native/windows/0000755000175000017500000000000011543426510015470 5ustar zero79zero79lwjgl-2.7.1/src/native/windows/org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.c0000644000175000017500000000470411543426510026270 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.c 2985 2008-04-07 18:42:36Z matzon $ * * @author elias_naur * @version $Revision: 2985 $ */ #include #include #include "awt_tools.h" #include "org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.h" #include "context.h" #include "common_tools.h" JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo_nInitHandle (JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject peer_info_handle) { WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); AWTSurfaceLock *surface = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); JAWT_Win32DrawingSurfaceInfo *win32_dsi = (JAWT_Win32DrawingSurfaceInfo *)surface->dsi->platformInfo; peer_info->drawable_hdc = win32_dsi->hdc; peer_info->u.hwnd = win32_dsi->hwnd; } lwjgl-2.7.1/src/native/windows/context.c0000644000175000017500000004656211543426510017335 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: context.c 3377 2010-07-12 12:04:56Z matzon $ * * @author elias_naue * @version $Revision: 3377 $ */ #include #include #include "common_tools.h" #include "extgl.h" #include "extgl_wgl.h" #include "context.h" extern HINSTANCE dll_handle; // Handle to the LWJGL dll #define _CONTEXT_PRIVATE_CLASS_NAME "__lwjgl_context_class_name" /* * Register the LWJGL window class. * Returns true for success, or false for failure */ bool registerWindow(WNDPROC win_proc, LPCTSTR class_name) { WNDCLASS windowClass; memset(&windowClass, 0, sizeof(windowClass)); windowClass.style = CS_OWNDC; windowClass.lpfnWndProc = win_proc; windowClass.cbClsExtra = 0; windowClass.cbWndExtra = 0; windowClass.hInstance = dll_handle; windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); windowClass.hCursor = LoadCursor(NULL, IDC_ARROW); windowClass.hbrBackground = NULL; windowClass.lpszMenuName = NULL; windowClass.lpszClassName = class_name; if (RegisterClass(&windowClass) == 0) { printfDebug("Failed to register window class\n"); return false; } return true; } static LRESULT CALLBACK dummyWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { return DefWindowProc(hwnd, msg, wParam, lParam); } bool applyPixelFormat(JNIEnv *env, HDC hdc, int iPixelFormat) { PIXELFORMATDESCRIPTOR desc; if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { throwFormattedException(env, "DescribePixelFormat failed (%d)", GetLastError()); return false; } // make that the pixel format of the device context if (SetPixelFormat(hdc, iPixelFormat, &desc) == FALSE) { throwFormattedException(env, "SetPixelFormat failed (%d)", GetLastError()); return false; } return true; } /* * Close the window */ void closeWindow(HWND *hwnd, HDC *hdc) { // Release device context if (*hdc != NULL && *hwnd != NULL) { ReleaseDC(*hwnd, *hdc); *hdc = NULL; } // Close the window if (*hwnd != NULL) { ShowWindow(*hwnd, SW_HIDE); DestroyWindow(*hwnd); *hwnd = NULL; } } void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool undecorated, bool child_window) { DWORD exstyle, windowflags; if (undecorated) { exstyle = WS_EX_APPWINDOW; windowflags = WS_POPUP; } else if (child_window) { exstyle = 0; windowflags = WS_CHILDWINDOW; } else { exstyle = WS_EX_APPWINDOW; windowflags = WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU; } windowflags = windowflags | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; *windowflags_return = windowflags; *exstyle_return = exstyle; } HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool undecorated, bool child_window, HWND parent) { RECT clientSize; DWORD exstyle, windowflags; HWND new_hwnd; getWindowFlags(&windowflags, &exstyle, undecorated, child_window); clientSize.bottom = height; clientSize.left = 0; clientSize.right = width; clientSize.top = 0; AdjustWindowRectEx( &clientSize, // client-rectangle structure windowflags, // window styles FALSE, // menu-present option exstyle // extended window style ); // Create the window now, using that class: new_hwnd = CreateWindowEx ( exstyle, window_class_name, "", windowflags, x, y, clientSize.right - clientSize.left, clientSize.bottom - clientSize.top, parent, NULL, dll_handle, NULL); return new_hwnd; } static int convertToBPE(int bpp) { int bpe; switch (bpp) { case 0: bpe = 0; break; case 32: case 24: bpe = 8; break; case 16: /* Fall through */ default: bpe = 4; break; } return bpe; } static int findPixelFormatARBFromBPP(JNIEnv *env, HDC hdc, WGLExtensions *extensions, jobject pixel_format, jobject pixelFormatCaps, int bpp, bool window, bool pbuffer, bool double_buffer) { jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); jboolean floating_point = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); jboolean floating_point_packed = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); jboolean sRGB = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); int pixel_type; int iPixelFormat; unsigned int num_formats_returned; attrib_list_t attrib_list; GLuint *pixelFormatCaps_ptr; jlong pixelFormatCapsSize; BOOL result; jlong i; int bpe = convertToBPE(bpp); if ( floating_point ) pixel_type = WGL_TYPE_RGBA_FLOAT_ARB; else if ( floating_point_packed ) pixel_type = WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT; else pixel_type = WGL_TYPE_RGBA_ARB; initAttribList(&attrib_list); if (window) { putAttrib(&attrib_list, WGL_DRAW_TO_WINDOW_ARB); putAttrib(&attrib_list, TRUE); } if (pbuffer) { putAttrib(&attrib_list, WGL_DRAW_TO_PBUFFER_ARB); putAttrib(&attrib_list, TRUE); } if (!getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL")) { putAttrib(&attrib_list, WGL_ACCELERATION_ARB); putAttrib(&attrib_list, WGL_FULL_ACCELERATION_ARB); } putAttrib(&attrib_list, WGL_PIXEL_TYPE_ARB); putAttrib(&attrib_list, pixel_type); putAttrib(&attrib_list, WGL_DOUBLE_BUFFER_ARB); putAttrib(&attrib_list, double_buffer ? TRUE : FALSE); putAttrib(&attrib_list, WGL_SUPPORT_OPENGL_ARB); putAttrib(&attrib_list, TRUE); putAttrib(&attrib_list, WGL_RED_BITS_ARB); putAttrib(&attrib_list, bpe); putAttrib(&attrib_list, WGL_GREEN_BITS_ARB); putAttrib(&attrib_list, bpe); putAttrib(&attrib_list, WGL_BLUE_BITS_ARB); putAttrib(&attrib_list, bpe); putAttrib(&attrib_list, WGL_ALPHA_BITS_ARB); putAttrib(&attrib_list, alpha); putAttrib(&attrib_list, WGL_DEPTH_BITS_ARB); putAttrib(&attrib_list, depth); putAttrib(&attrib_list, WGL_STENCIL_BITS_ARB); putAttrib(&attrib_list, stencil); // Assume caller checked extension availability if (samples > 0) { putAttrib(&attrib_list, WGL_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); putAttrib(&attrib_list, WGL_SAMPLES_ARB); putAttrib(&attrib_list, samples); // WGL_COVERAGE_SAMPLES_NV if colorSamples > 0 if ( colorSamples > 0 ) { putAttrib(&attrib_list, WGL_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples); } } putAttrib(&attrib_list, WGL_ACCUM_BITS_ARB); putAttrib(&attrib_list, accum_bpp); putAttrib(&attrib_list, WGL_ACCUM_ALPHA_BITS_ARB); putAttrib(&attrib_list, accum_alpha); putAttrib(&attrib_list, WGL_STEREO_ARB); putAttrib(&attrib_list, stereo ? TRUE : FALSE); putAttrib(&attrib_list, WGL_AUX_BUFFERS_ARB); putAttrib(&attrib_list, num_aux_buffers); if (sRGB) { putAttrib(&attrib_list, WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB); putAttrib(&attrib_list, TRUE); } // Assume caller checked extension availability if (pixelFormatCaps != NULL) { pixelFormatCaps_ptr = (GLuint *)(*env)->GetDirectBufferAddress(env, pixelFormatCaps); pixelFormatCapsSize = (*env)->GetDirectBufferCapacity(env, pixelFormatCaps); for (i = 0; i < pixelFormatCapsSize; i++) putAttrib(&attrib_list, pixelFormatCaps_ptr[i]); } putAttrib(&attrib_list, 0); putAttrib(&attrib_list, 0); result = extensions->wglChoosePixelFormatARB(hdc, attrib_list.attribs, NULL, 1, &iPixelFormat, &num_formats_returned); if (result == FALSE || num_formats_returned < 1) { throwFormattedException(env, "Failed to find ARB pixel format %d %d\n", result, num_formats_returned); return -1; } return iPixelFormat; } static int findPixelFormatARB(JNIEnv *env, HDC hdc, WGLExtensions *extensions, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer) { int bpp; int iPixelFormat; int fallback_bpp = 16; jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); if (use_hdc_bpp) { bpp = GetDeviceCaps(hdc, BITSPIXEL); iPixelFormat = findPixelFormatARBFromBPP(env, hdc, extensions, pixel_format, pixelFormatCaps, bpp, window, pbuffer, double_buffer); if ((*env)->ExceptionOccurred(env)) { (*env)->ExceptionClear(env); printfDebugJava(env, "Failed to find ARB pixel format with HDC depth %d, falling back to %d\n", bpp, fallback_bpp); bpp = fallback_bpp; } else return iPixelFormat; } else bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); return findPixelFormatARBFromBPP(env, hdc, extensions, pixel_format, pixelFormatCaps, bpp, window, pbuffer, double_buffer); } /* * Find an appropriate pixel format */ static int findPixelFormatFromBPP(JNIEnv *env, HDC hdc, jobject pixel_format, int bpp, bool double_buffer) { jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); unsigned int flags = PFD_DRAW_TO_WINDOW | // support window PFD_SUPPORT_OPENGL | (double_buffer ? PFD_DOUBLEBUFFER : 0) | (stereo ? PFD_STEREO : 0); PIXELFORMATDESCRIPTOR desc; int iPixelFormat; PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd 1, // version number flags, // RGBA type PFD_TYPE_RGBA, (BYTE)bpp, 0, 0, 0, 0, 0, 0, // color bits ignored (BYTE)alpha, 0, // shift bit ignored accum_bpp + accum_alpha, // no accumulation buffer 0, 0, 0, 0, // accum bits ignored (BYTE)depth, (BYTE)stencil, num_aux_buffers, PFD_MAIN_PLANE, // main layer 0, // reserved 0, 0, 0 // layer masks ignored }; // get the best available match of pixel format for the device context iPixelFormat = ChoosePixelFormat(hdc, &pfd); if (iPixelFormat == 0) { throwException(env, "Failed to choose pixel format"); return -1; } if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { throwException(env, "Could not describe pixel format"); return -1; } if (desc.cColorBits < bpp) { throwException(env, "Insufficient color precision"); return -1; } if (desc.cAlphaBits < alpha) { throwException(env, "Insufficient alpha precision"); return -1; } if (desc.cStencilBits < stencil) { throwException(env, "Insufficient stencil precision"); return -1; } if (desc.cDepthBits < depth) { throwException(env, "Insufficient depth buffer precision"); return -1; } if ((desc.dwFlags & PFD_GENERIC_FORMAT) != 0) { jboolean allowSoftwareOpenGL = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); // secondary check for software override if(!allowSoftwareOpenGL) { throwException(env, "Pixel format not accelerated"); return -1; } } if ((desc.dwFlags & flags) != flags) { throwException(env, "Capabilities not supported"); return -1; } return iPixelFormat; } static int findPixelFormatDefault(JNIEnv *env, HDC hdc, jobject pixel_format, bool use_hdc_bpp, bool double_buffer) { int bpp; int iPixelFormat; int fallback_bpp = 16; jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); if (use_hdc_bpp) { bpp = GetDeviceCaps(hdc, BITSPIXEL); iPixelFormat = findPixelFormatFromBPP(env, hdc, pixel_format, bpp, double_buffer); if ((*env)->ExceptionOccurred(env)) { (*env)->ExceptionClear(env); printfDebugJava(env, "Failed to find pixel format with HDC depth %d, falling back to %d\n", bpp, fallback_bpp); bpp = fallback_bpp; } else return iPixelFormat; } else bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); return findPixelFormatFromBPP(env, hdc, pixel_format, bpp, double_buffer); } static bool validateAndGetExtensions(JNIEnv *env, WGLExtensions *extensions, HDC dummy_hdc, HGLRC dummy_hglrc, int samples, int colorSamples, bool floating_point, bool floating_point_packed, bool sRGB, jobject pixelFormatCaps) { if (!wglMakeCurrent(dummy_hdc, dummy_hglrc)) { throwException(env, "Could not bind context to dummy window"); return false; } extgl_InitWGL(extensions); if (!extensions->WGL_ARB_pixel_format) { throwException(env, "No support for WGL_ARB_pixel_format"); return false; } if (samples > 0 && !extensions->WGL_ARB_multisample) { throwException(env, "No support for WGL_ARB_multisample"); return false; } if (colorSamples > 0 && !extensions->WGL_NV_multisample_coverage) { throwException(env, "No support for WGL_NV_multisample_coverage"); return false; } /* * Apparently, some drivers don't report WGL_ARB_pixel_format_float * even though GL_ARB_color_buffer_float and WGL_ATI_color_format_float * is supported. */ if (floating_point && !(extensions->WGL_ARB_pixel_format_float || extensions->WGL_ATI_pixel_format_float)) { throwException(env, "No support for WGL_ARB_pixel_format_float nor WGL_ATI_pixel_format_float"); return false; } if (floating_point_packed && !(extensions->WGL_EXT_pixel_format_packed_float)) { throwException(env, "No support for WGL_EXT_pixel_format_packed_float"); return false; } if (sRGB && !(extensions->WGL_ARB_framebuffer_sRGB)) { throwException(env, "No support for WGL_ARB_framebuffer_sRGB"); return false; } if (pixelFormatCaps != NULL && !extensions->WGL_ARB_render_texture) { throwException(env, "No support for WGL_ARB_render_texture"); return false; } return true; } int findPixelFormatOnDC(JNIEnv *env, HDC hdc, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer) { HGLRC dummy_hglrc; HDC saved_current_hdc; HGLRC saved_current_hglrc; WGLExtensions extensions; HWND dummy_hwnd; HDC dummy_hdc; int pixel_format_id; jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); bool floating_point_packed = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); bool use_arb_selection = samples > 0 || floating_point || floating_point_packed || sRGB || pbuffer || pixelFormatCaps != NULL; pixel_format_id = findPixelFormatDefault(env, hdc, pixel_format, use_hdc_bpp, double_buffer); if (!(*env)->ExceptionOccurred(env) && use_arb_selection) { dummy_hwnd = createDummyWindow(origin_x, origin_y); if (dummy_hwnd == NULL) { throwException(env, "Could not create dummy window"); return -1; } dummy_hdc = GetDC(dummy_hwnd); if (!applyPixelFormat(env, dummy_hdc, pixel_format_id)) { closeWindow(&dummy_hwnd, &dummy_hdc); return -1; } dummy_hglrc = wglCreateContext(dummy_hdc); if (dummy_hglrc == NULL) { closeWindow(&dummy_hwnd, &dummy_hdc); throwException(env, "Failed to create OpenGL rendering context"); return -1; } // Save the current HDC and HGLRC to avoid disruption saved_current_hdc = wglGetCurrentDC(); saved_current_hglrc = wglGetCurrentContext(); if (validateAndGetExtensions(env, &extensions, dummy_hdc, dummy_hglrc, samples, colorSamples, floating_point, floating_point_packed, sRGB, pixelFormatCaps)) { pixel_format_id = findPixelFormatARB(env, hdc, &extensions, pixel_format, pixelFormatCaps, use_hdc_bpp, window, pbuffer, double_buffer); } wglMakeCurrent(saved_current_hdc, saved_current_hglrc); wglDeleteContext(dummy_hglrc); closeWindow(&dummy_hwnd, &dummy_hdc); } return pixel_format_id; } static bool registerDummyWindow() { static bool window_registered = false; if (!window_registered) { if (!registerWindow(dummyWindowProc, _CONTEXT_PRIVATE_CLASS_NAME)) { return false; } window_registered = true; } return true; } HWND createDummyWindow(int origin_x, int origin_y) { if (!registerDummyWindow()) return NULL; return createWindow(_CONTEXT_PRIVATE_CLASS_NAME, origin_x, origin_y, 1, 1, false, false, NULL); } lwjgl-2.7.1/src/native/windows/Window.h0000644000175000017500000000435111543426510017113 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: Window.h 3227 2009-07-07 19:47:55Z matzon $ * * Include file to access public window features * * @author cix_foo * @version $Revision: 3227 $ */ #ifndef _LWJGL_WINDOW_H_INCLUDED_ #define _LWJGL_WINDOW_H_INCLUDED_ #define WIN32_LEAN_AND_MEAN #ifndef _WIN32_WINDOWS #define _WIN32_WINDOWS 0x0500 #endif #ifndef WINVER #define WINVER 0x0500 #endif #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0400 #endif #include #include #include "common_tools.h" #ifdef _PRIVATE_WINDOW_H_ #define WINDOW_H_API #else #define WINDOW_H_API extern #endif /* _PRIVATE_WINDOW_H_ */ #endif /* _LWJGL_WINDOW_H_INCLUDED_ */ lwjgl-2.7.1/src/native/windows/org_lwjgl_input_Cursor.c0000644000175000017500000001304511543426510022401 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_input_Cursor.c 3263 2010-01-10 22:46:41Z matzon $ * * win32 mouse handling. * * @author elias_naur * @version $Revision: 3263 $ */ #include "Window.h" #include "org_lwjgl_input_Cursor.h" #include "org_lwjgl_opengl_WindowsDisplay.h" #include "common_tools.h" JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateCursor (JNIEnv *env, jclass unused, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset) { unsigned char col0, col1, col2, col3, col4, col5, col6, col7; unsigned char mask; BITMAPINFO bitmapInfo; HBITMAP cursorMask; HCURSOR *cursor_handle; HCURSOR cursor = NULL; ICONINFO iconInfo; char *ptrCursorImage; HBITMAP colorDIB; int *srcPtr; char *dstPtr; int bitWidth; int scanlinePad; int imageSize; // Size in bits unsigned char *maskPixels; int pixelCount = 0; int maskCount = 0; HBITMAP colorBitmap; int x, y; HDC hDC; jobject handle_buffer = newJavaManagedByteBuffer(env, sizeof(HCURSOR)); int *pixels; if (handle_buffer == NULL) { throwException(env, "Could not allocate handle"); return NULL; } pixels = (int *)(*env)->GetDirectBufferAddress(env, image_buffer) + images_offset; memset(&bitmapInfo, 0, sizeof(BITMAPINFO)); bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bitmapInfo.bmiHeader.biWidth = width; bitmapInfo.bmiHeader.biHeight = -height; bitmapInfo.bmiHeader.biPlanes = 1; bitmapInfo.bmiHeader.biBitCount = 24; bitmapInfo.bmiHeader.biCompression = BI_RGB; hDC = GetDC(NULL); colorDIB = CreateDIBSection(hDC, (BITMAPINFO*)&(bitmapInfo), DIB_RGB_COLORS, (void*)&(ptrCursorImage), NULL, 0); srcPtr = pixels; dstPtr = ptrCursorImage; if (!dstPtr) { throwException(env, "Could not allocate DIB section."); ReleaseDC(NULL, hDC); return NULL; } for (y = 0; y < height; y++ ) { for (x = 0; x < width; x++ ) { dstPtr[2] = (*srcPtr >> 0x10) & 0xFF; dstPtr[1] = (*srcPtr >> 0x08) & 0xFF; dstPtr[0] = *srcPtr & 0xFF; srcPtr++; dstPtr += 3; } } colorBitmap = CreateDIBitmap(hDC, (BITMAPINFOHEADER*)&bitmapInfo.bmiHeader, CBM_INIT, (void *)ptrCursorImage, (BITMAPINFO*)&bitmapInfo, DIB_RGB_COLORS); DeleteObject(colorDIB); // Convert alpha map to pixel packed mask bitWidth = width >> 3; scanlinePad = bitWidth & (sizeof(WORD) - 1); imageSize = (bitWidth + scanlinePad)*height; // Size in bits maskPixels = (unsigned char*)malloc(sizeof(unsigned char)*imageSize); memset(maskPixels, 0, imageSize); for (y = 0; y < height; y++) for (x = 0; x < bitWidth; x++) { col0 = (pixels[pixelCount++] & 0x01000000) >> 17; col1 = (pixels[pixelCount++] & 0x01000000) >> 18; col2 = (pixels[pixelCount++] & 0x01000000) >> 19; col3 = (pixels[pixelCount++] & 0x01000000) >> 20; col4 = (pixels[pixelCount++] & 0x01000000) >> 21; col5 = (pixels[pixelCount++] & 0x01000000) >> 22; col6 = (pixels[pixelCount++] & 0x01000000) >> 23; col7 = (pixels[pixelCount++] & 0x01000000) >> 24; mask = col0 | col1 | col2 | col3 | col4 | col5 | col6 | col7; maskPixels[maskCount++] = ~mask; // 1 is tranparant, 0 opaque } cursorMask = CreateBitmap(width, height, 1, 1, maskPixels); memset(&iconInfo, 0, sizeof(ICONINFO)); iconInfo.hbmMask = cursorMask; iconInfo.hbmColor = colorBitmap; iconInfo.fIcon = FALSE; iconInfo.xHotspot = x_hotspot; iconInfo.yHotspot = y_hotspot; cursor = CreateIconIndirect(&iconInfo); DeleteObject(colorBitmap); DeleteObject(cursorMask); free(maskPixels); ReleaseDC(NULL, hDC); cursor_handle = (HCURSOR *)(*env)->GetDirectBufferAddress(env, handle_buffer); *cursor_handle = cursor; return handle_buffer; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_doDestroyCursor (JNIEnv *env, jclass unused, jobject handle_buffer) { HCURSOR *cursor_handle = (HCURSOR *)(*env)->GetDirectBufferAddress(env, handle_buffer); DestroyCursor(*cursor_handle); } lwjgl-2.7.1/src/native/windows/org_lwjgl_opengl_WindowsContextImplementation.c0000644000175000017500000001621611543426510027161 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_WindowsContextImplementation.c 3412 2010-09-26 23:43:24Z spasi $ * * @author elias_naur * @version $Revision: 3412 $ */ #include #include "org_lwjgl_opengl_WindowsContextImplementation.h" #include "context.h" #include "extgl_wgl.h" #include "common_tools.h" typedef struct { HGLRC context; } WindowsContext; JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nCreate (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject attribs, jobject shared_context_handle) { WindowsPeerInfo *peer_info; WindowsContext *shared_context_info; WindowsContext *context_info; HGLRC context; HGLRC shared_context = NULL; // -- We need to create a temporary context to detect the presence of WGL_ARB_create_context HDC saved_current_hdc; HGLRC saved_current_hglrc; WGLExtensions extensions; const int *attribList = attribs == NULL ? NULL : ((const int *)(*env)->GetDirectBufferAddress(env, attribs)); jobject context_handle = newJavaManagedByteBuffer(env, sizeof(WindowsContext)); if (context_handle == NULL) { throwException(env, "Could not create handle buffer"); return NULL; } peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); if (shared_context_handle != NULL) { shared_context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, shared_context_handle); shared_context = shared_context_info->context; } // Create the context context = wglCreateContext(peer_info->drawable_hdc); if (context == NULL) { throwException(env, "Could not create context"); return NULL; } // Save the current HDC and HGLRC to avoid disruption saved_current_hdc = wglGetCurrentDC(); saved_current_hglrc = wglGetCurrentContext(); // Make context current and detect extensions if (!wglMakeCurrent(peer_info->drawable_hdc, context)) { throwException(env, "Could not bind dummy context"); return NULL; } extgl_InitWGL(&extensions); // Restore previous context wglMakeCurrent(saved_current_hdc, saved_current_hglrc); // if ( extensions.WGL_ARB_create_context ) { // We support WGL_ARB_create_context, use the new context creation routine // If we have no context to share and no special attributes, we don't have to recreate the context - wglCreateContext is equivalent to wglCreateContextAttribs(hdc,0,NULL). if ( shared_context != NULL || attribList != NULL ) { // Delete the oldschool context wglDeleteContext(context); // Create a new context using WGL_ARB_create_context context = (HGLRC)extensions.wglCreateContextAttribsARB(peer_info->drawable_hdc, shared_context, attribList); if (context == NULL) { throwException(env, "Could not create context (WGL_ARB_create_context)"); return NULL; } } } else { // We don't support WGL_ARB_create_context, use the old context creation routine if (shared_context != NULL && !wglShareLists(shared_context, context)) { // Use wglShareLists to share context data wglDeleteContext(context); throwException(env, "Could not share contexts"); return NULL; } } context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle); context_info->context = context; return context_handle; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_getHGLRC(JNIEnv *env, jclass clazz, jobject context_handle) { WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle); return (intptr_t)context_info->context; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_getHDC(JNIEnv *env, jclass clazz, jobject peer_info_handle) { WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); return (intptr_t)peer_info->drawable_hdc; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nSwapBuffers (JNIEnv *env, jclass clazz, jobject peer_info_handle) { WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); SwapBuffers(peer_info->drawable_hdc); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nReleaseCurrentContext (JNIEnv *env, jclass clazz) { wglMakeCurrent(NULL, NULL); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nMakeCurrent (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject context_handle) { WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle); WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); if (!wglMakeCurrent(peer_info->drawable_hdc, context_info->context)) throwException(env, "Could not make context current"); } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nIsCurrent (JNIEnv *env, jclass clazz, jobject context_handle) { WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle); return wglGetCurrentContext() == context_info->context; } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nSetSwapInterval (JNIEnv *env, jclass clazz, jint value) { WGLExtensions extensions; extgl_InitWGL(&extensions); if (extensions.WGL_EXT_swap_control) { return extensions.wglSwapIntervalEXT(value) ? JNI_TRUE : JNI_FALSE; } else return JNI_FALSE; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nDestroy (JNIEnv *env, jclass clazz, jobject context_handle) { WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle); wglDeleteContext(context_info->context); } lwjgl-2.7.1/src/native/windows/windows_al.c0000644000175000017500000000474011543426510020007 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include #include #include "extal.h" #include "common_tools.h" /** * $Id: windows_al.c 3412 2010-09-26 23:43:24Z spasi $ * * This file contains the AL extension assigning mechanism * * @author Brian Matzon * @version $Revision: 3412 $ */ /* Handle to OpenAL Library */ static HMODULE handleOAL; void *extal_NativeGetFunctionPointer(const char *function) { return GetProcAddress(handleOAL, function); } void extal_LoadLibrary(JNIEnv *env, jstring path) { char *path_str = GetStringNativeChars(env, path); printfDebugJava(env, "Testing '%s'", path_str); handleOAL = LoadLibrary(path_str); if (handleOAL != NULL) { printfDebugJava(env, "Found OpenAL at '%s'", path_str); } else { throwFormattedException(env, "Could not load OpenAL library (%d)", GetLastError()); } free(path_str); } /** * Unloads the OpenAL Library */ void extal_UnloadLibrary() { FreeLibrary(handleOAL); } lwjgl-2.7.1/src/native/windows/extgl_wgl.h0000644000175000017500000003174111543426510017643 0ustar zero79zero79/* ---------------------------------------------------------------------------- Copyright (c) 2001-2002, Lev Povalahev All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The name of the author may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------*/ /* Lev Povalahev levp@gmx.net http://www.uni-karlsruhe.de/~uli2/ */ #ifndef _EXTGL_WGL_H #define _EXTGL_WGL_H #include #include "extgl.h" #include "common_tools.h" /*-------------------------------------------------------------------*/ /*------------WGL_EXT_EXTENSION_STRING-------------------------------*/ /*-------------------------------------------------------------------*/ typedef const char* (APIENTRY * wglGetExtensionsStringEXTPROC) (); /*-------------------------------------------------------------------*/ /*------------WGL_ARB_EXTENSION_STRING-------------------------------*/ /*-------------------------------------------------------------------*/ typedef const char* (APIENTRY * wglGetExtensionsStringARBPROC) (HDC hdc); /*-------------------------------------------------------------------*/ /*------------WGL_ARB_PBUFFER----------------------------------------*/ /*-------------------------------------------------------------------*/ #define WGL_DRAW_TO_PBUFFER_ARB 0x202D #define WGL_DRAW_TO_PBUFFER_ARB 0x202D #define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E #define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F #define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 #define WGL_PBUFFER_LARGEST_ARB 0x2033 #define WGL_PBUFFER_WIDTH_ARB 0x2034 #define WGL_PBUFFER_HEIGHT_ARB 0x2035 #define WGL_PBUFFER_LOST_ARB 0x2036 DECLARE_HANDLE(HPBUFFERARB); typedef HPBUFFERARB (APIENTRY * wglCreatePbufferARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); typedef HDC (APIENTRY * wglGetPbufferDCARBPROC) (HPBUFFERARB hPbuffer); typedef int (APIENTRY * wglReleasePbufferDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); typedef BOOL (APIENTRY * wglDestroyPbufferARBPROC) (HPBUFFERARB hPbuffer); typedef BOOL (APIENTRY * wglQueryPbufferARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); /*-------------------------------------------------------------------*/ /*------------WGL_ARB_PIXEL_FORMAT-----------------------------------*/ /*-------------------------------------------------------------------*/ #define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 #define WGL_DRAW_TO_WINDOW_ARB 0x2001 #define WGL_DRAW_TO_BITMAP_ARB 0x2002 #define WGL_ACCELERATION_ARB 0x2003 #define WGL_NEED_PALETTE_ARB 0x2004 #define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 #define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 #define WGL_SWAP_METHOD_ARB 0x2007 #define WGL_NUMBER_OVERLAYS_ARB 0x2008 #define WGL_NUMBER_UNDERLAYS_ARB 0x2009 #define WGL_TRANSPARENT_ARB 0x200A #define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 #define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 #define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 #define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A #define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B #define WGL_SHARE_DEPTH_ARB 0x200C #define WGL_SHARE_STENCIL_ARB 0x200D #define WGL_SHARE_ACCUM_ARB 0x200E #define WGL_SUPPORT_GDI_ARB 0x200F #define WGL_SUPPORT_OPENGL_ARB 0x2010 #define WGL_DOUBLE_BUFFER_ARB 0x2011 #define WGL_STEREO_ARB 0x2012 #define WGL_PIXEL_TYPE_ARB 0x2013 #define WGL_COLOR_BITS_ARB 0x2014 #define WGL_RED_BITS_ARB 0x2015 #define WGL_RED_SHIFT_ARB 0x2016 #define WGL_GREEN_BITS_ARB 0x2017 #define WGL_GREEN_SHIFT_ARB 0x2018 #define WGL_BLUE_BITS_ARB 0x2019 #define WGL_BLUE_SHIFT_ARB 0x201A #define WGL_ALPHA_BITS_ARB 0x201B #define WGL_ALPHA_SHIFT_ARB 0x201C #define WGL_ACCUM_BITS_ARB 0x201D #define WGL_ACCUM_RED_BITS_ARB 0x201E #define WGL_ACCUM_GREEN_BITS_ARB 0x201F #define WGL_ACCUM_BLUE_BITS_ARB 0x2020 #define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 #define WGL_DEPTH_BITS_ARB 0x2022 #define WGL_STENCIL_BITS_ARB 0x2023 #define WGL_AUX_BUFFERS_ARB 0x2024 #define WGL_NO_ACCELERATION_ARB 0x2025 #define WGL_GENERIC_ACCELERATION_ARB 0x2026 #define WGL_FULL_ACCELERATION_ARB 0x2027 #define WGL_SWAP_EXCHANGE_ARB 0x2028 #define WGL_SWAP_COPY_ARB 0x2029 #define WGL_SWAP_UNDEFINED_ARB 0x202A #define WGL_TYPE_RGBA_ARB 0x202B #define WGL_TYPE_COLORINDEX_ARB 0x202C typedef BOOL (APIENTRY * wglGetPixelFormatAttribivARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); typedef BOOL (APIENTRY * wglGetPixelFormatAttribfvARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); typedef BOOL (APIENTRY * wglChoosePixelFormatARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); typedef BOOL (APIENTRY * wglBindTexImageARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); typedef BOOL (APIENTRY * wglReleaseTexImageARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); typedef BOOL (APIENTRY * wglSetPbufferAttribARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList); /*-------------------------------------------------------------------*/ /*------------WGL_EXT_SWAP_CONTROL-----------------------------------*/ /*-------------------------------------------------------------------*/ typedef BOOL (APIENTRY * wglSwapIntervalEXTPROC) (int interval); typedef int (APIENTRY * wglGetSwapIntervalEXTPROC) (void); /*-------------------------------------------------------------------*/ /*------------WGL_ARB_MAKE_CURRENT_READ------------------------------*/ /*-------------------------------------------------------------------*/ #define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 #define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 typedef BOOL (APIENTRY * wglMakeContextCurrentARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); typedef HDC (APIENTRY * wglGetCurrentReadDCARBPROC) (void); /*-------------------------------------------------------------------*/ /*------------WGL_ARB_MULTISAMPLE------------------------------------*/ /*-------------------------------------------------------------------*/ #define WGL_SAMPLE_BUFFERS_ARB 0x2041 #define WGL_SAMPLES_ARB 0x2042 /*-------------------------------------------------------------------*/ /*------------WGL_ARB_pixel_format_float ----------------------------*/ /*-------------------------------------------------------------------*/ #define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 /*-------------------------------------------------------------------*/ /*------------WGL_ATI_pixel_format_float ----------------------------*/ /*-------------------------------------------------------------------*/ #define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 /*------------------------------------------------------------------*/ /*------------ WGL_ARB_framebuffer_sRGB ----------------------------*/ /*------------------------------------------------------------------*/ #define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9 /*---------------------------------------------------------------------------*/ /*------------ WGL_EXT_pixel_format_packed_float ----------------------------*/ /*---------------------------------------------------------------------------*/ #define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8 /*----------------------------------------------------------------*/ /*------------ WGL_ARB_create_context ----------------------------*/ /*----------------------------------------------------------------*/ #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 #define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 #define WGL_CONTEXT_FLAGS_ARB 0x2094 #define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 #define ERROR_INVALID_VERSION_ARB 0x2095 typedef HGLRC (APIENTRY * wglCreateContextAttribsARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList); /*---------------------------------------------------------------------*/ /*------------ WGL_NV_multisample_coverage ----------------------------*/ /*---------------------------------------------------------------------*/ #define WGL_COVERAGE_SAMPLES_NV 0x2042 #define WGL_COLOR_SAMPLES_NV 0x20B9 /*---------------------------------------------------------------------*/ typedef struct { bool WGL_ARB_buffer_region; bool WGL_ARB_extensions_string; bool WGL_ARB_make_current_read; bool WGL_ARB_multisample; bool WGL_ARB_pbuffer; bool WGL_ARB_pixel_format; bool WGL_ARB_render_texture; bool WGL_EXT_extensions_string; bool WGL_EXT_swap_control; bool WGL_NV_render_depth_texture; bool WGL_NV_render_texture_rectangle; bool WGL_ARB_pixel_format_float; bool WGL_ATI_pixel_format_float; bool WGL_ARB_framebuffer_sRGB; bool WGL_EXT_pixel_format_packed_float; bool WGL_ARB_create_context; bool WGL_NV_multisample_coverage; wglGetExtensionsStringEXTPROC wglGetExtensionsStringEXT; wglGetExtensionsStringARBPROC wglGetExtensionsStringARB; wglCreatePbufferARBPROC wglCreatePbufferARB; wglGetPbufferDCARBPROC wglGetPbufferDCARB; wglReleasePbufferDCARBPROC wglReleasePbufferDCARB; wglDestroyPbufferARBPROC wglDestroyPbufferARB; wglQueryPbufferARBPROC wglQueryPbufferARB; wglGetPixelFormatAttribivARBPROC wglGetPixelFormatAttribivARB; wglGetPixelFormatAttribfvARBPROC wglGetPixelFormatAttribfvARB; wglChoosePixelFormatARBPROC wglChoosePixelFormatARB; wglBindTexImageARBPROC wglBindTexImageARB; wglReleaseTexImageARBPROC wglReleaseTexImageARB; wglSetPbufferAttribARBPROC wglSetPbufferAttribARB; wglSwapIntervalEXTPROC wglSwapIntervalEXT; wglGetSwapIntervalEXTPROC wglGetSwapIntervalEXT; wglMakeContextCurrentARBPROC wglMakeContextCurrentARB; wglGetCurrentReadDCARBPROC wglGetCurrentReadDCARB; wglCreateContextAttribsARBPROC wglCreateContextAttribsARB; } WGLExtensions; extern void extgl_InitWGL(WGLExtensions *extensions); #endif lwjgl-2.7.1/src/native/windows/org_lwjgl_opengl_Pbuffer.c0000644000175000017500000001765711543426510022657 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_Pbuffer.c 3358 2010-06-03 15:49:26Z spasi $ * * Windows Pbuffer. * * @author elias_naur * @version $Revision: 3358 $ */ #include #include "org_lwjgl_opengl_WindowsDisplay.h" #include "org_lwjgl_opengl_Pbuffer.h" #include "context.h" #include "extgl.h" #include "extgl_wgl.h" #include "common_tools.h" static bool isPbufferSupported(WGLExtensions *extensions) { return extensions->WGL_ARB_pixel_format && extensions->WGL_ARB_pbuffer; } static bool getExtensions(JNIEnv *env, WGLExtensions *extensions, jobject pixel_format, jobject pixelFormatCaps) { int origin_x = 0; int origin_y = 0; HWND dummy_hwnd; HDC dummy_hdc; HGLRC dummy_context; HDC saved_hdc; HGLRC saved_context; int pixel_format_id; dummy_hwnd = createDummyWindow(origin_x, origin_y); if (dummy_hwnd == NULL) { throwException(env, "Could not create dummy window"); return false; } dummy_hdc = GetDC(dummy_hwnd); pixel_format_id = findPixelFormatOnDC(env, dummy_hdc, origin_x, origin_y, pixel_format, pixelFormatCaps, false, true, false, false); if (pixel_format_id == -1) { closeWindow(&dummy_hwnd, &dummy_hdc); return false; } if (!applyPixelFormat(env, dummy_hdc, pixel_format_id)) { closeWindow(&dummy_hwnd, &dummy_hdc); return false; } dummy_context = wglCreateContext(dummy_hdc); if (dummy_context == NULL) { closeWindow(&dummy_hwnd, &dummy_hdc); throwException(env, "Could not create dummy context"); return false; } saved_hdc = wglGetCurrentDC(); saved_context = wglGetCurrentContext(); if (!wglMakeCurrent(dummy_hdc, dummy_context)) { wglMakeCurrent(saved_hdc, saved_context); closeWindow(&dummy_hwnd, &dummy_hdc); wglDeleteContext(dummy_context); throwException(env, "Could not make dummy context current"); return false; } extgl_InitWGL(extensions); if (!wglMakeCurrent(saved_hdc, saved_context)) printfDebugJava(env, "ERROR: Could not restore current context"); closeWindow(&dummy_hwnd, &dummy_hdc); wglDeleteContext(dummy_context); return true; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nGetPbufferCapabilities (JNIEnv *env, jobject self, jobject pixel_format) { int caps = 0; WGLExtensions extensions; if (!getExtensions(env, &extensions, pixel_format, NULL)) return 0; if (isPbufferSupported(&extensions)) caps |= org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED; if (extensions.WGL_ARB_render_texture) caps |= org_lwjgl_opengl_Pbuffer_RENDER_TEXTURE_SUPPORTED; if (extensions.WGL_NV_render_texture_rectangle) caps |= org_lwjgl_opengl_Pbuffer_RENDER_TEXTURE_RECTANGLE_SUPPORTED; if (extensions.WGL_NV_render_depth_texture) caps |= org_lwjgl_opengl_Pbuffer_RENDER_DEPTH_TEXTURE_SUPPORTED; return caps; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nCreate (JNIEnv *env, jobject self, jobject peer_info_handle, jint width, jint height, jobject pixel_format, jobject pixelFormatCaps, jobject pBufferAttribs) { int origin_x = 0; int origin_y = 0; HWND dummy_hwnd; HDC dummy_hdc; HPBUFFERARB Pbuffer; HDC Pbuffer_dc; WGLExtensions extensions; const int *pBufferAttribs_ptr; WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); int pixel_format_id; if ( pBufferAttribs != NULL ) { pBufferAttribs_ptr = (const int *)(*env)->GetDirectBufferAddress(env, pBufferAttribs); } else { pBufferAttribs_ptr = NULL; } if (!getExtensions(env, &extensions, pixel_format, pixelFormatCaps)) return; dummy_hwnd = createDummyWindow(origin_x, origin_y); if (dummy_hwnd == NULL) { throwException(env, "Could not create dummy window"); return; } dummy_hdc = GetDC(dummy_hwnd); pixel_format_id = findPixelFormatOnDC(env, dummy_hdc, origin_x, origin_y, pixel_format, pixelFormatCaps, false, false, true, false); if (pixel_format_id == -1) { closeWindow(&dummy_hwnd, &dummy_hdc); return; } Pbuffer = extensions.wglCreatePbufferARB(dummy_hdc, pixel_format_id, width, height, pBufferAttribs_ptr); closeWindow(&dummy_hwnd, &dummy_hdc); if (Pbuffer == NULL) { throwException(env, "Could not create Pbuffer"); return; } Pbuffer_dc = extensions.wglGetPbufferDCARB(Pbuffer); if (Pbuffer_dc == NULL) { extensions.wglDestroyPbufferARB(Pbuffer); throwException(env, "Could not get Pbuffer DC"); return; } peer_info->u.pbuffer.extensions = extensions; peer_info->u.pbuffer.pbuffer = Pbuffer; peer_info->drawable_hdc = Pbuffer_dc; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nDestroy (JNIEnv *env, jclass clazz, jobject peer_info_handle) { WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); peer_info->u.pbuffer.extensions.wglReleasePbufferDCARB(peer_info->u.pbuffer.pbuffer, peer_info->drawable_hdc); peer_info->u.pbuffer.extensions.wglDestroyPbufferARB(peer_info->u.pbuffer.pbuffer); } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nIsBufferLost (JNIEnv *env, jclass clazz, jobject peer_info_handle) { WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); BOOL buffer_lost; peer_info->u.pbuffer.extensions.wglQueryPbufferARB(peer_info->u.pbuffer.pbuffer, WGL_PBUFFER_LOST_ARB, &buffer_lost); return buffer_lost ? JNI_TRUE : JNI_FALSE; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nSetPbufferAttrib (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint attrib, jint value) { WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); int attribs[3]; attribs[0] = attrib; attribs[1] = value; attribs[2] = 0; peer_info->u.pbuffer.extensions.wglSetPbufferAttribARB(peer_info->u.pbuffer.pbuffer, attribs); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nBindTexImageToPbuffer (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint buffer) { WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); peer_info->u.pbuffer.extensions.wglBindTexImageARB(peer_info->u.pbuffer.pbuffer, buffer); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nReleaseTexImageFromPbuffer (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint buffer) { WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); peer_info->u.pbuffer.extensions.wglReleaseTexImageARB(peer_info->u.pbuffer.pbuffer, buffer); } lwjgl-2.7.1/src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c0000644000175000017500000000627411543426510024341 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_WindowsPeerInfo.c 3358 2010-06-03 15:49:26Z spasi $ * * @author elias_naur * @version $Revision: 3358 $ */ #include #include "org_lwjgl_opengl_WindowsPeerInfo.h" #include "context.h" #include "common_tools.h" JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_createHandle(JNIEnv *env, jclass clazz) { return newJavaManagedByteBuffer(env, sizeof(WindowsPeerInfo)); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nChoosePixelFormat (JNIEnv *env, jclass clazz, jlong hdc_ptr, jint origin_x, jint origin_y, jobject pixel_format, jobject pixel_format_caps, jboolean use_hdc_bpp, jboolean window, jboolean pbuffer, jboolean double_buffer) { HDC hdc = (HDC)(INT_PTR)hdc_ptr; return findPixelFormatOnDC(env, hdc, origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, window, pbuffer, double_buffer); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_setPixelFormat (JNIEnv *env, jclass clazz, jlong hdc_ptr, jint pixel_format) { HDC hdc = (HDC)(INT_PTR)hdc_ptr; applyPixelFormat(env, hdc, pixel_format); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHdc(JNIEnv *env, jclass unused, jobject peer_info_handle) { WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); return (intptr_t)peer_info->drawable_hdc; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHwnd(JNIEnv *env, jclass unused, jobject peer_info_handle) { WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); return (intptr_t)peer_info->u.hwnd; } lwjgl-2.7.1/src/native/windows/org_lwjgl_opengl_Display.c0000644000175000017500000004116011543426510022655 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_Display.c 3302 2010-03-31 23:56:24Z spasi $ * * Base Windows display * * @author cix_foo * @version $Revision: 3302 $ */ #define _PRIVATE_WINDOW_H_ #include #include #include "Window.h" #include "extgl_wgl.h" #include "common_tools.h" #include "display.h" #include "org_lwjgl_opengl_WindowsDisplay.h" #include "org_lwjgl_WindowsSysImplementation.h" #include "context.h" #include #define WINDOWCLASSNAME "LWJGL" /* * WindowProc for the GL window. */ static LRESULT CALLBACK lwjglWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { jclass display_class; jclass display_class_global; jmethodID handleMessage_method; LONG message_time; JNIEnv *env = getThreadEnv(); if (env != NULL && !(*env)->ExceptionOccurred(env)) { /* * We'll cache a global reference to the WindowsDisplay class in the window's user data. * This is not so much to avoid lookup overhead as it is to avoid problems * with AWT. Specifically, awt code can indirectly call this message handler * when it does a SendMessage on the main thread to the currently focused window, * which could be a LWJGL window. The FindClass will then fail because the calling * internal awt class is using the system class loader, not the application loader * where lwjgl is found. * * The very first message sent to this handler is sent when * a window is created, where we are sure that the calling class' classloader has * LWJGL classes in it. */ display_class_global = (jclass)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_USERDATA); if (display_class_global == NULL) { display_class = (*env)->FindClass(env, "org/lwjgl/opengl/WindowsDisplay"); if (display_class != NULL) { display_class_global = (*env)->NewGlobalRef(env, display_class); if (display_class_global != NULL) SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)display_class_global); } } if (display_class_global != NULL) { message_time = GetMessageTime(); handleMessage_method = (*env)->GetStaticMethodID(env, display_class_global, "handleMessage", "(JIJJJ)I"); if (handleMessage_method != NULL) return (*env)->CallStaticIntMethod(env, display_class_global, handleMessage_method, (jlong)(intptr_t)hWnd, (jint)msg, (jlong)wParam, (jlong)lParam, (jlong)message_time); } } return DefWindowProc(hWnd, msg, wParam, lParam); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_defWindowProc(JNIEnv *env, jclass unused, jlong hWnd, jint msg, jlong wParam, jlong lParam) { return DefWindowProc((HWND)(INT_PTR)hWnd, msg, wParam, lParam); } /* * Handle native Windows messages */ static void handleMessages(JNIEnv *env) { /* * Now's our chance to deal with Windows messages that are * otherwise just piling up and causing everything not to * work properly */ MSG msg; while (!(*env)->ExceptionOccurred(env) && PeekMessage( &msg, // message information NULL, // handle to window 0, // first message 0, // last message PM_REMOVE // removal options )) { if (msg.message == WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getDC(JNIEnv *env, jclass unused, jlong hwnd_ptr) { HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; return (INT_PTR)GetDC(hwnd); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetTitle (JNIEnv * env, jclass unused, jlong hwnd_ptr, jstring title_obj) { HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; char * title = GetStringNativeChars(env, title_obj); SetWindowText(hwnd, title); free(title); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nUpdate(JNIEnv * env, jclass class) { handleMessages(env); } JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getAvailableDisplayModes(JNIEnv *env, jobject self) { return getAvailableDisplayModes(env); } JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion (JNIEnv *env, jobject ignored) { return org_lwjgl_WindowsSysImplementation_JNI_VERSION; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateWindow(JNIEnv *env, jclass unused, jint x, jint y, jint width, jint height, jboolean undecorated, jboolean child_window, jlong parent_hwnd) { HWND hwnd; static bool oneShotInitialised = false; if (!oneShotInitialised) { if (!registerWindow(lwjglWindowProc, WINDOWCLASSNAME)) { throwException(env, "Could not register window class"); return 0; } oneShotInitialised = true; } hwnd = createWindow(WINDOWCLASSNAME, x, y, width, height, undecorated, child_window, (HWND)(INT_PTR)parent_hwnd); return (INT_PTR)hwnd; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nReleaseDC(JNIEnv *env, jclass clazz, jlong hwnd_ptr, jlong hdc_ptr) { HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; HDC hdc = (HDC)(INT_PTR)hdc_ptr; ReleaseDC(hwnd, hdc); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nDestroyWindow(JNIEnv *env, jclass clazz, jlong hwnd_ptr) { jclass display_class_global; HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; display_class_global = (jclass)(LONG_PTR)GetWindowLongPtr(hwnd, GWLP_USERDATA); ShowWindow(hwnd, SW_HIDE); DestroyWindow(hwnd); if (display_class_global != NULL) (*env)->DeleteGlobalRef(env, display_class_global); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_clientToScreen(JNIEnv *env, jclass unused, jlong hwnd_int, jobject buffer_handle) { HWND hwnd = (HWND)(INT_PTR)hwnd_int; POINT point; jint *buffer = (jint *)(*env)->GetDirectBufferAddress(env, buffer_handle); jlong size = (*env)->GetDirectBufferCapacity(env, buffer_handle); if (size < 2) { throwFormattedRuntimeException(env, "Buffer size < 2", size); return; } point.x = buffer[0]; point.y = buffer[1]; ClientToScreen(hwnd, &point); buffer[0] = point.x; buffer[1] = point.y; } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getForegroundWindow(JNIEnv *env, jclass unused) { return (INT_PTR)GetForegroundWindow(); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getDesktopWindow(JNIEnv *env, jclass unused) { return (INT_PTR)GetDesktopWindow(); } static void copyBufferToRect(JNIEnv *env, jobject buffer_handle, RECT *rect) { jint *buffer = (jint *)(*env)->GetDirectBufferAddress(env, buffer_handle); jlong size = (*env)->GetDirectBufferCapacity(env, buffer_handle); if (size < 4) { throwFormattedRuntimeException(env, "Buffer size < 4", size); return; } rect->top = buffer[0]; rect->bottom = buffer[1]; rect->left = buffer[2]; rect->right = buffer[3]; } static void copyRectToBuffer(JNIEnv *env, RECT *rect, jobject buffer_handle) { jint *buffer = (jint *)(*env)->GetDirectBufferAddress(env, buffer_handle); jlong size = (*env)->GetDirectBufferCapacity(env, buffer_handle); if (size < 4) { throwFormattedRuntimeException(env, "Buffer size < 4", size); return; } buffer[0] = rect->top; buffer[1] = rect->bottom; buffer[2] = rect->left; buffer[3] = rect->right; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_clipCursor(JNIEnv *env, jclass unused, jobject handle_buffer) { RECT clip_rect; LPRECT clip_rect_ptr; if (handle_buffer != NULL) { copyBufferToRect(env, handle_buffer, &clip_rect); clip_rect_ptr = &clip_rect; } else clip_rect_ptr = NULL; if (ClipCursor(clip_rect_ptr) == 0) throwFormattedException(env, "ClipCursor failed (%d)", GetLastError()); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSwitchDisplayMode(JNIEnv *env, jobject self, jobject mode) { switchDisplayMode(env, mode); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nResetDisplayMode(JNIEnv *env, jobject self) { resetDisplayMode(env); } JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getCurrentDisplayMode(JNIEnv *env, jclass unused) { return getCurrentDisplayMode(env); } JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_convertToNativeRamp(JNIEnv *env, jclass unused, jobject float_ramp) { return convertToNativeRamp(env, float_ramp); } JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getCurrentGammaRamp(JNIEnv *env, jclass unused) { return getCurrentGammaRamp(env); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetGammaRamp(JNIEnv *env, jclass unused, jobject gamma_buffer) { setGammaRamp(env, gamma_buffer); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_showWindow(JNIEnv *env, jclass unused, jlong hwnd_ptr, jint mode) { HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; ShowWindow(hwnd, mode); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setForegroundWindow(JNIEnv *env, jclass unused, jlong hwnd_ptr) { HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; SetForegroundWindow(hwnd); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setFocus(JNIEnv *env, jclass unused, jlong hwnd_ptr) { HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; SetFocus(hwnd); } JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nGetVersion(JNIEnv *env, jobject self, jstring driver) { char *driver_str; jstring result; driver_str = GetStringNativeChars(env, driver); if (driver_str == NULL) return NULL; result = getVersion(env, driver_str); free(driver_str); return result; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nReshape(JNIEnv *env, jclass unused, jlong hwnd_ptr, jint x, jint y, jint width, jint height, jboolean undecorated, jboolean child) { HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; DWORD exstyle, windowflags; RECT clientSize; getWindowFlags(&windowflags, &exstyle, undecorated, child); // If we're not a fullscreen window, adjust the height to account for the // height of the title bar: clientSize.bottom = height; clientSize.left = 0; clientSize.right = width; clientSize.top = 0; AdjustWindowRectEx( &clientSize, // client-rectangle structure windowflags, // window styles FALSE, // menu-present option exstyle // extended window style ); SetWindowPos(hwnd, HWND_TOP, x, y, clientSize.right - clientSize.left, clientSize.bottom - clientSize.top, SWP_NOZORDER); } static HICON createWindowIcon(JNIEnv *env, jint *pixels, jint width, jint height) { unsigned char col; unsigned char mask; BITMAPV5HEADER bitmapInfo; HBITMAP cursorMask; HBITMAP colorBitmap; ICONINFO iconInfo; HICON icon; char *ptrCursorImage; int x, y; char *dstPtr; int imageSize; unsigned char *maskPixels; int widthInBytes; int leftShift; int maskPixelsOff; int scanlineWidth; HBITMAP colorDIB; memset(&bitmapInfo, 0, sizeof(BITMAPV5HEADER)); bitmapInfo.bV5Size = sizeof(BITMAPV5HEADER); bitmapInfo.bV5Width = width; bitmapInfo.bV5Height = -height; bitmapInfo.bV5Planes = 1; bitmapInfo.bV5BitCount = 32; bitmapInfo.bV5Compression = BI_BITFIELDS; bitmapInfo.bV5RedMask = 0x00FF0000; bitmapInfo.bV5GreenMask = 0x0000FF00; bitmapInfo.bV5BlueMask = 0x000000FF; bitmapInfo.bV5AlphaMask = 0xFF000000; colorDIB = CreateDIBSection(GetDC(NULL), (BITMAPINFO*)&(bitmapInfo), DIB_RGB_COLORS, (void*)&(ptrCursorImage), NULL, 0); if (!ptrCursorImage) { throwException(env, "Could not allocate DIB section."); } for (y = 0; y < height; y++ ) { dstPtr = ptrCursorImage + width*4*y;; for (x = 0; x < width; x++ ) { dstPtr[0] = (pixels[y*width+x] >> 0x10) & 0xFF; dstPtr[1] = (pixels[y*width+x] >> 0x08) & 0xFF; dstPtr[2] = pixels[y*width+x] & 0xFF; dstPtr[3] = (pixels[y*width+x] >> 0x18) & 0xFF; dstPtr += 4; } } colorBitmap = CreateDIBitmap(GetDC(NULL), (BITMAPINFOHEADER*)&bitmapInfo, CBM_INIT, (void *)ptrCursorImage, (BITMAPINFO*)&bitmapInfo, DIB_RGB_COLORS); DeleteObject(colorDIB); // Convert alpha map to pixel packed mask // number of bytes it takes to fit a bit packed scan line. widthInBytes = (width & 0x7) != 0 ? (width >> 3) + 1 : (width >> 3); // number of bytes it takes to fit WORD padded scan line. scanlineWidth = widthInBytes; if (scanlineWidth % sizeof(WORD) != 0) { scanlineWidth = (scanlineWidth / sizeof(WORD)) * sizeof(WORD) + sizeof(WORD); } imageSize = scanlineWidth*height; maskPixels = (unsigned char*)malloc(sizeof(unsigned char)*imageSize); memset(maskPixels, 0xFF, sizeof(unsigned char)*imageSize); cursorMask = CreateBitmap(width, height, 1, 1, maskPixels); memset(&iconInfo, 0, sizeof(ICONINFO)); iconInfo.hbmMask = cursorMask; iconInfo.hbmColor = colorBitmap; iconInfo.fIcon = TRUE; iconInfo.xHotspot = 0; iconInfo.yHotspot = 0; icon = CreateIconIndirect(&iconInfo); DeleteObject(colorBitmap); DeleteObject(cursorMask); free(maskPixels); return icon; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_destroyIcon (JNIEnv *env, jclass clazz, jlong handle) { HICON icon = (HICON)(INT_PTR)handle; DestroyIcon(icon); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_createIcon (JNIEnv *env, jclass clazz, jint width, jint height, jobject iconBuffer) { jint *imgData = (jint *)(*env)->GetDirectBufferAddress(env, iconBuffer); return (INT_PTR)createWindowIcon(env, imgData, width, height); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_sendMessage (JNIEnv *env, jclass clazz, jlong hwnd_ptr, jlong msg, jlong wparam, jlong lparam) { HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; return SendMessage(hwnd, (UINT)msg, (WPARAM)wparam, (LPARAM)lparam); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetCursorPosition (JNIEnv * env, jclass unused, jint x, jint y) { if (!SetCursorPos(x, y)) printfDebugJava(env, "SetCursorPos failed"); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getClientRect (JNIEnv *env, jclass unused, jlong hwnd_int, jobject rect_buffer) { HWND hwnd = (HWND)(INT_PTR)hwnd_int; RECT clientRect; GetClientRect(hwnd, &clientRect); copyRectToBuffer(env, &clientRect, rect_buffer); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetNativeCursor (JNIEnv *env, jclass unused, jlong hwnd_int, jobject handle_buffer) { HWND hwnd = (HWND)(INT_PTR)hwnd_int; HCURSOR *cursor_handle; HCURSOR cursor; if (handle_buffer != NULL) { cursor_handle = (HCURSOR *)(*env)->GetDirectBufferAddress(env, handle_buffer); cursor = *cursor_handle; SetClassLongPtr(hwnd, GCLP_HCURSOR, (LONG_PTR)cursor); SetCursor(cursor); } else { SetClassLongPtr(hwnd, GCLP_HCURSOR, (LONG_PTR)NULL); SetCursor(LoadCursor(NULL, IDC_ARROW)); } } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getSystemMetrics(JNIEnv *env, jclass unused, jint index) { return GetSystemMetrics(index); } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetCapture(JNIEnv *env, jclass unused, jlong hwnd_int) { HWND hwnd = (HWND)(INT_PTR)hwnd_int; return (INT_PTR) SetCapture(hwnd); } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nReleaseCapture(JNIEnv *env, jclass unused) { return ReleaseCapture(); } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nTrackMouseEvent(JNIEnv *env, jclass clazz, jlong hwnd_ptr) { HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; TRACKMOUSEEVENT tme; tme.cbSize = sizeof(TRACKMOUSEEVENT); tme.dwFlags = TME_LEAVE; tme.hwndTrack = hwnd; return TrackMouseEvent(&tme); }lwjgl-2.7.1/src/native/windows/display.h0000644000175000017500000000445011543426510017311 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: display.h 2985 2008-04-07 18:42:36Z matzon $ * * Windows specific library for display handling. * * @author cix_foo * @version $Revision: 2985 $ */ #ifndef _DISPLAY_H #define _DISPLAY_H #include extern jobjectArray getAvailableDisplayModes(JNIEnv *env); extern void switchDisplayMode(JNIEnv * env, jobject mode); extern void resetDisplayMode(JNIEnv * env); extern void restoreDisplayMode(void); extern void setGammaRamp(JNIEnv * env, jobject gammaRampBuffer); extern jobject getCurrentGammaRamp(JNIEnv *env); extern jobject getCurrentDisplayMode(JNIEnv * env); extern jobject getVersion(JNIEnv * env, char *driver); extern jobject convertToNativeRamp(JNIEnv *env, jobject float_gamma_obj); #endif lwjgl-2.7.1/src/native/windows/org_lwjgl_Sys.c0000644000175000017500000000760611543426510020471 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_Sys.c 3259 2009-12-02 23:11:14Z matzon $ * * Windows system library. * * @author cix_foo * @version $Revision: 3259 $ */ #include "Window.h" #include "mmsystem.h" #include "org_lwjgl_WindowsSysImplementation.h" #include "common_tools.h" #include #include JNIEXPORT jlong JNICALL Java_org_lwjgl_WindowsSysImplementation_nGetTime(JNIEnv * env, jclass unused) { DWORD time; timeBeginPeriod(1); time = timeGetTime(); timeEndPeriod(1); return time; } JNIEXPORT void JNICALL Java_org_lwjgl_WindowsSysImplementation_nAlert(JNIEnv * env, jclass unused, jlong hwnd_ptr, jstring title, jstring message) { HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; char * eMessageText = GetStringNativeChars(env, message); char * cTitleBarText = GetStringNativeChars(env, title); MessageBox(hwnd, eMessageText, cTitleBarText, MB_OK | MB_TOPMOST); printfDebugJava(env, "*** Alert ***%s\n%s\n", cTitleBarText, eMessageText); free(eMessageText); free(cTitleBarText); } JNIEXPORT void JNICALL Java_org_lwjgl_WindowsSysImplementation_initCommonControls(JNIEnv * env, jclass unused) { InitCommonControls(); } JNIEXPORT jstring JNICALL Java_org_lwjgl_WindowsSysImplementation_nGetClipboard (JNIEnv * env, jclass unused) { // Check to see if there's text available in the clipboard BOOL textAvailable = IsClipboardFormatAvailable(CF_TEXT); BOOL unicodeAvailable = IsClipboardFormatAvailable(CF_UNICODETEXT); void *clipboard_data; jstring ret; HANDLE hglb; const wchar_t * str; if (unicodeAvailable) { if (!OpenClipboard(NULL)) return NULL; hglb = GetClipboardData(CF_UNICODETEXT); if (hglb == NULL) { CloseClipboard(); return NULL; } clipboard_data = GlobalLock(hglb); if (clipboard_data == NULL) { CloseClipboard(); return NULL; } str = (const wchar_t *)clipboard_data; ret = (*env)->NewString(env, str, wcslen(str)); } else if (textAvailable) { if (!OpenClipboard(NULL)) return NULL; hglb = GetClipboardData(CF_TEXT); if (hglb == NULL) { CloseClipboard(); return NULL; } clipboard_data = GlobalLock(hglb); if (clipboard_data == NULL) { CloseClipboard(); return NULL; } ret = NewStringNativeWithLength(env, (const char *) clipboard_data, strlen(clipboard_data)); } else { return NULL; } GlobalUnlock(hglb); CloseClipboard(); return ret; } lwjgl-2.7.1/src/native/windows/extgl_wgl.c0000644000175000017500000002021111543426510017624 0ustar zero79zero79/* ---------------------------------------------------------------------------- Copyright (c) 2001-2002, Lev Povalahev All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The name of the author may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------*/ /* Lev Povalahev levp@gmx.net http://www.uni-karlsruhe.de/~uli2/ */ #include #include #include "extgl_wgl.h" #include "extgl.h" static HMODULE lib_gl_handle = NULL; void *extgl_GetProcAddress(const char *name) { void *t = wglGetProcAddress(name); if (t == NULL) { t = GetProcAddress(lib_gl_handle, name); if (t == NULL) { printfDebug("Could not locate symbol %s\n", name); } } return t; } bool extgl_Open(JNIEnv *env) { if (lib_gl_handle != NULL) return true; // load the dynamic libraries for OpenGL lib_gl_handle = LoadLibrary("opengl32.dll"); if (lib_gl_handle == NULL) { throwException(env, "Could not load OpenGL library"); return false; } return true; } void extgl_Close(void) { FreeLibrary(lib_gl_handle); lib_gl_handle = NULL; } /** returns true if the extension is available */ static bool WGLQueryExtension(WGLExtensions *extensions, const char *name) { const GLubyte *extension_string; if (!extensions->WGL_ARB_extensions_string) if (!extensions->WGL_EXT_extensions_string) return false; else extension_string = (GLubyte*)extensions->wglGetExtensionsStringEXT(); else extension_string = (GLubyte*)extensions->wglGetExtensionsStringARB(wglGetCurrentDC()); return extgl_QueryExtension(extension_string, name); } static void extgl_InitWGLARBPbuffer(WGLExtensions *extensions) { ExtFunction functions[] = { {"wglCreatePbufferARB", (void *)&extensions->wglCreatePbufferARB}, {"wglGetPbufferDCARB", (void *)&extensions->wglGetPbufferDCARB}, {"wglReleasePbufferDCARB", (void *)&extensions->wglReleasePbufferDCARB}, {"wglDestroyPbufferARB", (void *)&extensions->wglDestroyPbufferARB}, {"wglQueryPbufferARB", (void *)&extensions->wglQueryPbufferARB}}; if (extensions->WGL_ARB_pbuffer) extensions->WGL_ARB_pbuffer = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } static void extgl_InitWGLARBPixelFormat(WGLExtensions *extensions) { ExtFunction functions[] = { {"wglGetPixelFormatAttribivARB", (void *)&extensions->wglGetPixelFormatAttribivARB}, {"wglGetPixelFormatAttribfvARB", (void *)&extensions->wglGetPixelFormatAttribfvARB}, {"wglChoosePixelFormatARB", (void *)&extensions->wglChoosePixelFormatARB}}; if (extensions->WGL_ARB_pixel_format) extensions->WGL_ARB_pixel_format = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } static void extgl_InitWGLARBRenderTexture(WGLExtensions *extensions) { ExtFunction functions[] = { {"wglBindTexImageARB", (void *)&extensions->wglBindTexImageARB}, {"wglReleaseTexImageARB", (void *)&extensions->wglReleaseTexImageARB}, {"wglSetPbufferAttribARB", (void *)&extensions->wglSetPbufferAttribARB}}; if (extensions->WGL_ARB_render_texture) extensions->WGL_ARB_render_texture = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } static void extgl_InitWGLEXTSwapControl(WGLExtensions *extensions) { ExtFunction functions[] = { {"wglSwapIntervalEXT", (void *)&extensions->wglSwapIntervalEXT}, {"wglGetSwapIntervalEXT", (void *)&extensions->wglGetSwapIntervalEXT}}; if (extensions->WGL_EXT_swap_control) extensions->WGL_EXT_swap_control = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } static void extgl_InitWGLARBMakeCurrentRead(WGLExtensions *extensions) { ExtFunction functions[] = { {"wglMakeContextCurrentARB", (void *)&extensions->wglMakeContextCurrentARB}, {"wglGetCurrentReadDCARB", (void *)&extensions->wglGetCurrentReadDCARB}}; if (extensions->WGL_ARB_make_current_read) extensions->WGL_ARB_make_current_read = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } static void extgl_InitWGLARBCreateContext(WGLExtensions *extensions) { ExtFunction functions[] = { {"wglCreateContextAttribsARB", (void *)&extensions->wglCreateContextAttribsARB} }; if (extensions->WGL_ARB_create_context) extensions->WGL_ARB_create_context = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } static void extgl_InitSupportedWGLExtensions(WGLExtensions *extensions) { extensions->WGL_ARB_buffer_region = WGLQueryExtension(extensions, "WGL_ARB_buffer_region"); extensions->WGL_ARB_make_current_read = WGLQueryExtension(extensions, "WGL_ARB_make_current_read"); extensions->WGL_ARB_multisample = WGLQueryExtension(extensions, "WGL_ARB_multisample"); extensions->WGL_ARB_pixel_format_float = WGLQueryExtension(extensions, "WGL_ARB_pixel_format_float"); extensions->WGL_ATI_pixel_format_float = WGLQueryExtension(extensions, "WGL_ATI_pixel_format_float"); extensions->WGL_ARB_pbuffer = WGLQueryExtension(extensions, "WGL_ARB_pbuffer"); extensions->WGL_ARB_pixel_format = WGLQueryExtension(extensions, "WGL_ARB_pixel_format"); extensions->WGL_ARB_render_texture = WGLQueryExtension(extensions, "WGL_ARB_render_texture"); extensions->WGL_EXT_swap_control = WGLQueryExtension(extensions, "WGL_EXT_swap_control"); extensions->WGL_NV_render_depth_texture = WGLQueryExtension(extensions, "WGL_NV_render_depth_texture"); extensions->WGL_NV_render_texture_rectangle = WGLQueryExtension(extensions, "WGL_NV_render_texture_rectangle"); extensions->WGL_ARB_framebuffer_sRGB = WGLQueryExtension(extensions, "WGL_ARB_framebuffer_sRGB") || WGLQueryExtension(extensions, "WGL_EXT_framebuffer_sRGB"); extensions->WGL_EXT_pixel_format_packed_float = WGLQueryExtension(extensions, "WGL_EXT_pixel_format_packed_float"); extensions->WGL_ARB_create_context = WGLQueryExtension(extensions, "WGL_ARB_create_context"); extensions->WGL_NV_multisample_coverage = WGLQueryExtension(extensions, "WGL_NV_multisample_coverage"); } static void extgl_InitWGLEXTExtensionsString(WGLExtensions *extensions) { ExtFunction functions[] = { {"wglGetExtensionsStringEXT", (void *)&extensions->wglGetExtensionsStringEXT} }; extensions->WGL_EXT_extensions_string = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } static void extgl_InitWGLARBExtensionsString(WGLExtensions *extensions) { ExtFunction functions[] = { {"wglGetExtensionsStringARB", (void *)&extensions->wglGetExtensionsStringARB} }; extensions->WGL_ARB_extensions_string = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } void extgl_InitWGL(WGLExtensions *extensions) { extgl_InitWGLARBExtensionsString(extensions); extgl_InitWGLEXTExtensionsString(extensions); extgl_InitSupportedWGLExtensions(extensions); extgl_InitWGLARBMakeCurrentRead(extensions); extgl_InitWGLEXTSwapControl(extensions); extgl_InitWGLARBRenderTexture(extensions); extgl_InitWGLARBPixelFormat(extensions); extgl_InitWGLARBPbuffer(extensions); extgl_InitWGLARBCreateContext(extensions); } lwjgl-2.7.1/src/native/windows/org_lwjgl_opengl_WindowsKeyboard.c0000644000175000017500000000667611543426510024400 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_input_Keyboard.c 2385 2006-06-23 16:45:21Z elias_naur $ * * @author elias_naue * @version $Revision: 2385 $ */ #include "Window.h" #include #include "org_lwjgl_opengl_WindowsKeyboard.h" JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_GetKeyState(JNIEnv *env, jclass unused, jint virt_key) { return GetKeyState(virt_key); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_MapVirtualKey(JNIEnv *env, jclass unused, jint uCode, jint uMapType) { return MapVirtualKey(uCode, uMapType); } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_isWindowsNT(JNIEnv *env, jclass unused) { OSVERSIONINFO osvi; osvi.dwOSVersionInfoSize = sizeof(osvi); GetVersionEx(&osvi); return osvi.dwPlatformId == VER_PLATFORM_WIN32_NT ? JNI_TRUE : JNI_FALSE; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_ToUnicode(JNIEnv *env, jclass unused, jint wVirtKey, jint wScanCode, jobject lpKeyState_obj, jobject pwszBuff_obj, jint cchBuff, jint flags) { const PBYTE lpKeyState = (*env)->GetDirectBufferAddress(env, lpKeyState_obj); LPWSTR pwszBuff = (*env)->GetDirectBufferAddress(env, pwszBuff_obj); return ToUnicode(wVirtKey, wScanCode, lpKeyState, pwszBuff, cchBuff, flags); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_ToAscii(JNIEnv *env, jclass unused, jint wVirtKey, jint wScanCode, jobject lpKeyState_obj, jobject lpChar_obj, jint flags) { const PBYTE lpKeyState = (*env)->GetDirectBufferAddress(env, lpKeyState_obj); LPWORD lpChar = (*env)->GetDirectBufferAddress(env, lpChar_obj); return ToAscii(wVirtKey, wScanCode, lpKeyState, lpChar, flags); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_GetKeyboardState(JNIEnv *env, jclass unused, jobject lpKeyState_obj) { PBYTE lpKeyState = (*env)->GetDirectBufferAddress(env, lpKeyState_obj); return GetKeyboardState(lpKeyState); } lwjgl-2.7.1/src/native/windows/display.c0000644000175000017500000002225211543426510017304 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: display.c 2985 2008-04-07 18:42:36Z matzon $ * * Windows specific library for display handling. * * @author cix_foo * @version $Revision: 2985 $ */ #include #include #include "org_lwjgl_opengl_WindowsDisplay.h" #include "display.h" #include "common_tools.h" static jobject createDisplayMode(JNIEnv *env, DEVMODE *devmode) { jclass displayModeClass; jmethodID displayModeConstructor; displayModeClass = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode"); if (displayModeClass == NULL) return NULL; displayModeConstructor = (*env)->GetMethodID(env, displayModeClass, "", "(IIII)V"); if (displayModeConstructor == NULL) return NULL; return (*env)->NewObject(env, displayModeClass, displayModeConstructor, devmode->dmPelsWidth, devmode->dmPelsHeight, devmode->dmBitsPerPel, devmode->dmDisplayFrequency); } /** * Choose displaymodes using extended codepath (multiple displaydevices) */ jobjectArray getAvailableDisplayModes(JNIEnv * env) { int i = 0, j = 0, n = 0; // DISPLAY_DEVICE DisplayDevice; DEVMODE DevMode; jobject *display_mode_objects = NULL; int list_size = 0; jclass displayModeClass; jobjectArray ret; displayModeClass = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode"); ZeroMemory(&DevMode, sizeof(DEVMODE)); // ZeroMemory(&DisplayDevice, sizeof(DISPLAY_DEVICE)); DevMode.dmSize = sizeof(DEVMODE); // DisplayDevice.cb = sizeof(DISPLAY_DEVICE); /* Multi-monitor stuff commented out since we're only really interested in the primary monitor */ /* while(EnumDisplayDevices(NULL, i++, &DisplayDevice, 0) != 0) { // continue if mirroring device if((DisplayDevice.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) != 0) { continue; } j = 0; while(EnumDisplaySettings((const char *) DisplayDevice.DeviceName, j++, &DevMode) != 0) {*/ while(EnumDisplaySettings(NULL, j++, &DevMode) != 0) { // Filter out indexed modes if (DevMode.dmBitsPerPel > 8 && ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN | CDS_TEST) == DISP_CHANGE_SUCCESSFUL) { jobject displayMode; if (list_size <= n) { list_size += 1; display_mode_objects = (jobject *)realloc(display_mode_objects, sizeof(jobject)*list_size); if (display_mode_objects == NULL) return NULL; } displayMode = createDisplayMode(env, &DevMode); display_mode_objects[n++] = displayMode; } } // } printfDebugJava(env, "Found %d displaymodes", n); ret = (*env)->NewObjectArray(env, n, displayModeClass, NULL); for (i = 0; i < n; i++) { (*env)->SetObjectArrayElement(env, ret, i, display_mode_objects[i]); } free(display_mode_objects); return ret; } void switchDisplayMode(JNIEnv * env, jobject mode) { DEVMODE devmode; jclass cls_displayMode = (*env)->GetObjectClass(env, mode); jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I"); jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I"); jfieldID fid_bpp = (*env)->GetFieldID(env, cls_displayMode, "bpp", "I"); jfieldID fid_freq = (*env)->GetFieldID(env, cls_displayMode, "freq", "I"); int width = (*env)->GetIntField(env, mode, fid_width); int height = (*env)->GetIntField(env, mode, fid_height); int bpp = (*env)->GetIntField(env, mode, fid_bpp); int freq = (*env)->GetIntField(env, mode, fid_freq); LONG cdsret; ZeroMemory(&devmode, sizeof(DEVMODE)); devmode.dmSize = sizeof(DEVMODE); devmode.dmBitsPerPel = bpp; devmode.dmPelsWidth = width; devmode.dmPelsHeight = height; devmode.dmDisplayFrequency = freq; devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; if (freq != 0) devmode.dmFields |= DM_DISPLAYFREQUENCY; cdsret = ChangeDisplaySettings(&devmode, CDS_FULLSCREEN); if (cdsret != DISP_CHANGE_SUCCESSFUL) { /* What's the proper way to do this multiply with 2 thing, if at all necessary? */ /* // Failed: so let's check to see if it's a wierd dual screen display printfDebugJava(env, "Failed to set display mode (%ld) ... assuming dual monitors", cdsret); devmode.dmPelsWidth = width * 2; cdsret = ChangeDisplaySettings(&devmode, CDS_FULLSCREEN); if (cdsret != DISP_CHANGE_SUCCESSFUL) { printfDebugJava(env, "Failed to set display mode using dual monitors (%ld)", cdsret);*/ throwFormattedException(env, "Failed to set display mode (%ld).", cdsret); return; // } } } static jobject createNativeGammaBuffer(JNIEnv *env) { return newJavaManagedByteBuffer(env, sizeof(WORD)*3*org_lwjgl_opengl_WindowsDisplay_GAMMA_LENGTH); } jobject getCurrentGammaRamp(JNIEnv *env) { jobject gamma_buffer; WORD *gamma; HDC screenDC; gamma_buffer = createNativeGammaBuffer(env); if (gamma_buffer == NULL) return NULL; gamma = (WORD *)(*env)->GetDirectBufferAddress(env, gamma_buffer); // Get the screen screenDC = GetDC(NULL); if (screenDC == NULL) { throwException(env, "Couldn't get screen DC!"); return NULL; } // Get the default gamma ramp if (GetDeviceGammaRamp(screenDC, gamma) == FALSE) { printfDebugJava(env, "Failed to get initial device gamma"); } ReleaseDC(NULL, screenDC); return gamma_buffer; } void setGammaRamp(JNIEnv * env, jobject gammaRampBuffer) { HDC screenDC; WORD *gammaRamp = (WORD *)(*env)->GetDirectBufferAddress(env, gammaRampBuffer); screenDC = GetDC(NULL); if (SetDeviceGammaRamp(screenDC, gammaRamp) == FALSE) { throwException(env, "Failed to set device gamma."); } ReleaseDC(NULL, screenDC); } jobject convertToNativeRamp(JNIEnv *env, jobject float_gamma_obj) { int i; float scaledRampEntry; WORD rampEntry; const float *gammaRamp = (const float *)(*env)->GetDirectBufferAddress(env, float_gamma_obj); jint gamma_ramp_length = (*env)->GetDirectBufferCapacity(env, float_gamma_obj); jobject native_ramp; WORD *native_ramp_buffer; native_ramp = createNativeGammaBuffer(env); if (native_ramp == NULL) return NULL; native_ramp_buffer = (WORD *)(*env)->GetDirectBufferAddress(env, native_ramp); // Turn array of floats into array of RGB WORDs for (i = 0; i < gamma_ramp_length; i++) { scaledRampEntry = gammaRamp[i]*0xffff; rampEntry = (WORD)scaledRampEntry; native_ramp_buffer[i] = rampEntry; native_ramp_buffer[i + org_lwjgl_opengl_WindowsDisplay_GAMMA_LENGTH] = rampEntry; native_ramp_buffer[i + 2*org_lwjgl_opengl_WindowsDisplay_GAMMA_LENGTH] = rampEntry; } return native_ramp; } jobject getCurrentDisplayMode(JNIEnv * env) { DEVMODE devmode; if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode)) { throwFormattedException(env, "Couldn't get current display settings (%ld)", GetLastError()); return NULL; } return createDisplayMode(env, &devmode); } void resetDisplayMode(JNIEnv * env) { // Under Windows, all we have to do is: ChangeDisplaySettings(NULL, 0); } jobject getVersion(JNIEnv * env, char *driver) { DWORD var = 0; DWORD dwInfoSize; LPVOID lpInfoBuff; BOOL bRetval; jclass version_class; jmethodID version_cons; jobject ret = NULL; version_class = (*env)->FindClass(env, "org/lwjgl/opengl/WindowsFileVersion"); if (version_class == NULL) return NULL; version_cons = (*env)->GetMethodID(env, version_class, "", "(II)V"); if (version_cons == NULL) return NULL; dwInfoSize = GetFileVersionInfoSize(driver, &var); lpInfoBuff = malloc(dwInfoSize); if (lpInfoBuff == NULL) { throwException(env, "Failed to allocate lpInfoBuff"); return NULL; } bRetval = GetFileVersionInfo(driver, 0, dwInfoSize, lpInfoBuff); if (bRetval != 0) { VS_FIXEDFILEINFO * fxdFileInfo; UINT uiLen = 0; bRetval = VerQueryValue(lpInfoBuff, TEXT("\\"), (void *)&fxdFileInfo, &uiLen); if (bRetval != 0) ret = (*env)->NewObject(env, version_class, version_cons, fxdFileInfo->dwProductVersionMS, fxdFileInfo->dwProductVersionLS); } free(lpInfoBuff); return ret; } lwjgl-2.7.1/src/native/windows/windows_cl.c0000644000175000017500000000471011543426510020006 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include #include #include #include "extcl.h" #include "common_tools.h" /** * This file contains the CL extension assigning mechanism * * @author Spasi */ /* Handle to OpenCL Library */ static HMODULE handleOCL; void * extcl_NativeGetFunctionPointer(const char *func_name) { return GetProcAddress(handleOCL, func_name); } void extcl_LoadLibrary(JNIEnv *env, jstring path) { char *path_str = GetStringNativeChars(env, path); printfDebugJava(env, "Testing '%s'", path_str); handleOCL = LoadLibrary(path_str); if (handleOCL != NULL) { printfDebugJava(env, "Found OpenCL at '%s'", path_str); } else { throwFormattedException(env, "Could not load OpenCL library (%d)", GetLastError()); } free(path_str); } /** * Unloads the OpenCL Library */ void extcl_UnloadLibrary() { if ( handleOCL != NULL ) { FreeLibrary(handleOCL); handleOCL = NULL; } }lwjgl-2.7.1/src/native/windows/LWJGL.c0000644000175000017500000000443211543426510016516 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: LWJGL.c 2985 2008-04-07 18:42:36Z matzon $ * * Basic DLL stub. * * @author cix_foo * @version $Revision: 2985 $ */ #define WIN32_LEAN_AND_MEAN #include #include #include #include "org_lwjgl_opengl_WindowsDisplay.h" HINSTANCE dll_handle; /* * DLL entry point for Windows. Called when Java loads the .dll */ BOOL WINAPI DllMain( HINSTANCE hinstDLL, // handle to DLL module DWORD fdwReason, // reason for calling function LPVOID lpvReserved // reserved ) { dll_handle = hinstDLL; return TRUE; // Success } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getDllInstance(JNIEnv *env, jclass unused) { return (LONG_PTR)dll_handle; } lwjgl-2.7.1/src/native/windows/org_lwjgl_opengl_WindowsRegistry.c0000644000175000017500000001072211543426510024433 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_WindowsRegistry.c 2985 2008-04-07 18:42:36Z matzon $ * * @author elias_naur * @version $Revision: 2985 $ */ #include #include #include "org_lwjgl_opengl_WindowsRegistry.h" #include "common_tools.h" /* * Return a string containing the queried value, or NULL of the method fails. * In that case, a java exception is thrown. */ static jstring queryRegistrationKey(JNIEnv *env, HKEY root_key, LPCTSTR subkey, LPCTSTR value) { DWORD buf_size = 1; char *result; HKEY hKey; LONG lRet; jstring java_result; if(RegOpenKeyEx(root_key, TEXT(subkey), 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS) { throwException(env, "Failed to open registry key"); return NULL; } result = (char *)malloc(buf_size); if (result == NULL) { RegCloseKey(hKey); throwException(env, "Failed to allocate buffer"); return NULL; } while (1) { lRet = RegQueryValueEx(hKey, TEXT(value), NULL, NULL, (LPBYTE)result, &buf_size); if (lRet != ERROR_SUCCESS && lRet != ERROR_MORE_DATA) { RegCloseKey(hKey); free(result); throwException(env, "Failed query key value"); return NULL; } if (lRet == ERROR_SUCCESS) { RegCloseKey(hKey); // make sure the result has a terminating null buf_size += 1; result = (char *)realloc(result, buf_size); if (result == NULL) { throwException(env, "Failed to resize buffer"); return NULL; } result[buf_size - 1] = '\0'; java_result = NewStringNativeWithLength(env, result, strlen(result)); free(result); return java_result; } result = (char *)realloc(result, buf_size); if (result == NULL) { RegCloseKey(hKey); throwException(env, "Failed to resize buffer"); return NULL; } } } static HKEY enumToRootKey(jint root_key_enum) { switch (root_key_enum) { case org_lwjgl_opengl_WindowsRegistry_HKEY_CLASSES_ROOT: return HKEY_CLASSES_ROOT; case org_lwjgl_opengl_WindowsRegistry_HKEY_CURRENT_USER: return HKEY_CURRENT_USER; case org_lwjgl_opengl_WindowsRegistry_HKEY_LOCAL_MACHINE: return HKEY_LOCAL_MACHINE; case org_lwjgl_opengl_WindowsRegistry_HKEY_USERS: return HKEY_USERS; default: return 0; } } JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_WindowsRegistry_nQueryRegistrationKey (JNIEnv *env, jclass unused, jint root_key, jstring subkey, jstring value) { HKEY root = enumToRootKey(root_key); char *subkey_native; char *value_native; jstring result; subkey_native = GetStringNativeChars(env, subkey); if (subkey_native == NULL) { throwException(env, "Failed to fetch the native string"); return NULL; } value_native = GetStringNativeChars(env, value); if (value_native == NULL) { free(subkey_native); throwException(env, "Failed to fetch the native string"); return NULL; } result = queryRegistrationKey(env, root, subkey_native, value_native); free(subkey_native); free(value_native); return result; } lwjgl-2.7.1/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.c0000644000175000017500000000441011543426510025655 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_WindowsDisplayPeerInfo.c 3057 2008-04-30 16:01:25Z elias_naur $ * * @author elias_naur * @version $Revision: 3057 $ */ #include #include "Window.h" #include "org_lwjgl_opengl_WindowsDisplayPeerInfo.h" #include "context.h" #include "common_tools.h" JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplayPeerInfo_nInitDC (JNIEnv *env, jclass clazz, jobject peer_info_handle, jlong hwnd_ptr, jlong hdc_ptr) { HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; HDC hdc = (HDC)(INT_PTR)hdc_ptr; WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); peer_info->drawable_hdc = hdc; peer_info->u.hwnd = hwnd; } lwjgl-2.7.1/src/native/windows/context.h0000644000175000017500000000632311543426510017331 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: context.h 3139 2008-10-28 09:53:16Z elias_naur $ * * @author elias_naur * @version $Revision: 3139 $ */ #ifndef __LWJGL_CONTEXT_H #define __LWJGL_CONTEXT_H #include #include #include "common_tools.h" #include "extgl.h" #include "extgl_wgl.h" typedef struct { union { HWND hwnd; struct { HPBUFFERARB pbuffer; // Contains the function pointers that // created the pbuffer WGLExtensions extensions; } pbuffer; } u; HDC drawable_hdc; } WindowsPeerInfo; /* * Register the LWJGL window class. * Returns true for success, or false for failure */ extern bool registerWindow(); extern bool applyPixelFormat(JNIEnv *env, HDC hdc, int iPixelFormat); /* * Close the window */ extern void closeWindow(HWND *hwnd, HDC *hdc); /** * Create a dummy window suitable to create contexts from */ extern HWND createDummyWindow(int x, int y); /** * Return appropriate window and extended style flags from the given fullscreen and undecorated property */ extern void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool undecorated, bool child_window); /* * Create a window with the specified position, size, and * fullscreen attribute. The window will have DirectInput associated * with it. * * Returns true for success, or false for failure */ extern HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool undecorated, bool child_window, HWND parent); extern int findPixelFormatOnDC(JNIEnv *env, HDC hdc, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer); #endif lwjgl-2.7.1/src/templates/0000755000175000017500000000000011523635604014512 5ustar zero79zero79lwjgl-2.7.1/src/templates/org/0000755000175000017500000000000011523635604015301 5ustar zero79zero79lwjgl-2.7.1/src/templates/org/lwjgl/0000755000175000017500000000000011523635612016417 5ustar zero79zero79lwjgl-2.7.1/src/templates/org/lwjgl/opencl/0000755000175000017500000000000011543426510017674 5ustar zero79zero79lwjgl-2.7.1/src/templates/org/lwjgl/opencl/NV_device_attribute_query.java0000644000175000017500000000407011543426510025712 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface NV_device_attribute_query { /** Accepted as the <param_name> parameter of clGetDeviceInfo. */ int CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV = 0x4000, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV = 0x4001, CL_DEVICE_REGISTERS_PER_BLOCK_NV = 0x4002, CL_DEVICE_WARP_SIZE_NV = 0x4003, CL_DEVICE_GPU_OVERLAP_NV = 0x4004, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV = 0x4005, CL_DEVICE_INTEGRATED_MEMORY_NV = 0x4006; }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/KHR_d3d10_sharing.java0000644000175000017500000000331111543426510023567 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLPlatformExtension; @CLPlatformExtension public interface KHR_d3d10_sharing { // Not implemented }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/CL10GL.java0000644000175000017500000002016511543426510021425 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.PointerBuffer; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opencl.cl_int; import org.lwjgl.util.generator.opencl.cl_uint; import org.lwjgl.util.generator.opencl.cl_void; import org.lwjgl.util.generator.opencl.size_t; import java.nio.ByteBuffer; import java.nio.IntBuffer; /** The core OpenCL 1.0 OpenGL interrop functionality. */ public interface CL10GL { /** cl_gl_object_type */ int CL_GL_OBJECT_BUFFER = 0x2000, CL_GL_OBJECT_TEXTURE2D = 0x2001, CL_GL_OBJECT_TEXTURE3D = 0x2002, CL_GL_OBJECT_RENDERBUFFER = 0x2003; /** cl_gl_texture_info */ int CL_GL_TEXTURE_TARGET = 0x2004, CL_GL_MIPMAP_LEVEL = 0x2005; @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_mem", params = "context") CLMem clCreateFromGLBuffer(@PointerWrapper("cl_context") CLContext context, @NativeType("cl_mem_flags") long flags, @NativeType("GLuint") int bufobj, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_mem", params = "context") CLMem clCreateFromGLTexture2D(@PointerWrapper("cl_context") CLContext context, @NativeType("cl_mem_flags") long flags, @NativeType("GLenum") int target, @NativeType("GLint") int miplevel, @NativeType("GLuint") int texture, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_mem", params = "context") CLMem clCreateFromGLTexture3D(@PointerWrapper("cl_context") CLContext context, @NativeType("cl_mem_flags") long flags, @NativeType("GLenum") int target, @NativeType("GLint") int miplevel, @NativeType("GLuint") int texture, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_mem", params = "context") CLMem clCreateFromGLRenderbuffer(@PointerWrapper("cl_context") CLContext context, @NativeType("cl_mem_flags") long flags, @NativeType("GLuint") int renderbuffer, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @cl_int int clGetGLObjectInfo(@PointerWrapper("cl_mem") CLMem memobj, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_gl_object_type") IntBuffer gl_object_type, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("GLuint") IntBuffer gl_object_name); @cl_int int clGetGLTextureInfo(@PointerWrapper("cl_mem") CLMem memobj, @NativeType("cl_gl_texture_info") int param_name, @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); @Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueAcquireGLObjects(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @AutoSize("mem_objects") @cl_uint int num_objects, @Check("1") @Const @NativeType("cl_mem") PointerBuffer mem_objects, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @Alternate("clEnqueueAcquireGLObjects") @Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueAcquireGLObjects(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @Constant("1") @cl_uint int num_objects, @Constant(value = "APIUtil.getBufferPointer().put(0, mem_object).getBuffer(), 0", keepParam = true) CLMem mem_object, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueReleaseGLObjects(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @AutoSize("mem_objects") @cl_uint int num_objects, @Check("1") @Const @NativeType("cl_mem") PointerBuffer mem_objects, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @Alternate("clEnqueueReleaseGLObjects") @Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueReleaseGLObjects(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @Constant("1") @cl_uint int num_objects, @Constant(value = "APIUtil.getBufferPointer().put(0, mem_object).getBuffer(), 0", keepParam = true) CLMem mem_object, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/APPLE_ContextLoggingFunctions.java0000644000175000017500000000547311543426510026315 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opencl.CLDeviceExtension; import org.lwjgl.util.generator.opencl.cl_char; import org.lwjgl.util.generator.opencl.cl_void; import org.lwjgl.util.generator.opencl.size_t; import java.nio.ByteBuffer; @Private @CLDeviceExtension public interface APPLE_ContextLoggingFunctions { @Extern void clLogMessagesToSystemLogAPPLE(@Check @Const @cl_char ByteBuffer errstr, @Const @cl_void ByteBuffer private_info, @AutoSize("private_info") @size_t long cb, @Check @cl_void ByteBuffer user_data); @Extern void clLogMessagesToStdoutAPPLE(@Check @Const @cl_char ByteBuffer errstr, @Const @cl_void ByteBuffer private_info, @AutoSize("private_info") @size_t long cb, @Check @cl_void ByteBuffer user_data); @Extern void clLogMessagesToStderrAPPLE(@Check @Const @cl_char ByteBuffer errstr, @Const @cl_void ByteBuffer private_info, @AutoSize("private_info") @size_t long cb, @Check @cl_void ByteBuffer user_data); }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/APPLE_SetMemObjectDestructor.java0000644000175000017500000000470511543426510026066 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.Code; import org.lwjgl.util.generator.Constant; import org.lwjgl.util.generator.PointerWrapper; import org.lwjgl.util.generator.opencl.CLDeviceExtension; import org.lwjgl.util.generator.opencl.cl_int; @CLDeviceExtension public interface APPLE_SetMemObjectDestructor { @Code( tryBlock = true, // Create a GlobalRef to the callback object. javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);", // Check if we need to delete the GlobalRef. javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);" ) @cl_int int clSetMemObjectDestructorAPPLE(@PointerWrapper("cl_mem") CLMem memobj, @PointerWrapper("cl_mem_object_destructor_callback") CLMemObjectDestructorCallback pfn_notify, @Constant("user_data") @PointerWrapper("void *") long user_data); }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/KHR_icd.java0000644000175000017500000000504511543426510022006 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.PointerBuffer; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opencl.CLPlatformExtension; import org.lwjgl.util.generator.opencl.cl_int; import org.lwjgl.util.generator.opencl.cl_uint; import java.nio.IntBuffer; @CLPlatformExtension @Extension(postfix = "KHR", className = "KHRICD") public interface KHR_icd { /** Accepted as <param_name> to the function clGetPlatformInfo */ int CL_PLATFORM_ICD_SUFFIX_KHR = 0x0920; /** Returned by clGetPlatformIDs when no platforms are found */ int CL_PLATFORM_NOT_FOUND_KHR = -1001; @Optional(reason = "AMD Stream does not expose this (version tested: 2.2)") @cl_int int clIcdGetPlatformIDsKHR(@AutoSize(value = "platforms", canBeNull = true) @cl_uint int num_entries, @OutParameter @Check(canBeNull = true) @NativeType("cl_platform_id") PointerBuffer platforms, @OutParameter @Check(value = "1", canBeNull = true) @cl_uint IntBuffer num_platforms); }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/KHR_global_int32_base_atomics.java0000644000175000017500000000327611543426510026243 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface KHR_global_int32_base_atomics { }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/AMD_fp64.java0000644000175000017500000000325111543426510022000 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface AMD_fp64 { }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/KHR_local_int32_extended_atomics.java0000644000175000017500000000330111543426510026750 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface KHR_local_int32_extended_atomics { }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/NV_pragma_unroll.java0000644000175000017500000000326111543426510024006 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface NV_pragma_unroll { }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java0000644000175000017500000000764111543426510023605 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.PointerBuffer; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opencl.CLDeviceExtension; import org.lwjgl.util.generator.opencl.cl_int; import org.lwjgl.util.generator.opencl.cl_void; import org.lwjgl.util.generator.opencl.size_t; import java.nio.ByteBuffer; @CLDeviceExtension @Extension(postfix = "APPLE", className = "APPLEGLSharing") public interface APPLE_gl_sharing { /** * This enumerated value can be specified as part of the <properties> argument passed to clCreateContext * to allow OpenCL compliant devices in an existing CGL share group to be used as the devices in * the newly created CL context. GL objects that were allocated in the given CGL share group can * now be shared between CL and GL. */ int CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE = 0x10000000; /** * Returns a cl_device_id for the CL device associated with the virtual screen for * the given CGL context. Return type: cl_device_id */ int CL_CGL_DEVICE_FOR_CURRENT_VIRTUAL_SCREEN_APPLE = 0x10000002; /** * Returns an array of cl_device_ids for the CL device(s) corresponding to * the virtual screen(s) for the given CGL context. Return type: cl_device_id[] */ int CL_CGL_DEVICES_FOR_SUPPORTED_VIRTUAL_SCREENS_APPLE = 0x10000003; /** Error code returned by clGetGLContextInfoAPPLE if an invalid platform_gl_ctx is provided */ int CL_INVALID_GL_CONTEXT_APPLE = -1000; @Code( javaBeforeNative = "\t\tif ( param_value_size_ret == null && APIUtil.isDevicesParam(param_name) ) param_value_size_ret = APIUtil.getBufferPointer();", javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS && param_value != null && APIUtil.isDevicesParam(param_name) ) context.getParent().registerCLDevices(param_value, param_value_size_ret);" ) @cl_int int clGetGLContextInfoAPPLE(@PointerWrapper("cl_context") CLContext context, @Check("1") @NativeType("cl_void") PointerBuffer platform_gl_ctx, @NativeType("cl_gl_platform_info") int param_name, @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/AMD_printf.java0000644000175000017500000000325311543426510022525 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface AMD_printf { }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/KHR_fp16.java0000644000175000017500000000335111543426510022021 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface KHR_fp16 { /** cl_device_info */ int CL_DEVICE_HALF_FP_CONFIG = 0x1033; }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/KHR_fp64.java0000644000175000017500000000335311543426510022026 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface KHR_fp64 { /** cl_device_info */ int CL_DEVICE_DOUBLE_FP_CONFIG = 0x1032; }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/KHR_int64_base_atomics.java0000644000175000017500000000326711543426510024730 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface KHR_int64_base_atomics { }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/KHR_gl_sharing.java0000644000175000017500000000664711543426510023375 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.PointerBuffer; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opencl.*; import java.nio.ByteBuffer; @CLPlatformExtension @CLDeviceExtension @Extension(postfix = "KHR", className = "KHRGLSharing") public interface KHR_gl_sharing { /** * Returned by clCreateContext, clCreateContextFromType, and * clGetGLContextInfoKHR when an invalid OpenGL context or share group * object handle is specified in <properties>: */ int CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR = -1000; /** Accepted as the <param_name> argument of clGetGLContextInfoKHR: */ int CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR = 0x2006, CL_DEVICES_FOR_GL_CONTEXT_KHR = 0x2007; /** * Accepted as an attribute name in the 'properties' argument of * clCreateContext and clCreateContextFromType: */ int CL_GL_CONTEXT_KHR = 0x2008, CL_EGL_DISPLAY_KHR = 0x2009, CL_GLX_DISPLAY_KHR = 0x200A, CL_WGL_HDC_KHR = 0x200B, CL_CGL_SHAREGROUP_KHR = 0x200C; @Code( javaBeforeNative = "\t\tif ( param_value_size_ret == null && APIUtil.isDevicesParam(param_name) ) param_value_size_ret = APIUtil.getBufferPointer();", javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS && param_value != null && APIUtil.isDevicesParam(param_name) ) APIUtil.getCLPlatform(properties).registerCLDevices(param_value, param_value_size_ret);" ) @cl_int int clGetGLContextInfoKHR(@NullTerminated @Const @NativeType("cl_context_properties") PointerBuffer properties, @NativeType("cl_gl_context_info") int param_name, @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/EXT_device_fission.java0000644000175000017500000001276111543426510024257 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.PointerBuffer; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opencl.CLDeviceExtension; import org.lwjgl.util.generator.opencl.cl_int; import org.lwjgl.util.generator.opencl.cl_uint; import java.nio.IntBuffer; import java.nio.LongBuffer; @CLDeviceExtension public interface EXT_device_fission { /** * Accepted as a property name in the <properties> parameter of * clCreateSubDeviceEXT: */ int CL_DEVICE_PARTITION_EQUALLY_EXT = 0x4050, CL_DEVICE_PARTITION_BY_COUNTS_EXT = 0x4051, CL_DEVICE_PARTITION_BY_NAMES_EXT = 0x4052, CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT = 0x4053; /** * Accepted as a property name, when accompanying the * CL_DEVICE_PARITION_BY_AFFINITY_DOMAIN_EXT property, in the <properties> * parameter of clCreateSubDeviceEXT: */ int CL_AFFINITY_DOMAIN_L1_CACHE_EXT = 0x1, CL_AFFINITY_DOMAIN_L2_CACHE_EXT = 0x2, CL_AFFINITY_DOMAIN_L3_CACHE_EXT = 0x3, CL_AFFINITY_DOMAIN_L4_CACHE_EXT = 0x4, CL_AFFINITY_DOMAIN_NUMA_EXT = 0x10, CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT = 0x100; /** * Accepted as a property being queried in the <param_name> argument of * clGetDeviceInfo: */ int CL_DEVICE_PARENT_DEVICE_EXT = 0x4054, CL_DEVICE_PARITION_TYPES_EXT = 0x4055, CL_DEVICE_AFFINITY_DOMAINS_EXT = 0x4056, CL_DEVICE_REFERENCE_COUNT_EXT = 0x4057, CL_DEVICE_PARTITION_STYLE_EXT = 0x4058; /** * Accepted as the property list terminator in the <properties> parameter of * clCreateSubDeviceEXT: */ int CL_PROPERTIES_LIST_END_EXT = 0x0; /** * Accepted as the partition counts list terminator in the <properties> * parameter of clCreateSubDeviceEXT: */ int CL_PARTITION_BY_COUNTS_LIST_END_EXT = 0x0; /** * Accepted as the partition names list terminator in the <properties> * parameter of clCreateSubDeviceEXT: */ int CL_PARTITION_BY_NAMES_LIST_END_EXT = -1; /** * Returned by clCreateSubDevicesEXT when the indicated partition scheme is * supported by the implementation, but the implementation can not further * partition the device in this way. */ int CL_DEVICE_PARTITION_FAILED_EXT = -1057; /** * Returned by clCreateSubDevicesEXT when the total number of compute units * requested exceeds CL_DEVICE_MAX_COMPUTE_UNITS, or the number of compute * units for any one sub-device is less than 1. */ int CL_INVALID_PARTITION_COUNT_EXT = -1058; /** * Returned by clCreateSubDevicesEXT when a compute unit name appearing in a * name list following CL_DEVICE_PARTITION_BY_NAMES_EXT is not in range. */ int CL_INVALID_PARTITION_NAME_EXT = -1059; @Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) device.retain();") @cl_int int clRetainDeviceEXT(@PointerWrapper("cl_device_id") CLDevice device); /** * Warning: LWJGL will not automatically release any objects associated with sub-devices. * The user is responsible for tracking and releasing everything prior to calling this method. * * @param device the parent CLDevice * * @return the error code */ @Code( javaBeforeNative = "\t\tAPIUtil.releaseObjects(device);", javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) device.release();" ) @cl_int int clReleaseDeviceEXT(@PointerWrapper("cl_device_id") CLDevice device); @Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS && out_devices != null ) in_device.registerSubCLDevices(out_devices);") @cl_int int clCreateSubDevicesEXT( @PointerWrapper("cl_device_id") CLDevice in_device, // TODO: cl_device_partition_property_ext is a cl_bitfield (ulong), but the spec says properties is a {property-value, cl_int[]} list... @NullTerminated @Const @NativeType("cl_device_partition_property_ext") LongBuffer properties, @AutoSize(value = "out_devices", canBeNull = true) @cl_uint int num_entries, @OutParameter @Check(canBeNull = true) @NativeType("cl_device_id") PointerBuffer out_devices, @OutParameter @Check(value = "1", canBeNull = true) @cl_uint IntBuffer num_devices); }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/AMD_media_ops.java0000644000175000017500000000325611543426510023166 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface AMD_media_ops { }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/KHR_int64_extended_atomics.java0000644000175000017500000000327311543426510025613 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface KHR_int64_extended_atomics { }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/AMD_device_attribute_query.java0000644000175000017500000000361311543426510025772 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface AMD_device_attribute_query { /** * Accepted as the <param_name> parameter of clGetDeviceInfo. Return the * offset in nano-seconds between an event timestamp and Epoch. */ int CL_DEVICE_PROFILING_TIMER_OFFSET_AMD = 0x4036; }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/KHR_local_int32_base_atomics.java0000644000175000017500000000327511543426510026074 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface KHR_local_int32_base_atomics { }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/KHR_gl_event.java0000644000175000017500000000475411543426510023060 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.opengl.GLSync; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opencl.CLDeviceExtension; import org.lwjgl.util.generator.opencl.CLPlatformExtension; import org.lwjgl.util.generator.opencl.cl_int; import java.nio.IntBuffer; @Imports("org.lwjgl.opengl.GLSync") @CLPlatformExtension @CLDeviceExtension @Extension(postfix = "KHR", className = "KHRGLEvent") public interface KHR_gl_event { /** Returned by clGetEventInfo when param_name is CL_EVENT_COMMAND_TYPE: */ int CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR = 0x200D; @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_event", params = "context") CLEvent clCreateEventFromGLsyncKHR(@PointerWrapper("cl_context") CLContext context, @PointerWrapper("cl_GLsync") GLSync sync, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/KHR_byte_addressable_store.java0000644000175000017500000000327311543426510025760 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface KHR_byte_addressable_store { }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/KHR_3d_image_writes.java0000644000175000017500000000326411543426510024315 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface KHR_3d_image_writes { }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/CL11.java0000644000175000017500000002353311543426510021205 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.PointerBuffer; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opencl.*; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; /** The core OpenCL 1.1 API */ public interface CL11 { /** Error Codes */ int CL_MISALIGNED_SUB_BUFFER_OFFSET = -13, CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST = -14, CL_INVALID_PROPERTY = -64; /** OpenCL Version */ int CL_VERSION_1_1 = 1; /** cl_device_info */ int CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF = 0x1034, CL_DEVICE_HOST_UNIFIED_MEMORY = 0x1035, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR = 0x1036, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT = 0x1037, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT = 0x1038, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG = 0x1039, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT = 0x103A, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE = 0x103B, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF = 0x103C, CL_DEVICE_OPENCL_C_VERSION = 0x103D; /** cl_device_fp_config - bitfield */ int CL_FP_SOFT_FLOAT = (1 << 6); /** cl_context_info */ int CL_CONTEXT_NUM_DEVICES = 0x1083; /** cl_channel_order */ int CL_Rx = 0x10BA, CL_RGx = 0x10BB, CL_RGBx = 0x10BC; /** cl_mem_info */ int CL_MEM_ASSOCIATED_MEMOBJECT = 0x1107, CL_MEM_OFFSET = 0x1108; /** cl_addressing_mode */ int CL_ADDRESS_MIRRORED_REPEAT = 0x1134; /** cl_kernel_work_group_info */ int CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE = 0x11B3, CL_KERNEL_PRIVATE_MEM_SIZE = 0x11B4; /** cl_event_info */ int CL_EVENT_CONTEXT = 0x11D4; /** cl_command_type */ int CL_COMMAND_READ_BUFFER_RECT = 0x1201, CL_COMMAND_WRITE_BUFFER_RECT = 0x1202, CL_COMMAND_COPY_BUFFER_RECT = 0x1203, CL_COMMAND_USER = 0x1204; /** cl_buffer_create_type */ int CL_BUFFER_CREATE_TYPE_REGION = 0x1220; @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_mem", factory = "CLMem.create", params = "buffer.getParent()") CLMem clCreateSubBuffer(@PointerWrapper("cl_mem") CLMem buffer, @NativeType("cl_mem_flags") long flags, @NativeType("cl_buffer_create_type") int buffer_create_type, @Const @Check("2 * PointerBuffer.getPointerSize()") @NativeType("cl_void") ByteBuffer buffer_create_info, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Code( tryBlock = true, // Create a GlobalRef to the callback object. javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);", // Check if we need to delete the GlobalRef. javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);" ) @cl_int int clSetMemObjectDestructorCallback(@PointerWrapper("cl_mem") CLMem memobj, @PointerWrapper("cl_mem_object_destructor_callback") CLMemObjectDestructorCallback pfn_notify, @Constant("user_data") @PointerWrapper("void *") long user_data); @Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueReadBufferRect(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem buffer, @cl_bool int blocking_read, @Const @Check("3") @NativeType("size_t") PointerBuffer buffer_origin, @Const @Check("3") @NativeType("size_t") PointerBuffer host_origin, @Const @Check("3") @NativeType("size_t") PointerBuffer region, @size_t long buffer_row_pitch, @size_t long buffer_slice_pitch, @size_t long host_row_pitch, @size_t long host_slice_pitch, @OutParameter @Check("CLChecks.calculateBufferRectSize(host_origin, region, host_row_pitch, host_slice_pitch)") @cl_byte @cl_short @cl_int @cl_long @cl_float @cl_double Buffer ptr, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Const @Check(canBeNull = true) @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueWriteBufferRect(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem buffer, @cl_bool int blocking_write, @Const @Check("3") @NativeType("size_t") PointerBuffer buffer_origin, @Const @Check("3") @NativeType("size_t") PointerBuffer host_origin, @Const @Check("3") @NativeType("size_t") PointerBuffer region, @size_t long buffer_row_pitch, @size_t long buffer_slice_pitch, @size_t long host_row_pitch, @size_t long host_slice_pitch, @Const @Check("CLChecks.calculateBufferRectSize(host_origin, region, host_row_pitch, host_slice_pitch)") @cl_byte @cl_short @cl_int @cl_long @cl_float @cl_double Buffer ptr, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Const @Check(canBeNull = true) @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueCopyBufferRect(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem src_buffer, @PointerWrapper("cl_mem") CLMem dst_buffer, @Const @Check("3") @NativeType("size_t") PointerBuffer src_origin, @Const @Check("3") @NativeType("size_t") PointerBuffer dst_origin, @Const @Check("3") @NativeType("size_t") PointerBuffer region, @size_t long src_row_pitch, @size_t long src_slice_pitch, @size_t long dst_row_pitch, @size_t long dst_slice_pitch, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Const @Check(canBeNull = true) @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_event", params = "context") CLEvent clCreateUserEvent(@PointerWrapper("cl_context") CLContext context, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @cl_int int clSetUserEventStatus(@PointerWrapper("cl_event") CLEvent event, @cl_int int execution_status); @Code( tryBlock = true, // Create a GlobalRef to the callback object. javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);", // Check if we need to delete the GlobalRef. javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);" ) @cl_int int clSetEventCallback(@PointerWrapper("cl_event") CLEvent event, @cl_int int command_exec_callback_type, @PointerWrapper("cl_event_callback") CLEventCallback pfn_notify, @Constant("user_data") @PointerWrapper("void *") long user_data); }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/KHR_global_int32_extended_atomics.java0000644000175000017500000000330211543426510027117 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface KHR_global_int32_extended_atomics { }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/EXT_migrate_memobject.java0000644000175000017500000001003411543426510024732 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.PointerBuffer; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opencl.CLDeviceExtension; import org.lwjgl.util.generator.opencl.cl_bitfield; import org.lwjgl.util.generator.opencl.cl_int; import org.lwjgl.util.generator.opencl.cl_uint; @CLDeviceExtension public interface EXT_migrate_memobject { /** * Besides a value of zero, the following cl_mem_migration_flags_ext values are * allowed: */ int CL_MIGRATE_MEM_OBJECT_HOST_EXT = 0x1; /** * Returned in the <param_value> parameter of the clGetEventInfo when * <param_name> is CL_EVENT_COMMAND_TYPE: */ int CL_COMMAND_MIGRATE_MEM_OBJECT_EXT = 0x4040; @Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueMigrateMemObjectEXT(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @AutoSize("mem_objects") @cl_uint int num_mem_objects, @Check("1") @Const @NativeType("cl_mem") PointerBuffer mem_objects, @cl_bitfield @NativeType("cl_mem_migration_flags_ext") long flags, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @Alternate("clEnqueueMigrateMemObjectEXT") @Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueMigrateMemObjectEXT(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @Constant("1") @cl_uint int num_mem_objects, @Constant(value = "APIUtil.getBufferPointer().put(0, mem_object).getBuffer(), 0", keepParam = true) CLMem mem_object, @cl_bitfield @NativeType("cl_mem_migration_flags_ext") long flags, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/KHR_select_fprounding_mode.java0000644000175000017500000000327311543426510025766 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface KHR_select_fprounding_mode { }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/CL10.java0000644000175000017500000017125111543426510021205 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.PointerBuffer; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opencl.*; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; /** The core OpenCL 1.0 API */ public interface CL10 { /** Error Codes */ int CL_SUCCESS = 0, CL_DEVICE_NOT_FOUND = -1, CL_DEVICE_NOT_AVAILABLE = -2, CL_COMPILER_NOT_AVAILABLE = -3, CL_MEM_OBJECT_ALLOCATION_FAILURE = -4, CL_OUT_OF_RESOURCES = -5, CL_OUT_OF_HOST_MEMORY = -6, CL_PROFILING_INFO_NOT_AVAILABLE = -7, CL_MEM_COPY_OVERLAP = -8, CL_IMAGE_FORMAT_MISMATCH = -9, CL_IMAGE_FORMAT_NOT_SUPPORTED = -10, CL_BUILD_PROGRAM_FAILURE = -11, CL_MAP_FAILURE = -12, CL_INVALID_VALUE = -30, CL_INVALID_DEVICE_TYPE = -31, CL_INVALID_PLATFORM = -32, CL_INVALID_DEVICE = -33, CL_INVALID_CONTEXT = -34, CL_INVALID_QUEUE_PROPERTIES = -35, CL_INVALID_COMMAND_QUEUE = -36, CL_INVALID_HOST_PTR = -37, CL_INVALID_MEM_OBJECT = -38, CL_INVALID_IMAGE_FORMAT_DESCRIPTOR = -39, CL_INVALID_IMAGE_SIZE = -40, CL_INVALID_SAMPLER = -41, CL_INVALID_BINARY = -42, CL_INVALID_BUILD_OPTIONS = -43, CL_INVALID_PROGRAM = -44, CL_INVALID_PROGRAM_EXECUTABLE = -45, CL_INVALID_KERNEL_NAME = -46, CL_INVALID_KERNEL_DEFINITION = -47, CL_INVALID_KERNEL = -48, CL_INVALID_ARG_INDEX = -49, CL_INVALID_ARG_VALUE = -50, CL_INVALID_ARG_SIZE = -51, CL_INVALID_KERNEL_ARGS = -52, CL_INVALID_WORK_DIMENSION = -53, CL_INVALID_WORK_GROUP_SIZE = -54, CL_INVALID_WORK_ITEM_SIZE = -55, CL_INVALID_GLOBAL_OFFSET = -56, CL_INVALID_EVENT_WAIT_LIST = -57, CL_INVALID_EVENT = -58, CL_INVALID_OPERATION = -59, CL_INVALID_GL_OBJECT = -60, CL_INVALID_BUFFER_SIZE = -61, CL_INVALID_MIP_LEVEL = -62, CL_INVALID_GLOBAL_WORK_SIZE = -63; /** OpenCL Version */ int CL_VERSION_1_0 = 1; /** cl_bool */ int CL_FALSE = 0, CL_TRUE = 1; /** cl_platform_info */ int CL_PLATFORM_PROFILE = 0x0900, CL_PLATFORM_VERSION = 0x0901, CL_PLATFORM_NAME = 0x0902, CL_PLATFORM_VENDOR = 0x0903, CL_PLATFORM_EXTENSIONS = 0x0904; /** cl_device_type - bitfield */ int CL_DEVICE_TYPE_DEFAULT = (1 << 0), CL_DEVICE_TYPE_CPU = (1 << 1), CL_DEVICE_TYPE_GPU = (1 << 2), CL_DEVICE_TYPE_ACCELERATOR = (1 << 3), CL_DEVICE_TYPE_ALL = 0xFFFFFFFF; /** cl_device_info */ int CL_DEVICE_TYPE = 0x1000, CL_DEVICE_VENDOR_ID = 0x1001, CL_DEVICE_MAX_COMPUTE_UNITS = 0x1002, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = 0x1003, CL_DEVICE_MAX_WORK_GROUP_SIZE = 0x1004, CL_DEVICE_MAX_WORK_ITEM_SIZES = 0x1005, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR = 0x1006, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT = 0x1007, CL_DEVICE_PREFERRED_VECTOR_WIDTH_ = 0x1008, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG = 0x1009, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT = 0x100A, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE = 0x100B, CL_DEVICE_MAX_CLOCK_FREQUENCY = 0x100C, CL_DEVICE_ADDRESS_BITS = 0x100D, CL_DEVICE_MAX_READ_IMAGE_ARGS = 0x100E, CL_DEVICE_MAX_WRITE_IMAGE_ARGS = 0x100F, CL_DEVICE_MAX_MEM_ALLOC_SIZE = 0x1010, CL_DEVICE_IMAGE2D_MAX_WIDTH = 0x1011, CL_DEVICE_IMAGE2D_MAX_HEIGHT = 0x1012, CL_DEVICE_IMAGE3D_MAX_WIDTH = 0x1013, CL_DEVICE_IMAGE3D_MAX_HEIGHT = 0x1014, CL_DEVICE_IMAGE3D_MAX_DEPTH = 0x1015, CL_DEVICE_IMAGE_SUPPORT = 0x1016, CL_DEVICE_MAX_PARAMETER_SIZE = 0x1017, CL_DEVICE_MAX_SAMPLERS = 0x1018, CL_DEVICE_MEM_BASE_ADDR_ALIGN = 0x1019, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE = 0x101A, CL_DEVICE_SINGLE_FP_CONFIG = 0x101B, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE = 0x101C, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE = 0x101D, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE = 0x101E, CL_DEVICE_GLOBAL_MEM_SIZE = 0x101F, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE = 0x1020, CL_DEVICE_MAX_CONSTANT_ARGS = 0x1021, CL_DEVICE_LOCAL_MEM_TYPE = 0x1022, CL_DEVICE_LOCAL_MEM_SIZE = 0x1023, CL_DEVICE_ERROR_CORRECTION_SUPPORT = 0x1024, CL_DEVICE_PROFILING_TIMER_RESOLUTION = 0x1025, CL_DEVICE_ENDIAN_LITTLE = 0x1026, CL_DEVICE_AVAILABLE = 0x1027, CL_DEVICE_COMPILER_AVAILABLE = 0x1028, CL_DEVICE_EXECUTION_CAPABILITIES = 0x1029, CL_DEVICE_QUEUE_PROPERTIES = 0x102A, CL_DEVICE_NAME = 0x102B, CL_DEVICE_VENDOR = 0x102C, CL_DRIVER_VERSION = 0x102D, CL_DEVICE_PROFILE = 0x102E, CL_DEVICE_VERSION = 0x102F, CL_DEVICE_EXTENSIONS = 0x1030, CL_DEVICE_PLATFORM = 0x1031; /* 0x1032 reserved for CL_DEVICE_DOUBLE_FP_CONFIG */ /* 0x1033 reserved for CL_DEVICE_HALF_FP_CONFIG */ /** cl_device_fp_config - bitfield */ int CL_FP_DENORM = (1 << 0), CL_FP_INF_NAN = (1 << 1), CL_FP_ROUND_TO_NEAREST = (1 << 2), CL_FP_ROUND_TO_ZERO = (1 << 3), CL_FP_ROUND_TO_INF = (1 << 4), CL_FP_FMA = (1 << 5); /** cl_device_mem_cache_type */ int CL_NONE = 0x0, CL_READ_ONLY_CACHE = 0x1, CL_READ_WRITE_CACHE = 0x2; /** cl_device_local_mem_type */ int CL_LOCAL = 0x1, CL_GLOBAL = 0x2; /** cl_device_exec_capabilities - bitfield */ int CL_EXEC_KERNEL = (1 << 0), CL_EXEC_NATIVE_KERNEL = (1 << 1); /** cl_command_queue_properties - bitfield */ int CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE = (1 << 0), CL_QUEUE_PROFILING_ENABLE = (1 << 1); /** cl_context_info */ int CL_CONTEXT_REFERENCE_COUNT = 0x1080, CL_CONTEXT_DEVICES = 0x1081, CL_CONTEXT_PROPERTIES = 0x1082; /** cl_context_info + cl_context_properties */ int CL_CONTEXT_PLATFORM = 0x1084; /** cl_command_queue_info */ int CL_QUEUE_CONTEXT = 0x1090, CL_QUEUE_DEVICE = 0x1091, CL_QUEUE_REFERENCE_COUNT = 0x1092, CL_QUEUE_PROPERTIES = 0x1093; /** cl_mem_flags - bitfield */ int CL_MEM_READ_WRITE = (1 << 0), CL_MEM_WRITE_ONLY = (1 << 1), CL_MEM_READ_ONLY = (1 << 2), CL_MEM_USE_HOST_PTR = (1 << 3), CL_MEM_ALLOC_HOST_PTR = (1 << 4), CL_MEM_COPY_HOST_PTR = (1 << 5); /** cl_channel_order */ int CL_R = 0x10B0, CL_A = 0x10B1, CL_RG = 0x10B2, CL_RA = 0x10B3, CL_RGB = 0x10B4, CL_RGBA = 0x10B5, CL_BGRA = 0x10B6, CL_ARGB = 0x10B7, CL_INTENSITY = 0x10B8, CL_LUMINANCE = 0x10B9; /** cl_channel_type */ int CL_SNORM_INT8 = 0x10D0, CL_SNORM_INT16 = 0x10D1, CL_UNORM_INT8 = 0x10D2, CL_UNORM_INT16 = 0x10D3, CL_UNORM_SHORT_565 = 0x10D4, CL_UNORM_SHORT_555 = 0x10D5, CL_UNORM_INT_101010 = 0x10D6, CL_SIGNED_INT8 = 0x10D7, CL_SIGNED_INT16 = 0x10D8, CL_SIGNED_INT32 = 0x10D9, CL_UNSIGNED_INT8 = 0x10DA, CL_UNSIGNED_INT16 = 0x10DB, CL_UNSIGNED_INT32 = 0x10DC, CL_HALF_FLOAT = 0x10DD, CL_FLOAT = 0x10DE; /** cl_mem_object_type */ int CL_MEM_OBJECT_BUFFER = 0x10F0, CL_MEM_OBJECT_IMAGE2D = 0x10F1, CL_MEM_OBJECT_IMAGE3D = 0x10F2; /** cl_mem_info */ int CL_MEM_TYPE = 0x1100, CL_MEM_FLAGS = 0x1101, CL_MEM_SIZE = 0x1102, CL_MEM_HOST_PTR = 0x1103, CL_MEM_MAP_COUNT = 0x1104, CL_MEM_REFERENCE_COUNT = 0x1105, CL_MEM_CONTEXT = 0x1106; /** cl_image_info */ int CL_IMAGE_FORMAT = 0x1110, CL_IMAGE_ELEMENT_SIZE = 0x1111, CL_IMAGE_ROW_PITCH = 0x1112, CL_IMAGE_SLICE_PITCH = 0x1113, CL_IMAGE_WIDTH = 0x1114, CL_IMAGE_HEIGHT = 0x1115, CL_IMAGE_DEPTH = 0x1116; /** cl_addressing_mode */ int CL_ADDRESS_NONE = 0x1130, CL_ADDRESS_CLAMP_TO_EDGE = 0x1131, CL_ADDRESS_CLAMP = 0x1132, CL_ADDRESS_REPEAT = 0x1133; /** cl_filter_mode */ int CL_FILTER_NEAREST = 0x1140, CL_FILTER_LINEAR = 0x1141; /** cl_sampler_info */ int CL_SAMPLER_REFERENCE_COUNT = 0x1150, CL_SAMPLER_CONTEXT = 0x1151, CL_SAMPLER_NORMALIZED_COORDS = 0x1152, CL_SAMPLER_ADDRESSING_MODE = 0x1153, CL_SAMPLER_FILTER_MODE = 0x1154; /** cl_map_flags - bitfield */ int CL_MAP_READ = (1 << 0), CL_MAP_WRITE = (1 << 1); /** cl_program_info */ int CL_PROGRAM_REFERENCE_COUNT = 0x1160, CL_PROGRAM_CONTEXT = 0x1161, CL_PROGRAM_NUM_DEVICES = 0x1162, CL_PROGRAM_DEVICES = 0x1163, CL_PROGRAM_SOURCE = 0x1164, CL_PROGRAM_BINARY_SIZES = 0x1165, CL_PROGRAM_BINARIES = 0x1166; /** cl_program_build_info */ int CL_PROGRAM_BUILD_STATUS = 0x1181, CL_PROGRAM_BUILD_OPTIONS = 0x1182, CL_PROGRAM_BUILD_LOG = 0x1183; /** cl_build_status */ int CL_BUILD_SUCCESS = 0, CL_BUILD_NONE = -1, CL_BUILD_ERROR = -2, CL_BUILD_IN_PROGRESS = -3; /** cl_kernel_info */ int CL_KERNEL_FUNCTION_NAME = 0x1190, CL_KERNEL_NUM_ARGS = 0x1191, CL_KERNEL_REFERENCE_COUNT = 0x1192, CL_KERNEL_CONTEXT = 0x1193, CL_KERNEL_PROGRAM = 0x1194; /** cl_kernel_work_group_info */ int CL_KERNEL_WORK_GROUP_SIZE = 0x11B0, CL_KERNEL_COMPILE_WORK_GROUP_SIZE = 0x11B1, CL_KERNEL_LOCAL_MEM_SIZE = 0x11B2; /** cl_event_info */ int CL_EVENT_COMMAND_QUEUE = 0x11D0, CL_EVENT_COMMAND_TYPE = 0x11D1, CL_EVENT_REFERENCE_COUNT = 0x11D2, CL_EVENT_COMMAND_EXECUTION_STATUS = 0x11D3; /** cl_command_type */ int CL_COMMAND_NDRANGE_KERNEL = 0x11F0, CL_COMMAND_TASK = 0x11F1, CL_COMMAND_NATIVE_KERNEL = 0x11F2, CL_COMMAND_READ_BUFFER = 0x11F3, CL_COMMAND_WRITE_BUFFER = 0x11F4, CL_COMMAND_COPY_BUFFER = 0x11F5, CL_COMMAND_READ_IMAGE = 0x11F6, CL_COMMAND_WRITE_IMAGE = 0x11F7, CL_COMMAND_COPY_IMAGE = 0x11F8, CL_COMMAND_COPY_IMAGE_TO_BUFFER = 0x11F9, CL_COMMAND_COPY_BUFFER_TO_IMAGE = 0x11FA, CL_COMMAND_MAP_BUFFER = 0x11FB, CL_COMMAND_MAP_IMAGE = 0x11FC, CL_COMMAND_UNMAP_MEM_OBJECT = 0x11FD, CL_COMMAND_MARKER = 0x11FE, CL_COMMAND_ACQUIRE_GL_OBJECTS = 0x11FF, CL_COMMAND_RELEASE_GL_OBJECTS = 0x1200; /** command execution status */ int CL_COMPLETE = 0x0, CL_RUNNING = 0x1, CL_SUBMITTED = 0x2, CL_QUEUED = 0x3; /** cl_profiling_info */ int CL_PROFILING_COMMAND_QUEUED = 0x1280, CL_PROFILING_COMMAND_SUBMIT = 0x1281, CL_PROFILING_COMMAND_START = 0x1282, CL_PROFILING_COMMAND_END = 0x1283; /* Platform API */ @Code( javaBeforeNative = "\t\tif ( num_platforms == null ) num_platforms = APIUtil.getBufferInt();", javaAfterNative = "\t\tif ( __result == CL_SUCCESS && platforms != null ) CLPlatform.registerCLPlatforms(platforms, num_platforms);" ) @cl_int int clGetPlatformIDs(@AutoSize(value = "platforms", canBeNull = true) @cl_uint int num_entries, @OutParameter @Check(canBeNull = true) @NativeType("cl_platform_id") PointerBuffer platforms, @OutParameter @Check(value = "1", canBeNull = true) @cl_uint IntBuffer num_platforms); @cl_int int clGetPlatformInfo(@PointerWrapper(value = "cl_platform_id", canBeNull = true) CLPlatform platform, @NativeType("cl_platform_info") int param_name, @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); @Code( javaBeforeNative = "\t\telse\n" + "\t\t\tnum_devices = APIUtil.getBufferInt();", javaAfterNative = "\t\tif ( __result == CL_SUCCESS && devices != null ) platform.registerCLDevices(devices, num_devices);" ) @cl_int int clGetDeviceIDs(@PointerWrapper("cl_platform_id") CLPlatform platform, @NativeType("cl_device_type") long device_type, @AutoSize(value = "devices", canBeNull = true) @cl_uint int num_entries, @OutParameter @Check(canBeNull = true) @NativeType("cl_device_id") PointerBuffer devices, @OutParameter @Check(value = "1", canBeNull = true) @cl_uint IntBuffer num_devices); @cl_int int clGetDeviceInfo(@PointerWrapper("cl_device_id") CLDevice device, @NativeType("cl_device_info") int param_name, @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); /** LWJGL requires CL_CONTEXT_PLATFORM to be present in the cl_context_properties buffer. */ @Code( tryBlock = true, // Create a GlobalRef to the callback object. javaBeforeNative = "\t\tlong user_data = pfn_notify == null || pfn_notify.isCustom() ? 0 : CallbackUtil.createGlobalRef(pfn_notify);", // Associate context with the GlobalRef, so we can delete it later. javaFinally = "\t\t\tCallbackUtil.registerCallback(__result, user_data);" ) @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_context", params = "APIUtil.getCLPlatform(properties)") CLContext clCreateContext(@NullTerminated @Check("3") @Const @NativeType("cl_context_properties") PointerBuffer properties, @AutoSize("devices") @cl_uint int num_devices, @Check("1") @Const @NativeType("cl_device_id") PointerBuffer devices, @PointerWrapper(value = "cl_create_context_callback", canBeNull = true) CLContextCallback pfn_notify, @Constant("user_data") @PointerWrapper("void *") long user_data, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); /** LWJGL requires CL_CONTEXT_PLATFORM to be present in the cl_context_properties buffer. */ @Alternate("clCreateContext") @Code( tryBlock = true, // Create a GlobalRef to the callback object. javaBeforeNative = "\t\tlong user_data = pfn_notify == null || pfn_notify.isCustom() ? 0 : CallbackUtil.createGlobalRef(pfn_notify);", // Associate context with the GlobalRef, so we can delete it later. javaFinally = "\t\t\tCallbackUtil.registerCallback(__result, user_data);" ) @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_context", params = "APIUtil.getCLPlatform(properties)") CLContext clCreateContext(@NullTerminated @Check("3") @Const @NativeType("cl_context_properties") PointerBuffer properties, @Constant("1") @cl_uint int num_devices, @Constant(value = "APIUtil.getBufferPointer().put(0, device).getBuffer(), 0", keepParam = true) CLDevice device, @PointerWrapper(value = "cl_create_context_callback", canBeNull = true) CLContextCallback pfn_notify, @Constant("user_data") @PointerWrapper("void *") long user_data, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); /** LWJGL requires CL_CONTEXT_PLATFORM to be present in the cl_context_properties buffer. */ @Code( tryBlock = true, // Create a GlobalRef to the callback object. javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);", // Associate context with the GlobalRef, so we can delete it later. javaFinally = "\t\t\tCallbackUtil.registerCallback(__result, user_data);" ) @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_context", params = "APIUtil.getCLPlatform(properties)") CLContext clCreateContextFromType(@NullTerminated @Check("3") @Const @NativeType("cl_context_properties") PointerBuffer properties, @NativeType("cl_device_type") long device_type, @PointerWrapper(value = "cl_create_context_callback", canBeNull = true) CLContextCallback pfn_notify, @Constant("user_data") @PointerWrapper("void *") long user_data, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) context.retain();") @cl_int int clRetainContext(@PointerWrapper("cl_context") CLContext context); @Code( javaBeforeNative = "\t\tAPIUtil.releaseObjects(context);", javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) CallbackUtil.unregisterCallback(context);" ) @cl_int int clReleaseContext(@PointerWrapper("cl_context") CLContext context); @Code( javaBeforeNative = "\t\tif ( param_value_size_ret == null && APIUtil.isDevicesParam(param_name) ) param_value_size_ret = APIUtil.getBufferPointer();", javaAfterNative = "\t\tif ( __result == CL_SUCCESS && param_value != null && APIUtil.isDevicesParam(param_name) ) context.getParent().registerCLDevices(param_value, param_value_size_ret);" ) @cl_int int clGetContextInfo(@PointerWrapper("cl_context") CLContext context, @NativeType("cl_context_info") int param_name, @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_command_queue", params = "context, device") CLCommandQueue clCreateCommandQueue(@PointerWrapper("cl_context") CLContext context, @PointerWrapper("cl_device_id") CLDevice device, @NativeType("cl_command_queue_properties") long properties, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.retain();") @cl_int int clRetainCommandQueue(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue); @Code( javaBeforeNative = "\t\tAPIUtil.releaseObjects(command_queue);", javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.release();" ) @cl_int int clReleaseCommandQueue(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue); @cl_int int clGetCommandQueueInfo(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @NativeType("cl_command_queue_info") int param_name, @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); @GenerateAutos @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_mem", params = "context") CLMem clCreateBuffer(@PointerWrapper("cl_context") CLContext context, @NativeType("cl_mem_flags") long flags, @AutoSize("host_ptr") @size_t long size, @cl_byte @cl_short @cl_int @cl_long @cl_float @cl_double Buffer host_ptr, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueReadBuffer(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem buffer, @cl_bool int blocking_read, @size_t long offset, @AutoSize("ptr") @size_t long cb, @OutParameter @cl_byte @cl_short @cl_int @cl_long @cl_float @cl_double Buffer ptr, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueWriteBuffer(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem buffer, @cl_bool int blocking_write, @size_t long offset, @AutoSize("ptr") @size_t long cb, @Const @cl_byte @cl_short @cl_int @cl_long @cl_float @cl_double Buffer ptr, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueCopyBuffer(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem src_buffer, @PointerWrapper("cl_mem") CLMem dst_buffer, @size_t long src_offset, @size_t long dst_offset, @size_t long cb, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @Code(javaAfterNative = "\t\tif ( __result != null ) command_queue.registerCLEvent(event);") @Check(value = "errcode_ret", canBeNull = true) @cl_void @AutoSize("cb") ByteBuffer clEnqueueMapBuffer(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem buffer, @cl_bool int blocking_map, @NativeType("cl_map_flags") long map_flags, @size_t long offset, @size_t long cb, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_mem", params = "context") CLMem clCreateImage2D(@PointerWrapper("cl_context") CLContext context, @NativeType("cl_mem_flags") long flags, @Check("2 * 4") @Const @NativeType("cl_image_format") ByteBuffer image_format, @size_t long image_width, @size_t long image_height, @size_t long image_row_pitch, @Check(value = "CLChecks.calculateImage2DSize(image_format, image_width, image_height, image_row_pitch)", canBeNull = true) @cl_byte @cl_short @cl_int @cl_float Buffer host_ptr, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_mem", params = "context") CLMem clCreateImage3D(@PointerWrapper("cl_context") CLContext context, @NativeType("cl_mem_flags") long flags, @Check("2 * 4") @Const @NativeType("cl_image_format") ByteBuffer image_format, @size_t long image_width, @size_t long image_height, @size_t long image_depth, @size_t long image_row_pitch, @size_t long image_slice_pitch, @Check(value = "CLChecks.calculateImage3DSize(image_format, image_width, image_height, image_height, image_row_pitch, image_slice_pitch)", canBeNull = true) @cl_byte @cl_short @cl_int @cl_float Buffer host_ptr, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @cl_int int clGetSupportedImageFormats(@PointerWrapper("cl_context") CLContext context, @NativeType("cl_mem_flags") long flags, @NativeType("cl_mem_object_type") int image_type, @AutoSize(value = "image_formats", expression = " / (2 * 4)", canBeNull = true) @cl_uint int num_entries, @OutParameter @Check(canBeNull = true) @NativeType("cl_image_format") ByteBuffer image_formats, @OutParameter @Check(value = "1", canBeNull = true) @cl_uint IntBuffer num_image_formats); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueReadImage(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem image, @cl_bool int blocking_read, @Check("3") @Const @NativeType("size_t") PointerBuffer origin, @Check("3") @Const @NativeType("size_t") PointerBuffer region, @size_t long row_pitch, @size_t long slice_pitch, @OutParameter @Check("CLChecks.calculateImageSize(region, row_pitch, slice_pitch)") @cl_byte @cl_short @cl_int @cl_float Buffer ptr, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueWriteImage(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem image, @cl_bool int blocking_write, @Check("3") @Const @NativeType("size_t") PointerBuffer origin, @Check("3") @Const @NativeType("size_t") PointerBuffer region, @size_t long input_row_pitch, @size_t long input_slice_pitch, @Check("CLChecks.calculateImageSize(region, input_row_pitch, input_slice_pitch)") @Const @cl_byte @cl_short @cl_int @cl_float Buffer ptr, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueCopyImage(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem src_image, @PointerWrapper("cl_mem") CLMem dst_image, @Check("3") @Const @NativeType("size_t") PointerBuffer src_origin, @Check("3") @Const @NativeType("size_t") PointerBuffer dst_origin, @Check("3") @Const @NativeType("size_t") PointerBuffer region, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueCopyImageToBuffer(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem src_image, @PointerWrapper("cl_mem") CLMem dst_buffer, @Check("3") @Const @NativeType("size_t") PointerBuffer src_origin, @Check("3") @Const @NativeType("size_t") PointerBuffer region, @size_t long dst_offset, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueCopyBufferToImage(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem src_buffer, @PointerWrapper("cl_mem") CLMem dst_image, @size_t long src_offset, @Check("3") @Const @NativeType("size_t") PointerBuffer dst_origin, @Check("3") @Const @NativeType("size_t") PointerBuffer region, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @Code(javaAfterNative = "\t\tif ( __result != null ) command_queue.registerCLEvent(event);") @Check(value = "errcode_ret", canBeNull = true) @cl_void @AutoSize(value = "extcl_CalculateImageSize(region_address, *image_row_pitch_address, image_slice_pitch == NULL ? 0 : *image_slice_pitch_address)", isNative = true) ByteBuffer clEnqueueMapImage(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem image, @cl_bool int blocking_map, @NativeType("cl_map_flags") long map_flags, @Check("3") @Const @NativeType("size_t") PointerBuffer origin, @Check("3") @Const @NativeType("size_t") PointerBuffer region, @OutParameter @Check("1") @NativeType("size_t") PointerBuffer image_row_pitch, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer image_slice_pitch, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @cl_int int clGetImageInfo(@PointerWrapper("cl_mem") CLMem image, @NativeType("cl_image_info") int param_name, @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) memobj.retain();") @cl_int int clRetainMemObject(@PointerWrapper("cl_mem") CLMem memobj); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) memobj.release();") @cl_int int clReleaseMemObject(@PointerWrapper("cl_mem") CLMem memobj); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueUnmapMemObject(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem memobj, @Check @cl_void ByteBuffer mapped_ptr, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @cl_int int clGetMemObjectInfo(@PointerWrapper("cl_mem") CLMem memobj, @NativeType("cl_mem_info") int param_name, @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_sampler", params = "context") CLSampler clCreateSampler(@PointerWrapper("cl_context") CLContext context, @cl_bool int normalized_coords, @NativeType("cl_addressing_mode") int addressing_mode, @NativeType("cl_filter_mode") int filter_mode, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) sampler.retain();") @cl_int int clRetainSampler(@PointerWrapper("cl_sampler") CLSampler sampler); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) sampler.release();") @cl_int int clReleaseSampler(@PointerWrapper("cl_sampler") CLSampler sampler); @cl_int int clGetSamplerInfo(@PointerWrapper("cl_sampler") CLSampler sampler, @NativeType("cl_sampler_info") int param_name, @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); // ------[ clCreateProgramWithSource ]------ @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_program", params = "context") CLProgram clCreateProgramWithSource(@PointerWrapper("cl_context") CLContext context, @Constant("1") @cl_uint int count, @Check @Indirect @Const @cl_char ByteBuffer string, @AutoSize("string") @Indirect @Const @size_t long lengths, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Alternate(value = "clCreateProgramWithSource", nativeAlt = true) @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_program", params = "context") CLProgram clCreateProgramWithSource2(@PointerWrapper("cl_context") CLContext context, @AutoSize("lengths") @cl_uint int count, @Check("APIUtil.getSize(lengths)") @PointerArray(value = "count", lengths = "lengths") @Const @NativeType("cl_char") ByteBuffer strings, @Check("1") @Const @NativeType("size_t") PointerBuffer lengths, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Alternate(value = "clCreateProgramWithSource", nativeAlt = true) @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_program", params = "context") CLProgram clCreateProgramWithSource3(@PointerWrapper("cl_context") CLContext context, @Constant("strings.length") @cl_uint int count, @Check("1") @PointerArray(value = "count") @Const @NativeType("cl_char") ByteBuffer[] strings, @Constant("APIUtil.getLengths(strings).getBuffer(), 0") @Const @NativeType("size_t") PointerBuffer lengths, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Alternate("clCreateProgramWithSource") @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_program", params = "context") CLProgram clCreateProgramWithSource(@PointerWrapper("cl_context") CLContext context, @Constant("1") @cl_uint int count, CharSequence string, @Constant("string.length()") @Indirect @Const @size_t long lengths, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Alternate(value = "clCreateProgramWithSource", nativeAlt = true) @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_program", params = "context") CLProgram clCreateProgramWithSource4(@PointerWrapper("cl_context") CLContext context, @Constant("strings.length") @cl_uint int count, @Const @PointerArray(value = "count", lengths = "lengths") CharSequence[] strings, @Constant("APIUtil.getLengths(strings).getBuffer(), 0") @Const @NativeType("size_t") PointerBuffer lengths, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); // ------[ clCreateProgramWithBinary ]------ @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_program", params = "context") CLProgram clCreateProgramWithBinary(@PointerWrapper("cl_context") CLContext context, @Constant("1") @cl_uint int num_devices, @Const @Indirect @PointerWrapper("cl_device_id") CLDevice device, @AutoSize("binary") @Const @Indirect @size_t long lengths, @Const @Indirect @cl_uchar ByteBuffer binary, @OutParameter @Check("1") @cl_int IntBuffer binary_status, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Alternate(value = "clCreateProgramWithBinary", nativeAlt = true) @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_program", params = "context") CLProgram clCreateProgramWithBinary2(@PointerWrapper("cl_context") CLContext context, @AutoSize("device_list") @cl_uint int num_devices, @Check("1") @Const @NativeType("cl_device_id") PointerBuffer device_list, @Check("device_list.remaining()") @Const @NativeType("size_t") PointerBuffer lengths, @Check("APIUtil.getSize(lengths)") @PointerArray(value = "num_devices", lengths = "lengths") @Const @NativeType("cl_uchar") ByteBuffer binaries, @OutParameter @Check("device_list.remaining()") @cl_int IntBuffer binary_status, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Alternate(value = "clCreateProgramWithBinary", nativeAlt = true) @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_program", params = "context") CLProgram clCreateProgramWithBinary3(@PointerWrapper("cl_context") CLContext context, @Constant("binaries.length") @cl_uint int num_devices, @Check("binaries.length") @Const @NativeType("cl_device_id") PointerBuffer device_list, @Constant("APIUtil.getLengths(binaries).getBuffer(), 0") @Const @NativeType("size_t") PointerBuffer lengths, @Check("1") @PointerArray("num_devices") @Const @NativeType("cl_uchar") ByteBuffer[] binaries, @OutParameter @Check("binaries.length") @cl_int IntBuffer binary_status, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) program.retain();") @cl_int int clRetainProgram(@PointerWrapper("cl_program") CLProgram program); @Code( javaBeforeNative = "\t\tAPIUtil.releaseObjects(program);", javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) program.release();" ) @cl_int int clReleaseProgram(@PointerWrapper("cl_program") CLProgram program); @Code( tryBlock = true, // Create a GlobalRef to the callback object. javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);", // Check if we need to delete the GlobalRef. javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);" ) @cl_int int clBuildProgram(@PointerWrapper("cl_program") CLProgram program, @AutoSize(value = "device_list", canBeNull = true) @cl_uint int num_devices, @Check(canBeNull = true) @Const @NativeType("cl_device_id") PointerBuffer device_list, @Check @NullTerminated @Const @cl_char ByteBuffer options, @PointerWrapper(value = "cl_build_program_callback", canBeNull = true) CLBuildProgramCallback pfn_notify, @Constant("user_data") @PointerWrapper("void *") long user_data); @Alternate("clBuildProgram") @Code( tryBlock = true, // Create a GlobalRef to the callback object. javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);", // Check if we need to delete the GlobalRef. javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);" ) @cl_int int clBuildProgram(@PointerWrapper("cl_program") CLProgram program, @AutoSize(value = "device_list", canBeNull = true) @cl_uint int num_devices, @Check(canBeNull = true) @Const @NativeType("cl_device_id") PointerBuffer device_list, @NullTerminated @Const CharSequence options, @PointerWrapper(value = "cl_build_program_callback", canBeNull = true) CLBuildProgramCallback pfn_notify, @Constant("user_data") @PointerWrapper("void *") long user_data); @Alternate("clBuildProgram") @Code( tryBlock = true, // Create a GlobalRef to the callback object. javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);", // Check if we need to delete the GlobalRef. javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);" ) @cl_int int clBuildProgram(@PointerWrapper("cl_program") CLProgram program, @Constant("1") @cl_uint int num_devices, @Constant(value = "APIUtil.getBufferPointer().put(0, device).getBuffer(), 0", keepParam = true) CLDevice device, @NullTerminated @Const CharSequence options, @PointerWrapper(value = "cl_build_program_callback", canBeNull = true) CLBuildProgramCallback pfn_notify, @Constant("user_data") @PointerWrapper("void *") long user_data); @cl_int int clUnloadCompiler(); @cl_int int clGetProgramInfo(@PointerWrapper("cl_program") CLProgram program, @NativeType("cl_program_info") int param_name, @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); /** * This method can be used to get program binaries. The binary for each device (in the * order returned by CL_PROGRAM_DEVICES) will be written sequentially to * the param_value buffer. The buffer size must be big enough to hold * all the binaries, as returned by CL_PROGRAM_BINARY_SIZES. * * @param program the program * @param param_value the buffers where the binaries will be written to. * @param param_value_size_ret optional size result * * @return the error code */ @Alternate(value = "clGetProgramInfo", nativeAlt = true) @cl_int int clGetProgramInfo2(@PointerWrapper("cl_program") CLProgram program, @Constant("CL_PROGRAM_BINARIES") @NativeType("cl_program_info") int param_name, @Constant("sizes.remainingByte()") @size_t long param_value_size, @Helper(passToNative = true) @Check("1") @Const @NativeType("size_t") PointerBuffer sizes, @OutParameter @Check("APIUtil.getSize(sizes)") @PointerArray(value = "param_value_size", lengths = "sizes") @NativeType("cl_uchar") ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); /** * This method can be used to get program binaries. The binary for each device (in the * order returned by CL_PROGRAM_DEVICES) will be written to the corresponding * slot of the param_value array. The size of each buffer must be big enough to * hold the corresponding binary, as returned by CL_PROGRAM_BINARY_SIZES. * * @param program the program * @param param_value the buffers where the binaries will be written to. * @param param_value_size_ret optional size result * * @return the error code */ @Alternate(value = "clGetProgramInfo", nativeAlt = true) @cl_int int clGetProgramInfo3(@PointerWrapper("cl_program") CLProgram program, @Constant("CL_PROGRAM_BINARIES") @NativeType("cl_program_info") int param_name, @Constant("param_value.length * PointerBuffer.getPointerSize()") @size_t long param_value_size, @PointerArray("param_value_size") @NativeType("cl_uchar") ByteBuffer[] param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); @cl_int int clGetProgramBuildInfo(@PointerWrapper("cl_program") CLProgram program, @PointerWrapper("cl_device_id") CLDevice device, @NativeType("cl_program_build_info") int param_name, @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_kernel", params = "program") CLKernel clCreateKernel(@PointerWrapper("cl_program") CLProgram program, @NullTerminated @Const @cl_char ByteBuffer kernel_name, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Alternate("clCreateKernel") @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_kernel", params = "program") CLKernel clCreateKernel(@PointerWrapper("cl_program") CLProgram program, @NullTerminated @Const CharSequence kernel_name, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS && kernels != null ) program.registerCLKernels(kernels);") @cl_int int clCreateKernelsInProgram(@PointerWrapper("cl_program") CLProgram program, @AutoSize(value = "kernels", canBeNull = true) @cl_uint int num_kernels, @OutParameter @Check(canBeNull = true) @NativeType("cl_kernel") PointerBuffer kernels, @OutParameter @Check(value = "1", canBeNull = true) @cl_uint IntBuffer num_kernels_ret); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) kernel.retain();") @cl_int int clRetainKernel(@PointerWrapper("cl_kernel") CLKernel kernel); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) kernel.release();") @cl_int int clReleaseKernel(@PointerWrapper("cl_kernel") CLKernel kernel); @cl_int int clSetKernelArg(@PointerWrapper("cl_kernel") CLKernel kernel, @cl_uint int arg_index, @AutoSize("arg_value") @size_t long arg_size, @Const @cl_byte @cl_short @cl_int @cl_long @cl_float @cl_double Buffer arg_value); @Alternate("clSetKernelArg") @cl_int int clSetKernelArg(@PointerWrapper("cl_kernel") CLKernel kernel, @cl_uint int arg_index, @Constant("PointerBuffer.getPointerSize()") @size_t long arg_size, @Check(canBeNull = true) @Const @Constant(value = "APIUtil.getBufferPointer().put(0, arg_value == null ? 0 : arg_value.getPointer()).getBuffer(), 0", keepParam = true) CLObject arg_value); /** Sets the size of a __local kernel argument at the specified index. */ @Alternate("clSetKernelArg") @cl_int int clSetKernelArg2(@PointerWrapper("cl_kernel") CLKernel kernel, @cl_uint int arg_index, @size_t long arg_size, @Constant("null, 0") Buffer arg_value); // This is used by CLKernelUtil. Assumes arg_value.position() == 0. @Alternate("clSetKernelArg") @Private @cl_int int clSetKernelArg3(@PointerWrapper("cl_kernel") CLKernel kernel, @cl_uint int arg_index, @size_t long arg_size, @Constant(value = "arg_value, 0", keepParam = true) Buffer arg_value); @cl_int int clGetKernelInfo(@PointerWrapper("cl_kernel") CLKernel kernel, @NativeType("cl_kernel_info") int param_name, @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); @cl_int int clGetKernelWorkGroupInfo(@PointerWrapper("cl_kernel") CLKernel kernel, @PointerWrapper(value = "cl_device_id", canBeNull = true) CLDevice device, @NativeType("cl_kernel_work_group_info") int param_name, @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueNDRangeKernel(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_kernel") CLKernel kernel, @cl_uint int work_dim, @Check(value = "work_dim", canBeNull = true) @Const @NativeType("size_t") PointerBuffer global_work_offset, @Check(value = "work_dim", canBeNull = true) @Const @NativeType("size_t") PointerBuffer global_work_size, @Check(value = "work_dim", canBeNull = true) @Const @NativeType("size_t") PointerBuffer local_work_size, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueTask(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_kernel") CLKernel kernel, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); /** * Enqueues a native kernel to the specified command queue. The mem_list parameter * can be used to pass a list of CLMem objects that will be mapped to global memory space and * exposed as a ByteBuffer array in the CLNativeKernel#execute method. The * sizes parameter will be used to allocate direct ByteBuffers with the correct * capacities. The user is responsible for passing appropriate values to avoid crashes. * * @param command_queue the command queue * @param user_func the native kernel * @param mem_list the CLMem objects * @param sizes the CLMem object sizes * @param event_wait_list the event wait list * @param event the queue event * * @return the error code */ @Code( tryBlock = true, // Build the args buffer and create a GlobalRef to the user_func object. javaBeforeNative = "\t\tlong user_func_ref = CallbackUtil.createGlobalRef(user_func);\n" + "\t\tByteBuffer args = APIUtil.getNativeKernelArgs(user_func_ref, mem_list, sizes);", // Register CLEvent javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);", // Check if we need to delete the GlobalRef. javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_func_ref);", nativeAfterVars = "\tvoid **args_mem_loc = num_mem_objects == 0 ? NULL : (void **)malloc(num_mem_objects * sizeof(void *));", nativeBeforeCall = "\t_ptr_i = 0;\n" + "\twhile ( _ptr_i < num_mem_objects ) {\n" + "\t\targs_mem_loc[_ptr_i] = (cl_void *)((char *)args_address + (4 + _ptr_i * (4 + sizeof(void *))));\n" + "\t\t_ptr_i++;\n" + "\t}", nativeAfterCall = "\tfree(args_mem_loc);" ) @cl_int int clEnqueueNativeKernel(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_native_kernel_func") CLNativeKernel user_func, @Constant("args, 0") @cl_void ByteBuffer args, @AutoSize("args") @size_t long cb_args, @Constant("mem_list == null ? 0 : mem_list.length") @cl_uint int num_mem_objects, @Check(value = "1", canBeNull = true) @PointerArray("num_mem_objects") @Const @NativeType("cl_mem") CLMem[] mem_list, @Check(value = "mem_list.length", canBeNull = true) @Helper long[] sizes, @Constant(value = "(const void**)args_mem_loc", isNative = true) @Const @Indirect @cl_void ByteBuffer args_mem_loc, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @cl_int int clWaitForEvents(@AutoSize("event_list") @cl_uint int num_events, @Check("1") @Const @NativeType("cl_event") PointerBuffer event_list); @Alternate("clWaitForEvents") @cl_int int clWaitForEvents(@Constant("1") @cl_uint int num_events, @Constant(value = "APIUtil.getBufferPointer().put(0, event).getBuffer(), 0", keepParam = true) CLEvent event); @cl_int int clGetEventInfo(@PointerWrapper("cl_event") CLEvent event, @NativeType("cl_event_info") int param_name, @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) event.retain();") @cl_int int clRetainEvent(@PointerWrapper("cl_event") CLEvent event); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) event.release();") @cl_int int clReleaseEvent(@PointerWrapper("cl_event") CLEvent event); @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);") @cl_int int clEnqueueMarker(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @OutParameter @Check("1") @NativeType("cl_event") PointerBuffer event); @cl_int int clEnqueueBarrier(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue); @cl_int int clEnqueueWaitForEvents(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @AutoSize("event_list") @cl_uint int num_events, @Check("1") @Const @NativeType("cl_event") PointerBuffer event_list); @Alternate("clEnqueueWaitForEvents") @cl_int int clEnqueueWaitForEvents(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @Constant("1") @cl_uint int num_events, @Constant(value = "APIUtil.getBufferPointer().put(0, event).getBuffer(), 0", keepParam = true) CLEvent event); @cl_int int clGetEventProfilingInfo(@PointerWrapper("cl_event") CLEvent event, @NativeType("cl_profiling_info") int param_name, @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); @cl_int int clFlush(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue); @cl_int int clFinish(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue); @Private @PointerWrapper("void *") CLFunctionAddress clGetExtensionFunctionAddress(@Check("1") @Const @cl_char ByteBuffer func_name); @Alternate("clGetExtensionFunctionAddress") @Private @PointerWrapper("void *") CLFunctionAddress clGetExtensionFunctionAddress(CharSequence func_name); }lwjgl-2.7.1/src/templates/org/lwjgl/opencl/NV_compiler_options.java0000644000175000017500000000326411543426510024534 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.util.generator.opencl.CLDeviceExtension; @CLDeviceExtension public interface NV_compiler_options { }lwjgl-2.7.1/src/templates/org/lwjgl/openal/0000755000175000017500000000000011543426511017673 5ustar zero79zero79lwjgl-2.7.1/src/templates/org/lwjgl/openal/AL11.java0000644000175000017500000002400711543426510021176 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.openal; import java.nio.IntBuffer; import java.nio.FloatBuffer; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.openal.ALenum; import org.lwjgl.util.generator.openal.ALuint; import org.lwjgl.util.generator.openal.ALvoid; /** *
      * This is the core OpenAL class. This class implements * AL.h version 1.1 * * @author Brian Matzon * @version $Revision: 2286 $ * $Id: AL10.java 2286 2006-03-23 19:32:21Z matzon $ */ public interface AL11 { /** Source buffer position information in seconds */ public static final int AL_SEC_OFFSET = 0x1024; /** Source buffer position information in samples */ public static final int AL_SAMPLE_OFFSET = 0x1025; /** Source buffer position information in bytes */ public static final int AL_BYTE_OFFSET = 0x1026; /** Type of source: Buffer has been attached using AL_BUFFER */ public static final int AL_STATIC = 0x1028; /** Type of source: if one or more Buffers have been attached using alSourceQueueBuffers */ public static final int AL_STREAMING = 0x1029; /** Type of source: when it has the NULL buffer attached */ public static final int AL_UNDETERMINED = 0x1030; /** @see AL10#AL_INVALID_OPERATION */ public static final int AL_ILLEGAL_COMMAND = 0xA004; /** Speed of Sound in units per second */ public static final int AL_SPEED_OF_SOUND = 0xC003; public static final int AL_LINEAR_DISTANCE = 0xD003; public static final int AL_LINEAR_DISTANCE_CLAMPED = 0xD004; public static final int AL_EXPONENT_DISTANCE = 0xD005; public static final int AL_EXPONENT_DISTANCE_CLAMPED = 0xD006; /** * Listener attributes are changed using the Listener group of commands. * * @param pname name of the attribute to be set * @param v1 value value 1 * @param v2 value value 2 * @param v3 value value 3 */ @ALvoid void alListener3i(@ALenum int pname, int v1, int v2, int v3); /** * Listener state is maintained inside the AL implementation and can be queried in * full. * * @param pname name of the attribute to be retrieved * @param intdata Buffer to write ints to */ // TODO: What's the real minimum number of elements? @StripPostfix("intdata") @ALvoid void alGetListeneriv(@ALenum int pname, @OutParameter @Check("1") FloatBuffer intdata); /** * Specifies the position and other properties as taken into account during * sound processing. * * @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 */ @ALvoid void alSource3i(@ALuint int source, @ALenum int pname, int v1, int v2, int v3); /** * Specifies the position and other properties as taken into account during * sound processing. * * @param source Source to set property on * @param pname property to set * @param value IntBuffer containing value of property */ // TODO: What's the correct minimum value? @StripPostfix("value") @ALvoid void alSourceiv(@ALuint int source, @ALenum int pname, @Check("1") @Const IntBuffer value); /** * This function sets a floating point property of a buffer. * note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by * this call, but this function may be used by OpenAL extensions. * * @param buffer Buffer to set property on * @param pname property to set * @param value value of property */ @ALvoid void alBufferf(@ALuint int buffer, @ALenum int pname, float value); /** * This function sets a floating point property of a buffer. * note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by * this call, but this function may be used by OpenAL extensions. * * @param buffer Buffer to set property on * @param pname property to set * @param v1 value of property * @param v2 value of property * @param v3 value of property */ @ALvoid void alBuffer3f(@ALuint int buffer, @ALenum int pname, float v1, float v2, float v3); /** * This function sets a floating point property of a buffer. * note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by * this call, but this function may be used by OpenAL extensions. * * @param buffer Buffer to set property on * @param pname property to set * @param value FloatBuffer containing value of property */ // TODO: What's the correct minimum value? @StripPostfix("value") @ALvoid void alBufferfv(@ALuint int buffer, @ALenum int pname, @Check("1") @Const FloatBuffer value); /** * This function sets an integer property of a buffer. * note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by * this call, but this function may be used by OpenAL extensions. * * @param buffer Buffer to set property on * @param pname property to set * @param value value of property */ @ALvoid void alBufferi(@ALuint int buffer, @ALenum int pname, int value); /** * This function sets an integer property of a buffer. * note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by * this call, but this function may be used by OpenAL extensions. * * @param buffer Buffer to set property on * @param pname property to set * @param v1 value of property * @param v2 value of property * @param v3 value of property */ @ALvoid void alBuffer3i(@ALuint int buffer, @ALenum int pname, int v1, int v2, int v3); /** * This function sets an integer property of a buffer. * note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by * this call, but this function may be used by OpenAL extensions. * * @param buffer Buffer to set property on * @param pname property to set * @param value IntBuffer containing value of property */ // TODO: What's the correct minimum value? @StripPostfix("value") @ALvoid void alBufferiv(@ALuint int buffer, @ALenum int pname, @Check("1") @Const IntBuffer value); /** * This function retrieves an integer property of a buffer. * note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by * this call, but this function may be used by OpenAL extensions. * * @param buffer Buffer to get property from * @param pname name of property * @return int */ @ALvoid void alGetBufferi(@ALuint int buffer, @ALenum int pname, @Result int value); /** * This function retrieves an integer property of a buffer. * * @param buffer Buffer to get property from * @param pname name of property */ // TODO: What's the correct minimum value? @StripPostfix("values") @ALvoid void alGetBufferiv(@ALuint int buffer, @ALenum int pname, @OutParameter @Check("1") IntBuffer values); /** * This function retrieves a floating point property of a buffer. * note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by * this call, but this function may be used by OpenAL extensions. * * @param buffer Buffer to get property from * @param pname name of property * @return floating point property */ @ALvoid void alGetBufferf(@ALuint int buffer, @ALenum int pname, @Result float value); /** * This function retrieves a floating point property of a buffer. * note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by * this call, but this function may be used by OpenAL extensions. * * @param buffer Buffer to get property from * @param pname name of property */ // TODO: What's the correct minimum value? @StripPostfix("values") @ALvoid void alGetBufferfv(@ALuint int buffer, @ALenum int pname, @OutParameter @Check("1") FloatBuffer values); /** *

      * AL_SPEED_OF_SOUND allows the application to change the reference (propagation) * speed used in the Doppler calculation. The source and listener velocities should be * expressed in the same units as the speed of sound. *

      *

      * A negative or zero value will result in an AL_INVALID_VALUE error, and the * command is ignored. The default value is 343.3 (appropriate for velocity units of meters * and air as the propagation medium). The current setting can be queried using * alGetFloat{v} and AL_SPEED_OF_SOUND. * Distance and velocity units are completely independent of one another (so you could use * different units for each if desired). *

      * * @param value distance model to be set */ @ALvoid void alSpeedOfSound(float value); } lwjgl-2.7.1/src/templates/org/lwjgl/openal/AL10.java0000644000175000017500000012546311543426510021205 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.openal; import java.nio.Buffer; import java.nio.IntBuffer; import java.nio.FloatBuffer; import java.nio.DoubleBuffer; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.openal.*; /** *
      * This is the core OpenAL class. This class implements * AL.h version 1.0 * * @author Brian Matzon * @version $Revision: 3412 $ * $Id: AL10.java 3412 2010-09-26 23:43:24Z spasi $ */ public interface AL10 { /** Bad value */ int AL_INVALID = -1; /** Disable value */ int AL_NONE = 0; /** Boolean False */ int AL_FALSE = 0; /** Boolean True */ int AL_TRUE = 1; /** * Indicate the type of SOURCE. * Sources can be spatialized */ int AL_SOURCE_TYPE = 0x1027; /** Indicate source has absolute coordinates */ int AL_SOURCE_ABSOLUTE = 0x201; /** Indicate Source has listener relative coordinates */ int AL_SOURCE_RELATIVE = 0x202; /** * Directional source, inner cone angle, in degrees * Range: [0-360] * Default: 360 */ int AL_CONE_INNER_ANGLE = 0x1001; /** * Directional source, outer cone angle, in degrees. * Range: [0-360] * Default: 360 */ int AL_CONE_OUTER_ANGLE = 0x1002; /** * Specify the pitch to be applied, either at source, * or on mixer results, at listener. * Range: [0.5-2.0] * Default: 1.0 */ int AL_PITCH = 0x1003; /** * Specify the current location in three dimensional space. * OpenAL, like OpenGL, uses a right handed coordinate system, * where in a frontal default view X (thumb) points right, * Y points up (index finger), and Z points towards the * viewer/camera (middle finger). * To switch from a left handed coordinate system, flip the * sign on the Z coordinate. * Listener position is always in the world coordinate system. */ int AL_POSITION = 0x1004; /** Specify the current direction as forward vector. */ int AL_DIRECTION = 0x1005; /** Specify the current velocity in three dimensional space. */ int AL_VELOCITY = 0x1006; /** * Indicate whether source has to loop infinite. * Type: ALboolean * Range: [TRUE, FALSE] * Default: FALSE */ int AL_LOOPING = 0x1007; /** * Indicate the buffer to provide sound samples. * Type: ALuint. * Range: any valid Buffer id. */ int AL_BUFFER = 0x1009; /** * Indicate the gain (volume amplification) applied. * Type: ALfloat. * Range: ]0.0- ] * A value of 1.0 means un-attenuated/unchanged. * Each division by 2 equals an attenuation of -6dB. * Each multiplicaton with 2 equals an amplification of +6dB. * A value of 0.0 is meaningless with respect to a logarithmic * scale; it is interpreted as zero volume - the channel * is effectively disabled. */ int AL_GAIN = 0x100A; /** * Indicate minimum source attenuation. * Type: ALfloat * Range: [0.0 - 1.0] */ int AL_MIN_GAIN = 0x100D; /** * Indicate maximum source attenuation. * Type: ALfloat * Range: [0.0 - 1.0] */ int AL_MAX_GAIN = 0x100E; /** * Specify the current orientation. * Type: ALfv6 (at/up) * Range: N/A */ int AL_ORIENTATION = 0x100F; /* byte offset into source (in canon format). -1 if source * is not playing. Don't set this, get this. * * Type: ALfloat * Range: [0.0 - ] * Default: 1.0 */ int AL_REFERENCE_DISTANCE = 0x1020; /** * Indicate the rolloff factor for the source. * Type: ALfloat * Range: [0.0 - ] * Default: 1.0 */ int AL_ROLLOFF_FACTOR = 0x1021; /** * Indicate the gain (volume amplification) applied. * Type: ALfloat. * Range: ]0.0- ] * A value of 1.0 means un-attenuated/unchanged. * Each division by 2 equals an attenuation of -6dB. * Each multiplicaton with 2 equals an amplification of +6dB. * A value of 0.0 is meaningless with respect to a logarithmic * scale; it is interpreted as zero volume - the channel * is effectively disabled. */ int AL_CONE_OUTER_GAIN = 0x1022; /** * Specify the maximum distance. * Type: ALfloat * Range: [0.0 - ] */ int AL_MAX_DISTANCE = 0x1023; /** * Specify the channel mask. (Creative) * Type: ALuint * Range: [0 - 255] */ int AL_CHANNEL_MASK = 0x3000; /** Source state information */ int AL_SOURCE_STATE = 0x1010; /** Source state information */ int AL_INITIAL = 0x1011; /** Source state information */ int AL_PLAYING = 0x1012; /** Source state information */ int AL_PAUSED = 0x1013; /** Source state information */ int AL_STOPPED = 0x1014; /** Buffer Queue params */ int AL_BUFFERS_QUEUED = 0x1015; /** Buffer Queue params */ int AL_BUFFERS_PROCESSED = 0x1016; /** Sound buffers: format specifier. */ int AL_FORMAT_MONO8 = 0x1100; /** Sound buffers: format specifier. */ int AL_FORMAT_MONO16 = 0x1101; /** Sound buffers: format specifier. */ int AL_FORMAT_STEREO8 = 0x1102; /** Sound buffers: format specifier. */ int AL_FORMAT_STEREO16 = 0x1103; /** Ogg Vorbis format specifier. */ int AL_FORMAT_VORBIS_EXT = 0x10003; /** * Sound buffers: frequency, in units of Hertz [Hz]. * This is the number of samples per second. Half of the * sample frequency marks the maximum significant * frequency component. */ int AL_FREQUENCY = 0x2001; /** * Sound buffers: The number of bits per sample for the * data contained in the buffer. */ int AL_BITS = 0x2002; /** * Sound buffers: The number of channels for the data * contained in the buffer. */ int AL_CHANNELS = 0x2003; /** * Sound buffers: Size in bytes of the buffer data. */ int AL_SIZE = 0x2004; /** * @deprecated This token is a relict of the early OpenAL days and is * no longer supported. Neither the OpenAL spec nor OpenAL Soft define * it. */ @Deprecated int AL_DATA = 0x2005; /** * Buffer state. * * Not supported for public use (yet). */ int AL_UNUSED = 0x2010; /** * Buffer state. * * Not supported for public use (yet). */ int AL_PENDING = 0x2011; /** * Buffer state. * * Not supported for public use (yet). */ int AL_PROCESSED = 0x2012; /** Errors: No Error. */ int AL_NO_ERROR = AL_FALSE; /** Illegal name passed as an argument to an AL call. */ int AL_INVALID_NAME = 0xA001; /** Illegal enum passed as an argument to an AL call. */ int AL_INVALID_ENUM = 0xA002; /** * Illegal value passed as an argument to an AL call. * Applies to parameter values, but not to enumerations. */ int AL_INVALID_VALUE = 0xA003; /** * 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. */ int AL_INVALID_OPERATION = 0xA004; /** * A function could not be completed, * because there is not enough memory available. */ int AL_OUT_OF_MEMORY = 0xA005; /** Context strings: Vendor */ int AL_VENDOR = 0xB001; /** Context strings: Version */ int AL_VERSION = 0xB002; /** Context strings: Renderer */ int AL_RENDERER = 0xB003; /** Context strings: Extensions */ int AL_EXTENSIONS = 0xB004; /** Doppler scale. Default 1.0 */ int AL_DOPPLER_FACTOR = 0xC000; /** Doppler velocity. Default 1.0 */ int AL_DOPPLER_VELOCITY = 0xC001; /** Distance model. Default INVERSE_DISTANCE_CLAMPED */ int AL_DISTANCE_MODEL = 0xD000; /** Distance model */ int AL_INVERSE_DISTANCE = 0xD001; /** Distance model */ int AL_INVERSE_DISTANCE_CLAMPED = 0xD002; /** * The application can temporarily disable certain AL capabilities on a per Context * basis. This allows the driver implementation to optimize for certain subsets of * operations. Enabling and disabling capabilities is handled using a function pair. * * @param capability name of a capability to enable */ @ALvoid void alEnable(int capability); /** * The application can temporarily disable certain AL capabilities on a per Context * basis. This allows the driver implementation to optimize for certain subsets of * operations. Enabling and disabling capabilities is handled using a function pair. * * @param capability name of a capability to disable */ @ALvoid void alDisable(@ALenum int capability); /** * The application can also query whether a given capability is currently enabled or * not. *

      * If the token used to specify target is not legal, an AL_INVALID_ENUM error will be * generated. *

      *

      * At this time, this mechanism is not used. There are no valid targets. *

      * * @param capability name of a capability to check * @return true if named feature is enabled */ boolean alIsEnabled(@ALenum int capability); /** * Hinting for implementation * NOTE: This method is a NOP, but is provided for completeness. * * @param target The target to hint * @param mode Mode to hint */ // @ALvoid // void alHint(@ALenum int target, @ALenum int mode); /** * Like OpenGL, AL uses a simplified interface for querying global state. * * Legal values are e.g. AL_DOPPLER_FACTOR, AL_DOPPLER_VELOCITY, * AL_DISTANCE_MODEL. *

      * null destinations are quietly ignored. AL_INVALID_ENUM is the response to errors * in specifying pName. The amount of memory required in the destination * depends on the actual state requested. *

      * * @return boolean state described by pname will be returned. */ boolean alGetBoolean(@ALenum int pname); /** * Like OpenGL, AL uses a simplified interface for querying global state. * * Legal values are e.g. AL_DOPPLER_FACTOR, AL_DOPPLER_VELOCITY, * AL_DISTANCE_MODEL. *

      * null destinations are quietly ignored. AL_INVALID_ENUM is the response to errors * in specifying pName. The amount of memory required in the destination * depends on the actual state requested. *

      * * @return int state described by pname will be returned. */ int alGetInteger(@ALenum int pname); /** * Like OpenGL, AL uses a simplified interface for querying global state. * * Legal values are e.g. AL_DOPPLER_FACTOR, AL_DOPPLER_VELOCITY, * AL_DISTANCE_MODEL. *

      * null destinations are quietly ignored. AL_INVALID_ENUM is the response to errors * in specifying pName. The amount of memory required in the destination * depends on the actual state requested. *

      * * @return float state described by pname will be returned. */ float alGetFloat(@ALenum int pname); /** * Like OpenGL, AL uses a simplified interface for querying global state. * * Legal values are e.g. AL_DOPPLER_FACTOR, AL_DOPPLER_VELOCITY, * AL_DISTANCE_MODEL. *

      * null destinations are quietly ignored. AL_INVALID_ENUM is the response to errors * in specifying pName. The amount of memory required in the destination * depends on the actual state requested. *

      * * @return double state described by pname will be returned. */ double alGetDouble(@ALenum int pname); /** * Like OpenGL, AL uses a simplified interface for querying global state. * * Legal values are e.g. AL_DOPPLER_FACTOR, AL_DOPPLER_VELOCITY, * AL_DISTANCE_MODEL. *

      * null destinations are quietly ignored. AL_INVALID_ENUM is the response to errors * in specifying pName. The amount of memory required in the destination * depends on the actual state requested. *

      * * @param pname state to be queried * @param data Buffer to place the integers in */ @StripPostfix("data") @ALvoid void alGetIntegerv(@ALenum int pname, @OutParameter @Check("1") IntBuffer data); /** * Like OpenGL, AL uses a simplified interface for querying global state. * * Legal values are e.g. AL_DOPPLER_FACTOR, AL_DOPPLER_VELOCITY, * AL_DISTANCE_MODEL. *

      * null destinations are quietly ignored. AL_INVALID_ENUM is the response to errors * in specifying pName. The amount of memory required in the destination * depends on the actual state requested. *

      * * @param pname state to be queried * @param data Buffer to place the floats in */ @StripPostfix("data") @ALvoid void alGetFloatv(@ALenum int pname, @OutParameter @Check("1") FloatBuffer data); /** * Like OpenGL, AL uses a simplified interface for querying global state. * * Legal values are e.g. AL_DOPPLER_FACTOR, AL_DOPPLER_VELOCITY, * AL_DISTANCE_MODEL. *

      * null destinations are quietly ignored. AL_INVALID_ENUM is the response to errors * in specifying pName. The amount of memory required in the destination * depends on the actual state requested. *

      * * @param pname state to be queried * @param data Buffer to place the doubles in */ @StripPostfix("data") @ALvoid void alGetDoublev(@ALenum int pname, @OutParameter @Check("1") DoubleBuffer data); /** * The application can retrieve state information global to the current AL Context. * GetString will return a pointer to a constant string. Valid values for param are * VERSION, RENDERER, VENDOR, and EXTENSIONS, as well as the error codes * defined by AL. The application can use GetString to retrieve a string for an error * code. * * @param pname The property to be returned * @return OpenAL String property */ @NoErrorCheck String alGetString(@ALenum int pname); /** * The AL detects only a subset of those conditions that could be considered errors. * This is because in many cases error checking would adversely impact the * performance of an error-free program. *

      * Each detectable error is assigned a numeric * code. When an error is detected by AL, a flag is set and the error code is recorded. * Further errors, if they occur, do not affect this recorded code. When GetError is * called, the code is returned and the flag is cleared, so that a further error will again * record its code. If a call to GetError returns AL_NO_ERROR then there has been no * detectable error since the last call to GetError (or since the AL was initialized). *

      *

      * Error codes can be mapped to strings. The GetString function returns a pointer to a * constant (literal) string that is identical to the identifier used for the enumeration * value, as defined in the specification. *

      *

      * AL_NO_ERROR - "No Error" token.
      * AL_INVALID_NAME - Invalid Name parameter.
      * AL_INVALID_ENUM - Invalid parameter.
      * AL_INVALID_VALUE - Invalid enum parameter value.
      * AL_INVALID_OPERATION - Illegal call.
      * AL_OUT_OF_MEMORY - Unable to allocate memory.
      *

      *

      * The table summarizes the AL errors. Currently, when an error flag is set, results of * AL operations are undefined only if AL_OUT_OF_MEMORY has occured. In other * cases, the command generating the error is ignored so that it has no effect on AL * state or output buffer contents. If the error generating command returns a value, it * returns zero. If the generating command modifies values through a pointer * argument, no change is made to these values. These error semantics apply only to * AL errors, not to system errors such as memory access errors. *

      *

      * Several error generation conditions are implicit in the description of the various AL * commands. First, if a command that requires an enumerated value is passed a value * that is not one of those specified as allowable for that command, the error * AL_INVALID_ENUM results. This is the case even if the argument is a pointer to a * symbolic constant if that value is not allowable for the given command. This will * occur whether the value is allowable for other functions, or an invalid integer value. *

      *

      * Integer parameters that are used as names for AL objects such as Buffers and * Sources are checked for validity. If an invalid name parameter is specified in an AL * command, an AL_INVALID_NAME error will be generated, and the command is * ignored. *

      *

      * If a negative integer is provided where an argument of type sizei is specified, the * error AL_INVALID_VALUE results. The same error will result from attempts to set * integral and floating point values for attributes exceeding the legal range for these. * The specification does not guarantee that the implementation emits * AL_INVALID_VALUE if a NaN or Infinity value is passed in for a float or double * argument (as the specification does not enforce possibly expensive testing of * floating point values). *

      *

      * Commands can be invalid. For example, certain commands might not be applicable * to a given object. There are also illegal combinations of tokens and values as * arguments to a command. AL responds to any such illegal command with an * AL_INVALID_OPERATION error. *

      *

      * If memory is exhausted as a side effect of the execution of an AL command, either * on system level or by exhausting the allocated resources at AL's internal disposal, * the error AL_OUT_OF_MEMORY may be generated. This can also happen independent * of recent commands if AL has to request memory for an internal task and fails to * allocate the required memory from the operating system. *

      *

      * Otherwise errors are generated only for conditions that are explicitely described in * this specification. *

      * * @return current error state */ @NoErrorCheck @ALenum int alGetError(); /** * To verify that a given extension is available for the current context and the device it * is associated with, use this method. *

      * A null name argument returns AL_FALSE, as do invalid and unsupported string * tokens. A null deviceHandle will result in an INVALID_DEVICE error. *

      * * @param fname String describing the desired extension * @return true if extension is available, false if not */ boolean alIsExtensionPresent(String fname); /** *

      * To obtain enumeration values for extensions, the application has to use * GetEnumValue of an extension token. Enumeration values are defined within the * AL namespace and allocated according to specification of the core API and the * extensions, thus they are context-independent. *

      *

      * Returns 0 if the enumeration can not be found. The presence of an enum value does * not guarantee the applicability of an extension to the current context. A non-zero * return indicates merely that the implementation is aware of the existence of this * extension. Implementations should not attempt to return 0 to indicate that the * extensions is not supported for the current context. *

      * * @param ename String describing an OpenAL enum * @return Actual int for the described enumeration name */ @ALenum int alGetEnumValue(String ename); /** * Listener attributes are changed using the Listener group of commands. * * @param pname name of the attribute to be set * @param value value to set the attribute to */ @ALvoid void alListeneri(@ALenum int pname, int value); /** * Listener attributes are changed using the Listener group of commands. * * @param pname name of the attribute to be set * @param value floating point value to set the attribute to */ @ALvoid void alListenerf(@ALenum int pname, float value); /** * Listener attributes are changed using the Listener group of commands. * * @param pname name of the attribute to be set * @param value FloatBuffer containing value to set the attribute to */ @StripPostfix("value") @ALvoid void alListenerfv(@ALenum int pname, @Check("1") @Const FloatBuffer value); /** * Listener attributes are changed using the Listener group of commands. * * @param pname name of the attribute to be set * @param v1 value value 1 * @param v2 value value 2 * @param v3 float value 3 */ @ALvoid void alListener3f(@ALenum int pname, float v1, float v2, float v3); /** * Listener state is maintained inside the AL implementation and can be queried in * full. * * @param pname name of the attribute to be retrieved * @return int */ void alGetListeneri(@ALenum int pname, @Result @ALint int value); /** * Listener state is maintained inside the AL implementation and can be queried in * full. * * @param pname name of the attribute to be retrieved * @return float */ void alGetListenerf(@ALenum int pname, @Result float value); /** * Listener state is maintained inside the AL implementation and can be queried in * full. * * @param pname name of the attribute to be retrieved * @param floatdata Buffer to write floats to */ // TODO: What's the real minimum number of elements? @StripPostfix("floatdata") @ALvoid void alGetListenerfv(@ALenum int pname, @OutParameter @Check("1") FloatBuffer floatdata); /** * The application requests a number of Sources using GenSources. * * @param sources array holding sources */ @ALvoid void alGenSources(@AutoSize("sources") @ALsizei int n, @OutParameter @ALuint IntBuffer sources); @Alternate(value = "alGenSources", nativeAlt = true) @ALvoid void alGenSources2(@Constant("1") @ALsizei int n, @Result @ALuint int source); /** * The application requests deletion of a number of Sources by DeleteSources. * * @param sources Source array to delete from */ @ALvoid void alDeleteSources(@AutoSize("sources") @ALsizei int n, @ALuint IntBuffer sources); @Alternate(value = "alDeleteSources", nativeAlt = true) @ALvoid void alDeleteSources2(@Constant("1") @ALsizei int n, @Indirect @ALuint int source); /** * The application can verify whether a source name is valid using the IsSource query. * * @param id id of source to be testes for validity * @return true if id is valid, false if not */ boolean alIsSource(@ALuint int id); /** * Specifies the position and other properties as taken into account during * sound processing. * * @param source Source to det property on * @param pname property to set * @param value value of property */ @ALvoid void alSourcei(@ALuint int source, @ALenum int pname, int value); /** * Specifies the position and other properties as taken into account during * sound processing. * * @param source Source to det property on * @param pname property to set * @param value value of property */ @ALvoid void alSourcef(@ALuint int source, @ALenum int pname, float value); /** * Specifies the position and other properties as taken into account during * sound processing. * * @param source Source to set property on * @param pname property to set * @param value FloatBuffer containing value of property */ // TODO: What's the correct minimum value? @StripPostfix("value") @ALvoid void alSourcefv(@ALuint int source, @ALenum int pname, @Check("1") @Const FloatBuffer value); /** * Specifies the position and other properties as taken into account during * sound processing. * * @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 */ @ALvoid void alSource3f( @ALuint int source, @ALenum int pname, float v1, float v2, float v3); /** * Source state is maintained inside the AL implementation, and the current attributes * can be queried. The performance of such queries is implementation dependent, no * performance guarantees are made. * * @param source source to get property from * @param pname name of property * @return int */ @ALvoid void alGetSourcei(@ALuint int source, @ALenum int pname, @Result int value); /** * Source state is maintained inside the AL implementation, and the current attributes * can be queried. The performance of such queries is implementation dependent, no * performance guarantees are made. * * @param source source to get property from * @param pname name of property * @return float */ @ALvoid void alGetSourcef(@ALuint int source, @ALenum int pname, @Result float value); /** * Source state is maintained inside the AL implementation, and the current attributes * can be queried. The performance of such queries is implementation dependent, no * performance guarantees are made. * * @param source Source to get property from * @param pname property to get * @param floatdata Buffer to write floats to */ // TODO: What's the correct minimum value? @StripPostfix("floatdata") @ALvoid void alGetSourcefv(@ALuint int source, @ALenum int pname, @OutParameter @Check("1") FloatBuffer floatdata); /** * Play() applied to an AL_INITIAL Source will promote the Source to AL_PLAYING, thus * the data found in the Buffer will be fed into the processing, starting at the * beginning. Play() applied to a AL_PLAYING Source will restart the Source from the * beginning. It will not affect the configuration, and will leave the Source in * AL_PLAYING state, but reset the sampling offset to the beginning. Play() applied to a * AL_PAUSED Source will resume processing using the Source state as preserved at the * Pause() operation. Play() applied to a AL_STOPPED Source will propagate it to * AL_INITIAL then to AL_PLAYING immediately. * * @param sources array of sources to play */ @StripPostfix("sources") @ALvoid void alSourcePlayv(@AutoSize("sources") @ALsizei int n, @ALuint IntBuffer sources); /** * Pause() applied to an AL_INITIAL Source is a legal NOP. Pause() applied to a * AL_PLAYING Source will change its state to AL_PAUSED. The Source is exempt from * processing, its current state is preserved. Pause() applied to a AL_PAUSED Source is a * legal NOP. Pause() applied to a AL_STOPPED Source is a legal NOP. * * @param sources array of sources to pause */ @StripPostfix("sources") @ALvoid void alSourcePausev(@AutoSize("sources") @ALsizei int n, @ALuint IntBuffer sources); /** * Stop() applied to an AL_INITIAL Source is a legal NOP. Stop() applied to a AL_PLAYING * Source will change its state to AL_STOPPED. The Source is exempt from processing, * its current state is preserved. Stop() applied to a AL_PAUSED Source will change its * state to AL_STOPPED, with the same consequences as on a AL_PLAYING Source. Stop() * applied to a AL_STOPPED Source is a legal NOP. * * @param sources array of sources to stop */ @StripPostfix("sources") @ALvoid void alSourceStopv(@AutoSize("sources") @ALsizei int n, @ALuint IntBuffer sources); /** * Rewind() applied to an AL_INITIAL Source is a legal NOP. Rewind() applied to a * AL_PLAYING Source will change its state to AL_STOPPED then AL_INITIAL. The Source is * exempt from processing, its current state is preserved, with the exception of the * sampling offset which is reset to the beginning. Rewind() applied to a AL_PAUSED * Source will change its state to AL_INITIAL, with the same consequences as on a * AL_PLAYING Source. Rewind() applied to a AL_STOPPED Source promotes the Source to * AL_INITIAL, resetting the sampling offset to the beginning. * * @param sources array of sources to rewind */ @StripPostfix("sources") @ALvoid void alSourceRewindv(@AutoSize("sources") @ALsizei int n, @ALuint IntBuffer sources); /** * Play() applied to an AL_INITIAL Source will promote the Source to AL_PLAYING, thus * the data found in the Buffer will be fed into the processing, starting at the * beginning. Play() applied to a AL_PLAYING Source will restart the Source from the * beginning. It will not affect the configuration, and will leave the Source in * AL_PLAYING state, but reset the sampling offset to the beginning. Play() applied to a * AL_PAUSED Source will resume processing using the Source state as preserved at the * Pause() operation. Play() applied to a AL_STOPPED Source will propagate it to * AL_INITIAL then to AL_PLAYING immediately. * * @param source Source to play */ @ALvoid void alSourcePlay(@ALuint int source); /** * Pause() applied to an AL_INITIAL Source is a legal NOP. Pause() applied to a * AL_PLAYING Source will change its state to AL_PAUSED. The Source is exempt from * processing, its current state is preserved. Pause() applied to a AL_PAUSED Source is a * legal NOP. Pause() applied to a AL_STOPPED Source is a legal NOP. * * @param source Source to pause */ @ALvoid void alSourcePause(@ALuint int source); /** * Stop() applied to an AL_INITIAL Source is a legal NOP. Stop() applied to a AL_PLAYING * Source will change its state to AL_STOPPED. The Source is exempt from processing, * its current state is preserved. Stop() applied to a AL_PAUSED Source will change its * state to AL_STOPPED, with the same consequences as on a AL_PLAYING Source. Stop() * applied to a AL_STOPPED Source is a legal NOP. * * @param source Source to stop */ @ALvoid void alSourceStop(@ALuint int source); /** * Rewind() applied to an AL_INITIAL Source is a legal NOP. Rewind() applied to a * AL_PLAYING Source will change its state to AL_STOPPED then AL_INITIAL. The Source is * exempt from processing, its current state is preserved, with the exception of the * sampling offset which is reset to the beginning. Rewind() applied to a AL_PAUSED * Source will change its state to AL_INITIAL, with the same consequences as on a * AL_PLAYING Source. Rewind() applied to a AL_STOPPED Source promotes the Source to * AL_INITIAL, resetting the sampling offset to the beginning. * * @param source Source to rewind */ @ALvoid void alSourceRewind(@ALuint int source); /** * The application requests a number of Buffers using GenBuffers. * * @param buffers holding buffers */ @ALvoid void alGenBuffers(@AutoSize("buffers") @ALsizei int n, @OutParameter @ALuint IntBuffer buffers); @Alternate(value = "alGenBuffers", nativeAlt = true) @ALvoid void alGenBuffers2(@Constant("1") @ALsizei int n, @Result @ALuint int buffer); /** *

      * The application requests deletion of a number of Buffers by calling DeleteBuffers. *

      *

      * Once deleted, Names are no longer valid for use with AL function calls. Any such * use will cause an AL_INVALID_NAME error. The implementation is free to defer actual * release of resources. *

      *

      * IsBuffer(bname) can be used to verify deletion of a buffer. Deleting bufferName 0 is * a legal NOP in both scalar and vector forms of the command. The same is true for * unused buffer names, e.g. such as not allocated yet, or as released already. * * @param buffers Buffer to delete from */ @ALvoid void alDeleteBuffers(@AutoSize("buffers") @ALsizei int n, @ALuint IntBuffer buffers); @Alternate(value = "alDeleteBuffers", nativeAlt = true) @ALvoid void alDeleteBuffers2(@Constant("1") @ALsizei int n, @Indirect @ALuint int buffer); /** * The application can verify whether a buffer Name is valid using the IsBuffer query. * * @param buffer buffer to be tested for validity * @return true if supplied buffer is valid, false if not */ boolean alIsBuffer(@ALuint int buffer); /** *

      * A special case of Buffer state is the actual sound sample data stored in asociation * with the Buffer. Applications can specify sample data using BufferData. *

      *

      * The data specified is copied to an internal software, or if possible, hardware buffer. * The implementation is free to apply decompression, conversion, resampling, and * filtering as needed. The internal format of the Buffer is not exposed to the * application, and not accessible. Valid formats are AL_FORMAT_MONO8, * AL_FORMAT_MONO16, AL_FORMAT_STEREO8, and AL_FORMAT_STEREO16. An * implementation may expose other formats, see the chapter on Extensions for * information on determining if additional formats are supported. *

      *

      * Applications should always check for an error condition after attempting to specify * buffer data in case an implementation has to generate an AL_OUT_OF_MEMORY or * conversion related AL_INVALID_VALUE error. The application is free to reuse the * memory specified by the data pointer once the call to BufferData returns. The * implementation has to dereference, e.g. copy, the data during BufferData execution. *

      * * @param buffer Buffer to fill * @param format format sound data is in * @param data location of data * @param freq frequency of data */ @ALvoid void alBufferData( @ALuint int buffer, @ALenum int format, @ALbyte @ALshort @ALint Buffer data, @AutoSize("data") @ALsizei int size, @ALsizei int freq); /** * Buffer state is maintained inside the AL implementation and can be queried in full.
      * ALC_FREQUENCY - specified in samples per second, i.e. units of Hertz [Hz].
      * ALC_SIZE - Size in bytes of the buffer data.
      * * @param buffer buffer to get property from * @param pname name of property to retrieve */ @ALvoid void alGetBufferi(@ALuint int buffer, @ALenum int pname, @Result int value); /** * Buffer state is maintained inside the AL implementation and can be queried in full.
      * ALC_FREQUENCY - specified in samples per second, i.e. units of Hertz [Hz].
      * ALC_SIZE - Size in bytes of the buffer data.
      * * @param buffer buffer to get property from * @param pname name of property to retrieve * @return float */ @ALvoid void alGetBufferf(@ALuint int buffer, @ALenum int pname, @Result float value); /** *

      * The application can queue up one or multiple buffer names using * SourceQueueBuffers. The buffers will be queued in the sequence in which they * appear in the array. *

      *

      * This command is legal on a Source in any state (to allow for streaming, queueing * has to be possible on a AL_PLAYING Source). Queues are read-only with exception of * the unqueue operation. The Buffer Name AL_NONE (i.e. 0) can be queued. *

      * * @param source source to queue buffers onto * @param buffers buffers to be queued */ @ALvoid void alSourceQueueBuffers(@ALuint int source, @AutoSize("buffers") @ALsizei int n, @ALuint IntBuffer buffers); @Alternate(value = "alSourceQueueBuffers", nativeAlt = true) @ALvoid void alSourceQueueBuffers2(@ALuint int source, @Constant("1") @ALsizei int n, @Indirect @ALuint int buffer); /** *

      * Once a queue entry for a buffer has been appended to a queue and is pending * processing, it should not be changed. Removal of a given queue entry is not possible * unless either the Source is AL_STOPPED (in which case then entire queue is considered * processed), or if the queue entry has already been processed (AL_PLAYING or AL_PAUSED * Source). *

      *

      * The Unqueue command removes a number of buffers entries that have finished * processing, in the order of appearance, from the queue. The operation will fail if * more buffers are requested than available, leaving the destination arguments * unchanged. An AL_INVALID_VALUE error will be thrown. If no error, the destination * argument will have been updated accordingly. *

      * * @param source source to unqueue buffers from * @param buffers IntBuffer containing list of names that were unqueued */ @ALvoid void alSourceUnqueueBuffers(@ALuint int source, @AutoSize("buffers") @ALsizei int n, @OutParameter @ALuint IntBuffer buffers); @Alternate(value = "alSourceUnqueueBuffers", nativeAlt = true) @ALvoid void alSourceUnqueueBuffers2(@ALuint int source, @Constant("1") @ALsizei int n, @Result @ALuint int buffer); /** *

      * Samples usually use the entire dynamic range of the chosen format/encoding, * independent of their real world intensity. In other words, a jet engine and a * clockwork both will have samples with full amplitude. The application will then * have to adjust Source AL_GAIN accordingly to account for relative differences. *

      *

      * Source AL_GAIN is then attenuated by distance. The effective attenuation of a Source * depends on many factors, among which distance attenuation and source and * Listener AL_GAIN are only some of the contributing factors. Even if the source and * Listener AL_GAIN exceed 1.0 (amplification beyond the guaranteed dynamic range), * distance and other attenuation might ultimately limit the overall AL_GAIN to a value * below 1.0. *

      *

      * AL currently supports three modes of operation with respect to distance * attenuation. It supports two distance-dependent attenuation models, one which is * similar to the IASIG I3DL2 (and DS3D) model. The application choses one of these * two models (or can chose to disable distance-dependent attenuation effects model) * on a per-context basis. *

      *

      * Legal arguments are AL_NONE, AL_INVERSE_DISTANCE, and * AL_INVERSE_DISTANCE_CLAMPED. *
      *
      * AL_NONE bypasses all distance attenuation * calculation for all Sources. The implementation is expected to optimize this * situation. *
      *
      * AL_INVERSE_DISTANCE_CLAMPED is the DS3D model, with * AL_REFERENCE_DISTANCE indicating both the reference distance and the distance * below which gain will be clamped. *
      *
      * AL_INVERSE_DISTANCE is equivalent to the DS3D * model with the exception that AL_REFERENCE_DISTANCE does not imply any * clamping. *
      *
      * The AL implementation is still free to apply any range clamping as * necessary. The current distance model chosen can be queried using GetIntegerv and * AL_DISTANCE_MODEL. *

      * * @param value distance model to be set */ @ALvoid void alDistanceModel(@ALenum int value); /** * The Doppler Effect depends on the velocities of Source and Listener relative to the * medium, and the propagation speed of sound in that medium. The application * might want to emphasize or de-emphasize the Doppler Effect as physically accurate * calculation might not give the desired results. The amount of frequency shift (pitch * change) is proportional to the speed of listener and source along their line of sight. * The application can increase or decrease that frequency shift by specifying the * scaling factor AL should apply to the result of the calculation. *
      *
      * The Doppler Effect as implemented by AL is described by the formula below. Effects * of the medium (air, water) moving with respect to listener and source are ignored. * AL_DOPPLER_VELOCITY is the propagation speed relative to which the Source * velocities are interpreted. * *

      *

      	 *	 VD: AL_DOPPLER_VELOCITY
      	 *	 DF: AL_DOPPLER_FACTOR
      	 *	 vl: Listener velocity (scalar, projected on source-listener vector)
      	 *	 vs: Source verlocity (scalar, projected on source-listener vector)
      	 *	 f: Frequency in sample
      	 *	 f': effective Doppler shifted frequency
      	 *
      	 *	 f' = DF * f * (VD-vl)/(VD+vs)
      	 *
      	 *	 vl<0, vs>0 : source and listener approaching each other
      	 *	 vl>0, vs<0 : source and listener moving away from each other
      	 * 
      *

      *

      * The implementation has to clamp the projected Listener velocity vl, if abs(vl) is * greater or equal VD. It similarly has to clamp the projected Source velocity vs if * abs(vs) is greater or equal VD. *

      *

      * There are two API calls global to the current context that provide control of the two * related parameters. *

      *

      * AL_DOPPLER_FACTOR is a simple scaling to exaggerate or * deemphasize the Doppler (pitch) shift resulting from the calculation. *

      *

      * A negative value will result in an AL_INVALID_VALUE error, the command is then * ignored. The default value is 1. The current setting can be queried using GetFloatv * and AL_DOPPLER_FACTOR. The implementation is free to optimize the case of * AL_DOPPLER_FACTOR being set to zero, as this effectively disables the effect. *

      * * @param value Doppler scale value to set */ @ALvoid void alDopplerFactor(float value); /** * The Doppler Effect depends on the velocities of Source and Listener relative to the * medium, and the propagation speed of sound in that medium. The application * might want to emphasize or de-emphasize the Doppler Effect as physically accurate * calculation might not give the desired results. The amount of frequency shift (pitch * change) is proportional to the speed of listener and source along their line of sight. * The application can increase or decrease that frequency shift by specifying the * scaling factor AL should apply to the result of the calculation. *
      *
      * The Doppler Effect as implemented by AL is described by the formula below. Effects * of the medium (air, water) moving with respect to listener and source are ignored. * AL_DOPPLER_VELOCITY is the propagation speed relative to which the Source * velocities are interpreted. * *

      *

      	 *	 VD: AL_DOPPLER_VELOCITY
      	 *	 DF: AL_DOPPLER_FACTOR
      	 *	 vl: Listener velocity (scalar, projected on source-listener vector)
      	 *	 vs: Source verlocity (scalar, projected on source-listener vector)
      	 *	 f: Frequency in sample
      	 *	 f': effective Doppler shifted frequency
      	 *
      	 *	 f' = DF * f * (VD-vl)/(VD+vs)
      	 *
      	 *	 vl<0, vs>0 : source and listener approaching each other
      	 *	 vl>0, vs<0 : source and listener moving away from each other
      	 * 
      *

      *

      * The implementation has to clamp the projected Listener velocity vl, if abs(vl) is * greater or equal VD. It similarly has to clamp the projected Source velocity vs if * abs(vs) is greater or equal VD. *

      *

      * There are two API calls global to the current context that provide control of the two * related parameters. *

      *

      * AL_DOPPLER_VELOCITY allows the application to change the reference (propagation) * velocity used in the Doppler Effect calculation. This permits the application to use a * velocity scale appropriate to its purposes. *

      *

      * A negative or zero value will result in an AL_INVALID_VALUE error, the command is * then ignored. The default value is 1. The current setting can be queried using * GetFloatv and AL_DOPPLER_VELOCITY. *

      * * @param value Doppler velocity value to set */ @ALvoid void alDopplerVelocity(float value); } lwjgl-2.7.1/src/templates/org/lwjgl/openal/EFX10.java0000644000175000017500000007350311543426511021331 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.openal; import java.nio.FloatBuffer; import java.nio.IntBuffer; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.openal.ALenum; import org.lwjgl.util.generator.openal.ALsizei; import org.lwjgl.util.generator.openal.ALuint; import org.lwjgl.util.generator.openal.ALvoid; import org.lwjgl.util.generator.Alternate; /** * Implementation of the OpenAL extension ALC_EXT_EFX (version 1.0). Contains necessary fields, * methods and a range of supplementary fields containing minimum, maximum and default values of * the former fields. *

      * On top of regular functions defined in the ALC_EXT_EFX, there are also several convenience * functions. Namely alGen... and alDelete... which do not take a Java buffer parameter and * automatically create or delete a single object, without the overhead of using a buffer. *

      * For comments and specification of functions and fields, refer to the "Effects Extension Guide" * which is part of the OpenAL SDK and can be downloaded from: * http://connect.creativelabs.com/openal/Downloads/Forms/AllItems.aspx * * @author Ciardhubh * @version $Revision$ * $Id$ */ public interface EFX10 { // ALC properties String ALC_EXT_EFX_NAME = "ALC_EXT_EFX"; int ALC_EFX_MAJOR_VERSION = 0x20001; int ALC_EFX_MINOR_VERSION = 0x20002; int ALC_MAX_AUXILIARY_SENDS = 0x20003; // Listener properties int AL_METERS_PER_UNIT = 0x20004; // Source properties int AL_DIRECT_FILTER = 0x20005; int AL_AUXILIARY_SEND_FILTER = 0x20006; int AL_AIR_ABSORPTION_FACTOR = 0x20007; int AL_ROOM_ROLLOFF_FACTOR = 0x20008; int AL_CONE_OUTER_GAINHF = 0x20009; int AL_DIRECT_FILTER_GAINHF_AUTO = 0x2000A; int AL_AUXILIARY_SEND_FILTER_GAIN_AUTO = 0x2000B; int AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO = 0x2000C; // Auxiliary effect slot properties int AL_EFFECTSLOT_EFFECT = 0x0001; int AL_EFFECTSLOT_GAIN = 0x0002; int AL_EFFECTSLOT_AUXILIARY_SEND_AUTO = 0x0003; // NULL auxiliary slot ID to disable a source send int AL_EFFECTSLOT_NULL = 0x0000; // Effect parameters // Reverb int AL_REVERB_DENSITY = 0x0001; int AL_REVERB_DIFFUSION = 0x0002; int AL_REVERB_GAIN = 0x0003; int AL_REVERB_GAINHF = 0x0004; int AL_REVERB_DECAY_TIME = 0x0005; int AL_REVERB_DECAY_HFRATIO = 0x0006; int AL_REVERB_REFLECTIONS_GAIN = 0x0007; int AL_REVERB_REFLECTIONS_DELAY = 0x0008; int AL_REVERB_LATE_REVERB_GAIN = 0x0009; int AL_REVERB_LATE_REVERB_DELAY = 0x000A; int AL_REVERB_AIR_ABSORPTION_GAINHF = 0x000B; int AL_REVERB_ROOM_ROLLOFF_FACTOR = 0x000C; int AL_REVERB_DECAY_HFLIMIT = 0x000D; // EAX Reverb int AL_EAXREVERB_DENSITY = 0x0001; int AL_EAXREVERB_DIFFUSION = 0x0002; int AL_EAXREVERB_GAIN = 0x0003; int AL_EAXREVERB_GAINHF = 0x0004; int AL_EAXREVERB_GAINLF = 0x0005; int AL_EAXREVERB_DECAY_TIME = 0x0006; int AL_EAXREVERB_DECAY_HFRATIO = 0x0007; int AL_EAXREVERB_DECAY_LFRATIO = 0x0008; int AL_EAXREVERB_REFLECTIONS_GAIN = 0x0009; int AL_EAXREVERB_REFLECTIONS_DELAY = 0x000A; int AL_EAXREVERB_REFLECTIONS_PAN = 0x000B; int AL_EAXREVERB_LATE_REVERB_GAIN = 0x000C; int AL_EAXREVERB_LATE_REVERB_DELAY = 0x000D; int AL_EAXREVERB_LATE_REVERB_PAN = 0x000E; int AL_EAXREVERB_ECHO_TIME = 0x000F; int AL_EAXREVERB_ECHO_DEPTH = 0x0010; int AL_EAXREVERB_MODULATION_TIME = 0x0011; int AL_EAXREVERB_MODULATION_DEPTH = 0x0012; int AL_EAXREVERB_AIR_ABSORPTION_GAINHF = 0x0013; int AL_EAXREVERB_HFREFERENCE = 0x0014; int AL_EAXREVERB_LFREFERENCE = 0x0015; int AL_EAXREVERB_ROOM_ROLLOFF_FACTOR = 0x0016; int AL_EAXREVERB_DECAY_HFLIMIT = 0x0017; // Chorus int AL_CHORUS_WAVEFORM = 0x0001; int AL_CHORUS_PHASE = 0x0002; int AL_CHORUS_RATE = 0x0003; int AL_CHORUS_DEPTH = 0x0004; int AL_CHORUS_FEEDBACK = 0x0005; int AL_CHORUS_DELAY = 0x0006; // Distortion int AL_DISTORTION_EDGE = 0x0001; int AL_DISTORTION_GAIN = 0x0002; int AL_DISTORTION_LOWPASS_CUTOFF = 0x0003; int AL_DISTORTION_EQCENTER = 0x0004; int AL_DISTORTION_EQBANDWIDTH = 0x0005; // Echo int AL_ECHO_DELAY = 0x0001; int AL_ECHO_LRDELAY = 0x0002; int AL_ECHO_DAMPING = 0x0003; int AL_ECHO_FEEDBACK = 0x0004; int AL_ECHO_SPREAD = 0x0005; // Flanger int AL_FLANGER_WAVEFORM = 0x0001; int AL_FLANGER_PHASE = 0x0002; int AL_FLANGER_RATE = 0x0003; int AL_FLANGER_DEPTH = 0x0004; int AL_FLANGER_FEEDBACK = 0x0005; int AL_FLANGER_DELAY = 0x0006; // Frequency shifter int AL_FREQUENCY_SHIFTER_FREQUENCY = 0x0001; int AL_FREQUENCY_SHIFTER_LEFT_DIRECTION = 0x0002; int AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION = 0x0003; // Vocal morpher int AL_VOCAL_MORPHER_PHONEMEA = 0x0001; int AL_VOCAL_MORPHER_PHONEMEA_COARSE_TUNING = 0x0002; int AL_VOCAL_MORPHER_PHONEMEB = 0x0003; int AL_VOCAL_MORPHER_PHONEMEB_COARSE_TUNING = 0x0004; int AL_VOCAL_MORPHER_WAVEFORM = 0x0005; int AL_VOCAL_MORPHER_RATE = 0x0006; // Pitch shifter int AL_PITCH_SHIFTER_COARSE_TUNE = 0x0001; int AL_PITCH_SHIFTER_FINE_TUNE = 0x0002; // Ring modulator int AL_RING_MODULATOR_FREQUENCY = 0x0001; int AL_RING_MODULATOR_HIGHPASS_CUTOFF = 0x0002; int AL_RING_MODULATOR_WAVEFORM = 0x0003; // Autowah int AL_AUTOWAH_ATTACK_TIME = 0x0001; int AL_AUTOWAH_RELEASE_TIME = 0x0002; int AL_AUTOWAH_RESONANCE = 0x0003; int AL_AUTOWAH_PEAK_GAIN = 0x0004; // Compressor int AL_COMPRESSOR_ONOFF = 0x0001; // Equalizer int AL_EQUALIZER_LOW_GAIN = 0x0001; int AL_EQUALIZER_LOW_CUTOFF = 0x0002; int AL_EQUALIZER_MID1_GAIN = 0x0003; int AL_EQUALIZER_MID1_CENTER = 0x0004; int AL_EQUALIZER_MID1_WIDTH = 0x0005; int AL_EQUALIZER_MID2_GAIN = 0x0006; int AL_EQUALIZER_MID2_CENTER = 0x0007; int AL_EQUALIZER_MID2_WIDTH = 0x0008; int AL_EQUALIZER_HIGH_GAIN = 0x0009; int AL_EQUALIZER_HIGH_CUTOFF = 0x000A; // Effect type int AL_EFFECT_FIRST_PARAMETER = 0x0000; int AL_EFFECT_LAST_PARAMETER = 0x8000; int AL_EFFECT_TYPE = 0x8001; // Effect types, used with AL_EFFECT_TYPE int AL_EFFECT_NULL = 0x0000; int AL_EFFECT_REVERB = 0x0001; int AL_EFFECT_CHORUS = 0x0002; int AL_EFFECT_DISTORTION = 0x0003; int AL_EFFECT_ECHO = 0x0004; int AL_EFFECT_FLANGER = 0x0005; int AL_EFFECT_FREQUENCY_SHIFTER = 0x0006; int AL_EFFECT_VOCAL_MORPHER = 0x0007; int AL_EFFECT_PITCH_SHIFTER = 0x0008; int AL_EFFECT_RING_MODULATOR = 0x0009; int AL_EFFECT_AUTOWAH = 0x000A; int AL_EFFECT_COMPRESSOR = 0x000B; int AL_EFFECT_EQUALIZER = 0x000C; int AL_EFFECT_EAXREVERB = 0x8000; // Filter properties // Lowpass int AL_LOWPASS_GAIN = 0x0001; int AL_LOWPASS_GAINHF = 0x0002; // Highpass int AL_HIGHPASS_GAIN = 0x0001; int AL_HIGHPASS_GAINLF = 0x0002; // Bandpass int AL_BANDPASS_GAIN = 0x0001; int AL_BANDPASS_GAINLF = 0x0002; int AL_BANDPASS_GAINHF = 0x0003; // Filter type int AL_FILTER_FIRST_PARAMETER = 0x0000; int AL_FILTER_LAST_PARAMETER = 0x8000; int AL_FILTER_TYPE = 0x8001; // Filter types, used with the AL_FILTER_TYPE property int AL_FILTER_NULL = 0x0000; int AL_FILTER_LOWPASS = 0x0001; int AL_FILTER_HIGHPASS = 0x0002; int AL_FILTER_BANDPASS = 0x0003; // Auxiliary effect slot object functions @ALvoid void alGenAuxiliaryEffectSlots(@AutoSize("auxiliaryeffectslots") @ALsizei int n, @OutParameter @ALuint IntBuffer auxiliaryeffectslots); @Alternate(value = "alGenAuxiliaryEffectSlots", nativeAlt = true) @ALvoid void alGenAuxiliaryEffectSlots2(@Constant("1") @ALsizei int n, @Result @ALuint int auxiliaryeffectslot); @ALvoid void alDeleteAuxiliaryEffectSlots(@AutoSize("auxiliaryeffectslots") @ALsizei int n, @OutParameter @ALuint IntBuffer auxiliaryeffectslots); @Alternate(value = "alDeleteAuxiliaryEffectSlots", nativeAlt = true) @ALvoid void alDeleteAuxiliaryEffectSlots2(@Constant("1") @ALsizei int n, @Indirect @ALuint int auxiliaryeffectslot); boolean alIsAuxiliaryEffectSlot(@ALuint int auxiliaryeffectslot); @ALvoid void alAuxiliaryEffectSloti(@ALuint int auxiliaryeffectslot, @ALenum int param, int value); @StripPostfix("values") @ALvoid void alAuxiliaryEffectSlotiv(@ALuint int auxiliaryeffectslot, @ALenum int param, @Check("1") @Const IntBuffer values); @ALvoid void alAuxiliaryEffectSlotf(@ALuint int auxiliaryeffectslot, @ALenum int param, float value); @StripPostfix("values") @ALvoid void alAuxiliaryEffectSlotfv(@ALuint int auxiliaryeffectslot, @ALenum int param, @Check("1") @Const FloatBuffer values); @ALvoid void alGetAuxiliaryEffectSloti(@ALuint int auxiliaryeffectslot, @ALenum int param, @Result int value); @StripPostfix("intdata") @ALvoid void alGetAuxiliaryEffectSlotiv(@ALuint int auxiliaryeffectslot, @ALenum int param, @OutParameter @Check("1") IntBuffer intdata); @ALvoid void alGetAuxiliaryEffectSlotf(@ALuint int auxiliaryeffectslot, @ALenum int param, @Result float value); @StripPostfix("floatdata") @ALvoid void alGetAuxiliaryEffectSlotfv(@ALuint int auxiliaryeffectslot, @ALenum int param, @OutParameter @Check("1") FloatBuffer floatdata); // Effect object functions @ALvoid void alGenEffects(@AutoSize("effects") @ALsizei int n, @OutParameter @ALuint IntBuffer effects); @Alternate(value = "alGenEffects", nativeAlt = true) @ALvoid void alGenEffects2(@Constant("1") @ALsizei int n, @Result @ALuint int effect); @ALvoid void alDeleteEffects(@AutoSize("effects") @ALsizei int n, @OutParameter @ALuint IntBuffer effects); @Alternate(value = "alDeleteEffects", nativeAlt = true) @ALvoid void alDeleteEffects2(@Constant("1") @ALsizei int n, @Indirect @ALuint int effect); boolean alIsEffect(@ALuint int effect); @ALvoid void alEffecti(@ALuint int effect, @ALenum int param, int value); @StripPostfix("values") @ALvoid void alEffectiv(@ALuint int effect, @ALenum int param, @Check("1") @Const IntBuffer values); @ALvoid void alEffectf(@ALuint int effect, @ALenum int param, float value); @StripPostfix("values") @ALvoid void alEffectfv(@ALuint int effect, @ALenum int param, @Check("1") @Const FloatBuffer values); @ALvoid void alGetEffecti(@ALuint int effect, @ALenum int param, @Result int value); @StripPostfix("intdata") @ALvoid void alGetEffectiv(@ALuint int effect, @ALenum int param, @OutParameter @Check("1") IntBuffer intdata); @ALvoid void alGetEffectf(@ALuint int effect, @ALenum int param, @Result float value); @StripPostfix("floatdata") @ALvoid void alGetEffectfv(@ALuint int effect, @ALenum int param, @OutParameter @Check("1") FloatBuffer floatdata); // Filter object functions @ALvoid void alGenFilters(@AutoSize("filters") @ALsizei int n, @OutParameter @ALuint IntBuffer filters); @Alternate(value = "alGenFilters", nativeAlt = true) @ALvoid void alGenFilters2(@Constant("1") @ALsizei int n, @Result @ALuint int filter); @ALvoid void alDeleteFilters(@AutoSize("filters") @ALsizei int n, @OutParameter @ALuint IntBuffer filters); @Alternate(value = "alDeleteFilters", nativeAlt = true) @ALvoid void alDeleteFilters2(@Constant("1") @ALsizei int n, @Indirect @ALuint int filter); boolean alIsFilter(@ALuint int filter); @ALvoid void alFilteri(@ALuint int filter, @ALenum int param, int value); @StripPostfix("values") @ALvoid void alFilteriv(@ALuint int filter, @ALenum int param, @Check("1") @Const IntBuffer values); @ALvoid void alFilterf(@ALuint int filter, @ALenum int param, float value); @StripPostfix("values") @ALvoid void alFilterfv(@ALuint int filter, @ALenum int param, @Check("1") @Const FloatBuffer values); @ALvoid void alGetFilteri(@ALuint int filter, @ALenum int param, @Result int value); @StripPostfix("intdata") @ALvoid void alGetFilteriv(@ALuint int filter, @ALenum int param, @OutParameter @Check("1") IntBuffer intdata); @ALvoid void alGetFilterf(@ALuint int filter, @ALenum int param, @Result float value); @StripPostfix("floatdata") @ALvoid void alGetFilterfv(@ALuint int filter, @ALenum int param, @OutParameter @Check("1") FloatBuffer floatdata); // Source property value ranges and defaults float AL_MIN_AIR_ABSORPTION_FACTOR = 0.0f; float AL_MAX_AIR_ABSORPTION_FACTOR = 10.0f; float AL_DEFAULT_AIR_ABSORPTION_FACTOR = 0.0f; float AL_MIN_ROOM_ROLLOFF_FACTOR = 0.0f; float AL_MAX_ROOM_ROLLOFF_FACTOR = 10.0f; float AL_DEFAULT_ROOM_ROLLOFF_FACTOR = 0.0f; float AL_MIN_CONE_OUTER_GAINHF = 0.0f; float AL_MAX_CONE_OUTER_GAINHF = 1.0f; float AL_DEFAULT_CONE_OUTER_GAINHF = 1.0f; int AL_MIN_DIRECT_FILTER_GAINHF_AUTO = AL10.AL_FALSE; int AL_MAX_DIRECT_FILTER_GAINHF_AUTO = AL10.AL_TRUE; int AL_DEFAULT_DIRECT_FILTER_GAINHF_AUTO = AL10.AL_TRUE; int AL_MIN_AUXILIARY_SEND_FILTER_GAIN_AUTO = AL10.AL_FALSE; int AL_MAX_AUXILIARY_SEND_FILTER_GAIN_AUTO = AL10.AL_TRUE; int AL_DEFAULT_AUXILIARY_SEND_FILTER_GAIN_AUTO = AL10.AL_TRUE; int AL_MIN_AUXILIARY_SEND_FILTER_GAINHF_AUTO = AL10.AL_FALSE; int AL_MAX_AUXILIARY_SEND_FILTER_GAINHF_AUTO = AL10.AL_TRUE; int AL_DEFAULT_AUXILIARY_SEND_FILTER_GAINHF_AUTO = AL10.AL_TRUE; // Listener property value ranges and defaults float AL_MIN_METERS_PER_UNIT = Float.MIN_VALUE; float AL_MAX_METERS_PER_UNIT = Float.MAX_VALUE; float AL_DEFAULT_METERS_PER_UNIT = 1.0f; // Effect parameter ranges and defaults // Reverb float AL_REVERB_MIN_DENSITY = 0.0f; float AL_REVERB_MAX_DENSITY = 1.0f; float AL_REVERB_DEFAULT_DENSITY = 1.0f; float AL_REVERB_MIN_DIFFUSION = 0.0f; float AL_REVERB_MAX_DIFFUSION = 1.0f; float AL_REVERB_DEFAULT_DIFFUSION = 1.0f; float AL_REVERB_MIN_GAIN = 0.0f; float AL_REVERB_MAX_GAIN = 1.0f; float AL_REVERB_DEFAULT_GAIN = 0.32f; float AL_REVERB_MIN_GAINHF = 0.0f; float AL_REVERB_MAX_GAINHF = 1.0f; float AL_REVERB_DEFAULT_GAINHF = 0.89f; float AL_REVERB_MIN_DECAY_TIME = 0.1f; float AL_REVERB_MAX_DECAY_TIME = 20.0f; float AL_REVERB_DEFAULT_DECAY_TIME = 1.49f; float AL_REVERB_MIN_DECAY_HFRATIO = 0.1f; float AL_REVERB_MAX_DECAY_HFRATIO = 2.0f; float AL_REVERB_DEFAULT_DECAY_HFRATIO = 0.83f; float AL_REVERB_MIN_REFLECTIONS_GAIN = 0.0f; float AL_REVERB_MAX_REFLECTIONS_GAIN = 3.16f; float AL_REVERB_DEFAULT_REFLECTIONS_GAIN = 0.05f; float AL_REVERB_MIN_REFLECTIONS_DELAY = 0.0f; float AL_REVERB_MAX_REFLECTIONS_DELAY = 0.3f; float AL_REVERB_DEFAULT_REFLECTIONS_DELAY = 0.007f; float AL_REVERB_MIN_LATE_REVERB_GAIN = 0.0f; float AL_REVERB_MAX_LATE_REVERB_GAIN = 10.0f; float AL_REVERB_DEFAULT_LATE_REVERB_GAIN = 1.26f; float AL_REVERB_MIN_LATE_REVERB_DELAY = 0.0f; float AL_REVERB_MAX_LATE_REVERB_DELAY = 0.1f; float AL_REVERB_DEFAULT_LATE_REVERB_DELAY = 0.011f; float AL_REVERB_MIN_AIR_ABSORPTION_GAINHF = 0.892f; float AL_REVERB_MAX_AIR_ABSORPTION_GAINHF = 1.0f; float AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF = 0.994f; float AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR = 0.0f; float AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR = 10.0f; float AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR = 0.0f; int AL_REVERB_MIN_DECAY_HFLIMIT = AL10.AL_FALSE; int AL_REVERB_MAX_DECAY_HFLIMIT = AL10.AL_TRUE; int AL_REVERB_DEFAULT_DECAY_HFLIMIT = AL10.AL_TRUE; // EAX reverb float AL_EAXREVERB_MIN_DENSITY = 0.0f; float AL_EAXREVERB_MAX_DENSITY = 1.0f; float AL_EAXREVERB_DEFAULT_DENSITY = 1.0f; float AL_EAXREVERB_MIN_DIFFUSION = 0.0f; float AL_EAXREVERB_MAX_DIFFUSION = 1.0f; float AL_EAXREVERB_DEFAULT_DIFFUSION = 1.0f; float AL_EAXREVERB_MIN_GAIN = 0.0f; float AL_EAXREVERB_MAX_GAIN = 1.0f; float AL_EAXREVERB_DEFAULT_GAIN = 0.32f; float AL_EAXREVERB_MIN_GAINHF = 0.0f; float AL_EAXREVERB_MAX_GAINHF = 1.0f; float AL_EAXREVERB_DEFAULT_GAINHF = 0.89f; float AL_EAXREVERB_MIN_GAINLF = 0.0f; float AL_EAXREVERB_MAX_GAINLF = 1.0f; float AL_EAXREVERB_DEFAULT_GAINLF = 1.0f; float AL_EAXREVERB_MIN_DECAY_TIME = 0.1f; float AL_EAXREVERB_MAX_DECAY_TIME = 20.0f; float AL_EAXREVERB_DEFAULT_DECAY_TIME = 1.49f; float AL_EAXREVERB_MIN_DECAY_HFRATIO = 0.1f; float AL_EAXREVERB_MAX_DECAY_HFRATIO = 2.0f; float AL_EAXREVERB_DEFAULT_DECAY_HFRATIO = 0.83f; float AL_EAXREVERB_MIN_DECAY_LFRATIO = 0.1f; float AL_EAXREVERB_MAX_DECAY_LFRATIO = 2.0f; float AL_EAXREVERB_DEFAULT_DECAY_LFRATIO = 1.0f; float AL_EAXREVERB_MIN_REFLECTIONS_GAIN = 0.0f; float AL_EAXREVERB_MAX_REFLECTIONS_GAIN = 3.16f; float AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN = 0.05f; float AL_EAXREVERB_MIN_REFLECTIONS_DELAY = 0.0f; float AL_EAXREVERB_MAX_REFLECTIONS_DELAY = 0.3f; float AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY = 0.007f; float AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ = 0.0f; float AL_EAXREVERB_MIN_LATE_REVERB_GAIN = 0.0f; float AL_EAXREVERB_MAX_LATE_REVERB_GAIN = 10.0f; float AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN = 1.26f; float AL_EAXREVERB_MIN_LATE_REVERB_DELAY = 0.0f; float AL_EAXREVERB_MAX_LATE_REVERB_DELAY = 0.1f; float AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY = 0.011f; float AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ = 0.0f; float AL_EAXREVERB_MIN_ECHO_TIME = 0.075f; float AL_EAXREVERB_MAX_ECHO_TIME = 0.25f; float AL_EAXREVERB_DEFAULT_ECHO_TIME = 0.25f; float AL_EAXREVERB_MIN_ECHO_DEPTH = 0.0f; float AL_EAXREVERB_MAX_ECHO_DEPTH = 1.0f; float AL_EAXREVERB_DEFAULT_ECHO_DEPTH = 0.0f; float AL_EAXREVERB_MIN_MODULATION_TIME = 0.04f; float AL_EAXREVERB_MAX_MODULATION_TIME = 4.0f; float AL_EAXREVERB_DEFAULT_MODULATION_TIME = 0.25f; float AL_EAXREVERB_MIN_MODULATION_DEPTH = 0.0f; float AL_EAXREVERB_MAX_MODULATION_DEPTH = 1.0f; float AL_EAXREVERB_DEFAULT_MODULATION_DEPTH = 0.0f; float AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF = 0.892f; float AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF = 1.0f; float AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF = 0.994f; float AL_EAXREVERB_MIN_HFREFERENCE = 1000.0f; float AL_EAXREVERB_MAX_HFREFERENCE = 20000.0f; float AL_EAXREVERB_DEFAULT_HFREFERENCE = 5000.0f; float AL_EAXREVERB_MIN_LFREFERENCE = 20.0f; float AL_EAXREVERB_MAX_LFREFERENCE = 1000.0f; float AL_EAXREVERB_DEFAULT_LFREFERENCE = 250.0f; float AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR = 0.0f; float AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR = 10.0f; float AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR = 0.0f; int AL_EAXREVERB_MIN_DECAY_HFLIMIT = AL10.AL_FALSE; int AL_EAXREVERB_MAX_DECAY_HFLIMIT = AL10.AL_TRUE; int AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT = AL10.AL_TRUE; // Chorus int AL_CHORUS_WAVEFORM_SINUSOID = 0; int AL_CHORUS_WAVEFORM_TRIANGLE = 1; int AL_CHORUS_MIN_WAVEFORM = 0; int AL_CHORUS_MAX_WAVEFORM = 1; int AL_CHORUS_DEFAULT_WAVEFORM = 1; int AL_CHORUS_MIN_PHASE = -180; int AL_CHORUS_MAX_PHASE = 180; int AL_CHORUS_DEFAULT_PHASE = 90; float AL_CHORUS_MIN_RATE = 0.0f; float AL_CHORUS_MAX_RATE = 10.0f; float AL_CHORUS_DEFAULT_RATE = 1.1f; float AL_CHORUS_MIN_DEPTH = 0.0f; float AL_CHORUS_MAX_DEPTH = 1.0f; float AL_CHORUS_DEFAULT_DEPTH = 0.1f; float AL_CHORUS_MIN_FEEDBACK = -1.0f; float AL_CHORUS_MAX_FEEDBACK = 1.0f; float AL_CHORUS_DEFAULT_FEEDBACK = 0.25f; float AL_CHORUS_MIN_DELAY = 0.0f; float AL_CHORUS_MAX_DELAY = 0.016f; float AL_CHORUS_DEFAULT_DELAY = 0.016f; // Distortion float AL_DISTORTION_MIN_EDGE = 0.0f; float AL_DISTORTION_MAX_EDGE = 1.0f; float AL_DISTORTION_DEFAULT_EDGE = 0.2f; float AL_DISTORTION_MIN_GAIN = 0.01f; float AL_DISTORTION_MAX_GAIN = 1.0f; float AL_DISTORTION_DEFAULT_GAIN = 0.05f; float AL_DISTORTION_MIN_LOWPASS_CUTOFF = 80.0f; float AL_DISTORTION_MAX_LOWPASS_CUTOFF = 24000.0f; float AL_DISTORTION_DEFAULT_LOWPASS_CUTOFF = 8000.0f; float AL_DISTORTION_MIN_EQCENTER = 80.0f; float AL_DISTORTION_MAX_EQCENTER = 24000.0f; float AL_DISTORTION_DEFAULT_EQCENTER = 3600.0f; float AL_DISTORTION_MIN_EQBANDWIDTH = 80.0f; float AL_DISTORTION_MAX_EQBANDWIDTH = 24000.0f; float AL_DISTORTION_DEFAULT_EQBANDWIDTH = 3600.0f; // Echo float AL_ECHO_MIN_DELAY = 0.0f; float AL_ECHO_MAX_DELAY = 0.207f; float AL_ECHO_DEFAULT_DELAY = 0.1f; float AL_ECHO_MIN_LRDELAY = 0.0f; float AL_ECHO_MAX_LRDELAY = 0.404f; float AL_ECHO_DEFAULT_LRDELAY = 0.1f; float AL_ECHO_MIN_DAMPING = 0.0f; float AL_ECHO_MAX_DAMPING = 0.99f; float AL_ECHO_DEFAULT_DAMPING = 0.5f; float AL_ECHO_MIN_FEEDBACK = 0.0f; float AL_ECHO_MAX_FEEDBACK = 1.0f; float AL_ECHO_DEFAULT_FEEDBACK = 0.5f; float AL_ECHO_MIN_SPREAD = -1.0f; float AL_ECHO_MAX_SPREAD = 1.0f; float AL_ECHO_DEFAULT_SPREAD = -1.0f; // Flanger int AL_FLANGER_WAVEFORM_SINUSOID = 0; int AL_FLANGER_WAVEFORM_TRIANGLE = 1; int AL_FLANGER_MIN_WAVEFORM = 0; int AL_FLANGER_MAX_WAVEFORM = 1; int AL_FLANGER_DEFAULT_WAVEFORM = 1; int AL_FLANGER_MIN_PHASE = -180; int AL_FLANGER_MAX_PHASE = 180; int AL_FLANGER_DEFAULT_PHASE = 0; float AL_FLANGER_MIN_RATE = 0.0f; float AL_FLANGER_MAX_RATE = 10.0f; float AL_FLANGER_DEFAULT_RATE = 0.27f; float AL_FLANGER_MIN_DEPTH = 0.0f; float AL_FLANGER_MAX_DEPTH = 1.0f; float AL_FLANGER_DEFAULT_DEPTH = 1.0f; float AL_FLANGER_MIN_FEEDBACK = -1.0f; float AL_FLANGER_MAX_FEEDBACK = 1.0f; float AL_FLANGER_DEFAULT_FEEDBACK = -0.5f; float AL_FLANGER_MIN_DELAY = 0.0f; float AL_FLANGER_MAX_DELAY = 0.004f; float AL_FLANGER_DEFAULT_DELAY = 0.002f; // Frequency shifter float AL_FREQUENCY_SHIFTER_MIN_FREQUENCY = 0.0f; float AL_FREQUENCY_SHIFTER_MAX_FREQUENCY = 24000.0f; float AL_FREQUENCY_SHIFTER_DEFAULT_FREQUENCY = 0.0f; int AL_FREQUENCY_SHIFTER_MIN_LEFT_DIRECTION = 0; int AL_FREQUENCY_SHIFTER_MAX_LEFT_DIRECTION = 2; int AL_FREQUENCY_SHIFTER_DEFAULT_LEFT_DIRECTION = 0; int AL_FREQUENCY_SHIFTER_DIRECTION_DOWN = 0; int AL_FREQUENCY_SHIFTER_DIRECTION_UP = 1; int AL_FREQUENCY_SHIFTER_DIRECTION_OFF = 2; int AL_FREQUENCY_SHIFTER_MIN_RIGHT_DIRECTION = 0; int AL_FREQUENCY_SHIFTER_MAX_RIGHT_DIRECTION = 2; int AL_FREQUENCY_SHIFTER_DEFAULT_RIGHT_DIRECTION = 0; // Vocal morpher int AL_VOCAL_MORPHER_MIN_PHONEMEA = 0; int AL_VOCAL_MORPHER_MAX_PHONEMEA = 29; int AL_VOCAL_MORPHER_DEFAULT_PHONEMEA = 0; int AL_VOCAL_MORPHER_MIN_PHONEMEA_COARSE_TUNING = -24; int AL_VOCAL_MORPHER_MAX_PHONEMEA_COARSE_TUNING = 24; int AL_VOCAL_MORPHER_DEFAULT_PHONEMEA_COARSE_TUNING = 0; int AL_VOCAL_MORPHER_MIN_PHONEMEB = 0; int AL_VOCAL_MORPHER_MAX_PHONEMEB = 29; int AL_VOCAL_MORPHER_DEFAULT_PHONEMEB = 10; int AL_VOCAL_MORPHER_MIN_PHONEMEB_COARSE_TUNING = -24; int AL_VOCAL_MORPHER_MAX_PHONEMEB_COARSE_TUNING = 24; int AL_VOCAL_MORPHER_DEFAULT_PHONEMEB_COARSE_TUNING = 0; int AL_VOCAL_MORPHER_PHONEME_A = 0; int AL_VOCAL_MORPHER_PHONEME_E = 1; int AL_VOCAL_MORPHER_PHONEME_I = 2; int AL_VOCAL_MORPHER_PHONEME_O = 3; int AL_VOCAL_MORPHER_PHONEME_U = 4; int AL_VOCAL_MORPHER_PHONEME_AA = 5; int AL_VOCAL_MORPHER_PHONEME_AE = 6; int AL_VOCAL_MORPHER_PHONEME_AH = 7; int AL_VOCAL_MORPHER_PHONEME_AO = 8; int AL_VOCAL_MORPHER_PHONEME_EH = 9; int AL_VOCAL_MORPHER_PHONEME_ER = 10; int AL_VOCAL_MORPHER_PHONEME_IH = 11; int AL_VOCAL_MORPHER_PHONEME_IY = 12; int AL_VOCAL_MORPHER_PHONEME_UH = 13; int AL_VOCAL_MORPHER_PHONEME_UW = 14; int AL_VOCAL_MORPHER_PHONEME_B = 15; int AL_VOCAL_MORPHER_PHONEME_D = 16; int AL_VOCAL_MORPHER_PHONEME_F = 17; int AL_VOCAL_MORPHER_PHONEME_G = 18; int AL_VOCAL_MORPHER_PHONEME_J = 19; int AL_VOCAL_MORPHER_PHONEME_K = 20; int AL_VOCAL_MORPHER_PHONEME_L = 21; int AL_VOCAL_MORPHER_PHONEME_M = 22; int AL_VOCAL_MORPHER_PHONEME_N = 23; int AL_VOCAL_MORPHER_PHONEME_P = 24; int AL_VOCAL_MORPHER_PHONEME_R = 25; int AL_VOCAL_MORPHER_PHONEME_S = 26; int AL_VOCAL_MORPHER_PHONEME_T = 27; int AL_VOCAL_MORPHER_PHONEME_V = 28; int AL_VOCAL_MORPHER_PHONEME_Z = 29; int AL_VOCAL_MORPHER_WAVEFORM_SINUSOID = 0; int AL_VOCAL_MORPHER_WAVEFORM_TRIANGLE = 1; int AL_VOCAL_MORPHER_WAVEFORM_SAWTOOTH = 2; int AL_VOCAL_MORPHER_MIN_WAVEFORM = 0; int AL_VOCAL_MORPHER_MAX_WAVEFORM = 2; int AL_VOCAL_MORPHER_DEFAULT_WAVEFORM = 0; float AL_VOCAL_MORPHER_MIN_RATE = 0.0f; float AL_VOCAL_MORPHER_MAX_RATE = 10.0f; float AL_VOCAL_MORPHER_DEFAULT_RATE = 1.41f; // Pitch shifter int AL_PITCH_SHIFTER_MIN_COARSE_TUNE = -12; int AL_PITCH_SHIFTER_MAX_COARSE_TUNE = 12; int AL_PITCH_SHIFTER_DEFAULT_COARSE_TUNE = 12; int AL_PITCH_SHIFTER_MIN_FINE_TUNE = -50; int AL_PITCH_SHIFTER_MAX_FINE_TUNE = 50; int AL_PITCH_SHIFTER_DEFAULT_FINE_TUNE = 0; // Ring modulator float AL_RING_MODULATOR_MIN_FREQUENCY = 0.0f; float AL_RING_MODULATOR_MAX_FREQUENCY = 8000.0f; float AL_RING_MODULATOR_DEFAULT_FREQUENCY = 440.0f; float AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF = 0.0f; float AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF = 24000.0f; float AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF = 800.0f; int AL_RING_MODULATOR_SINUSOID = 0; int AL_RING_MODULATOR_SAWTOOTH = 1; int AL_RING_MODULATOR_SQUARE = 2; int AL_RING_MODULATOR_MIN_WAVEFORM = 0; int AL_RING_MODULATOR_MAX_WAVEFORM = 2; int AL_RING_MODULATOR_DEFAULT_WAVEFORM = 0; // Autowah float AL_AUTOWAH_MIN_ATTACK_TIME = 0.0001f; float AL_AUTOWAH_MAX_ATTACK_TIME = 1.0f; float AL_AUTOWAH_DEFAULT_ATTACK_TIME = 0.06f; float AL_AUTOWAH_MIN_RELEASE_TIME = 0.0001f; float AL_AUTOWAH_MAX_RELEASE_TIME = 1.0f; float AL_AUTOWAH_DEFAULT_RELEASE_TIME = 0.06f; float AL_AUTOWAH_MIN_RESONANCE = 2.0f; float AL_AUTOWAH_MAX_RESONANCE = 1000.0f; float AL_AUTOWAH_DEFAULT_RESONANCE = 1000.0f; float AL_AUTOWAH_MIN_PEAK_GAIN = 0.00003f; float AL_AUTOWAH_MAX_PEAK_GAIN = 31621.0f; float AL_AUTOWAH_DEFAULT_PEAK_GAIN = 11.22f; // Compressor int AL_COMPRESSOR_MIN_ONOFF = 0; int AL_COMPRESSOR_MAX_ONOFF = 1; int AL_COMPRESSOR_DEFAULT_ONOFF = 1; // Equalizer float AL_EQUALIZER_MIN_LOW_GAIN = 0.126f; float AL_EQUALIZER_MAX_LOW_GAIN = 7.943f; float AL_EQUALIZER_DEFAULT_LOW_GAIN = 1.0f; float AL_EQUALIZER_MIN_LOW_CUTOFF = 50.0f; float AL_EQUALIZER_MAX_LOW_CUTOFF = 800.0f; float AL_EQUALIZER_DEFAULT_LOW_CUTOFF = 200.0f; float AL_EQUALIZER_MIN_MID1_GAIN = 0.126f; float AL_EQUALIZER_MAX_MID1_GAIN = 7.943f; float AL_EQUALIZER_DEFAULT_MID1_GAIN = 1.0f; float AL_EQUALIZER_MIN_MID1_CENTER = 200.0f; float AL_EQUALIZER_MAX_MID1_CENTER = 3000.0f; float AL_EQUALIZER_DEFAULT_MID1_CENTER = 500.0f; float AL_EQUALIZER_MIN_MID1_WIDTH = 0.01f; float AL_EQUALIZER_MAX_MID1_WIDTH = 1.0f; float AL_EQUALIZER_DEFAULT_MID1_WIDTH = 1.0f; float AL_EQUALIZER_MIN_MID2_GAIN = 0.126f; float AL_EQUALIZER_MAX_MID2_GAIN = 7.943f; float AL_EQUALIZER_DEFAULT_MID2_GAIN = 1.0f; float AL_EQUALIZER_MIN_MID2_CENTER = 1000.0f; float AL_EQUALIZER_MAX_MID2_CENTER = 8000.0f; float AL_EQUALIZER_DEFAULT_MID2_CENTER = 3000.0f; float AL_EQUALIZER_MIN_MID2_WIDTH = 0.01f; float AL_EQUALIZER_MAX_MID2_WIDTH = 1.0f; float AL_EQUALIZER_DEFAULT_MID2_WIDTH = 1.0f; float AL_EQUALIZER_MIN_HIGH_GAIN = 0.126f; float AL_EQUALIZER_MAX_HIGH_GAIN = 7.943f; float AL_EQUALIZER_DEFAULT_HIGH_GAIN = 1.0f; float AL_EQUALIZER_MIN_HIGH_CUTOFF = 4000.0f; float AL_EQUALIZER_MAX_HIGH_CUTOFF = 16000.0f; float AL_EQUALIZER_DEFAULT_HIGH_CUTOFF = 6000.0f; // Filter parameter ranges and defaults // Lowpass float LOWPASS_MIN_GAIN = 0.0f; float LOWPASS_MAX_GAIN = 1.0f; float LOWPASS_DEFAULT_GAIN = 1.0f; float LOWPASS_MIN_GAINHF = 0.0f; float LOWPASS_MAX_GAINHF = 1.0f; float LOWPASS_DEFAULT_GAINHF = 1.0f; // Highpass float HIGHPASS_MIN_GAIN = 0.0f; float HIGHPASS_MAX_GAIN = 1.0f; float HIGHPASS_DEFAULT_GAIN = 1.0f; float HIGHPASS_MIN_GAINLF = 0.0f; float HIGHPASS_MAX_GAINLF = 1.0f; float HIGHPASS_DEFAULT_GAINLF = 1.0f; // Bandpass float BANDPASS_MIN_GAIN = 0.0f; float BANDPASS_MAX_GAIN = 1.0f; float BANDPASS_DEFAULT_GAIN = 1.0f; float BANDPASS_MIN_GAINHF = 0.0f; float BANDPASS_MAX_GAINHF = 1.0f; float BANDPASS_DEFAULT_GAINHF = 1.0f; float BANDPASS_MIN_GAINLF = 0.0f; float BANDPASS_MAX_GAINLF = 1.0f; float BANDPASS_DEFAULT_GAINLF = 1.0f; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/0000755000175000017500000000000011543426511017701 5ustar zero79zero79lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java0000644000175000017500000000532411543426511025275 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLreturn; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.IntBuffer; public interface ARB_vertex_array_object { /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_VERTEX_ARRAY_BINDING = 0x85B5; @Reuse("GL30") void glBindVertexArray(@GLuint int array); @Reuse("GL30") void glDeleteVertexArrays(@AutoSize("arrays") @GLsizei int n, @Const @GLuint IntBuffer arrays); @Reuse("GL30") @Alternate("glDeleteVertexArrays") void glDeleteVertexArrays(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, array), 0", keepParam = true) int array); @Reuse("GL30") void glGenVertexArrays(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); @Reuse("GL30") @Alternate("glGenVertexArrays") @GLreturn("arrays") void glGenVertexArrays2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); @Reuse("GL30") boolean glIsVertexArray(@GLuint int array); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/APPLE_packed_pixels.java0000644000175000017500000000501711543426511024303 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface APPLE_packed_pixels { /** * Accepted by the <type> parameter of DrawPixels, ReadPixels, TexImage1D, * TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, * TexSubImage2D, TexSubImage3D, GetHistogram, GetMinmax, * ConvolutionFilter1D, ConvolutionFilter2D, ConvolutionFilter3D, * GetConvolutionFilter, SeparableFilter2D, SeparableFilter3D, * GetSeparableFilter, ColorTable, GetColorTable, TexImage4DSGIS, * and TexSubImage4DSGIS: */ int GL_UNSIGNED_BYTE_3_3_2 = 0x8032; int GL_UNSIGNED_BYTE_2_3_3_REV = 0x8362; int GL_UNSIGNED_SHORT_5_6_5 = 0x8363; int GL_UNSIGNED_SHORT_5_6_5_REV = 0x8364; int GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033; int GL_UNSIGNED_SHORT_4_4_4_4_REV = 0x8365; int GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034; int GL_UNSIGNED_SHORT_1_5_5_5_REV = 0x8366; int GL_UNSIGNED_INT_8_8_8_8 = 0x8035; int GL_UNSIGNED_INT_8_8_8_8_REV = 0x8367; int GL_UNSIGNED_INT_10_10_10_2 = 0x8036; int GL_UNSIGNED_INT_2_10_10_10_REV = 0x8368; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_pixel_buffer_object.java0000644000175000017500000000415511543426511025235 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_pixel_buffer_object extends ARB_buffer_object { /** * Accepted by the <target> parameters of BindBuffer, BufferData, * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, * GetBufferParameteriv, and GetBufferPointerv: */ int GL_PIXEL_PACK_BUFFER_ARB = 0x88EB; int GL_PIXEL_UNPACK_BUFFER_ARB = 0x88EC; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_PIXEL_PACK_BUFFER_BINDING_ARB = 0x88ED; int GL_PIXEL_UNPACK_BUFFER_BINDING_ARB = 0x88EF; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_framebuffer_blit.java0000644000175000017500000000644211543426511024570 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLbitfield; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLint; public interface EXT_framebuffer_blit { /** Accepted by the <target> parameter of BindFramebufferEXT, CheckFramebufferStatusEXT, FramebufferTexture{1D|2D|3D}EXT, FramebufferRenderbufferEXT, and GetFramebufferAttachmentParameterivEXT. */ int GL_READ_FRAMEBUFFER_EXT = 0x8CA8; int GL_DRAW_FRAMEBUFFER_EXT = 0x8CA9; /** Accepted by the <pname> parameters of GetIntegerv, GetFloatv, and GetDoublev. */ int GL_DRAW_FRAMEBUFFER_BINDING_EXT = 0x8CA6; // alias FRAMEBUFFER_BINDING_EXT int GL_READ_FRAMEBUFFER_BINDING_EXT = 0x8CAA; /** Transfers a rectangle of pixel values from one region of the read framebuffer to another in the draw framebuffer. <mask> is the bitwise OR of a number of values indicating which buffers are to be copied. The values are COLOR_BUFFER_BIT, DEPTH_BUFFER_BIT, and STENCIL_BUFFER_BIT. The pixels corresponding to these buffers are copied from the source rectangle, bound by the locations (srcX0, srcY0) and (srcX1, srcY1) inclusive, to the destination rectangle, bound by the locations (dstX0, dstY0) and (dstX1, dstY1) inclusive. If the source and destination rectangle dimensions do not match, the source image is stretched to fit the destination rectangle. <filter> must be LINEAR or NEAREST and specifies the method of interpolation to be applied if the image is stretched. */ void glBlitFramebufferEXT( @GLint int srcX0, @GLint int srcY0, @GLint int srcX1, @GLint int srcY1, @GLint int dstX0, @GLint int dstY0, @GLint int dstX1, @GLint int dstY1, @GLbitfield int mask, @GLenum int filter); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_vertex_attrib_integer_64bit.java0000644000175000017500000001010711543426511026555 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.LongBuffer; @Dependent public interface NV_vertex_attrib_integer_64bit { /** * Accepted by the <type> parameter of VertexAttribLPointerEXT, * VertexArrayVertexAttribLOffsetEXT, and VertexAttribLFormatNV: */ int GL_INT64_NV = 0x140E; int GL_UNSIGNED_INT64_NV = 0x140F; void glVertexAttribL1i64NV(@GLuint int index, @GLint64EXT long x); void glVertexAttribL2i64NV(@GLuint int index, @GLint64EXT long x, @GLint64EXT long y); void glVertexAttribL3i64NV(@GLuint int index, @GLint64EXT long x, @GLint64EXT long y, @GLint64EXT long z); void glVertexAttribL4i64NV(@GLuint int index, @GLint64EXT long x, @GLint64EXT long y, @GLint64EXT long z, @GLint64EXT long w); @StripPostfix("v") void glVertexAttribL1i64vNV(@GLuint int index, @Const @GLint64EXT @Check("1") LongBuffer v); @StripPostfix("v") void glVertexAttribL2i64vNV(@GLuint int index, @Const @GLint64EXT @Check("2") LongBuffer v); @StripPostfix("v") void glVertexAttribL3i64vNV(@GLuint int index, @Const @GLint64EXT @Check("3") LongBuffer v); @StripPostfix("v") void glVertexAttribL4i64vNV(@GLuint int index, @Const @GLint64EXT @Check("4") LongBuffer v); void glVertexAttribL1ui64NV(@GLuint int index, @GLuint64EXT long x); void glVertexAttribL2ui64NV(@GLuint int index, @GLuint64EXT long x, @GLuint64EXT long y); void glVertexAttribL3ui64NV(@GLuint int index, @GLuint64EXT long x, @GLuint64EXT long y, @GLuint64EXT long z); void glVertexAttribL4ui64NV(@GLuint int index, @GLuint64EXT long x, @GLuint64EXT long y, @GLuint64EXT long z, @GLuint64EXT long w); @StripPostfix("v") void glVertexAttribL1ui64vNV(@GLuint int index, @Const @GLuint64EXT @Check("1") LongBuffer v); @StripPostfix("v") void glVertexAttribL2ui64vNV(@GLuint int index, @Const @GLuint64EXT @Check("2") LongBuffer v); @StripPostfix("v") void glVertexAttribL3ui64vNV(@GLuint int index, @Const @GLuint64EXT @Check("3") LongBuffer v); @StripPostfix("v") void glVertexAttribL4ui64vNV(@GLuint int index, @Const @GLuint64EXT @Check("4") LongBuffer v); @StripPostfix("params") void glGetVertexAttribLi64vNV(@GLuint int index, @GLenum int pname, @OutParameter @GLint64EXT @Check("4") LongBuffer params); @StripPostfix("params") void glGetVertexAttribLui64vNV(@GLuint int index, @GLenum int pname, @OutParameter @GLuint64EXT @Check("4") LongBuffer params); @Dependent("NV_vertex_buffer_unified_memory") void glVertexAttribLFormatNV(@GLuint int index, int size, @GLenum int type, @GLsizei int stride); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_gpu_program5.java0000644000175000017500000000367111543426511023565 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_gpu_program5 { /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV = 0x8E5A; int GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV = 0x8E5B; int GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV = 0x8E5C; int GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV = 0x8E5D; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_stencil_wrap.java0000644000175000017500000000324311543426511023760 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_stencil_wrap { int GL_INCR_WRAP_EXT = 0x8507; int GL_DECR_WRAP_EXT = 0x8508; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_vertex_program3.java0000644000175000017500000000341511543426511024301 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_vertex_program3 { /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB = 0x8B4C; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_separate_specular_color.java0000644000175000017500000000335711543426511026174 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_separate_specular_color { int GL_SINGLE_COLOR_EXT = 0x81F9; int GL_SEPARATE_SPECULAR_COLOR_EXT = 0x81FA; int GL_LIGHT_MODEL_COLOR_CONTROL_EXT = 0x81F8; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ATI_envmap_bumpmap.java0000644000175000017500000000467311543426511024262 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import java.nio.*; public interface ATI_envmap_bumpmap { int GL_BUMP_ROT_MATRIX_ATI = 0x8775; int GL_BUMP_ROT_MATRIX_SIZE_ATI = 0x8776; int GL_BUMP_NUM_TEX_UNITS_ATI = 0x8777; int GL_BUMP_TEX_UNITS_ATI = 0x8778; int GL_DUDV_ATI = 0x8779; int GL_DU8DV8_ATI = 0x877A; int GL_BUMP_ENVMAP_ATI = 0x877B; int GL_BUMP_TARGET_ATI = 0x877C; @StripPostfix("param") void glTexBumpParameterfvATI(@GLenum int pname, @Check("4") @Const FloatBuffer param); @StripPostfix("param") void glTexBumpParameterivATI(@GLenum int pname, @Check("4") @Const IntBuffer param); @StripPostfix("param") void glGetTexBumpParameterfvATI(@GLenum int pname, @OutParameter @Check("4") FloatBuffer param); @StripPostfix("param") void glGetTexBumpParameterivATI(@GLenum int pname, @OutParameter @Check("4") IntBuffer param); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_cube_map_array.java0000644000175000017500000000524211543426511025764 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_texture_cube_map_array { /** * Accepted by the <target> parameter of TexParameteri, TexParameteriv, * TexParameterf, TexParameterfv, BindTexture, and GenerateMipmap: *

      * Accepted by the <target> parameter of TexImage3D, TexSubImage3D, * CompressedTeximage3D, CompressedTexSubImage3D and CopyTexSubImage3D: *

      * Accepted by the <tex> parameter of GetTexImage: */ int GL_TEXTURE_CUBE_MAP_ARRAY_ARB = 0x9009; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, * GetIntegerv and GetFloatv: */ int GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB = 0x900A; /** * Accepted by the <target> parameter of TexImage3D, TexSubImage3D, * CompressedTeximage3D, CompressedTexSubImage3D and CopyTexSubImage3D: */ int GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB = 0x900B; /** Returned by the <type> parameter of GetActiveUniform: */ int GL_SAMPLER_CUBE_MAP_ARRAY_ARB = 0x900C; int GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB = 0x900D; int GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB = 0x900E; int GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB = 0x900F; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_copy_buffer.java0000644000175000017500000000454111543426511023537 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.Reuse; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLintptr; import org.lwjgl.util.generator.opengl.GLsizeiptr; public interface ARB_copy_buffer { /** * Accepted by the target parameters of BindBuffer, BufferData, * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, * GetBufferPointerv, MapBufferRange, FlushMappedBufferRange, * GetBufferParameteriv, BindBufferRange, BindBufferBase, * and CopyBufferSubData: */ int GL_COPY_READ_BUFFER = 0x8F36; int GL_COPY_WRITE_BUFFER = 0x8F37; @Reuse("GL31") void glCopyBufferSubData(@GLenum int readTarget, @GLenum int writeTarget, @GLintptr long readOffset, @GLintptr long writeOffset, @GLsizeiptr long size); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ATI_text_fragment_shader.java0000644000175000017500000000416511543426511025444 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ATI_text_fragment_shader { /** * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, * and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * and GetDoublev, and by the <target> parameter of ProgramStringARB, * BindProgramARB, ProgramEnvParameter4{d,dv,f,fv}ARB, * ProgramLocalParameter4{d,dv,f,fv}ARB, * GetProgramEnvParameter{dv,fv}ARB, GetProgramLocalParameter{dv,fv}ARB, * GetProgramivARB, GetProgramfvATI, and GetProgramStringARB. */ int GL_TEXT_FRAGMENT_SHADER_ATI = 0x8200; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_seamless_cube_map.java0000644000175000017500000000351511543426511024703 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_seamless_cube_map { /** * Accepted by the <cap> parameter of Enable, Disable and IsEnabled, * and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv * and GetDoublev: */ int GL_TEXTURE_CUBE_MAP_SEAMLESS = 0x884F; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_ES2_compatibility.java0000644000175000017500000000622211543426511024554 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.ByteBuffer; import java.nio.IntBuffer; public interface ARB_ES2_compatibility { /** * Accepted by the <value> parameter of GetBooleanv, GetIntegerv, * GetInteger64v, GetFloatv, and GetDoublev: */ int GL_SHADER_COMPILER = 0x8DFA, GL_NUM_SHADER_BINARY_FORMATS = 0x8DF9, GL_MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB, GL_MAX_VARYING_VECTORS = 0x8DFC, GL_MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD, GL_IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A, GL_IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; /** Accepted by the <type> parameter of VertexAttribPointer: */ int GL_FIXED = 0x140C; /** * Accepted by the <precisiontype> parameter of * GetShaderPrecisionFormat: */ int GL_LOW_FLOAT = 0x8DF0, GL_MEDIUM_FLOAT = 0x8DF1, GL_HIGH_FLOAT = 0x8DF2, GL_LOW_INT = 0x8DF3, GL_MEDIUM_INT = 0x8DF4, GL_HIGH_INT = 0x8DF5; @Reuse("GL41") void glReleaseShaderCompiler(); @Reuse("GL41") void glShaderBinary(@AutoSize("shaders") @GLsizei int count, @Const @GLuint IntBuffer shaders, @GLenum int binaryformat, @Const @GLvoid ByteBuffer binary, @AutoSize("binary") @GLsizei int length); @Reuse("GL41") void glGetShaderPrecisionFormat(@GLenum int shadertype, @GLenum int precisiontype, @OutParameter @Check("2") IntBuffer range, @OutParameter @Check("1") IntBuffer precision); @Reuse("GL41") void glDepthRangef(@GLclampf float n, @GLclampf float f); @Reuse("GL41") void glClearDepthf(@GLclampf float d); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_compression_latc.java0000644000175000017500000000417411543426511026416 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.Extension; @Extension(postfix = "EXT", className = "EXTTextureCompressionLATC") public interface EXT_texture_compression_latc { /** * Accepted by the <internalformat> parameter of TexImage2D, * CopyTexImage2D, and CompressedTexImage2D and the <format> parameter * of CompressedTexSubImage2D: */ int GL_COMPRESSED_LUMINANCE_LATC1_EXT = 0x8C70; int GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT = 0x8C71; int GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT = 0x8C72; int GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT = 0x8C73; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_occlusion_query.java0000644000175000017500000000702511543426511024376 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLreturn; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.IntBuffer; public interface NV_occlusion_query { int GL_OCCLUSION_TEST_HP = 0x8165; int GL_OCCLUSION_TEST_RESULT_HP = 0x8166; /* HP_occlusion_test */ int GL_PIXEL_COUNTER_BITS_NV = 0x8864; int GL_CURRENT_OCCLUSION_QUERY_ID_NV = 0x8865; int GL_PIXEL_COUNT_NV = 0x8866; int GL_PIXEL_COUNT_AVAILABLE_NV = 0x8867; void glGenOcclusionQueriesNV(@AutoSize("piIDs") @GLsizei int n, @OutParameter @GLuint IntBuffer piIDs); @Alternate("glGenOcclusionQueriesNV") @GLreturn("piIDs") void glGenOcclusionQueriesNV2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer piIDs); void glDeleteOcclusionQueriesNV(@AutoSize("piIDs") @GLsizei int n, @Const @GLuint IntBuffer piIDs); @Alternate("glDeleteOcclusionQueriesNV") void glDeleteOcclusionQueriesNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, piID), 0", keepParam = true) int piID); boolean glIsOcclusionQueryNV(@GLuint int id); void glBeginOcclusionQueryNV(@GLuint int id); void glEndOcclusionQueryNV(); @StripPostfix("params") void glGetOcclusionQueryuivNV(@GLuint int id, @GLenum int pname, @OutParameter @Check("1") @GLuint IntBuffer params); @Alternate("glGetOcclusionQueryuivNV") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetOcclusionQueryuivNV2(@GLuint int id, @GLenum int pname, @OutParameter @GLuint IntBuffer params); @StripPostfix("params") void glGetOcclusionQueryivNV(@GLuint int id, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); @Alternate("glGetOcclusionQueryivNV") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetOcclusionQueryivNV2(@GLuint int id, @GLenum int pname, @OutParameter IntBuffer params); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_compression_rgtc.java0000644000175000017500000000414311543426511026426 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.Extension; @Extension(postfix = "EXT", className = "EXTTextureCompressionRGTC") public interface EXT_texture_compression_rgtc { /** * Accepted by the <internalformat> parameter of TexImage2D, * CopyTexImage2D, and CompressedTexImage2D and the <format> parameter * of CompressedTexSubImage2D: */ int GL_COMPRESSED_RED_RGTC1_EXT = 0x8DBB; int GL_COMPRESSED_SIGNED_RED_RGTC1_EXT = 0x8DBC; int GL_COMPRESSED_RED_GREEN_RGTC2_EXT = 0x8DBD; int GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 0x8DBE; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_pixel_buffer_object.java0000644000175000017500000000415511543426511025271 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_pixel_buffer_object extends ARB_buffer_object { /** * Accepted by the <target> parameters of BindBuffer, BufferData, * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, * GetBufferParameteriv, and GetBufferPointerv: */ int GL_PIXEL_PACK_BUFFER_EXT = 0x88EB; int GL_PIXEL_UNPACK_BUFFER_EXT = 0x88EC; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_PIXEL_PACK_BUFFER_BINDING_EXT = 0x88ED; int GL_PIXEL_UNPACK_BUFFER_BINDING_EXT = 0x88EF; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/APPLE_rgb_422.java0000644000175000017500000000462011543426511022630 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface APPLE_rgb_422 { /** * Accepted by the <format> parameter of DrawPixels, ReadPixels, TexImage1D, * TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, TexSubImage2D, * TexSubImage3D, GetHistogram, GetMinmax, ConvolutionFilter1D, * ConvolutionFilter2D, GetConvolutionFilter, SeparableFilter2D, * GetSeparableFilter, ColorTable, GetColorTable: */ int GL_RGB_422_APPLE = 0x8A1F; /** * Accepted by the <type> parameter of DrawPixels, ReadPixels, TexImage1D, * TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, TexSubImage2D, * TexSubImage3D, GetHistogram, GetMinmax, ConvolutionFilter1D, * ConvolutionFilter2D, GetConvolutionFilter, SeparableFilter2D, * GetSeparableFilter, ColorTable, GetColorTable: */ int GL_UNSIGNED_SHORT_8_8_APPLE = 0x85BA; int GL_UNSIGNED_SHORT_8_8_REV_APPLE = 0x85BB; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_sample_shading.java0000644000175000017500000000411611543426511024210 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLclampf; public interface ARB_sample_shading { /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, * and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_SAMPLE_SHADING_ARB = 0x8C36; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, * GetIntegerv, and GetFloatv: */ int GL_MIN_SAMPLE_SHADING_VALUE_ARB = 0x8C37; void glMinSampleShadingARB(@GLclampf float value); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_point_sprite.java0000644000175000017500000000373711543426511023700 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import java.nio.*; public interface NV_point_sprite { int GL_POINT_SPRITE_NV = 0x8861; int GL_COORD_REPLACE_NV = 0x8862; int GL_POINT_SPRITE_R_MODE_NV = 0x8863; void glPointParameteriNV(@GLenum int pname, int param); @StripPostfix("params") void glPointParameterivNV(@GLenum int pname, @Check("4") @Const IntBuffer params); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_texture_shader2.java0000644000175000017500000000515411543426511024264 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_texture_shader2 { int GL_DOT_PRODUCT_TEXTURE_3D_NV = 0x86EF; int GL_HILO_NV = 0x86F4; int GL_DSDT_NV = 0x86F5; int GL_DSDT_MAG_NV = 0x86F6; int GL_DSDT_MAG_VIB_NV = 0x86F7; int GL_UNSIGNED_INT_S8_S8_8_8_NV = 0x86DA; int GL_UNSIGNED_INT_8_8_S8_S8_REV_NV = 0x86DB; int GL_SIGNED_RGBA_NV = 0x86FB; int GL_SIGNED_RGBA8_NV = 0x86FC; int GL_SIGNED_RGB_NV = 0x86FE; int GL_SIGNED_RGB8_NV = 0x86FF; int GL_SIGNED_LUMINANCE_NV = 0x8701; int GL_SIGNED_LUMINANCE8_NV = 0x8702; int GL_SIGNED_LUMINANCE_ALPHA_NV = 0x8703; int GL_SIGNED_LUMINANCE8_ALPHA8_NV = 0x8704; int GL_SIGNED_ALPHA_NV = 0x8705; int GL_SIGNED_ALPHA8_NV = 0x8706; int GL_SIGNED_INTENSITY_NV = 0x8707; int GL_SIGNED_INTENSITY8_NV = 0x8708; int GL_SIGNED_RGB_UNSIGNED_ALPHA_NV = 0x870C; int GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV = 0x870D; int GL_HILO16_NV = 0x86F8; int GL_SIGNED_HILO_NV = 0x86F9; int GL_SIGNED_HILO16_NV = 0x86FA; int GL_DSDT8_NV = 0x8709; int GL_DSDT8_MAG8_NV = 0x870A; int GL_DSDT_MAG_INTENSITY_NV = 0x86DC; int GL_DSDT8_MAG8_INTENSITY8_NV = 0x870B; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_buffer_object.java0000644000175000017500000001546411543426511024041 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; @Extension(postfix = "ARB", isFinal = false) public interface ARB_buffer_object { /** Accepted by the <usage> parameter of BufferDataARB: */ int GL_STREAM_DRAW_ARB = 0x88E0; int GL_STREAM_READ_ARB = 0x88E1; int GL_STREAM_COPY_ARB = 0x88E2; int GL_STATIC_DRAW_ARB = 0x88E4; int GL_STATIC_READ_ARB = 0x88E5; int GL_STATIC_COPY_ARB = 0x88E6; int GL_DYNAMIC_DRAW_ARB = 0x88E8; int GL_DYNAMIC_READ_ARB = 0x88E9; int GL_DYNAMIC_COPY_ARB = 0x88EA; /** Accepted by the <access> parameter of MapBufferARB: */ int GL_READ_ONLY_ARB = 0x88B8; int GL_WRITE_ONLY_ARB = 0x88B9; int GL_READ_WRITE_ARB = 0x88BA; /** Accepted by the <pname> parameter of GetBufferParameterivARB: */ int GL_BUFFER_SIZE_ARB = 0x8764; int GL_BUFFER_USAGE_ARB = 0x8765; int GL_BUFFER_ACCESS_ARB = 0x88BB; int GL_BUFFER_MAPPED_ARB = 0x88BC; int GL_BUFFER_MAP_POINTER_ARB = 0x88BD; @Code(" StateTracker.bindBuffer(caps, target, buffer);") void glBindBufferARB(@GLenum int target, @GLuint int buffer); void glDeleteBuffersARB(@AutoSize("buffers") @GLsizei int n, @Const @GLuint IntBuffer buffers); @Alternate("glDeleteBuffersARB") void glDeleteBuffersARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer); void glGenBuffersARB(@AutoSize("buffers") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers); @Alternate("glGenBuffersARB") @GLreturn("buffers") void glGenBuffersARB2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers); boolean glIsBufferARB(@GLuint int buffer); @GenerateAutos void glBufferDataARB(@GLenum int target, @AutoSize("data") @GLsizeiptrARB long size, @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer data, @GLenum int usage); void glBufferSubDataARB(@GLenum int target, @GLintptrARB long offset, @AutoSize("data") @GLsizeiptrARB long size, @Check @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer data); void glGetBufferSubDataARB(@GLenum int target, @GLintptrARB long offset, @AutoSize("data") @GLsizeiptrARB long size, @OutParameter @Check @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer data); /** * glMapBufferARB maps a GL buffer object to a ByteBuffer. The old_buffer argument can be null, * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null, * it will be returned if it points to the same mapped memory and has the same capacity as the buffer object, * otherwise a new ByteBuffer is created. That way, an application will normally use glMapBufferARB like this: *

      * ByteBuffer mapped_buffer; mapped_buffer = glMapBufferARB(..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapBufferARB(..., ..., mapped_buffer); *

      * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused. *

      * The version of this method without an explicit length argument calls glGetBufferParameterARB internally to * retrieve the current buffer object size, which may cause a pipeline flush and reduce application performance. *

      * The version of this method with an explicit length argument is a fast alternative to the one without. No GL call * is made to retrieve the buffer object size, so the user is responsible for tracking and using the appropriate length.
      * Security warning: The length argument should match the buffer object size. Reading from or writing to outside * the memory region that corresponds to the mapped buffer object will cause native crashes. * * @param length the length of the mapped memory in bytes. * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created. * * @return A ByteBuffer representing the mapped buffer memory. */ @CachedResult @GLvoid @AutoSize("GLChecks.getBufferObjectSizeARB(caps, target)") ByteBuffer glMapBufferARB(@GLenum int target, @GLenum int access); boolean glUnmapBufferARB(@GLenum int target); @StripPostfix("params") void glGetBufferParameterivARB(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetBufferParameterivARB") @GLreturn("params") @StripPostfix("params") void glGetBufferParameterivARB2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("pointer") @AutoSize("GLChecks.getBufferObjectSizeARB(caps, target)") void glGetBufferPointervARB(@GLenum int target, @GLenum int pname, @Result @GLvoid ByteBuffer pointer); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_shader_texture_lod.java0000644000175000017500000000315011543426511025113 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_shader_texture_lod { }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_border_clamp.java0000644000175000017500000000322111543426511025437 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_texture_border_clamp { int GL_CLAMP_TO_BORDER_ARB = 0x812D; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_snorm.java0000644000175000017500000000504711543426511024210 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_texture_snorm { /** * Accepted by the <internalFormat> parameter of TexImage1D, * TexImage2D, and TexImage3D: */ int GL_RED_SNORM = 0x8F90; int GL_RG_SNORM = 0x8F91; int GL_RGB_SNORM = 0x8F92; int GL_RGBA_SNORM = 0x8F93; int GL_ALPHA_SNORM = 0x9010; int GL_LUMINANCE_SNORM = 0x9011; int GL_LUMINANCE_ALPHA_SNORM = 0x9012; int GL_INTENSITY_SNORM = 0x9013; int GL_R8_SNORM = 0x8F94; int GL_RG8_SNORM = 0x8F95; int GL_RGB8_SNORM = 0x8F96; int GL_RGBA8_SNORM = 0x8F97; int GL_ALPHA8_SNORM = 0x9014; int GL_LUMINANCE8_SNORM = 0x9015; int GL_LUMINANCE8_ALPHA8_SNORM = 0x9016; int GL_INTENSITY8_SNORM = 0x9017; int GL_R16_SNORM = 0x8F98; int GL_RG16_SNORM = 0x8F99; int GL_RGB16_SNORM = 0x8F9A; int GL_RGBA16_SNORM = 0x8F9B; int GL_ALPHA16_SNORM = 0x9018; int GL_LUMINANCE16_SNORM = 0x9019; int GL_LUMINANCE16_ALPHA16_SNORM = 0x901A; int GL_INTENSITY16_SNORM = 0x901B; /** Returned by GetTexLevelParmeter */ int GL_SIGNED_NORMALIZED = 0x8F9C; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_framebuffer_multisample.java0000644000175000017500000000455311543426511026173 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLsizei; public interface EXT_framebuffer_multisample { /** Accepted by the <pname> parameter of GetRenderbufferParameterivEXT. */ int GL_RENDERBUFFER_SAMPLES_EXT = 0x8CAB; /** Returned by CheckFramebufferStatusEXT. */ int GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT = 0x8D56; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev. */ int GL_MAX_SAMPLES_EXT = 0x8D57; /** * Establishes the data storage, format, dimensions, and number of * samples of a renderbuffer object's image. */ void glRenderbufferStorageMultisampleEXT( @GLenum int target, @GLsizei int samples, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/AMD_vertex_shader_tessellator.java0000644000175000017500000000427611543426511026522 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; public interface AMD_vertex_shader_tessellator { /** Returned by the <type> parameter of GetActiveUniform: */ int GL_SAMPLER_BUFFER_AMD = 0x9001; int GL_INT_SAMPLER_BUFFER_AMD = 0x9002; int GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD = 0x9003; /** Accepted by TessellationModeAMD */ int GL_DISCRETE_AMD = 0x9006; int GL_CONTINUOUS_AMD = 0x9007; /** Accepted by GetIntegerv */ int GL_TESSELLATION_MODE_AMD = 0x9004; /** Accepted by GetFloatv */ int GL_TESSELLATION_FACTOR_AMD = 0x9005; void glTessellationFactorAMD(float factor); void glTessellationModeAMD(@GLenum int mode); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java0000644000175000017500000000526311543426511025534 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLreturn; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.IntBuffer; public interface APPLE_vertex_array_object { /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_VERTEX_ARRAY_BINDING_APPLE = 0x85B5; void glBindVertexArrayAPPLE(@GLuint int array); void glDeleteVertexArraysAPPLE(@AutoSize("arrays") @GLsizei int n, @Const @GLuint IntBuffer arrays); @Alternate("glDeleteVertexArraysAPPLE") void glDeleteVertexArraysAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getBufferInt().put(0, array), 0", keepParam = true) int array); void glGenVertexArraysAPPLE(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); @Alternate("glGenVertexArraysAPPLE") @GLreturn("arrays") void glGenVertexArraysAPPLE2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); boolean glIsVertexArrayAPPLE(@GLuint int array); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_blend_subtract.java0000644000175000017500000000326511543426511024265 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_blend_subtract { int GL_FUNC_SUBTRACT_EXT = 0x800A; int GL_FUNC_REVERSE_SUBTRACT_EXT = 0x800B; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java0000644000175000017500000002305711543426511024102 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.*; public interface ARB_vertex_shader { /** * Accepted by the <shaderType> argument of CreateShaderObjectARB and * returned by the <params> parameter of GetObjectParameter{if}vARB: */ int GL_VERTEX_SHADER_ARB = 0x8B31; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB = 0x8B4A; int GL_MAX_VARYING_FLOATS_ARB = 0x8B4B; int GL_MAX_VERTEX_ATTRIBS_ARB = 0x8869; int GL_MAX_TEXTURE_IMAGE_UNITS_ARB = 0x8872; int GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB = 0x8B4C; int GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB = 0x8B4D; int GL_MAX_TEXTURE_COORDS_ARB = 0x8871; /** * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, and * by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and * GetDoublev: */ int GL_VERTEX_PROGRAM_POINT_SIZE_ARB = 0x8642; int GL_VERTEX_PROGRAM_TWO_SIDE_ARB = 0x8643; /** Accepted by the <pname> parameter GetObjectParameter{if}vARB: */ int GL_OBJECT_ACTIVE_ATTRIBUTES_ARB = 0x8B89; int GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB = 0x8B8A; /** Accepted by the <pname> parameter of GetVertexAttrib{dfi}vARB: */ int GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB = 0x8622; int GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB = 0x8623; int GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB = 0x8624; int GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB = 0x8625; int GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB = 0x886A; int GL_CURRENT_VERTEX_ATTRIB_ARB = 0x8626; /** Accepted by the <pname> parameter of GetVertexAttribPointervARB: */ int GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB = 0x8645; /** Returned by the <type> parameter of GetActiveAttribARB: */ int GL_FLOAT = 0x1406; int GL_FLOAT_VEC2_ARB = 0x8B50; int GL_FLOAT_VEC3_ARB = 0x8B51; int GL_FLOAT_VEC4_ARB = 0x8B52; int GL_FLOAT_MAT2_ARB = 0x8B5A; int GL_FLOAT_MAT3_ARB = 0x8B5B; int GL_FLOAT_MAT4_ARB = 0x8B5C; @NoErrorCheck void glVertexAttrib1sARB(@GLuint int index, short v0); @NoErrorCheck void glVertexAttrib1fARB(@GLuint int index, float v0); @NoErrorCheck void glVertexAttrib1dARB(@GLuint int index, double v0); @NoErrorCheck void glVertexAttrib2sARB(@GLuint int index, short v0, short v1); @NoErrorCheck void glVertexAttrib2fARB(@GLuint int index, float v0, float v1); @NoErrorCheck void glVertexAttrib2dARB(@GLuint int index, double v0, double v1); @NoErrorCheck void glVertexAttrib3sARB(@GLuint int index, short v0, short v1, short v2); @NoErrorCheck void glVertexAttrib3fARB(@GLuint int index, float v0, float v1, float v2); @NoErrorCheck void glVertexAttrib3dARB(@GLuint int index, double v0, double v1, double v2); @NoErrorCheck void glVertexAttrib4sARB(@GLuint int index, short v0, short v1, short v2, short v3); @NoErrorCheck void glVertexAttrib4fARB(@GLuint int index, float v0, float v1, float v2, float v3); @NoErrorCheck void glVertexAttrib4dARB(@GLuint int index, double v0, double v1, double v2, double v3); @NoErrorCheck void glVertexAttrib4NubARB(@GLuint int index, @GLubyte byte x, @GLubyte byte y, @GLubyte byte z, @GLubyte byte w); void glVertexAttribPointerARB(@GLuint int index, int size, @AutoType("buffer") @GLenum int type, boolean normalized, @GLsizei int stride, @CachedReference(index = "index", name = "glVertexAttribPointer_buffer") @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLbyte @GLubyte @GLshort @GLushort @GLint @GLuint @GLfloat @GLdouble Buffer buffer); void glEnableVertexAttribArrayARB(@GLuint int index); void glDisableVertexAttribArrayARB(@GLuint int index); void glBindAttribLocationARB(@GLhandleARB int programObj, @GLuint int index, @NullTerminated @Const @GLcharARB ByteBuffer name); @Alternate("glBindAttribLocationARB") void glBindAttribLocationARB(@GLhandleARB int programObj, @GLuint int index, @NullTerminated CharSequence name); void glGetActiveAttribARB(@GLhandleARB int programObj, @GLuint int index, @AutoSize("name") @GLsizei int maxLength, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @Check("1") IntBuffer size, @OutParameter @GLenum @Check("1") IntBuffer type, @OutParameter @GLcharARB ByteBuffer name); /** Overloads glGetActiveAttribARB. This version returns both size and type in the sizeType buffer (at .position() and .position() + 1). */ @Alternate("glGetActiveAttribARB") @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveAttribARB2(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength, @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length, @OutParameter @Check("2") IntBuffer sizeType, @OutParameter @GLenum @Constant("sizeType, sizeType.position() + 1") IntBuffer type, @OutParameter @GLcharARB ByteBuffer name); /** Overloads glGetActiveAttribARB. This version returns only the attrib name. */ @Alternate(value = "glGetActiveAttribARB", javaAlt = true) @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveAttribARB(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength, @OutParameter @GLsizei @Constant("name_length, 0, APIUtil.getBufferInt(), 0, APIUtil.getBufferInt(), 1") IntBuffer length, @OutParameter @GLcharARB ByteBuffer name); /** Overloads glGetActiveAttribARB. This version returns only the attrib size. */ @Alternate(value = "glGetActiveAttribARB", javaAlt = true) @GLreturn(value = "size") void glGetActiveAttribSizeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength, @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, @OutParameter IntBuffer size, @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); /** Overloads glGetActiveAttribARB. This version returns only the attrib type. */ @Alternate(value = "glGetActiveAttribARB", javaAlt = true) @GLreturn(value = "type") void glGetActiveAttribTypeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength, @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore @OutParameter @GLenum IntBuffer type, @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); int glGetAttribLocationARB(@GLhandleARB int programObj, @NullTerminated @Const @GLcharARB ByteBuffer name); @Alternate("glGetAttribLocationARB") int glGetAttribLocationARB(@GLhandleARB int programObj, @NullTerminated CharSequence name); @StripPostfix("params") void glGetVertexAttribfvARB(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @StripPostfix("params") void glGetVertexAttribdvARB(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") DoubleBuffer params); @StripPostfix("params") void glGetVertexAttribivARB(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @StripPostfix("result") void glGetVertexAttribPointervARB(@GLuint int index, @GLenum int pname, @Result @GLvoid ByteBuffer result); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java0000644000175000017500000001446611543426511025310 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.ByteBuffer; import java.nio.IntBuffer; public interface AMD_performance_monitor { /** Accepted by the <pame> parameter of GetPerfMonitorCounterInfoAMD */ int GL_COUNTER_TYPE_AMD = 0x8BC0; int GL_COUNTER_RANGE_AMD = 0x8BC1; /** * Returned as a valid value in <data> parameter of * GetPerfMonitorCounterInfoAMD if <pname> = COUNTER_TYPE_AMD */ int GL_UNSIGNED_INT = 0x1405; int GL_FLOAT = 0x1406; int GL_UNSIGNED_INT64_AMD = 0x8BC2; int GL_PERCENTAGE_AMD = 0x8BC3; /** Accepted by the <pname> parameter of GetPerfMonitorCounterDataAMD */ int GL_PERFMON_RESULT_AVAILABLE_AMD = 0x8BC4; int GL_PERFMON_RESULT_SIZE_AMD = 0x8BC5; int GL_PERFMON_RESULT_AMD = 0x8BC6; void glGetPerfMonitorGroupsAMD(@OutParameter @Check(value = "1", canBeNull = true) @GLint IntBuffer numGroups, @AutoSize("groups") @GLsizei int groupsSize, @GLuint IntBuffer groups); void glGetPerfMonitorCountersAMD(@GLuint int group, @OutParameter @Check(value = "1") @GLint IntBuffer numCounters, @OutParameter @Check(value = "1") @GLint IntBuffer maxActiveCounters, @AutoSize("counters") @GLsizei int countersSize, @GLuint IntBuffer counters); void glGetPerfMonitorGroupStringAMD(@GLuint int group, @AutoSize("groupString") @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer groupString); @Alternate("glGetPerfMonitorGroupStringAMD") @GLreturn(value = "groupString", maxLength = "bufSize") void glGetPerfMonitorGroupStringAMD2(@GLuint int group, @GLsizei int bufSize, @OutParameter @GLsizei @Constant("groupString_length, 0") IntBuffer length, @OutParameter @GLchar ByteBuffer groupString); void glGetPerfMonitorCounterStringAMD(@GLuint int group, @GLuint int counter, @AutoSize("counterString") @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer counterString); @Alternate("glGetPerfMonitorCounterStringAMD") @GLreturn(value = "counterString", maxLength = "bufSize") void glGetPerfMonitorCounterStringAMD2(@GLuint int group, @GLuint int counter, @GLsizei int bufSize, @OutParameter @GLsizei @Constant("counterString_length, 0") IntBuffer length, @OutParameter @GLchar ByteBuffer counterString); void glGetPerfMonitorCounterInfoAMD(@GLuint int group, @GLuint int counter, @GLenum int pname, @Check(value = "16") @GLvoid ByteBuffer data); void glGenPerfMonitorsAMD(@AutoSize("monitors") @GLsizei int n, @OutParameter @GLuint IntBuffer monitors); @Alternate("glGenPerfMonitorsAMD") @GLreturn("monitors") void glGenPerfMonitorsAMD2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer monitors); void glDeletePerfMonitorsAMD(@AutoSize("monitors") @GLsizei int n, @GLuint IntBuffer monitors); @Alternate("glDeletePerfMonitorsAMD") void glDeletePerfMonitorsAMD(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, monitor), 0", keepParam = true) int monitor); void glSelectPerfMonitorCountersAMD(@GLuint int monitor, boolean enable, @GLuint int group, @AutoSize("counterList") int numCounters, @GLuint IntBuffer counterList); @Alternate("glSelectPerfMonitorCountersAMD") void glSelectPerfMonitorCountersAMD(@GLuint int monitor, boolean enable, @GLuint int group, @Constant("1") int numCounters, @Constant(value = "APIUtil.getBufferInt().put(0, counter), 0", keepParam = true) int counter); void glBeginPerfMonitorAMD(@GLuint int monitor); void glEndPerfMonitorAMD(@GLuint int monitor); void glGetPerfMonitorCounterDataAMD(@GLuint int monitor, @GLenum int pname, @AutoSize("data") @GLsizei int dataSize, @OutParameter @GLuint IntBuffer data, @OutParameter @GLint @Check(value = "1", canBeNull = true) IntBuffer bytesWritten); @Alternate("glGetPerfMonitorCounterDataAMD") @GLreturn("data") void glGetPerfMonitorCounterDataAMD2(@GLuint int monitor, @GLenum int pname, @Constant("4") @GLsizei int dataSize, @OutParameter @GLuint IntBuffer data, @OutParameter @GLint @Constant("null, 0") IntBuffer bytesWritten); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_array.java0000644000175000017500000000662111543426511024167 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.Reuse; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLuint; public interface EXT_texture_array { /** * Accepted by the <target> parameter of TexParameteri, TexParameteriv, * TexParameterf, TexParameterfv, and BindTexture: */ int GL_TEXTURE_1D_ARRAY_EXT = 0x8C18; int GL_TEXTURE_2D_ARRAY_EXT = 0x8C1A; /** * Accepted by the <target> parameter of TexImage3D, TexSubImage3D, * CopyTexSubImage3D, CompressedTexImage3D, and CompressedTexSubImage3D: */ int GL_PROXY_TEXTURE_2D_ARRAY_EXT = 0x8C1B; /** * Accepted by the <target> parameter of TexImage2D, TexSubImage2D, * CopyTexImage2D, CopyTexSubImage2D, CompressedTexImage2D, and * CompressedTexSubImage2D: */ int GL_PROXY_TEXTURE_1D_ARRAY_EXT = 0x8C19; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv * and GetFloatv: */ int GL_TEXTURE_BINDING_1D_ARRAY_EXT = 0x8C1C; int GL_TEXTURE_BINDING_2D_ARRAY_EXT = 0x8C1D; int GL_MAX_ARRAY_TEXTURE_LAYERS_EXT = 0x88FF; /** * Accepted by the <param> parameter of TexParameterf, TexParameteri, * TexParameterfv, and TexParameteriv when the <pname> parameter is * TEXTURE_COMPARE_MODE_ARB: */ int GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT = 0x884E; /** * Accepted by the <pname> parameter of * GetFramebufferAttachmentParameterivEXT: */ int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT = 0x8CD4; /** Returned by the <type> parameter of GetActiveUniform: */ int GL_SAMPLER_1D_ARRAY_EXT = 0x8DC0; int GL_SAMPLER_2D_ARRAY_EXT = 0x8DC1; int GL_SAMPLER_1D_ARRAY_SHADOW_EXT = 0x8DC3; int GL_SAMPLER_2D_ARRAY_SHADOW_EXT = 0x8DC4; @Reuse("EXTGeometryShader4") void glFramebufferTextureLayerEXT(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, int layer); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_rg.java0000644000175000017500000000510611543426511023422 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_texture_rg { /** * Accepted by the <internalFormat> parameter of TexImage1D, TexImage2D, * TexImage3D, CopyTexImage1D, and CopyTexImage2D: */ int GL_R8 = 0x8229; int GL_R16 = 0x822A; int GL_RG8 = 0x822B; int GL_RG16 = 0x822C; int GL_R16F = 0x822D; int GL_R32F = 0x822E; int GL_RG16F = 0x822F; int GL_RG32F = 0x8230; int GL_R8I = 0x8231; int GL_R8UI = 0x8232; int GL_R16I = 0x8233; int GL_R16UI = 0x8234; int GL_R32I = 0x8235; int GL_R32UI = 0x8236; int GL_RG8I = 0x8237; int GL_RG8UI = 0x8238; int GL_RG16I = 0x8239; int GL_RG16UI = 0x823A; int GL_RG32I = 0x823B; int GL_RG32UI = 0x823C; /** * Accepted by the <format> parameter of TexImage3D, TexImage2D, * TexImage3D, TexSubImage1D, TexSubImage2D, TexSubImage3D, * DrawPixels and ReadPixels: */ int GL_RG = 0x8227; int GL_RG_INTEGER = 0x8228; /** * Accepted by the <param> parameter of the TexParameter{if}* * functions when <pname> is DEPTH_TEXTURE_MODE: */ int GL_RED = 0x1903; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_gpu_shader5.java0000644000175000017500000000411011543426511023432 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_gpu_shader5 { /** Accepted by the <pname> parameter of GetProgramiv: */ int GL_GEOMETRY_SHADER_INVOCATIONS = 0x887F; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * GetDoublev, and GetInteger64v: */ int GL_MAX_GEOMETRY_SHADER_INVOCATIONS = 0x8E5A; int GL_MIN_FRAGMENT_INTERPOLATION_OFFSET = 0x8E5B; int GL_MAX_FRAGMENT_INTERPOLATION_OFFSET = 0x8E5C; int GL_FRAGMENT_INTERPOLATION_OFFSET_BITS = 0x8E5D; int GL_MAX_VERTEX_STREAMS = 0x8E71; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_env_dot3.java0000644000175000017500000000324611543426511024572 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_texture_env_dot3 { int GL_DOT3_RGB_EXT = 0x8740; int GL_DOT3_RGBA_EXT = 0x8741; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_half_float_vertex.java0000644000175000017500000000350311543426511024725 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_half_float_vertex { /** * Accepted by the <type> argument of VertexPointer, NormalPointer, * ColorPointer, SecondaryColorPointer, FogCoordPointer, TexCoordPointer, * and VertexAttribPointer: */ int GL_HALF_FLOAT = 0x140B; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_vertex_buffer_object.java0000644000175000017500000000534611543426511025434 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_vertex_buffer_object extends ARB_buffer_object { /** * Accepted by the <target> parameters of BindBufferARB, BufferDataARB, * BufferSubDataARB, MapBufferARB, UnmapBufferARB, * GetBufferSubDataARB, GetBufferParameterivARB, and * GetBufferPointervARB: */ int GL_ARRAY_BUFFER_ARB = 0x8892; int GL_ELEMENT_ARRAY_BUFFER_ARB = 0x8893; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_ARRAY_BUFFER_BINDING_ARB = 0x8894; int GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB = 0x8895; int GL_VERTEX_ARRAY_BUFFER_BINDING_ARB = 0x8896; int GL_NORMAL_ARRAY_BUFFER_BINDING_ARB = 0x8897; int GL_COLOR_ARRAY_BUFFER_BINDING_ARB = 0x8898; int GL_INDEX_ARRAY_BUFFER_BINDING_ARB = 0x8899; int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB = 0x889A; int GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB = 0x889B; int GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB = 0x889C; int GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB = 0x889D; int GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB = 0x889E; /** * Accepted by the <pname> parameter of GetVertexAttribivARB: */ int GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB = 0x889F; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_parameter_buffer_object.java0000644000175000017500000000622111543426511026007 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.FloatBuffer; import java.nio.IntBuffer; public interface NV_parameter_buffer_object { /** Accepted by the <pname> parameter of GetProgramivARB: */ int GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV = 0x8DA0; int GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV = 0x8DA1; /** * Accepted by the <target> parameter of ProgramBufferParametersfvNV, * ProgramBufferParametersIivNV, and ProgramBufferParametersIuivNV, * BindBufferRangeNV, BindBufferOffsetNV, BindBufferBaseNV, and BindBuffer * and the <value> parameter of GetIntegerIndexedvEXT: */ int GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV = 0x8DA2; int GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV = 0x8DA3; int GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV = 0x8DA4; @StripPostfix("params") void glProgramBufferParametersfvNV(@GLenum int target, @GLuint int buffer, @GLuint int index, @AutoSize(value = "params", expression = " >> 2") @GLsizei int count, @Const FloatBuffer params); @StripPostfix("params") void glProgramBufferParametersIivNV(@GLenum int target, @GLuint int buffer, @GLuint int index, @AutoSize(value = "params", expression = " >> 2") @GLsizei int count, @Const IntBuffer params); @StripPostfix("params") void glProgramBufferParametersIuivNV(@GLenum int target, @GLuint int buffer, @GLuint int index, @AutoSize(value = "params", expression = " >> 2") @GLuint int count, @Const @GLuint IntBuffer params); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_program.java0000644000175000017500000001123611543426511022621 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; @Extension(postfix = "NV", isFinal = false) public interface NV_program { /** Accepted by the <pname> parameter of GetProgramivNV: */ int GL_PROGRAM_TARGET_NV = 0x8646; int GL_PROGRAM_LENGTH_NV = 0x8627; int GL_PROGRAM_RESIDENT_NV = 0x8647; /** Accepted by the <pname> parameter of GetProgramStringNV: */ int GL_PROGRAM_STRING_NV = 0x8628; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_PROGRAM_ERROR_POSITION_NV = 0x864B; /** Accepted by the <name> parameter of GetString: */ int GL_PROGRAM_ERROR_STRING_NV = 0x8874; void glLoadProgramNV(@GLenum int target, @GLuint int programID, @AutoSize("string") @GLsizei int length, @Const @GLubyte Buffer string); @Alternate("glLoadProgramNV") void glLoadProgramNV(@GLenum int target, @GLuint int programID, @Constant("string.length()") @GLsizei int length, CharSequence string); void glBindProgramNV(@GLenum int target, @GLuint int programID); void glDeleteProgramsNV(@AutoSize("programs") @GLsizei int n, @Const @GLuint IntBuffer programs); @Alternate("glDeleteProgramsNV") void glDeleteProgramsNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, program), 0", keepParam = true) int program); void glGenProgramsNV(@AutoSize("programs") @GLsizei int n, @OutParameter @GLuint IntBuffer programs); @Alternate("glGenProgramsNV") @GLreturn("programs") void glGenProgramsNV2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer programs); @StripPostfix("params") void glGetProgramivNV(@GLuint int programID, @GLenum int parameterName, @OutParameter @Check @GLint IntBuffer params); @Alternate("glGetProgramivNV") @GLreturn("params") @StripPostfix("params") void glGetProgramivNV2(@GLuint int programID, @GLenum int parameterName, @OutParameter @GLint IntBuffer params); void glGetProgramStringNV(@GLuint int programID, @GLenum int parameterName, @OutParameter @Check @GLubyte Buffer paramString); @Alternate("glGetProgramStringNV") @Code("\t\tint programLength = glGetProgramNV(programID, GL_PROGRAM_LENGTH_NV);") @GLreturn(value="paramString", maxLength = "programLength", forceMaxLength = true) void glGetProgramStringNV2(@GLuint int programID, @GLenum int parameterName, @OutParameter @GLchar ByteBuffer paramString); boolean glIsProgramNV(@GLuint int programID); boolean glAreProgramsResidentNV(@AutoSize("programIDs") @GLsizei int n, @Const @GLuint IntBuffer programIDs, @OutParameter @GLboolean @Check("programIDs.remaining()") ByteBuffer programResidences); void glRequestResidentProgramsNV(@AutoSize("programIDs") @GLsizei int n, @GLuint IntBuffer programIDs); @Alternate("glRequestResidentProgramsNV") void glRequestResidentProgramsNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, programID), 0", keepParam = true) int programID); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_color_buffer_float.java0000644000175000017500000000553511543426511025074 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; public interface ARB_color_buffer_float { /** * Accepted by the <pname> parameters of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_RGBA_FLOAT_MODE_ARB = 0x8820; /** * Accepted by the <target> parameter of ClampColorARB and the <pname> * parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev. */ int GL_CLAMP_VERTEX_COLOR_ARB = 0x891A; int GL_CLAMP_FRAGMENT_COLOR_ARB = 0x891B; int GL_CLAMP_READ_COLOR_ARB = 0x891C; /** Accepted by the <clamp> parameter of ClampColorARB. */ int GL_FIXED_ONLY_ARB = 0x891D; /** * Accepted as a value in the <piAttribIList> and <pfAttribFList> * parameter arrays of wglChoosePixelFormatARB, and returned in the * <piValues> parameter array of wglGetPixelFormatAttribivARB, and the * <pfValues> parameter array of wglGetPixelFormatAttribfvARB: */ int WGL_TYPE_RGBA_FLOAT_ARB = 0x21A0; /** * Accepted as values of the <render_type> arguments in the * glXCreateNewContext and glXCreateContext functions */ int GLX_RGBA_FLOAT_TYPE = 0x20B9; /** Accepted as a bit set in the GLX_RENDER_TYPE variable */ int GLX_RGBA_FLOAT_BIT = 0x00000004; void glClampColorARB(@GLenum int target, @GLenum int clamp); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_packed_depth_stencil.java0000644000175000017500000000536711543426511025433 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_packed_depth_stencil { /** Accepted by the <format> parameter of DrawPixels, ReadPixels, TexImage1D, TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D, TexSubImage3D, and GetTexImage, by the <type> parameter of CopyPixels, by the <internalformat> parameter of TexImage1D, TexImage2D, TexImage3D, CopyTexImage1D, CopyTexImage2D, and RenderbufferStorageEXT, and returned in the <data> parameter of GetTexLevelParameter and GetRenderbufferParameterivEXT. */ int GL_DEPTH_STENCIL_EXT = 0x84F9; /** Accepted by the <type> parameter of DrawPixels, ReadPixels, TexImage1D, TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D, TexSubImage3D, and GetTexImage. */ int GL_UNSIGNED_INT_24_8_EXT = 0x84FA; /** Accepted by the <internalformat> parameter of TexImage1D, TexImage2D, TexImage3D, CopyTexImage1D, CopyTexImage2D, and RenderbufferStorageEXT, and returned in the <data> parameter of GetTexLevelParameter and GetRenderbufferParameterivEXT. */ int GL_DEPTH24_STENCIL8_EXT = 0x88F0; /** Accepted by the <value> parameter of GetTexLevelParameter. */ int GL_TEXTURE_STENCIL_SIZE_EXT = 0x88F1; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_vertex_weighting.java0000644000175000017500000000537011543426511024653 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLfloat; import org.lwjgl.util.generator.opengl.GLsizei; import java.nio.*; public interface EXT_vertex_weighting { int GL_MODELVIEW0_STACK_DEPTH_EXT = 0x0BA3; int GL_MODELVIEW1_STACK_DEPTH_EXT = 0x8502; int GL_MODELVIEW0_MATRIX_EXT = 0x0BA6; int GL_MODELVIEW1_MATRIX_EXT = 0x8506; int GL_VERTEX_WEIGHTING_EXT = 0x8509; int GL_MODELVIEW0_EXT = 0x1700; int GL_MODELVIEW1_EXT = 0x850A; int GL_CURRENT_VERTEX_WEIGHT_EXT = 0x850B; int GL_VERTEX_WEIGHT_ARRAY_EXT = 0x850C; int GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT = 0x850D; int GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT = 0x850E; int GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = 0x850F; int GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT = 0x8510; @NoErrorCheck void glVertexWeightfEXT(float weight); void glVertexWeightPointerEXT(@GLsizei int size, @AutoType("pPointer") @GLenum int type, @GLsizei int stride, @CachedReference @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLfloat Buffer pPointer); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java0000644000175000017500000021031611543426511025262 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.*; @ForceInit @Dependent @DeprecatedGL public interface EXT_direct_state_access { /** * Accepted by the <pname> parameter of GetBooleanIndexedvEXT, * GetIntegerIndexedvEXT, GetFloatIndexedvEXT, GetDoubleIndexedvEXT: * GetBooleani_v, GetIntegeri_v, GetFloati_vEXT, GetDoublei_vEXT: */ int GL_PROGRAM_MATRIX_EXT = 0x8E2D; int GL_TRANSPOSE_PROGRAM_MATRIX_EXT = 0x8E2E; int GL_PROGRAM_MATRIX_STACK_DEPTH_EXT = 0x8E2F; /* OpenGL 1.1: New client commands */ @DeprecatedGL void glClientAttribDefaultEXT(@GLbitfield int mask); @DeprecatedGL void glPushClientAttribDefaultEXT(@GLbitfield int mask); /* OpenGL 1.0: New matrix commands add "Matrix" prefix to name, drops "Matrix" suffix from name, and add initial "enum matrixMode" parameter */ @StripPostfix("m") @DeprecatedGL void glMatrixLoadfEXT(@GLenum int matrixMode, @Check("16") @Const FloatBuffer m); @StripPostfix("m") @DeprecatedGL void glMatrixLoaddEXT(@GLenum int matrixMode, @Check("16") @Const DoubleBuffer m); @StripPostfix("m") @DeprecatedGL void glMatrixMultfEXT(@GLenum int matrixMode, @Check("16") @Const FloatBuffer m); @StripPostfix("m") @DeprecatedGL void glMatrixMultdEXT(@GLenum int matrixMode, @Check("16") @Const DoubleBuffer m); @DeprecatedGL void glMatrixLoadIdentityEXT(@GLenum int matrixMode); @DeprecatedGL void glMatrixRotatefEXT(@GLenum int matrixMode, float angle, float x, float y, float z); @DeprecatedGL void glMatrixRotatedEXT(@GLenum int matrixMode, double angle, double x, double y, double z); @DeprecatedGL void glMatrixScalefEXT(@GLenum int matrixMode, float x, float y, float z); @DeprecatedGL void glMatrixScaledEXT(@GLenum int matrixMode, double x, double y, double z); @DeprecatedGL void glMatrixTranslatefEXT(@GLenum int matrixMode, float x, float y, float z); @DeprecatedGL void glMatrixTranslatedEXT(@GLenum int matrixMode, double x, double y, double z); @DeprecatedGL void glMatrixOrthoEXT(@GLenum int matrixMode, double l, double r, double b, double t, double n, double f); @DeprecatedGL void glMatrixFrustumEXT(@GLenum int matrixMode, double l, double r, double b, double t, double n, double f); @DeprecatedGL void glMatrixPushEXT(@GLenum int matrixMode); @DeprecatedGL void glMatrixPopEXT(@GLenum int matrixMode); /* OpenGL 1.1: New texture object commands and queries replace "Tex" in name with "Texture" and add initial "uint texture" parameter */ void glTextureParameteriEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, int param); @StripPostfix("param") void glTextureParameterivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Check("4") @Const IntBuffer param); void glTextureParameterfEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, float param); @StripPostfix("param") void glTextureParameterfvEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Check("4") @Const FloatBuffer param); void glTextureImage1DEXT(@GLuint int texture, @GLenum int target, int level, int internalformat, @GLsizei int width, int border, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check(value = "GLChecks.calculateTexImage1DStorage(pixels, format, type, width)", canBeNull = true) @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); void glTextureImage2DEXT(@GLuint int texture, @GLenum int target, int level, int internalformat, @GLsizei int width, @GLsizei int height, int border, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check(value = "GLChecks.calculateTexImage2DStorage(pixels, format, type, width, height)", canBeNull = true) @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); void glTextureSubImage1DEXT(@GLuint int texture, @GLenum int target, int level, int xoffset, @GLsizei int width, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check("GLChecks.calculateImageStorage(pixels, format, type, width, 1, 1)") @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); void glTextureSubImage2DEXT(@GLuint int texture, @GLenum int target, int level, int xoffset, int yoffset, @GLsizei int width, @GLsizei int height, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, 1)") @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); void glCopyTextureImage1DEXT(@GLuint int texture, @GLenum int target, int level, @GLenum int internalformat, int x, int y, @GLsizei int width, int border); void glCopyTextureImage2DEXT(@GLuint int texture, @GLenum int target, int level, @GLenum int internalformat, int x, int y, @GLsizei int width, @GLsizei int height, int border); void glCopyTextureSubImage1DEXT(@GLuint int texture, @GLenum int target, int level, int xoffset, int x, int y, @GLsizei int width); void glCopyTextureSubImage2DEXT(@GLuint int texture, @GLenum int target, int level, int xoffset, int yoffset, int x, int y, @GLsizei int width, @GLsizei int height); void glGetTextureImageEXT(@GLuint int texture, @GLenum int target, int level, @GLenum int format, @GLenum int type, @OutParameter @BufferObject(BufferKind.PackPBO) @Check("GLChecks.calculateImageStorage(pixels, format, type, 1, 1, 1)") @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); @StripPostfix("params") void glGetTextureParameterfvEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @Alternate("glGetTextureParameterfvEXT") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetTextureParameterfvEXT2(@GLuint int texture, @GLenum int target, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") void glGetTextureParameterivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetTextureParameterivEXT") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetTextureParameterivEXT2(@GLuint int texture, @GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") void glGetTextureLevelParameterfvEXT(@GLuint int texture, @GLenum int target, int level, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @Alternate("glGetTextureLevelParameterfvEXT") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetTextureLevelParameterfvEXT2(@GLuint int texture, @GLenum int target, int level, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") void glGetTextureLevelParameterivEXT(@GLuint int texture, @GLenum int target, int level, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetTextureLevelParameterivEXT") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetTextureLevelParameterivEXT2(@GLuint int texture, @GLenum int target, int level, @GLenum int pname, @OutParameter IntBuffer params); /* OpenGL 1.2: New 3D texture object commands replace "Tex" in name with "Texture" and adds initial "uint texture" parameter */ @Dependent("OpenGL12") void glTextureImage3DEXT(@GLuint int texture, @GLenum int target, int level, int internalformat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, int border, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check(value = "GLChecks.calculateTexImage3DStorage(pixels, format, type, width, height, depth)", canBeNull = true) @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); @Dependent("OpenGL12") void glTextureSubImage3DEXT(@GLuint int texture, @GLenum int target, int level, int xoffset, int yoffset, int zoffset, @GLsizei int width, @GLsizei int height, @GLsizei int depth, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, depth)") @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); @Dependent("OpenGL12") void glCopyTextureSubImage3DEXT(@GLuint int texture, @GLenum int target, int level, int xoffset, int yoffset, int zoffset, int x, int y, @GLsizei int width, @GLsizei int height); /* OpenGL 1.2.1: New multitexture commands and queries prefix "Multi" before "Tex" and add an initial "enum texunit" parameter (to identify the texture unit */ @Dependent("OpenGL13") void glBindMultiTextureEXT(@GLenum int texunit, @GLenum int target, @GLuint int texture); @Dependent("OpenGL13") @DeprecatedGL void glMultiTexCoordPointerEXT(@GLenum int texunit, int size, @AutoType("pointer") @GLenum int type, @GLsizei int stride, @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLfloat @GLdouble Buffer pointer); @Dependent("OpenGL13") @DeprecatedGL void glMultiTexEnvfEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, float param); @Dependent("OpenGL13") @StripPostfix("params") @DeprecatedGL void glMultiTexEnvfvEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Check("4") @Const FloatBuffer params); @Dependent("OpenGL13") @DeprecatedGL void glMultiTexEnviEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, int param); @Dependent("OpenGL13") @StripPostfix("params") @DeprecatedGL void glMultiTexEnvivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Check("4") @Const IntBuffer params); @Dependent("OpenGL13") @DeprecatedGL void glMultiTexGendEXT(@GLenum int texunit, @GLenum int coord, @GLenum int pname, double param); @Dependent("OpenGL13") @StripPostfix("params") @DeprecatedGL void glMultiTexGendvEXT(@GLenum int texunit, @GLenum int coord, @GLenum int pname, @Check("4") @Const DoubleBuffer params); @Dependent("OpenGL13") @DeprecatedGL void glMultiTexGenfEXT(@GLenum int texunit, @GLenum int coord, @GLenum int pname, float param); @Dependent("OpenGL13") @StripPostfix("params") @DeprecatedGL void glMultiTexGenfvEXT(@GLenum int texunit, @GLenum int coord, @GLenum int pname, @Check("4") @Const FloatBuffer params); @Dependent("OpenGL13") @DeprecatedGL void glMultiTexGeniEXT(@GLenum int texunit, @GLenum int coord, @GLenum int pname, int param); @Dependent("OpenGL13") @StripPostfix("params") @DeprecatedGL void glMultiTexGenivEXT(@GLenum int texunit, @GLenum int coord, @GLenum int pname, @Check("4") @Const IntBuffer params); @Dependent("OpenGL13") @StripPostfix("params") @DeprecatedGL void glGetMultiTexEnvfvEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Check("4") @OutParameter FloatBuffer params); @Dependent("OpenGL13") @StripPostfix("params") @DeprecatedGL void glGetMultiTexEnvivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); @Dependent("OpenGL13") @StripPostfix("params") @DeprecatedGL void glGetMultiTexGendvEXT(@GLenum int texunit, @GLenum int coord, @GLenum int pname, @Check("4") @OutParameter DoubleBuffer params); @Dependent("OpenGL13") @StripPostfix("params") @DeprecatedGL void glGetMultiTexGenfvEXT(@GLenum int texunit, @GLenum int coord, @GLenum int pname, @Check("4") @OutParameter FloatBuffer params); @Dependent("OpenGL13") @StripPostfix("params") @DeprecatedGL void glGetMultiTexGenivEXT(@GLenum int texunit, @GLenum int coord, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); @Dependent("OpenGL13") void glMultiTexParameteriEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, int param); @Dependent("OpenGL13") @StripPostfix("param") void glMultiTexParameterivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Check("4") @Const IntBuffer param); @Dependent("OpenGL13") void glMultiTexParameterfEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, float param); @Dependent("OpenGL13") @StripPostfix("param") void glMultiTexParameterfvEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Check("4") @Const FloatBuffer param); @Dependent("OpenGL13") void glMultiTexImage1DEXT(@GLenum int texunit, @GLenum int target, int level, int internalformat, @GLsizei int width, int border, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check(value = "GLChecks.calculateTexImage1DStorage(pixels, format, type, width)", canBeNull = true) @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); @Dependent("OpenGL13") void glMultiTexImage2DEXT(@GLenum int texunit, @GLenum int target, int level, int internalformat, @GLsizei int width, @GLsizei int height, int border, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check(value = "GLChecks.calculateTexImage2DStorage(pixels, format, type, width, height)", canBeNull = true) @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); @Dependent("OpenGL13") void glMultiTexSubImage1DEXT(@GLenum int texunit, @GLenum int target, int level, int xoffset, @GLsizei int width, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check("GLChecks.calculateImageStorage(pixels, format, type, width, 1, 1)") @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); @Dependent("OpenGL13") void glMultiTexSubImage2DEXT(@GLenum int texunit, @GLenum int target, int level, int xoffset, int yoffset, @GLsizei int width, @GLsizei int height, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, 1)") @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); @Dependent("OpenGL13") void glCopyMultiTexImage1DEXT(@GLenum int texunit, @GLenum int target, int level, @GLenum int internalformat, int x, int y, @GLsizei int width, int border); @Dependent("OpenGL13") void glCopyMultiTexImage2DEXT(@GLenum int texunit, @GLenum int target, int level, @GLenum int internalformat, int x, int y, @GLsizei int width, @GLsizei int height, int border); @Dependent("OpenGL13") void glCopyMultiTexSubImage1DEXT(@GLenum int texunit, @GLenum int target, int level, int xoffset, int x, int y, @GLsizei int width); @Dependent("OpenGL13") void glCopyMultiTexSubImage2DEXT(@GLenum int texunit, @GLenum int target, int level, int xoffset, int yoffset, int x, int y, @GLsizei int width, @GLsizei int height); @Dependent("OpenGL13") void glGetMultiTexImageEXT(@GLenum int texunit, @GLenum int target, int level, @GLenum int format, @GLenum int type, @OutParameter @BufferObject(BufferKind.PackPBO) @Check("GLChecks.calculateImageStorage(pixels, format, type, 1, 1, 1)") @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); @Dependent("OpenGL13") @StripPostfix("params") void glGetMultiTexParameterfvEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Check("4") @OutParameter FloatBuffer params); @Alternate("glGetMultiTexParameterfvEXT") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetMultiTexParameterfvEXT2(@GLenum int texunit, @GLenum int target, @GLenum int pname, @OutParameter FloatBuffer params); @Dependent("OpenGL13") @StripPostfix("params") void glGetMultiTexParameterivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); @Alternate("glGetMultiTexParameterivEXT") @GLreturn("params") @Dependent("OpenGL13") @StripPostfix(value = "params", postfix = "v") void glGetMultiTexParameterivEXT2(@GLenum int texunit, @GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @Dependent("OpenGL13") @StripPostfix("params") void glGetMultiTexLevelParameterfvEXT(@GLenum int texunit, @GLenum int target, int level, @GLenum int pname, @Check("4") @OutParameter FloatBuffer params); @Alternate("glGetMultiTexLevelParameterfvEXT") @GLreturn("params") @Dependent("OpenGL13") @StripPostfix(value = "params", postfix = "v") void glGetMultiTexLevelParameterfvEXT2(@GLenum int texunit, @GLenum int target, int level, @GLenum int pname, @OutParameter FloatBuffer params); @Dependent("OpenGL13") @StripPostfix("params") void glGetMultiTexLevelParameterivEXT(@GLenum int texunit, @GLenum int target, int level, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); @Alternate("glGetMultiTexLevelParameterivEXT") @GLreturn("params") @Dependent("OpenGL13") @StripPostfix(value = "params", postfix = "v") void glGetMultiTexLevelParameterivEXT2(@GLenum int texunit, @GLenum int target, int level, @GLenum int pname, @OutParameter IntBuffer params); @Dependent("OpenGL13") void glMultiTexImage3DEXT(@GLenum int texunit, @GLenum int target, int level, int internalformat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, int border, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check(value = "GLChecks.calculateTexImage3DStorage(pixels, format, type, width, height, depth)", canBeNull = true) @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); @Dependent("OpenGL13") void glMultiTexSubImage3DEXT(@GLenum int texunit, @GLenum int target, int level, int xoffset, int yoffset, int zoffset, @GLsizei int width, @GLsizei int height, @GLsizei int depth, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, depth)") @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); @Dependent("OpenGL13") void glCopyMultiTexSubImage3DEXT(@GLenum int texunit, @GLenum int target, int level, int xoffset, int yoffset, int zoffset, int x, int y, @GLsizei int width, @GLsizei int height); /* OpenGL 1.2.1: New indexed texture commands and queries append "Indexed" to name and add "uint index" parameter (to identify the texture unit index) after state name parameters (if any) and before state value parameters */ @Dependent("OpenGL13") @DeprecatedGL void glEnableClientStateIndexedEXT(@GLenum int array, @GLuint int index); @Dependent("OpenGL13") @DeprecatedGL void glDisableClientStateIndexedEXT(@GLenum int array, @GLuint int index); /* OpenGL 3.0: New indexed texture commands and queries append "i" to name and add "uint index" parameter (to identify the texture unit index) after state name parameters (if any) and before state value parameters */ @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") @Dependent("OpenGL30") void glEnableClientStateiEXT(@GLenum int array, @GLuint int index); @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") @Dependent("OpenGL30") void glDisableClientStateiEXT(@GLenum int array, @GLuint int index); /* OpenGL 1.2.1: New indexed generic queries (added for indexed texture state) append "Indexed" to name and add "uint index" parameter (to identify the texture unit) after state name parameters (if any) and before state value parameters */ @Dependent("OpenGL13") @StripPostfix("params") void glGetFloatIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") FloatBuffer params); @Alternate("glGetFloatIndexedvEXT") @GLreturn("params") @Dependent("OpenGL13") @StripPostfix("params") void glGetFloatIndexedvEXT2(@GLenum int pname, @GLuint int index, @OutParameter FloatBuffer params); @Dependent("OpenGL13") @StripPostfix(value = "params", hasPostfix = false) void glGetDoubleIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") DoubleBuffer params); @Alternate("glGetDoubleIndexedvEXT") @GLreturn("params") @Dependent("OpenGL13") @StripPostfix(value = "params", hasPostfix = false) void glGetDoubleIndexedvEXT2(@GLenum int pname, @GLuint int index, @OutParameter DoubleBuffer params); @Dependent("OpenGL13") @StripPostfix("params") void glGetPointerIndexedvEXT(@GLenum int pname, @GLuint int index, @Result @GLvoid ByteBuffer params); /* OpenGL 3.0: New indexed generic queries (added for indexed texture state) replace "v" for "i_v" to name and add "uint index" parameter (to identify the texture unit) after state name parameters (if any) and before state value parameters */ @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") @Dependent("OpenGL30") @StripPostfix("params") void glGetFloati_vEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") FloatBuffer params); @Alternate("glGetFloati_vEXT") @GLreturn("params") @Dependent("OpenGL30") @StripPostfix("params") void glGetFloati_vEXT2(@GLenum int pname, @GLuint int index, @OutParameter FloatBuffer params); @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") @Dependent("OpenGL30") @StripPostfix("params") void glGetDoublei_vEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") DoubleBuffer params); @Alternate("glGetDoublei_vEXT") @GLreturn("params") @Dependent("OpenGL30") @StripPostfix("params") void glGetDoublei_vEXT2(@GLenum int pname, @GLuint int index, @OutParameter DoubleBuffer params); @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") @Dependent("OpenGL30") @StripPostfix(value = "params", hasPostfix = false) void glGetPointeri_vEXT(@GLenum int pname, @GLuint int index, @Result @GLvoid ByteBuffer params); /* OpenGL 1.2.1: Extend the functionality of these EXT_draw_buffers2 commands and queries for multitexture TODO: Why 1.2.1 and not EXT_draw_buffers2? */ @Reuse("EXTDrawBuffers2") @Dependent("OpenGL13") void glEnableIndexedEXT(@GLenum int cap, @GLuint int index); @Reuse("EXTDrawBuffers2") @Dependent("OpenGL13") void glDisableIndexedEXT(@GLenum int cap, @GLuint int index); @Reuse("EXTDrawBuffers2") @Dependent("OpenGL13") boolean glIsEnabledIndexedEXT(@GLenum int cap, @GLuint int index); @Reuse("EXTDrawBuffers2") @Dependent("OpenGL13") @StripPostfix("params") void glGetIntegerIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") IntBuffer params); @Reuse("EXTDrawBuffers2") @Alternate("glGetIntegerIndexedvEXT") @GLreturn("params") @Dependent("OpenGL13") @StripPostfix("params") void glGetIntegerIndexedvEXT2(@GLenum int pname, @GLuint int index, @OutParameter IntBuffer params); @Reuse("EXTDrawBuffers2") @Dependent("OpenGL13") @StripPostfix("params") void glGetBooleanIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("4") @GLboolean ByteBuffer params); @Reuse("EXTDrawBuffers2") @Alternate("glGetBooleanIndexedvEXT") @GLreturn("params") @Dependent("OpenGL13") @StripPostfix("params") void glGetBooleanIndexedvEXT2(@GLenum int pname, @GLuint int index, @OutParameter @GLboolean ByteBuffer params); /* ARB_vertex_program: New program commands and queries add "Named" prefix to name and adds initial "uint program" parameter */ @Dependent("GL_ARB_vertex_program") void glNamedProgramStringEXT(@GLuint int program, @GLenum int target, @GLenum int format, @AutoSize("string") @GLsizei int len, @Const @GLvoid Buffer string); @Alternate("glNamedProgramStringEXT") @Dependent("GL_ARB_vertex_program") void glNamedProgramStringEXT(@GLuint int program, @GLenum int target, @GLenum int format, @Constant("string.length()") @GLsizei int length, CharSequence string); @Dependent("GL_ARB_vertex_program") void glNamedProgramLocalParameter4dEXT(@GLuint int program, @GLenum int target, @GLuint int index, double x, double y, double z, double w); @Dependent("GL_ARB_vertex_program") @StripPostfix("params") void glNamedProgramLocalParameter4dvEXT(@GLuint int program, @GLenum int target, @GLuint int index, @Const @Check("4") DoubleBuffer params); @Dependent("GL_ARB_vertex_program") void glNamedProgramLocalParameter4fEXT(@GLuint int program, @GLenum int target, @GLuint int index, float x, float y, float z, float w); @Dependent("GL_ARB_vertex_program") @StripPostfix("params") void glNamedProgramLocalParameter4fvEXT(@GLuint int program, @GLenum int target, @GLuint int index, @Const @Check("4") FloatBuffer params); @Dependent("GL_ARB_vertex_program") @StripPostfix("params") void glGetNamedProgramLocalParameterdvEXT(@GLuint int program, @GLenum int target, @GLuint int index, @OutParameter @Check("4") DoubleBuffer params); @Dependent("GL_ARB_vertex_program") @StripPostfix("params") void glGetNamedProgramLocalParameterfvEXT(@GLuint int program, @GLenum int target, @GLuint int index, @OutParameter @Check("4") FloatBuffer params); @Dependent("GL_ARB_vertex_program") @StripPostfix("params") void glGetNamedProgramivEXT(@GLuint int program, @GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetNamedProgramivEXT") @GLreturn("params") @Dependent("GL_ARB_vertex_program") @StripPostfix("params") void glGetNamedProgramivEXT2(@GLuint int program, @GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @Dependent("GL_ARB_vertex_program") void glGetNamedProgramStringEXT(@GLuint int program, @GLenum int target, @GLenum int pname, @OutParameter @Check @GLvoid ByteBuffer string); @Alternate("glGetNamedProgramStringEXT") @Code("\t\tint programLength = glGetNamedProgramEXT(program, target, ARBProgram.GL_PROGRAM_LENGTH_ARB);") @GLreturn(value = "paramString", maxLength = "programLength", forceMaxLength = true) void glGetNamedProgramStringEXT2(@GLuint int program, @GLenum int target, @GLenum int pname, @OutParameter @GLchar ByteBuffer paramString); /* OpenGL 1.3: New compressed texture object commands replace "Tex" in name with "Texture" and add initial "uint texture" parameter */ @Dependent("OpenGL13") void glCompressedTextureImage3DEXT(@GLuint int texture, @GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, int border, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer data); @Dependent("OpenGL13") void glCompressedTextureImage2DEXT(@GLuint int texture, @GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, int border, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer data); @Dependent("OpenGL13") void glCompressedTextureImage1DEXT(@GLuint int texture, @GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, int border, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer data); @Dependent("OpenGL13") void glCompressedTextureSubImage3DEXT(@GLuint int texture, @GLenum int target, int level, int xoffset, int yoffset, int zoffset, @GLsizei int width, @GLsizei int height, @GLsizei int depth, @GLenum int format, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer data); @Dependent("OpenGL13") void glCompressedTextureSubImage2DEXT(@GLuint int texture, @GLenum int target, int level, int xoffset, int yoffset, @GLsizei int width, @GLsizei int height, @GLenum int format, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer data); @Dependent("OpenGL13") void glCompressedTextureSubImage1DEXT(@GLuint int texture, @GLenum int target, int level, int xoffset, @GLsizei int width, @GLenum int format, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer data); @Dependent("OpenGL13") void glGetCompressedTextureImageEXT(@GLuint int texture, @GLenum int target, int level, @OutParameter @BufferObject(BufferKind.PackPBO) @Check @GLbyte @GLshort @GLint Buffer img); /* OpenGL 1.3: New multitexture compressed texture commands and queries prefix "Multi" before "Tex" and add an initial "enum texunit" parameter (to identify the texture unit) */ @Dependent("OpenGL13") void glCompressedMultiTexImage3DEXT(@GLenum int texunit, @GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, int border, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer data); @Dependent("OpenGL13") void glCompressedMultiTexImage2DEXT(@GLenum int texunit, @GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, int border, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer data); @Dependent("OpenGL13") void glCompressedMultiTexImage1DEXT(@GLenum int texunit, @GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, int border, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer data); @Dependent("OpenGL13") void glCompressedMultiTexSubImage3DEXT(@GLenum int texunit, @GLenum int target, int level, int xoffset, int yoffset, int zoffset, @GLsizei int width, @GLsizei int height, @GLsizei int depth, @GLenum int format, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer data); @Dependent("OpenGL13") void glCompressedMultiTexSubImage2DEXT(@GLenum int texunit, @GLenum int target, int level, int xoffset, int yoffset, @GLsizei int width, @GLsizei int height, @GLenum int format, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer data); @Dependent("OpenGL13") void glCompressedMultiTexSubImage1DEXT(@GLenum int texunit, @GLenum int target, int level, int xoffset, @GLsizei int width, @GLenum int format, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer data); @Dependent("OpenGL13") void glGetCompressedMultiTexImageEXT(@GLenum int texunit, @GLenum int target, int level, @OutParameter @BufferObject(BufferKind.PackPBO) @Check @GLbyte @GLshort @GLint Buffer img); /* OpenGL 1.3: New transpose matrix commands add "Matrix" suffix to name, drops "Matrix" suffix from name, and add initial "enum matrixMode" parameter */ @Dependent("OpenGL13") @StripPostfix("m") @DeprecatedGL void glMatrixLoadTransposefEXT(@GLenum int matrixMode, @Check("16") @Const FloatBuffer m); @Dependent("OpenGL13") @StripPostfix("m") @DeprecatedGL void glMatrixLoadTransposedEXT(@GLenum int matrixMode, @Check("16") @Const DoubleBuffer m); @Dependent("OpenGL13") @StripPostfix("m") @DeprecatedGL void glMatrixMultTransposefEXT(@GLenum int matrixMode, @Check("16") @Const FloatBuffer m); @Dependent("OpenGL13") @StripPostfix("m") @DeprecatedGL void glMatrixMultTransposedEXT(@GLenum int matrixMode, @Check("16") @Const DoubleBuffer m); /* OpenGL 1.5: New buffer commands and queries replace "Buffer" with "NamedBuffer" in name and replace "enum target" parameter with "uint buffer" */ @Dependent("OpenGL15") @GenerateAutos void glNamedBufferDataEXT(@GLuint int buffer, @AutoSize("data") @GLsizeiptr long size, @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer data, @GLenum int usage); @Dependent("OpenGL15") void glNamedBufferSubDataEXT(@GLuint int buffer, @GLintptr long offset, @AutoSize("data") @GLsizeiptr long size, @Check @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer data); /** * glMapNamedBufferEXT maps a GL buffer object to a ByteBuffer. The old_buffer argument can be null, * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null, * it will be returned if it points to the same mapped memory and has the same capacity as the buffer object, * otherwise a new ByteBuffer is created. That way, an application will normally use glMapNamedBufferEXT like this: *

      * ByteBuffer mapped_buffer; mapped_buffer = glMapNamedBufferEXT(..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapNamedBufferEXT(..., ..., mapped_buffer); *

      * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused. *

      * The version of this method without an explicit length argument calls glGetNamedBufferParameterEXT internally to * retrieve the current buffer object size, which may cause a pipeline flush and reduce application performance. *

      * The version of this method with an explicit length argument is a fast alternative to the one without. No GL call * is made to retrieve the buffer object size, so the user is responsible for tracking and using the appropriate length.
      * Security warning: The length argument should match the buffer object size. Reading from or writing to outside * the memory region that corresponds to the mapped buffer object will cause native crashes. * * @param length the length of the mapped memory in bytes. * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created. * * @return A ByteBuffer representing the mapped buffer memory. */ @Dependent("OpenGL15") @CachedResult @GLvoid @AutoSize("GLChecks.getNamedBufferObjectSize(caps, buffer)") ByteBuffer glMapNamedBufferEXT(@GLuint int buffer, @GLenum int access); @Dependent("OpenGL15") boolean glUnmapNamedBufferEXT(@GLuint int buffer); @Dependent("OpenGL15") @StripPostfix("params") void glGetNamedBufferParameterivEXT(@GLuint int buffer, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetNamedBufferParameterivEXT") @GLreturn("params") @Dependent("OpenGL15") @StripPostfix("params") void glGetNamedBufferParameterivEXT2(@GLuint int buffer, @GLenum int pname, @OutParameter IntBuffer params); @Dependent("OpenGL15") @StripPostfix("params") @AutoSize("GLChecks.getNamedBufferObjectSize(caps, buffer)") void glGetNamedBufferPointervEXT(@GLuint int buffer, @GLenum int pname, @OutParameter @Result @GLvoid ByteBuffer params); @Dependent("OpenGL15") void glGetNamedBufferSubDataEXT(@GLuint int buffer, @GLintptr long offset, @AutoSize("data") @GLsizeiptr long size, @OutParameter @Check @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer data); /* OpenGL 2.0: New uniform commands add "Program" prefix to name and add initial "uint program" parameter */ @Dependent("OpenGL20") void glProgramUniform1fEXT(@GLuint int program, int location, float v0); @Dependent("OpenGL20") void glProgramUniform2fEXT(@GLuint int program, int location, float v0, float v1); @Dependent("OpenGL20") void glProgramUniform3fEXT(@GLuint int program, int location, float v0, float v1, float v2); @Dependent("OpenGL20") void glProgramUniform4fEXT(@GLuint int program, int location, float v0, float v1, float v2, float v3); @Dependent("OpenGL20") void glProgramUniform1iEXT(@GLuint int program, int location, int v0); @Dependent("OpenGL20") void glProgramUniform2iEXT(@GLuint int program, int location, int v0, int v1); @Dependent("OpenGL20") void glProgramUniform3iEXT(@GLuint int program, int location, int v0, int v1, int v2); @Dependent("OpenGL20") void glProgramUniform4iEXT(@GLuint int program, int location, int v0, int v1, int v2, int v3); @Dependent("OpenGL20") @StripPostfix("value") void glProgramUniform1fvEXT(@GLuint int program, int location, @AutoSize(value = "value") @GLsizei int count, @Const FloatBuffer value); @Dependent("OpenGL20") @StripPostfix("value") void glProgramUniform2fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const FloatBuffer value); @Dependent("OpenGL20") @StripPostfix("value") void glProgramUniform3fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const FloatBuffer value); @Dependent("OpenGL20") @StripPostfix("value") void glProgramUniform4fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const FloatBuffer value); @Dependent("OpenGL20") @StripPostfix("value") void glProgramUniform1ivEXT(@GLuint int program, int location, @AutoSize(value = "value") @GLsizei int count, @Const IntBuffer value); @Dependent("OpenGL20") @StripPostfix("value") void glProgramUniform2ivEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const IntBuffer value); @Dependent("OpenGL20") @StripPostfix("value") void glProgramUniform3ivEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const IntBuffer value); @Dependent("OpenGL20") @StripPostfix("value") void glProgramUniform4ivEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const IntBuffer value); @Dependent("OpenGL20") @StripPostfix("value") void glProgramUniformMatrix2fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @Dependent("OpenGL20") @StripPostfix("value") void glProgramUniformMatrix3fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @Dependent("OpenGL20") @StripPostfix("value") void glProgramUniformMatrix4fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 4") @GLsizei int count, boolean transpose, @Const FloatBuffer value); /* OpenGL 2.1: New uniform matrix commands add "Program" prefix to name and add initial "uint program" parameter */ @Dependent("OpenGL21") @StripPostfix("value") void glProgramUniformMatrix2x3fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (2 * 3)") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @Dependent("OpenGL21") @StripPostfix("value") void glProgramUniformMatrix3x2fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 2)") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @Dependent("OpenGL21") @StripPostfix("value") void glProgramUniformMatrix2x4fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @Dependent("OpenGL21") @StripPostfix("value") void glProgramUniformMatrix4x2fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @Dependent("OpenGL21") @StripPostfix("value") void glProgramUniformMatrix3x4fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 4)") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @Dependent("OpenGL21") @StripPostfix("value") void glProgramUniformMatrix4x3fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (4 * 3)") @GLsizei int count, boolean transpose, @Const FloatBuffer value); /* EXT_texture_buffer_object: New texture buffer object command replaces "Tex" in name with "Texture" and adds initial "uint texture" parameter */ @Dependent("GL_EXT_texture_buffer_object") void glTextureBufferEXT(@GLuint int texture, @GLenum int target, @GLenum int internalformat, @GLuint int buffer); /* EXT_texture_buffer_object: New multitexture texture buffer command prefixes "Multi" before "Tex" and add an initial "enum texunit" parameter (to identify the texture unit) */ @Dependent("GL_EXT_texture_buffer_object") void glMultiTexBufferEXT(@GLenum int texunit, @GLenum int target, @GLenum int internalformat, @GLuint int buffer); /* EXT_texture_integer: New integer texture object commands and queries replace "Tex" in name with "Texture" and add initial "uint texture" parameter */ @Dependent("GL_EXT_texture_integer") @StripPostfix("params") void glTextureParameterIivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Check("4") @Const IntBuffer params); @Alternate("glTextureParameterIivEXT") @Dependent("GL_EXT_texture_integer") @StripPostfix("param") void glTextureParameterIivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param); @Dependent("GL_EXT_texture_integer") @StripPostfix("params") void glTextureParameterIuivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Check("4") @Const @GLuint IntBuffer params); @Alternate("glTextureParameterIuivEXT") @Dependent("GL_EXT_texture_integer") @StripPostfix("param") void glTextureParameterIuivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) @GLuint int param); @Dependent("GL_EXT_texture_integer") @StripPostfix("params") void glGetTextureParameterIivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); @Alternate("glGetTextureParameterIivEXT") @GLreturn("params") @Dependent("GL_EXT_texture_integer") @StripPostfix(value = "params", postfix = "v") void glGetTextureParameterIivEXT2(@GLuint int texture, @GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @Dependent("GL_EXT_texture_integer") @StripPostfix("params") void glGetTextureParameterIuivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Check("4") @OutParameter @GLuint IntBuffer params); @Alternate("glGetTextureParameterIuivEXT") @GLreturn("params") @Dependent("GL_EXT_texture_integer") @StripPostfix(value = "params", postfix = "v") void glGetTextureParameterIuivEXT2(@GLuint int texture, @GLenum int target, @GLenum int pname, @OutParameter @GLuint IntBuffer params); /* EXT_texture_integer: New multitexture integer texture commands and queries prefix "Multi" before "Tex" and add an initial "enum texunit" parameter (to identify the texture unit) */ @Dependent("GL_EXT_texture_integer") @StripPostfix("params") void glMultiTexParameterIivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Check("4") @Const IntBuffer params); @Alternate("glMultiTexParameterIivEXT") @Dependent("GL_EXT_texture_integer") @StripPostfix("param") void glMultiTexParameterIivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param); @Dependent("GL_EXT_texture_integer") @StripPostfix("params") void glMultiTexParameterIuivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Check("4") @Const @GLuint IntBuffer params); @Alternate("glMultiTexParameterIuivEXT") @Dependent("GL_EXT_texture_integer") @StripPostfix("param") void glMultiTexParameterIuivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param); @Dependent("GL_EXT_texture_integer") @StripPostfix("params") void glGetMultiTexParameterIivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); @Alternate("glGetMultiTexParameterIivEXT") @GLreturn("params") @Dependent("GL_EXT_texture_integer") @StripPostfix(value = "params", postfix = "v") void glGetMultiTexParameterIivEXT2(@GLenum int texunit, @GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @Dependent("GL_EXT_texture_integer") @StripPostfix("params") void glGetMultiTexParameterIuivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Check("4") @OutParameter @GLuint IntBuffer params); @Alternate("glGetMultiTexParameterIuivEXT") @GLreturn("params") @Dependent("GL_EXT_texture_integer") @StripPostfix(value = "params", postfix = "v") void glGetMultiTexParameterIuivEXT2(@GLenum int texunit, @GLenum int target, @GLenum int pname, @OutParameter @GLuint IntBuffer params); /* EXT_gpu_shader4: New integer uniform commands add "Program" prefix to name and add initial "uint program" parameter */ @Dependent("GL_EXT_gpu_shader4") void glProgramUniform1uiEXT(@GLuint int program, int location, @GLuint int v0); @Dependent("GL_EXT_gpu_shader4") void glProgramUniform2uiEXT(@GLuint int program, int location, @GLuint int v0, @GLuint int v1); @Dependent("GL_EXT_gpu_shader4") void glProgramUniform3uiEXT(@GLuint int program, int location, @GLuint int v0, @GLuint int v1, @GLuint int v2); @Dependent("GL_EXT_gpu_shader4") void glProgramUniform4uiEXT(@GLuint int program, int location, @GLuint int v0, @GLuint int v1, @GLuint int v2, @GLuint int v3); @Dependent("GL_EXT_gpu_shader4") @StripPostfix("value") void glProgramUniform1uivEXT(@GLuint int program, int location, @AutoSize(value = "value") @GLsizei int count, @Const @GLuint IntBuffer value); @Dependent("GL_EXT_gpu_shader4") @StripPostfix("value") void glProgramUniform2uivEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const @GLuint IntBuffer value); @Dependent("GL_EXT_gpu_shader4") @StripPostfix("value") void glProgramUniform3uivEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const @GLuint IntBuffer value); @Dependent("GL_EXT_gpu_shader4") @StripPostfix("value") void glProgramUniform4uivEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const @GLuint IntBuffer value); /* EXT_gpu_program_parameters: New program command adds "Named" prefix to name and adds "uint program" parameter */ @Dependent("GL_EXT_gpu_program_parameters") @StripPostfix("params") void glNamedProgramLocalParameters4fvEXT(@GLuint int program, @GLenum int target, @GLuint int index, @AutoSize(value = "params", expression = " >> 2") @GLsizei int count, @Const FloatBuffer params); /* NV_gpu_program4: New program commands and queries add "Named" prefix to name and replace "enum target" with "uint program" */ @Dependent("GL_NV_gpu_program4") void glNamedProgramLocalParameterI4iEXT(@GLuint int program, @GLenum int target, @GLuint int index, int x, int y, int z, int w); @Dependent("GL_NV_gpu_program4") @StripPostfix("params") void glNamedProgramLocalParameterI4ivEXT(@GLuint int program, @GLenum int target, @GLuint int index, @Check("4") @Const IntBuffer params); @Dependent("GL_NV_gpu_program4") @StripPostfix("params") void glNamedProgramLocalParametersI4ivEXT(@GLuint int program, @GLenum int target, @GLuint int index, @AutoSize(value = "params", expression = " >> 2") @GLsizei int count, @Const IntBuffer params); @Dependent("GL_NV_gpu_program4") void glNamedProgramLocalParameterI4uiEXT(@GLuint int program, @GLenum int target, @GLuint int index, @GLuint int x, @GLuint int y, @GLuint int z, @GLuint int w); @Dependent("GL_NV_gpu_program4") @StripPostfix("params") void glNamedProgramLocalParameterI4uivEXT(@GLuint int program, @GLenum int target, @GLuint int index, @Check("4") @Const @GLuint IntBuffer params); @Dependent("GL_NV_gpu_program4") @StripPostfix("params") void glNamedProgramLocalParametersI4uivEXT(@GLuint int program, @GLenum int target, @GLuint int index, @AutoSize(value = "params", expression = " >> 2") @GLsizei int count, @Const @GLuint IntBuffer params); @Dependent("GL_NV_gpu_program4") @StripPostfix("params") void glGetNamedProgramLocalParameterIivEXT(@GLuint int program, @GLenum int target, @GLuint int index, @Check("4") @OutParameter IntBuffer params); @Dependent("GL_NV_gpu_program4") @StripPostfix("params") void glGetNamedProgramLocalParameterIuivEXT(@GLuint int program, @GLenum int target, @GLuint int index, @Check("4") @OutParameter @GLuint IntBuffer params); /* OpenGL 3.0: New renderbuffer commands add "Named" prefix to name and replace "enum target" with "uint renderbuffer" */ @Dependent("OpenGL30,GL_EXT_framebuffer_object") void glNamedRenderbufferStorageEXT(@GLuint int renderbuffer, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); @Dependent("OpenGL30,GL_EXT_framebuffer_object") @StripPostfix("params") void glGetNamedRenderbufferParameterivEXT(@GLuint int renderbuffer, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); @Alternate("glGetNamedRenderbufferParameterivEXT") @GLreturn("params") @Dependent("OpenGL30,GL_EXT_framebuffer_object") @StripPostfix("params") void glGetNamedRenderbufferParameterivEXT2(@GLuint int renderbuffer, @GLenum int pname, @OutParameter IntBuffer params); /* EXT_framebuffer_multisample: New renderbuffer commands add "Named" prefix to name and replace "enum target" with "uint renderbuffer" */ @Dependent("OpenGL30,GL_EXT_framebuffer_multisample") void glNamedRenderbufferStorageMultisampleEXT(@GLuint int renderbuffer, @GLsizei int samples, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); /* NV_framebuffer_multisample_coverage: New renderbuffer commands add "Named" prefix to name and replace "enum target" with "uint renderbuffer" */ @Dependent("GL_NV_framebuffer_multisample_coverage") void glNamedRenderbufferStorageMultisampleCoverageEXT(@GLuint int renderbuffer, @GLsizei int coverageSamples, @GLsizei int colorSamples, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); /* OpenGL 3.0: New framebuffer commands add "Named" prefix to name and replace "enum target" with "uint framebuffer" */ @Dependent("OpenGL30,GL_EXT_framebuffer_object") @GLenum int glCheckNamedFramebufferStatusEXT(@GLuint int framebuffer, @GLenum int target); @Dependent("OpenGL30,GL_EXT_framebuffer_object") void glNamedFramebufferTexture1DEXT(@GLuint int framebuffer, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level); @Dependent("OpenGL30,GL_EXT_framebuffer_object") void glNamedFramebufferTexture2DEXT(@GLuint int framebuffer, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level); @Dependent("OpenGL30,GL_EXT_framebuffer_object") void glNamedFramebufferTexture3DEXT(@GLuint int framebuffer, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level, int zoffset); @Dependent("OpenGL30,GL_EXT_framebuffer_object") void glNamedFramebufferRenderbufferEXT(@GLuint int framebuffer, @GLenum int attachment, @GLenum int renderbuffertarget, @GLuint int renderbuffer); @Dependent("OpenGL30,GL_EXT_framebuffer_object") @StripPostfix("params") void glGetNamedFramebufferAttachmentParameterivEXT(@GLuint int framebuffer, @GLenum int attachment, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); @Alternate("glGetNamedFramebufferAttachmentParameterivEXT") @GLreturn("params") @Dependent("OpenGL30,GL_EXT_framebuffer_object") @StripPostfix("params") void glGetNamedFramebufferAttachmentParameterivEXT2(@GLuint int framebuffer, @GLenum int attachment, @GLenum int pname, @OutParameter IntBuffer params); /* OpenGL 3.0: New texture commands add "Texture" within name and replace "enum target" with "uint texture" */ @Dependent("OpenGL30,GL_EXT_framebuffer_object") void glGenerateTextureMipmapEXT(@GLuint int texture, @GLenum int target); /* OpenGL 3.0: New texture commands add "MultiTex" within name and replace "enum target" with "enum texunit" */ @Dependent("OpenGL30,GL_EXT_framebuffer_object") void glGenerateMultiTexMipmapEXT(@GLenum int texunit, @GLenum int target); /* OpenGL 3.0: New framebuffer commands */ @Dependent("OpenGL30,GL_EXT_framebuffer_object") void glFramebufferDrawBufferEXT(@GLuint int framebuffer, @GLenum int mode); @Dependent("OpenGL30,GL_EXT_framebuffer_object") void glFramebufferDrawBuffersEXT(@GLuint int framebuffer, @AutoSize("bufs") @GLsizei int n, @Const @GLenum IntBuffer bufs); @Dependent("OpenGL30,GL_EXT_framebuffer_object") void glFramebufferReadBufferEXT(@GLuint int framebuffer, @GLenum int mode); /* OpenGL 3.0: New framebuffer query */ @Dependent("OpenGL30,GL_EXT_framebuffer_object") @StripPostfix("param") void glGetFramebufferParameterivEXT(@GLuint int framebuffer, @GLenum int pname, @Check("4") @OutParameter IntBuffer param); @Alternate("glGetFramebufferParameterivEXT") @GLreturn("param") @Dependent("OpenGL30,GL_EXT_framebuffer_object") @StripPostfix("param") void glGetFramebufferParameterivEXT2(@GLuint int framebuffer, @GLenum int pname, @OutParameter IntBuffer param); /* OpenGL 3.1: New buffer data copy command */ @Dependent("OpenGL31,GL_ARB_copy_buffer") void glNamedCopyBufferSubDataEXT(@GLuint int readBuffer, @GLuint int writeBuffer, @GLintptr long readoffset, @GLintptr long writeoffset, @GLsizeiptr long size); /* EXT_geometry_shader4 or NV_geometry_program4: New framebuffer commands add "Named" prefix to name and replace "enum target" with "uint framebuffer" */ @Dependent("GL_EXT_geometry_shader4,NV_geometry_program4") void glNamedFramebufferTextureEXT(@GLuint int framebuffer, @GLenum int attachment, @GLuint int texture, int level); @Dependent("GL_EXT_geometry_shader4,NV_geometry_program4") void glNamedFramebufferTextureLayerEXT(@GLuint int framebuffer, @GLenum int attachment, @GLuint int texture, int level, int layer); @Dependent("GL_EXT_geometry_shader4,NV_geometry_program4") void glNamedFramebufferTextureFaceEXT(@GLuint int framebuffer, @GLenum int attachment, @GLuint int texture, int level, @GLenum int face); /* NV_explicit_multisample: New texture renderbuffer object command replaces "Tex" in name with "Texture" and add initial "uint texture" parameter */ @Dependent("GL_NV_explicit_multisample") void glTextureRenderbufferEXT(@GLuint int texture, @GLenum int target, @GLuint int renderbuffer); /* NV_explicit_multisample: New multitexture texture renderbuffer command prefixes "Multi" before "Tex" and add an initial "enum texunit" parameter (to identify the texture unit) */ @Dependent("GL_NV_explicit_multisample") void glMultiTexRenderbufferEXT(@GLenum int texunit, @GLenum int target, @GLuint int renderbuffer); /* OpenGL 3.0: New vertex array specification commands for vertex array objects prefix "VertexArray", add initial "uint vaobj" and "uint buffer" parameters, change "Pointer" suffix to "Offset", and change the final parameter from "const void *" to "intptr offset" */ @Dependent("OpenGL30") @DeprecatedGL void glVertexArrayVertexOffsetEXT(@GLuint int vaobj, @GLuint int buffer, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset); @Dependent("OpenGL30") @DeprecatedGL void glVertexArrayColorOffsetEXT(@GLuint int vaobj, @GLuint int buffer, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset); @Dependent("OpenGL30") @DeprecatedGL void glVertexArrayEdgeFlagOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLsizei int stride, @GLintptr long offset); @Dependent("OpenGL30") void glVertexArrayIndexOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLenum int type, @GLsizei int stride, @GLintptr long offset); @Dependent("OpenGL30") @DeprecatedGL void glVertexArrayNormalOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLenum int type, @GLsizei int stride, @GLintptr long offset); @Dependent("OpenGL30") @DeprecatedGL void glVertexArrayTexCoordOffsetEXT(@GLuint int vaobj, @GLuint int buffer, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset); @Dependent("OpenGL30") @DeprecatedGL void glVertexArrayMultiTexCoordOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLenum int texunit, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset); @Dependent("OpenGL30") @DeprecatedGL void glVertexArrayFogCoordOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLenum int type, @GLsizei int stride, @GLintptr long offset); @Dependent("OpenGL30") @DeprecatedGL void glVertexArraySecondaryColorOffsetEXT(@GLuint int vaobj, @GLuint int buffer, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset); @Dependent("OpenGL30") void glVertexArrayVertexAttribOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLuint int index, int size, @GLenum int type, boolean normalized, @GLsizei int stride, @GLintptr long offset); @Dependent("OpenGL30") void glVertexArrayVertexAttribIOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLuint int index, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset); /* OpenGL 3.0: New vertex array enable commands for vertex array objects change "ClientState" to "VertexArray" and add an initial "uint vaobj" parameter */ @Dependent("OpenGL30") void glEnableVertexArrayEXT(@GLuint int vaobj, @GLenum int array); @Dependent("OpenGL30") void glDisableVertexArrayEXT(@GLuint int vaobj, @GLenum int array); /* OpenGL 3.0: New vertex attrib array enable commands for vertex array objects change "VertexAttribArray" to "VertexArrayAttrib" and add an initial "uint vaobj" parameter */ @Dependent("OpenGL30") void glEnableVertexArrayAttribEXT(@GLuint int vaobj, @GLuint int index); @Dependent("OpenGL30") void glDisableVertexArrayAttribEXT(@GLuint int vaobj, @GLuint int index); /* OpenGL 3.0: New queries for vertex array objects */ @Dependent("OpenGL30") @StripPostfix("param") void glGetVertexArrayIntegervEXT(@GLuint int vaobj, @GLenum int pname, @OutParameter @Check("16") IntBuffer param); @Alternate("glGetVertexArrayIntegervEXT") @GLreturn("param") @Dependent("OpenGL30") @StripPostfix("param") void glGetVertexArrayIntegervEXT2(@GLuint int vaobj, @GLenum int pname, @OutParameter IntBuffer param); @Dependent("OpenGL30") @StripPostfix("param") void glGetVertexArrayPointervEXT(@GLuint int vaobj, @GLenum int pname, @Result @GLvoid ByteBuffer param); @Dependent("OpenGL30") @StripPostfix(value = "param") void glGetVertexArrayIntegeri_vEXT(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @OutParameter @Check("16") IntBuffer param); @Alternate("glGetVertexArrayIntegeri_vEXT") @GLreturn("param") @Dependent("OpenGL30") @StripPostfix(value = "param", postfix = "_v") void glGetVertexArrayIntegeri_vEXT2(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @OutParameter IntBuffer param); @Dependent("OpenGL30") @StripPostfix(value = "param") void glGetVertexArrayPointeri_vEXT(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @Result @GLvoid ByteBuffer param); /* OpenGL 3.0: New buffer commands replace "Buffer" with "NamedBuffer" in name and replace "enum target" parameter with "uint buffer" */ /** * glMapNamedBufferRangeEXT maps a GL buffer object range to a ByteBuffer. The old_buffer argument can be null, * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null, * it will be returned if it points to the same mapped memory and has the same capacity as the buffer object, * otherwise a new ByteBuffer is created. That way, an application will normally use glMapNamedBufferRangeEXT like this: *

      * ByteBuffer mapped_buffer; mapped_buffer = glMapNamedBufferRangeEXT(..., ..., ..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapNamedBufferRangeEXT(..., ..., ..., ..., mapped_buffer); *

      * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused. * * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created. * * @return A ByteBuffer representing the mapped buffer memory. */ @Dependent("OpenGL30") @CachedResult(isRange = true) @GLvoid @AutoSize("length") ByteBuffer glMapNamedBufferRangeEXT(@GLuint int buffer, @GLintptr long offset, @GLsizeiptr long length, @GLbitfield int access); @Dependent("OpenGL30") void glFlushMappedNamedBufferRangeEXT(@GLuint int buffer, @GLintptr long offset, @GLsizeiptr long length); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/GL15.java0000644000175000017500000002410611543426511021217 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; public interface GL15 { // ---------------------------------------------------------------------- // ---------------------- ARB_vertex_buffer_object ---------------------- // ---------------------------------------------------------------------- int GL_ARRAY_BUFFER = 0x8892; int GL_ELEMENT_ARRAY_BUFFER = 0x8893; int GL_ARRAY_BUFFER_BINDING = 0x8894; int GL_ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; int GL_VERTEX_ARRAY_BUFFER_BINDING = 0x8896; int GL_NORMAL_ARRAY_BUFFER_BINDING = 0x8897; int GL_COLOR_ARRAY_BUFFER_BINDING = 0x8898; int GL_INDEX_ARRAY_BUFFER_BINDING = 0x8899; int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = 0x889A; int GL_EDGE_FLAG_ARRAY_BUFFER_BINDING = 0x889B; int GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING = 0x889C; int GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING = 0x889D; int GL_WEIGHT_ARRAY_BUFFER_BINDING = 0x889E; int GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; int GL_STREAM_DRAW = 0x88E0; int GL_STREAM_READ = 0x88E1; int GL_STREAM_COPY = 0x88E2; int GL_STATIC_DRAW = 0x88E4; int GL_STATIC_READ = 0x88E5; int GL_STATIC_COPY = 0x88E6; int GL_DYNAMIC_DRAW = 0x88E8; int GL_DYNAMIC_READ = 0x88E9; int GL_DYNAMIC_COPY = 0x88EA; int GL_READ_ONLY = 0x88B8; int GL_WRITE_ONLY = 0x88B9; int GL_READ_WRITE = 0x88BA; int GL_BUFFER_SIZE = 0x8764; int GL_BUFFER_USAGE = 0x8765; int GL_BUFFER_ACCESS = 0x88BB; int GL_BUFFER_MAPPED = 0x88BC; int GL_BUFFER_MAP_POINTER = 0x88BD; int GL_FOG_COORD_SRC = GL14.GL_FOG_COORDINATE_SOURCE; int GL_FOG_COORD = GL14.GL_FOG_COORDINATE; int GL_CURRENT_FOG_COORD = GL14.GL_CURRENT_FOG_COORDINATE; int GL_FOG_COORD_ARRAY_TYPE = GL14.GL_FOG_COORDINATE_ARRAY_TYPE; int GL_FOG_COORD_ARRAY_STRIDE = GL14.GL_FOG_COORDINATE_ARRAY_STRIDE; int GL_FOG_COORD_ARRAY_POINTER = GL14.GL_FOG_COORDINATE_ARRAY_POINTER; int GL_FOG_COORD_ARRAY = GL14.GL_FOG_COORDINATE_ARRAY; int GL_FOG_COORD_ARRAY_BUFFER_BINDING = GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING; int GL_SRC0_RGB = GL13.GL_SOURCE0_RGB; int GL_SRC1_RGB = GL13.GL_SOURCE1_RGB; int GL_SRC2_RGB = GL13.GL_SOURCE2_RGB; int GL_SRC0_ALPHA = GL13.GL_SOURCE0_ALPHA; int GL_SRC1_ALPHA = GL13.GL_SOURCE1_ALPHA; int GL_SRC2_ALPHA = GL13.GL_SOURCE2_ALPHA; @Code(" StateTracker.bindBuffer(caps, target, buffer);") void glBindBuffer(@GLenum int target, @GLuint int buffer); void glDeleteBuffers(@AutoSize("buffers") @GLsizei int n, @Const @GLuint IntBuffer buffers); @Alternate("glDeleteBuffers") void glDeleteBuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer); void glGenBuffers(@AutoSize("buffers") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers); @Alternate("glGenBuffers") @GLreturn("buffers") void glGenBuffers2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers); boolean glIsBuffer(@GLuint int buffer); @GenerateAutos void glBufferData(@GLenum int target, @AutoSize("data") @GLsizeiptr long size, @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer data, @GLenum int usage); void glBufferSubData(@GLenum int target, @GLintptr long offset, @AutoSize("data") @GLsizeiptr long size, @Check @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer data); void glGetBufferSubData(@GLenum int target, @GLintptr long offset, @AutoSize("data") @GLsizeiptr long size, @OutParameter @Check @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer data); /** * glMapBuffer maps a GL buffer object to a ByteBuffer. The old_buffer argument can be null, * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null, * it will be returned if it points to the same mapped memory and has the same capacity as the buffer object, * otherwise a new ByteBuffer is created. That way, an application will normally use glMapBuffer like this: *

      * ByteBuffer mapped_buffer; mapped_buffer = glMapBuffer(..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapBuffer(..., ..., mapped_buffer); *

      * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused. *

      * The version of this method without an explicit length argument calls glGetBufferParameter internally to * retrieve the current buffer object size, which may cause a pipeline flush and reduce application performance. *

      * The version of this method with an explicit length argument is a fast alternative to the one without. No GL call * is made to retrieve the buffer object size, so the user is responsible for tracking and using the appropriate length.
      * Security warning: The length argument should match the buffer object size. Reading from or writing to outside * the memory region that corresponds to the mapped buffer object will cause native crashes. * * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created. * * @return A ByteBuffer representing the mapped buffer memory. */ @CachedResult @GLvoid @AutoSize("GLChecks.getBufferObjectSize(caps, target)") ByteBuffer glMapBuffer(@GLenum int target, @GLenum int access); boolean glUnmapBuffer(@GLenum int target); @StripPostfix("params") void glGetBufferParameteriv(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetBufferParameteriv") @GLreturn("params") @StripPostfix("params") void glGetBufferParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("pointer") @AutoSize("GLChecks.getBufferObjectSize(caps, target)") void glGetBufferPointerv(@GLenum int target, @GLenum int pname, @OutParameter @Result @GLvoid ByteBuffer pointer); // ----------------------------------------------------------------- // ---------------------- ARB_occlusion_query ---------------------- // ----------------------------------------------------------------- /** * Accepted by the <target> parameter of BeginQuery, EndQuery, * and GetQueryiv: */ int GL_SAMPLES_PASSED = 0x8914; /** Accepted by the <pname> parameter of GetQueryiv: */ int GL_QUERY_COUNTER_BITS = 0x8864; int GL_CURRENT_QUERY = 0x8865; /** * Accepted by the <pname> parameter of GetQueryObjectiv and * GetQueryObjectuiv: */ int GL_QUERY_RESULT = 0x8866; int GL_QUERY_RESULT_AVAILABLE = 0x8867; void glGenQueries(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); @Alternate("glGenQueries") @GLreturn("ids") void glGenQueries2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); void glDeleteQueries(@AutoSize("ids") @GLsizei int n, @GLuint IntBuffer ids); @Alternate("glDeleteQueries") void glDeleteQueries(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, id), 0", keepParam = true) int id); boolean glIsQuery(@GLuint int id); void glBeginQuery(@GLenum int target, @GLuint int id); void glEndQuery(@GLenum int target); @StripPostfix("params") void glGetQueryiv(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); @Alternate("glGetQueryiv") @GLreturn("params") @StripPostfix("params") void glGetQueryiv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") void glGetQueryObjectiv(@GLenum int id, @GLenum int pname, @OutParameter @Check("1") @GLint IntBuffer params); @Alternate("glGetQueryObjectiv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetQueryObjectiv2(@GLenum int id, @GLenum int pname, @OutParameter @GLint IntBuffer params); @StripPostfix("params") void glGetQueryObjectuiv(@GLenum int id, @GLenum int pname, @OutParameter @Check("1") @GLuint IntBuffer params); @Alternate("glGetQueryObjectuiv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetQueryObjectuiv2(@GLenum int id, @GLenum int pname, @OutParameter @GLuint IntBuffer params); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/GL40.java0000644000175000017500000004574611543426511021232 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.ByteBuffer; import java.nio.DoubleBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; import com.sun.mirror.type.PrimitiveType; public interface GL40 { // ---------------------------------------------------------------------- // ----------------------[ ARB_draw_buffers_blend ]---------------------- // ---------------------------------------------------------------------- void glBlendEquationi(@GLuint int buf, @GLenum int mode); void glBlendEquationSeparatei(@GLuint int buf, @GLenum int modeRGB, @GLenum int modeAlpha); void glBlendFunci(@GLuint int buf, @GLenum int src, @GLenum int dst); void glBlendFuncSeparatei(@GLuint int buf, @GLenum int srcRGB, @GLenum int dstRGB, @GLenum int srcAlpha, @GLenum int dstAlpha); // ----------------------------------------------------------------- // ----------------------[ ARB_draw_indirect ]---------------------- // ----------------------------------------------------------------- /** * Accepted by the <target> parameters of BindBuffer, BufferData, * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, * GetBufferPointerv, MapBufferRange, FlushMappedBufferRange, * GetBufferParameteriv, BindBufferRange, BindBufferBase, and * CopyBufferSubData: */ int GL_DRAW_INDIRECT_BUFFER = 0x8F3F; /** * Accepted by the <value> parameter of GetIntegerv, GetBooleanv, GetFloatv, * and GetDoublev: */ int GL_DRAW_INDIRECT_BUFFER_BINDING = 0x8F43; void glDrawArraysIndirect(@GLenum int mode, @BufferObject(BufferKind.IndirectBO) @Check("4") @NullTerminated @Const @GLvoid(PrimitiveType.Kind.INT) IntBuffer indirect); void glDrawElementsIndirect(@GLenum int mode, @GLenum int type, @BufferObject(BufferKind.IndirectBO) @Check("5") @NullTerminated @Const @GLvoid(PrimitiveType.Kind.INT) IntBuffer indirect); // --------------------------------------------------------------- // ----------------------[ ARB_gpu_shader5 ]---------------------- // --------------------------------------------------------------- /** Accepted by the <pname> parameter of GetProgramiv: */ int GL_GEOMETRY_SHADER_INVOCATIONS = 0x887F; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * GetDoublev, and GetInteger64v: */ int GL_MAX_GEOMETRY_SHADER_INVOCATIONS = 0x8E5A; int GL_MIN_FRAGMENT_INTERPOLATION_OFFSET = 0x8E5B; int GL_MAX_FRAGMENT_INTERPOLATION_OFFSET = 0x8E5C; int GL_FRAGMENT_INTERPOLATION_OFFSET_BITS = 0x8E5D; int GL_MAX_VERTEX_STREAMS = 0x8E71; // ------------------------------------------------------------------- // ----------------------[ ARB_gpu_shader_fp64 ]---------------------- // ------------------------------------------------------------------- /** * Returned in the <type> parameter of GetActiveUniform, and * GetTransformFeedbackVarying: */ int GL_DOUBLE_VEC2 = 0x8FFC; int GL_DOUBLE_VEC3 = 0x8FFD; int GL_DOUBLE_VEC4 = 0x8FFE; int GL_DOUBLE_MAT2 = 0x8F46; int GL_DOUBLE_MAT3 = 0x8F47; int GL_DOUBLE_MAT4 = 0x8F48; int GL_DOUBLE_MAT2x3 = 0x8F49; int GL_DOUBLE_MAT2x4 = 0x8F4A; int GL_DOUBLE_MAT3x2 = 0x8F4B; int GL_DOUBLE_MAT3x4 = 0x8F4C; int GL_DOUBLE_MAT4x2 = 0x8F4D; int GL_DOUBLE_MAT4x3 = 0x8F4E; void glUniform1d(int location, double x); void glUniform2d(int location, double x, double y); void glUniform3d(int location, double x, double y, double z); void glUniform4d(int location, double x, double y, double z, double w); @StripPostfix("value") void glUniform1dv(int location, @AutoSize("value") @GLsizei int count, @Const DoubleBuffer value); @StripPostfix("value") void glUniform2dv(int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const DoubleBuffer value); @StripPostfix("value") void glUniform3dv(int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const DoubleBuffer value); @StripPostfix("value") void glUniform4dv(int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const DoubleBuffer value); @StripPostfix("value") void glUniformMatrix2dv(int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @StripPostfix("value") void glUniformMatrix3dv(int location, @AutoSize(value = "value", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @StripPostfix("value") void glUniformMatrix4dv(int location, @AutoSize(value = "value", expression = " >> 4") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @StripPostfix("value") void glUniformMatrix2x3dv(int location, @AutoSize(value = "value", expression = " / (2 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @StripPostfix("value") void glUniformMatrix2x4dv(int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @StripPostfix("value") void glUniformMatrix3x2dv(int location, @AutoSize(value = "value", expression = " / (3 * 2)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @StripPostfix("value") void glUniformMatrix3x4dv(int location, @AutoSize(value = "value", expression = " / (3 * 4)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @StripPostfix("value") void glUniformMatrix4x2dv(int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @StripPostfix("value") void glUniformMatrix4x3dv(int location, @AutoSize(value = "value", expression = " / (4 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @StripPostfix("params") void glGetUniformdv(@GLuint int program, int location, @OutParameter @Check DoubleBuffer params); // ------------------------------------------------------------------ // ----------------------[ ARB_sample_shading ]---------------------- // ------------------------------------------------------------------ /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, * and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_SAMPLE_SHADING = 0x8C36; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, * GetIntegerv, and GetFloatv: */ int GL_MIN_SAMPLE_SHADING_VALUE = 0x8C37; @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") void glMinSampleShading(@GLclampf float value); // --------------------------------------------------------------------- // ----------------------[ ARB_shader_subroutine ]---------------------- // --------------------------------------------------------------------- /** Accepted by the <pname> parameter of GetProgramStageiv: */ int GL_ACTIVE_SUBROUTINES = 0x8DE5; int GL_ACTIVE_SUBROUTINE_UNIFORMS = 0x8DE6; int GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS = 0x8E47; int GL_ACTIVE_SUBROUTINE_MAX_LENGTH = 0x8E48; int GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH = 0x8E49; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, GetDoublev, and GetInteger64v: */ int GL_MAX_SUBROUTINES = 0x8DE7; int GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS = 0x8DE8; /** Accepted by the <pname> parameter of GetActiveSubroutineUniformiv: */ int GL_NUM_COMPATIBLE_SUBROUTINES = 0x8E4A; int GL_COMPATIBLE_SUBROUTINES = 0x8E4B; int GL_UNIFORM_SIZE = GL31.GL_UNIFORM_SIZE; int GL_UNIFORM_NAME_LENGTH = GL31.GL_UNIFORM_NAME_LENGTH; int glGetSubroutineUniformLocation(@GLuint int program, @GLenum int shadertype, @Const @NullTerminated ByteBuffer name); @GLuint int glGetSubroutineIndex(@GLuint int program, @GLenum int shadertype, @Const @NullTerminated ByteBuffer name); @StripPostfix("values") void glGetActiveSubroutineUniformiv(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLenum int pname, @OutParameter @Check("1") IntBuffer values); @Alternate("glGetActiveSubroutineUniformiv") @GLreturn("values") @StripPostfix("values") void glGetActiveSubroutineUniformiv2(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLenum int pname, @OutParameter IntBuffer values); void glGetActiveSubroutineUniformName(@GLuint int program, @GLenum int shadertype, @GLuint int index, @AutoSize("name") @GLsizei int bufsize, @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, @OutParameter @GLchar ByteBuffer name); @Alternate("glGetActiveSubroutineUniformName") @GLreturn(value = "name", maxLength = "bufsize") void glGetActiveSubroutineUniformName2(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLsizei int bufsize, @OutParameter @Constant("name_length, 0") @GLsizei IntBuffer length, @OutParameter @GLchar ByteBuffer name); void glGetActiveSubroutineName(@GLuint int program, @GLenum int shadertype, @GLuint int index, @AutoSize("name") @GLsizei int bufsize, @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, @OutParameter @GLchar ByteBuffer name); @Alternate("glGetActiveSubroutineName") @GLreturn(value = "name", maxLength = "bufsize") void glGetActiveSubroutineName2(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLsizei int bufsize, @OutParameter @Constant("name_length, 0") @GLsizei IntBuffer length, @OutParameter @GLchar ByteBuffer name); @StripPostfix("indices") void glUniformSubroutinesuiv(@GLenum int shadertype, @AutoSize("indices") @GLsizei int count, @Const @GLuint IntBuffer indices); @StripPostfix("params") void glGetUniformSubroutineuiv(@GLenum int shadertype, int location, @Check("1") @OutParameter @GLuint IntBuffer params); @Alternate("glGetUniformSubroutineuiv") @GLreturn("params") @StripPostfix("params") void glGetUniformSubroutineuiv2(@GLenum int shadertype, int location, @OutParameter @GLuint IntBuffer params); @StripPostfix("values") void glGetProgramStageiv(@GLuint int program, @GLenum int shadertype, @GLenum int pname, @Check("1") @OutParameter IntBuffer values); @Alternate("glGetProgramStageiv") @GLreturn("values") @StripPostfix("values") void glGetProgramStageiv2(@GLuint int program, @GLenum int shadertype, @GLenum int pname, @OutParameter IntBuffer values); // ----------------------------------------------------------------------- // ----------------------[ ARB_tessellation_shader ]---------------------- // ----------------------------------------------------------------------- /** * Accepted by the <mode> parameter of Begin and all vertex array functions * that implicitly call Begin: */ int GL_PATCHES = 0xE; /** * Accepted by the <pname> parameter of PatchParameteri, GetBooleanv, * GetDoublev, GetFloatv, GetIntegerv, and GetInteger64v: */ int GL_PATCH_VERTICES = 0x8E72; /** * Accepted by the <pname> parameter of PatchParameterfv, GetBooleanv, * GetDoublev, GetFloatv, and GetIntegerv, and GetInteger64v: */ int GL_PATCH_DEFAULT_INNER_LEVEL = 0x8E73; int GL_PATCH_DEFAULT_OUTER_LEVEL = 0x8E74; /** Accepted by the <pname> parameter of GetProgramiv: */ int GL_TESS_CONTROL_OUTPUT_VERTICES = 0x8E75; int GL_TESS_GEN_MODE = 0x8E76; int GL_TESS_GEN_SPACING = 0x8E77; int GL_TESS_GEN_VERTEX_ORDER = 0x8E78; int GL_TESS_GEN_POINT_MODE = 0x8E79; /** Returned by GetProgramiv when <pname> is TESS_GEN_MODE: */ int GL_ISOLINES = 0x8E7A; /** Returned by GetProgramiv when <pname> is TESS_GEN_SPACING: */ int GL_FRACTIONAL_ODD = 0x8E7B; int GL_FRACTIONAL_EVEN = 0x8E7C; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetFloatv, * GetIntegerv, and GetInteger64v: */ int GL_MAX_PATCH_VERTICES = 0x8E7D; int GL_MAX_TESS_GEN_LEVEL = 0x8E7E; int GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS = 0x8E7F; int GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS = 0x8E80; int GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS = 0x8E81; int GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS = 0x8E82; int GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS = 0x8E83; int GL_MAX_TESS_PATCH_COMPONENTS = 0x8E84; int GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS = 0x8E85; int GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS = 0x8E86; int GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS = 0x8E89; int GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS = 0x8E8A; int GL_MAX_TESS_CONTROL_INPUT_COMPONENTS = 0x886C; int GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS = 0x886D; int GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS = 0x8E1E; int GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS = 0x8E1F; /** Accepted by the <pname> parameter of GetActiveUniformBlockiv: */ int GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER = 0x84F0; int GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER = 0x84F1; /** * Accepted by the <type> parameter of CreateShader and returned by the * <params> parameter of GetShaderiv: */ int GL_TESS_EVALUATION_SHADER = 0x8E87; int GL_TESS_CONTROL_SHADER = 0x8E88; void glPatchParameteri(@GLenum int pname, int value); @StripPostfix("values") void glPatchParameterfv(@GLenum int pname, @Check("4") @Const FloatBuffer values); // -------------------------------------------------------------------------- // ----------------------[ ARB_texture_cube_map_array ]---------------------- // -------------------------------------------------------------------------- /** * Accepted by the <target> parameter of TexParameteri, TexParameteriv, * TexParameterf, TexParameterfv, BindTexture, and GenerateMipmap: *

      * Accepted by the <target> parameter of TexImage3D, TexSubImage3D, * CompressedTeximage3D, CompressedTexSubImage3D and CopyTexSubImage3D: *

      * Accepted by the <tex> parameter of GetTexImage: */ int GL_TEXTURE_CUBE_MAP_ARRAY = 0x9009; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, * GetIntegerv and GetFloatv: */ int GL_TEXTURE_BINDING_CUBE_MAP_ARRAY = 0x900A; /** * Accepted by the <target> parameter of TexImage3D, TexSubImage3D, * CompressedTeximage3D, CompressedTexSubImage3D and CopyTexSubImage3D: */ int GL_PROXY_TEXTURE_CUBE_MAP_ARRAY = 0x900B; /** Returned by the <type> parameter of GetActiveUniform: */ int GL_SAMPLER_CUBE_MAP_ARRAY = 0x900C; int GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW = 0x900D; int GL_INT_SAMPLER_CUBE_MAP_ARRAY = 0x900E; int GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY = 0x900F; // ------------------------------------------------------------------ // ----------------------[ ARB_texture_gather ]---------------------- // ------------------------------------------------------------------ /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB = 0x8E5E; int GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB = 0x8E5F; int GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB = 0x8F9F; // ----------------------------------------------------------------------- // ----------------------[ ARB_transform_feedback2 ]---------------------- // ----------------------------------------------------------------------- /** Accepted by the <target> parameter of BindTransformFeedback: */ int GL_TRANSFORM_FEEDBACK = 0x8E22; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv, * and GetFloatv: */ int GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED = 0x8E23; int GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE = 0x8E24; int GL_TRANSFORM_FEEDBACK_BINDING = 0x8E25; void glBindTransformFeedback(@GLenum int target, @GLuint int id); void glDeleteTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @Const @GLuint IntBuffer ids); @Alternate("glDeleteTransformFeedbacks") void glDeleteTransformFeedbacks(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, id), 0", keepParam = true) int id); void glGenTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); @Alternate("glGenTransformFeedbacks") @GLreturn("ids") void glGenTransformFeedbacks2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); boolean glIsTransformFeedback(@GLuint int id); void glPauseTransformFeedback(); void glResumeTransformFeedback(); void glDrawTransformFeedback(@GLenum int mode, @GLuint int id); // ----------------------------------------------------------------------- // ----------------------[ ARB_transform_feedback3 ]---------------------- // ----------------------------------------------------------------------- /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv, * and GetFloatv: */ int GL_MAX_TRANSFORM_FEEDBACK_BUFFERS = 0x8E70; void glDrawTransformFeedbackStream(@GLenum int mode, @GLuint int id, @GLuint int stream); void glBeginQueryIndexed(@GLenum int target, @GLuint int index, @GLuint int id); void glEndQueryIndexed(@GLenum int target, @GLuint int index); @StripPostfix("params") void glGetQueryIndexediv(@GLenum int target, @GLuint int index, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); @Alternate("glGetQueryIndexediv") @GLreturn("params") @StripPostfix("params") void glGetQueryIndexediv2(@GLenum int target, @GLuint int index, @GLenum int pname, @OutParameter IntBuffer params); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_gpu_shader5.java0000644000175000017500000002055511543426511023364 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLint64EXT; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import org.lwjgl.util.generator.opengl.GLuint64EXT; import java.nio.LongBuffer; @Dependent public interface NV_gpu_shader5 { /** * Returned by the <type> parameter of GetActiveAttrib, GetActiveUniform, and * GetTransformFeedbackVarying: */ int GL_INT64_NV = 0x140E; int GL_UNSIGNED_INT64_NV = 0x140F; int GL_INT8_NV = 0x8FE0; int GL_INT8_VEC2_NV = 0x8FE1; int GL_INT8_VEC3_NV = 0x8FE2; int GL_INT8_VEC4_NV = 0x8FE3; int GL_INT16_NV = 0x8FE4; int GL_INT16_VEC2_NV = 0x8FE5; int GL_INT16_VEC3_NV = 0x8FE6; int GL_INT16_VEC4_NV = 0x8FE7; int GL_INT64_VEC2_NV = 0x8FE9; int GL_INT64_VEC3_NV = 0x8FEA; int GL_INT64_VEC4_NV = 0x8FEB; int GL_UNSIGNED_INT8_NV = 0x8FEC; int GL_UNSIGNED_INT8_VEC2_NV = 0x8FED; int GL_UNSIGNED_INT8_VEC3_NV = 0x8FEE; int GL_UNSIGNED_INT8_VEC4_NV = 0x8FEF; int GL_UNSIGNED_INT16_NV = 0x8FF0; int GL_UNSIGNED_INT16_VEC2_NV = 0x8FF1; int GL_UNSIGNED_INT16_VEC3_NV = 0x8FF2; int GL_UNSIGNED_INT16_VEC4_NV = 0x8FF3; int GL_UNSIGNED_INT64_VEC2_NV = 0x8FF5; int GL_UNSIGNED_INT64_VEC3_NV = 0x8FF6; int GL_UNSIGNED_INT64_VEC4_NV = 0x8FF7; int GL_FLOAT16_NV = 0x8FF8; int GL_FLOAT16_VEC2_NV = 0x8FF9; int GL_FLOAT16_VEC3_NV = 0x8FFA; int GL_FLOAT16_VEC4_NV = 0x8FFB; /** Accepted by the <primitiveMode> parameter of BeginTransformFeedback: */ int GL_PATCHES = ARB_tessellation_shader.GL_PATCHES; void glUniform1i64NV(int location, @GLint64EXT long x); void glUniform2i64NV(int location, @GLint64EXT long x, @GLint64EXT long y); void glUniform3i64NV(int location, @GLint64EXT long x, @GLint64EXT long y, @GLint64EXT long z); void glUniform4i64NV(int location, @GLint64EXT long x, @GLint64EXT long y, @GLint64EXT long z, @GLint64EXT long w); @StripPostfix("value") void glUniform1i64vNV(int location, @AutoSize("value") @GLsizei int count, @Const @GLint64EXT LongBuffer value); @StripPostfix("value") void glUniform2i64vNV(int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const @GLint64EXT LongBuffer value); @StripPostfix("value") void glUniform3i64vNV(int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const @GLint64EXT LongBuffer value); @StripPostfix("value") void glUniform4i64vNV(int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const @GLint64EXT LongBuffer value); void glUniform1ui64NV(int location, @GLuint64EXT long x); void glUniform2ui64NV(int location, @GLuint64EXT long x, @GLuint64EXT long y); void glUniform3ui64NV(int location, @GLuint64EXT long x, @GLuint64EXT long y, @GLuint64EXT long z); void glUniform4ui64NV(int location, @GLuint64EXT long x, @GLuint64EXT long y, @GLuint64EXT long z, @GLuint64EXT long w); @StripPostfix("value") void glUniform1ui64vNV(int location, @AutoSize("value") @GLsizei int count, @Const @GLuint64EXT LongBuffer value); @StripPostfix("value") void glUniform2ui64vNV(int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const @GLuint64EXT LongBuffer value); @StripPostfix("value") void glUniform3ui64vNV(int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const @GLuint64EXT LongBuffer value); @StripPostfix("value") void glUniform4ui64vNV(int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const @GLuint64EXT LongBuffer value); @StripPostfix("params") void glGetUniformi64vNV(@GLuint int program, int location, @OutParameter @Check("1") @GLint64EXT LongBuffer params); @StripPostfix("params") void glGetUniformui64vNV(@GLuint int program, int location, @OutParameter @Check("1") @GLuint64EXT LongBuffer params); // ------------- @Dependent("EXT_direct_state_access") void glProgramUniform1i64NV(@GLuint int program, int location, @GLint64EXT long x); @Dependent("EXT_direct_state_access") void glProgramUniform2i64NV(@GLuint int program, int location, @GLint64EXT long x, @GLint64EXT long y); @Dependent("EXT_direct_state_access") void glProgramUniform3i64NV(@GLuint int program, int location, @GLint64EXT long x, @GLint64EXT long y, @GLint64EXT long z); @Dependent("EXT_direct_state_access") void glProgramUniform4i64NV(@GLuint int program, int location, @GLint64EXT long x, @GLint64EXT long y, @GLint64EXT long z, @GLint64EXT long w); @Dependent("EXT_direct_state_access") @StripPostfix("value") void glProgramUniform1i64vNV(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const @GLint64EXT LongBuffer value); @Dependent("EXT_direct_state_access") @StripPostfix("value") void glProgramUniform2i64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const @GLint64EXT LongBuffer value); @Dependent("EXT_direct_state_access") @StripPostfix("value") void glProgramUniform3i64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const @GLint64EXT LongBuffer value); @Dependent("EXT_direct_state_access") @StripPostfix("value") void glProgramUniform4i64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const @GLint64EXT LongBuffer value); @Dependent("EXT_direct_state_access") void glProgramUniform1ui64NV(@GLuint int program, int location, @GLuint64EXT long x); @Dependent("EXT_direct_state_access") void glProgramUniform2ui64NV(@GLuint int program, int location, @GLuint64EXT long x, @GLuint64EXT long y); @Dependent("EXT_direct_state_access") void glProgramUniform3ui64NV(@GLuint int program, int location, @GLuint64EXT long x, @GLuint64EXT long y, @GLuint64EXT long z); @Dependent("EXT_direct_state_access") void glProgramUniform4ui64NV(@GLuint int program, int location, @GLuint64EXT long x, @GLuint64EXT long y, @GLuint64EXT long z, @GLuint64EXT long w); @Dependent("EXT_direct_state_access") @StripPostfix("value") void glProgramUniform1ui64vNV(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const @GLuint64EXT LongBuffer value); @Dependent("EXT_direct_state_access") @StripPostfix("value") void glProgramUniform2ui64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const @GLuint64EXT LongBuffer value); @Dependent("EXT_direct_state_access") @StripPostfix("value") void glProgramUniform3ui64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const @GLuint64EXT LongBuffer value); @Dependent("EXT_direct_state_access") @StripPostfix("value") void glProgramUniform4ui64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const @GLuint64EXT LongBuffer value); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/AMD_texture_texture4.java0000644000175000017500000000314611543426511024575 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface AMD_texture_texture4 { }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_packed_float.java0000644000175000017500000000624411543426511023706 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_packed_float { /** * Accepted by the <internalformat> parameter of TexImage1D, * TexImage2D, TexImage3D, CopyTexImage1D, CopyTexImage2D, and * RenderbufferStorageEXT: */ int GL_R11F_G11F_B10F_EXT = 0x8C3A; /** * Accepted by the <type> parameter of DrawPixels, ReadPixels, * TexImage1D, TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, * TexSubImage2D, TexSubImage3D, GetHistogram, GetMinmax, * ConvolutionFilter1D, ConvolutionFilter2D, ConvolutionFilter3D, * GetConvolutionFilter, SeparableFilter2D, GetSeparableFilter, * ColorTable, ColorSubTable, and GetColorTable: */ int GL_UNSIGNED_INT_10F_11F_11F_REV_EXT = 0x8C3B; /** * Accepted by the <pname> parameters of GetIntegerv, GetFloatv, and * GetDoublev: */ int GL_RGBA_SIGNED_COMPONENTS_EXT = 0x8C3C; /** * Accepted as a value in the <piAttribIList> and <pfAttribFList> * parameter arrays of wglChoosePixelFormatARB, and returned in the * <piValues> parameter array of wglGetPixelFormatAttribivARB, and the * <pfValues> parameter array of wglGetPixelFormatAttribfvARB: */ int WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT = 0x20A8; /** * Accepted as values of the <render_type> arguments in the * glXCreateNewContext and glXCreateContext functions */ int GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT = 0x20B1; /** * Returned by glXGetFBConfigAttrib (when <attribute> is set to * GLX_RENDER_TYPE) and accepted by the <attrib_list> parameter of * glXChooseFBConfig (following the GLX_RENDER_TYPE token): */ int GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT = 0x00000008; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_tessellation_program5.java0000644000175000017500000000522311543426511025473 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_tessellation_program5 { /** * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, * by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * and GetDoublev, and by the <target> parameter of ProgramStringARB, * BindProgramARB, ProgramEnvParameter4[df][v]ARB, * ProgramLocalParameter4[df][v]ARB, GetProgramEnvParameter[df]vARB, * GetProgramLocalParameter[df]vARB, GetProgramivARB and * GetProgramStringARB: */ int GL_TESS_CONTROL_PROGRAM_NV = 0x891E; int GL_TESS_EVALUATION_PROGRAM_NV = 0x891F; /** * Accepted by the <target> parameter of ProgramBufferParametersfvNV, * ProgramBufferParametersIivNV, and ProgramBufferParametersIuivNV, * BindBufferRangeNV, BindBufferOffsetNV, BindBufferBaseNV, and BindBuffer * and the <value> parameter of GetIntegerIndexedvEXT: */ int GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV = 0x8C74; int GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV = 0x8C75; /** Accepted by the <pname> parameter of GetProgramivARB: */ int GL_MAX_PROGRAM_PATCH_ATTRIBS_NV = 0x86D8; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_shared_texture_palette.java0000644000175000017500000000323211543426511026030 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_shared_texture_palette { int GL_SHARED_TEXTURE_PALETTE_EXT = 0x81FB; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_rectangle.java0000644000175000017500000000343711543426511025017 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_texture_rectangle { int GL_TEXTURE_RECTANGLE_EXT = 0x84F5; int GL_TEXTURE_BINDING_RECTANGLE_EXT = 0x84F6; int GL_PROXY_TEXTURE_RECTANGLE_EXT = 0x84F7; int GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT = 0x84F8; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/IBM_rasterpos_clip.java0000644000175000017500000000350711543426511024271 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface IBM_rasterpos_clip { /** * Accepted by the <target> parameter of Enable and Disable and the <value> * parameter of IsEnabled, GetBooleanv, GetIntegerv, GetFloatv, GetDoublev: */ int GL_RASTER_POSITION_UNCLIPPED_IBM = 103010; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/SGIS_texture_lod.java0000644000175000017500000000401311543426511023725 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; @Extension(postfix = "SGIS", className = "SGISTextureLOD") public interface SGIS_texture_lod { /** * Accepted by the <pname> parameter of TexParameteri, TexParameterf, * TexParameteriv, TexParameterfv, GetTexParameteriv, and GetTexParameterfv. */ int GL_TEXTURE_MIN_LOD_SGIS = 0x813A; int GL_TEXTURE_MAX_LOD_SGIS = 0x813B; int GL_TEXTURE_BASE_LEVEL_SGIS = 0x813C; int GL_TEXTURE_MAX_LEVEL_SGIS = 0x813D; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_vertex_shader.java0000644000175000017500000002611711543426511024136 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.*; public interface EXT_vertex_shader { int GL_VERTEX_SHADER_EXT = 0x8780; int GL_VERTEX_SHADER_BINDING_EXT = 0x8781; int GL_OP_INDEX_EXT = 0x8782; int GL_OP_NEGATE_EXT = 0x8783; int GL_OP_DOT3_EXT = 0x8784; int GL_OP_DOT4_EXT = 0x8785; int GL_OP_MUL_EXT = 0x8786; int GL_OP_ADD_EXT = 0x8787; int GL_OP_MADD_EXT = 0x8788; int GL_OP_FRAC_EXT = 0x8789; int GL_OP_MAX_EXT = 0x878A; int GL_OP_MIN_EXT = 0x878B; int GL_OP_SET_GE_EXT = 0x878C; int GL_OP_SET_LT_EXT = 0x878D; int GL_OP_CLAMP_EXT = 0x878E; int GL_OP_FLOOR_EXT = 0x878F; int GL_OP_ROUND_EXT = 0x8790; int GL_OP_EXP_BASE_2_EXT = 0x8791; int GL_OP_LOG_BASE_2_EXT = 0x8792; int GL_OP_POWER_EXT = 0x8793; int GL_OP_RECIP_EXT = 0x8794; int GL_OP_RECIP_SQRT_EXT = 0x8795; int GL_OP_SUB_EXT = 0x8796; int GL_OP_CROSS_PRODUCT_EXT = 0x8797; int GL_OP_MULTIPLY_MATRIX_EXT = 0x8798; int GL_OP_MOV_EXT = 0x8799; int GL_OUTPUT_VERTEX_EXT = 0x879A; int GL_OUTPUT_COLOR0_EXT = 0x879B; int GL_OUTPUT_COLOR1_EXT = 0x879C; int GL_OUTPUT_TEXTURE_COORD0_EXT = 0x879D; int GL_OUTPUT_TEXTURE_COORD1_EXT = 0x879E; int GL_OUTPUT_TEXTURE_COORD2_EXT = 0x879F; int GL_OUTPUT_TEXTURE_COORD3_EXT = 0x87A0; int GL_OUTPUT_TEXTURE_COORD4_EXT = 0x87A1; int GL_OUTPUT_TEXTURE_COORD5_EXT = 0x87A2; int GL_OUTPUT_TEXTURE_COORD6_EXT = 0x87A3; int GL_OUTPUT_TEXTURE_COORD7_EXT = 0x87A4; int GL_OUTPUT_TEXTURE_COORD8_EXT = 0x87A5; int GL_OUTPUT_TEXTURE_COORD9_EXT = 0x87A6; int GL_OUTPUT_TEXTURE_COORD10_EXT = 0x87A7; int GL_OUTPUT_TEXTURE_COORD11_EXT = 0x87A8; int GL_OUTPUT_TEXTURE_COORD12_EXT = 0x87A9; int GL_OUTPUT_TEXTURE_COORD13_EXT = 0x87AA; int GL_OUTPUT_TEXTURE_COORD14_EXT = 0x87AB; int GL_OUTPUT_TEXTURE_COORD15_EXT = 0x87AC; int GL_OUTPUT_TEXTURE_COORD16_EXT = 0x87AD; int GL_OUTPUT_TEXTURE_COORD17_EXT = 0x87AE; int GL_OUTPUT_TEXTURE_COORD18_EXT = 0x87AF; int GL_OUTPUT_TEXTURE_COORD19_EXT = 0x87B0; int GL_OUTPUT_TEXTURE_COORD20_EXT = 0x87B1; int GL_OUTPUT_TEXTURE_COORD21_EXT = 0x87B2; int GL_OUTPUT_TEXTURE_COORD22_EXT = 0x87B3; int GL_OUTPUT_TEXTURE_COORD23_EXT = 0x87B4; int GL_OUTPUT_TEXTURE_COORD24_EXT = 0x87B5; int GL_OUTPUT_TEXTURE_COORD25_EXT = 0x87B6; int GL_OUTPUT_TEXTURE_COORD26_EXT = 0x87B7; int GL_OUTPUT_TEXTURE_COORD27_EXT = 0x87B8; int GL_OUTPUT_TEXTURE_COORD28_EXT = 0x87B9; int GL_OUTPUT_TEXTURE_COORD29_EXT = 0x87BA; int GL_OUTPUT_TEXTURE_COORD30_EXT = 0x87BB; int GL_OUTPUT_TEXTURE_COORD31_EXT = 0x87BC; int GL_OUTPUT_FOG_EXT = 0x87BD; int GL_SCALAR_EXT = 0x87BE; int GL_VECTOR_EXT = 0x87BF; int GL_MATRIX_EXT = 0x87C0; int GL_VARIANT_EXT = 0x87C1; int GL_INVARIANT_EXT = 0x87C2; int GL_LOCAL_CONSTANT_EXT = 0x87C3; int GL_LOCAL_EXT = 0x87C4; int GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT = 0x87C5; int GL_MAX_VERTEX_SHADER_VARIANTS_EXT = 0x87C6; int GL_MAX_VERTEX_SHADER_INVARIANTS_EXT = 0x87C7; int GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = 0x87C8; int GL_MAX_VERTEX_SHADER_LOCALS_EXT = 0x87C9; int GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT = 0x87CA; int GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT = 0x87CB; int GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT = 0x87CC; int GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = 0x87CD; int GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT = 0x87CE; int GL_VERTEX_SHADER_INSTRUCTIONS_EXT = 0x87CF; int GL_VERTEX_SHADER_VARIANTS_EXT = 0x87D0; int GL_VERTEX_SHADER_INVARIANTS_EXT = 0x87D1; int GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = 0x87D2; int GL_VERTEX_SHADER_LOCALS_EXT = 0x87D3; int GL_VERTEX_SHADER_OPTIMIZED_EXT = 0x87D4; int GL_X_EXT = 0x87D5; int GL_Y_EXT = 0x87D6; int GL_Z_EXT = 0x87D7; int GL_W_EXT = 0x87D8; int GL_NEGATIVE_X_EXT = 0x87D9; int GL_NEGATIVE_Y_EXT = 0x87DA; int GL_NEGATIVE_Z_EXT = 0x87DB; int GL_NEGATIVE_W_EXT = 0x87DC; int GL_ZERO_EXT = 0x87DD; int GL_ONE_EXT = 0x87DE; int GL_NEGATIVE_ONE_EXT = 0x87DF; int GL_NORMALIZED_RANGE_EXT = 0x87E0; int GL_FULL_RANGE_EXT = 0x87E1; int GL_CURRENT_VERTEX_EXT = 0x87E2; int GL_MVP_MATRIX_EXT = 0x87E3; int GL_VARIANT_VALUE_EXT = 0x87E4; int GL_VARIANT_DATATYPE_EXT = 0x87E5; int GL_VARIANT_ARRAY_STRIDE_EXT = 0x87E6; int GL_VARIANT_ARRAY_TYPE_EXT = 0x87E7; int GL_VARIANT_ARRAY_EXT = 0x87E8; int GL_VARIANT_ARRAY_POINTER_EXT = 0x87E9; int GL_INVARIANT_VALUE_EXT = 0x87EA; int GL_INVARIANT_DATATYPE_EXT = 0x87EB; int GL_LOCAL_CONSTANT_VALUE_EXT = 0x87EC; int GL_LOCAL_CONSTANT_DATATYPE_EXT = 0x87ED; void glBeginVertexShaderEXT(); void glEndVertexShaderEXT(); void glBindVertexShaderEXT(@GLuint int id); @GLuint int glGenVertexShadersEXT(@GLuint int range); void glDeleteVertexShaderEXT(@GLuint int id); void glShaderOp1EXT(@GLenum int op, @GLuint int res, @GLuint int arg1); void glShaderOp2EXT(@GLenum int op, @GLuint int res, @GLuint int arg1, @GLuint int arg2); void glShaderOp3EXT(@GLenum int op, @GLuint int res, @GLuint int arg1, @GLuint int arg2, @GLuint int arg3); void glSwizzleEXT(@GLuint int res, @GLuint int in, @GLenum int outX, @GLenum int outY, @GLenum int outZ, @GLenum int outW); void glWriteMaskEXT(@GLuint int res, @GLuint int in, @GLenum int outX, @GLenum int outY, @GLenum int outZ, @GLenum int outW); void glInsertComponentEXT(@GLuint int res, @GLuint int src, @GLuint int num); void glExtractComponentEXT(@GLuint int res, @GLuint int src, @GLuint int num); @GLuint int glGenSymbolsEXT(@GLenum int dataType, @GLenum int storageType, @GLenum int range, @GLuint int components); void glSetInvariantEXT(@GLuint int id, @AutoType("pAddr") @GLenum int type, @Check("4") @Const @GLbyte @GLubyte @GLshort @GLushort @GLint @GLuint @GLfloat @GLdouble Buffer pAddr); void glSetLocalConstantEXT(@GLuint int id, @AutoType("pAddr") @GLenum int type, @Check("4") @Const @GLbyte @GLubyte @GLshort @GLushort @GLint @GLuint @GLfloat @GLdouble Buffer pAddr); @StripPostfix("pAddr") void glVariantbvEXT(@GLuint int id, @Check("4") @Const ByteBuffer pAddr); @StripPostfix("pAddr") void glVariantsvEXT(@GLuint int id, @Check("4") @Const ShortBuffer pAddr); @StripPostfix("pAddr") void glVariantivEXT(@GLuint int id, @Check("4") @Const IntBuffer pAddr); @StripPostfix("pAddr") void glVariantfvEXT(@GLuint int id, @Check("4") @Const FloatBuffer pAddr); @StripPostfix("pAddr") void glVariantdvEXT(@GLuint int id, @Check("4") @Const DoubleBuffer pAddr); @StripPostfix("pAddr") void glVariantubvEXT(@GLuint int id, @Check("4") @Const @GLubyte ByteBuffer pAddr); @StripPostfix("pAddr") void glVariantusvEXT(@GLuint int id, @Check("4") @Const @GLushort ShortBuffer pAddr); @StripPostfix("pAddr") void glVariantuivEXT(@GLuint int id, @Check("4") @Const @GLuint IntBuffer pAddr); void glVariantPointerEXT(@GLuint int id, @AutoType("pAddr") @GLenum int type, @GLuint int stride, @CachedReference @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLbyte @GLshort @GLint @GLubyte @GLushort @GLuint @GLfloat @GLdouble Buffer pAddr); void glEnableVariantClientStateEXT(@GLuint int id); void glDisableVariantClientStateEXT(@GLuint int id); @GLuint int glBindLightParameterEXT(@GLenum int light, @GLenum int value); @GLuint int glBindMaterialParameterEXT(@GLenum int face, @GLenum int value); @GLuint int glBindTexGenParameterEXT(@GLenum int unit, @GLenum int coord, @GLenum int value); @GLuint int glBindTextureUnitParameterEXT(@GLenum int unit, @GLenum int value); @GLuint int glBindParameterEXT(@GLenum int value); boolean glIsVariantEnabledEXT(@GLuint int id, @GLenum int cap); @StripPostfix("pbData") void glGetVariantBooleanvEXT(@GLuint int id, @GLenum int value, @OutParameter @Check("4") ByteBuffer pbData); @StripPostfix("pbData") void glGetVariantIntegervEXT(@GLuint int id, @GLenum int value, @OutParameter @Check("4") IntBuffer pbData); @StripPostfix("pbData") void glGetVariantFloatvEXT(@GLuint int id, @GLenum int value, @OutParameter @Check("4") FloatBuffer pbData); @StripPostfix("pbData") void glGetVariantPointervEXT(@GLuint int id, @GLenum int value, @OutParameter @Result @GLvoid ByteBuffer pbData); @StripPostfix("pbData") void glGetInvariantBooleanvEXT(@GLuint int id, @GLenum int value, @OutParameter @Check("4") ByteBuffer pbData); @StripPostfix("pbData") void glGetInvariantIntegervEXT(@GLuint int id, @GLenum int value, @OutParameter @Check("4") IntBuffer pbData); @StripPostfix("pbData") void glGetInvariantFloatvEXT(@GLuint int id, @GLenum int value, @OutParameter @Check("4") FloatBuffer pbData); @StripPostfix("pbData") void glGetLocalConstantBooleanvEXT(@GLuint int id, @GLenum int value, @OutParameter @Check("4") ByteBuffer pbData); @StripPostfix("pbData") void glGetLocalConstantIntegervEXT(@GLuint int id, @GLenum int value, @OutParameter @Check("4") IntBuffer pbData); @StripPostfix("pbData") void glGetLocalConstantFloatvEXT(@GLuint int id, @GLenum int value, @OutParameter @Check("4") FloatBuffer pbData); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_packed_depth_stencil.java0000644000175000017500000000326411543426511025310 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_packed_depth_stencil { int GL_DEPTH_STENCIL_NV = 0x84F9; int GL_UNSIGNED_INT_24_8_NV = 0x84FA; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_fragment_program_shadow.java0000644000175000017500000000315711543426511026135 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_fragment_program_shadow { } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/AMD_conservative_depth.java0000644000175000017500000000315011543426511025120 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface AMD_conservative_depth { }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_vertex_array_bgra.java0000644000175000017500000000337211543426511024743 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_vertex_array_bgra { /** * Accepted by the <size> parameter of ColorPointer, * SecondaryColorPointer, and VertexAttribPointer: */ int GL_BGRA = 0x80E1; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/GL14.java0000644000175000017500000001360711543426511021222 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.*; /** *

      * The core OpenGL1.4 API. * * @author cix_foo * @version $Revision: 3460 $ * $Id: GL14.java 3460 2010-11-29 18:25:28Z spasi $ */ @DeprecatedGL public interface GL14 { int GL_GENERATE_MIPMAP = 0x8191; int GL_GENERATE_MIPMAP_HINT = 0x8192; int GL_DEPTH_COMPONENT16 = 0x81A5; int GL_DEPTH_COMPONENT24 = 0x81A6; int GL_DEPTH_COMPONENT32 = 0x81A7; int GL_TEXTURE_DEPTH_SIZE = 0x884A; int GL_DEPTH_TEXTURE_MODE = 0x884B; int GL_TEXTURE_COMPARE_MODE = 0x884C; int GL_TEXTURE_COMPARE_FUNC = 0x884D; int GL_COMPARE_R_TO_TEXTURE = 0x884E; int GL_FOG_COORDINATE_SOURCE = 0x8450; int GL_FOG_COORDINATE = 0x8451; int GL_FRAGMENT_DEPTH = 0x8452; int GL_CURRENT_FOG_COORDINATE = 0x8453; int GL_FOG_COORDINATE_ARRAY_TYPE = 0x8454; int GL_FOG_COORDINATE_ARRAY_STRIDE = 0x8455; int GL_FOG_COORDINATE_ARRAY_POINTER = 0x8456; int GL_FOG_COORDINATE_ARRAY = 0x8457; int GL_POINT_SIZE_MIN = 0x8126; int GL_POINT_SIZE_MAX = 0x8127; int GL_POINT_FADE_THRESHOLD_SIZE = 0x8128; int GL_POINT_DISTANCE_ATTENUATION = 0x8129; int GL_COLOR_SUM = 0x8458; int GL_CURRENT_SECONDARY_COLOR = 0x8459; int GL_SECONDARY_COLOR_ARRAY_SIZE = 0x845A; int GL_SECONDARY_COLOR_ARRAY_TYPE = 0x845B; int GL_SECONDARY_COLOR_ARRAY_STRIDE = 0x845C; int GL_SECONDARY_COLOR_ARRAY_POINTER = 0x845D; int GL_SECONDARY_COLOR_ARRAY = 0x845E; int GL_BLEND_DST_RGB = 0x80C8; int GL_BLEND_SRC_RGB = 0x80C9; int GL_BLEND_DST_ALPHA = 0x80CA; int GL_BLEND_SRC_ALPHA = 0x80CB; int GL_INCR_WRAP = 0x8507; int GL_DECR_WRAP = 0x8508; int GL_TEXTURE_FILTER_CONTROL = 0x8500; int GL_TEXTURE_LOD_BIAS = 0x8501; int GL_MAX_TEXTURE_LOD_BIAS = 0x84FD; int GL_MIRRORED_REPEAT = 0x8370; int GL_BLEND_COLOR = 0x8005; int GL_BLEND_EQUATION = 0x8009; int GL_FUNC_ADD = 0x8006; int GL_FUNC_SUBTRACT = 0x800A; int GL_FUNC_REVERSE_SUBTRACT = 0x800B; int GL_MIN = 0x8007; int GL_MAX = 0x8008; void glBlendEquation(@GLenum int mode); void glBlendColor(@GLclampf float red, @GLclampf float green, @GLclampf float blue, @GLclampf float alpha); @DeprecatedGL void glFogCoordf(float coord); @DeprecatedGL void glFogCoordd(double coord); @DeprecatedGL void glFogCoordPointer(@AutoType("data") @GLenum int type, @GLsizei int stride, @CachedReference @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLfloat @GLdouble Buffer data); void glMultiDrawArrays(@GLenum int mode, IntBuffer piFirst, @Check("piFirst.remaining()") @GLsizei IntBuffer piCount, @AutoSize("piFirst") @GLsizei int primcount); //void glMultiDrawElements(int mode, int piCount, int type, int pIndices, int primcount); void glPointParameteri(@GLenum int pname, int param); void glPointParameterf(@GLenum int pname, float param); @StripPostfix("params") void glPointParameteriv(@GLenum int pname, @Check("4") @Const IntBuffer params); @StripPostfix("params") void glPointParameterfv(@GLenum int pname, @Check("4") @Const FloatBuffer params); @DeprecatedGL void glSecondaryColor3b(byte red, byte green, byte blue); @DeprecatedGL void glSecondaryColor3f(float red, float green, float blue); @DeprecatedGL void glSecondaryColor3d(double red, double green, double blue); @DeprecatedGL void glSecondaryColor3ub(@GLubyte byte red, @GLubyte byte green, @GLubyte byte blue); @DeprecatedGL void glSecondaryColorPointer(int size, @AutoType("data") @GLenum int type, @GLsizei int stride, @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLbyte @GLubyte @GLfloat @GLdouble Buffer data); void glBlendFuncSeparate(@GLenum int sfactorRGB, @GLenum int dfactorRGB, @GLenum int sfactorAlpha, @GLenum int dfactorAlpha); @DeprecatedGL void glWindowPos2f(float x, float y); @DeprecatedGL void glWindowPos2d(double x, double y); @DeprecatedGL void glWindowPos2i(int x, int y); @DeprecatedGL void glWindowPos3f(float x, float y, float z); @DeprecatedGL void glWindowPos3d(double x, double y, double z); @DeprecatedGL void glWindowPos3i(int x, int y, int z); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_multisample_filter_hint.java0000644000175000017500000000347111543426511026077 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_multisample_filter_hint { /** * Accepted by the <target> parameter of Hint and by the <pname> * parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev: */ int GL_MULTISAMPLE_FILTER_HINT_NV = 0x8534; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ATI_texture_compression_3dc.java0000644000175000017500000000341311543426511026114 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; @Extension(postfix = "ATI", className = "ATITextureCompression3DC") public interface ATI_texture_compression_3dc { int GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI = 0x8837; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_register_combiners2.java0000644000175000017500000000403111543426511025114 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import java.nio.*; public interface NV_register_combiners2 { int GL_PER_STAGE_CONSTANTS_NV = 0x8535; @StripPostfix("params") void glCombinerStageParameterfvNV(@GLenum int stage, @GLenum int pname, @Const @Check("4") FloatBuffer params); @StripPostfix("params") void glGetCombinerStageParameterfvNV(@GLenum int stage, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_buffer_object.java0000644000175000017500000000467211543426511025654 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLuint; public interface EXT_texture_buffer_object { /** * Accepted by the <target> parameter of BindBuffer, BufferData, * BufferSubData, MapBuffer, BindTexture, UnmapBuffer, GetBufferSubData, * GetBufferParameteriv, GetBufferPointerv, and TexBufferEXT, and * the <pname> parameter of GetBooleanv, GetDoublev, GetFloatv, and * GetIntegerv: */ int GL_TEXTURE_BUFFER_EXT = 0x8C2A; /** * Accepted by the <pname> parameters of GetBooleanv, GetDoublev, * GetFloatv, and GetIntegerv: */ int GL_MAX_TEXTURE_BUFFER_SIZE_EXT = 0x8C2B; int GL_TEXTURE_BINDING_BUFFER_EXT = 0x8C2C; int GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT = 0x8C2D; int GL_TEXTURE_BUFFER_FORMAT_EXT = 0x8C2E; void glTexBufferEXT(@GLenum int target, @GLenum int internalformat, @GLuint int buffer); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_parameter_buffer_object2.java0000644000175000017500000000315611543426511026075 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_parameter_buffer_object2 { }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_texture_rectangle.java0000644000175000017500000000343211543426511024675 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_texture_rectangle { int GL_TEXTURE_RECTANGLE_NV = 0x84F5; int GL_TEXTURE_BINDING_RECTANGLE_NV = 0x84F6; int GL_PROXY_TEXTURE_RECTANGLE_NV = 0x84F7; int GL_MAX_RECTANGLE_TEXTURE_SIZE_NV = 0x84F8; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ATI_texture_env_combine3.java0000644000175000017500000000363311543426511025375 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ATI_texture_env_combine3 { /** * Accepted by the <params> parameter of TexEnvf, TexEnvi, TexEnvfv, * and TexEnviv when the <pname> parameter value is COMBINE_RGB_ARB * or COMBINE_ALPHA_ARB */ int GL_MODULATE_ADD_ATI = 0x8744; int GL_MODULATE_SIGNED_ADD_ATI = 0x8745; int GL_MODULATE_SUBTRACT_ATI = 0x8746; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_bindable_uniform.java0000644000175000017500000000475011543426511024571 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLintptr; import org.lwjgl.util.generator.opengl.GLuint; public interface EXT_bindable_uniform { /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT = 0x8DE2; int GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT = 0x8DE3; int GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT = 0x8DE4; int GL_MAX_BINDABLE_UNIFORM_SIZE_EXT = 0x8DED; int GL_UNIFORM_BUFFER_BINDING_EXT = 0x8DEF; /** * Accepted by the <target> parameters of BindBuffer, BufferData, * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, and * GetBufferPointerv: */ int GL_UNIFORM_BUFFER_EXT = 0x8DEE; void glUniformBufferEXT(@GLuint int program, int location, @GLuint int buffer); int glGetUniformBufferSizeEXT(@GLuint int program, int location); @GLintptr long glGetUniformOffsetEXT(@GLuint int program, int location); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java0000644000175000017500000001222011543426511024401 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLreturn; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.FloatBuffer; import java.nio.IntBuffer; @Extension(postfix = "") public interface ARB_sampler_objects { /** * Accepted by the <value> parameter of the GetBooleanv, GetIntegerv, * GetInteger64v, GetFloatv and GetDoublev functions: */ int GL_SAMPLER_BINDING = 0x8919; @Reuse("GL33") void glGenSamplers(@AutoSize("samplers") @GLsizei int count, @OutParameter @GLuint IntBuffer samplers); @Reuse("GL33") @Alternate("glGenSamplers") @GLreturn("samplers") void glGenSamplers2(@Constant("1") @GLsizei int count, @OutParameter @GLuint IntBuffer samplers); @Reuse("GL33") void glDeleteSamplers(@AutoSize("samplers") @GLsizei int count, @Const @GLuint IntBuffer samplers); @Reuse("GL33") @Alternate("glDeleteSamplers") void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtil.getBufferInt().put(0, sampler), 0", keepParam = true) int sampler); @Reuse("GL33") boolean glIsSampler(@GLuint int sampler); @Reuse("GL33") void glBindSampler(@GLenum int unit, @GLuint int sampler); @Reuse("GL33") void glSamplerParameteri(@GLuint int sampler, @GLenum int pname, int param); @Reuse("GL33") void glSamplerParameterf(@GLuint int sampler, @GLenum int pname, float param); @Reuse("GL33") @StripPostfix("params") void glSamplerParameteriv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const IntBuffer params); @Reuse("GL33") @StripPostfix("params") void glSamplerParameterfv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const FloatBuffer params); @Reuse("GL33") @StripPostfix("params") void glSamplerParameterIiv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const IntBuffer params); @Reuse("GL33") @StripPostfix("params") void glSamplerParameterIuiv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const @GLuint IntBuffer params); @Reuse("GL33") @StripPostfix("params") void glGetSamplerParameteriv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); @Reuse("GL33") @Alternate("glGetSamplerParameteriv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetSamplerParameteriv2(@GLuint int sampler, @GLenum int pname, @OutParameter IntBuffer params); @Reuse("GL33") @StripPostfix("params") void glGetSamplerParameterfv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter FloatBuffer params); @Reuse("GL33") @Alternate("glGetSamplerParameterfv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetSamplerParameterfv2(@GLuint int sampler, @GLenum int pname, @OutParameter FloatBuffer params); @Reuse("GL33") @StripPostfix("params") void glGetSamplerParameterIiv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); @Reuse("GL33") @Alternate("glGetSamplerParameterIiv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetSamplerParameterIiv2(@GLuint int sampler, @GLenum int pname, @OutParameter IntBuffer params); @Reuse("GL33") @StripPostfix("params") void glGetSamplerParameterIuiv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); @Reuse("GL33") @Alternate("glGetSamplerParameterIuiv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetSamplerParameterIuiv2(@GLuint int sampler, @GLenum int pname, @OutParameter IntBuffer params); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_rescale_normal.java0000644000175000017500000000321211543426511024250 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_rescale_normal { int GL_RESCALE_NORMAL_EXT = 0x803A; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_swizzle.java0000644000175000017500000000412111543426511024515 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_texture_swizzle { /** * Accepted by the <pname> parameters of TexParameteri, * TexParameterf, TexParameteriv, TexParameterfv, * GetTexParameterfv, and GetTexParameteriv: */ int GL_TEXTURE_SWIZZLE_R = 0x8E42; int GL_TEXTURE_SWIZZLE_G = 0x8E43; int GL_TEXTURE_SWIZZLE_B = 0x8E44; int GL_TEXTURE_SWIZZLE_A = 0x8E45; /** * Accepted by the <pname> parameters of TexParameteriv, * TexParameterfv, GetTexParameterfv, and GetTexParameteriv: */ int GL_TEXTURE_SWIZZLE_RGBA = 0x8E46; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/GL12.java0000644000175000017500000001212111543426511021206 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.Buffer; /** *

      * The core OpenGL1.2.1 API, with the imaging subset. * * @author cix_foo * @version $Revision: 3412 $ * $Id: GL12.java 3412 2010-09-26 23:43:24Z spasi $ */ public interface GL12 { int GL_TEXTURE_BINDING_3D = 0x806A; int GL_PACK_SKIP_IMAGES = 0x806B; int GL_PACK_IMAGE_HEIGHT = 0x806C; int GL_UNPACK_SKIP_IMAGES = 0x806D; int GL_UNPACK_IMAGE_HEIGHT = 0x806E; int GL_TEXTURE_3D = 0x806F; int GL_PROXY_TEXTURE_3D = 0x8070; int GL_TEXTURE_DEPTH = 0x8071; int GL_TEXTURE_WRAP_R = 0x8072; int GL_MAX_3D_TEXTURE_SIZE = 0x8073; int GL_BGR = 0x80E0; int GL_BGRA = 0x80E1; int GL_UNSIGNED_BYTE_3_3_2 = 0x8032; int GL_UNSIGNED_BYTE_2_3_3_REV = 0x8362; int GL_UNSIGNED_SHORT_5_6_5 = 0x8363; int GL_UNSIGNED_SHORT_5_6_5_REV = 0x8364; int GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033; int GL_UNSIGNED_SHORT_4_4_4_4_REV = 0x8365; int GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034; int GL_UNSIGNED_SHORT_1_5_5_5_REV = 0x8366; int GL_UNSIGNED_INT_8_8_8_8 = 0x8035; int GL_UNSIGNED_INT_8_8_8_8_REV = 0x8367; int GL_UNSIGNED_INT_10_10_10_2 = 0x8036; int GL_UNSIGNED_INT_2_10_10_10_REV = 0x8368; int GL_RESCALE_NORMAL = 0x803A; int GL_LIGHT_MODEL_COLOR_CONTROL = 0x81F8; int GL_SINGLE_COLOR = 0x81F9; int GL_SEPARATE_SPECULAR_COLOR = 0x81FA; int GL_CLAMP_TO_EDGE = 0x812F; int GL_TEXTURE_MIN_LOD = 0x813A; int GL_TEXTURE_MAX_LOD = 0x813B; int GL_TEXTURE_BASE_LEVEL = 0x813C; int GL_TEXTURE_MAX_LEVEL = 0x813D; int GL_MAX_ELEMENTS_VERTICES = 0x80E8; int GL_MAX_ELEMENTS_INDICES = 0x80E9; int GL_ALIASED_POINT_SIZE_RANGE = 0x846D; int GL_ALIASED_LINE_WIDTH_RANGE = 0x846E; int GL_SMOOTH_POINT_SIZE_RANGE = 0x0B12; int GL_SMOOTH_POINT_SIZE_GRANULARITY = 0x0B13; int GL_SMOOTH_LINE_WIDTH_RANGE = 0x0B22; int GL_SMOOTH_LINE_WIDTH_GRANULARITY = 0x0B23; void glDrawRangeElements(@GLenum int mode, @GLuint int start, @GLuint int end, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type, @BufferObject(BufferKind.ElementVBO) @Const @GLubyte @GLushort @GLuint Buffer indices); void glTexImage3D(@GLenum int target, int level, int internalFormat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, int border, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check(value = "GLChecks.calculateTexImage3DStorage(pixels, format, type, width, height, depth)", canBeNull = true) @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); void glTexSubImage3D(@GLenum int target, int level, int xoffset, int yoffset, int zoffset, @GLsizei int width, @GLsizei int height, @GLsizei int depth, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, depth)") @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); void glCopyTexSubImage3D(@GLenum int target, int level, int xoffset, int yoffset, int zoffset, int x, int y, @GLsizei int width, @GLsizei int height); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_vertex_program1_1.java0000644000175000017500000000314711543426511024521 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_vertex_program1_1 { } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/GL41.java0000644000175000017500000005265211543426511021225 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.*; public interface GL41 { // --------------------------------------------------------------------- // ----------------------[ ARB_ES2_compatibility ]---------------------- // --------------------------------------------------------------------- /** * Accepted by the <value> parameter of GetBooleanv, GetIntegerv, * GetInteger64v, GetFloatv, and GetDoublev: */ int GL_SHADER_COMPILER = 0x8DFA, GL_NUM_SHADER_BINARY_FORMATS = 0x8DF9, GL_MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB, GL_MAX_VARYING_VECTORS = 0x8DFC, GL_MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD, GL_IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A, GL_IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; /** Accepted by the <type> parameter of VertexAttribPointer: */ int GL_FIXED = 0x140C; /** * Accepted by the <precisiontype> parameter of * GetShaderPrecisionFormat: */ int GL_LOW_FLOAT = 0x8DF0, GL_MEDIUM_FLOAT = 0x8DF1, GL_HIGH_FLOAT = 0x8DF2, GL_LOW_INT = 0x8DF3, GL_MEDIUM_INT = 0x8DF4, GL_HIGH_INT = 0x8DF5; @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glReleaseShaderCompiler(); @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glShaderBinary(@AutoSize("shaders") @GLsizei int count, @Const @GLuint IntBuffer shaders, @GLenum int binaryformat, @Const @GLvoid ByteBuffer binary, @AutoSize("binary") @GLsizei int length); @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glGetShaderPrecisionFormat(@GLenum int shadertype, @GLenum int precisiontype, @OutParameter @Check("2") IntBuffer range, @OutParameter @Check("1") IntBuffer precision); @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glDepthRangef(@GLclampf float n, @GLclampf float f); @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glClearDepthf(@GLclampf float d); // ---------------------------------------------------------------------- // ----------------------[ ARB_get_program_binary ]---------------------- // ---------------------------------------------------------------------- /** * Accepted by the <pname> parameter of ProgramParameteri and * GetProgramiv: */ int GL_PROGRAM_BINARY_RETRIEVABLE_HINT = 0x8257; /** Accepted by the <pname> parameter of GetProgramiv: */ int GL_PROGRAM_BINARY_LENGTH = 0x8741; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetInteger64v, GetFloatv and GetDoublev: */ int GL_NUM_PROGRAM_BINARY_FORMATS = 0x87FE, GL_PROGRAM_BINARY_FORMATS = 0x87FF; void glGetProgramBinary(@GLuint int program, @AutoSize("binary") @GLsizei int bufSize, @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, @Check("1") @GLenum IntBuffer binaryFormat, @OutParameter @GLvoid ByteBuffer binary); void glProgramBinary(@GLuint int program, @GLenum int binaryFormat, @Const @GLvoid ByteBuffer binary, @AutoSize("binary") @GLsizei int length); void glProgramParameteri(@GLuint int program, @GLenum int pname, int value); // --------------------------------------------------------------------------- // ----------------------[ ARB_separate_shader_objects ]---------------------- // --------------------------------------------------------------------------- /** Accepted by <stages> parameter to UseProgramStages: */ int GL_VERTEX_SHADER_BIT = 0x00000001, GL_FRAGMENT_SHADER_BIT = 0x00000002, GL_GEOMETRY_SHADER_BIT = 0x00000004, GL_TESS_CONTROL_SHADER_BIT = 0x00000008, GL_TESS_EVALUATION_SHADER_BIT = 0x00000010, GL_ALL_SHADER_BITS = 0xFFFFFFFF; /** * Accepted by the <pname> parameter of ProgramParameteri and * GetProgramiv: */ int GL_PROGRAM_SEPARABLE = 0x8258; /** Accepted by <type> parameter to GetProgramPipelineiv: */ int GL_ACTIVE_PROGRAM = 0x8259; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetInteger64v, GetFloatv, and GetDoublev: */ int GL_PROGRAM_PIPELINE_BINDING = 0x825A; void glUseProgramStages(@GLuint int pipeline, @GLbitfield int stages, @GLuint int program); void glActiveShaderProgram(@GLuint int pipeline, @GLuint int program); @StripPostfix(value = "strings", postfix = "v") @GLuint int glCreateShaderProgramv(@GLenum int type, @GLsizei int count, @Check @Const @Indirect @GLchar ByteBuffer strings); @Alternate("glCreateShaderProgramv") @StripPostfix(value = "string", postfix = "v") @GLuint int glCreateShaderProgramv(@GLenum int type, @Constant("1") @GLsizei int count, @NullTerminated CharSequence string); @Alternate("glCreateShaderProgramv") @StripPostfix(value = "strings", postfix = "v") @GLuint int glCreateShaderProgramv(@GLenum int type, @Constant("strings.length") @GLsizei int count, @Const @NullTerminated @PointerArray(value = "count") CharSequence[] strings); void glBindProgramPipeline(@GLuint int pipeline); void glDeleteProgramPipelines(@AutoSize("pipelines") @GLsizei int n, @Const @GLuint IntBuffer pipelines); @Alternate("glDeleteProgramPipelines") void glDeleteProgramPipelines(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, pipeline), 0", keepParam = true) int pipeline); void glGenProgramPipelines(@AutoSize("pipelines") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines); @Alternate("glGenProgramPipelines") @GLreturn("pipelines") void glGenProgramPipelines2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines); boolean glIsProgramPipeline(@GLuint int pipeline); @StripPostfix("params") void glGetProgramPipelineiv(@GLuint int pipeline, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); @Alternate("glGetProgramPipelineiv") @GLreturn("params") @StripPostfix("params") void glGetProgramPipelineiv2(@GLuint int pipeline, @GLenum int pname, @OutParameter IntBuffer params); void glProgramUniform1i(@GLuint int program, int location, int v0); void glProgramUniform2i(@GLuint int program, int location, int v0, int v1); void glProgramUniform3i(@GLuint int program, int location, int v0, int v1, int v2); void glProgramUniform4i(@GLuint int program, int location, int v0, int v1, int v2, int v3); void glProgramUniform1f(@GLuint int program, int location, float v0); void glProgramUniform2f(@GLuint int program, int location, float v0, float v1); void glProgramUniform3f(@GLuint int program, int location, float v0, float v1, float v2); void glProgramUniform4f(@GLuint int program, int location, float v0, float v1, float v2, float v3); void glProgramUniform1d(@GLuint int program, int location, double v0); void glProgramUniform2d(@GLuint int program, int location, double v0, double v1); void glProgramUniform3d(@GLuint int program, int location, double v0, double v1, double v2); void glProgramUniform4d(@GLuint int program, int location, double v0, double v1, double v2, double v3); @StripPostfix("value") void glProgramUniform1iv(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const IntBuffer value); @StripPostfix("value") void glProgramUniform2iv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const IntBuffer value); @StripPostfix("value") void glProgramUniform3iv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const IntBuffer value); @StripPostfix("value") void glProgramUniform4iv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const IntBuffer value); @StripPostfix("value") void glProgramUniform1fv(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const FloatBuffer value); @StripPostfix("value") void glProgramUniform2fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const FloatBuffer value); @StripPostfix("value") void glProgramUniform3fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const FloatBuffer value); @StripPostfix("value") void glProgramUniform4fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const FloatBuffer value); @StripPostfix("value") void glProgramUniform1dv(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const DoubleBuffer value); @StripPostfix("value") void glProgramUniform2dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const DoubleBuffer value); @StripPostfix("value") void glProgramUniform3dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const DoubleBuffer value); @StripPostfix("value") void glProgramUniform4dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const DoubleBuffer value); void glProgramUniform1ui(@GLuint int program, int location, int v0); void glProgramUniform2ui(@GLuint int program, int location, int v0, int v1); void glProgramUniform3ui(@GLuint int program, int location, int v0, int v1, int v2); void glProgramUniform4ui(@GLuint int program, int location, int v0, int v1, int v2, int v3); @StripPostfix("value") void glProgramUniform1uiv(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const IntBuffer value); @StripPostfix("value") void glProgramUniform2uiv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const IntBuffer value); @StripPostfix("value") void glProgramUniform3uiv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const IntBuffer value); @StripPostfix("value") void glProgramUniform4uiv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const IntBuffer value); @StripPostfix("value") void glProgramUniformMatrix2fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @StripPostfix("value") void glProgramUniformMatrix3fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @StripPostfix("value") void glProgramUniformMatrix4fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 4") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @StripPostfix("value") void glProgramUniformMatrix2dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @StripPostfix("value") void glProgramUniformMatrix3dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @StripPostfix("value") void glProgramUniformMatrix4dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 4") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @StripPostfix("value") void glProgramUniformMatrix2x3fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (2 * 3)") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @StripPostfix("value") void glProgramUniformMatrix3x2fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 2)") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @StripPostfix("value") void glProgramUniformMatrix2x4fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @StripPostfix("value") void glProgramUniformMatrix4x2fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @StripPostfix("value") void glProgramUniformMatrix3x4fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 4)") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @StripPostfix("value") void glProgramUniformMatrix4x3fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (4 * 3)") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @StripPostfix("value") void glProgramUniformMatrix2x3dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (2 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @StripPostfix("value") void glProgramUniformMatrix3x2dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 2)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @StripPostfix("value") void glProgramUniformMatrix2x4dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @StripPostfix("value") void glProgramUniformMatrix4x2dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @StripPostfix("value") void glProgramUniformMatrix3x4dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 4)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @StripPostfix("value") void glProgramUniformMatrix4x3dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (4 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); void glValidateProgramPipeline(@GLuint int pipeline); void glGetProgramPipelineInfoLog(@GLuint int pipeline, @AutoSize("infoLog") @GLsizei int bufSize, @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, @OutParameter @GLchar ByteBuffer infoLog); @Alternate("glGetProgramPipelineInfoLog") @GLreturn(value = "infoLog", maxLength = "bufSize") void glGetProgramPipelineInfoLog2(@GLuint int pipeline, @GLsizei int bufSize, @OutParameter @GLsizei @Constant("infoLog_length, 0") IntBuffer length, @OutParameter @GLchar ByteBuffer infoLog); // ----------------------------------------------------------------------- // ----------------------[ ARB_vertex_attrib_64bit ]---------------------- // ----------------------------------------------------------------------- /** Returned in the <type> parameter of GetActiveAttrib: */ int GL_DOUBLE_VEC2 = 0x8FFC; int GL_DOUBLE_VEC3 = 0x8FFD; int GL_DOUBLE_VEC4 = 0x8FFE; int GL_DOUBLE_MAT2 = 0x8F46; int GL_DOUBLE_MAT3 = 0x8F47; int GL_DOUBLE_MAT4 = 0x8F48; int GL_DOUBLE_MAT2x3 = 0x8F49; int GL_DOUBLE_MAT2x4 = 0x8F4A; int GL_DOUBLE_MAT3x2 = 0x8F4B; int GL_DOUBLE_MAT3x4 = 0x8F4C; int GL_DOUBLE_MAT4x2 = 0x8F4D; int GL_DOUBLE_MAT4x3 = 0x8F4E; @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glVertexAttribL1d(@GLuint int index, double x); @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glVertexAttribL2d(@GLuint int index, double x, double y); @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glVertexAttribL3d(@GLuint int index, double x, double y, double z); @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glVertexAttribL4d(@GLuint int index, double x, double y, double z, double w); @Optional(reason = "Not exposed in ATI Catalyst 10.10c") @StripPostfix("v") void glVertexAttribL1dv(@GLuint int index, @Const @Check("1") DoubleBuffer v); @Optional(reason = "Not exposed in ATI Catalyst 10.10c") @StripPostfix("v") void glVertexAttribL2dv(@GLuint int index, @Const @Check("2") DoubleBuffer v); @Optional(reason = "Not exposed in ATI Catalyst 10.10c") @StripPostfix("v") void glVertexAttribL3dv(@GLuint int index, @Const @Check("3") DoubleBuffer v); @Optional(reason = "Not exposed in ATI Catalyst 10.10c") @StripPostfix("v") void glVertexAttribL4dv(@GLuint int index, @Const @Check("4") DoubleBuffer v); @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glVertexAttribLPointer(@GLuint int index, int size, @Constant("GL11.GL_DOUBLE") @GLenum int type, @GLsizei int stride, @CachedReference(index = "index", name = "glVertexAttribPointer_buffer") @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLdouble Buffer pointer); @Optional(reason = "Not exposed in ATI Catalyst 10.10c") @StripPostfix("params") void glGetVertexAttribLdv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") DoubleBuffer params); // ------------------------------------------------------------------ // ----------------------[ ARB_viewport_array ]---------------------- // ------------------------------------------------------------------ /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * GetDoublev and GetInteger64v: */ int GL_MAX_VIEWPORTS = 0x825B, GL_VIEWPORT_SUBPIXEL_BITS = 0x825C, GL_VIEWPORT_BOUNDS_RANGE = 0x825D, GL_LAYER_PROVOKING_VERTEX = 0x825E, GL_VIEWPORT_INDEX_PROVOKING_VERTEX = 0x825F; /** Accepted by the <pname> parameter of GetIntegeri_v: */ int GL_SCISSOR_BOX = 0x0C10; /** Accepted by the <pname> parameter of GetFloati_v: */ int GL_VIEWPORT = 0x0BA2; /** Accepted by the <pname> parameter of GetDoublei_v: */ int GL_DEPTH_RANGE = 0x0B70; /** Accepted by the <pname> parameter of Enablei, Disablei, and IsEnabledi: */ int GL_SCISSOR_TEST = 0x0C11; /** * Returned in the <data> parameter from a Get query with a <pname> of * LAYER_PROVOKING_VERTEX or VIEWPORT_INDEX_PROVOKING_VERTEX: */ int GL_FIRST_VERTEX_CONVENTION = 0x8E4D, GL_LAST_VERTEX_CONVENTION = 0x8E4E, GL_PROVOKING_VERTEX = 0x8E4F, GL_UNDEFINED_VERTEX = 0x8260; @StripPostfix("v") void glViewportArrayv(@GLuint int first, @AutoSize(value = "v", expression = " >> 2") @GLsizei int count, @Const FloatBuffer v); void glViewportIndexedf(@GLuint int index, float x, float y, float w, float h); @StripPostfix("v") void glViewportIndexedfv(@GLuint int index, @Check("4") @Const FloatBuffer v); @StripPostfix("v") void glScissorArrayv(@GLuint int first, @AutoSize(value = "v", expression = " >> 2") @GLsizei int count, @Const IntBuffer v); void glScissorIndexed(@GLuint int index, int left, int bottom, @GLsizei int width, @GLsizei int height); @StripPostfix("v") void glScissorIndexedv(@GLuint int index, @Check("4") @Const IntBuffer v); @StripPostfix("v") void glDepthRangeArrayv(@GLuint int first, @AutoSize(value = "v", expression = " >> 1") @GLsizei int count, @Const @GLclampd DoubleBuffer v); void glDepthRangeIndexed(@GLuint int index, @GLclampd double n, @GLclampd double f); @StripPostfix("data") void glGetFloati_v(@GLenum int target, @GLuint int index, @Check @OutParameter FloatBuffer data); @Alternate("glGetFloati_v") @GLreturn("data") @StripPostfix("data") void glGetFloati_v2(@GLenum int target, @GLuint int index, @OutParameter FloatBuffer data); @StripPostfix("data") void glGetDoublei_v(@GLenum int target, @GLuint int index, @Check @OutParameter DoubleBuffer data); @Alternate("glGetDoublei_v") @GLreturn("data") @StripPostfix("data") void glGetDoublei_v2(@GLenum int target, @GLuint int index, @OutParameter DoubleBuffer data); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_vertex_program.java0000644000175000017500000003072111543426511024216 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.*; public interface NV_vertex_program extends NV_program { /** Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev, and by the <target> parameter of BindProgramNV, ExecuteProgramNV, GetProgramParameter[df]vNV, GetTrackMatrixivNV, LoadProgramNV, ProgramParameter[s]4[df][v]NV, and TrackMatrixNV: */ int GL_VERTEX_PROGRAM_NV = 0x8620; /** Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev: */ int GL_VERTEX_PROGRAM_POINT_SIZE_NV = 0x8642; int GL_VERTEX_PROGRAM_TWO_SIDE_NV = 0x8643; /** Accepted by the <target> parameter of ExecuteProgramNV and LoadProgramNV: */ int GL_VERTEX_STATE_PROGRAM_NV = 0x8621; /** Accepted by the <pname> parameter of GetVertexAttrib[dfi]vNV: */ int GL_ATTRIB_ARRAY_SIZE_NV = 0x8623; int GL_ATTRIB_ARRAY_STRIDE_NV = 0x8624; int GL_ATTRIB_ARRAY_TYPE_NV = 0x8625; int GL_CURRENT_ATTRIB_NV = 0x8626; /** Accepted by the <pname> parameter of GetProgramParameterfvNV and GetProgramParameterdvNV: */ int GL_PROGRAM_PARAMETER_NV = 0x8644; /** Accepted by the <pname> parameter of GetVertexAttribPointervNV: */ int GL_ATTRIB_ARRAY_POINTER_NV = 0x8645; /** Accepted by the <pname> parameter of GetTrackMatrixivNV: */ int GL_TRACK_MATRIX_NV = 0x8648; int GL_TRACK_MATRIX_TRANSFORM_NV = 0x8649; /** Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev: */ int GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV = 0x862E; int GL_MAX_TRACK_MATRICES_NV = 0x862F; int GL_CURRENT_MATRIX_STACK_DEPTH_NV = 0x8640; int GL_CURRENT_MATRIX_NV = 0x8641; int GL_VERTEX_PROGRAM_BINDING_NV = 0x864A; /** Accepted by the <matrix> parameter of TrackMatrixNV: */ int GL_MODELVIEW_PROJECTION_NV = 0x8629; /** Accepted by the <matrix> parameter of TrackMatrixNV and by the <mode> parameter of MatrixMode: */ int GL_MATRIX0_NV = 0x8630; int GL_MATRIX1_NV = 0x8631; int GL_MATRIX2_NV = 0x8632; int GL_MATRIX3_NV = 0x8633; int GL_MATRIX4_NV = 0x8634; int GL_MATRIX5_NV = 0x8635; int GL_MATRIX6_NV = 0x8636; int GL_MATRIX7_NV = 0x8637; /** Accepted by the <transform> parameter of TrackMatrixNV: */ int GL_IDENTITY_NV = 0x862A; int GL_INVERSE_NV = 0x862B; int GL_TRANSPOSE_NV = 0x862C; int GL_INVERSE_TRANSPOSE_NV = 0x862D; /** Accepted by the <array> parameter of EnableClientState and DisableClientState, by the <cap> parameter of IsEnabled, and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev: */ int GL_VERTEX_ATTRIB_ARRAY0_NV = 0x8650; int GL_VERTEX_ATTRIB_ARRAY1_NV = 0x8651; int GL_VERTEX_ATTRIB_ARRAY2_NV = 0x8652; int GL_VERTEX_ATTRIB_ARRAY3_NV = 0x8653; int GL_VERTEX_ATTRIB_ARRAY4_NV = 0x8654; int GL_VERTEX_ATTRIB_ARRAY5_NV = 0x8655; int GL_VERTEX_ATTRIB_ARRAY6_NV = 0x8656; int GL_VERTEX_ATTRIB_ARRAY7_NV = 0x8657; int GL_VERTEX_ATTRIB_ARRAY8_NV = 0x8658; int GL_VERTEX_ATTRIB_ARRAY9_NV = 0x8659; int GL_VERTEX_ATTRIB_ARRAY10_NV = 0x865A; int GL_VERTEX_ATTRIB_ARRAY11_NV = 0x865B; int GL_VERTEX_ATTRIB_ARRAY12_NV = 0x865C; int GL_VERTEX_ATTRIB_ARRAY13_NV = 0x865D; int GL_VERTEX_ATTRIB_ARRAY14_NV = 0x865E; int GL_VERTEX_ATTRIB_ARRAY15_NV = 0x865F; /** Accepted by the <target> parameter of GetMapdv, GetMapfv, GetMapiv, Map1d and Map1f and by the <cap> parameter of Enable, Disable, and IsEnabled, and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev: */ int GL_MAP1_VERTEX_ATTRIB0_4_NV = 0x8660; int GL_MAP1_VERTEX_ATTRIB1_4_NV = 0x8661; int GL_MAP1_VERTEX_ATTRIB2_4_NV = 0x8662; int GL_MAP1_VERTEX_ATTRIB3_4_NV = 0x8663; int GL_MAP1_VERTEX_ATTRIB4_4_NV = 0x8664; int GL_MAP1_VERTEX_ATTRIB5_4_NV = 0x8665; int GL_MAP1_VERTEX_ATTRIB6_4_NV = 0x8666; int GL_MAP1_VERTEX_ATTRIB7_4_NV = 0x8667; int GL_MAP1_VERTEX_ATTRIB8_4_NV = 0x8668; int GL_MAP1_VERTEX_ATTRIB9_4_NV = 0x8669; int GL_MAP1_VERTEX_ATTRIB10_4_NV = 0x866A; int GL_MAP1_VERTEX_ATTRIB11_4_NV = 0x866B; int GL_MAP1_VERTEX_ATTRIB12_4_NV = 0x866C; int GL_MAP1_VERTEX_ATTRIB13_4_NV = 0x866D; int GL_MAP1_VERTEX_ATTRIB14_4_NV = 0x866E; int GL_MAP1_VERTEX_ATTRIB15_4_NV = 0x866F; /** Accepted by the <target> parameter of GetMapdv, GetMapfv, GetMapiv, Map2d and Map2f and by the <cap> parameter of Enable, Disable, and IsEnabled, and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev: */ int GL_MAP2_VERTEX_ATTRIB0_4_NV = 0x8670; int GL_MAP2_VERTEX_ATTRIB1_4_NV = 0x8671; int GL_MAP2_VERTEX_ATTRIB2_4_NV = 0x8672; int GL_MAP2_VERTEX_ATTRIB3_4_NV = 0x8673; int GL_MAP2_VERTEX_ATTRIB4_4_NV = 0x8674; int GL_MAP2_VERTEX_ATTRIB5_4_NV = 0x8675; int GL_MAP2_VERTEX_ATTRIB6_4_NV = 0x8676; int GL_MAP2_VERTEX_ATTRIB7_4_NV = 0x8677; int GL_MAP2_VERTEX_ATTRIB8_4_NV = 0x8678; int GL_MAP2_VERTEX_ATTRIB9_4_NV = 0x8679; int GL_MAP2_VERTEX_ATTRIB10_4_NV = 0x867A; int GL_MAP2_VERTEX_ATTRIB11_4_NV = 0x867B; int GL_MAP2_VERTEX_ATTRIB12_4_NV = 0x867C; int GL_MAP2_VERTEX_ATTRIB13_4_NV = 0x867D; int GL_MAP2_VERTEX_ATTRIB14_4_NV = 0x867E; int GL_MAP2_VERTEX_ATTRIB15_4_NV = 0x867F; void glExecuteProgramNV(@GLenum int target, @GLuint int id, @Check("4") @Const FloatBuffer params); @StripPostfix("params") void glGetProgramParameterfvNV(@GLenum int target, @GLuint int index, @GLenum int parameterName, @OutParameter @Check("4") FloatBuffer params); @StripPostfix("params") void glGetProgramParameterdvNV(@GLenum int target, @GLuint int index, @GLenum int parameterName, @OutParameter @Check("4") DoubleBuffer params); @StripPostfix("params") void glGetTrackMatrixivNV(@GLenum int target, @GLuint int address, @GLenum int parameterName, @OutParameter @Check("4") IntBuffer params); @StripPostfix("params") void glGetVertexAttribfvNV(@GLuint int index, @GLenum int parameterName, @OutParameter @Check("4") FloatBuffer params); @StripPostfix("params") void glGetVertexAttribdvNV(@GLuint int index, @GLenum int parameterName, @OutParameter @Check("4") DoubleBuffer params); @StripPostfix("params") void glGetVertexAttribivNV(@GLuint int index, @GLenum int parameterName, @OutParameter @Check("4") IntBuffer params); @StripPostfix("pointer") void glGetVertexAttribPointervNV(@GLuint int index, @GLenum int parameterName, @Result @GLvoid ByteBuffer pointer); void glProgramParameter4fNV(@GLenum int target, @GLuint int index, float x, float y, float z, float w); void glProgramParameter4dNV(@GLenum int target, @GLuint int index, double x, double y, double z, double w); @StripPostfix("params") void glProgramParameters4fvNV(@GLenum int target, @GLuint int index, @AutoSize(value = "params", expression = " >> 2") @GLuint int count, @Const FloatBuffer params); @StripPostfix("params") void glProgramParameters4dvNV(@GLenum int target, @GLuint int index, @AutoSize(value = "params", expression = " >> 2") @GLuint int count, @Const DoubleBuffer params); void glTrackMatrixNV(@GLenum int target, @GLuint int address, @GLenum int matrix, @GLenum int transform); void glVertexAttribPointerNV(@GLuint int index, int size, @GLenum int type, @GLsizei int stride, @CachedReference(index="index",name="glVertexAttribPointer_buffer") @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLbyte @GLubyte @GLshort @GLushort @GLint @GLuint @GLfloat @GLdouble Buffer buffer); @NoErrorCheck void glVertexAttrib1sNV(@GLuint int index, short x); @NoErrorCheck void glVertexAttrib1fNV(@GLuint int index, float x); @NoErrorCheck void glVertexAttrib1dNV(@GLuint int index, double x); @NoErrorCheck void glVertexAttrib2sNV(@GLuint int index, short x, short y); @NoErrorCheck void glVertexAttrib2fNV(@GLuint int index, float x, float y); @NoErrorCheck void glVertexAttrib2dNV(@GLuint int index, double x, double y); @NoErrorCheck void glVertexAttrib3sNV(@GLuint int index, short x, short y, short z); @NoErrorCheck void glVertexAttrib3fNV(@GLuint int index, float x, float y, float z); @NoErrorCheck void glVertexAttrib3dNV(@GLuint int index, double x, double y, double z); @NoErrorCheck void glVertexAttrib4sNV(@GLuint int index, short x, short y, short z, short w); @NoErrorCheck void glVertexAttrib4fNV(@GLuint int index, float x, float y, float z, float w); @NoErrorCheck void glVertexAttrib4dNV(@GLuint int index, double x, double y, double z, double w); @NoErrorCheck void glVertexAttrib4ubNV(@GLuint int index, @GLubyte byte x, @GLubyte byte y, @GLubyte byte z, @GLubyte byte w); @NoErrorCheck @StripPostfix("v") void glVertexAttribs1svNV(@GLuint int index, @AutoSize("v") @GLsizei int n, @Const ShortBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribs1fvNV(@GLuint int index, @AutoSize("v") @GLsizei int n, @Const FloatBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribs1dvNV(@GLuint int index, @AutoSize("v") @GLsizei int n, @Const DoubleBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribs2svNV(@GLuint int index, @AutoSize(value = "v", expression = " >> 1") @GLsizei int n, @Const ShortBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribs2fvNV(@GLuint int index, @AutoSize(value = "v", expression = " >> 1") @GLsizei int n, @Const FloatBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribs2dvNV(@GLuint int index, @AutoSize(value = "v", expression = " >> 1") @GLsizei int n, @Const DoubleBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribs3svNV(@GLuint int index, @AutoSize(value = "v", expression = " / 3") @GLsizei int n, @Const ShortBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribs3fvNV(@GLuint int index, @AutoSize(value = "v", expression = " / 3") @GLsizei int n, @Const FloatBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribs3dvNV(@GLuint int index, @AutoSize(value = "v", expression = " / 3") @GLsizei int n, @Const DoubleBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribs4svNV(@GLuint int index, @AutoSize(value = "v", expression = " >> 2") @GLsizei int n, @Const ShortBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribs4fvNV(@GLuint int index, @AutoSize(value = "v", expression = " >> 2") @GLsizei int n, @Const FloatBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribs4dvNV(@GLuint int index, @AutoSize(value = "v", expression = " >> 2") @GLsizei int n, @Const DoubleBuffer v); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_conditional_render.java0000644000175000017500000000403411543426511025012 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLuint; public interface NV_conditional_render { /** * Accepted by the <mode> parameter of BeginConditionalRenderNV: */ int GL_QUERY_WAIT_NV = 0x8E13; int GL_QUERY_NO_WAIT_NV = 0x8E14; int GL_QUERY_BY_REGION_WAIT_NV = 0x8E15; int GL_QUERY_BY_REGION_NO_WAIT_NV = 0x8E16; void glBeginConditionalRenderNV(@GLuint int id, @GLenum int mode); void glEndConditionalRenderNV(); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_geometry_shader4.java0000644000175000017500000000762511543426511024507 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLuint; public interface ARB_geometry_shader4 { /** * Accepted by the <type> parameter of CreateShader and returned by the * <params> parameter of GetShaderiv: */ int GL_GEOMETRY_SHADER_ARB = 0x8DD9; /** * Accepted by the <pname> parameter of ProgramParameteriEXT and * GetProgramiv: */ int GL_GEOMETRY_VERTICES_OUT_ARB = 0x8DDA; int GL_GEOMETRY_INPUT_TYPE_ARB = 0x8DDB; int GL_GEOMETRY_OUTPUT_TYPE_ARB = 0x8DDC; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB = 0x8C29; int GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB = 0x8DDD; int GL_MAX_VERTEX_VARYING_COMPONENTS_ARB = 0x8DDE; int GL_MAX_VARYING_COMPONENTS_ARB = 0x8B4B; int GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB = 0x8DDF; int GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB = 0x8DE0; int GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB = 0x8DE1; /** * Accepted by the <mode> parameter of Begin, DrawArrays, * MultiDrawArrays, DrawElements, MultiDrawElements, and * DrawRangeElements: */ int GL_LINES_ADJACENCY_ARB = 0xA; int GL_LINE_STRIP_ADJACENCY_ARB = 0xB; int GL_TRIANGLES_ADJACENCY_ARB = 0xC; int GL_TRIANGLE_STRIP_ADJACENCY_ARB = 0xD; /** Returned by CheckFramebufferStatusEXT: */ int GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB = 0x8DA8; int GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB = 0x8DA9; /** * Accepted by the <pname> parameter of GetFramebufferAttachment- * ParameterivEXT: */ int GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB = 0x8DA7; int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_ARB = 0x8CD4; /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, * and by the <pname> parameter of GetIntegerv, GetFloatv, GetDoublev, * and GetBooleanv: */ int GL_PROGRAM_POINT_SIZE_ARB = 0x8642; void glProgramParameteriARB(@GLuint int program, @GLenum int pname, int value); void glFramebufferTextureARB(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level); void glFramebufferTextureLayerARB(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, int layer); void glFramebufferTextureFaceARB(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, @GLenum int face); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_point_sprite.java0000644000175000017500000000421311543426511023747 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_point_sprite { /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, by * the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and * GetDoublev, and by the <target> parameter of TexEnvi, TexEnviv, * TexEnvf, TexEnvfv, GetTexEnviv, and GetTexEnvfv: */ int GL_POINT_SPRITE_ARB = 0x8861; /** * When the <target> parameter of TexEnvf, TexEnvfv, TexEnvi, TexEnviv, * GetTexEnvfv, or GetTexEnviv is POINT_SPRITE_ARB, then the value of * <pname> may be: */ int GL_COORD_REPLACE_ARB = 0x8862; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ATI_shader_texture_lod.java0000644000175000017500000000315011543426511025124 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ATI_shader_texture_lod { }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_multisample.java0000644000175000017500000001071611543426511025351 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLbitfield; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.FloatBuffer; @Extension(postfix = "") public interface ARB_texture_multisample { /** Accepted by the <pname> parameter of GetMultisamplefv: */ int GL_SAMPLE_POSITION = 0x8E50; /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, and by * the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and * GetDoublev: */ int GL_SAMPLE_MASK = 0x8E51; /** * Accepted by the <target> parameter of GetBooleani_v and * GetIntegeri_v: */ int GL_SAMPLE_MASK_VALUE = 0x8E52; /** * Accepted by the <target> parameter of BindTexture and * TexImage2DMultisample: */ int GL_TEXTURE_2D_MULTISAMPLE = 0x9100; /** Accepted by the <target> parameter of TexImage2DMultisample: */ int GL_PROXY_TEXTURE_2D_MULTISAMPLE = 0x9101; /** * Accepted by the <target> parameter of BindTexture and * TexImage3DMultisample: */ int GL_TEXTURE_2D_MULTISAMPLE_ARRAY = 0x9102; /** Accepted by the <target> parameter of TexImage3DMultisample: */ int GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY = 0x9103; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv, * and GetFloatv: */ int GL_MAX_SAMPLE_MASK_WORDS = 0x8E59; int GL_MAX_COLOR_TEXTURE_SAMPLES = 0x910E; int GL_MAX_DEPTH_TEXTURE_SAMPLES = 0x910F; int GL_MAX_INTEGER_SAMPLES = 0x9110; int GL_TEXTURE_BINDING_2D_MULTISAMPLE = 0x9104; int GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY = 0x9105; /** Accepted by the <pname> parameter of GetTexLevelParameter */ int GL_TEXTURE_SAMPLES = 0x9106; int GL_TEXTURE_FIXED_SAMPLE_LOCATIONS = 0x9107; /** Returned by the <type> parameter of GetActiveUniform: */ int GL_SAMPLER_2D_MULTISAMPLE = 0x9108; int GL_INT_SAMPLER_2D_MULTISAMPLE = 0x9109; int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE = 0x910A; int GL_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910B; int GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910C; int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910D; @Reuse("GL32") void glTexImage2DMultisample(@GLenum int target, @GLsizei int samples, int internalformat, @GLsizei int width, @GLsizei int height, boolean fixedsamplelocations); @Reuse("GL32") void glTexImage3DMultisample(@GLenum int target, @GLsizei int samples, int internalformat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, boolean fixedsamplelocations); @Reuse("GL32") @StripPostfix("val") void glGetMultisamplefv(@GLenum int pname, @GLuint int index, @OutParameter @Check("2") FloatBuffer val); @Reuse("GL32") void glSampleMaski(@GLuint int index, @GLbitfield int mask); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_point_parameters.java0000644000175000017500000000404511543426511024643 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import java.nio.*; public interface EXT_point_parameters { int GL_POINT_SIZE_MIN_EXT = 0x8126; int GL_POINT_SIZE_MAX_EXT = 0x8127; int GL_POINT_FADE_THRESHOLD_SIZE_EXT = 0x8128; int GL_DISTANCE_ATTENUATION_EXT = 0x8129; void glPointParameterfEXT(@GLenum int pname, float param); @StripPostfix("pfParams") void glPointParameterfvEXT(@GLenum int pname, @Check("4") @Const FloatBuffer pfParams); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/SUN_slice_accum.java0000644000175000017500000000330311543426511023537 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface SUN_slice_accum { /** * Accepted by the <op> parameter of Accum, */ int GL_SLICE_ACCUM_SUN = 0x85CC; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/APPLE_aux_depth_stencil.java0000644000175000017500000000332511543426511025172 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface APPLE_aux_depth_stencil { /** Accepted by the <pname> parameter of GetIntegerv. */ int GL_AUX_DEPTH_STENCIL_APPLE = 0x8A14; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ATI_texture_mirror_once.java0000644000175000017500000000327011543426511025341 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ATI_texture_mirror_once { int GL_MIRROR_CLAMP_ATI = 0x8742; int GL_MIRROR_CLAMP_TO_EDGE_ATI = 0x8743; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_transpose_matrix.java0000644000175000017500000000404011543426511024630 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import java.nio.*; public interface ARB_transpose_matrix { int GL_TRANSPOSE_MODELVIEW_MATRIX_ARB = 0x84E3; int GL_TRANSPOSE_PROJECTION_MATRIX_ARB = 0x84E4; int GL_TRANSPOSE_TEXTURE_MATRIX_ARB = 0x84E5; int GL_TRANSPOSE_COLOR_MATRIX_ARB = 0x84E6; @StripPostfix("pfMtx") void glLoadTransposeMatrixfARB(@Check("16") @Const FloatBuffer pfMtx); @StripPostfix("pfMtx") void glMultTransposeMatrixfARB(@Check("16") @Const FloatBuffer pfMtx); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_vertex_attrib_64bit.java0000644000175000017500000000735211543426511025131 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.Buffer; import java.nio.DoubleBuffer; @Dependent @Extension(postfix = "") public interface ARB_vertex_attrib_64bit { /** Returned in the <type> parameter of GetActiveAttrib: */ int GL_DOUBLE_VEC2 = 0x8FFC; int GL_DOUBLE_VEC3 = 0x8FFD; int GL_DOUBLE_VEC4 = 0x8FFE; int GL_DOUBLE_MAT2 = 0x8F46; int GL_DOUBLE_MAT3 = 0x8F47; int GL_DOUBLE_MAT4 = 0x8F48; int GL_DOUBLE_MAT2x3 = 0x8F49; int GL_DOUBLE_MAT2x4 = 0x8F4A; int GL_DOUBLE_MAT3x2 = 0x8F4B; int GL_DOUBLE_MAT3x4 = 0x8F4C; int GL_DOUBLE_MAT4x2 = 0x8F4D; int GL_DOUBLE_MAT4x3 = 0x8F4E; @Reuse("GL41") void glVertexAttribL1d(@GLuint int index, double x); @Reuse("GL41") void glVertexAttribL2d(@GLuint int index, double x, double y); @Reuse("GL41") void glVertexAttribL3d(@GLuint int index, double x, double y, double z); @Reuse("GL41") void glVertexAttribL4d(@GLuint int index, double x, double y, double z, double w); @Reuse("GL41") @StripPostfix("v") void glVertexAttribL1dv(@GLuint int index, @Const @Check("1") DoubleBuffer v); @Reuse("GL41") @StripPostfix("v") void glVertexAttribL2dv(@GLuint int index, @Const @Check("2") DoubleBuffer v); @Reuse("GL41") @StripPostfix("v") void glVertexAttribL3dv(@GLuint int index, @Const @Check("3") DoubleBuffer v); @Reuse("GL41") @StripPostfix("v") void glVertexAttribL4dv(@GLuint int index, @Const @Check("4") DoubleBuffer v); @Reuse("GL41") void glVertexAttribLPointer(@GLuint int index, int size, @Constant("GL11.GL_DOUBLE") @GLenum int type, @GLsizei int stride, @CachedReference(index = "index", name = "glVertexAttribPointer_buffer") @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLdouble Buffer pointer); @Reuse("GL41") @StripPostfix("params") void glGetVertexAttribLdv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") DoubleBuffer params); @Dependent("EXT_direct_state_access") void glVertexArrayVertexAttribLOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLuint int index, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/APPLE_flush_buffer_range.java0000644000175000017500000000420611543426511025315 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLintptr; import org.lwjgl.util.generator.opengl.GLsizeiptr; public interface APPLE_flush_buffer_range { /** * Accepted by the <pname> parameter of BufferParameteriAPPLE and * GetBufferParameteriv: */ int GL_BUFFER_SERIALIZED_MODIFY_APPLE = 0x8A12; int GL_BUFFER_FLUSHING_UNMAP_APPLE = 0x8A13; void glBufferParameteriAPPLE(@GLenum int target, @GLenum int pname, int param); void glFlushMappedBufferRangeAPPLE(@GLenum int target, @GLintptr long offset, @GLsizeiptr long size); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java0000644000175000017500000000770411543426511024463 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLreturn; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.IntBuffer; public interface ARB_occlusion_query { /** * Accepted by the <target> parameter of BeginQueryARB, EndQueryARB, * and GetQueryivARB: */ int GL_SAMPLES_PASSED_ARB = 0x8914; /** Accepted by the <pname> parameter of GetQueryivARB: */ int GL_QUERY_COUNTER_BITS_ARB = 0x8864; int GL_CURRENT_QUERY_ARB = 0x8865; /** * Accepted by the <pname> parameter of GetQueryObjectivARB and * GetQueryObjectuivARB: */ int GL_QUERY_RESULT_ARB = 0x8866; int GL_QUERY_RESULT_AVAILABLE_ARB = 0x8867; void glGenQueriesARB(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); @Alternate("glGenQueriesARB") @GLreturn("ids") void glGenQueriesARB2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); void glDeleteQueriesARB(@AutoSize("ids") @GLsizei int n, @GLuint IntBuffer ids); @Alternate("glDeleteQueriesARB") void glDeleteQueriesARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, id), 0", keepParam = true) int id); boolean glIsQueryARB(@GLuint int id); void glBeginQueryARB(@GLenum int target, @GLuint int id); void glEndQueryARB(@GLenum int target); @StripPostfix("params") void glGetQueryivARB(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); @Alternate("glGetQueryivARB") @GLreturn("params") @StripPostfix("params") void glGetQueryivARB2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") void glGetQueryObjectivARB(@GLuint int id, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); @Alternate("glGetQueryObjectivARB") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetQueryObjectivARB2(@GLuint int id, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") void glGetQueryObjectuivARB(@GLuint int id, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); @Alternate("glGetQueryObjectuivARB") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetQueryObjectuivARB2(@GLuint int id, @GLenum int pname, @OutParameter IntBuffer params); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/APPLE_ycbcr_422.java0000644000175000017500000000475411543426511023170 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface APPLE_ycbcr_422 { /** * Accepted by the <format> parameter of DrawPixels, ReadPixels, TexImage1D, * TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, TexSubImage2D, * TexSubImage3D, GetHistogram, GetMinmax, ConvolutionFilter1D, * ConvolutionFilter2D, ConvolutionFilter3D, GetConvolutionFilter, * SeparableFilter2D, SeparableFilter3D, GetSeparableFilter, ColorTable, * GetColorTable: */ int GL_YCBCR_422_APPLE = 0x85B9; /** * Accepted by the <type> parameter of DrawPixels, ReadPixels, TexImage1D, * TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, TexSubImage2D, * TexSubImage3D, GetHistogram, GetMinmax, ConvolutionFilter1D, * ConvolutionFilter2D, ConvolutionFilter3D, GetConvolutionFilter, * SeparableFilter2D, SeparableFilter3D, GetSeparableFilter, ColorTable, * GetColorTable: */ int GL_UNSIGNED_SHORT_8_8_APPLE = 0x85BA; int GL_UNSIGNED_SHORT_8_8_REV_APPLE = 0x85BB; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_framebuffer_sRGB.java0000644000175000017500000000465511543426511024437 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_framebuffer_sRGB { /** * Accepted by the <attribList> parameter of glXChooseVisual, and by * the <attrib> parameter of glXGetConfig: */ int GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT = 0x20B2; /** * Accepted by the <piAttributes> parameter of * wglGetPixelFormatAttribivEXT, wglGetPixelFormatAttribfvEXT, and * the <piAttribIList> and <pfAttribIList> of wglChoosePixelFormatEXT: */ int WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT = 0x20A9; /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, * and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_FRAMEBUFFER_SRGB_EXT = 0x8DB9; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_FRAMEBUFFER_SRGB_CAPABLE_EXT = 0x8DBA; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/GREMEDY_string_marker.java0000644000175000017500000000375111543426511024575 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLsizei; import java.nio.ByteBuffer; public interface GREMEDY_string_marker { void glStringMarkerGREMEDY(@AutoSize("string") @GLsizei int len, @Const ByteBuffer string); @Alternate("glStringMarkerGREMEDY") void glStringMarkerGREMEDY(@Constant("string.length()") @GLsizei int len, CharSequence string); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_cg_shader.java0000644000175000017500000000424211543426511023205 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_Cg_shader { /** * You can pass GL_CG_VERTEX_SHADER_EXT to glCreateShaderARB instead of GL_VERTEX_SHADER_ARB to create a vertex shader object * that will parse and compile its shader source with the Cg compiler front-end rather than the GLSL front-end. Likewise, you * can pass GL_CG_FRAGMENT_SHADER_EXT to glCreateShaderARB instead of GL_FRAGMENT_SHADER_ARB to create a fragment shader object * that will parse and compile its shader source with the Cg front-end rather than the GLSL front-end. */ int GL_CG_VERTEX_SHADER_EXT = 0x890E; int GL_CG_FRAGMENT_SHADER_EXT = 0x890F; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java0000644000175000017500000001235711543426511026223 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.ByteBuffer; import java.nio.IntBuffer; public interface ARB_shading_language_include { /** Accepted by the <type> parameter of NamedStringARB: */ int GL_SHADER_INCLUDE_ARB = 0x8DAE; /** Accepted by the <pname> parameter of GetNamedStringivARB: */ int GL_NAMED_STRING_LENGTH_ARB = 0x8DE9; int GL_NAMED_STRING_TYPE_ARB = 0x8DEA; void glNamedStringARB(@GLenum int type, @AutoSize("name") int namelen, @Const @GLchar ByteBuffer name, @AutoSize("string") int stringlen, @Const @GLchar ByteBuffer string); @Alternate("glNamedStringARB") void glNamedStringARB(@GLenum int type, @Constant("name.length()") int namelen, CharSequence name, @Constant("string.length()") int stringlen, CharSequence string); void glDeleteNamedStringARB(@AutoSize("name") int namelen, @Const @GLchar ByteBuffer name); @Alternate("glDeleteNamedStringARB") void glDeleteNamedStringARB(@Constant("name.length()") int namelen, CharSequence name); void glCompileShaderIncludeARB(@GLuint int shader, @GLsizei int count, @Const @NullTerminated("count") @PointerArray("count") @GLchar ByteBuffer path, @Constant("null, 0") @Const IntBuffer length); @Alternate(value = "glCompileShaderIncludeARB", nativeAlt = true) void glCompileShaderIncludeARB2(@GLuint int shader, @Constant("path.length") @GLsizei int count, @Const @PointerArray(value = "count", lengths = "length") CharSequence[] path, @Constant("APIUtil.getLengths(path), 0") @Const IntBuffer length); boolean glIsNamedStringARB(@AutoSize("name") int namelen, @Const @GLchar ByteBuffer name); @Alternate("glIsNamedStringARB") boolean glIsNamedStringARB(@Constant("name.length()") int namelen, CharSequence name); void glGetNamedStringARB(@AutoSize("name") int namelen, @Const @GLchar ByteBuffer name, @AutoSize("string") @GLsizei int bufSize, @OutParameter @Check(value = "1", canBeNull = true) IntBuffer stringlen, @OutParameter @GLchar ByteBuffer string); @Alternate("glGetNamedStringARB") void glGetNamedStringARB(@Constant("name.length()") int namelen, CharSequence name, @AutoSize("string") @GLsizei int bufSize, @OutParameter @Check(value = "1", canBeNull = true) IntBuffer stringlen, @OutParameter @GLchar ByteBuffer string); @Alternate("glGetNamedStringARB") @GLreturn(value = "string", maxLength = "bufSize") void glGetNamedStringARB2(@Constant("name.length()") int namelen, CharSequence name, @GLsizei int bufSize, @OutParameter @Constant("string_length, 0") IntBuffer stringlen, @OutParameter @GLchar ByteBuffer string); @StripPostfix("params") void glGetNamedStringivARB(@AutoSize("name") int namelen, @Const @GLchar ByteBuffer name, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); @Alternate("glGetNamedStringivARB") @StripPostfix(value = "params", postfix = "v") void glGetNamedStringivARB(@Constant("name.length()") int namelen, CharSequence name, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); @Alternate("glGetNamedStringivARB") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetNamedStringivARB2(@Constant("name.length()") int namelen, CharSequence name, @GLenum int pname, @OutParameter IntBuffer params); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_packed_pixels.java0000644000175000017500000000350111543426511024076 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_packed_pixels { int GL_UNSIGNED_BYTE_3_3_2_EXT = 0x8032; int GL_UNSIGNED_SHORT_4_4_4_4_EXT = 0x8033; int GL_UNSIGNED_SHORT_5_5_5_1_EXT = 0x8034; int GL_UNSIGNED_INT_8_8_8_8_EXT = 0x8035; int GL_UNSIGNED_INT_10_10_10_2_EXT = 0x8036; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java0000644000175000017500000000524611543426511024055 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLvoid; import java.nio.IntBuffer; import com.sun.mirror.type.PrimitiveType; public interface ARB_draw_indirect { /** * Accepted by the <target> parameters of BindBuffer, BufferData, * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, * GetBufferPointerv, MapBufferRange, FlushMappedBufferRange, * GetBufferParameteriv, BindBufferRange, BindBufferBase, and * CopyBufferSubData: */ int GL_DRAW_INDIRECT_BUFFER = 0x8F3F; /** * Accepted by the <value> parameter of GetIntegerv, GetBooleanv, GetFloatv, * and GetDoublev: */ int GL_DRAW_INDIRECT_BUFFER_BINDING = 0x8F43; @Reuse("GL40") void glDrawArraysIndirect(@GLenum int mode, @BufferObject(BufferKind.IndirectBO) @Check("4") @NullTerminated @Const @GLvoid(PrimitiveType.Kind.INT) IntBuffer indirect); @Reuse("GL40") void glDrawElementsIndirect(@GLenum int mode, @GLenum int type, @BufferObject(BufferKind.IndirectBO) @Check("5") @NullTerminated @Const @GLvoid(PrimitiveType.Kind.INT) IntBuffer indirect); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_copy_depth_to_color.java0000644000175000017500000000327711543426511025216 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_copy_depth_to_color { int GL_DEPTH_STENCIL_TO_RGBA_NV = 0x886E; int GL_DEPTH_STENCIL_TO_BGRA_NV = 0x886F; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_paletted_texture.java0000644000175000017500000001003611543426511024646 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.*; public interface EXT_paletted_texture { /** * Accepted by the internalformat parameter of TexImage1D, TexImage2D and * TexImage3DEXT: */ int GL_COLOR_INDEX1_EXT = 0x80E2; int GL_COLOR_INDEX2_EXT = 0x80E3; int GL_COLOR_INDEX4_EXT = 0x80E4; int GL_COLOR_INDEX8_EXT = 0x80E5; int GL_COLOR_INDEX12_EXT = 0x80E6; int GL_COLOR_INDEX16_EXT = 0x80E7; /** * Accepted by the pname parameter of GetColorTableParameterivEXT and * GetColorTableParameterfvEXT: */ int GL_COLOR_TABLE_FORMAT_EXT = 0x80D8; int GL_COLOR_TABLE_WIDTH_EXT = 0x80D9; int GL_COLOR_TABLE_RED_SIZE_EXT = 0x80DA; int GL_COLOR_TABLE_GREEN_SIZE_EXT = 0x80DB; int GL_COLOR_TABLE_BLUE_SIZE_EXT = 0x80DC; int GL_COLOR_TABLE_ALPHA_SIZE_EXT = 0x80DD; int GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = 0x80DE; int GL_COLOR_TABLE_INTENSITY_SIZE_EXT = 0x80DF; /** * Accepted by the value parameter of GetTexLevelParameter{if}v: */ int GL_TEXTURE_INDEX_SIZE_EXT = 0x80ED; void glColorTableEXT(@GLenum int target, @GLenum int internalFormat, @GLsizei int width, @GLenum int format, @GLenum int type, @Check("GLChecks.calculateImageStorage(data, format, type, width, 1, 1)") @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer data); void glColorSubTableEXT(@GLenum int target, @GLsizei int start, @GLsizei int count, @GLenum int format, @GLenum int type, @Check("GLChecks.calculateImageStorage(data, format, type, count, 1, 1)") @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer data); void glGetColorTableEXT(@GLenum int target, @GLenum int format, @GLenum int type, @OutParameter @Check @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer data); @StripPostfix("params") void glGetColorTableParameterivEXT(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @StripPostfix("params") void glGetColorTableParameterfvEXT(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java0000644000175000017500000000567611543426511025225 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLchar; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.ByteBuffer; public interface ARB_blend_func_extended { /** * Accepted by the <src> and <dst> parameters of BlendFunc and * BlendFunci, and by the <srcRGB>, <dstRGB>, <srcAlpha> and <dstAlpha> * parameters of BlendFuncSeparate and BlendFuncSeparatei: */ int GL_SRC1_COLOR = 0x88F9; int GL_SRC1_ALPHA = GL15.GL_SRC1_ALPHA; int GL_ONE_MINUS_SRC1_COLOR = 0x88FA; int GL_ONE_MINUS_SRC1_ALPHA = 0x88FB; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv * and GetDoublev: */ int GL_MAX_DUAL_SOURCE_DRAW_BUFFERS = 0x88FC; @Reuse("GL33") void glBindFragDataLocationIndexed(@GLuint int program, @GLuint int colorNumber, @GLuint int index, @NullTerminated @Const @GLchar ByteBuffer name); @Reuse("GL33") @Alternate("glBindFragDataLocationIndexed") void glBindFragDataLocationIndexed(@GLuint int program, @GLuint int colorNumber, @GLuint int index, @NullTerminated CharSequence name); @Reuse("GL33") int glGetFragDataIndex(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name); @Reuse("GL33") @Alternate("glGetFragDataIndex") int glGetFragDataIndex(@GLuint int program, @NullTerminated CharSequence name); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_fog_coord.java0000644000175000017500000000513611543426511023232 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLdouble; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLfloat; import org.lwjgl.util.generator.opengl.GLsizei; import java.nio.*; public interface EXT_fog_coord { int GL_FOG_COORDINATE_SOURCE_EXT = 0x8450; int GL_FOG_COORDINATE_EXT = 0x8451; int GL_FRAGMENT_DEPTH_EXT = 0x8452; int GL_CURRENT_FOG_COORDINATE_EXT = 0x8453; int GL_FOG_COORDINATE_ARRAY_TYPE_EXT = 0x8454; int GL_FOG_COORDINATE_ARRAY_STRIDE_EXT = 0x8455; int GL_FOG_COORDINATE_ARRAY_POINTER_EXT = 0x8456; int GL_FOG_COORDINATE_ARRAY_EXT = 0x8457; void glFogCoordfEXT(float coord); void glFogCoorddEXT(double coord); void glFogCoordPointerEXT(@AutoType("data") @GLenum int type, @GLsizei int stride, @CachedReference @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLfloat @GLdouble Buffer data); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_geometry_shader4.java0000644000175000017500000000762511543426511024543 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLuint; public interface EXT_geometry_shader4 { /** * Accepted by the <type> parameter of CreateShader and returned by the * <params> parameter of GetShaderiv: */ int GL_GEOMETRY_SHADER_EXT = 0x8DD9; /** * Accepted by the <pname> parameter of ProgramParameteriEXT and * GetProgramiv: */ int GL_GEOMETRY_VERTICES_OUT_EXT = 0x8DDA; int GL_GEOMETRY_INPUT_TYPE_EXT = 0x8DDB; int GL_GEOMETRY_OUTPUT_TYPE_EXT = 0x8DDC; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT = 0x8C29; int GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT = 0x8DDD; int GL_MAX_VERTEX_VARYING_COMPONENTS_EXT = 0x8DDE; int GL_MAX_VARYING_COMPONENTS_EXT = 0x8B4B; int GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT = 0x8DDF; int GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT = 0x8DE0; int GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT = 0x8DE1; /** * Accepted by the <mode> parameter of Begin, DrawArrays, * MultiDrawArrays, DrawElements, MultiDrawElements, and * DrawRangeElements: */ int GL_LINES_ADJACENCY_EXT = 0xA; int GL_LINE_STRIP_ADJACENCY_EXT = 0xB; int GL_TRIANGLES_ADJACENCY_EXT = 0xC; int GL_TRIANGLE_STRIP_ADJACENCY_EXT = 0xD; /** Returned by CheckFramebufferStatusEXT: */ int GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT = 0x8DA8; int GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT = 0x8DA9; /** * Accepted by the <pname> parameter of GetFramebufferAttachment- * ParameterivEXT: */ int GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT = 0x8DA7; int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT = 0x8CD4; /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, * and by the <pname> parameter of GetIntegerv, GetFloatv, GetDoublev, * and GetBooleanv: */ int GL_PROGRAM_POINT_SIZE_EXT = 0x8642; void glProgramParameteriEXT(@GLuint int program, @GLenum int pname, int value); void glFramebufferTextureEXT(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level); void glFramebufferTextureLayerEXT(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, int layer); void glFramebufferTextureFaceEXT(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, @GLenum int face); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_sync.java0000644000175000017500000001047611543426511022214 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.PointerWrapper; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.IntBuffer; import java.nio.LongBuffer; @Extension(postfix = "") public interface ARB_sync { /** Accepted as the <pname> parameter of GetInteger64v: */ int GL_MAX_SERVER_WAIT_TIMEOUT = 0x9111; /** Accepted as the <pname> parameter of GetSynciv: */ int GL_OBJECT_TYPE = 0x9112; int GL_SYNC_CONDITION = 0x9113; int GL_SYNC_STATUS = 0x9114; int GL_SYNC_FLAGS = 0x9115; /** Returned in <values> for GetSynciv <pname> OBJECT_TYPE: */ int GL_SYNC_FENCE = 0x9116; /** Returned in <values> for GetSynciv <pname> SYNC_CONDITION: */ int GL_SYNC_GPU_COMMANDS_COMPLETE = 0x9117; /** Returned in <values> for GetSynciv <pname> SYNC_STATUS: */ int GL_UNSIGNALED = 0x9118; int GL_SIGNALED = 0x9119; /** Accepted in the <flags> parameter of ClientWaitSync: */ int GL_SYNC_FLUSH_COMMANDS_BIT = 0x00000001; /** Accepted in the <timeout> parameter of WaitSync: */ long GL_TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFFl; /** Returned by ClientWaitSync: */ int GL_ALREADY_SIGNALED = 0x911A; int GL_TIMEOUT_EXPIRED = 0x911B; int GL_CONDITION_SATISFIED = 0x911C; int GL_WAIT_FAILED = 0x911D; @Reuse("GL32") @PointerWrapper("GLsync") GLSync glFenceSync(@GLenum int condition, @GLbitfield int flags); @Reuse("GL32") boolean glIsSync(@PointerWrapper("GLsync") GLSync sync); @Reuse("GL32") void glDeleteSync(@PointerWrapper("GLsync") GLSync sync); @Reuse("GL32") @GLenum int glClientWaitSync(@PointerWrapper("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout); @Reuse("GL32") void glWaitSync(@PointerWrapper("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout); @Reuse("GL32") @StripPostfix("params") void glGetInteger64v(@GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer params); @Reuse("GL32") @Alternate("glGetInteger64v") @GLreturn("params") @StripPostfix("params") void glGetInteger64v2(@GLenum int pname, @OutParameter @GLint64 LongBuffer params); @Reuse("GL32") @StripPostfix("values") void glGetSynciv(@PointerWrapper("GLsync") GLSync sync, @GLenum int pname, @AutoSize("values") @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter IntBuffer values); @Reuse("GL32") @Alternate("glGetSynciv") @GLreturn("values") @StripPostfix("values") void glGetSynciv2(@PointerWrapper("GLsync") GLSync sync, @GLenum int pname, @Constant("1") @GLsizei int bufSize, @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, @OutParameter IntBuffer values); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_draw_range_elements.java0000644000175000017500000000426311543426511025276 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.*; public interface EXT_draw_range_elements { int GL_MAX_ELEMENTS_VERTICES_EXT = 0x80E8; int GL_MAX_ELEMENTS_INDICES_EXT = 0x80E9; void glDrawRangeElementsEXT(@GLenum int mode, @GLuint int start, @GLuint int end, @AutoSize("pIndices") @GLsizei int count, @AutoType("pIndices") @GLenum int type, @BufferObject(BufferKind.ElementVBO) @Const @GLubyte @GLushort @GLuint Buffer pIndices); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java0000644000175000017500000000612311543426511025052 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLreturn; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.IntBuffer; public interface NV_transform_feedback2 { /** Accepted by the <target> parameter of BindTransformFeedbackNV: */ int GL_TRANSFORM_FEEDBACK_NV = 0x8E22; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv, * and GetFloatv: */ int GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV = 0x8E23; int GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV = 0x8E24; int GL_TRANSFORM_FEEDBACK_BINDING_NV = 0x8E25; void glBindTransformFeedbackNV(@GLenum int target, @GLuint int id); void glDeleteTransformFeedbacksNV(@AutoSize("ids") @GLsizei int n, @Const @GLuint IntBuffer ids); @Alternate("glDeleteTransformFeedbacksNV") void glDeleteTransformFeedbacksNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, id), 0", keepParam = true) int id); void glGenTransformFeedbacksNV(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); @Alternate("glGenTransformFeedbacksNV") @GLreturn("ids") void glGenTransformFeedbacksNV2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); boolean glIsTransformFeedbackNV(@GLuint int id); void glPauseTransformFeedbackNV(); void glResumeTransformFeedbackNV(); void glDrawTransformFeedbackNV(@GLenum int mode, @GLuint int id); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java0000644000175000017500000001777311543426511025115 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLreturn; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.IntBuffer; public interface EXT_framebuffer_object { /** * Accepted by the <target> parameter of BindFramebufferEXT, * CheckFramebufferStatusEXT, FramebufferTexture{1D|2D|3D}EXT, and * FramebufferRenderbufferEXT: */ int GL_FRAMEBUFFER_EXT = 0x8D40; /** * Accepted by the <target> parameter of BindRenderbufferEXT, * RenderbufferStorageEXT, and GetRenderbufferParameterivEXT, and * returned by GetFramebufferAttachmentParameterivEXT: */ int GL_RENDERBUFFER_EXT = 0x8D41; /** * Accepted by the <internalformat> parameter of * RenderbufferStorageEXT: */ int GL_STENCIL_INDEX1_EXT = 0x8D46; int GL_STENCIL_INDEX4_EXT = 0x8D47; int GL_STENCIL_INDEX8_EXT = 0x8D48; int GL_STENCIL_INDEX16_EXT = 0x8D49; /** Accepted by the <pname> parameter of GetRenderbufferParameterivEXT: */ int GL_RENDERBUFFER_WIDTH_EXT = 0x8D42; int GL_RENDERBUFFER_HEIGHT_EXT = 0x8D43; int GL_RENDERBUFFER_INTERNAL_FORMAT_EXT = 0x8D44; int GL_RENDERBUFFER_RED_SIZE_EXT = 0x8D50; int GL_RENDERBUFFER_GREEN_SIZE_EXT = 0x8D51; int GL_RENDERBUFFER_BLUE_SIZE_EXT = 0x8D52; int GL_RENDERBUFFER_ALPHA_SIZE_EXT = 0x8D53; int GL_RENDERBUFFER_DEPTH_SIZE_EXT = 0x8D54; int GL_RENDERBUFFER_STENCIL_SIZE_EXT = 0x8D55; /** * Accepted by the <pname> parameter of * GetFramebufferAttachmentParameterivEXT: */ int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT = 0x8CD0; int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT = 0x8CD1; int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT = 0x8CD2; int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT = 0x8CD3; int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT = 0x8CD4; /** * Accepted by the <attachment> parameter of * FramebufferTexture{1D|2D|3D}EXT, FramebufferRenderbufferEXT, and * GetFramebufferAttachmentParameterivEXT */ int GL_COLOR_ATTACHMENT0_EXT = 0x8CE0; int GL_COLOR_ATTACHMENT1_EXT = 0x8CE1; int GL_COLOR_ATTACHMENT2_EXT = 0x8CE2; int GL_COLOR_ATTACHMENT3_EXT = 0x8CE3; int GL_COLOR_ATTACHMENT4_EXT = 0x8CE4; int GL_COLOR_ATTACHMENT5_EXT = 0x8CE5; int GL_COLOR_ATTACHMENT6_EXT = 0x8CE6; int GL_COLOR_ATTACHMENT7_EXT = 0x8CE7; int GL_COLOR_ATTACHMENT8_EXT = 0x8CE8; int GL_COLOR_ATTACHMENT9_EXT = 0x8CE9; int GL_COLOR_ATTACHMENT10_EXT = 0x8CEA; int GL_COLOR_ATTACHMENT11_EXT = 0x8CEB; int GL_COLOR_ATTACHMENT12_EXT = 0x8CEC; int GL_COLOR_ATTACHMENT13_EXT = 0x8CED; int GL_COLOR_ATTACHMENT14_EXT = 0x8CEE; int GL_COLOR_ATTACHMENT15_EXT = 0x8CEF; int GL_DEPTH_ATTACHMENT_EXT = 0x8D00; int GL_STENCIL_ATTACHMENT_EXT = 0x8D20; /** Returned by CheckFramebufferStatusEXT(): */ int GL_FRAMEBUFFER_COMPLETE_EXT = 0x8CD5; int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT = 0x8CD6; int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT = 0x8CD7; int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT = 0x8CD9; int GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT = 0x8CDA; int GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT = 0x8CDB; int GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT = 0x8CDC; int GL_FRAMEBUFFER_UNSUPPORTED_EXT = 0x8CDD; /** Accepted by GetIntegerv(): */ int GL_FRAMEBUFFER_BINDING_EXT = 0x8CA6; int GL_RENDERBUFFER_BINDING_EXT = 0x8CA7; int GL_MAX_COLOR_ATTACHMENTS_EXT = 0x8CDF; int GL_MAX_RENDERBUFFER_SIZE_EXT = 0x84E8; /** Returned by GetError(): */ int GL_INVALID_FRAMEBUFFER_OPERATION_EXT = 0x0506; boolean glIsRenderbufferEXT(@GLuint int renderbuffer); void glBindRenderbufferEXT(@GLenum int target, @GLuint int renderbuffer); void glDeleteRenderbuffersEXT(@AutoSize("renderbuffers") int n, @Const @GLuint IntBuffer renderbuffers); @Alternate("glDeleteRenderbuffersEXT") void glDeleteRenderbuffersEXT(@Constant("1") int n, @Constant(value = "APIUtil.getBufferInt().put(0, renderbuffer), 0", keepParam = true) int renderbuffer); void glGenRenderbuffersEXT(@AutoSize("renderbuffers") int n, @OutParameter @GLuint IntBuffer renderbuffers); @Alternate("glGenRenderbuffersEXT") @GLreturn("renderbuffers") void glGenRenderbuffersEXT2(@Constant("1") int n, @OutParameter @GLuint IntBuffer renderbuffers); void glRenderbufferStorageEXT(@GLenum int target, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); @StripPostfix("params") void glGetRenderbufferParameterivEXT(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetRenderbufferParameterivEXT") @GLreturn("params") @StripPostfix("params") void glGetRenderbufferParameterivEXT2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); boolean glIsFramebufferEXT(@GLuint int framebuffer); void glBindFramebufferEXT(@GLenum int target, @GLuint int framebuffer); void glDeleteFramebuffersEXT(@AutoSize("framebuffers") int n, @Const @GLuint IntBuffer framebuffers); @Alternate("glDeleteFramebuffersEXT") void glDeleteFramebuffersEXT(@Constant("1") int n, @Constant(value = "APIUtil.getBufferInt().put(0, framebuffer), 0", keepParam = true) int framebuffer); void glGenFramebuffersEXT(@AutoSize("framebuffers") int n, @OutParameter @GLuint IntBuffer framebuffers); @Alternate("glGenFramebuffersEXT") @GLreturn("framebuffers") void glGenFramebuffersEXT2(@Constant("1") int n, @OutParameter @GLuint IntBuffer framebuffers); @GLenum int glCheckFramebufferStatusEXT(@GLenum int target); void glFramebufferTexture1DEXT(@GLenum int target, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level); void glFramebufferTexture2DEXT(@GLenum int target, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level); void glFramebufferTexture3DEXT(@GLenum int target, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level, int zoffset); void glFramebufferRenderbufferEXT(@GLenum int target, @GLenum int attachment, @GLenum int renderbuffertarget, @GLuint int renderbuffer); @StripPostfix("params") void glGetFramebufferAttachmentParameterivEXT(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetFramebufferAttachmentParameterivEXT") @GLreturn("params") @StripPostfix("params") void glGetFramebufferAttachmentParameterivEXT2(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter IntBuffer params); void glGenerateMipmapEXT(@GLenum int target); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_buffer_object_rgb32.java0000644000175000017500000000330311543426511026605 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.Alias; @Alias("EXT_texture_buffer_object_rgb32") public interface ARB_texture_buffer_object_rgb32 { }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_filter_anisotropic.java0000644000175000017500000000331711543426511026747 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_texture_filter_anisotropic { int GL_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE; int GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_stencil_clear_tag.java0000644000175000017500000000422411543426511024730 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; public interface EXT_stencil_clear_tag { /** Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev. */ int GL_STENCIL_TAG_BITS_EXT = 0x88F2; int GL_STENCIL_CLEAR_TAG_VALUE_EXT = 0x88F3; /** Controls the stencil clear tag state. stencilTagBits is a count of the number of most-significant stencil buffer bits involved in the stencil clear tag update. */ void glStencilClearTagEXT(@GLsizei int stencilTagBits, @GLuint int stencilClearTag); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java0000644000175000017500000002074711543426511025600 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.ByteBuffer; import java.nio.IntBuffer; @Extension(postfix = "") public interface ARB_uniform_buffer_object { /** * Accepted by the <target> parameters of BindBuffer, BufferData, * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, and * GetBufferPointerv: */ int GL_UNIFORM_BUFFER = 0x8A11; /** * Accepted by the <pname> parameter of GetIntegeri_v, GetBooleanv, * GetIntegerv, GetFloatv, and GetDoublev: */ int GL_UNIFORM_BUFFER_BINDING = 0x8A28; /** Accepted by the <pname> parameter of GetIntegeri_v: */ int GL_UNIFORM_BUFFER_START = 0x8A29; int GL_UNIFORM_BUFFER_SIZE = 0x8A2A; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_MAX_VERTEX_UNIFORM_BLOCKS = 0x8A2B; int GL_MAX_GEOMETRY_UNIFORM_BLOCKS = 0x8A2C; int GL_MAX_FRAGMENT_UNIFORM_BLOCKS = 0x8A2D; int GL_MAX_COMBINED_UNIFORM_BLOCKS = 0x8A2E; int GL_MAX_UNIFORM_BUFFER_BINDINGS = 0x8A2F; int GL_MAX_UNIFORM_BLOCK_SIZE = 0x8A30; int GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 0x8A31; int GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS = 0x8A32; int GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 0x8A33; int GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT = 0x8A34; /** Accepted by the <pname> parameter of GetProgramiv: */ int GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 0x8A35; int GL_ACTIVE_UNIFORM_BLOCKS = 0x8A36; /** Accepted by the <pname> parameter of GetActiveUniformsivARB: */ int GL_UNIFORM_TYPE = 0x8A37; int GL_UNIFORM_SIZE = 0x8A38; int GL_UNIFORM_NAME_LENGTH = 0x8A39; int GL_UNIFORM_BLOCK_INDEX = 0x8A3A; int GL_UNIFORM_OFFSET = 0x8A3B; int GL_UNIFORM_ARRAY_STRIDE = 0x8A3C; int GL_UNIFORM_MATRIX_STRIDE = 0x8A3D; int GL_UNIFORM_IS_ROW_MAJOR = 0x8A3E; /** Accepted by the <pname> parameter of GetActiveUniformBlockivARB: */ int GL_UNIFORM_BLOCK_BINDING = 0x8A3F; int GL_UNIFORM_BLOCK_DATA_SIZE = 0x8A40; int GL_UNIFORM_BLOCK_NAME_LENGTH = 0x8A41; int GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS = 0x8A42; int GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8A43; int GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8A44; int GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER = 0x8A45; int GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8A46; /** Returned by GetActiveUniformsivARB and GetUniformBlockIndexARB */ int GL_INVALID_INDEX = 0xFFFFFFFF; @Reuse("GL31") void glGetUniformIndices(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount, @Const @NullTerminated("uniformIndices.remaining()") @GLchar @PointerArray("uniformCount") ByteBuffer uniformNames, @OutParameter @GLuint IntBuffer uniformIndices); @Reuse("GL31") @Alternate(value = "glGetUniformIndices") void glGetUniformIndices(@GLuint int program, @Constant("uniformNames.length") @GLsizei int uniformCount, @Const @NullTerminated @PointerArray("uniformCount") CharSequence[] uniformNames, @OutParameter @Check("uniformNames.length") @GLuint IntBuffer uniformIndices); @Reuse("GL31") @StripPostfix("params") void glGetActiveUniformsiv(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount, @Const @GLuint IntBuffer uniformIndices, @GLenum int pname, @OutParameter @Check("uniformIndices.remaining()") @GLint IntBuffer params); @Reuse("GL31") @Alternate("glGetActiveUniformsiv") @GLreturn("params") @StripPostfix("params") void glGetActiveUniformsiv(@GLuint int program, @Constant("1") @GLsizei int uniformCount, @Constant(value = "params.put(1, uniformIndex), 1", keepParam = true) int uniformIndex, // Reuse params buffer @GLenum int pname, @OutParameter @GLint IntBuffer params); @Reuse("GL31") void glGetActiveUniformName(@GLuint int program, @GLuint int uniformIndex, @AutoSize("uniformName") @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer uniformName); @Reuse("GL31") @Alternate("glGetActiveUniformName") @GLreturn(value = "uniformName", maxLength = "bufSize") void glGetActiveUniformName2(@GLuint int program, @GLuint int uniformIndex, @GLsizei int bufSize, @OutParameter @GLsizei @Constant("uniformName_length, 0") IntBuffer length, @OutParameter @GLchar ByteBuffer uniformName); @Reuse("GL31") @GLuint int glGetUniformBlockIndex(@GLuint int program, @Const @NullTerminated @GLchar ByteBuffer uniformBlockName); @Reuse("GL31") @Alternate("glGetUniformBlockIndex") @GLuint int glGetUniformBlockIndex(@GLuint int program, @NullTerminated CharSequence uniformBlockName); @Reuse("GL31") @StripPostfix("params") void glGetActiveUniformBlockiv(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname, @OutParameter @Check(value = "16") @GLint IntBuffer params); @Reuse("GL31") @Alternate("glGetActiveUniformBlockiv") @GLreturn("params") @StripPostfix("params") void glGetActiveUniformBlockiv2(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname, @OutParameter @GLint IntBuffer params); @Reuse("GL31") void glGetActiveUniformBlockName(@GLuint int program, @GLuint int uniformBlockIndex, @AutoSize("uniformBlockName") @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer uniformBlockName); @Reuse("GL31") @Alternate("glGetActiveUniformBlockName") @GLreturn(value = "uniformBlockName", maxLength = "bufSize") void glGetActiveUniformBlockName2(@GLuint int program, @GLuint int uniformBlockIndex, @GLsizei int bufSize, @OutParameter @GLsizei @Constant("uniformBlockName_length, 0") IntBuffer length, @OutParameter @GLchar ByteBuffer uniformBlockName); @Reuse("GL30") void glBindBufferRange(@GLenum int target, @GLuint int index, @GLuint int buffer, @GLintptr long offset, @GLsizeiptr long size); @Reuse("GL30") void glBindBufferBase(@GLenum int target, @GLuint int index, @GLuint int buffer); @Reuse("GL30") @StripPostfix(value = "data", extension = "") void glGetIntegeri_v(@GLenum int value, @GLuint int index, @OutParameter @Check("4") IntBuffer data); @Reuse("GL30") @Alternate("glGetIntegeri_v") @GLreturn("data") @StripPostfix("data") void glGetIntegeri_v2(@GLenum int value, @GLuint int index, @OutParameter IntBuffer data); @Reuse("GL31") void glUniformBlockBinding(@GLuint int program, @GLuint int uniformBlockIndex, @GLuint int uniformBlockBinding); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_vertex_program2.java0000644000175000017500000000314511543426511024300 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_vertex_program2 { } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_vertex_array_range.java0000644000175000017500000000503611543426511025042 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.*; public interface NV_vertex_array_range { int GL_VERTEX_ARRAY_RANGE_NV = 0x851D; int GL_VERTEX_ARRAY_RANGE_LENGTH_NV = 0x851E; int GL_VERTEX_ARRAY_RANGE_VALID_NV = 0x851F; int GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = 0x8520; int GL_VERTEX_ARRAY_RANGE_POINTER_NV = 0x8521; void glVertexArrayRangeNV(@AutoSize("pPointer") @GLsizei int size, @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pPointer); void glFlushVertexArrayRangeNV(); @PlatformDependent({Platform.WGL, Platform.GLX}) @GLvoid @AutoSize("size") ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority); @PlatformDependent({Platform.WGL, Platform.GLX}) void glFreeMemoryNV(@Check @GLbyte Buffer pointer); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_shader_buffer_load.java0000644000175000017500000001020611543426511024744 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.LongBuffer; public interface NV_shader_buffer_load { /** * Accepted by the <pname> parameter of GetBufferParameterui64vNV, * GetNamedBufferParameterui64vNV: */ int GL_BUFFER_GPU_ADDRESS_NV = 0x8F1D; /** Returned by the <type> parameter of GetActiveUniform: */ int GL_GPU_ADDRESS_NV = 0x8F34; /** Accepted by the <value> parameter of GetIntegerui64vNV: */ int GL_MAX_SHADER_BUFFER_ADDRESS_NV = 0x8F35; void glMakeBufferResidentNV(@GLenum int target, @GLenum int access); void glMakeBufferNonResidentNV(@GLenum int target); boolean glIsBufferResidentNV(@GLenum int target); void glMakeNamedBufferResidentNV(@GLuint int buffer, @GLenum int access); void glMakeNamedBufferNonResidentNV(@GLuint int buffer); boolean glIsNamedBufferResidentNV(@GLuint int buffer); @StripPostfix("params") void glGetBufferParameterui64vNV(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") @GLuint64EXT LongBuffer params); @Alternate("glGetBufferParameterui64vNV") @GLreturn("params") @StripPostfix("params") void glGetBufferParameterui64vNV2(@GLenum int target, @GLenum int pname, @OutParameter @GLuint64EXT LongBuffer params); @StripPostfix("params") void glGetNamedBufferParameterui64vNV(@GLuint int buffer, @GLenum int pname, @OutParameter @Check("1") @GLuint64EXT LongBuffer params); @Alternate("glGetNamedBufferParameterui64vNV") @GLreturn("params") @StripPostfix("params") void glGetNamedBufferParameterui64vNV2(@GLuint int buffer, @GLenum int pname, @OutParameter @GLuint64EXT LongBuffer params); @StripPostfix("result") void glGetIntegerui64vNV(@GLenum int value, @OutParameter @Check("1") @GLuint64EXT LongBuffer result); @Alternate("glGetIntegerui64vNV") @GLreturn("result") @StripPostfix("result") void glGetIntegerui64vNV2(@GLenum int value, @OutParameter @GLuint64EXT LongBuffer result); void glUniformui64NV(int location, @GLuint64EXT long value); @StripPostfix("value") void glUniformui64vNV(int location, @AutoSize("value") @GLsizei int count, @Const @GLuint64EXT LongBuffer value); @Reuse("NVGpuShader5") @StripPostfix("params") void glGetUniformui64vNV(@GLuint int program, int location, @OutParameter @Check("1") @GLuint64EXT LongBuffer params); void glProgramUniformui64NV(@GLuint int program, int location, @GLuint64EXT long value); @StripPostfix("value") void glProgramUniformui64vNV(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const @GLuint64EXT LongBuffer value); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_vertex_array_range2.java0000644000175000017500000000323711543426511025125 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_vertex_array_range2 { int GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV = 0x8533; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_occlusion_query2.java0000644000175000017500000000336111543426511024540 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_occlusion_query2 { /** * Accepted by the <target> parameter of BeginQuery, EndQuery, * and GetQueryiv: */ int GL_ANY_SAMPLES_PASSED = 0x8C2F; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_timer_query.java0000644000175000017500000000506311543426511023635 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.*; public interface EXT_timer_query { /** * Accepted by the <target> parameter of BeginQuery, EndQuery, and * GetQueryiv: */ int GL_TIME_ELAPSED_EXT = 0x88BF; @StripPostfix("params") void glGetQueryObjecti64vEXT(@GLuint int id, @GLenum int pname, @OutParameter @Check("1") @GLint64EXT LongBuffer params); @Alternate("glGetQueryObjecti64vEXT") @GLreturn("params") @StripPostfix("params") void glGetQueryObjecti64vEXT2(@GLuint int id, @GLenum int pname, @OutParameter @GLint64EXT LongBuffer params); @StripPostfix("params") void glGetQueryObjectui64vEXT(@GLuint int id, @GLenum int pname, @OutParameter @Check("1") @GLuint64EXT LongBuffer params); @Alternate("glGetQueryObjectui64vEXT") @GLreturn("params") @StripPostfix("params") void glGetQueryObjectui64vEXT2(@GLuint int id, @GLenum int pname, @OutParameter @GLuint64EXT LongBuffer params); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/GL11.java0000644000175000017500000013701111543426511021213 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.*; /** * The core OpenGL1.1 API. * * @author cix_foo * @version $Revision: 3460 $ * $Id: GL11.java 3460 2010-11-29 18:25:28Z spasi $ */ @DeprecatedGL public interface GL11 { /* AccumOp */ int GL_ACCUM = 0x0100; int GL_LOAD = 0x0101; int GL_RETURN = 0x0102; int GL_MULT = 0x0103; int GL_ADD = 0x0104; /* AlphaFunction */ int GL_NEVER = 0x0200; int GL_LESS = 0x0201; int GL_EQUAL = 0x0202; int GL_LEQUAL = 0x0203; int GL_GREATER = 0x0204; int GL_NOTEQUAL = 0x0205; int GL_GEQUAL = 0x0206; int GL_ALWAYS = 0x0207; /* AttribMask */ int GL_CURRENT_BIT = 0x00000001; int GL_POINT_BIT = 0x00000002; int GL_LINE_BIT = 0x00000004; int GL_POLYGON_BIT = 0x00000008; int GL_POLYGON_STIPPLE_BIT = 0x00000010; int GL_PIXEL_MODE_BIT = 0x00000020; int GL_LIGHTING_BIT = 0x00000040; int GL_FOG_BIT = 0x00000080; int GL_DEPTH_BUFFER_BIT = 0x00000100; int GL_ACCUM_BUFFER_BIT = 0x00000200; int GL_STENCIL_BUFFER_BIT = 0x00000400; int GL_VIEWPORT_BIT = 0x00000800; int GL_TRANSFORM_BIT = 0x00001000; int GL_ENABLE_BIT = 0x00002000; int GL_COLOR_BUFFER_BIT = 0x00004000; int GL_HINT_BIT = 0x00008000; int GL_EVAL_BIT = 0x00010000; int GL_LIST_BIT = 0x00020000; int GL_TEXTURE_BIT = 0x00040000; int GL_SCISSOR_BIT = 0x00080000; int GL_ALL_ATTRIB_BITS = 0x000fffff; /* BeginMode */ int GL_POINTS = 0x0000; int GL_LINES = 0x0001; int GL_LINE_LOOP = 0x0002; int GL_LINE_STRIP = 0x0003; int GL_TRIANGLES = 0x0004; int GL_TRIANGLE_STRIP = 0x0005; int GL_TRIANGLE_FAN = 0x0006; int GL_QUADS = 0x0007; int GL_QUAD_STRIP = 0x0008; int GL_POLYGON = 0x0009; /* BlendingFactorDest */ int GL_ZERO = 0; int GL_ONE = 1; int GL_SRC_COLOR = 0x0300; int GL_ONE_MINUS_SRC_COLOR = 0x0301; int GL_SRC_ALPHA = 0x0302; int GL_ONE_MINUS_SRC_ALPHA = 0x0303; int GL_DST_ALPHA = 0x0304; int GL_ONE_MINUS_DST_ALPHA = 0x0305; /* BlendingFactorSrc */ /* GL_ZERO */ /* GL_ONE */ int GL_DST_COLOR = 0x0306; int GL_ONE_MINUS_DST_COLOR = 0x0307; int GL_SRC_ALPHA_SATURATE = 0x0308; int GL_CONSTANT_COLOR = 0x8001; int GL_ONE_MINUS_CONSTANT_COLOR = 0x8002; int GL_CONSTANT_ALPHA = 0x8003; int GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004; /* Boolean */ int GL_TRUE = 1; int GL_FALSE = 0; /* ClipPlaneName */ int GL_CLIP_PLANE0 = 0x3000; int GL_CLIP_PLANE1 = 0x3001; int GL_CLIP_PLANE2 = 0x3002; int GL_CLIP_PLANE3 = 0x3003; int GL_CLIP_PLANE4 = 0x3004; int GL_CLIP_PLANE5 = 0x3005; /* DataType */ int GL_BYTE = 0x1400; int GL_UNSIGNED_BYTE = 0x1401; int GL_SHORT = 0x1402; int GL_UNSIGNED_SHORT = 0x1403; int GL_INT = 0x1404; int GL_UNSIGNED_INT = 0x1405; int GL_FLOAT = 0x1406; int GL_2_BYTES = 0x1407; int GL_3_BYTES = 0x1408; int GL_4_BYTES = 0x1409; int GL_DOUBLE = 0x140A; /* DrawBufferMode */ int GL_NONE = 0; int GL_FRONT_LEFT = 0x0400; int GL_FRONT_RIGHT = 0x0401; int GL_BACK_LEFT = 0x0402; int GL_BACK_RIGHT = 0x0403; int GL_FRONT = 0x0404; int GL_BACK = 0x0405; int GL_LEFT = 0x0406; int GL_RIGHT = 0x0407; int GL_FRONT_AND_BACK = 0x0408; int GL_AUX0 = 0x0409; int GL_AUX1 = 0x040A; int GL_AUX2 = 0x040B; int GL_AUX3 = 0x040C; /* ErrorCode */ int GL_NO_ERROR = 0; int GL_INVALID_ENUM = 0x0500; int GL_INVALID_VALUE = 0x0501; int GL_INVALID_OPERATION = 0x0502; int GL_STACK_OVERFLOW = 0x0503; int GL_STACK_UNDERFLOW = 0x0504; int GL_OUT_OF_MEMORY = 0x0505; /* FeedBackMode */ int GL_2D = 0x0600; int GL_3D = 0x0601; int GL_3D_COLOR = 0x0602; int GL_3D_COLOR_TEXTURE = 0x0603; int GL_4D_COLOR_TEXTURE = 0x0604; /* FeedBackToken */ int GL_PASS_THROUGH_TOKEN = 0x0700; int GL_POINT_TOKEN = 0x0701; int GL_LINE_TOKEN = 0x0702; int GL_POLYGON_TOKEN = 0x0703; int GL_BITMAP_TOKEN = 0x0704; int GL_DRAW_PIXEL_TOKEN = 0x0705; int GL_COPY_PIXEL_TOKEN = 0x0706; int GL_LINE_RESET_TOKEN = 0x0707; /* FogMode */ /* GL_LINEAR */ int GL_EXP = 0x0800; int GL_EXP2 = 0x0801; /* FrontFaceDirection */ int GL_CW = 0x0900; int GL_CCW = 0x0901; /* GetMapTarget */ int GL_COEFF = 0x0A00; int GL_ORDER = 0x0A01; int GL_DOMAIN = 0x0A02; /* GetTarget */ int GL_CURRENT_COLOR = 0x0B00; int GL_CURRENT_INDEX = 0x0B01; int GL_CURRENT_NORMAL = 0x0B02; int GL_CURRENT_TEXTURE_COORDS = 0x0B03; int GL_CURRENT_RASTER_COLOR = 0x0B04; int GL_CURRENT_RASTER_INDEX = 0x0B05; int GL_CURRENT_RASTER_TEXTURE_COORDS = 0x0B06; int GL_CURRENT_RASTER_POSITION = 0x0B07; int GL_CURRENT_RASTER_POSITION_VALID = 0x0B08; int GL_CURRENT_RASTER_DISTANCE = 0x0B09; int GL_POINT_SMOOTH = 0x0B10; int GL_POINT_SIZE = 0x0B11; int GL_POINT_SIZE_RANGE = 0x0B12; int GL_POINT_SIZE_GRANULARITY = 0x0B13; int GL_LINE_SMOOTH = 0x0B20; int GL_LINE_WIDTH = 0x0B21; int GL_LINE_WIDTH_RANGE = 0x0B22; int GL_LINE_WIDTH_GRANULARITY = 0x0B23; int GL_LINE_STIPPLE = 0x0B24; int GL_LINE_STIPPLE_PATTERN = 0x0B25; int GL_LINE_STIPPLE_REPEAT = 0x0B26; int GL_LIST_MODE = 0x0B30; int GL_MAX_LIST_NESTING = 0x0B31; int GL_LIST_BASE = 0x0B32; int GL_LIST_INDEX = 0x0B33; int GL_POLYGON_MODE = 0x0B40; int GL_POLYGON_SMOOTH = 0x0B41; int GL_POLYGON_STIPPLE = 0x0B42; int GL_EDGE_FLAG = 0x0B43; int GL_CULL_FACE = 0x0B44; int GL_CULL_FACE_MODE = 0x0B45; int GL_FRONT_FACE = 0x0B46; int GL_LIGHTING = 0x0B50; int GL_LIGHT_MODEL_LOCAL_VIEWER = 0x0B51; int GL_LIGHT_MODEL_TWO_SIDE = 0x0B52; int GL_LIGHT_MODEL_AMBIENT = 0x0B53; int GL_SHADE_MODEL = 0x0B54; int GL_COLOR_MATERIAL_FACE = 0x0B55; int GL_COLOR_MATERIAL_PARAMETER = 0x0B56; int GL_COLOR_MATERIAL = 0x0B57; int GL_FOG = 0x0B60; int GL_FOG_INDEX = 0x0B61; int GL_FOG_DENSITY = 0x0B62; int GL_FOG_START = 0x0B63; int GL_FOG_END = 0x0B64; int GL_FOG_MODE = 0x0B65; int GL_FOG_COLOR = 0x0B66; int GL_DEPTH_RANGE = 0x0B70; int GL_DEPTH_TEST = 0x0B71; int GL_DEPTH_WRITEMASK = 0x0B72; int GL_DEPTH_CLEAR_VALUE = 0x0B73; int GL_DEPTH_FUNC = 0x0B74; int GL_ACCUM_CLEAR_VALUE = 0x0B80; int GL_STENCIL_TEST = 0x0B90; int GL_STENCIL_CLEAR_VALUE = 0x0B91; int GL_STENCIL_FUNC = 0x0B92; int GL_STENCIL_VALUE_MASK = 0x0B93; int GL_STENCIL_FAIL = 0x0B94; int GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95; int GL_STENCIL_PASS_DEPTH_PASS = 0x0B96; int GL_STENCIL_REF = 0x0B97; int GL_STENCIL_WRITEMASK = 0x0B98; int GL_MATRIX_MODE = 0x0BA0; int GL_NORMALIZE = 0x0BA1; int GL_VIEWPORT = 0x0BA2; int GL_MODELVIEW_STACK_DEPTH = 0x0BA3; int GL_PROJECTION_STACK_DEPTH = 0x0BA4; int GL_TEXTURE_STACK_DEPTH = 0x0BA5; int GL_MODELVIEW_MATRIX = 0x0BA6; int GL_PROJECTION_MATRIX = 0x0BA7; int GL_TEXTURE_MATRIX = 0x0BA8; int GL_ATTRIB_STACK_DEPTH = 0x0BB0; int GL_CLIENT_ATTRIB_STACK_DEPTH = 0x0BB1; int GL_ALPHA_TEST = 0x0BC0; int GL_ALPHA_TEST_FUNC = 0x0BC1; int GL_ALPHA_TEST_REF = 0x0BC2; int GL_DITHER = 0x0BD0; int GL_BLEND_DST = 0x0BE0; int GL_BLEND_SRC = 0x0BE1; int GL_BLEND = 0x0BE2; int GL_LOGIC_OP_MODE = 0x0BF0; int GL_INDEX_LOGIC_OP = 0x0BF1; int GL_COLOR_LOGIC_OP = 0x0BF2; int GL_AUX_BUFFERS = 0x0C00; int GL_DRAW_BUFFER = 0x0C01; int GL_READ_BUFFER = 0x0C02; int GL_SCISSOR_BOX = 0x0C10; int GL_SCISSOR_TEST = 0x0C11; int GL_INDEX_CLEAR_VALUE = 0x0C20; int GL_INDEX_WRITEMASK = 0x0C21; int GL_COLOR_CLEAR_VALUE = 0x0C22; int GL_COLOR_WRITEMASK = 0x0C23; int GL_INDEX_MODE = 0x0C30; int GL_RGBA_MODE = 0x0C31; int GL_DOUBLEBUFFER = 0x0C32; int GL_STEREO = 0x0C33; int GL_RENDER_MODE = 0x0C40; int GL_PERSPECTIVE_CORRECTION_HINT = 0x0C50; int GL_POINT_SMOOTH_HINT = 0x0C51; int GL_LINE_SMOOTH_HINT = 0x0C52; int GL_POLYGON_SMOOTH_HINT = 0x0C53; int GL_FOG_HINT = 0x0C54; int GL_TEXTURE_GEN_S = 0x0C60; int GL_TEXTURE_GEN_T = 0x0C61; int GL_TEXTURE_GEN_R = 0x0C62; int GL_TEXTURE_GEN_Q = 0x0C63; int GL_PIXEL_MAP_I_TO_I = 0x0C70; int GL_PIXEL_MAP_S_TO_S = 0x0C71; int GL_PIXEL_MAP_I_TO_R = 0x0C72; int GL_PIXEL_MAP_I_TO_G = 0x0C73; int GL_PIXEL_MAP_I_TO_B = 0x0C74; int GL_PIXEL_MAP_I_TO_A = 0x0C75; int GL_PIXEL_MAP_R_TO_R = 0x0C76; int GL_PIXEL_MAP_G_TO_G = 0x0C77; int GL_PIXEL_MAP_B_TO_B = 0x0C78; int GL_PIXEL_MAP_A_TO_A = 0x0C79; int GL_PIXEL_MAP_I_TO_I_SIZE = 0x0CB0; int GL_PIXEL_MAP_S_TO_S_SIZE = 0x0CB1; int GL_PIXEL_MAP_I_TO_R_SIZE = 0x0CB2; int GL_PIXEL_MAP_I_TO_G_SIZE = 0x0CB3; int GL_PIXEL_MAP_I_TO_B_SIZE = 0x0CB4; int GL_PIXEL_MAP_I_TO_A_SIZE = 0x0CB5; int GL_PIXEL_MAP_R_TO_R_SIZE = 0x0CB6; int GL_PIXEL_MAP_G_TO_G_SIZE = 0x0CB7; int GL_PIXEL_MAP_B_TO_B_SIZE = 0x0CB8; int GL_PIXEL_MAP_A_TO_A_SIZE = 0x0CB9; int GL_UNPACK_SWAP_BYTES = 0x0CF0; int GL_UNPACK_LSB_FIRST = 0x0CF1; int GL_UNPACK_ROW_LENGTH = 0x0CF2; int GL_UNPACK_SKIP_ROWS = 0x0CF3; int GL_UNPACK_SKIP_PIXELS = 0x0CF4; int GL_UNPACK_ALIGNMENT = 0x0CF5; int GL_PACK_SWAP_BYTES = 0x0D00; int GL_PACK_LSB_FIRST = 0x0D01; int GL_PACK_ROW_LENGTH = 0x0D02; int GL_PACK_SKIP_ROWS = 0x0D03; int GL_PACK_SKIP_PIXELS = 0x0D04; int GL_PACK_ALIGNMENT = 0x0D05; int GL_MAP_COLOR = 0x0D10; int GL_MAP_STENCIL = 0x0D11; int GL_INDEX_SHIFT = 0x0D12; int GL_INDEX_OFFSET = 0x0D13; int GL_RED_SCALE = 0x0D14; int GL_RED_BIAS = 0x0D15; int GL_ZOOM_X = 0x0D16; int GL_ZOOM_Y = 0x0D17; int GL_GREEN_SCALE = 0x0D18; int GL_GREEN_BIAS = 0x0D19; int GL_BLUE_SCALE = 0x0D1A; int GL_BLUE_BIAS = 0x0D1B; int GL_ALPHA_SCALE = 0x0D1C; int GL_ALPHA_BIAS = 0x0D1D; int GL_DEPTH_SCALE = 0x0D1E; int GL_DEPTH_BIAS = 0x0D1F; int GL_MAX_EVAL_ORDER = 0x0D30; int GL_MAX_LIGHTS = 0x0D31; int GL_MAX_CLIP_PLANES = 0x0D32; int GL_MAX_TEXTURE_SIZE = 0x0D33; int GL_MAX_PIXEL_MAP_TABLE = 0x0D34; int GL_MAX_ATTRIB_STACK_DEPTH = 0x0D35; int GL_MAX_MODELVIEW_STACK_DEPTH = 0x0D36; int GL_MAX_NAME_STACK_DEPTH = 0x0D37; int GL_MAX_PROJECTION_STACK_DEPTH = 0x0D38; int GL_MAX_TEXTURE_STACK_DEPTH = 0x0D39; int GL_MAX_VIEWPORT_DIMS = 0x0D3A; int GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = 0x0D3B; int GL_SUBPIXEL_BITS = 0x0D50; int GL_INDEX_BITS = 0x0D51; int GL_RED_BITS = 0x0D52; int GL_GREEN_BITS = 0x0D53; int GL_BLUE_BITS = 0x0D54; int GL_ALPHA_BITS = 0x0D55; int GL_DEPTH_BITS = 0x0D56; int GL_STENCIL_BITS = 0x0D57; int GL_ACCUM_RED_BITS = 0x0D58; int GL_ACCUM_GREEN_BITS = 0x0D59; int GL_ACCUM_BLUE_BITS = 0x0D5A; int GL_ACCUM_ALPHA_BITS = 0x0D5B; int GL_NAME_STACK_DEPTH = 0x0D70; int GL_AUTO_NORMAL = 0x0D80; int GL_MAP1_COLOR_4 = 0x0D90; int GL_MAP1_INDEX = 0x0D91; int GL_MAP1_NORMAL = 0x0D92; int GL_MAP1_TEXTURE_COORD_1 = 0x0D93; int GL_MAP1_TEXTURE_COORD_2 = 0x0D94; int GL_MAP1_TEXTURE_COORD_3 = 0x0D95; int GL_MAP1_TEXTURE_COORD_4 = 0x0D96; int GL_MAP1_VERTEX_3 = 0x0D97; int GL_MAP1_VERTEX_4 = 0x0D98; int GL_MAP2_COLOR_4 = 0x0DB0; int GL_MAP2_INDEX = 0x0DB1; int GL_MAP2_NORMAL = 0x0DB2; int GL_MAP2_TEXTURE_COORD_1 = 0x0DB3; int GL_MAP2_TEXTURE_COORD_2 = 0x0DB4; int GL_MAP2_TEXTURE_COORD_3 = 0x0DB5; int GL_MAP2_TEXTURE_COORD_4 = 0x0DB6; int GL_MAP2_VERTEX_3 = 0x0DB7; int GL_MAP2_VERTEX_4 = 0x0DB8; int GL_MAP1_GRID_DOMAIN = 0x0DD0; int GL_MAP1_GRID_SEGMENTS = 0x0DD1; int GL_MAP2_GRID_DOMAIN = 0x0DD2; int GL_MAP2_GRID_SEGMENTS = 0x0DD3; int GL_TEXTURE_1D = 0x0DE0; int GL_TEXTURE_2D = 0x0DE1; int GL_FEEDBACK_BUFFER_POINTER = 0x0DF0; int GL_FEEDBACK_BUFFER_SIZE = 0x0DF1; int GL_FEEDBACK_BUFFER_TYPE = 0x0DF2; int GL_SELECTION_BUFFER_POINTER = 0x0DF3; int GL_SELECTION_BUFFER_SIZE = 0x0DF4; /* GetTextureParameter */ /* GL_TEXTURE_MAG_FILTER */ /* GL_TEXTURE_MIN_FILTER */ /* GL_TEXTURE_WRAP_S */ /* GL_TEXTURE_WRAP_T */ int GL_TEXTURE_WIDTH = 0x1000; int GL_TEXTURE_HEIGHT = 0x1001; int GL_TEXTURE_INTERNAL_FORMAT = 0x1003; int GL_TEXTURE_BORDER_COLOR = 0x1004; int GL_TEXTURE_BORDER = 0x1005; /* GL_TEXTURE_RED_SIZE */ /* GL_TEXTURE_GREEN_SIZE */ /* GL_TEXTURE_BLUE_SIZE */ /* GL_TEXTURE_ALPHA_SIZE */ /* GL_TEXTURE_LUMINANCE_SIZE */ /* GL_TEXTURE_INTENSITY_SIZE */ /* GL_TEXTURE_PRIORITY */ /* GL_TEXTURE_RESIDENT */ /* HintMode */ int GL_DONT_CARE = 0x1100; int GL_FASTEST = 0x1101; int GL_NICEST = 0x1102; /* LightName */ int GL_LIGHT0 = 0x4000; int GL_LIGHT1 = 0x4001; int GL_LIGHT2 = 0x4002; int GL_LIGHT3 = 0x4003; int GL_LIGHT4 = 0x4004; int GL_LIGHT5 = 0x4005; int GL_LIGHT6 = 0x4006; int GL_LIGHT7 = 0x4007; /* LightParameter */ int GL_AMBIENT = 0x1200; int GL_DIFFUSE = 0x1201; int GL_SPECULAR = 0x1202; int GL_POSITION = 0x1203; int GL_SPOT_DIRECTION = 0x1204; int GL_SPOT_EXPONENT = 0x1205; int GL_SPOT_CUTOFF = 0x1206; int GL_CONSTANT_ATTENUATION = 0x1207; int GL_LINEAR_ATTENUATION = 0x1208; int GL_QUADRATIC_ATTENUATION = 0x1209; /* ListMode */ int GL_COMPILE = 0x1300; int GL_COMPILE_AND_EXECUTE = 0x1301; /* LogicOp */ int GL_CLEAR = 0x1500; int GL_AND = 0x1501; int GL_AND_REVERSE = 0x1502; int GL_COPY = 0x1503; int GL_AND_INVERTED = 0x1504; int GL_NOOP = 0x1505; int GL_XOR = 0x1506; int GL_OR = 0x1507; int GL_NOR = 0x1508; int GL_EQUIV = 0x1509; int GL_INVERT = 0x150A; int GL_OR_REVERSE = 0x150B; int GL_COPY_INVERTED = 0x150C; int GL_OR_INVERTED = 0x150D; int GL_NAND = 0x150E; int GL_SET = 0x150F; /* MaterialParameter */ int GL_EMISSION = 0x1600; int GL_SHININESS = 0x1601; int GL_AMBIENT_AND_DIFFUSE = 0x1602; int GL_COLOR_INDEXES = 0x1603; /* GL_AMBIENT */ /* GL_DIFFUSE */ /* GL_SPECULAR */ /* MatrixMode */ int GL_MODELVIEW = 0x1700; int GL_PROJECTION = 0x1701; int GL_TEXTURE = 0x1702; /* PixelCopyType */ int GL_COLOR = 0x1800; int GL_DEPTH = 0x1801; int GL_STENCIL = 0x1802; /* PixelFormat */ int GL_COLOR_INDEX = 0x1900; int GL_STENCIL_INDEX = 0x1901; int GL_DEPTH_COMPONENT = 0x1902; int GL_RED = 0x1903; int GL_GREEN = 0x1904; int GL_BLUE = 0x1905; int GL_ALPHA = 0x1906; int GL_RGB = 0x1907; int GL_RGBA = 0x1908; int GL_LUMINANCE = 0x1909; int GL_LUMINANCE_ALPHA = 0x190A; /* PixelType */ int GL_BITMAP = 0x1A00; /* GL_BYTE */ /* GL_UNSIGNED_BYTE */ /* GL_SHORT */ /* GL_UNSIGNED_SHORT */ /* GL_INT */ /* GL_UNSIGNED_INT */ /* GL_FLOAT */ /* PolygonMode */ int GL_POINT = 0x1B00; int GL_LINE = 0x1B01; int GL_FILL = 0x1B02; /* RenderingMode */ int GL_RENDER = 0x1C00; int GL_FEEDBACK = 0x1C01; int GL_SELECT = 0x1C02; /* ShadingModel */ int GL_FLAT = 0x1D00; int GL_SMOOTH = 0x1D01; /* StencilOp */ /* GL_ZERO */ int GL_KEEP = 0x1E00; int GL_REPLACE = 0x1E01; int GL_INCR = 0x1E02; int GL_DECR = 0x1E03; /* GL_INVERT */ /* StringName */ int GL_VENDOR = 0x1F00; int GL_RENDERER = 0x1F01; int GL_VERSION = 0x1F02; int GL_EXTENSIONS = 0x1F03; /* TextureCoordName */ int GL_S = 0x2000; int GL_T = 0x2001; int GL_R = 0x2002; int GL_Q = 0x2003; /* TexCoordPointerType */ /* GL_SHORT */ /* GL_INT */ /* GL_FLOAT */ /* GL_DOUBLE */ /* TextureEnvMode */ int GL_MODULATE = 0x2100; int GL_DECAL = 0x2101; /* GL_BLEND */ /* GL_REPLACE */ /* TextureEnvParameter */ int GL_TEXTURE_ENV_MODE = 0x2200; int GL_TEXTURE_ENV_COLOR = 0x2201; /* TextureEnvTarget */ int GL_TEXTURE_ENV = 0x2300; /* TextureGenMode */ int GL_EYE_LINEAR = 0x2400; int GL_OBJECT_LINEAR = 0x2401; int GL_SPHERE_MAP = 0x2402; /* TextureGenParameter */ int GL_TEXTURE_GEN_MODE = 0x2500; int GL_OBJECT_PLANE = 0x2501; int GL_EYE_PLANE = 0x2502; /* TextureMagFilter */ int GL_NEAREST = 0x2600; int GL_LINEAR = 0x2601; /* TextureMinFilter */ /* GL_NEAREST */ /* GL_LINEAR */ int GL_NEAREST_MIPMAP_NEAREST = 0x2700; int GL_LINEAR_MIPMAP_NEAREST = 0x2701; int GL_NEAREST_MIPMAP_LINEAR = 0x2702; int GL_LINEAR_MIPMAP_LINEAR = 0x2703; /* TextureParameterName */ int GL_TEXTURE_MAG_FILTER = 0x2800; int GL_TEXTURE_MIN_FILTER = 0x2801; int GL_TEXTURE_WRAP_S = 0x2802; int GL_TEXTURE_WRAP_T = 0x2803; /* GL_TEXTURE_BORDER_COLOR */ /* GL_TEXTURE_PRIORITY */ /* TextureWrapMode */ int GL_CLAMP = 0x2900; int GL_REPEAT = 0x2901; /* ClientAttribMask */ int GL_CLIENT_PIXEL_STORE_BIT = 0x00000001; int GL_CLIENT_VERTEX_ARRAY_BIT = 0x00000002; int GL_ALL_CLIENT_ATTRIB_BITS = 0xffffffff; /* polygon_offset */ int GL_POLYGON_OFFSET_FACTOR = 0x8038; int GL_POLYGON_OFFSET_UNITS = 0x2A00; int GL_POLYGON_OFFSET_POINT = 0x2A01; int GL_POLYGON_OFFSET_LINE = 0x2A02; int GL_POLYGON_OFFSET_FILL = 0x8037; /* texture */ int GL_ALPHA4 = 0x803B; int GL_ALPHA8 = 0x803C; int GL_ALPHA12 = 0x803D; int GL_ALPHA16 = 0x803E; int GL_LUMINANCE4 = 0x803F; int GL_LUMINANCE8 = 0x8040; int GL_LUMINANCE12 = 0x8041; int GL_LUMINANCE16 = 0x8042; int GL_LUMINANCE4_ALPHA4 = 0x8043; int GL_LUMINANCE6_ALPHA2 = 0x8044; int GL_LUMINANCE8_ALPHA8 = 0x8045; int GL_LUMINANCE12_ALPHA4 = 0x8046; int GL_LUMINANCE12_ALPHA12 = 0x8047; int GL_LUMINANCE16_ALPHA16 = 0x8048; int GL_INTENSITY = 0x8049; int GL_INTENSITY4 = 0x804A; int GL_INTENSITY8 = 0x804B; int GL_INTENSITY12 = 0x804C; int GL_INTENSITY16 = 0x804D; int GL_R3_G3_B2 = 0x2A10; int GL_RGB4 = 0x804F; int GL_RGB5 = 0x8050; int GL_RGB8 = 0x8051; int GL_RGB10 = 0x8052; int GL_RGB12 = 0x8053; int GL_RGB16 = 0x8054; int GL_RGBA2 = 0x8055; int GL_RGBA4 = 0x8056; int GL_RGB5_A1 = 0x8057; int GL_RGBA8 = 0x8058; int GL_RGB10_A2 = 0x8059; int GL_RGBA12 = 0x805A; int GL_RGBA16 = 0x805B; int GL_TEXTURE_RED_SIZE = 0x805C; int GL_TEXTURE_GREEN_SIZE = 0x805D; int GL_TEXTURE_BLUE_SIZE = 0x805E; int GL_TEXTURE_ALPHA_SIZE = 0x805F; int GL_TEXTURE_LUMINANCE_SIZE = 0x8060; int GL_TEXTURE_INTENSITY_SIZE = 0x8061; int GL_PROXY_TEXTURE_1D = 0x8063; int GL_PROXY_TEXTURE_2D = 0x8064; /* texture_object */ int GL_TEXTURE_PRIORITY = 0x8066; int GL_TEXTURE_RESIDENT = 0x8067; int GL_TEXTURE_BINDING_1D = 0x8068; int GL_TEXTURE_BINDING_2D = 0x8069; /* vertex_array */ int GL_VERTEX_ARRAY = 0x8074; int GL_NORMAL_ARRAY = 0x8075; int GL_COLOR_ARRAY = 0x8076; int GL_INDEX_ARRAY = 0x8077; int GL_TEXTURE_COORD_ARRAY = 0x8078; int GL_EDGE_FLAG_ARRAY = 0x8079; int GL_VERTEX_ARRAY_SIZE = 0x807A; int GL_VERTEX_ARRAY_TYPE = 0x807B; int GL_VERTEX_ARRAY_STRIDE = 0x807C; int GL_NORMAL_ARRAY_TYPE = 0x807E; int GL_NORMAL_ARRAY_STRIDE = 0x807F; int GL_COLOR_ARRAY_SIZE = 0x8081; int GL_COLOR_ARRAY_TYPE = 0x8082; int GL_COLOR_ARRAY_STRIDE = 0x8083; int GL_INDEX_ARRAY_TYPE = 0x8085; int GL_INDEX_ARRAY_STRIDE = 0x8086; int GL_TEXTURE_COORD_ARRAY_SIZE = 0x8088; int GL_TEXTURE_COORD_ARRAY_TYPE = 0x8089; int GL_TEXTURE_COORD_ARRAY_STRIDE = 0x808A; int GL_EDGE_FLAG_ARRAY_STRIDE = 0x808C; int GL_VERTEX_ARRAY_POINTER = 0x808E; int GL_NORMAL_ARRAY_POINTER = 0x808F; int GL_COLOR_ARRAY_POINTER = 0x8090; int GL_INDEX_ARRAY_POINTER = 0x8091; int GL_TEXTURE_COORD_ARRAY_POINTER = 0x8092; int GL_EDGE_FLAG_ARRAY_POINTER = 0x8093; int GL_V2F = 0x2A20; int GL_V3F = 0x2A21; int GL_C4UB_V2F = 0x2A22; int GL_C4UB_V3F = 0x2A23; int GL_C3F_V3F = 0x2A24; int GL_N3F_V3F = 0x2A25; int GL_C4F_N3F_V3F = 0x2A26; int GL_T2F_V3F = 0x2A27; int GL_T4F_V4F = 0x2A28; int GL_T2F_C4UB_V3F = 0x2A29; int GL_T2F_C3F_V3F = 0x2A2A; int GL_T2F_N3F_V3F = 0x2A2B; int GL_T2F_C4F_N3F_V3F = 0x2A2C; int GL_T4F_C4F_N3F_V4F = 0x2A2D; /* For compatibility with OpenGL v1.0 */ int GL_LOGIC_OP = GL_INDEX_LOGIC_OP; int GL_TEXTURE_COMPONENTS = GL_TEXTURE_INTERNAL_FORMAT; @DeprecatedGL void glAccum(@GLenum int op, float value); @DeprecatedGL void glAlphaFunc(@GLenum int func, @GLclampf float ref); void glClearColor(@GLclampf float red, @GLclampf float green, @GLclampf float blue, @GLclampf float alpha); @DeprecatedGL void glClearAccum(float red, float green, float blue, float alpha); void glClear(@GLbitfield int mask); @DeprecatedGL void glCallLists(@AutoSize("lists") @GLsizei int n, @AutoType("lists") @GLenum int type, @Const @GLubyte @GLushort @GLuint Buffer lists); @DeprecatedGL void glCallList(@GLuint int list); void glBlendFunc(@GLenum int sfactor, @GLenum int dfactor); @DeprecatedGL void glBitmap(@GLsizei int width, @GLsizei int height, float xorig, float yorig, float xmove, float ymove, @BufferObject(BufferKind.UnpackPBO) @Check("(((width + 7)/8)*height)") @Const @GLubyte ByteBuffer bitmap); void glBindTexture(@GLenum int target, @GLuint int texture); @DeprecatedGL void glPrioritizeTextures(@AutoSize("textures") @GLsizei int n, @Const @GLuint IntBuffer textures, @Const @Check("textures.remaining()") @GLclampf FloatBuffer priorities); @DeprecatedGL boolean glAreTexturesResident(@AutoSize("textures") @GLsizei int n, @Const @GLuint IntBuffer textures, @Check("textures.remaining()") @GLboolean ByteBuffer residences); @NoErrorCheck @DeprecatedGL @Code("\t\tif ( ContextCapabilities.DEBUG ) StateTracker.setBeginEnd(caps, true);") void glBegin(@GLenum int mode); @DeprecatedGL @Code("\t\tif ( ContextCapabilities.DEBUG ) StateTracker.setBeginEnd(caps, false);") void glEnd(); @NoErrorCheck void glArrayElement(int i); void glClearDepth(@GLclampd double depth); @DeprecatedGL void glDeleteLists(@GLuint int list, @GLsizei int range); void glDeleteTextures(@AutoSize("textures") @GLsizei int n, @Const @GLuint IntBuffer textures); @Alternate("glDeleteTextures") void glDeleteTextures(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, texture), 0", keepParam = true) int texture); void glCullFace(@GLenum int mode); void glCopyTexSubImage2D(@GLenum int target, int level, int xoffset, int yoffset, int x, int y, @GLsizei int width, @GLsizei int height); void glCopyTexSubImage1D(@GLenum int target, int level, int xoffset, int x, int y, @GLsizei int width); void glCopyTexImage2D(@GLenum int target, int level, int internalFormat, int x, int y, @GLsizei int width, @GLsizei int height, int border); void glCopyTexImage1D(@GLenum int target, int level, int internalFormat, int x, int y, @GLsizei int width, int border); void glCopyPixels(int x, int y, int width, int height, int type); @DeprecatedGL void glColorPointer(int size, @AutoType("pointer") @GLenum int type, @GLsizei int stride, @CachedReference @Check @BufferObject(BufferKind.ArrayVBO) @Const @GLfloat @GLdouble @GLubyte @GLbyte Buffer pointer); @DeprecatedGL void glColorMaterial(@GLenum int face, @GLenum int mode); void glColorMask(boolean red, boolean green, boolean blue, boolean alpha); @NoErrorCheck @DeprecatedGL void glColor3b(byte red, byte green, byte blue); @NoErrorCheck @DeprecatedGL void glColor3f(float red, float green, float blue); @NoErrorCheck @DeprecatedGL void glColor3d(double red, double green, double blue); @NoErrorCheck @DeprecatedGL void glColor3ub(@GLubyte byte red, @GLubyte byte green, @GLubyte byte blue); @NoErrorCheck @DeprecatedGL void glColor4b(byte red, byte green, byte blue, byte alpha); @NoErrorCheck @DeprecatedGL void glColor4f(float red, float green, float blue, float alpha); @NoErrorCheck @DeprecatedGL void glColor4d(double red, double green, double blue, double alpha); @NoErrorCheck @DeprecatedGL void glColor4ub(@GLubyte byte red, @GLubyte byte green, @GLubyte byte blue, @GLubyte byte alpha); void glClipPlane(@GLenum int plane, @Check("4") @Const DoubleBuffer equation); void glClearStencil(int s); // This function is only used in indexed color mode // void glClearIndex(float c); @DeprecatedGL void glEvalPoint1(int i); @DeprecatedGL void glEvalPoint2(int i, int j); @DeprecatedGL void glEvalMesh1(@GLenum int mode, int i1, int i2); @DeprecatedGL void glEvalMesh2(@GLenum int mode, int i1, int i2, int j1, int j2); @DeprecatedGL void glEvalCoord1f(float u); @DeprecatedGL void glEvalCoord1d(double u); @DeprecatedGL void glEvalCoord2f(float u, float v); @DeprecatedGL void glEvalCoord2d(double u, double v); @DeprecatedGL void glEnableClientState(@GLenum int cap); @DeprecatedGL void glDisableClientState(@GLenum int cap); void glEnable(@GLenum int cap); void glDisable(@GLenum int cap); @DeprecatedGL void glEdgeFlagPointer(int stride, @CachedReference @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLbyte Buffer pointer); @DeprecatedGL void glEdgeFlag(boolean flag); @DeprecatedGL void glDrawPixels(@GLsizei int width, @GLsizei int height, @GLenum int format, @GLenum int type, @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, 1)") @BufferObject(BufferKind.UnpackPBO) @Const @GLbyte @GLshort @GLint Buffer pixels); void glDrawElements(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type, @BufferObject(BufferKind.ElementVBO) @Const @GLubyte @GLushort @GLuint Buffer indices); void glDrawBuffer(@GLenum int mode); void glDrawArrays(@GLenum int mode, int first, @GLsizei int count); void glDepthRange(@GLclampd double zNear, @GLclampd double zFar); void glDepthMask(boolean flag); void glDepthFunc(@GLenum int func); @DeprecatedGL void glFeedbackBuffer(@AutoSize("buffer") @GLsizei int size, @GLenum int type, FloatBuffer buffer); @StripPostfix("values") @DeprecatedGL void glGetPixelMapfv(@GLenum int map, @OutParameter @Check("256") @BufferObject(BufferKind.PackPBO) FloatBuffer values); @StripPostfix("values") @DeprecatedGL void glGetPixelMapuiv(@GLenum int map, @OutParameter @Check("256") @BufferObject(BufferKind.PackPBO) @GLuint IntBuffer values); @StripPostfix("values") @DeprecatedGL void glGetPixelMapusv(@GLenum int map, @OutParameter @Check("256") @BufferObject(BufferKind.PackPBO) @GLushort ShortBuffer values); @StripPostfix("params") @DeprecatedGL void glGetMaterialfv(@GLenum int face, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @StripPostfix("params") @DeprecatedGL void glGetMaterialiv(@GLenum int face, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @StripPostfix("v") @DeprecatedGL void glGetMapfv(@GLenum int target, @GLenum int query, @OutParameter @Check("256") FloatBuffer v); @StripPostfix("v") @DeprecatedGL void glGetMapdv(@GLenum int target, @GLenum int query, @OutParameter @Check("256") DoubleBuffer v); @StripPostfix("v") @DeprecatedGL void glGetMapiv(@GLenum int target, @GLenum int query, @OutParameter @Check("256") IntBuffer v); @StripPostfix("params") @DeprecatedGL void glGetLightfv(@GLenum int light, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @StripPostfix("params") @DeprecatedGL void glGetLightiv(@GLenum int light, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @NoErrorCheck int glGetError(); void glGetClipPlane(@GLenum int plane, @OutParameter @Check("4") DoubleBuffer equation); @StripPostfix("params") void glGetBooleanv(@GLenum int pname, @OutParameter @Check("16") @GLboolean ByteBuffer params); @Alternate("glGetBooleanv") @GLreturn("params") @StripPostfix("params") void glGetBooleanv2(@GLenum int pname, @OutParameter @GLboolean ByteBuffer params); @StripPostfix("params") void glGetDoublev(@GLenum int pname, @OutParameter @Check("16") DoubleBuffer params); @Alternate("glGetDoublev") @GLreturn("params") @StripPostfix("params") void glGetDoublev2(@GLenum int pname, @OutParameter DoubleBuffer params); @StripPostfix("params") void glGetFloatv(@GLenum int pname, @OutParameter @Check("16") FloatBuffer params); @Alternate("glGetFloatv") @GLreturn("params") @StripPostfix("params") void glGetFloatv2(@GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") void glGetIntegerv(@GLenum int pname, @OutParameter @Check("16") IntBuffer params); @Alternate("glGetIntegerv") @GLreturn("params") @StripPostfix("params") void glGetIntegerv2(@GLenum int pname, @OutParameter IntBuffer params); void glGenTextures(@AutoSize("textures") @GLsizei int n, @OutParameter @GLuint IntBuffer textures); @Alternate("glGenTextures") @GLreturn("textures") void glGenTextures2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer textures); @GLuint @DeprecatedGL int glGenLists(@GLsizei int range); @DeprecatedGL void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar); void glFrontFace(@GLenum int mode); @DeprecatedGL void glFogf(@GLenum int pname, float param); @DeprecatedGL void glFogi(@GLenum int pname, int param); @StripPostfix("params") @DeprecatedGL void glFogfv(@GLenum int pname, @Check("4") @Const FloatBuffer params); @StripPostfix("params") @DeprecatedGL void glFogiv(@GLenum int pname, @Check("4") @Const IntBuffer params); void glFlush(); void glFinish(); @StripPostfix("result") void glGetPointerv(@GLenum int pname, @Result @GLvoid ByteBuffer result); boolean glIsEnabled(@GLenum int cap); void glInterleavedArrays(@GLenum int format, @GLsizei int stride, @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pointer); @DeprecatedGL void glInitNames(); void glHint(@GLenum int target, @GLenum int mode); @StripPostfix("params") void glGetTexParameterfv(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @Alternate("glGetTexParameterfv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetTexParameterfv2(@GLenum int target, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") void glGetTexParameteriv(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetTexParameteriv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetTexParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") void glGetTexLevelParameterfv(@GLenum int target, int level, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @Alternate("glGetTexLevelParameterfv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetTexLevelParameterfv2(@GLenum int target, int level, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") void glGetTexLevelParameteriv(@GLenum int target, int level, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetTexLevelParameteriv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetTexLevelParameteriv2(@GLenum int target, int level, @GLenum int pname, @OutParameter IntBuffer params); void glGetTexImage(@GLenum int target, int level, @GLenum int format, @GLenum int type, @OutParameter @BufferObject(BufferKind.PackPBO) @Check("GLChecks.calculateImageStorage(pixels, format, type, 1, 1, 1)") @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); @StripPostfix("params") @DeprecatedGL void glGetTexGeniv(@GLenum int coord, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetTexGeniv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") @DeprecatedGL void glGetTexGeniv2(@GLenum int coord, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") @DeprecatedGL void glGetTexGenfv(@GLenum int coord, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @Alternate("glGetTexGenfv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") @DeprecatedGL void glGetTexGenfv2(@GLenum int coord, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") @DeprecatedGL void glGetTexGendv(@GLenum int coord, @GLenum int pname, @OutParameter @Check("4") DoubleBuffer params); @Alternate("glGetTexGendv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") @DeprecatedGL void glGetTexGendv2(@GLenum int coord, @GLenum int pname, @OutParameter DoubleBuffer params); @StripPostfix("params") void glGetTexEnviv(@GLenum int coord, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetTexEnviv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetTexEnviv2(@GLenum int coord, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") void glGetTexEnvfv(@GLenum int coord, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @Alternate("glGetTexEnvfv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetTexEnvfv2(@GLenum int coord, @GLenum int pname, @OutParameter FloatBuffer params); @Const String glGetString(int name); @DeprecatedGL void glGetPolygonStipple(@OutParameter @BufferObject(BufferKind.PackPBO) @Check("128") @GLubyte ByteBuffer mask); @DeprecatedGL boolean glIsList(@GLuint int list); @DeprecatedGL void glMaterialf(@GLenum int face, @GLenum int pname, float param); @DeprecatedGL void glMateriali(@GLenum int face, @GLenum int pname, int param); @StripPostfix("params") @DeprecatedGL void glMaterialfv(@GLenum int face, @GLenum int pname, @Check("4") @Const FloatBuffer params); @StripPostfix("params") @DeprecatedGL void glMaterialiv(@GLenum int face, @GLenum int pname, @Check("4") @Const IntBuffer params); @DeprecatedGL void glMapGrid1f(int un, float u1, float u2); @DeprecatedGL void glMapGrid1d(int un, double u1, double u2); @DeprecatedGL void glMapGrid2f(int un, float u1, float u2, int vn, float v1, float v2); @DeprecatedGL void glMapGrid2d(int un, double u1, double u2, int vn, double v1, double v2); // TODO: check buffer size valid @DeprecatedGL void glMap2f(@GLenum int target, float u1, float u2, int ustride, int uorder, float v1, float v2, int vstride, int vorder, @Check @Const FloatBuffer points); @DeprecatedGL void glMap2d(@GLenum int target, double u1, double u2, int ustride, int uorder, double v1, double v2, int vstride, int vorder, @Check @Const DoubleBuffer points); // TODO: check buffer size valid @DeprecatedGL void glMap1f(@GLenum int target, float u1, float u2, int stride, int order, @Check @Const FloatBuffer points); @DeprecatedGL void glMap1d(@GLenum int target, double u1, double u2, int stride, int order, @Check @Const DoubleBuffer points); void glLogicOp(@GLenum int opcode); @DeprecatedGL void glLoadName(@GLuint int name); @StripPostfix("m") @DeprecatedGL void glLoadMatrixf(@Check("16") @Const FloatBuffer m); @StripPostfix("m") @DeprecatedGL void glLoadMatrixd(@Check("16") @Const DoubleBuffer m); @DeprecatedGL void glLoadIdentity(); @DeprecatedGL void glListBase(@GLuint int base); void glLineWidth(float width); @DeprecatedGL void glLineStipple(int factor, @GLushort short pattern); @DeprecatedGL void glLightModelf(@GLenum int pname, float param); @DeprecatedGL void glLightModeli(@GLenum int pname, int param); @StripPostfix("params") @DeprecatedGL void glLightModelfv(@GLenum int pname, @Check("4") @Const FloatBuffer params); @StripPostfix("params") @DeprecatedGL void glLightModeliv(@GLenum int pname, @Check("4") @Const IntBuffer params); @DeprecatedGL void glLightf(@GLenum int light, @GLenum int pname, float param); @DeprecatedGL void glLighti(@GLenum int light, @GLenum int pname, int param); @StripPostfix("params") @DeprecatedGL void glLightfv(@GLenum int light, @GLenum int pname, @Check("4") @Const FloatBuffer params); @StripPostfix("params") @DeprecatedGL void glLightiv(@GLenum int light, @GLenum int pname, @Check("4") @Const IntBuffer params); boolean glIsTexture(@GLuint int texture); @DeprecatedGL void glMatrixMode(@GLenum int mode); @DeprecatedGL void glPolygonStipple(@BufferObject(BufferKind.UnpackPBO) @Check("128") @Const @GLubyte ByteBuffer mask); void glPolygonOffset(float factor, float units); void glPolygonMode(@GLenum int face, @GLenum int mode); void glPointSize(float size); @DeprecatedGL void glPixelZoom(float xfactor, float yfactor); @DeprecatedGL void glPixelTransferf(@GLenum int pname, float param); @DeprecatedGL void glPixelTransferi(@GLenum int pname, int param); void glPixelStoref(@GLenum int pname, float param); void glPixelStorei(@GLenum int pname, int param); @StripPostfix("values") @DeprecatedGL void glPixelMapfv(@GLenum int map, @AutoSize("values") @GLsizei int mapsize, @BufferObject(BufferKind.UnpackPBO) @Const FloatBuffer values); @StripPostfix("values") @DeprecatedGL void glPixelMapuiv(@GLenum int map, @AutoSize("values") @GLsizei int mapsize, @BufferObject(BufferKind.UnpackPBO) @Const @GLuint IntBuffer values); @StripPostfix("values") @DeprecatedGL void glPixelMapusv(@GLenum int map, @AutoSize("values") @GLsizei int mapsize, @BufferObject(BufferKind.UnpackPBO) @Const @GLushort ShortBuffer values); @DeprecatedGL void glPassThrough(float token); @DeprecatedGL void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar); @DeprecatedGL void glNormalPointer(@AutoType("pointer") @GLenum int type, @GLsizei int stride, @CachedReference @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLint @GLbyte @GLfloat @GLdouble Buffer pointer); @NoErrorCheck @DeprecatedGL void glNormal3b(byte nx, byte ny, byte nz); @NoErrorCheck @DeprecatedGL void glNormal3f(float nx, float ny, float nz); @NoErrorCheck @DeprecatedGL void glNormal3d(double nx, double ny, double nz); @NoErrorCheck @DeprecatedGL void glNormal3i(int nx, int ny, int nz); @DeprecatedGL void glNewList(@GLuint int list, @GLenum int mode); @DeprecatedGL void glEndList(); @StripPostfix("m") @DeprecatedGL void glMultMatrixf(@Check("16") @Const FloatBuffer m); @StripPostfix("m") @DeprecatedGL void glMultMatrixd(@Check("16") @Const DoubleBuffer m); void glShadeModel(@GLenum int mode); @DeprecatedGL void glSelectBuffer(@AutoSize("buffer") @GLsizei int size, @GLuint IntBuffer buffer); void glScissor(int x, int y, @GLsizei int width, @GLsizei int height); @DeprecatedGL void glScalef(float x, float y, float z); @DeprecatedGL void glScaled(double x, double y, double z); @DeprecatedGL void glRotatef(float angle, float x, float y, float z); @DeprecatedGL int glRenderMode(@GLenum int mode); @DeprecatedGL void glRectf(float x1, float y1, float x2, float y2); @DeprecatedGL void glRectd(double x1, double y1, double x2, double y2); @DeprecatedGL void glRecti(int x1, int y1, int x2, int y2); void glReadPixels(int x, int y, @GLsizei int width, @GLsizei int height, @GLenum int format, @GLenum int type, @OutParameter @BufferObject(BufferKind.PackPBO) @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, 1)") @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); void glReadBuffer(@GLenum int mode); @DeprecatedGL void glRasterPos2f(float x, float y); @DeprecatedGL void glRasterPos2d(double x, double y); @DeprecatedGL void glRasterPos2i(int x, int y); @DeprecatedGL void glRasterPos3f(float x, float y, float z); @DeprecatedGL void glRasterPos3d(double x, double y, double z); @DeprecatedGL void glRasterPos3i(int x, int y, int z); @DeprecatedGL void glRasterPos4f(float x, float y, float z, float w); @DeprecatedGL void glRasterPos4d(double x, double y, double z, double w); @DeprecatedGL void glRasterPos4i(int x, int y, int z, int w); @DeprecatedGL void glPushName(@GLuint int name); @DeprecatedGL void glPopName(); @DeprecatedGL void glPushMatrix(); @DeprecatedGL void glPopMatrix(); @Code(" StateTracker.pushAttrib(caps, mask);") @DeprecatedGL void glPushClientAttrib(@GLbitfield int mask); @Code(" StateTracker.popAttrib(caps);") @DeprecatedGL void glPopClientAttrib(); @DeprecatedGL void glPushAttrib(@GLbitfield int mask); @DeprecatedGL void glPopAttrib(); void glStencilFunc(@GLenum int func, int ref, @GLuint int mask); @DeprecatedGL void glVertexPointer(int size, @AutoType("pointer") @GLenum int type, @GLsizei int stride, @CachedReference @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLshort @GLint @GLfloat @GLdouble Buffer pointer); @NoErrorCheck @DeprecatedGL void glVertex2f(float x, float y); @NoErrorCheck @DeprecatedGL void glVertex2d(double x, double y); @NoErrorCheck @DeprecatedGL void glVertex2i(int x, int y); @NoErrorCheck @DeprecatedGL void glVertex3f(float x, float y, float z); @NoErrorCheck @DeprecatedGL void glVertex3d(double x, double y, double z); @NoErrorCheck @DeprecatedGL void glVertex3i(int x, int y, int z); @NoErrorCheck @DeprecatedGL void glVertex4f(float x, float y, float z, float w); @NoErrorCheck @DeprecatedGL void glVertex4d(double x, double y, double z, double w); @NoErrorCheck @DeprecatedGL void glVertex4i(int x, int y, int z, int w); @DeprecatedGL void glTranslatef(float x, float y, float z); @DeprecatedGL void glTranslated(double x, double y, double z); void glTexImage1D(@GLenum int target, int level, int internalformat, @GLsizei int width, int border, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check(value = "GLChecks.calculateTexImage1DStorage(pixels, format, type, width)", canBeNull = true) @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); void glTexImage2D(@GLenum int target, int level, int internalformat, int width, int height, int border, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check(value = "GLChecks.calculateTexImage2DStorage(pixels, format, type, width, height)", canBeNull = true) @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); void glTexSubImage1D(@GLenum int target, int level, int xoffset, @GLsizei int width, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check("GLChecks.calculateImageStorage(pixels, format, type, width, 1, 1)") @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); void glTexSubImage2D(@GLenum int target, int level, int xoffset, int yoffset, @GLsizei int width, @GLsizei int height, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, 1)") @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pixels); void glTexParameterf(@GLenum int target, @GLenum int pname, float param); void glTexParameteri(@GLenum int target, @GLenum int pname, int param); @StripPostfix("param") void glTexParameterfv(@GLenum int target, @GLenum int pname, @Check("4") @Const FloatBuffer param); @StripPostfix("param") void glTexParameteriv(@GLenum int target, @GLenum int pname, @Check("4") @Const IntBuffer param); @DeprecatedGL void glTexGenf(@GLenum int coord, @GLenum int pname, float param); @DeprecatedGL void glTexGend(@GLenum int coord, @GLenum int pname, double param); @StripPostfix("params") @DeprecatedGL void glTexGenfv(@GLenum int coord, @GLenum int pname, @Check("4") @Const FloatBuffer params); @StripPostfix("params") @DeprecatedGL void glTexGendv(@GLenum int coord, @GLenum int pname, @Check("4") @Const DoubleBuffer params); @DeprecatedGL void glTexGeni(@GLenum int coord, @GLenum int pname, int param); @StripPostfix("params") @DeprecatedGL void glTexGeniv(@GLenum int coord, @GLenum int pname, @Check("4") @Const IntBuffer params); void glTexEnvf(@GLenum int target, @GLenum int pname, float param); void glTexEnvi(@GLenum int target, @GLenum int pname, int param); @StripPostfix("params") void glTexEnvfv(@GLenum int target, @GLenum int pname, @Check("4") @Const FloatBuffer params); @StripPostfix("params") void glTexEnviv(@GLenum int target, @GLenum int pname, @Check("4") @Const IntBuffer params); @DeprecatedGL void glTexCoordPointer(int size, @AutoType("pointer") @GLenum int type, @GLsizei int stride, @CachedReference(index = "StateTracker.getReferences(caps).glClientActiveTexture", name = "glTexCoordPointer_buffer") @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLint @GLshort @GLfloat @GLdouble Buffer pointer); @NoErrorCheck @DeprecatedGL void glTexCoord1f(float s); @NoErrorCheck @DeprecatedGL void glTexCoord1d(double s); @NoErrorCheck @DeprecatedGL void glTexCoord2f(float s, float t); @NoErrorCheck @DeprecatedGL void glTexCoord2d(double s, double t); @NoErrorCheck @DeprecatedGL void glTexCoord3f(float s, float t, float r); @NoErrorCheck @DeprecatedGL void glTexCoord3d(double s, double t, double r); @NoErrorCheck @DeprecatedGL void glTexCoord4f(float s, float t, float r, float q); @NoErrorCheck @DeprecatedGL void glTexCoord4d(double s, double t, double r, double q); void glStencilOp(@GLenum int fail, @GLenum int zfail, @GLenum int zpass); void glStencilMask(@GLuint int mask); void glViewport(int x, int y, @GLsizei int width, @GLsizei int height); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java0000644000175000017500000000627711543426511025145 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLreturn; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.IntBuffer; public interface ARB_transform_feedback2 { /** Accepted by the <target> parameter of BindTransformFeedback: */ int GL_TRANSFORM_FEEDBACK = 0x8E22; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv, * and GetFloatv: */ int GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED = 0x8E23; int GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE = 0x8E24; int GL_TRANSFORM_FEEDBACK_BINDING = 0x8E25; @Reuse("GL40") void glBindTransformFeedback(@GLenum int target, @GLuint int id); @Reuse("GL40") void glDeleteTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @Const @GLuint IntBuffer ids); @Reuse("GL40") @Alternate("glDeleteTransformFeedbacks") void glDeleteTransformFeedbacks(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, id), 0", keepParam = true) int id); @Reuse("GL40") void glGenTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); @Reuse("GL40") @Alternate("glGenTransformFeedbacks") @GLreturn("ids") void glGenTransformFeedbacks2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); @Reuse("GL40") boolean glIsTransformFeedback(@GLuint int id); @Reuse("GL40") void glPauseTransformFeedback(); @Reuse("GL40") void glResumeTransformFeedback(); @Reuse("GL40") void glDrawTransformFeedback(@GLenum int mode, @GLuint int id); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_vertex_buffer_unified_memory.java0000644000175000017500000001066611543426511027121 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.LongBuffer; public interface NV_vertex_buffer_unified_memory { /** * Accepted by the <cap> parameter of DisableClientState, * EnableClientState, IsEnabled: */ int GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV = 0x8F1E; int GL_ELEMENT_ARRAY_UNIFIED_NV = 0x8F1F; /** * Accepted by the <pname> parameter of BufferAddressRangeNV * and the <value> parameter of GetIntegerui64i_vNV: */ int GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV = 0x8F20; int GL_TEXTURE_COORD_ARRAY_ADDRESS_NV = 0x8F25; /** * Accepted by the <pname> parameter of BufferAddressRangeNV * and the <value> parameter of GetIntegerui64vNV: */ int GL_VERTEX_ARRAY_ADDRESS_NV = 0x8F21; int GL_NORMAL_ARRAY_ADDRESS_NV = 0x8F22; int GL_COLOR_ARRAY_ADDRESS_NV = 0x8F23; int GL_INDEX_ARRAY_ADDRESS_NV = 0x8F24; int GL_EDGE_FLAG_ARRAY_ADDRESS_NV = 0x8F26; int GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV = 0x8F27; int GL_FOG_COORD_ARRAY_ADDRESS_NV = 0x8F28; int GL_ELEMENT_ARRAY_ADDRESS_NV = 0x8F29; /** Accepted by the <target> parameter of GetIntegeri_vNV: */ int GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV = 0x8F2A; int GL_TEXTURE_COORD_ARRAY_LENGTH_NV = 0x8F2F; /** Accepted by the <value> parameter of GetIntegerv: */ int GL_VERTEX_ARRAY_LENGTH_NV = 0x8F2B; int GL_NORMAL_ARRAY_LENGTH_NV = 0x8F2C; int GL_COLOR_ARRAY_LENGTH_NV = 0x8F2D; int GL_INDEX_ARRAY_LENGTH_NV = 0x8F2E; int GL_EDGE_FLAG_ARRAY_LENGTH_NV = 0x8F30; int GL_SECONDARY_COLOR_ARRAY_LENGTH_NV = 0x8F31; int GL_FOG_COORD_ARRAY_LENGTH_NV = 0x8F32; int GL_ELEMENT_ARRAY_LENGTH_NV = 0x8F33; void glBufferAddressRangeNV(@GLenum int pname, @GLuint int index, @GLuint64EXT long address, @GLsizeiptr long length); void glVertexFormatNV(int size, @GLenum int type, @GLsizei int stride); void glNormalFormatNV(@GLenum int type, @GLsizei int stride); void glColorFormatNV(int size, @GLenum int type, @GLsizei int stride); void glIndexFormatNV(@GLenum int type, @GLsizei int stride); void glTexCoordFormatNV(int size, @GLenum int type, @GLsizei int stride); void glEdgeFlagFormatNV(@GLsizei int stride); void glSecondaryColorFormatNV(int size, @GLenum int type, @GLsizei int stride); void glFogCoordFormatNV(@GLenum int type, @GLsizei int stride); void glVertexAttribFormatNV(@GLuint int index, int size, @GLenum int type, boolean normalized, @GLsizei int stride); void glVertexAttribIFormatNV(@GLuint int index, int size, @GLenum int type, @GLsizei int stride); @StripPostfix("result") void glGetIntegerui64i_vNV(@GLenum int value, @GLuint int index, @OutParameter @Check("1") @GLuint64EXT LongBuffer result); @Alternate("glGetIntegerui64i_vNV") @GLreturn("result") @StripPostfix("result") void glGetIntegerui64i_vNV2(@GLenum int value, @GLuint int index, @OutParameter @GLuint64EXT LongBuffer result); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_fog_distance.java0000644000175000017500000000332111543426511023573 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_fog_distance { int GL_FOG_DISTANCE_MODE_NV = 0x855A; int GL_EYE_RADIAL_NV = 0x855B; int GL_EYE_PLANE_ABSOLUTE_NV = 0x855C; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ATI_vertex_array_object.java0000644000175000017500000001010611543426511025300 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.*; public interface ATI_vertex_array_object { int GL_STATIC_ATI = 0x8760; int GL_DYNAMIC_ATI = 0x8761; int GL_PRESERVE_ATI = 0x8762; int GL_DISCARD_ATI = 0x8763; int GL_OBJECT_BUFFER_SIZE_ATI = 0x8764; int GL_OBJECT_BUFFER_USAGE_ATI = 0x8765; int GL_ARRAY_OBJECT_BUFFER_ATI = 0x8766; int GL_ARRAY_OBJECT_OFFSET_ATI = 0x8767; @GenerateAutos @GLuint int glNewObjectBufferATI(@AutoSize("pPointer") @GLsizei int size, @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pPointer, @GLenum int usage); boolean glIsObjectBufferATI(@GLuint int buffer); void glUpdateObjectBufferATI(@GLuint int buffer, @GLuint int offset, @AutoSize("pPointer") @GLsizei int size, @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer pPointer, @GLenum int preserve); @StripPostfix("params") void glGetObjectBufferfvATI(@GLuint int buffer, @GLenum int pname, @OutParameter @Check FloatBuffer params); @StripPostfix("params") void glGetObjectBufferivATI(@GLuint int buffer, @GLenum int pname, @OutParameter @Check IntBuffer params); @Alternate("glGetObjectBufferivATI") @GLreturn("params") @StripPostfix("params") void glGetObjectBufferivATI2(@GLuint int buffer, @GLenum int pname, @OutParameter IntBuffer params); void glFreeObjectBufferATI(@GLuint int buffer); void glArrayObjectATI(@GLenum int array, int size, @GLenum int type, @GLsizei int stride, @GLuint int buffer, @GLuint int offset); @StripPostfix("params") void glGetArrayObjectfvATI(@GLenum int array, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @StripPostfix("params") void glGetArrayObjectivATI(@GLenum int array, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); void glVariantArrayObjectATI(@GLuint int id, @GLenum int type, @GLsizei int stride, @GLuint int buffer, @GLuint int offset); @StripPostfix("params") void glGetVariantArrayObjectfvATI(@GLuint int id, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @StripPostfix("params") void glGetVariantArrayObjectivATI(@GLuint int id, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ATI_element_array.java0000644000175000017500000000436011543426511024073 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.*; public interface ATI_element_array { int GL_ELEMENT_ARRAY_ATI = 0x8768; int GL_ELEMENT_ARRAY_TYPE_ATI = 0x8769; int GL_ELEMENT_ARRAY_POINTER_ATI = 0x876A; void glElementPointerATI(@AutoType("pPointer") @GLenum int type, @Check @Const @GLubyte @GLushort @GLuint Buffer pPointer); void glDrawElementArrayATI(@GLenum int mode, @GLsizei int count); void glDrawRangeElementArrayATI(@GLenum int mode, @GLuint int start, @GLuint int end, @GLsizei int count); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_draw_buffers_blend.java0000644000175000017500000000407011543426511025046 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLuint; public interface ARB_draw_buffers_blend { void glBlendEquationiARB(@GLuint int buf, @GLenum int mode); void glBlendEquationSeparateiARB(@GLuint int buf, @GLenum int modeRGB, @GLenum int modeAlpha); void glBlendFunciARB(@GLuint int buf, @GLenum int src, @GLenum int dst); void glBlendFuncSeparateiARB(@GLuint int buf, @GLenum int srcRGB, @GLenum int dstRGB, @GLenum int srcAlpha, @GLenum int dstAlpha); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_texgen_reflection.java0000644000175000017500000000325311543426511024656 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_texgen_reflection { int GL_NORMAL_MAP_NV = 0x8511; int GL_REFLECTION_MAP_NV = 0x8512; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ATI_pn_triangles.java0000644000175000017500000000431311543426511023727 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; public interface ATI_pn_triangles { int GL_PN_TRIANGLES_ATI = 0x87F0; int GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI = 0x87F1; int GL_PN_TRIANGLES_POINT_MODE_ATI = 0x87F2; int GL_PN_TRIANGLES_NORMAL_MODE_ATI = 0x87F3; int GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI = 0x87F4; int GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI = 0x87F5; int GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI = 0x87F6; int GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI = 0x87F7; int GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI = 0x87F8; void glPNTrianglesfATI(@GLenum int pname, float param); void glPNTrianglesiATI(@GLenum int pname, int param); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_blend_minmax.java0000644000175000017500000000376611543426511023735 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; public interface EXT_blend_minmax { /** Accepted by the <mode> parameter of BlendEquationEXT. */ int GL_FUNC_ADD_EXT = 0x8006; int GL_MIN_EXT = 0x8007; int GL_MAX_EXT = 0x8008; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev. */ int GL_BLEND_EQUATION_EXT = 0x8009; void glBlendEquationEXT(@GLenum int mode); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/GL30.java0000644000175000017500000011762011543426511021220 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.*; public interface GL30 { // ---------------------------------------------------------- // ----------------------[ OpenGL 3.0 ]---------------------- // ---------------------------------------------------------- int GL_MAJOR_VERSION = 0x821B; int GL_MINOR_VERSION = 0x821C; int GL_NUM_EXTENSIONS = 0x821D; int GL_CONTEXT_FLAGS = 0x821E; int GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 0x0001; int GL_DEPTH_BUFFER = 0x8223; int GL_STENCIL_BUFFER = 0x8224; int GL_COMPRESSED_RED = 0x8225; int GL_COMPRESSED_RG = 0x8226; int GL_COMPARE_REF_TO_TEXTURE = ARB_shadow.GL_COMPARE_R_TO_TEXTURE_ARB; int GL_CLIP_DISTANCE0 = GL11.GL_CLIP_PLANE0; int GL_CLIP_DISTANCE1 = GL11.GL_CLIP_PLANE1; int GL_CLIP_DISTANCE2 = GL11.GL_CLIP_PLANE2; int GL_CLIP_DISTANCE3 = GL11.GL_CLIP_PLANE3; int GL_CLIP_DISTANCE4 = GL11.GL_CLIP_PLANE4; int GL_CLIP_DISTANCE5 = GL11.GL_CLIP_PLANE5; int GL_CLIP_DISTANCE6 = 0x3006; int GL_CLIP_DISTANCE7 = 0x3007; int GL_MAX_CLIP_DISTANCES = GL11.GL_MAX_CLIP_PLANES; int GL_MAX_VARYING_COMPONENTS = GL20.GL_MAX_VARYING_FLOATS; int GL_BUFFER_ACCESS_FLAGS = 0x911F; int GL_BUFFER_MAP_LENGTH = 0x9120; int GL_BUFFER_MAP_OFFSET = 0x9121; String glGetStringi(@GLenum int name, @GLuint int index); @StripPostfix("value") void glClearBufferfv(@GLenum int buffer, int drawbuffer, @Const @Check("4") FloatBuffer value); @StripPostfix("value") void glClearBufferiv(@GLenum int buffer, int drawbuffer, @Const @Check("4") IntBuffer value); @StripPostfix("value") void glClearBufferuiv(@GLenum int buffer, int drawbuffer, @Const @Check("4") IntBuffer value); void glClearBufferfi(@GLenum int buffer, int drawbuffer, float depth, int stencil); // --------------------------------------------------------------- // ----------------------[ EXT_gpu_shader4 ]---------------------- // --------------------------------------------------------------- /** * Accepted by the <pname> parameters of GetVertexAttribdv, * GetVertexAttribfv, GetVertexAttribiv, GetVertexAttribIiv, and * GetVertexAttribIuiv: */ int GL_VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD; /** Returned by the <type> parameter of GetActiveUniform: */ int GL_SAMPLER_BUFFER = 0x8DC2; int GL_SAMPLER_CUBE_SHADOW = 0x8DC5; int GL_UNSIGNED_INT_VEC2 = 0x8DC6; int GL_UNSIGNED_INT_VEC3 = 0x8DC7; int GL_UNSIGNED_INT_VEC4 = 0x8DC8; int GL_INT_SAMPLER_1D = 0x8DC9; int GL_INT_SAMPLER_2D = 0x8DCA; int GL_INT_SAMPLER_3D = 0x8DCB; int GL_INT_SAMPLER_CUBE = 0x8DCC; int GL_INT_SAMPLER_2D_RECT = 0x8DCD; int GL_INT_SAMPLER_1D_ARRAY = 0x8DCE; int GL_INT_SAMPLER_2D_ARRAY = 0x8DCF; int GL_INT_SAMPLER_BUFFER = 0x8DD0; int GL_UNSIGNED_INT_SAMPLER_1D = 0x8DD1; int GL_UNSIGNED_INT_SAMPLER_2D = 0x8DD2; int GL_UNSIGNED_INT_SAMPLER_3D = 0x8DD3; int GL_UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4; int GL_UNSIGNED_INT_SAMPLER_2D_RECT = 0x8DD5; int GL_UNSIGNED_INT_SAMPLER_1D_ARRAY = 0x8DD6; int GL_UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7; int GL_UNSIGNED_INT_SAMPLER_BUFFER = 0x8DD8; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_MIN_PROGRAM_TEXEL_OFFSET = 0x8904; int GL_MAX_PROGRAM_TEXEL_OFFSET = 0x8905; @NoErrorCheck void glVertexAttribI1i(@GLuint int index, int x); @NoErrorCheck void glVertexAttribI2i(@GLuint int index, int x, int y); @NoErrorCheck void glVertexAttribI3i(@GLuint int index, int x, int y, int z); @NoErrorCheck void glVertexAttribI4i(@GLuint int index, int x, int y, int z, int w); @NoErrorCheck void glVertexAttribI1ui(@GLuint int index, @GLuint int x); @NoErrorCheck void glVertexAttribI2ui(@GLuint int index, @GLuint int x, @GLuint int y); @NoErrorCheck void glVertexAttribI3ui(@GLuint int index, @GLuint int x, @GLuint int y, @GLuint int z); @NoErrorCheck void glVertexAttribI4ui(@GLuint int index, @GLuint int x, @GLuint int y, @GLuint int z, @GLuint int w); @NoErrorCheck @StripPostfix("v") void glVertexAttribI1iv(@GLuint int index, @Check("1") @Const IntBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI2iv(@GLuint int index, @Check("2") @Const IntBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI3iv(@GLuint int index, @Check("3") @Const IntBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI4iv(@GLuint int index, @Check("4") @Const IntBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI1uiv(@GLuint int index, @Check("1") @Const @GLuint IntBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI2uiv(@GLuint int index, @Check("2") @Const @GLuint IntBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI3uiv(@GLuint int index, @Check("3") @Const @GLuint IntBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI4uiv(@GLuint int index, @Check("4") @Const @GLuint IntBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI4bv(@GLuint int index, @Check("4") @Const ByteBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI4sv(@GLuint int index, @Check("4") @Const ShortBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI4ubv(@GLuint int index, @Check("4") @Const @GLubyte ByteBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI4usv(@GLuint int index, @Check("4") @Const @GLushort ShortBuffer v); void glVertexAttribIPointer(@GLuint int index, int size, @GLenum int type, @GLsizei int stride, @CachedReference @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLbyte @GLubyte @GLshort @GLushort @GLint @GLuint Buffer buffer); @StripPostfix("params") void glGetVertexAttribIiv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @StripPostfix("params") void glGetVertexAttribIuiv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") @GLuint IntBuffer params); void glUniform1ui(int location, @GLuint int v0); void glUniform2ui(int location, @GLuint int v0, @GLuint int v1); void glUniform3ui(int location, @GLuint int v0, @GLuint int v1, @GLuint int v2); void glUniform4ui(int location, @GLuint int v0, @GLuint int v1, @GLuint int v2, @GLuint int v3); @StripPostfix("value") void glUniform1uiv(int location, @AutoSize("value") @GLsizei int count, @Const @GLuint IntBuffer value); @StripPostfix("value") void glUniform2uiv(int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const @GLuint IntBuffer value); @StripPostfix("value") void glUniform3uiv(int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const @GLuint IntBuffer value); @StripPostfix("value") void glUniform4uiv(int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const @GLuint IntBuffer value); @StripPostfix("params") void glGetUniformuiv(@GLuint int program, int location, @OutParameter @Check @GLuint IntBuffer params); void glBindFragDataLocation(@GLuint int program, @GLuint int colorNumber, @NullTerminated @Const @GLchar ByteBuffer name); @Alternate("glBindFragDataLocation") void glBindFragDataLocation(@GLuint int program, @GLuint int colorNumber, @NullTerminated CharSequence name); int glGetFragDataLocation(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name); @Alternate("glGetFragDataLocation") int glGetFragDataLocation(@GLuint int program, @NullTerminated CharSequence name); // --------------------------------------------------------------------- // ----------------------[ NV_conditional_render ]---------------------- // --------------------------------------------------------------------- /** Accepted by the <mode> parameter of BeginConditionalRender: */ int GL_QUERY_WAIT = 0x8E13; int GL_QUERY_NO_WAIT = 0x8E14; int GL_QUERY_BY_REGION_WAIT = 0x8E15; int GL_QUERY_BY_REGION_NO_WAIT = 0x8E16; void glBeginConditionalRender(@GLuint int id, @GLenum int mode); void glEndConditionalRender(); // -------------------------------------------------------------------- // ----------------------[ ARB_map_buffer_range ]---------------------- // -------------------------------------------------------------------- /** Accepted by the <access> parameter of MapBufferRange: */ int GL_MAP_READ_BIT = 0x0001; int GL_MAP_WRITE_BIT = 0x0002; int GL_MAP_INVALIDATE_RANGE_BIT = 0x0004; int GL_MAP_INVALIDATE_BUFFER_BIT = 0x0008; int GL_MAP_FLUSH_EXPLICIT_BIT = 0x0010; int GL_MAP_UNSYNCHRONIZED_BIT = 0x0020; /** * glMapBufferRange maps a GL buffer object range to a ByteBuffer. The old_buffer argument can be null, * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null, * it will be returned if it points to the same mapped memory and has the same capacity as the buffer object, * otherwise a new ByteBuffer is created. That way, an application will normally use glMapBufferRange like this: *

      * ByteBuffer mapped_buffer; mapped_buffer = glMapBufferRange(..., ..., ..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapBufferRange(..., ..., ..., ..., mapped_buffer); *

      * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused. * * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created. * * @return A ByteBuffer representing the mapped buffer memory. */ @CachedResult(isRange = true) @GLvoid @AutoSize("length") ByteBuffer glMapBufferRange(@GLenum int target, @GLintptr long offset, @GLsizeiptr long length, @GLbitfield int access); void glFlushMappedBufferRange(@GLenum int target, @GLintptr long offset, @GLsizeiptr long length); // ---------------------------------------------------------------------- // ----------------------[ ARB_color_buffer_float ]---------------------- // ---------------------------------------------------------------------- /** * Accepted by the <target> parameter of ClampColor and the <pname> * parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev. */ int GL_CLAMP_VERTEX_COLOR = 0x891A; int GL_CLAMP_FRAGMENT_COLOR = 0x891B; int GL_CLAMP_READ_COLOR = 0x891C; /** Accepted by the <clamp> parameter of ClampColor. */ int GL_FIXED_ONLY = 0x891D; void glClampColor(@GLenum int target, @GLenum int clamp); // ---------------------------------------------------------------------- // ----------------------[ NV_depth_buffer_float ]---------------------- // ---------------------------------------------------------------------- /** * Accepted by the <internalformat> parameter of TexImage1D, TexImage2D, * TexImage3D, CopyTexImage1D, CopyTexImage2D, and RenderbufferStorageEXT, * and returned in the <data> parameter of GetTexLevelParameter and * GetRenderbufferParameterivEXT: */ int GL_DEPTH_COMPONENT32F = 0x8DAB; int GL_DEPTH32F_STENCIL8 = 0x8DAC; /** * Accepted by the <type> parameter of DrawPixels, ReadPixels, TexImage1D, * TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D, TexSubImage3D, and * GetTexImage: */ int GL_FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD; // ----------------------------------------------------------------- // ----------------------[ ARB_texture_float ]---------------------- // ----------------------------------------------------------------- /** Accepted by the <value> parameter of GetTexLevelParameter: */ int GL_TEXTURE_RED_TYPE = 0x8C10; int GL_TEXTURE_GREEN_TYPE = 0x8C11; int GL_TEXTURE_BLUE_TYPE = 0x8C12; int GL_TEXTURE_ALPHA_TYPE = 0x8C13; int GL_TEXTURE_LUMINANCE_TYPE = 0x8C14; int GL_TEXTURE_INTENSITY_TYPE = 0x8C15; int GL_TEXTURE_DEPTH_TYPE = 0x8C16; /** Returned by the <params> parameter of GetTexLevelParameter: */ int GL_UNSIGNED_NORMALIZED = 0x8C17; /** * Accepted by the <internalFormat> parameter of TexImage1D, * TexImage2D, and TexImage3D: */ int GL_RGBA32F = 0x8814; int GL_RGB32F = 0x8815; int GL_ALPHA32F = 0x8816; int GL_RGBA16F = 0x881A; int GL_RGB16F = 0x881B; int GL_ALPHA16F = 0x881C; // ---------------------------------------------------------------- // ----------------------[ EXT_packed_float ]---------------------- // ---------------------------------------------------------------- /** * Accepted by the <internalformat> parameter of TexImage1D, * TexImage2D, TexImage3D, CopyTexImage1D, CopyTexImage2D, and * RenderbufferStorage: */ int GL_R11F_G11F_B10F = 0x8C3A; /** * Accepted by the <type> parameter of DrawPixels, ReadPixels, * TexImage1D, TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, * TexSubImage2D, TexSubImage3D, GetHistogram, GetMinmax, * ConvolutionFilter1D, ConvolutionFilter2D, ConvolutionFilter3D, * GetConvolutionFilter, SeparableFilter2D, GetSeparableFilter, * ColorTable, ColorSubTable, and GetColorTable: */ int GL_UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B; // --------------------------------------------------------------------------- // ----------------------[ EXT_texture_shared_exponent ]---------------------- // --------------------------------------------------------------------------- /** * Accepted by the <internalformat> parameter of TexImage1D, * TexImage2D, TexImage3D, CopyTexImage1D, CopyTexImage2D, and * RenderbufferStorage: */ int GL_RGB9_E5 = 0x8C3D; /** * Accepted by the <type> parameter of DrawPixels, ReadPixels, * TexImage1D, TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, * TexSubImage2D, TexSubImage3D, GetHistogram, GetMinmax, * ConvolutionFilter1D, ConvolutionFilter2D, ConvolutionFilter3D, * GetConvolutionFilter, SeparableFilter2D, GetSeparableFilter, * ColorTable, ColorSubTable, and GetColorTable: */ int GL_UNSIGNED_INT_5_9_9_9_REV = 0x8C3E; /** * Accepted by the <pname> parameter of GetTexLevelParameterfv and * GetTexLevelParameteriv: */ int GL_TEXTURE_SHARED_SIZE = 0x8C3F; // ---------------------------------------------------------------------- // ----------------------[ ARB_framebuffer_object ]---------------------- // ---------------------------------------------------------------------- /** * Accepted by the <target> parameter of BindFramebuffer, * CheckFramebufferStatus, FramebufferTexture{1D|2D|3D}, * FramebufferRenderbuffer, and * GetFramebufferAttachmentParameteriv: */ int GL_FRAMEBUFFER = 0x8D40; int GL_READ_FRAMEBUFFER = 0x8CA8; int GL_DRAW_FRAMEBUFFER = 0x8CA9; /** * Accepted by the <target> parameter of BindRenderbuffer, * RenderbufferStorage, and GetRenderbufferParameteriv, and * returned by GetFramebufferAttachmentParameteriv: */ int GL_RENDERBUFFER = 0x8D41; /** * Accepted by the <internalformat> parameter of * RenderbufferStorage: */ int GL_STENCIL_INDEX1 = 0x8D46; int GL_STENCIL_INDEX4 = 0x8D47; int GL_STENCIL_INDEX8 = 0x8D48; int GL_STENCIL_INDEX16 = 0x8D49; /** Accepted by the <pname> parameter of GetRenderbufferParameteriv: */ int GL_RENDERBUFFER_WIDTH = 0x8D42; int GL_RENDERBUFFER_HEIGHT = 0x8D43; int GL_RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; int GL_RENDERBUFFER_RED_SIZE = 0x8D50; int GL_RENDERBUFFER_GREEN_SIZE = 0x8D51; int GL_RENDERBUFFER_BLUE_SIZE = 0x8D52; int GL_RENDERBUFFER_ALPHA_SIZE = 0x8D53; int GL_RENDERBUFFER_DEPTH_SIZE = 0x8D54; int GL_RENDERBUFFER_STENCIL_SIZE = 0x8D55; /** * Accepted by the <pname> parameter of * GetFramebufferAttachmentParameteriv: */ int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; int GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210; int GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211; int GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212; int GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213; int GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214; int GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215; int GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216; int GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217; /** Returned in <params> by GetFramebufferAttachmentParameteriv: */ int GL_FRAMEBUFFER_DEFAULT = 0x8218; int GL_INDEX = 0x8222; /** * Accepted by the <attachment> parameter of * FramebufferTexture{1D|2D|3D}, FramebufferRenderbuffer, and * GetFramebufferAttachmentParameteriv */ int GL_COLOR_ATTACHMENT0 = 0x8CE0; int GL_COLOR_ATTACHMENT1 = 0x8CE1; int GL_COLOR_ATTACHMENT2 = 0x8CE2; int GL_COLOR_ATTACHMENT3 = 0x8CE3; int GL_COLOR_ATTACHMENT4 = 0x8CE4; int GL_COLOR_ATTACHMENT5 = 0x8CE5; int GL_COLOR_ATTACHMENT6 = 0x8CE6; int GL_COLOR_ATTACHMENT7 = 0x8CE7; int GL_COLOR_ATTACHMENT8 = 0x8CE8; int GL_COLOR_ATTACHMENT9 = 0x8CE9; int GL_COLOR_ATTACHMENT10 = 0x8CEA; int GL_COLOR_ATTACHMENT11 = 0x8CEB; int GL_COLOR_ATTACHMENT12 = 0x8CEC; int GL_COLOR_ATTACHMENT13 = 0x8CED; int GL_COLOR_ATTACHMENT14 = 0x8CEE; int GL_COLOR_ATTACHMENT15 = 0x8CEF; int GL_DEPTH_ATTACHMENT = 0x8D00; int GL_STENCIL_ATTACHMENT = 0x8D20; int GL_DEPTH_STENCIL_ATTACHMENT = 0x821A; /** Returned by CheckFramebufferStatus(): */ int GL_FRAMEBUFFER_COMPLETE = 0x8CD5; int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; int GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 0x8CDB; int GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0x8CDC; int GL_FRAMEBUFFER_UNSUPPORTED = 0x8CDD; int GL_FRAMEBUFFER_UNDEFINED = 0x8219; /** * Accepted by the <pname> parameters of GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_FRAMEBUFFER_BINDING = 0x8CA6; // alias DRAW_FRAMEBUFFER_BINDING int GL_RENDERBUFFER_BINDING = 0x8CA7; int GL_MAX_COLOR_ATTACHMENTS = 0x8CDF; int GL_MAX_RENDERBUFFER_SIZE = 0x84E8; /** Returned by GetError(): */ int GL_INVALID_FRAMEBUFFER_OPERATION = 0x0506; boolean glIsRenderbuffer(@GLuint int renderbuffer); void glBindRenderbuffer(@GLenum int target, @GLuint int renderbuffer); void glDeleteRenderbuffers(@AutoSize("renderbuffers") int n, @Const @GLuint IntBuffer renderbuffers); @Alternate("glDeleteRenderbuffers") void glDeleteRenderbuffers(@Constant("1") int n, @Constant(value = "APIUtil.getBufferInt().put(0, renderbuffer), 0", keepParam = true) int renderbuffer); void glGenRenderbuffers(@AutoSize("renderbuffers") int n, @OutParameter @GLuint IntBuffer renderbuffers); @Alternate("glGenRenderbuffers") @GLreturn("renderbuffers") void glGenRenderbuffers2(@Constant("1") int n, @OutParameter @GLuint IntBuffer renderbuffers); void glRenderbufferStorage(@GLenum int target, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); @StripPostfix("params") void glGetRenderbufferParameteriv(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetRenderbufferParameteriv") @GLreturn("params") @StripPostfix("params") void glGetRenderbufferParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); boolean glIsFramebuffer(@GLuint int framebuffer); void glBindFramebuffer(@GLenum int target, @GLuint int framebuffer); void glDeleteFramebuffers(@AutoSize("framebuffers") int n, @Const @GLuint IntBuffer framebuffers); @Alternate("glDeleteFramebuffers") void glDeleteFramebuffers(@Constant("1") int n, @Constant(value = "APIUtil.getBufferInt().put(0, framebuffer), 0", keepParam = true) int framebuffer); void glGenFramebuffers(@AutoSize("framebuffers") int n, @OutParameter @GLuint IntBuffer framebuffers); @Alternate("glGenFramebuffers") @GLreturn("framebuffers") void glGenFramebuffers2(@Constant("1") int n, @OutParameter @GLuint IntBuffer framebuffers); @GLenum int glCheckFramebufferStatus(@GLenum int target); void glFramebufferTexture1D(@GLenum int target, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level); void glFramebufferTexture2D(@GLenum int target, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level); void glFramebufferTexture3D(@GLenum int target, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level, int zoffset); void glFramebufferRenderbuffer(@GLenum int target, @GLenum int attachment, @GLenum int renderbuffertarget, @GLuint int renderbuffer); @StripPostfix("params") void glGetFramebufferAttachmentParameteriv(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetFramebufferAttachmentParameteriv") @GLreturn("params") @StripPostfix("params") void glGetFramebufferAttachmentParameteriv2(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter IntBuffer params); void glGenerateMipmap(@GLenum int target); // -------------------------------------------------------------------------------------------- // ----------------------[ ARB_half_float_vertex & ARB_half_float_pixel ]---------------------- // -------------------------------------------------------------------------------------------- /** * Accepted by the <type> parameter of DrawPixels, ReadPixels, * TexImage1D, TexImage2D, TexImage3D, GetTexImage, TexSubImage1D, * TexSubImage2D, TexSubImage3D, GetHistogram, GetMinmax, * ConvolutionFilter1D, ConvolutionFilter2D, GetConvolutionFilter, * SeparableFilter2D, GetSeparableFilter, ColorTable, ColorSubTable, * and GetColorTable: *

      * Accepted by the <type> argument of VertexPointer, NormalPointer, * ColorPointer, SecondaryColorPointer, FogCoordPointer, TexCoordPointer, * and VertexAttribPointer: */ int GL_HALF_FLOAT = 0x140B; // --------------------------------------------------------------------------- // ----------------------[ EXT_framebuffer_multisample ]---------------------- // --------------------------------------------------------------------------- /** Accepted by the <pname> parameter of GetRenderbufferParameteriv. */ int GL_RENDERBUFFER_SAMPLES = 0x8CAB; /** Returned by CheckFramebufferStatus. */ int GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev. */ int GL_MAX_SAMPLES = 0x8D57; /** * Establishes the data storage, format, dimensions, and number of * samples of a renderbuffer object's image. */ void glRenderbufferStorageMultisample( @GLenum int target, @GLsizei int samples, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); // -------------------------------------------------------------------- // ----------------------[ EXT_framebuffer_blit ]---------------------- // -------------------------------------------------------------------- /** Accepted by the <pname> parameters of GetIntegerv, GetFloatv, and GetDoublev. */ int GL_DRAW_FRAMEBUFFER_BINDING = 0x8CA6; // alias FRAMEBUFFER_BINDING int GL_READ_FRAMEBUFFER_BINDING = 0x8CAA; /** * Transfers a rectangle of pixel values from one * region of the read framebuffer to another in the draw framebuffer. * <mask> is the bitwise OR of a number of values indicating which * buffers are to be copied. The values are COLOR_BUFFER_BIT, * DEPTH_BUFFER_BIT, and STENCIL_BUFFER_BIT. * The pixels corresponding to these buffers are * copied from the source rectangle, bound by the locations (srcX0, * srcY0) and (srcX1, srcY1) inclusive, to the destination rectangle, * bound by the locations (dstX0, dstY0) and (dstX1, dstY1) * inclusive. * If the source and destination rectangle dimensions do not match, * the source image is stretched to fit the destination * rectangle. <filter> must be LINEAR or NEAREST and specifies the * method of interpolation to be applied if the image is * stretched. */ void glBlitFramebuffer( @GLint int srcX0, @GLint int srcY0, @GLint int srcX1, @GLint int srcY1, @GLint int dstX0, @GLint int dstY0, @GLint int dstX1, @GLint int dstY1, @GLbitfield int mask, @GLenum int filter); // ------------------------------------------------------------------- // ----------------------[ EXT_texture_integer ]---------------------- // ------------------------------------------------------------------- /** * Accepted by the <pname> parameters of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_RGBA_INTEGER_MODE = 0x8D9E; /** * Accepted by the <internalFormat> parameter of TexImage1D, * TexImage2D, and TexImage3D: */ int GL_RGBA32UI = 0x8D70; int GL_RGB32UI = 0x8D71; int GL_ALPHA32UI = 0x8D72; int GL_RGBA16UI = 0x8D76; int GL_RGB16UI = 0x8D77; int GL_ALPHA16UI = 0x8D78; int GL_RGBA8UI = 0x8D7C; int GL_RGB8UI = 0x8D7D; int GL_ALPHA8UI = 0x8D7E; int GL_RGBA32I = 0x8D82; int GL_RGB32I = 0x8D83; int GL_ALPHA32I = 0x8D84; int GL_RGBA16I = 0x8D88; int GL_RGB16I = 0x8D89; int GL_ALPHA16I = 0x8D8A; int GL_RGBA8I = 0x8D8E; int GL_RGB8I = 0x8D8F; int GL_ALPHA8I = 0x8D90; /** * Accepted by the <format> parameter of TexImage1D, TexImage2D, * TexImage3D, TexSubImage1D, TexSubImage2D, TexSubImage3D, * DrawPixels and ReadPixels: */ int GL_RED_INTEGER = 0x8D94; int GL_GREEN_INTEGER = 0x8D95; int GL_BLUE_INTEGER = 0x8D96; int GL_ALPHA_INTEGER = 0x8D97; int GL_RGB_INTEGER = 0x8D98; int GL_RGBA_INTEGER = 0x8D99; int GL_BGR_INTEGER = 0x8D9A; int GL_BGRA_INTEGER = 0x8D9B; @StripPostfix("params") void glTexParameterIiv(@GLenum int target, @GLenum int pname, @Check("4") IntBuffer params); @Alternate("glTexParameterIiv") @StripPostfix(value = "param", postfix = "v") void glTexParameterIiv(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param); @StripPostfix("params") void glTexParameterIuiv(@GLenum int target, @GLenum int pname, @Check("4") @GLuint IntBuffer params); @Alternate("glTexParameterIuiv") @StripPostfix(value = "param", postfix = "v") void glTexParameterIuiv(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param); @StripPostfix("params") void glGetTexParameterIiv(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetTexParameterIiv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetTexParameterIiv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") void glGetTexParameterIuiv(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") @GLuint IntBuffer params); @Alternate("glGetTexParameterIuiv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetTexParameterIuiv2(@GLenum int target, @GLenum int pname, @OutParameter @GLuint IntBuffer params); // ----------------------------------------------------------------- // ----------------------[ EXT_texture_array ]---------------------- // ----------------------------------------------------------------- /** * Accepted by the <target> parameter of TexParameteri, TexParameteriv, * TexParameterf, TexParameterfv, and BindTexture: */ int GL_TEXTURE_1D_ARRAY = 0x8C18; int GL_TEXTURE_2D_ARRAY = 0x8C1A; /** * Accepted by the <target> parameter of TexImage3D, TexSubImage3D, * CopyTexSubImage3D, CompressedTexImage3D, and CompressedTexSubImage3D: */ int GL_PROXY_TEXTURE_2D_ARRAY = 0x8C1B; /** * Accepted by the <target> parameter of TexImage2D, TexSubImage2D, * CopyTexImage2D, CopyTexSubImage2D, CompressedTexImage2D, and * CompressedTexSubImage2D: */ int GL_PROXY_TEXTURE_1D_ARRAY = 0x8C19; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv * and GetFloatv: */ int GL_TEXTURE_BINDING_1D_ARRAY = 0x8C1C; int GL_TEXTURE_BINDING_2D_ARRAY = 0x8C1D; int GL_MAX_ARRAY_TEXTURE_LAYERS = 0x88FF; /** * Accepted by the <param> parameter of TexParameterf, TexParameteri, * TexParameterfv, and TexParameteriv when the <pname> parameter is * TEXTURE_COMPARE_MODE_ARB: */ int GL_COMPARE_REF_DEPTH_TO_TEXTURE = 0x884E; /** * Accepted by the <pname> parameter of * GetFramebufferAttachmentParameteriv: */ int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4; /** Returned by the <type> parameter of GetActiveUniform: */ int GL_SAMPLER_1D_ARRAY = 0x8DC0; int GL_SAMPLER_2D_ARRAY = 0x8DC1; int GL_SAMPLER_1D_ARRAY_SHADOW = 0x8DC3; int GL_SAMPLER_2D_ARRAY_SHADOW = 0x8DC4; void glFramebufferTextureLayer(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, int layer); // ------------------------------------------------------------------------ // ----------------------[ EXT_packed_depth_stencil ]---------------------- // ------------------------------------------------------------------------ /** * Accepted by the <format> parameter of DrawPixels, ReadPixels, * TexImage1D, TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D, * TexSubImage3D, and GetTexImage, by the <type> parameter of * CopyPixels, by the <internalformat> parameter of TexImage1D, * TexImage2D, TexImage3D, CopyTexImage1D, CopyTexImage2D, and * RenderbufferStorage, and returned in the <data> parameter of * GetTexLevelParameter and GetRenderbufferParameteriv. */ int GL_DEPTH_STENCIL = 0x84F9; /** * Accepted by the <type> parameter of DrawPixels, ReadPixels, * TexImage1D, TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D, * TexSubImage3D, and GetTexImage. */ int GL_UNSIGNED_INT_24_8 = 0x84FA; /** * Accepted by the <internalformat> parameter of TexImage1D, * TexImage2D, TexImage3D, CopyTexImage1D, CopyTexImage2D, and * RenderbufferStorage, and returned in the <data> parameter of * GetTexLevelParameter and GetRenderbufferParameteriv. */ int GL_DEPTH24_STENCIL8 = 0x88F0; /** Accepted by the <value> parameter of GetTexLevelParameter. */ int GL_TEXTURE_STENCIL_SIZE = 0x88F1; // ----------------------------------------------------------------- // ----------------------[ EXT_draw_buffers2 ]---------------------- // ----------------------------------------------------------------- void glColorMaski(@GLuint int buf, boolean r, boolean g, boolean b, boolean a); @StripPostfix(value = "data", hasPostfix = false) void glGetBooleani_v(@GLenum int value, @GLuint int index, @OutParameter @Check("4") @GLboolean ByteBuffer data); @Alternate("glGetBooleani_v") @GLreturn("data") @StripPostfix(value = "data", hasPostfix = false) void glGetBooleani_v2(@GLenum int value, @GLuint int index, @OutParameter @GLboolean ByteBuffer data); @StripPostfix("data") void glGetIntegeri_v(@GLenum int value, @GLuint int index, @OutParameter @Check("4") IntBuffer data); @Alternate("glGetIntegeri_v") @GLreturn("data") @StripPostfix("data") void glGetIntegeri_v2(@GLenum int value, @GLuint int index, @OutParameter IntBuffer data); void glEnablei(@GLenum int target, @GLuint int index); void glDisablei(@GLenum int target, @GLuint int index); boolean glIsEnabledi(@GLenum int target, @GLuint int index); // ---------------------------------------------------------------------------- // ----------------------[ ARB_texture_compression_rgtc ]---------------------- // ---------------------------------------------------------------------------- /** * Accepted by the <internalformat> parameter of TexImage2D, * CopyTexImage2D, and CompressedTexImage2D and the <format> parameter * of CompressedTexSubImage2D: */ int GL_COMPRESSED_RED_RGTC1 = 0x8DBB; int GL_COMPRESSED_SIGNED_RED_RGTC1 = 0x8DBC; int GL_COMPRESSED_RED_GREEN_RGTC2 = 0x8DBD; int GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2 = 0x8DBE; // -------------------------------------------------------------- // ----------------------[ ARB_texture_rg ]---------------------- // -------------------------------------------------------------- /** * Accepted by the <internalFormat> parameter of TexImage1D, TexImage2D, * TexImage3D, CopyTexImage1D, and CopyTexImage2D: */ int GL_R8 = 0x8229; int GL_R16 = 0x822A; int GL_RG8 = 0x822B; int GL_RG16 = 0x822C; int GL_R16F = 0x822D; int GL_R32F = 0x822E; int GL_RG16F = 0x822F; int GL_RG32F = 0x8230; int GL_R8I = 0x8231; int GL_R8UI = 0x8232; int GL_R16I = 0x8233; int GL_R16UI = 0x8234; int GL_R32I = 0x8235; int GL_R32UI = 0x8236; int GL_RG8I = 0x8237; int GL_RG8UI = 0x8238; int GL_RG16I = 0x8239; int GL_RG16UI = 0x823A; int GL_RG32I = 0x823B; int GL_RG32UI = 0x823C; /** * Accepted by the <format> parameter of TexImage3D, TexImage2D, * TexImage3D, TexSubImage1D, TexSubImage2D, TexSubImage3D, * DrawPixels and ReadPixels: */ int GL_RG = 0x8227; int GL_RG_INTEGER = 0x8228; /** * Accepted by the <param> parameter of the TexParameter{if}* * functions when <pname> is DEPTH_TEXTURE_MODE: */ int GL_RED = 0x1903; // ---------------------------------------------------------------------- // ----------------------[ EXT_transform_feedback ]---------------------- // ---------------------------------------------------------------------- /** * Accepted by the <target> parameters of BindBuffer, BufferData, * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, * GetBufferPointerv, BindBufferRange, BindBufferOffset and * BindBufferBase: */ int GL_TRANSFORM_FEEDBACK_BUFFER = 0x8C8E; /** * Accepted by the <param> parameter of GetIntegerIndexedv and * GetBooleanIndexedv: */ int GL_TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84; int GL_TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85; /** * Accepted by the <param> parameter of GetIntegerIndexedv and * GetBooleanIndexedv, and by the <pname> parameter of GetBooleanv, * GetDoublev, GetIntegerv, and GetFloatv: */ int GL_TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F; /** Accepted by the <bufferMode> parameter of TransformFeedbackVaryings: */ int GL_INTERLEAVED_ATTRIBS = 0x8C8C; int GL_SEPARATE_ATTRIBS = 0x8C8D; /** * Accepted by the <target> parameter of BeginQuery, EndQuery, and * GetQueryiv: */ int GL_PRIMITIVES_GENERATED = 0x8C87; int GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88; /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, and by * the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and * GetDoublev: */ int GL_RASTERIZER_DISCARD = 0x8C89; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv, * and GetFloatv: */ int GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A; int GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B; int GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80; /** Accepted by the <pname> parameter of GetProgramiv: */ int GL_TRANSFORM_FEEDBACK_VARYINGS = 0x8C83; int GL_TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F; int GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 0x8C76; void glBindBufferRange(@GLenum int target, @GLuint int index, @GLuint int buffer, @GLintptr long offset, @GLsizeiptr long size); void glBindBufferBase(@GLenum int target, @GLuint int index, @GLuint int buffer); void glBeginTransformFeedback(@GLenum int primitiveMode); void glEndTransformFeedback(); void glTransformFeedbackVaryings(@GLuint int program, @GLsizei int count, @Const @NullTerminated("count") @GLchar @PointerArray("count") ByteBuffer varyings, @GLenum int bufferMode); @Alternate("glTransformFeedbackVaryings") void glTransformFeedbackVaryings(@GLuint int program, @Constant("varyings.length") @GLsizei int count, @Const @NullTerminated @PointerArray("count") CharSequence[] varyings, @GLenum int bufferMode); void glGetTransformFeedbackVarying(@GLuint int program, @GLuint int index, @AutoSize("name") @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLsizei @Check("1") IntBuffer size, @OutParameter @GLenum @Check("1") IntBuffer type, @OutParameter @GLchar ByteBuffer name); @Alternate("glGetTransformFeedbackVarying") @GLreturn(value = "name", maxLength = "bufSize") void glGetTransformFeedbackVarying2(@GLuint int program, @GLuint int index, @GLsizei int bufSize, @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length, @OutParameter @GLsizei @Check("1") IntBuffer size, @OutParameter @GLenum @Check("1") IntBuffer type, @OutParameter @GLchar ByteBuffer name); // ----------------------------------------------------------------------- // ----------------------[ ARB_vertex_array_object ]---------------------- // ----------------------------------------------------------------------- /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_VERTEX_ARRAY_BINDING = 0x85B5; @Code(" StateTracker.bindVAO(caps, array);") void glBindVertexArray(@GLuint int array); @Code(" StateTracker.deleteVAO(caps, arrays);") void glDeleteVertexArrays(@AutoSize("arrays") @GLsizei int n, @Const @GLuint IntBuffer arrays); @Alternate("glDeleteVertexArrays") @Code(" StateTracker.deleteVAO(caps, array);") void glDeleteVertexArrays(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, array), 0", keepParam = true) int array); void glGenVertexArrays(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); @Alternate("glGenVertexArrays") @GLreturn("arrays") void glGenVertexArrays2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); boolean glIsVertexArray(@GLuint int array); // -------------------------------------------------------------------- // ----------------------[ ARB_framebuffer_sRGB ]---------------------- // -------------------------------------------------------------------- /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, * and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_FRAMEBUFFER_SRGB = 0x8DB9; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_FRAMEBUFFER_SRGB_CAPABLE = 0x8DBA; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_viewport_array.java0000644000175000017500000001226411543426511024312 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.DoubleBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; @Extension(postfix = "") public interface ARB_viewport_array { /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * GetDoublev and GetInteger64v: */ int GL_MAX_VIEWPORTS = 0x825B, GL_VIEWPORT_SUBPIXEL_BITS = 0x825C, GL_VIEWPORT_BOUNDS_RANGE = 0x825D, GL_LAYER_PROVOKING_VERTEX = 0x825E, GL_VIEWPORT_INDEX_PROVOKING_VERTEX = 0x825F; /** Accepted by the <pname> parameter of GetIntegeri_v: */ int GL_SCISSOR_BOX = 0x0C10; /** Accepted by the <pname> parameter of GetFloati_v: */ int GL_VIEWPORT = 0x0BA2; /** Accepted by the <pname> parameter of GetDoublei_v: */ int GL_DEPTH_RANGE = 0x0B70; /** Accepted by the <pname> parameter of Enablei, Disablei, and IsEnabledi: */ int GL_SCISSOR_TEST = 0x0C11; /** * Returned in the <data> parameter from a Get query with a <pname> of * LAYER_PROVOKING_VERTEX or VIEWPORT_INDEX_PROVOKING_VERTEX: */ int GL_FIRST_VERTEX_CONVENTION = 0x8E4D, GL_LAST_VERTEX_CONVENTION = 0x8E4E, GL_PROVOKING_VERTEX = 0x8E4F, GL_UNDEFINED_VERTEX = 0x8260; @Reuse("GL41") @StripPostfix("v") void glViewportArrayv(@GLuint int first, @AutoSize(value = "v", expression = " >> 2") @GLsizei int count, @Const FloatBuffer v); @Reuse("GL41") void glViewportIndexedf(@GLuint int index, float x, float y, float w, float h); @Reuse("GL41") @StripPostfix("v") void glViewportIndexedfv(@GLuint int index, @Check("4") @Const FloatBuffer v); @Reuse("GL41") @StripPostfix("v") void glScissorArrayv(@GLuint int first, @AutoSize(value = "v", expression = " >> 2") @GLsizei int count, @Const IntBuffer v); @Reuse("GL41") void glScissorIndexed(@GLuint int index, int left, int bottom, @GLsizei int width, @GLsizei int height); @Reuse("GL41") @StripPostfix("v") void glScissorIndexedv(@GLuint int index, @Check("4") @Const IntBuffer v); @Reuse("GL41") @StripPostfix("v") void glDepthRangeArrayv(@GLuint int first, @AutoSize(value = "v", expression = " >> 1") @GLsizei int count, @Const @GLclampd DoubleBuffer v); @Reuse("GL41") void glDepthRangeIndexed(@GLuint int index, @GLclampd double n, @GLclampd double f); @Reuse("GL41") @StripPostfix("data") void glGetFloati_v(@GLenum int target, @GLuint int index, @Check @OutParameter FloatBuffer data); @Reuse("GL41") @Alternate("glGetFloati_v") @GLreturn("data") @StripPostfix("data") void glGetFloati_v2(@GLenum int target, @GLuint int index, @OutParameter FloatBuffer data); @Reuse("GL41") @StripPostfix("data") void glGetDoublei_v(@GLenum int target, @GLuint int index, @Check @OutParameter DoubleBuffer data); @Reuse("GL41") @Alternate("glGetDoublei_v") @GLreturn("data") @StripPostfix("data") void glGetDoublei_v2(@GLenum int target, @GLuint int index, @OutParameter DoubleBuffer data); @Reuse("EXTDrawBuffers2") @StripPostfix(value = "v", extension = "EXT") void glGetIntegerIndexedvEXT(@GLenum int target, @GLuint int index, @Check @OutParameter IntBuffer v); @Reuse("EXTDrawBuffers2") @Alternate("glGetIntegerIndexedivEXT") @GLreturn("v") @StripPostfix(value = "v", extension = "EXT") void glGetIntegerIndexedvEXT2(@GLenum int target, @GLuint int index, @OutParameter IntBuffer v); @Reuse("EXTDrawBuffers2") void glEnableIndexedEXT(@GLenum int target, @GLuint int index); @Reuse("EXTDrawBuffers2") void glDisableIndexedEXT(@GLenum int target, @GLuint int index); @Reuse("EXTDrawBuffers2") boolean glIsEnabledIndexedEXT(@GLenum int target, @GLuint int index); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_draw_instanced.java0000644000175000017500000000431711543426511024222 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.Buffer; public interface ARB_draw_instanced { void glDrawArraysInstancedARB(@GLenum int mode, int first, @GLsizei int count, @GLsizei int primcount); void glDrawElementsInstancedARB(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type, @BufferObject(BufferKind.ElementVBO) @Const @GLubyte @GLushort @GLuint Buffer indices, @GLsizei int primcount); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_depth_bounds_test.java0000644000175000017500000000412011543426511024776 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLclampd; public interface EXT_depth_bounds_test { /** Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev: */ int GL_DEPTH_BOUNDS_TEST_EXT = 0x8890; /** Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev: */ int GL_DEPTH_BOUNDS_EXT = 0x8891; void glDepthBoundsEXT(@GLclampd double zmin, @GLclampd double zmax); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_shader_buffer_store.java0000644000175000017500000000361011543426511025162 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_shader_buffer_store { /** Accepted by the <barriers> parameter of MemoryBarrierNV: */ int GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV = 0x00000010; /** Accepted by the <access> parameter of MakeBufferResidentNV: */ int GL_READ_WRITE = GL15.GL_READ_WRITE; int GL_WRITE_ONLY = GL15.GL_WRITE_ONLY; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_transform_feedback3.java0000644000175000017500000000535111543426511025136 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLreturn; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.IntBuffer; @Extension(postfix = "") public interface ARB_transform_feedback3 { /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv, * and GetFloatv: */ int GL_MAX_TRANSFORM_FEEDBACK_BUFFERS = 0x8E70; int GL_MAX_VERTEX_STREAMS = 0x8E71; @Reuse("GL40") void glDrawTransformFeedbackStream(@GLenum int mode, @GLuint int id, @GLuint int stream); @Reuse("GL40") void glBeginQueryIndexed(@GLenum int target, @GLuint int index, @GLuint int id); @Reuse("GL40") void glEndQueryIndexed(@GLenum int target, @GLuint int index); @Reuse("GL40") @StripPostfix("params") void glGetQueryIndexediv(@GLenum int target, @GLuint int index, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); @Reuse("GL40") @Alternate("glGetQueryIndexediv") @GLreturn("params") @StripPostfix("params") void glGetQueryIndexediv2(@GLenum int target, @GLuint int index, @GLenum int pname, @OutParameter IntBuffer params); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_shader_subroutine.java0000644000175000017500000001344211543426511024761 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.ByteBuffer; import java.nio.IntBuffer; @Extension(postfix = "") public interface ARB_shader_subroutine { /** Accepted by the <pname> parameter of GetProgramStageiv: */ int GL_ACTIVE_SUBROUTINES = 0x8DE5; int GL_ACTIVE_SUBROUTINE_UNIFORMS = 0x8DE6; int GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS = 0x8E47; int GL_ACTIVE_SUBROUTINE_MAX_LENGTH = 0x8E48; int GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH = 0x8E49; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, GetDoublev, and GetInteger64v: */ int GL_MAX_SUBROUTINES = 0x8DE7; int GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS = 0x8DE8; /** Accepted by the <pname> parameter of GetActiveSubroutineUniformiv: */ int GL_NUM_COMPATIBLE_SUBROUTINES = 0x8E4A; int GL_COMPATIBLE_SUBROUTINES = 0x8E4B; int GL_UNIFORM_SIZE = GL31.GL_UNIFORM_SIZE; int GL_UNIFORM_NAME_LENGTH = GL31.GL_UNIFORM_NAME_LENGTH; @Reuse("GL40") int glGetSubroutineUniformLocation(@GLuint int program, @GLenum int shadertype, @Const @NullTerminated ByteBuffer name); @Reuse("GL40") @GLuint int glGetSubroutineIndex(@GLuint int program, @GLenum int shadertype, @Const @NullTerminated ByteBuffer name); @Reuse("GL40") @StripPostfix("values") void glGetActiveSubroutineUniformiv(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLenum int pname, @Check("1") @OutParameter IntBuffer values); @Reuse("GL40") @Alternate("glGetActiveSubroutineUniformiv") @GLreturn("values") @StripPostfix("values") void glGetActiveSubroutineUniformiv2(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLenum int pname, @OutParameter IntBuffer values); @Reuse("GL40") void glGetActiveSubroutineUniformName(@GLuint int program, @GLenum int shadertype, @GLuint int index, @AutoSize("name") @GLsizei int bufsize, @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, @OutParameter ByteBuffer name); @Reuse("GL40") @Alternate("glGetActiveSubroutineUniformName") @GLreturn(value = "name", maxLength = "bufsize") void glGetActiveSubroutineUniformName2(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLsizei int bufsize, @OutParameter @Constant("name_length, 0") @GLsizei IntBuffer length, @OutParameter @GLchar ByteBuffer name); @Reuse("GL40") void glGetActiveSubroutineName(@GLuint int program, @GLenum int shadertype, @GLuint int index, @AutoSize("name") @GLsizei int bufsize, @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, @OutParameter ByteBuffer name); @Reuse("GL40") @Alternate("glGetActiveSubroutineName") @GLreturn(value = "name", maxLength = "bufsize") void glGetActiveSubroutineName2(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLsizei int bufsize, @OutParameter @Constant("name_length, 0") @GLsizei IntBuffer length, @OutParameter @GLchar ByteBuffer name); @Reuse("GL40") @StripPostfix("indices") void glUniformSubroutinesuiv(@GLenum int shadertype, @AutoSize("indices") @GLsizei int count, @Const @GLuint IntBuffer indices); @Reuse("GL40") @StripPostfix("params") void glGetUniformSubroutineuiv(@GLenum int shadertype, int location, @Check("1") @OutParameter @GLuint IntBuffer params); @Reuse("GL40") @Alternate("glGetUniformSubroutineuiv") @GLreturn("params") @StripPostfix("params") void glGetUniformSubroutineuiv2(@GLenum int shadertype, int location, @OutParameter @GLuint IntBuffer params); @Reuse("GL40") @StripPostfix("values") void glGetProgramStageiv(@GLuint int program, @GLenum int shadertype, @GLenum int pname, @Check("1") @OutParameter IntBuffer values); @Reuse("GL40") @Alternate("glGetProgramStageiv") @GLreturn("values") @StripPostfix("values") void glGetProgramStageiv2(@GLuint int program, @GLenum int shadertype, @GLenum int pname, @OutParameter IntBuffer values); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_3d.java0000644000175000017500000000314111543426511023351 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_texture_3d { } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_point_parameters.java0000644000175000017500000000405511543426511024610 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import java.nio.*; public interface ARB_point_parameters { int GL_POINT_SIZE_MIN_ARB = 0x8126; int GL_POINT_SIZE_MAX_ARB = 0x8127; int GL_POINT_FADE_THRESHOLD_SIZE_ARB = 0x8128; int GL_POINT_DISTANCE_ATTENUATION_ARB = 0x8129; void glPointParameterfARB(@GLenum int pname, float param); @StripPostfix("pfParams") void glPointParameterfvARB(@GLenum int pname, @Check("4") @Const FloatBuffer pfParams); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_shadow.java0000644000175000017500000000333611543426511022522 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_shadow { int GL_TEXTURE_COMPARE_MODE_ARB = 0x884C; int GL_TEXTURE_COMPARE_FUNC_ARB = 0x884D; int GL_COMPARE_R_TO_TEXTURE_ARB = 0x884E; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_geometry_program4.java0000644000175000017500000000517711543426511024627 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.Reuse; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLuint; public interface NV_geometry_program4 { /** * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, and by * the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and * GetDoublev: */ int GL_GEOMETRY_PROGRAM_NV = 0x8C26; /** Accepted by the <pname> parameter of GetProgramivARB: */ int GL_MAX_PROGRAM_OUTPUT_VERTICES_NV = 0x8C27; int GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV = 0x8C28; void glProgramVertexLimitNV(@GLenum int target, int limit); @Reuse("EXTGeometryShader4") void glFramebufferTextureEXT(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level); @Reuse("EXTGeometryShader4") void glFramebufferTextureLayerEXT(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, int layer); @Reuse("EXTGeometryShader4") void glFramebufferTextureFaceEXT(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, @GLenum int face); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/APPLE_vertex_array_range.java0000644000175000017500000000610311543426511025354 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.AutoSize; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLvoid; import java.nio.ByteBuffer; public interface APPLE_vertex_array_range { /** * Accepted by the <cap> parameter of EnableClientState, DisableClientState, * and IsEnabled: */ int GL_VERTEX_ARRAY_RANGE_APPLE = 0x851D; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE = 0x851E; int GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_APPLE = 0x8520; /** Accepted by the <pname> parameter of GetPointerv: */ int GL_VERTEX_ARRAY_RANGE_POINTER_APPLE = 0x8521; /** * Accepted by the <pname> parameter of VertexArrayParameteriAPPLE, * GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev: */ int GL_VERTEX_ARRAY_STORAGE_HINT_APPLE = 0x851F; /** Accepted by the <param> parameter of VertexArrayParameteriAPPLE: */ int GL_STORAGE_CACHED_APPLE = 0x85BE; int GL_STORAGE_SHARED_APPLE = 0x85BF; /** Accepted by the <object> parameter of TestObjectAPPLE and FinishObjectAPPLE: */ int GL_DRAW_PIXELS_APPLE = 0x8A0A; int GL_FENCE_APPLE = 0x8A0B; void glVertexArrayRangeAPPLE(@AutoSize("pointer") @GLsizei int length, @GLvoid ByteBuffer pointer); void glFlushVertexArrayRangeAPPLE(@AutoSize("pointer") @GLsizei int length, @GLvoid ByteBuffer pointer); void glVertexArrayParameteriAPPLE(@GLenum int pname, int param); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/GL20.java0000644000175000017500000006126311543426511021220 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.*; public interface GL20 { // ------------------------------------------------------------------ // -------------------[ ARB_shading_language_100 ]------------------- // ------------------------------------------------------------------ /** Accepted by the <name> parameter of GetString: */ int GL_SHADING_LANGUAGE_VERSION = 0x8B8C; // ------------------------------------------------------------------ // ----------------------[ ARB_shader_objects ]---------------------- // ------------------------------------------------------------------ /** Accepted by the <pname> argument of GetInteger: */ int GL_CURRENT_PROGRAM = 0x8B8D; /** Accepted by the <pname> parameter of GetObjectParameter{fi}vARB: */ int GL_SHADER_TYPE = 0x8B4F; int GL_DELETE_STATUS = 0x8B80; int GL_COMPILE_STATUS = 0x8B81; int GL_LINK_STATUS = 0x8B82; int GL_VALIDATE_STATUS = 0x8B83; int GL_INFO_LOG_LENGTH = 0x8B84; int GL_ATTACHED_SHADERS = 0x8B85; int GL_ACTIVE_UNIFORMS = 0x8B86; int GL_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87; int GL_ACTIVE_ATTRIBUTES = 0x8B89; int GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A; int GL_SHADER_SOURCE_LENGTH = 0x8B88; /** Returned by the <params> parameter of GetObjectParameter{fi}vARB: */ int GL_SHADER_OBJECT = 0x8B48; /** Returned by the <type> parameter of GetActiveUniformARB: */ int GL_FLOAT_VEC2 = 0x8B50; int GL_FLOAT_VEC3 = 0x8B51; int GL_FLOAT_VEC4 = 0x8B52; int GL_INT_VEC2 = 0x8B53; int GL_INT_VEC3 = 0x8B54; int GL_INT_VEC4 = 0x8B55; int GL_BOOL = 0x8B56; int GL_BOOL_VEC2 = 0x8B57; int GL_BOOL_VEC3 = 0x8B58; int GL_BOOL_VEC4 = 0x8B59; int GL_FLOAT_MAT2 = 0x8B5A; int GL_FLOAT_MAT3 = 0x8B5B; int GL_FLOAT_MAT4 = 0x8B5C; int GL_SAMPLER_1D = 0x8B5D; int GL_SAMPLER_2D = 0x8B5E; int GL_SAMPLER_3D = 0x8B5F; int GL_SAMPLER_CUBE = 0x8B60; int GL_SAMPLER_1D_SHADOW = 0x8B61; int GL_SAMPLER_2D_SHADOW = 0x8B62; /** * The ARB_shader_objects extension allows multiple, optionally null-terminated, source strings to define a shader program. *

      * This method uses just a single string, that should NOT be null-terminated. * * @param shader * @param string */ void glShaderSource(@GLuint int shader, @Constant("1") @GLsizei int count, @Indirect @Const @GLchar @Check ByteBuffer string, @AutoSize("string") @Indirect @Const @GLint int length); @Alternate("glShaderSource") void glShaderSource2(@GLuint int shader, @Constant("1") @GLsizei int count, CharSequence string, @Constant("string.length()") @Indirect @Const int length); @Alternate(value = "glShaderSource", nativeAlt = true) void glShaderSource3(@GLuint int shader, @Constant("strings.length") @GLsizei int count, @Const @PointerArray(value = "count", lengths = "length") CharSequence[] strings, @Constant("APIUtil.getLengths(strings), 0") @Const IntBuffer length); int glCreateShader(@GLuint int type); boolean glIsShader(@GLuint int shader); void glCompileShader(@GLuint int shader); void glDeleteShader(@GLuint int shader); int glCreateProgram(); boolean glIsProgram(int program); void glAttachShader(@GLuint int program, @GLuint int shader); void glDetachShader(@GLuint int program, @GLuint int shader); void glLinkProgram(@GLuint int program); void glUseProgram(@GLuint int program); void glValidateProgram(@GLuint int program); void glDeleteProgram(@GLuint int program); void glUniform1f(int location, float v0); void glUniform2f(int location, float v0, float v1); void glUniform3f(int location, float v0, float v1, float v2); void glUniform4f(int location, float v0, float v1, float v2, float v3); void glUniform1i(int location, int v0); void glUniform2i(int location, int v0, int v1); void glUniform3i(int location, int v0, int v1, int v2); void glUniform4i(int location, int v0, int v1, int v2, int v3); @StripPostfix("values") void glUniform1fv(int location, @AutoSize("values") @GLsizei int count, @Const FloatBuffer values); @StripPostfix("values") void glUniform2fv(int location, @AutoSize(value = "values", expression = " >> 1") @GLsizei int count, @Const FloatBuffer values); @StripPostfix("values") void glUniform3fv(int location, @AutoSize(value = "values", expression = " / 3") @GLsizei int count, @Const FloatBuffer values); @StripPostfix("values") void glUniform4fv(int location, @AutoSize(value = "values", expression = " >> 2") @GLsizei int count, @Const FloatBuffer values); @StripPostfix("values") void glUniform1iv(int location, @AutoSize("values") @GLsizei int count, @Const IntBuffer values); @StripPostfix("values") void glUniform2iv(int location, @AutoSize(value = "values", expression = " >> 1") @GLsizei int count, @Const IntBuffer values); @StripPostfix("values") void glUniform3iv(int location, @AutoSize(value = "values", expression = " / 3") @GLsizei int count, @Const IntBuffer values); @StripPostfix("values") void glUniform4iv(int location, @AutoSize(value = "values", expression = " >> 2") @GLsizei int count, @Const IntBuffer values); @StripPostfix("matrices") void glUniformMatrix2fv(int location, @AutoSize(value = "matrices", expression = " >> 2") @GLsizei int count, boolean transpose, @Const FloatBuffer matrices); @StripPostfix("matrices") void glUniformMatrix3fv(int location, @AutoSize(value = "matrices", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const FloatBuffer matrices); @StripPostfix("matrices") void glUniformMatrix4fv(int location, @AutoSize(value = "matrices", expression = " >> 4") @GLsizei int count, boolean transpose, @Const FloatBuffer matrices); @StripPostfix("params") void glGetShaderiv(@GLuint int shader, @GLenum int pname, @OutParameter @Check IntBuffer params); @Alternate("glGetShaderiv") @GLreturn("params") @StripPostfix("params") void glGetShaderiv2(@GLuint int shader, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") void glGetProgramiv(@GLuint int program, @GLenum int pname, @OutParameter @Check IntBuffer params); @Alternate("glGetProgramiv") @GLreturn("params") @StripPostfix("params") void glGetProgramiv2(@GLuint int program, @GLenum int pname, @OutParameter IntBuffer params); void glGetShaderInfoLog(@GLuint int shader, @AutoSize("infoLog") @GLsizei int maxLength, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer infoLog); @Alternate("glGetShaderInfoLog") @GLreturn(value = "infoLog", maxLength = "maxLength") void glGetShaderInfoLog2(@GLuint int shader, @GLsizei int maxLength, @OutParameter @GLsizei @Constant("infoLog_length, 0") IntBuffer length, @OutParameter @GLchar ByteBuffer infoLog); void glGetProgramInfoLog(@GLuint int program, @AutoSize("infoLog") @GLsizei int maxLength, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer infoLog); @Alternate("glGetProgramInfoLog") @GLreturn(value = "infoLog", maxLength = "maxLength") void glGetProgramInfoLog2(@GLuint int program, @GLsizei int maxLength, @OutParameter @GLsizei @Constant("infoLog_length, 0") IntBuffer length, @OutParameter @GLchar ByteBuffer infoLog); void glGetAttachedShaders(@GLuint int program, @AutoSize("shaders") @GLsizei int maxCount, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer count, @OutParameter @GLuint IntBuffer shaders); /** * Returns the location of the uniform with the specified name. The ByteBuffer should contain the uniform name as a * null-terminated string. * * @param program * @param name */ int glGetUniformLocation(@GLuint int program, @NullTerminated @Check("1") @Const @GLchar ByteBuffer name); @Alternate("glGetUniformLocation") int glGetUniformLocation(@GLuint int program, @NullTerminated CharSequence name); void glGetActiveUniform(@GLuint int program, @GLuint int index, @AutoSize("name") @GLsizei int maxLength, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLsizei @Check("1") IntBuffer size, @OutParameter @GLenum @Check("1") IntBuffer type, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveUniform. This version returns both size and type in the sizeType buffer (at .position() and .position() + 1). */ @Alternate("glGetActiveUniform") @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveUniform2(@GLuint int program, @GLuint int index, @GLsizei int maxLength, @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length, @OutParameter @Check("2") IntBuffer sizeType, @OutParameter @GLenum @Constant("sizeType, sizeType.position() + 1") IntBuffer type, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveUniformARB. This version returns only the uniform name. */ @Alternate(value = "glGetActiveUniform", javaAlt = true) @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveUniform(@GLuint int program, @GLuint int index, @GLsizei int maxLength, @OutParameter @GLsizei @Constant("name_length, 0, APIUtil.getBufferInt(), 0, APIUtil.getBufferInt(), 1") IntBuffer length, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveUniform. This version returns only the uniform size. */ @Alternate(value = "glGetActiveUniform", javaAlt = true) @GLreturn(value = "size") void glGetActiveUniformSize(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength, @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, @OutParameter IntBuffer size, @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); /** Overloads glGetActiveUniform. This version returns only the uniform type. */ @Alternate(value = "glGetActiveUniform", javaAlt = true) @GLreturn(value = "type") void glGetActiveUniformType(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength, @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore @OutParameter @GLenum IntBuffer type, @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); @StripPostfix("params") void glGetUniformfv(@GLuint int program, int location, @OutParameter @Check FloatBuffer params); @StripPostfix("params") void glGetUniformiv(@GLuint int program, int location, @OutParameter @Check IntBuffer params); void glGetShaderSource(@GLuint int shader, @AutoSize("source") @GLsizei int maxLength, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer source); @Alternate("glGetShaderSource") @GLreturn(value = "source", maxLength = "maxLength") void glGetShaderSource2(@GLuint int shader, @GLsizei int maxLength, @OutParameter @GLsizei @Constant("source_length, 0") IntBuffer length, @OutParameter @GLchar ByteBuffer source); // ------------------------------------------------------------------ // ----------------------[ ARB_vertex_program ]---------------------- // ------------------------------------------------------------------ @NoErrorCheck void glVertexAttrib1s(@GLuint int index, short x); @NoErrorCheck void glVertexAttrib1f(@GLuint int index, float x); @NoErrorCheck void glVertexAttrib1d(@GLuint int index, double x); @NoErrorCheck void glVertexAttrib2s(@GLuint int index, short x, short y); @NoErrorCheck void glVertexAttrib2f(@GLuint int index, float x, float y); @NoErrorCheck void glVertexAttrib2d(@GLuint int index, double x, double y); @NoErrorCheck void glVertexAttrib3s(@GLuint int index, short x, short y, short z); @NoErrorCheck void glVertexAttrib3f(@GLuint int index, float x, float y, float z); @NoErrorCheck void glVertexAttrib3d(@GLuint int index, double x, double y, double z); @NoErrorCheck void glVertexAttrib4s(@GLuint int index, short x, short y, short z, short w); @NoErrorCheck void glVertexAttrib4f(@GLuint int index, float x, float y, float z, float w); @NoErrorCheck void glVertexAttrib4d(@GLuint int index, double x, double y, double z, double w); @NoErrorCheck void glVertexAttrib4Nub(@GLuint int index, @GLubyte byte x, @GLubyte byte y, @GLubyte byte z, @GLubyte byte w); void glVertexAttribPointer(@GLuint int index, int size, @AutoType("buffer") @GLenum int type, boolean normalized, @GLsizei int stride, @CachedReference(index = "index", name = "glVertexAttribPointer_buffer") @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLubyte @GLbyte @GLshort @GLushort @GLint @GLuint @GLfloat @GLdouble Buffer buffer); void glEnableVertexAttribArray(@GLuint int index); void glDisableVertexAttribArray(@GLuint int index); @StripPostfix("params") void glGetVertexAttribfv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @StripPostfix("params") void glGetVertexAttribdv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") DoubleBuffer params); @StripPostfix("params") void glGetVertexAttribiv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @StripPostfix("pointer") void glGetVertexAttribPointerv(@GLuint int index, @GLenum int pname, @Result @GLvoid ByteBuffer pointer); // ----------------------------------------------------------------- // ----------------------[ ARB_vertex_shader ]---------------------- // ----------------------------------------------------------------- /** * Accepted by the <shaderType> argument of CreateShader and * returned by the <params> parameter of GetShader{if}v: */ int GL_VERTEX_SHADER = 0x8B31; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A; int GL_MAX_VARYING_FLOATS = 0x8B4B; int GL_MAX_VERTEX_ATTRIBS = 0x8869; int GL_MAX_TEXTURE_IMAGE_UNITS = 0x8872; int GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; int GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; int GL_MAX_TEXTURE_COORDS = 0x8871; /** * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, and * by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and * GetDoublev: */ int GL_VERTEX_PROGRAM_POINT_SIZE = 0x8642; int GL_VERTEX_PROGRAM_TWO_SIDE = 0x8643; /** Accepted by the <pname> parameter of GetVertexAttrib{dfi}vARB: */ int GL_VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; int GL_VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; int GL_VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; int GL_VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; int GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; int GL_CURRENT_VERTEX_ATTRIB = 0x8626; /** Accepted by the <pname> parameter of GetVertexAttribPointervARB: */ int GL_VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; void glBindAttribLocation(@GLuint int program, @GLuint int index, @NullTerminated @Const @GLchar ByteBuffer name); @Alternate("glBindAttribLocation") void glBindAttribLocation(@GLuint int program, @GLuint int index, @NullTerminated CharSequence name); void glGetActiveAttrib(@GLuint int program, @GLuint int index, @AutoSize("name") @GLsizei int maxLength, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @Check("1") IntBuffer size, @OutParameter @GLenum @Check("1") IntBuffer type, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveAttrib. This version returns both size and type in the sizeType buffer (at .position() and .position() + 1). */ @Alternate("glGetActiveAttrib") @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveAttrib2(@GLuint int program, @GLuint int index, @GLsizei int maxLength, @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length, @OutParameter @Check("2") IntBuffer sizeType, @OutParameter @GLenum @Constant("sizeType, sizeType.position() + 1") IntBuffer type, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveAttrib. This version returns only the attrib name. */ @Alternate(value = "glGetActiveAttrib", javaAlt = true) @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveAttrib(@GLuint int program, @GLuint int index, @GLsizei int maxLength, @OutParameter @GLsizei @Constant("name_length, 0, APIUtil.getBufferInt(), 0, APIUtil.getBufferInt(), 1") IntBuffer length, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveAttribARB. This version returns only the attrib size. */ @Alternate(value = "glGetActiveAttrib", javaAlt = true) @GLreturn(value = "size") void glGetActiveAttribSize(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength, @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, @OutParameter IntBuffer size, @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); /** Overloads glGetActiveAttrib. This version returns only the attrib type. */ @Alternate(value = "glGetActiveAttrib", javaAlt = true) @GLreturn(value = "type") void glGetActiveAttribType(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength, @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore @OutParameter @GLenum IntBuffer type, @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); int glGetAttribLocation(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name); @Alternate("glGetAttribLocation") int glGetAttribLocation(@GLuint int program, @NullTerminated CharSequence name); // ------------------------------------------------------------------- // ----------------------[ ARB_fragment_shader ]---------------------- // ------------------------------------------------------------------- /** * Accepted by the <shaderType> argument of CreateShader and * returned by the <params> parameter of GetShader{fi}vARB: */ int GL_FRAGMENT_SHADER = 0x8B30; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49; /** * Accepted by the <target> parameter of Hint and the <pname> parameter of * GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev: */ int GL_FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B; // ---------------------------------------------------------------- // ----------------------[ ARB_draw_buffers ]---------------------- // ---------------------------------------------------------------- /** * Accepted by the <pname> parameters of GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_MAX_DRAW_BUFFERS = 0x8824; int GL_DRAW_BUFFER0 = 0x8825; int GL_DRAW_BUFFER1 = 0x8826; int GL_DRAW_BUFFER2 = 0x8827; int GL_DRAW_BUFFER3 = 0x8828; int GL_DRAW_BUFFER4 = 0x8829; int GL_DRAW_BUFFER5 = 0x882A; int GL_DRAW_BUFFER6 = 0x882B; int GL_DRAW_BUFFER7 = 0x882C; int GL_DRAW_BUFFER8 = 0x882D; int GL_DRAW_BUFFER9 = 0x882E; int GL_DRAW_BUFFER10 = 0x882F; int GL_DRAW_BUFFER11 = 0x8830; int GL_DRAW_BUFFER12 = 0x8831; int GL_DRAW_BUFFER13 = 0x8832; int GL_DRAW_BUFFER14 = 0x8833; int GL_DRAW_BUFFER15 = 0x8834; void glDrawBuffers(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers); @Alternate("glDrawBuffers") void glDrawBuffers(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer); // ---------------------------------------------------------------- // ----------------------[ ARB_point_sprite ]---------------------- // ---------------------------------------------------------------- /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, by * the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and * GetDoublev, and by the <target> parameter of TexEnvi, TexEnviv, * TexEnvf, TexEnvfv, GetTexEnviv, and GetTexEnvfv: */ int GL_POINT_SPRITE = 0x8861; /** * When the <target> parameter of TexEnvf, TexEnvfv, TexEnvi, TexEnviv, * GetTexEnvfv, or GetTexEnviv is POINT_SPRITE, then the value of * <pname> may be: */ int GL_COORD_REPLACE = 0x8862; /** * Accepted by the <pname> parameter of PointParameter{if}vARB, and the * <pname> of Get: */ int GL_POINT_SPRITE_COORD_ORIGIN = 0x8CA0; /** Accepted by the <param> parameter of PointParameter{if}vARB: */ int GL_LOWER_LEFT = 0x8CA1; int GL_UPPER_LEFT = 0x8CA2; // ----------------------------------------------------------------- // ----------------------[ Two-Sided Stencil ]---------------------- // ----------------------------------------------------------------- int GL_STENCIL_BACK_FUNC = 0x8800; int GL_STENCIL_BACK_FAIL = 0x8801; int GL_STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; int GL_STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; int GL_STENCIL_BACK_REF = 0x8CA3; int GL_STENCIL_BACK_VALUE_MASK = 0x8CA4; int GL_STENCIL_BACK_WRITEMASK = 0x8CA5; void glStencilOpSeparate(@GLenum int face, @GLenum int sfail, @GLenum int dpfail, @GLenum int dppass); void glStencilFuncSeparate(@GLenum int face, @GLenum int func, int ref, @GLuint int mask); void glStencilMaskSeparate(@GLenum int face, @GLuint int mask); // ------------------------------------------------------------- // ----------------------[ EXT_blend_equation_separate ]---------------------- // ------------------------------------------------------------- int GL_BLEND_EQUATION_RGB = 0x8009; int GL_BLEND_EQUATION_ALPHA = 0x883D; void glBlendEquationSeparate(@GLenum int modeRGB, @GLenum int modeAlpha); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_compression_s3tc.java0000644000175000017500000000362711543426511026351 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; @Extension(postfix = "EXT", className = "EXTTextureCompressionS3TC") public interface EXT_texture_compression_s3tc { int GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0; int GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1; int GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2; int GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_lod_bias.java0000644000175000017500000000350711543426511024625 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; @Extension(postfix = "EXT", className = "EXTTextureLODBias") public interface EXT_texture_lod_bias { int GL_TEXTURE_FILTER_CONTROL_EXT = 0x8500; int GL_TEXTURE_LOD_BIAS_EXT = 0x8501; int GL_MAX_TEXTURE_LOD_BIAS_EXT = 0x84FD; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_shader_objects.java0000644000175000017500000003176711543426511024225 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; public interface ARB_shader_objects { /** Accepted by the <pname> argument of GetHandleARB: */ int GL_PROGRAM_OBJECT_ARB = 0x8B40; /** Accepted by the <pname> parameter of GetObjectParameter{fi}vARB: */ int GL_OBJECT_TYPE_ARB = 0x8B4E; int GL_OBJECT_SUBTYPE_ARB = 0x8B4F; int GL_OBJECT_DELETE_STATUS_ARB = 0x8B80; int GL_OBJECT_COMPILE_STATUS_ARB = 0x8B81; int GL_OBJECT_LINK_STATUS_ARB = 0x8B82; int GL_OBJECT_VALIDATE_STATUS_ARB = 0x8B83; int GL_OBJECT_INFO_LOG_LENGTH_ARB = 0x8B84; int GL_OBJECT_ATTACHED_OBJECTS_ARB = 0x8B85; int GL_OBJECT_ACTIVE_UNIFORMS_ARB = 0x8B86; int GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB = 0x8B87; int GL_OBJECT_SHADER_SOURCE_LENGTH_ARB = 0x8B88; /** Returned by the <params> parameter of GetObjectParameter{fi}vARB: */ int GL_SHADER_OBJECT_ARB = 0x8B48; /** Returned by the <type> parameter of GetActiveUniformARB: */ int GL_FLOAT = 0x1406; int GL_FLOAT_VEC2_ARB = 0x8B50; int GL_FLOAT_VEC3_ARB = 0x8B51; int GL_FLOAT_VEC4_ARB = 0x8B52; int GL_INT = 0x1404; int GL_INT_VEC2_ARB = 0x8B53; int GL_INT_VEC3_ARB = 0x8B54; int GL_INT_VEC4_ARB = 0x8B55; int GL_BOOL_ARB = 0x8B56; int GL_BOOL_VEC2_ARB = 0x8B57; int GL_BOOL_VEC3_ARB = 0x8B58; int GL_BOOL_VEC4_ARB = 0x8B59; int GL_FLOAT_MAT2_ARB = 0x8B5A; int GL_FLOAT_MAT3_ARB = 0x8B5B; int GL_FLOAT_MAT4_ARB = 0x8B5C; int GL_SAMPLER_1D_ARB = 0x8B5D; int GL_SAMPLER_2D_ARB = 0x8B5E; int GL_SAMPLER_3D_ARB = 0x8B5F; int GL_SAMPLER_CUBE_ARB = 0x8B60; int GL_SAMPLER_1D_SHADOW_ARB = 0x8B61; int GL_SAMPLER_2D_SHADOW_ARB = 0x8B62; int GL_SAMPLER_2D_RECT_ARB = 0x8B63; int GL_SAMPLER_2D_RECT_SHADOW_ARB = 0x8B64; void glDeleteObjectARB(@GLhandleARB int obj); @GLhandleARB int glGetHandleARB(@GLenum int pname); void glDetachObjectARB(@GLhandleARB int containerObj, @GLhandleARB int attachedObj); @GLhandleARB int glCreateShaderObjectARB(@GLenum int shaderType); /** * The ARB_shader_objects extension allows multiple, optionally null-terminated, source strings to define a shader program. *

      * This method uses just a single string, that should NOT be null-terminated. */ void glShaderSourceARB(@GLhandleARB int shader, @Constant("1") @GLsizei int count, @Indirect @Const @GLcharARB @Check ByteBuffer string, @AutoSize("string") @Indirect @Const @GLint int length); @Alternate("glShaderSourceARB") void glShaderSourceARB2(@GLhandleARB int shader, @Constant("1") @GLsizei int count, CharSequence string, @Constant("string.length()") @Indirect @Const int length); @Alternate(value = "glShaderSourceARB", nativeAlt = true) void glShaderSourceARB3(@GLhandleARB int shader, @Constant("strings.length") @GLsizei int count, @Const @PointerArray(value = "count", lengths = "length") CharSequence[] strings, @Constant("APIUtil.getLengths(strings), 0") @Const IntBuffer length); void glCompileShaderARB(@GLhandleARB int shaderObj); @GLhandleARB int glCreateProgramObjectARB(); void glAttachObjectARB(@GLhandleARB int containerObj, @GLhandleARB int obj); void glLinkProgramARB(@GLhandleARB int programObj); void glUseProgramObjectARB(@GLhandleARB int programObj); void glValidateProgramARB(@GLhandleARB int programObj); void glUniform1fARB(int location, float v0); void glUniform2fARB(int location, float v0, float v1); void glUniform3fARB(int location, float v0, float v1, float v2); void glUniform4fARB(int location, float v0, float v1, float v2, float v3); void glUniform1iARB(int location, int v0); void glUniform2iARB(int location, int v0, int v1); void glUniform3iARB(int location, int v0, int v1, int v2); void glUniform4iARB(int location, int v0, int v1, int v2, int v3); @StripPostfix("values") void glUniform1fvARB(int location, @AutoSize("values") @GLsizei int count, @Const FloatBuffer values); @StripPostfix("values") void glUniform2fvARB(int location, @AutoSize(value = "values", expression = " >> 1") @GLsizei int count, @Const FloatBuffer values); @StripPostfix("values") void glUniform3fvARB(int location, @AutoSize(value = "values", expression = " / 3") @GLsizei int count, @Const FloatBuffer values); @StripPostfix("values") void glUniform4fvARB(int location, @AutoSize(value = "values", expression = " >> 2") @GLsizei int count, @Const FloatBuffer values); @StripPostfix("values") void glUniform1ivARB(int location, @AutoSize(value = "values") @GLsizei int count, @Const IntBuffer values); @StripPostfix("values") void glUniform2ivARB(int location, @AutoSize(value = "values", expression = " >> 1") @GLsizei int count, @Const IntBuffer values); @StripPostfix("values") void glUniform3ivARB(int location, @AutoSize(value = "values", expression = " / 3") @GLsizei int count, @Const IntBuffer values); @StripPostfix("values") void glUniform4ivARB(int location, @AutoSize(value = "values", expression = " >> 2") @GLsizei int count, @Const IntBuffer values); @StripPostfix("matrices") void glUniformMatrix2fvARB(int location, @AutoSize(value = "matrices", expression = " >> 2") @GLsizei int count, boolean transpose, @Const FloatBuffer matrices); @StripPostfix("matrices") void glUniformMatrix3fvARB(int location, @AutoSize(value = "matrices", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const FloatBuffer matrices); @StripPostfix("matrices") void glUniformMatrix4fvARB(int location, @AutoSize(value = "matrices", expression = " >> 4") @GLsizei int count, boolean transpose, @Const FloatBuffer matrices); @StripPostfix("params") void glGetObjectParameterfvARB(@GLhandleARB int obj, @GLenum int pname, @OutParameter @Check FloatBuffer params); @Alternate("glGetObjectParameterfvARB") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetObjectParameterfvARB2(@GLhandleARB int obj, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") void glGetObjectParameterivARB(@GLhandleARB int obj, @GLenum int pname, @OutParameter @Check IntBuffer params); @Alternate("glGetObjectParameterivARB") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetObjectParameterivARB2(@GLhandleARB int obj, @GLenum int pname, @OutParameter IntBuffer params); void glGetInfoLogARB(@GLhandleARB int obj, @AutoSize("infoLog") @GLsizei int maxLength, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLcharARB ByteBuffer infoLog); @Alternate("glGetInfoLogARB") @GLreturn(value = "infoLog", maxLength = "maxLength") void glGetInfoLogARB2(@GLhandleARB int obj, @GLsizei int maxLength, @OutParameter @GLsizei @Constant("infoLog_length, 0") IntBuffer length, @OutParameter @GLcharARB ByteBuffer infoLog); void glGetAttachedObjectsARB(@GLhandleARB int containerObj, @AutoSize("obj") @GLsizei int maxCount, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer count, @OutParameter @GLhandleARB IntBuffer obj); /** * Returns the location of the uniform with the specified name. The ByteBuffer should contain the uniform name as a null-terminated string. * * @param programObj * @param name */ int glGetUniformLocationARB(@GLhandleARB int programObj, @NullTerminated @Const @GLcharARB ByteBuffer name); @Alternate("glGetUniformLocationARB") int glGetUniformLocationARB(@GLhandleARB int programObj, @NullTerminated CharSequence name); void glGetActiveUniformARB(@GLhandleARB int programObj, @GLuint int index, @AutoSize("name") @GLsizei int maxLength, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @Check("1") IntBuffer size, @OutParameter @GLenum @Check("1") IntBuffer type, @OutParameter @GLcharARB ByteBuffer name); /** Overloads glGetActiveUniformARB. This version returns both size and type in the sizeType buffer (at .position() and .position() + 1). */ @Alternate("glGetActiveUniformARB") @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveUniformARB2(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength, @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length, @OutParameter @Check("2") IntBuffer sizeType, @OutParameter @GLenum @Constant("sizeType, sizeType.position() + 1") IntBuffer type, @OutParameter @GLcharARB ByteBuffer name); /** Overloads glGetActiveUniformARB. This version returns only the uniform name. */ @Alternate(value = "glGetActiveUniformARB", javaAlt = true) @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveUniformARB(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength, @OutParameter @GLsizei @Constant("name_length, 0, APIUtil.getBufferInt(), 0, APIUtil.getBufferInt(), 1") IntBuffer length, @OutParameter @GLcharARB ByteBuffer name); /** Overloads glGetActiveUniformARB. This version returns only the uniform size. */ @Alternate(value = "glGetActiveUniformARB", javaAlt = true) @GLreturn(value = "size") void glGetActiveUniformSizeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength, @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, @OutParameter IntBuffer size, @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); /** Overloads glGetActiveUniformARB. This version returns only the uniform type. */ @Alternate(value = "glGetActiveUniformARB", javaAlt = true) @GLreturn(value = "type") void glGetActiveUniformTypeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength, @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore @OutParameter @GLenum IntBuffer type, @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); @StripPostfix("params") void glGetUniformfvARB(@GLhandleARB int programObj, int location, @OutParameter @Check FloatBuffer params); @StripPostfix("params") void glGetUniformivARB(@GLhandleARB int programObj, int location, @OutParameter @Check IntBuffer params); void glGetShaderSourceARB(@GLhandleARB int obj, @AutoSize("source") @GLsizei int maxLength, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLcharARB ByteBuffer source); @Alternate("glGetShaderSourceARB") @GLreturn(value = "source", maxLength = "maxLength") void glGetShaderSourceARB2(@GLhandleARB int obj, @GLsizei int maxLength, @OutParameter @GLsizei @Constant("source_length, 0") IntBuffer length, @OutParameter @GLcharARB ByteBuffer source); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_float.java0000644000175000017500000000512411543426511024117 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_texture_float { /** * Accepted by the <value> parameter of GetTexLevelParameter: */ int GL_TEXTURE_RED_TYPE_ARB = 0x8C10; int GL_TEXTURE_GREEN_TYPE_ARB = 0x8C11; int GL_TEXTURE_BLUE_TYPE_ARB = 0x8C12; int GL_TEXTURE_ALPHA_TYPE_ARB = 0x8C13; int GL_TEXTURE_LUMINANCE_TYPE_ARB = 0x8C14; int GL_TEXTURE_INTENSITY_TYPE_ARB = 0x8C15; int GL_TEXTURE_DEPTH_TYPE_ARB = 0x8C16; /** * Returned by the <params> parameter of GetTexLevelParameter: */ int GL_UNSIGNED_NORMALIZED_ARB = 0x8C17; /** * Accepted by the <internalFormat> parameter of TexImage1D, * TexImage2D, and TexImage3D: */ int GL_RGBA32F_ARB = 0x8814; int GL_RGB32F_ARB = 0x8815; int GL_ALPHA32F_ARB = 0x8816; int GL_INTENSITY32F_ARB = 0x8817; int GL_LUMINANCE32F_ARB = 0x8818; int GL_LUMINANCE_ALPHA32F_ARB = 0x8819; int GL_RGBA16F_ARB = 0x881A; int GL_RGB16F_ARB = 0x881B; int GL_ALPHA16F_ARB = 0x881C; int GL_INTENSITY16F_ARB = 0x881D; int GL_LUMINANCE16F_ARB = 0x881E; int GL_LUMINANCE_ALPHA16F_ARB = 0x881F; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_gather.java0000644000175000017500000000360411543426511024265 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_texture_gather { /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB = 0x8E5E; int GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB = 0x8E5F; int GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB = 0x8F9F; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ATI_meminfo.java0000644000175000017500000000343611543426511022701 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ATI_meminfo { /** Accepted by the <value> parameter of GetIntegerv: */ int GL_VBO_FREE_MEMORY_ATI = 0x87FB; int GL_TEXTURE_FREE_MEMORY_ATI = 0x87FC; int GL_RENDERBUFFER_FREE_MEMORY_ATI = 0x87FD; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_light_max_exponent.java0000644000175000017500000000326211543426511025046 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_light_max_exponent { int GL_MAX_SHININESS_NV = 0x8504; int GL_MAX_SPOT_EXPONENT_NV = 0x8505; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_draw_elements_base_vertex.java0000644000175000017500000000627011543426511026455 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.Buffer; public interface ARB_draw_elements_base_vertex { @Reuse("GL32") void glDrawElementsBaseVertex(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type, @BufferObject(BufferKind.ElementVBO) @Const @GLubyte @GLushort @GLuint Buffer indices, int basevertex); @Reuse("GL32") void glDrawRangeElementsBaseVertex(@GLenum int mode, @GLuint int start, @GLuint int end, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type, @BufferObject(BufferKind.ElementVBO) @Const @GLubyte @GLushort @GLuint Buffer indices, int basevertex); @Reuse("GL32") void glDrawElementsInstancedBaseVertex(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type, @BufferObject(BufferKind.ElementVBO) @Const @GLubyte @GLushort @GLuint Buffer indices, @GLsizei int primcount, int basevertex); //void glMultiDrawElementsBaseVertex(@GLenum int mode, @GLsizei*count, @GLenum int type, void**indices, @GLsizei int primcount, int*basevertex) }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_get_program_binary.java0000644000175000017500000000564011543426511025107 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import org.lwjgl.util.generator.opengl.GLvoid; import java.nio.ByteBuffer; import java.nio.IntBuffer; public interface ARB_get_program_binary { /** * Accepted by the <pname> parameter of ProgramParameteri and * GetProgramiv: */ int GL_PROGRAM_BINARY_RETRIEVABLE_HINT = 0x8257; /** Accepted by the <pname> parameter of GetProgramiv: */ int GL_PROGRAM_BINARY_LENGTH = 0x8741; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetInteger64v, GetFloatv and GetDoublev: */ int GL_NUM_PROGRAM_BINARY_FORMATS = 0x87FE, GL_PROGRAM_BINARY_FORMATS = 0x87FF; @Reuse("GL41") void glGetProgramBinary(@GLuint int program, @AutoSize("binary") @GLsizei int bufSize, @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, @Check("1") @GLenum IntBuffer binaryFormat, @OutParameter @GLvoid ByteBuffer binary); @Reuse("GL41") void glProgramBinary(@GLuint int program, @GLenum int binaryFormat, @Const @GLvoid ByteBuffer binary, @AutoSize("binary") @GLsizei int length); @Reuse("GL41") void glProgramParameteri(@GLuint int program, @GLenum int pname, int value); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_buffer_object.java0000644000175000017500000000470611543426511025616 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLuint; public interface ARB_texture_buffer_object { /** * Accepted by the <target> parameter of BindBuffer, BufferData, * BufferSubData, MapBuffer, MapBufferRangeARB, BindTexture, UnmapBuffer, * GetBufferSubData, GetBufferParameteriv, GetBufferPointerv, and TexBufferARB, * and the parameter of GetBooleanv, GetDoublev, GetFloatv, and * GetIntegerv: */ int GL_TEXTURE_BUFFER_ARB = 0x8C2A; /** * Accepted by the <pname> parameters of GetBooleanv, GetDoublev, * GetFloatv, and GetIntegerv: */ int GL_MAX_TEXTURE_BUFFER_SIZE_ARB = 0x8C2B; int GL_TEXTURE_BINDING_BUFFER_ARB = 0x8C2C; int GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB = 0x8C2D; int GL_TEXTURE_BUFFER_FORMAT_ARB = 0x8C2E; void glTexBufferARB(@GLenum int target, @GLenum int internalformat, @GLuint int buffer); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_transform_feedback.java0000644000175000017500000002105511543426511024771 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.ByteBuffer; import java.nio.IntBuffer; public interface NV_transform_feedback { /** * Accepted by the <target> parameters of BindBuffer, BufferData, * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, * GetBufferPointerv, BindBufferRangeNV, BindBufferOffsetNV and * BindBufferBaseNV: */ int GL_TRANSFORM_FEEDBACK_BUFFER_NV = 0x8C8E; /** * Accepted by the <param> parameter of GetIntegerIndexedvEXT and * GetBooleanIndexedvEXT: */ int GL_TRANSFORM_FEEDBACK_BUFFER_START_NV = 0x8C84; int GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV = 0x8C85; int GL_TRANSFORM_FEEDBACK_RECORD_NV = 0x8C86; /** * Accepted by the <param> parameter of GetIntegerIndexedvEXT and * GetBooleanIndexedvEXT, and by the <pname> parameter of GetBooleanv, * GetDoublev, GetIntegerv, and GetFloatv: */ int GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV = 0x8C8F; /** * Accepted by the <bufferMode> parameter of TransformFeedbackAttribsNV and * TransformFeedbackVaryingsNV: */ int GL_INTERLEAVED_ATTRIBS_NV = 0x8C8C; int GL_SEPARATE_ATTRIBS_NV = 0x8C8D; /** * Accepted by the <target> parameter of BeginQuery, EndQuery, and * GetQueryiv: */ int GL_PRIMITIVES_GENERATED_NV = 0x8C87; int GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV = 0x8C88; /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, and by * the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and * GetDoublev: */ int GL_RASTERIZER_DISCARD_NV = 0x8C89; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv, * and GetFloatv: */ int GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV = 0x8C8A; int GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV = 0x8C8B; int GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV = 0x8C80; int GL_TRANSFORM_FEEDBACK_ATTRIBS_NV = 0x8C7E; /** Accepted by the <pname> parameter of GetProgramiv: */ int GL_ACTIVE_VARYINGS_NV = 0x8C81; int GL_ACTIVE_VARYING_MAX_LENGTH_NV = 0x8C82; int GL_TRANSFORM_FEEDBACK_VARYINGS_NV = 0x8C83; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv, * GetFloatv, and GetProgramiv: */ int GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV = 0x8C7F; /** Accepted by the <attribs> parameter of TransformFeedbackAttribsNV: */ int GL_BACK_PRIMARY_COLOR_NV = 0x8C77; int GL_BACK_SECONDARY_COLOR_NV = 0x8C78; int GL_TEXTURE_COORD_NV = 0x8C79; int GL_CLIP_DISTANCE_NV = 0x8C7A; int GL_VERTEX_ID_NV = 0x8C7B; int GL_PRIMITIVE_ID_NV = 0x8C7C; int GL_GENERIC_ATTRIB_NV = 0x8C7D; int GL_LAYER_NV = 0x8DAA; void glBindBufferRangeNV(@GLenum int target, @GLuint int index, @GLuint int buffer, @GLintptr long offset, @GLsizeiptr long size); void glBindBufferOffsetNV(@GLenum int target, @GLuint int index, @GLuint int buffer, @GLintptr long offset); void glBindBufferBaseNV(@GLenum int target, @GLuint int index, @GLuint int buffer); void glTransformFeedbackAttribsNV(@AutoSize("attribs") @GLsizei int count, @Const IntBuffer attribs, @GLenum int bufferMode); void glTransformFeedbackVaryingsNV(@GLuint int program, @AutoSize("locations") @GLsizei int count, @Const IntBuffer locations, @GLenum int bufferMode); void glBeginTransformFeedbackNV(@GLenum int primitiveMode); void glEndTransformFeedbackNV(); int glGetVaryingLocationNV(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name); @Alternate("glGetVaryingLocationNV") int glGetVaryingLocationNV(@GLuint int program, @NullTerminated CharSequence name); void glGetActiveVaryingNV(@GLuint int program, @GLuint int index, @AutoSize("name") @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLsizei @Check("1") IntBuffer size, @OutParameter @GLenum @Check("1") IntBuffer type, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveVaryingNV. This version returns both size and type in the sizeType buffer (at .position() and .position() + 1). */ @Alternate("glGetActiveVaryingNV") @GLreturn(value = "name", maxLength = "bufSize") void glGetActiveVaryingNV2(@GLuint int program, @GLuint int index, @GLsizei int bufSize, @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length, @OutParameter @Check("2") IntBuffer sizeType, @OutParameter @GLenum @Constant("sizeType, sizeType.position() + 1") IntBuffer type, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveVaryingNV. This version returns only the varying name. */ @Alternate(value = "glGetActiveVaryingNV", javaAlt = true) @GLreturn(value = "name", maxLength = "bufSize") void glGetActiveVaryingNV(@GLuint int program, @GLuint int index, @GLsizei int bufSize, @OutParameter @GLsizei @Constant("name_length, 0, APIUtil.getBufferInt(), 0, APIUtil.getBufferInt(), 1") IntBuffer length, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveVaryingNV. This version returns only the varying size. */ @Alternate(value = "glGetActiveVaryingNV", javaAlt = true) @GLreturn(value = "size") void glGetActiveVaryingSizeNV(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int bufSize, @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, @OutParameter IntBuffer size, @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); /** Overloads glGetActiveVaryingNV. This version returns only the varying type. */ @Alternate(value = "glGetActiveVaryingNV", javaAlt = true) @GLreturn(value = "type") void glGetActiveVaryingTypeNV(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int bufSize, @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore @OutParameter @GLenum IntBuffer type, @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); void glActiveVaryingNV(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name); @Alternate("glActiveVaryingNV") void glActiveVaryingNV(@GLuint int program, @NullTerminated CharSequence name); void glGetTransformFeedbackVaryingNV(@GLuint int program, @GLuint int index, @OutParameter @Check("1") IntBuffer location); @Alternate("glGetTransformFeedbackVaryingNV") @GLreturn("location") void glGetTransformFeedbackVaryingNV2(@GLuint int program, @GLuint int index, @OutParameter IntBuffer location); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_compression_bptc.java0000644000175000017500000000444111543426511026364 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.Alias; import org.lwjgl.util.generator.Extension; @Extension(postfix = "ARB", className = "ARBTextureCompressionBPTC") @Alias("EXT_texture_compression_bptc") public interface ARB_texture_compression_bptc { /** * Accepted by the <internalformat> parameter of TexImage2D, TexImage3D, * CopyTexImage2D, CopyTexImage3D, CompressedTexImage2DARB, and * CompressedTexImage3DARB and the <format> parameter of * CompressedTexSubImage2DARB and CompressedTexSubImage3DARB: */ int GL_COMPRESSED_RGBA_BPTC_UNORM_ARB = 0x8E8C; int GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB = 0x8E8D; int GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB = 0x8E8E; int GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB = 0x8E8F; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_fence.java0000644000175000017500000000545711543426511022242 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLreturn; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.*; public interface NV_fence { int GL_ALL_COMPLETED_NV = 0x84F2; int GL_FENCE_STATUS_NV = 0x84F3; int GL_FENCE_CONDITION_NV = 0x84F4; void glGenFencesNV(@AutoSize("piFences") @GLsizei int n, @OutParameter @GLuint IntBuffer piFences); @Alternate("glGenFencesNV") @GLreturn("piFences") void glGenFencesNV2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer piFences); void glDeleteFencesNV(@AutoSize("piFences") @GLsizei int n, @Const @GLuint IntBuffer piFences); @Alternate("glDeleteFencesNV") void glDeleteFencesNV(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getBufferInt().put(0, fence), 0", keepParam = true) int fence); void glSetFenceNV(@GLuint int fence, @GLenum int condition); boolean glTestFenceNV(@GLuint int fence); void glFinishFenceNV(@GLuint int fence); boolean glIsFenceNV(@GLuint int fence); void glGetFenceivNV(@GLuint int fence, @GLenum int pname, @OutParameter @Check("4") IntBuffer piParams); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/GL21.java0000644000175000017500000001231111543426511021207 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.AutoSize; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.StripPostfix; import java.nio.FloatBuffer; public interface GL21 { // ------------------------------------------------------------------ // --------------------------[ GLSL 1.20 ]--------------------------- // ------------------------------------------------------------------ /** Returned by the <type> parameter of GetActiveAttribARB. */ int GL_FLOAT_MAT2x3 = 0x8B65; int GL_FLOAT_MAT2x4 = 0x8B66; int GL_FLOAT_MAT3x2 = 0x8B67; int GL_FLOAT_MAT3x4 = 0x8B68; int GL_FLOAT_MAT4x2 = 0x8B69; int GL_FLOAT_MAT4x3 = 0x8B6A; @StripPostfix("matrices") void glUniformMatrix2x3fv(int location, @AutoSize(value = "matrices", expression = " / (2 * 3)") @GLsizei int count, boolean transpose, FloatBuffer matrices); @StripPostfix("matrices") void glUniformMatrix3x2fv(int location, @AutoSize(value = "matrices", expression = " / (3 * 2)") @GLsizei int count, boolean transpose, FloatBuffer matrices); @StripPostfix("matrices") void glUniformMatrix2x4fv(int location, @AutoSize(value = "matrices", expression = " >> 3") @GLsizei int count, boolean transpose, FloatBuffer matrices); @StripPostfix("matrices") void glUniformMatrix4x2fv(int location, @AutoSize(value = "matrices", expression = " >> 3") @GLsizei int count, boolean transpose, FloatBuffer matrices); @StripPostfix("matrices") void glUniformMatrix3x4fv(int location, @AutoSize(value = "matrices", expression = " / (3 * 4)") @GLsizei int count, boolean transpose, FloatBuffer matrices); @StripPostfix("matrices") void glUniformMatrix4x3fv(int location, @AutoSize(value = "matrices", expression = " / (4 * 3)") @GLsizei int count, boolean transpose, FloatBuffer matrices); // ------------------------------------------------------------------ // -------------------[ ARB_pixel_buffer_object ]-------------------- // ------------------------------------------------------------------ /** * Accepted by the <target> parameters of BindBuffer, BufferData, * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, * GetBufferParameteriv, and GetBufferPointerv. */ int GL_PIXEL_PACK_BUFFER = 0x88EB; int GL_PIXEL_UNPACK_BUFFER = 0x88EC; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev. */ int GL_PIXEL_PACK_BUFFER_BINDING = 0x88ED; int GL_PIXEL_UNPACK_BUFFER_BINDING = 0x88EF; // ------------------------------------------------------------------ // ----------------------[ EXT_texture_sRGB ]------------------------ // ------------------------------------------------------------------ /** * Accepted by the <internalformat> parameter of TexImage1D, TexImage2D, * TexImage3D, CopyTexImage1D, CopyTexImage2D. */ int GL_SRGB = 0x8C40; int GL_SRGB8 = 0x8C41; int GL_SRGB_ALPHA = 0x8C42; int GL_SRGB8_ALPHA8 = 0x8C43; int GL_SLUMINANCE_ALPHA = 0x8C44; int GL_SLUMINANCE8_ALPHA8 = 0x8C45; int GL_SLUMINANCE = 0x8C46; int GL_SLUMINANCE8 = 0x8C47; int GL_COMPRESSED_SRGB = 0x8C48; int GL_COMPRESSED_SRGB_ALPHA = 0x8C49; int GL_COMPRESSED_SLUMINANCE = 0x8C4A; int GL_COMPRESSED_SLUMINANCE_ALPHA = 0x8C4B; // ------------------------------------------------------------------ // -----------------------[ Misc additions ]------------------------- // ------------------------------------------------------------------ /** Accepted by the <pname> parameter of GetIntegerv and GetFloatv. */ int GL_CURRENT_RASTER_SECONDARY_COLOR = 0x845F; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/APPLE_fence.java0000644000175000017500000000557311543426511022557 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLreturn; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.IntBuffer; public interface APPLE_fence { /** Accepted by the <object> parameter of TestObjectAPPLE and FinishObjectAPPLE: */ int GL_DRAW_PIXELS_APPLE = 0x8A0A; int GL_FENCE_APPLE = 0x8A0B; void glGenFencesAPPLE(@AutoSize("fences") @GLsizei int n, @OutParameter @GLuint IntBuffer fences); @Alternate("glGenFencesAPPLE") @GLreturn("fences") void glGenFencesAPPLE2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer fences); void glDeleteFencesAPPLE(@AutoSize("fences") @GLsizei int n, @Const @GLuint IntBuffer fences); @Alternate("glDeleteFencesAPPLE") void glDeleteFencesAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getBufferInt().put(0, fence), 0", keepParam = true) int fence); void glSetFenceAPPLE(@GLuint int fence); boolean glIsFenceAPPLE(@GLuint int fence); boolean glTestFenceAPPLE(@GLuint int fence); void glFinishFenceAPPLE(@GLuint int fence); boolean glTestObjectAPPLE(@GLenum int object, @GLuint int name); void glFinishObjectAPPLE(@GLenum int object, int name); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java0000644000175000017500000001325511543426511025111 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.ByteBuffer; import java.nio.IntBuffer; public interface EXT_transform_feedback { /** * Accepted by the <target> parameters of BindBuffer, BufferData, * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, * GetBufferPointerv, BindBufferRangeEXT, BindBufferOffsetEXT and * BindBufferBaseEXT: */ int GL_TRANSFORM_FEEDBACK_BUFFER_EXT = 0x8C8E; /** * Accepted by the <param> parameter of GetIntegerIndexedvEXT and * GetBooleanIndexedvEXT: */ int GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT = 0x8C84; int GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT = 0x8C85; /** * Accepted by the <param> parameter of GetIntegerIndexedvEXT and * GetBooleanIndexedvEXT, and by the <pname> parameter of GetBooleanv, * GetDoublev, GetIntegerv, and GetFloatv: */ int GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT = 0x8C8F; /** Accepted by the <bufferMode> parameter of TransformFeedbackVaryingsEXT: */ int GL_INTERLEAVED_ATTRIBS_EXT = 0x8C8C; int GL_SEPARATE_ATTRIBS_EXT = 0x8C8D; /** * Accepted by the <target> parameter of BeginQuery, EndQuery, and * GetQueryiv: */ int GL_PRIMITIVES_GENERATED_EXT = 0x8C87; int GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT = 0x8C88; /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, and by * the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and * GetDoublev: */ int GL_RASTERIZER_DISCARD_EXT = 0x8C89; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv, * and GetFloatv: */ int GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT = 0x8C8A; int GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT = 0x8C8B; int GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT = 0x8C80; /** Accepted by the <pname> parameter of GetProgramiv: */ int GL_TRANSFORM_FEEDBACK_VARYINGS_EXT = 0x8C83; int GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT = 0x8C7F; int GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT = 0x8C76; void glBindBufferRangeEXT(@GLenum int target, @GLuint int index, @GLuint int buffer, @GLintptr long offset, @GLsizeiptr long size); void glBindBufferOffsetEXT(@GLenum int target, @GLuint int index, @GLuint int buffer, @GLintptr long offset); void glBindBufferBaseEXT(@GLenum int target, @GLuint int index, @GLuint int buffer); void glBeginTransformFeedbackEXT(@GLenum int primitiveMode); void glEndTransformFeedbackEXT(); void glTransformFeedbackVaryingsEXT(@GLuint int program, @GLsizei int count, @Const @NullTerminated("count") @GLchar @PointerArray("count") ByteBuffer varyings, @GLenum int bufferMode); @Alternate("glTransformFeedbackVaryingsEXT") void glTransformFeedbackVaryingsEXT(@GLuint int program, @Constant("varyings.length") @GLsizei int count, @Const @NullTerminated @PointerArray("count") CharSequence[] varyings, @GLenum int bufferMode); void glGetTransformFeedbackVaryingEXT(@GLuint int program, @GLuint int index, @AutoSize("name") @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLsizei @Check("1") IntBuffer size, @OutParameter @GLenum @Check("1") IntBuffer type, @OutParameter @GLchar ByteBuffer name); @Alternate("glGetTransformFeedbackVaryingEXT") @GLreturn(value = "name", maxLength = "bufSize") void glGetTransformFeedbackVaryingEXT2(@GLuint int program, @GLuint int index, @GLsizei int bufSize, @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length, @OutParameter @GLsizei @Check("1") IntBuffer size, @OutParameter @GLenum @Check("1") IntBuffer type, @OutParameter @GLchar ByteBuffer name); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_register_combiners.java0000644000175000017500000001566211543426511025046 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLreturn; import java.nio.*; public interface NV_register_combiners { int GL_REGISTER_COMBINERS_NV = 0x8522; int GL_COMBINER0_NV = 0x8550; int GL_COMBINER1_NV = 0x8551; int GL_COMBINER2_NV = 0x8552; int GL_COMBINER3_NV = 0x8553; int GL_COMBINER4_NV = 0x8554; int GL_COMBINER5_NV = 0x8555; int GL_COMBINER6_NV = 0x8556; int GL_COMBINER7_NV = 0x8557; int GL_VARIABLE_A_NV = 0x8523; int GL_VARIABLE_B_NV = 0x8524; int GL_VARIABLE_C_NV = 0x8525; int GL_VARIABLE_D_NV = 0x8526; int GL_VARIABLE_E_NV = 0x8527; int GL_VARIABLE_F_NV = 0x8528; int GL_VARIABLE_G_NV = 0x8529; int GL_CONSTANT_COLOR0_NV = 0x852A; int GL_CONSTANT_COLOR1_NV = 0x852B; int GL_PRIMARY_COLOR_NV = 0x852C; int GL_SECONDARY_COLOR_NV = 0x852D; int GL_SPARE0_NV = 0x852E; int GL_SPARE1_NV = 0x852F; int GL_UNSIGNED_IDENTITY_NV = 0x8536; int GL_UNSIGNED_INVERT_NV = 0x8537; int GL_EXPAND_NORMAL_NV = 0x8538; int GL_EXPAND_NEGATE_NV = 0x8539; int GL_HALF_BIAS_NORMAL_NV = 0x853A; int GL_HALF_BIAS_NEGATE_NV = 0x853B; int GL_SIGNED_IDENTITY_NV = 0x853C; int GL_SIGNED_NEGATE_NV = 0x853D; int GL_E_TIMES_F_NV = 0x8531; int GL_SPARE0_PLUS_SECONDARY_COLOR_NV = 0x8532; int GL_SCALE_BY_TWO_NV = 0x853E; int GL_SCALE_BY_FOUR_NV = 0x853F; int GL_SCALE_BY_ONE_HALF_NV = 0x8540; int GL_BIAS_BY_NEGATIVE_ONE_HALF_NV = 0x8541; int GL_DISCARD_NV = 0x8530; int GL_COMBINER_INPUT_NV = 0x8542; int GL_COMBINER_MAPPING_NV = 0x8543; int GL_COMBINER_COMPONENT_USAGE_NV = 0x8544; int GL_COMBINER_AB_DOT_PRODUCT_NV = 0x8545; int GL_COMBINER_CD_DOT_PRODUCT_NV = 0x8546; int GL_COMBINER_MUX_SUM_NV = 0x8547; int GL_COMBINER_SCALE_NV = 0x8548; int GL_COMBINER_BIAS_NV = 0x8549; int GL_COMBINER_AB_OUTPUT_NV = 0x854A; int GL_COMBINER_CD_OUTPUT_NV = 0x854B; int GL_COMBINER_SUM_OUTPUT_NV = 0x854C; int GL_NUM_GENERAL_COMBINERS_NV = 0x854E; int GL_COLOR_SUM_CLAMP_NV = 0x854F; int GL_MAX_GENERAL_COMBINERS_NV = 0x854D; void glCombinerParameterfNV(@GLenum int pname, float param); @StripPostfix("params") void glCombinerParameterfvNV(@GLenum int pname, @Check("4") @Const FloatBuffer params); void glCombinerParameteriNV(@GLenum int pname, int param); @StripPostfix("params") void glCombinerParameterivNV(@GLenum int pname, @Check("4") @Const IntBuffer params); void glCombinerInputNV(@GLenum int stage, @GLenum int portion, @GLenum int variable, @GLenum int input, @GLenum int mapping, @GLenum int componentUsage); void glCombinerOutputNV(@GLenum int stage, @GLenum int portion, @GLenum int abOutput, @GLenum int cdOutput, @GLenum int sumOutput, @GLenum int scale, @GLenum int bias, boolean abDotProduct, boolean cdDotProduct, boolean muxSum); void glFinalCombinerInputNV(@GLenum int variable, @GLenum int input, @GLenum int mapping, @GLenum int componentUsage); @StripPostfix("params") void glGetCombinerInputParameterfvNV(@GLenum int stage, @GLenum int portion, @GLenum int variable, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @Alternate("glGetCombinerInputParameterfvNV") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetCombinerInputParameterfvNV2(@GLenum int stage, @GLenum int portion, @GLenum int variable, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") void glGetCombinerInputParameterivNV(@GLenum int stage, @GLenum int portion, @GLenum int variable, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetCombinerInputParameterivNV") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetCombinerInputParameterivNV2(@GLenum int stage, @GLenum int portion, @GLenum int variable, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") void glGetCombinerOutputParameterfvNV(@GLenum int stage, @GLenum int portion, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @Alternate("glGetCombinerOutputParameterfvNV") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetCombinerOutputParameterfvNV2(@GLenum int stage, @GLenum int portion, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") void glGetCombinerOutputParameterivNV(@GLenum int stage, @GLenum int portion, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetCombinerOutputParameterivNV") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetCombinerOutputParameterivNV2(@GLenum int stage, @GLenum int portion, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") void glGetFinalCombinerInputParameterfvNV(@GLenum int variable, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @Alternate("glGetFinalCombinerInputParameterfvNV") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetFinalCombinerInputParameterfvNV2(@GLenum int variable, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") void glGetFinalCombinerInputParameterivNV(@GLenum int variable, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetFinalCombinerInputParameterivNV") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetFinalCombinerInputParameterivNV2(@GLenum int variable, @GLenum int pname, @OutParameter IntBuffer params); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_stencil_two_side.java0000644000175000017500000000343611543426511024630 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; public interface EXT_stencil_two_side { int GL_STENCIL_TEST_TWO_SIDE_EXT = 0x8910; int GL_ACTIVE_STENCIL_FACE_EXT = 0x8911; void glActiveStencilFaceEXT(@GLenum int face); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_program.java0000644000175000017500000001746111543426511022710 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.*; @Extension(postfix = "ARB", isFinal = false) public interface ARB_program { /** Accepted by the <format> parameter of ProgramStringARB: */ int GL_PROGRAM_FORMAT_ASCII_ARB = 0x8875; /** Accepted by the <pname> parameter of GetProgramivARB: */ int GL_PROGRAM_LENGTH_ARB = 0x8627; int GL_PROGRAM_FORMAT_ARB = 0x8876; int GL_PROGRAM_BINDING_ARB = 0x8677; int GL_PROGRAM_INSTRUCTIONS_ARB = 0x88A0; int GL_MAX_PROGRAM_INSTRUCTIONS_ARB = 0x88A1; int GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB = 0x88A2; int GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB = 0x88A3; int GL_PROGRAM_TEMPORARIES_ARB = 0x88A4; int GL_MAX_PROGRAM_TEMPORARIES_ARB = 0x88A5; int GL_PROGRAM_NATIVE_TEMPORARIES_ARB = 0x88A6; int GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB = 0x88A7; int GL_PROGRAM_PARAMETERS_ARB = 0x88A8; int GL_MAX_PROGRAM_PARAMETERS_ARB = 0x88A9; int GL_PROGRAM_NATIVE_PARAMETERS_ARB = 0x88AA; int GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB = 0x88AB; int GL_PROGRAM_ATTRIBS_ARB = 0x88AC; int GL_MAX_PROGRAM_ATTRIBS_ARB = 0x88AD; int GL_PROGRAM_NATIVE_ATTRIBS_ARB = 0x88AE; int GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB = 0x88AF; int GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB = 0x88B4; int GL_MAX_PROGRAM_ENV_PARAMETERS_ARB = 0x88B5; int GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB = 0x88B6; /** Accepted by the <pname> parameter of GetProgramStringARB: */ int GL_PROGRAM_STRING_ARB = 0x8628; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_PROGRAM_ERROR_POSITION_ARB = 0x864B; int GL_CURRENT_MATRIX_ARB = 0x8641; int GL_TRANSPOSE_CURRENT_MATRIX_ARB = 0x88B7; int GL_CURRENT_MATRIX_STACK_DEPTH_ARB = 0x8640; int GL_MAX_PROGRAM_MATRICES_ARB = 0x862F; int GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB = 0x862E; /** Accepted by the <name> parameter of GetString: */ int GL_PROGRAM_ERROR_STRING_ARB = 0x8874; /** Accepted by the <mode> parameter of MatrixMode: */ int GL_MATRIX0_ARB = 0x88C0; int GL_MATRIX1_ARB = 0x88C1; int GL_MATRIX2_ARB = 0x88C2; int GL_MATRIX3_ARB = 0x88C3; int GL_MATRIX4_ARB = 0x88C4; int GL_MATRIX5_ARB = 0x88C5; int GL_MATRIX6_ARB = 0x88C6; int GL_MATRIX7_ARB = 0x88C7; int GL_MATRIX8_ARB = 0x88C8; int GL_MATRIX9_ARB = 0x88C9; int GL_MATRIX10_ARB = 0x88CA; int GL_MATRIX11_ARB = 0x88CB; int GL_MATRIX12_ARB = 0x88CC; int GL_MATRIX13_ARB = 0x88CD; int GL_MATRIX14_ARB = 0x88CE; int GL_MATRIX15_ARB = 0x88CF; int GL_MATRIX16_ARB = 0x88D0; int GL_MATRIX17_ARB = 0x88D1; int GL_MATRIX18_ARB = 0x88D2; int GL_MATRIX19_ARB = 0x88D3; int GL_MATRIX20_ARB = 0x88D4; int GL_MATRIX21_ARB = 0x88D5; int GL_MATRIX22_ARB = 0x88D6; int GL_MATRIX23_ARB = 0x88D7; int GL_MATRIX24_ARB = 0x88D8; int GL_MATRIX25_ARB = 0x88D9; int GL_MATRIX26_ARB = 0x88DA; int GL_MATRIX27_ARB = 0x88DB; int GL_MATRIX28_ARB = 0x88DC; int GL_MATRIX29_ARB = 0x88DD; int GL_MATRIX30_ARB = 0x88DE; int GL_MATRIX31_ARB = 0x88DF; void glProgramStringARB(@GLenum int target, @GLenum int format, @AutoSize("string") @GLsizei int length, @Const @GLbyte Buffer string); @Alternate("glProgramStringARB") void glProgramStringARB(@GLenum int target, @GLenum int format, @Constant("string.length()") @GLsizei int length, CharSequence string); void glBindProgramARB(@GLenum int target, @GLuint int program); void glDeleteProgramsARB(@AutoSize("programs") @GLsizei int n, @Const @GLuint IntBuffer programs); @Alternate("glDeleteProgramsARB") void glDeleteProgramsARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, program), 0", keepParam = true) int program); void glGenProgramsARB(@AutoSize("programs") @GLsizei int n, @OutParameter @GLuint IntBuffer programs); @Alternate("glGenProgramsARB") @GLreturn("programs") void glGenProgramsARB2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer programs); void glProgramEnvParameter4fARB(int target, int index, float x, float y, float z, float w); void glProgramEnvParameter4dARB(int target, int index, double x, double y, double z, double w); @StripPostfix("params") void glProgramEnvParameter4fvARB(@GLenum int target, @GLuint int index, @Check("4") @Const FloatBuffer params); @StripPostfix("params") void glProgramEnvParameter4dvARB(@GLenum int target, @GLuint int index, @Check("4") @Const DoubleBuffer params); void glProgramLocalParameter4fARB(@GLenum int target, @GLuint int index, float x, float y, float z, float w); void glProgramLocalParameter4dARB(@GLenum int target, @GLuint int index, double x, double y, double z, double w); @StripPostfix("params") void glProgramLocalParameter4fvARB(@GLenum int target, @GLuint int index, @Check("4") @Const FloatBuffer params); @StripPostfix("params") void glProgramLocalParameter4dvARB(@GLenum int target, @GLuint int index, @Check("4") @Const DoubleBuffer params); @StripPostfix("params") void glGetProgramEnvParameterfvARB(@GLenum int target, @GLuint int index, @OutParameter @Check("4") FloatBuffer params); @StripPostfix("params") void glGetProgramEnvParameterdvARB(@GLenum int target, @GLuint int index, @OutParameter @Check("4") DoubleBuffer params); @StripPostfix("params") void glGetProgramLocalParameterfvARB(@GLenum int target, @GLuint int index, @OutParameter @Check("4") FloatBuffer params); @StripPostfix("params") void glGetProgramLocalParameterdvARB(@GLenum int target, @GLuint int index, @OutParameter @Check("4") DoubleBuffer params); @StripPostfix("params") void glGetProgramivARB(@GLenum int target, @GLenum int parameterName, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetProgramivARB") @GLreturn("params") @StripPostfix("params") void glGetProgramivARB2(@GLenum int target, @GLenum int parameterName, @OutParameter IntBuffer params); void glGetProgramStringARB(@GLenum int target, @GLenum int parameterName, @OutParameter @Check @GLbyte Buffer paramString); @Alternate("glGetProgramStringARB") @Code("\t\tint programLength = glGetProgramARB(target, GL_PROGRAM_LENGTH_ARB);") @GLreturn(value="paramString", maxLength = "programLength", forceMaxLength = true) void glGetProgramStringARB2(@GLenum int target, @GLenum int parameterName, @OutParameter @GLchar ByteBuffer paramString); boolean glIsProgramARB(@GLuint int program); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_depth_buffer_float.java0000644000175000017500000000473511543426511025002 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_depth_buffer_float { /** * Accepted by the <internalformat> parameter of TexImage1D, TexImage2D, * TexImage3D, CopyTexImage1D, CopyTexImage2D, and RenderbufferStorageEXT, * and returned in the <data> parameter of GetTexLevelParameter and * GetRenderbufferParameterivEXT: */ int GL_DEPTH_COMPONENT32F_NV = 0x8DAB; int GL_DEPTH32F_STENCIL8_NV = 0x8DAC; /** * Accepted by the <type> parameter of DrawPixels, ReadPixels, TexImage1D, * TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D, TexSubImage3D, and * GetTexImage: */ int GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV = 0x8DAD; /** * Accepted by the <pname> parameters of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_DEPTH_BUFFER_FLOAT_MODE_NV = 0x8DAF; void glDepthRangedNV(double n, double f); void glClearDepthdNV(double d); void glDepthBoundsdNV(double zmin, double zmax); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_secondary_color.java0000644000175000017500000000543311543426511024456 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.Buffer; public interface EXT_secondary_color { int GL_COLOR_SUM_EXT = 0x8458; int GL_CURRENT_SECONDARY_COLOR_EXT = 0x8459; int GL_SECONDARY_COLOR_ARRAY_SIZE_EXT = 0x845A; int GL_SECONDARY_COLOR_ARRAY_TYPE_EXT = 0x845B; int GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT = 0x845C; int GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = 0x845D; int GL_SECONDARY_COLOR_ARRAY_EXT = 0x845E; void glSecondaryColor3bEXT(byte red, byte green, byte blue); void glSecondaryColor3fEXT(float red, float green, float blue); void glSecondaryColor3dEXT(double red, double green, double blue); void glSecondaryColor3ubEXT(@GLubyte byte red, @GLubyte byte green, @GLubyte byte blue); void glSecondaryColorPointerEXT(int size, @AutoType("pPointer") @GLenum int type, @GLsizei int stride, @CachedReference @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLbyte @GLubyte @GLfloat @GLdouble Buffer pPointer); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_texture_env_combine4.java0000644000175000017500000000342211543426511025300 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_texture_env_combine4 { int GL_COMBINE4_NV = 0x8503; int GL_SOURCE3_RGB_NV = 0x8583; int GL_SOURCE3_ALPHA_NV = 0x858B; int GL_OPERAND3_RGB_NV = 0x8593; int GL_OPERAND3_ALPHA_NV = 0x859B; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_provoking_vertex.java0000644000175000017500000000410111543426511024673 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; public interface EXT_provoking_vertex { /** Accepted by the <mode> parameter of ProvokingVertexEXT: */ int GL_FIRST_VERTEX_CONVENTION_EXT = 0x8E4D; int GL_LAST_VERTEX_CONVENTION_EXT = 0x8E4E; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_PROVOKING_VERTEX_EXT = 0x8E4F; int GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT = 0x8E4C; void glProvokingVertexEXT(@GLenum int mode); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_shader_precision.java0000644000175000017500000000314611543426511024555 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_shader_precision { }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_bgra.java0000644000175000017500000000322011543426511022174 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_bgra { int GL_BGR_EXT = 0x80E0; int GL_BGRA_EXT = 0x80E1; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_env_crossbar.java0000644000175000017500000000315311543426511025500 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_texture_env_crossbar { } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_multi_draw_arrays.java0000644000175000017500000000363611543426511025024 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLsizei; import java.nio.*; public interface EXT_multi_draw_arrays { void glMultiDrawArraysEXT(@GLenum int mode, IntBuffer piFirst, @Check("piFirst.remaining()") @GLsizei IntBuffer piCount, @AutoSize("piFirst") int primcount); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java0000644000175000017500000000540311543426511023714 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLsizei; import java.nio.*; public interface ATI_draw_buffers { /** * Accepted by the <pname> parameters of GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_MAX_DRAW_BUFFERS_ATI = 0x8824; int GL_DRAW_BUFFER0_ATI = 0x8825; int GL_DRAW_BUFFER1_ATI = 0x8826; int GL_DRAW_BUFFER2_ATI = 0x8827; int GL_DRAW_BUFFER3_ATI = 0x8828; int GL_DRAW_BUFFER4_ATI = 0x8829; int GL_DRAW_BUFFER5_ATI = 0x882A; int GL_DRAW_BUFFER6_ATI = 0x882B; int GL_DRAW_BUFFER7_ATI = 0x882C; int GL_DRAW_BUFFER8_ATI = 0x882D; int GL_DRAW_BUFFER9_ATI = 0x882E; int GL_DRAW_BUFFER10_ATI = 0x882F; int GL_DRAW_BUFFER11_ATI = 0x8830; int GL_DRAW_BUFFER12_ATI = 0x8831; int GL_DRAW_BUFFER13_ATI = 0x8832; int GL_DRAW_BUFFER14_ATI = 0x8833; int GL_DRAW_BUFFER15_ATI = 0x8834; void glDrawBuffersATI(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers); @Alternate("glDrawBuffersATI") void glDrawBuffersATI(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_blend_color.java0000644000175000017500000000422711543426511023553 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLclampf; public interface EXT_blend_color { /** Accepted by the <sfactor> and <dfactor> parameters of BlendFunc. */ int GL_CONSTANT_COLOR_EXT = 0x8001; int GL_ONE_MINUS_CONSTANT_COLOR_EXT = 0x8002; int GL_CONSTANT_ALPHA_EXT = 0x8003; int GL_ONE_MINUS_CONSTANT_ALPHA_EXT = 0x8004; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev. */ int GL_BLEND_COLOR_EXT = 0x8005; void glBlendColorEXT(@GLclampf float red, @GLclampf float green, @GLclampf float blue, @GLclampf float alpha); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_texture_compression_vtc.java0000644000175000017500000000410411543426511026143 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; @Extension(postfix = "NV", className = "NVTextureCompressionVTC") public interface NV_texture_compression_vtc { /** * Accepted by the <internalformat> parameter of TexImage3D and * CompressedTexImage3DARB and the <format> parameter of * CompressedTexSubImage2DARB: */ int GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0; int GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1; int GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2; int GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_rgb10_a2ui.java0000644000175000017500000000367111543426511024652 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.Extension; @Extension(postfix = "ARB", className = "ARBTextureRGB10_A2UI") public interface ARB_texture_rgb10_a2ui { /** * Accepted by the <internalFormat> parameter of TexImage1D, TexImage2D, * TexImage3D, CopyTexImage1D, CopyTexImage2D, RenderbufferStorage and * RenderbufferStorageMultisample: */ int GL_RGB10_A2UI = 0x906F; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_rectangle.java0000644000175000017500000000604611543426511024762 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_texture_rectangle { /** Accepted by the <cap> parameter of Enable, Disable and IsEnabled; by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv and GetDoublev; and by the <target> parameter of BindTexture, GetTexParameterfv, GetTexParameteriv, TexParameterf, TexParameteri, TexParameterfv and TexParameteriv: Accepted by the <target> parameter of GetTexImage, GetTexLevelParameteriv, GetTexLevelParameterfv, TexImage2D, CopyTexImage2D, TexSubImage2D and CopySubTexImage2D: */ int GL_TEXTURE_RECTANGLE_ARB = 0x84F5; /** Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv and GetDoublev: */ int GL_TEXTURE_BINDING_RECTANGLE_ARB = 0x84F6; /** Accepted by the <target> parameter of GetTexLevelParameteriv, GetTexLevelParameterfv, GetTexParameteriv and TexImage2D: */ int GL_PROXY_TEXTURE_RECTANGLE_ARB = 0x84F7; /** Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv and GetFloatv: */ int GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB = 0x84F8; /** Returned by <type> parameter of GetActiveUniform when the location <index> for program object <program> is of type sampler2DRect: */ int GL_SAMPLER_2D_RECT_ARB = 0x8B63; /** Returned by <type> parameter of GetActiveUniform when the location <index> for program object <program> is of type sampler2DRectShadow: */ int GL_SAMPLER_2D_RECT_SHADOW_ARB = 0x8B64; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_depth_clamp.java0000644000175000017500000000320211543426511023424 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_depth_clamp { int GL_DEPTH_CLAMP_NV = 0x864F; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_copy_image.java0000644000175000017500000000410111543426511023257 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; public interface NV_copy_image { void glCopyImageSubDataNV( @GLuint int srcName, @GLenum int srcTarget, int srcLevel, int srcX, int srcY, int srcZ, @GLuint int dstName, @GLenum int dstTarget, int dstLevel, int dstX, int dstY, int dstZ, @GLsizei int width, @GLsizei int height, @GLsizei int depth); // TODO: Implement WGL and GLX cross-context copying. }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_tessellation_shader.java0000644000175000017500000001132211543426511025263 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import java.nio.FloatBuffer; @Extension(postfix = "") public interface ARB_tessellation_shader { /** * Accepted by the <mode> parameter of Begin and all vertex array functions * that implicitly call Begin: */ int GL_PATCHES = 0xE; /** * Accepted by the <pname> parameter of PatchParameteri, GetBooleanv, * GetDoublev, GetFloatv, GetIntegerv, and GetInteger64v: */ int GL_PATCH_VERTICES = 0x8E72; /** * Accepted by the <pname> parameter of PatchParameterfv, GetBooleanv, * GetDoublev, GetFloatv, and GetIntegerv, and GetInteger64v: */ int GL_PATCH_DEFAULT_INNER_LEVEL = 0x8E73; int GL_PATCH_DEFAULT_OUTER_LEVEL = 0x8E74; /** Accepted by the <pname> parameter of GetProgramiv: */ int GL_TESS_CONTROL_OUTPUT_VERTICES = 0x8E75; int GL_TESS_GEN_MODE = 0x8E76; int GL_TESS_GEN_SPACING = 0x8E77; int GL_TESS_GEN_VERTEX_ORDER = 0x8E78; int GL_TESS_GEN_POINT_MODE = 0x8E79; /** Returned by GetProgramiv when <pname> is TESS_GEN_MODE: */ int GL_TRIANGLES = GL11.GL_TRIANGLES; int GL_QUADS = GL11.GL_QUADS; int GL_ISOLINES = 0x8E7A; /** Returned by GetProgramiv when <pname> is TESS_GEN_SPACING: */ int GL_EQUAL = GL11.GL_EQUAL; int GL_FRACTIONAL_ODD = 0x8E7B; int GL_FRACTIONAL_EVEN = 0x8E7C; /** Returned by GetProgramiv when <pname> is TESS_GEN_VERTEX_ORDER: */ int GL_CCW = GL11.GL_CCW; int GL_CW = GL11.GL_CW; /** Returned by GetProgramiv when <pname> is TESS_GEN_POINT_MODE: */ int GL_FALSE = GL11.GL_FALSE; int GL_TRUE = GL11.GL_TRUE; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetFloatv, * GetIntegerv, and GetInteger64v: */ int GL_MAX_PATCH_VERTICES = 0x8E7D; int GL_MAX_TESS_GEN_LEVEL = 0x8E7E; int GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS = 0x8E7F; int GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS = 0x8E80; int GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS = 0x8E81; int GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS = 0x8E82; int GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS = 0x8E83; int GL_MAX_TESS_PATCH_COMPONENTS = 0x8E84; int GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS = 0x8E85; int GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS = 0x8E86; int GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS = 0x8E89; int GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS = 0x8E8A; int GL_MAX_TESS_CONTROL_INPUT_COMPONENTS = 0x886C; int GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS = 0x886D; int GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS = 0x8E1E; int GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS = 0x8E1F; /** Accepted by the <pname> parameter of GetActiveUniformBlockiv: */ int GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER = 0x84F0; int GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER = 0x84F1; /** * Accepted by the <type> parameter of CreateShader and returned by the * <params> parameter of GetShaderiv: */ int GL_TESS_EVALUATION_SHADER = 0x8E87; int GL_TESS_CONTROL_SHADER = 0x8E88; @Reuse("GL40") void glPatchParameteri(@GLenum int pname, int value); @Reuse("GL40") @StripPostfix("values") void glPatchParameterfv(@GLenum int pname, @Check("4") @Const FloatBuffer values); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_fragment_program4.java0000644000175000017500000000314711543426511024572 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_fragment_program4 { }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_robustness.java0000644000175000017500000002063311543426511023443 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.*; @Dependent @DeprecatedGL public interface ARB_robustness { /** Returned by GetGraphicsResetStatusARB: */ int GL_NO_ERROR = 0x0000, GL_GUILTY_CONTEXT_RESET_ARB = 0x8253, GL_INNOCENT_CONTEXT_RESET_ARB = 0x8254, GL_UNKNOWN_CONTEXT_RESET_ARB = 0x8255; /** * Accepted by the <value> parameter of GetBooleanv, GetIntegerv, * GetInteger64v, GetFloatv, and GetDoublev: */ int GL_RESET_NOTIFICATION_STRATEGY_ARB = 0x8256; /** * Returned by GetIntegerv and related simple queries when * <value> is RESET_NOTIFICATION_STRATEGY_ARB: */ int GL_LOSE_CONTEXT_ON_RESET_ARB = 0x8252, GL_NO_RESET_NOTIFICATION_ARB = 0x8261; /** Returned by GetIntegerv when <pname> is CONTEXT_FLAGS: */ int GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB = 0x00000004; @GLenum int glGetGraphicsResetStatusARB(); @DeprecatedGL void glGetnMapdvARB(@GLenum int target, @GLenum int query, @Constant("v.remaining() << 3") @GLsizei int bufSize, @OutParameter @Check DoubleBuffer v); @DeprecatedGL void glGetnMapfvARB(@GLenum int target, @GLenum int query, @Constant("v.remaining() << 2") @GLsizei int bufSize, @OutParameter @Check FloatBuffer v); @DeprecatedGL void glGetnMapivARB(@GLenum int target, @GLenum int query, @Constant("v.remaining() << 2") @GLsizei int bufSize, @OutParameter @Check IntBuffer v); @DeprecatedGL void glGetnPixelMapfvARB(@GLenum int map, @Constant("values.remaining() << 2") @GLsizei int bufSize, @OutParameter @Check FloatBuffer values); @DeprecatedGL void glGetnPixelMapuivARB(@GLenum int map, @Constant("values.remaining() << 2") @GLsizei int bufSize, @OutParameter @Check @GLuint IntBuffer values); @DeprecatedGL void glGetnPixelMapusvARB(@GLenum int map, @Constant("values.remaining() << 1") @GLsizei int bufSize, @OutParameter @Check @GLushort ShortBuffer values); @DeprecatedGL void glGetnPolygonStippleARB(@AutoSize("pattern") @GLsizei int bufSize, @OutParameter @GLubyte ByteBuffer pattern); void glGetnTexImageARB(@GLenum int target, int level, @GLenum int format, @GLenum int type, @AutoSize("img") @GLsizei int bufSize, @OutParameter @BufferObject(BufferKind.PackPBO) @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer img); void glReadnPixelsARB(int x, int y, @GLsizei int width, @GLsizei int height, @GLenum int format, @GLenum int type, @AutoSize("data") @GLsizei int bufSize, @OutParameter @BufferObject(BufferKind.PackPBO) @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer data); @Dependent("GL_ARB_imaging") void glGetnColorTableARB(@GLenum int target, @GLenum int format, @GLenum int type, @AutoSize("table") @GLsizei int bufSize, @OutParameter @GLbyte @GLfloat @GLdouble Buffer table); @Dependent("GL_ARB_imaging") void glGetnConvolutionFilterARB(@GLenum int target, @GLenum int format, @GLenum int type, @AutoSize("image") @GLsizei int bufSize, @OutParameter @BufferObject(BufferKind.PackPBO) @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer image); @Dependent("GL_ARB_imaging") void glGetnSeparableFilterARB(@GLenum int target, @GLenum int format, @GLenum int type, @AutoSize("row") @GLsizei int rowBufSize, @OutParameter @BufferObject(BufferKind.PackPBO) @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer row, @AutoSize("column") @GLsizei int columnBufSize, @OutParameter @BufferObject(BufferKind.PackPBO) @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer column, @OutParameter @BufferObject(BufferKind.PackPBO) @Check @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer span); @Dependent("GL_ARB_imaging") void glGetnHistogramARB(@GLenum int target, boolean reset, @GLenum int format, @GLenum int type, @AutoSize("values") @GLsizei int bufSize, @OutParameter @BufferObject(BufferKind.PackPBO) @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer values); @Dependent("GL_ARB_imaging") void glGetnMinmaxARB(@GLenum int target, boolean reset, @GLenum int format, @GLenum int type, @AutoSize("values") @GLsizei int bufSize, @OutParameter @BufferObject(BufferKind.PackPBO) @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer values); @Dependent("OpenGL13") void glGetnCompressedTexImageARB(@GLenum int target, int lod, @AutoSize("img") @GLsizei int bufSize, @OutParameter @BufferObject(BufferKind.PackPBO) @GLbyte @GLshort @GLint Buffer img); @Dependent("OpenGL20") void glGetnUniformfvARB(@GLuint int program, int location, @Constant("params.remaining() << 2") @GLsizei int bufSize, @OutParameter @Check FloatBuffer params); @Dependent("OpenGL20") void glGetnUniformivARB(@GLuint int program, int location, @Constant("params.remaining() << 2") @GLsizei int bufSize, @OutParameter @Check IntBuffer params); @Dependent("OpenGL20") void glGetnUniformuivARB(@GLuint int program, int location, @Constant("params.remaining() << 2") @GLsizei int bufSize, @OutParameter @Check @GLuint IntBuffer params); @Dependent("OpenGL20") void glGetnUniformdvARB(@GLuint int program, int location, @Constant("params.remaining() << 3") @GLsizei int bufSize, @OutParameter @Check DoubleBuffer params); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_query_lod.java0000644000175000017500000000314711543426511025020 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_texture_query_lod { }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_framebuffer_multisample_coverage.java0000644000175000017500000000444711543426511027733 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLsizei; public interface NV_framebuffer_multisample_coverage { /** Accepted by the <pname> parameter of GetRenderbufferParameterivEXT. */ int GL_RENDERBUFFER_COVERAGE_SAMPLES_NV = 0x8CAB; int GL_RENDERBUFFER_COLOR_SAMPLES_NV = 0x8E10; /** Accepted by the <pname> parameter of GetIntegerv. */ int GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV = 0x8E11; int GL_MULTISAMPLE_COVERAGE_MODES_NV = 0x8E12; void glRenderbufferStorageMultisampleCoverageNV(@GLenum int target, @GLsizei int coverageSamples, @GLsizei int colorSamples, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/GL13.java0000644000175000017500000002235311543426511021217 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.*; /** *

      * The core OpenGL1.3 API. * * @author cix_foo * @version $Revision: 3460 $ * $Id: GL13.java 3460 2010-11-29 18:25:28Z spasi $ */ @DeprecatedGL public interface GL13 { int GL_TEXTURE0 = 0x84C0; int GL_TEXTURE1 = 0x84C1; int GL_TEXTURE2 = 0x84C2; int GL_TEXTURE3 = 0x84C3; int GL_TEXTURE4 = 0x84C4; int GL_TEXTURE5 = 0x84C5; int GL_TEXTURE6 = 0x84C6; int GL_TEXTURE7 = 0x84C7; int GL_TEXTURE8 = 0x84C8; int GL_TEXTURE9 = 0x84C9; int GL_TEXTURE10 = 0x84CA; int GL_TEXTURE11 = 0x84CB; int GL_TEXTURE12 = 0x84CC; int GL_TEXTURE13 = 0x84CD; int GL_TEXTURE14 = 0x84CE; int GL_TEXTURE15 = 0x84CF; int GL_TEXTURE16 = 0x84D0; int GL_TEXTURE17 = 0x84D1; int GL_TEXTURE18 = 0x84D2; int GL_TEXTURE19 = 0x84D3; int GL_TEXTURE20 = 0x84D4; int GL_TEXTURE21 = 0x84D5; int GL_TEXTURE22 = 0x84D6; int GL_TEXTURE23 = 0x84D7; int GL_TEXTURE24 = 0x84D8; int GL_TEXTURE25 = 0x84D9; int GL_TEXTURE26 = 0x84DA; int GL_TEXTURE27 = 0x84DB; int GL_TEXTURE28 = 0x84DC; int GL_TEXTURE29 = 0x84DD; int GL_TEXTURE30 = 0x84DE; int GL_TEXTURE31 = 0x84DF; int GL_ACTIVE_TEXTURE = 0x84E0; int GL_CLIENT_ACTIVE_TEXTURE = 0x84E1; int GL_MAX_TEXTURE_UNITS = 0x84E2; int GL_NORMAL_MAP = 0x8511; int GL_REFLECTION_MAP = 0x8512; int GL_TEXTURE_CUBE_MAP = 0x8513; int GL_TEXTURE_BINDING_CUBE_MAP = 0x8514; int GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; int GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; int GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; int GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; int GL_PROXY_TEXTURE_CUBE_MAP = 0x851B; int GL_MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; int GL_COMPRESSED_ALPHA = 0x84E9; int GL_COMPRESSED_LUMINANCE = 0x84EA; int GL_COMPRESSED_LUMINANCE_ALPHA = 0x84EB; int GL_COMPRESSED_INTENSITY = 0x84EC; int GL_COMPRESSED_RGB = 0x84ED; int GL_COMPRESSED_RGBA = 0x84EE; int GL_TEXTURE_COMPRESSION_HINT = 0x84EF; int GL_TEXTURE_COMPRESSED_IMAGE_SIZE = 0x86A0; int GL_TEXTURE_COMPRESSED = 0x86A1; int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2; int GL_COMPRESSED_TEXTURE_FORMATS = 0x86A3; int GL_MULTISAMPLE = 0x809D; int GL_SAMPLE_ALPHA_TO_COVERAGE = 0x809E; int GL_SAMPLE_ALPHA_TO_ONE = 0x809F; int GL_SAMPLE_COVERAGE = 0x80A0; int GL_SAMPLE_BUFFERS = 0x80A8; int GL_SAMPLES = 0x80A9; int GL_SAMPLE_COVERAGE_VALUE = 0x80AA; int GL_SAMPLE_COVERAGE_INVERT = 0x80AB; int GL_MULTISAMPLE_BIT = 0x20000000; int GL_TRANSPOSE_MODELVIEW_MATRIX = 0x84E3; int GL_TRANSPOSE_PROJECTION_MATRIX = 0x84E4; int GL_TRANSPOSE_TEXTURE_MATRIX = 0x84E5; int GL_TRANSPOSE_COLOR_MATRIX = 0x84E6; int GL_COMBINE = 0x8570; int GL_COMBINE_RGB = 0x8571; int GL_COMBINE_ALPHA = 0x8572; int GL_SOURCE0_RGB = 0x8580; int GL_SOURCE1_RGB = 0x8581; int GL_SOURCE2_RGB = 0x8582; int GL_SOURCE0_ALPHA = 0x8588; int GL_SOURCE1_ALPHA = 0x8589; int GL_SOURCE2_ALPHA = 0x858A; int GL_OPERAND0_RGB = 0x8590; int GL_OPERAND1_RGB = 0x8591; int GL_OPERAND2_RGB = 0x8592; int GL_OPERAND0_ALPHA = 0x8598; int GL_OPERAND1_ALPHA = 0x8599; int GL_OPERAND2_ALPHA = 0x859A; int GL_RGB_SCALE = 0x8573; int GL_ADD_SIGNED = 0x8574; int GL_INTERPOLATE = 0x8575; int GL_SUBTRACT = 0x84E7; int GL_CONSTANT = 0x8576; int GL_PRIMARY_COLOR = 0x8577; int GL_PREVIOUS = 0x8578; int GL_DOT3_RGB = 0x86AE; int GL_DOT3_RGBA = 0x86AF; int GL_CLAMP_TO_BORDER = 0x812D; void glActiveTexture(@GLenum int texture); @Code("\t\tStateTracker.getReferences(caps).glClientActiveTexture = texture - GL_TEXTURE0;") @DeprecatedGL void glClientActiveTexture(@GLenum int texture); void glCompressedTexImage1D(@GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, int border, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid Buffer data); void glCompressedTexImage2D(@GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, int border, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer data); void glCompressedTexImage3D(@GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, int border, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer data); void glCompressedTexSubImage1D(@GLenum int target, int level, int xoffset, @GLsizei int width, @GLenum int format, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer data); void glCompressedTexSubImage2D(@GLenum int target, int level, int xoffset, int yoffset, @GLsizei int width, @GLsizei int height, @GLenum int format, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer data); void glCompressedTexSubImage3D(@GLenum int target, int level, int xoffset, int yoffset, int zoffset, @GLsizei int width, @GLsizei int height, @GLsizei int depth, @GLenum int format, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer data); // TODO: check buffer size valid void glGetCompressedTexImage(@GLenum int target, int lod, @OutParameter @BufferObject(BufferKind.PackPBO) @Check @GLbyte @GLshort @GLint Buffer img); @NoErrorCheck @DeprecatedGL void glMultiTexCoord1f(@GLenum int target, float s); @NoErrorCheck @DeprecatedGL void glMultiTexCoord1d(@GLenum int target, double s); @NoErrorCheck @DeprecatedGL void glMultiTexCoord2f(@GLenum int target, float s, float t); @NoErrorCheck @DeprecatedGL void glMultiTexCoord2d(@GLenum int target, double s, double t); @NoErrorCheck @DeprecatedGL void glMultiTexCoord3f(@GLenum int target, float s, float t, float r); @NoErrorCheck @DeprecatedGL void glMultiTexCoord3d(@GLenum int target, double s, double t, double r); @NoErrorCheck @DeprecatedGL void glMultiTexCoord4f(@GLenum int target, float s, float t, float r, float q); @NoErrorCheck @DeprecatedGL void glMultiTexCoord4d(@GLenum int target, double s, double t, double r, double q); @StripPostfix("m") @DeprecatedGL void glLoadTransposeMatrixf(@Check("16") @Const FloatBuffer m); @StripPostfix("m") @DeprecatedGL void glLoadTransposeMatrixd(@Check("16") @Const DoubleBuffer m); @StripPostfix("m") @DeprecatedGL void glMultTransposeMatrixf(@Check("16") @Const FloatBuffer m); @StripPostfix("m") @DeprecatedGL void glMultTransposeMatrixd(@Check("16") @Const DoubleBuffer m); void glSampleCoverage(@GLclampf float value, boolean invert); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/AMD_transform_feedback3_lines_triangles.java0000644000175000017500000000317211543426511030374 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface AMD_transform_feedback3_lines_triangles { }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_gpu_program4.java0000644000175000017500000001123111543426511023553 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.IntBuffer; public interface NV_gpu_program4 { /** Accepted by the <pname> parameter of GetProgramivARB: */ int GL_PROGRAM_ATTRIB_COMPONENTS_NV = 0x8906; int GL_PROGRAM_RESULT_COMPONENTS_NV = 0x8907; int GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV = 0x8908; int GL_MAX_PROGRAM_RESULT_COMPONENTS_NV = 0x8909; int GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV = 0x8DA5; int GL_MAX_PROGRAM_GENERIC_RESULTS_NV = 0x8DA6; // --- void glProgramLocalParameterI4iNV(@GLenum int target, @GLuint int index, int x, int y, int z, int w); @StripPostfix("params") void glProgramLocalParameterI4ivNV(@GLenum int target, @GLuint int index, @Check("4") @Const IntBuffer params); @StripPostfix("params") void glProgramLocalParametersI4ivNV(@GLenum int target, @GLuint int index, @AutoSize(value = "params", expression = " >> 2") @GLsizei int count, @Const IntBuffer params); // --- void glProgramLocalParameterI4uiNV(@GLenum int target, @GLuint int index, @GLuint int x, @GLuint int y, @GLuint int z, @GLuint int w); @StripPostfix("params") void glProgramLocalParameterI4uivNV(@GLenum int target, @GLuint int index, @Check("4") @Const @GLuint IntBuffer params); @StripPostfix("params") void glProgramLocalParametersI4uivNV(@GLenum int target, @GLuint int index, @AutoSize(value = "params", expression = " >> 2") @GLsizei int count, @Const @GLuint IntBuffer params); // --- void glProgramEnvParameterI4iNV(@GLenum int target, @GLuint int index, int x, int y, int z, int w); @StripPostfix("params") void glProgramEnvParameterI4ivNV(@GLenum int target, @GLuint int index, @Check("4") @Const IntBuffer params); @StripPostfix("params") void glProgramEnvParametersI4ivNV(@GLenum int target, @GLuint int index, @AutoSize(value = "params", expression = " >> 2") @GLsizei int count, @Const IntBuffer params); // --- void glProgramEnvParameterI4uiNV(@GLenum int target, @GLuint int index, @GLuint int x, @GLuint int y, @GLuint int z, @GLuint int w); @StripPostfix("params") void glProgramEnvParameterI4uivNV(@GLenum int target, @GLuint int index, @Check("4") @Const @GLuint IntBuffer params); @StripPostfix("params") void glProgramEnvParametersI4uivNV(@GLenum int target, @GLuint int index, @AutoSize(value = "params", expression = " >> 2") @GLsizei int count, @Const @GLuint IntBuffer params); // --- @StripPostfix("params") void glGetProgramLocalParameterIivNV(@GLenum int target, @GLuint int index, @OutParameter @Check("4") IntBuffer params); @StripPostfix("params") void glGetProgramLocalParameterIuivNV(@GLenum int target, @GLuint int index, @OutParameter @Check("4") @GLuint IntBuffer params); // --- @StripPostfix("params") void glGetProgramEnvParameterIivNV(@GLenum int target, @GLuint int index, @OutParameter @Check("4")IntBuffer params); @StripPostfix("params") void glGetProgramEnvParameterIuivNV(@GLenum int target, @GLuint int index, @OutParameter @Check("4") @GLuint IntBuffer params); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_compression.java0000644000175000017500000001220611543426511025352 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLvoid; import java.nio.*; public interface ARB_texture_compression { int GL_COMPRESSED_ALPHA_ARB = 0x84E9; int GL_COMPRESSED_LUMINANCE_ARB = 0x84EA; int GL_COMPRESSED_LUMINANCE_ALPHA_ARB = 0x84EB; int GL_COMPRESSED_INTENSITY_ARB = 0x84EC; int GL_COMPRESSED_RGB_ARB = 0x84ED; int GL_COMPRESSED_RGBA_ARB = 0x84EE; int GL_TEXTURE_COMPRESSION_HINT_ARB = 0x84EF; int GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = 0x86A0; int GL_TEXTURE_COMPRESSED_ARB = 0x86A1; int GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = 0x86A2; int GL_COMPRESSED_TEXTURE_FORMATS_ARB = 0x86A3; void glCompressedTexImage1DARB(@GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, int border, @AutoSize("pData") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer pData); void glCompressedTexImage2DARB(@GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, int border, @AutoSize("pData") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer pData); void glCompressedTexImage3DARB(@GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, int border, @AutoSize("pData") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer pData); void glCompressedTexSubImage1DARB(@GLenum int target, int level, int xoffset, @GLsizei int width, @GLenum int format, @AutoSize("pData") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer pData); void glCompressedTexSubImage2DARB(@GLenum int target, int level, int xoffset, int yoffset, @GLsizei int width, @GLsizei int height, @GLenum int format, @AutoSize("pData") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer pData); void glCompressedTexSubImage3DARB(@GLenum int target, int level, int xoffset, int yoffset, int zoffset, @GLsizei int width, @GLsizei int height, @GLsizei int depth, @GLenum int format, @AutoSize("pData") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLvoid ByteBuffer pData); void glGetCompressedTexImageARB(@GLenum int target, int lod, @OutParameter @BufferObject(BufferKind.PackPBO) @Check @GLvoid ByteBuffer pImg); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/APPLE_texture_range.java0000644000175000017500000000537011543426511024346 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLvoid; import java.nio.Buffer; import java.nio.ByteBuffer; public interface APPLE_texture_range { /** * Accepted by the parameters of TexParameteri, TexParameterf, * TexParameteriv, TexParameterfv, GetTexParameteriv, and * GetTexParameterfv: */ int GL_TEXTURE_STORAGE_HINT_APPLE = 0x85BC; /** * Accepted by the parameters of TexParameteri, TexParameterf, * TexParameteriv, and TexParameterfv: */ int GL_STORAGE_PRIVATE_APPLE = 0x85BD; int GL_STORAGE_CACHED_APPLE = 0x85BE; int GL_STORAGE_SHARED_APPLE = 0x85BF; /** * Accepted by the parameters of GetTexParameteriv and * GetTexParameterfv: */ int GL_TEXTURE_RANGE_LENGTH_APPLE = 0x85B7; /** Accepted by the parameters of GetTexParameterPointerv: */ int GL_TEXTURE_RANGE_POINTER_APPLE = 0x85B8; void glTextureRangeAPPLE(@GLenum int target, @AutoSize("pointer") @GLsizei int length, @GLvoid ByteBuffer pointer); void glGetTexParameterPointervAPPLE(@GLenum int target, @GLenum int pname, @Result @GLvoid Buffer params); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/SGIS_generate_mipmap.java0000644000175000017500000000403611543426511024531 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; public interface SGIS_generate_mipmap { /** * Accepted by the <pname> parameter of TexParameteri, TexParameterf, * TexParameteriv, TexParameterfv, GetTexParameteriv, and GetTexParameterfv. */ int GL_GENERATE_MIPMAP_SGIS = 0x8191; /** * Accepted by the <target> parameter of Hint, and by the * parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev. */ int GL_GENERATE_MIPMAP_HINT_SGIS = 0x8192; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_shared_exponent.java0000644000175000017500000000460711543426511026241 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_texture_shared_exponent { /** * Accepted by the <internalformat> parameter of TexImage1D, * TexImage2D, TexImage3D, CopyTexImage1D, CopyTexImage2D, and * RenderbufferStorageEXT: */ int GL_RGB9_E5_EXT = 0x8C3D; /** * Accepted by the <type> parameter of DrawPixels, ReadPixels, * TexImage1D, TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, * TexSubImage2D, TexSubImage3D, GetHistogram, GetMinmax, * ConvolutionFilter1D, ConvolutionFilter2D, ConvolutionFilter3D, * GetConvolutionFilter, SeparableFilter2D, GetSeparableFilter, * ColorTable, ColorSubTable, and GetColorTable: */ int GL_UNSIGNED_INT_5_9_9_9_REV_EXT = 0x8C3E; /** * Accepted by the <pname> parameter of GetTexLevelParameterfv and * GetTexLevelParameteriv: */ int GL_TEXTURE_SHARED_SIZE_EXT = 0x8C3F; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_fragment_program.java0000644000175000017500000000644511543426511024512 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLubyte; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.*; public interface NV_fragment_program extends NV_program { /** * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, by the * <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev, * and by the <target> parameter of BindProgramNV, LoadProgramNV, * ProgramLocalParameter4dARB, ProgramLocalParameter4dvARB, * ProgramLocalParameter4fARB, ProgramLocalParameter4fvARB, * GetProgramLocalParameterdvARB, and GetProgramLocalParameterfvARB: */ int GL_FRAGMENT_PROGRAM_NV = 0x8870; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_MAX_TEXTURE_COORDS_NV = 0x8871; int GL_MAX_TEXTURE_IMAGE_UNITS_NV = 0x8872; int GL_FRAGMENT_PROGRAM_BINDING_NV = 0x8873; int GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV = 0x8868; void glProgramNamedParameter4fNV(@GLuint int id, @AutoSize("name") @GLsizei int length, @Const @GLubyte ByteBuffer name, float x, float y, float z, float w); void glProgramNamedParameter4dNV(@GLuint int id, @AutoSize("name") @GLsizei int length, @Const @GLubyte ByteBuffer name, double x, double y, double z, double w); @StripPostfix("params") void glGetProgramNamedParameterfvNV(@GLuint int id, @AutoSize("name") @GLsizei int length, @Const @GLubyte ByteBuffer name, @OutParameter @Check("4") FloatBuffer params); @StripPostfix("params") void glGetProgramNamedParameterdvNV(@GLuint int id, @AutoSize("name") @GLsizei int length, @Const @GLubyte ByteBuffer name, @OutParameter @Check("4") DoubleBuffer params); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_framebuffer_sRGB.java0000644000175000017500000000465511543426511024403 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_framebuffer_sRGB { /** * Accepted by the <attribList> parameter of glXChooseVisual, and by * the <attrib> parameter of glXGetConfig: */ int GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB = 0x20B2; /** * Accepted by the <piAttributes> parameter of * wglGetPixelFormatAttribivEXT, wglGetPixelFormatAttribfvEXT, and * the <piAttribIList> and <pfAttribIList> of wglChoosePixelFormatEXT: */ int WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB = 0x20A9; /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, * and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_FRAMEBUFFER_SRGB_ARB = 0x8DB9; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_FRAMEBUFFER_SRGB_CAPABLE_ARB = 0x8DBA; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ATI_vertex_attrib_array_object.java0000644000175000017500000000440711543426511026654 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.*; public interface ATI_vertex_attrib_array_object { void glVertexAttribArrayObjectATI(@GLuint int index, int size, @GLenum int type, boolean normalized, @GLsizei int stride, @GLuint int buffer, @GLuint int offset); @StripPostfix("params") void glGetVertexAttribArrayObjectfvATI(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @StripPostfix("params") void glGetVertexAttribArrayObjectivATI(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/AMD_draw_buffers_blend.java0000644000175000017500000000423411543426511025045 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLuint; public interface AMD_draw_buffers_blend { void glBlendFuncIndexedAMD(@GLuint int buf, @GLenum int src, @GLenum int dst); void glBlendFuncSeparateIndexedAMD(@GLuint int buf, @GLenum int srcRGB, @GLenum int dstRGB, @GLenum int srcAlpha, @GLenum int dstAlpha); void glBlendEquationIndexedAMD(@GLuint int buf, @GLenum int mode); void glBlendEquationSeparateIndexedAMD(@GLuint int buf, @GLenum int modeRGB, @GLenum int modeAlpha); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_pixel_data_range.java0000644000175000017500000000525511543426511024444 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.*; public interface NV_pixel_data_range { /** * Accepted by the <target> parameter of PixelDataRangeNV and * FlushPixelDataRangeNV, and by the <cap> parameter of * EnableClientState, DisableClientState, and IsEnabled: */ int GL_WRITE_PIXEL_DATA_RANGE_NV = 0x8878; int GL_READ_PIXEL_DATA_RANGE_NV = 0x8879; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV = 0x887A; int GL_READ_PIXEL_DATA_RANGE_LENGTH_NV = 0x887B; /** * Accepted by the <pname> parameter of GetPointerv: */ int GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV = 0x887C; int GL_READ_PIXEL_DATA_RANGE_POINTER_NV = 0x887D; void glPixelDataRangeNV(@GLenum int target, @AutoSize("data") @GLsizei int length, @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer data); void glFlushPixelDataRangeNV(@GLenum int target); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_imaging.java0000644000175000017500000003142511543426511022650 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.*; /** *

      * The GL12 imaging subset extension. * * @author cix_foo * @version $Revision: 3412 $ * $Id: ARB_imaging.java 3412 2010-09-26 23:43:24Z spasi $ */ @Extension(postfix = "") @DeprecatedGL public interface ARB_imaging { int GL_CONSTANT_COLOR = 0x8001; int GL_ONE_MINUS_CONSTANT_COLOR = 0x8002; int GL_CONSTANT_ALPHA = 0x8003; int GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004; int GL_BLEND_COLOR = 0x8005; int GL_FUNC_ADD = 0x8006; int GL_MIN = 0x8007; int GL_MAX = 0x8008; int GL_BLEND_EQUATION = 0x8009; int GL_FUNC_SUBTRACT = 0x800A; int GL_FUNC_REVERSE_SUBTRACT = 0x800B; int GL_COLOR_MATRIX = 0x80B1; int GL_COLOR_MATRIX_STACK_DEPTH = 0x80B2; int GL_MAX_COLOR_MATRIX_STACK_DEPTH = 0x80B3; int GL_POST_COLOR_MATRIX_RED_SCALE = 0x80B4; int GL_POST_COLOR_MATRIX_GREEN_SCALE = 0x80B5; int GL_POST_COLOR_MATRIX_BLUE_SCALE = 0x80B6; int GL_POST_COLOR_MATRIX_ALPHA_SCALE = 0x80B7; int GL_POST_COLOR_MATRIX_RED_BIAS = 0x80B8; int GL_POST_COLOR_MATRIX_GREEN_BIAS = 0x80B9; int GL_POST_COLOR_MATRIX_BLUE_BIAS = 0x80BA; int GL_POST_COLOR_MATRIX_ALPHA_BIAS = 0x80BB; int GL_COLOR_TABLE = 0x80D0; int GL_POST_CONVOLUTION_COLOR_TABLE = 0x80D1; int GL_POST_COLOR_MATRIX_COLOR_TABLE = 0x80D2; int GL_PROXY_COLOR_TABLE = 0x80D3; int GL_PROXY_POST_CONVOLUTION_COLOR_TABLE = 0x80D4; int GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE = 0x80D5; int GL_COLOR_TABLE_SCALE = 0x80D6; int GL_COLOR_TABLE_BIAS = 0x80D7; int GL_COLOR_TABLE_FORMAT = 0x80D8; int GL_COLOR_TABLE_WIDTH = 0x80D9; int GL_COLOR_TABLE_RED_SIZE = 0x80DA; int GL_COLOR_TABLE_GREEN_SIZE = 0x80DB; int GL_COLOR_TABLE_BLUE_SIZE = 0x80DC; int GL_COLOR_TABLE_ALPHA_SIZE = 0x80DD; int GL_COLOR_TABLE_LUMINANCE_SIZE = 0x80DE; int GL_COLOR_TABLE_INTENSITY_SIZE = 0x80DF; int GL_CONVOLUTION_1D = 0x8010; int GL_CONVOLUTION_2D = 0x8011; int GL_SEPARABLE_2D = 0x8012; int GL_CONVOLUTION_BORDER_MODE = 0x8013; int GL_CONVOLUTION_FILTER_SCALE = 0x8014; int GL_CONVOLUTION_FILTER_BIAS = 0x8015; int GL_REDUCE = 0x8016; int GL_CONVOLUTION_FORMAT = 0x8017; int GL_CONVOLUTION_WIDTH = 0x8018; int GL_CONVOLUTION_HEIGHT = 0x8019; int GL_MAX_CONVOLUTION_WIDTH = 0x801A; int GL_MAX_CONVOLUTION_HEIGHT = 0x801B; int GL_POST_CONVOLUTION_RED_SCALE = 0x801C; int GL_POST_CONVOLUTION_GREEN_SCALE = 0x801D; int GL_POST_CONVOLUTION_BLUE_SCALE = 0x801E; int GL_POST_CONVOLUTION_ALPHA_SCALE = 0x801F; int GL_POST_CONVOLUTION_RED_BIAS = 0x8020; int GL_POST_CONVOLUTION_GREEN_BIAS = 0x8021; int GL_POST_CONVOLUTION_BLUE_BIAS = 0x8022; int GL_POST_CONVOLUTION_ALPHA_BIAS = 0x8023; int GL_IGNORE_BORDER = 0x8150; int GL_CONSTANT_BORDER = 0x8151; int GL_REPLICATE_BORDER = 0x8153; int GL_CONVOLUTION_BORDER_COLOR = 0x8154; int GL_HISTOGRAM = 0x8024; int GL_PROXY_HISTOGRAM = 0x8025; int GL_HISTOGRAM_WIDTH = 0x8026; int GL_HISTOGRAM_FORMAT = 0x8027; int GL_HISTOGRAM_RED_SIZE = 0x8028; int GL_HISTOGRAM_GREEN_SIZE = 0x8029; int GL_HISTOGRAM_BLUE_SIZE = 0x802A; int GL_HISTOGRAM_ALPHA_SIZE = 0x802B; int GL_HISTOGRAM_LUMINANCE_SIZE = 0x802C; int GL_HISTOGRAM_SINK = 0x802D; int GL_MINMAX = 0x802E; int GL_MINMAX_FORMAT = 0x802F; int GL_MINMAX_SINK = 0x8030; int GL_TABLE_TOO_LARGE = 0x8031; @DeprecatedGL void glColorTable(@GLenum int target, @GLenum int internalFormat, @GLsizei int width, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check("256") @Const @GLbyte @GLfloat @GLdouble Buffer data); @DeprecatedGL void glColorSubTable(@GLenum int target, @GLsizei int start, @GLsizei int count, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check("256") @Const @GLbyte @GLfloat @GLdouble Buffer data); @StripPostfix("params") @DeprecatedGL void glColorTableParameteriv(@GLenum int target, @GLenum int pname, @Check("4") @Const IntBuffer params); @StripPostfix("params") @DeprecatedGL void glColorTableParameterfv(@GLenum int target, @GLenum int pname, @Check("4") @Const FloatBuffer params); @DeprecatedGL void glCopyColorSubTable(@GLenum int target, @GLsizei int start, int x, int y, @GLsizei int width); @DeprecatedGL void glCopyColorTable(@GLenum int target, @GLenum int internalformat, int x, int y, @GLsizei int width); @DeprecatedGL void glGetColorTable(@GLenum int target, @GLenum int format, @GLenum int type, @OutParameter @Check("256") @GLbyte @GLfloat @GLdouble Buffer data); @StripPostfix("params") @DeprecatedGL void glGetColorTableParameteriv(@GLenum int target, @GLenum int pname, @Check("4") IntBuffer params); @StripPostfix("params") @DeprecatedGL void glGetColorTableParameterfv(@GLenum int target, @GLenum int pname, @Check("4") FloatBuffer params); @Reuse("GL14") void glBlendEquation(@GLenum int mode); @Reuse("GL14") void glBlendColor(@GLclampf float red, @GLclampf float green, @GLclampf float blue, @GLclampf float alpha); @DeprecatedGL void glHistogram(@GLenum int target, @GLsizei int width, @GLenum int internalformat, boolean sink); @DeprecatedGL void glResetHistogram(@GLenum int target); @DeprecatedGL void glGetHistogram(@GLenum int target, boolean reset, @GLenum int format, @GLenum int type, @OutParameter @BufferObject(BufferKind.PackPBO) @Check("256") @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer values); @StripPostfix("params") @DeprecatedGL void glGetHistogramParameterfv(@GLenum int target, @GLenum int pname, @OutParameter @Check("256") FloatBuffer params); @StripPostfix("params") @DeprecatedGL void glGetHistogramParameteriv(@GLenum int target, @GLenum int pname, @OutParameter @Check("256") IntBuffer params); @DeprecatedGL void glMinmax(@GLenum int target, @GLenum int internalformat, boolean sink); @DeprecatedGL void glResetMinmax(@GLenum int target); @DeprecatedGL void glGetMinmax(@GLenum int target, boolean reset, @GLenum int format, @GLenum int types, @OutParameter @BufferObject(BufferKind.PackPBO) @Check("4") @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer values); @StripPostfix("params") @DeprecatedGL void glGetMinmaxParameterfv(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @StripPostfix("params") @DeprecatedGL void glGetMinmaxParameteriv(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @DeprecatedGL void glConvolutionFilter1D(@GLenum int target, @GLenum int internalformat, @GLsizei int width, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check("GLChecks.calculateImageStorage(image, format, type, width, 1, 1)") @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer image); @DeprecatedGL void glConvolutionFilter2D(@GLenum int target, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check("GLChecks.calculateImageStorage(image, format, type, width, height, 1)") @Const @GLbyte @GLshort @GLint Buffer image); @DeprecatedGL void glConvolutionParameterf(@GLenum int target, @GLenum int pname, float params); @StripPostfix("params") @DeprecatedGL void glConvolutionParameterfv(@GLenum int target, @GLenum int pname, @Check("4") @Const FloatBuffer params); @DeprecatedGL void glConvolutionParameteri(@GLenum int target, @GLenum int pname, int params); @StripPostfix("params") @DeprecatedGL void glConvolutionParameteriv(@GLenum int target, @GLenum int pname, @Check("4") @Const IntBuffer params); @DeprecatedGL void glCopyConvolutionFilter1D(@GLenum int target, @GLenum int internalformat, int x, int y, @GLsizei int width); @DeprecatedGL void glCopyConvolutionFilter2D(@GLenum int target, @GLenum int internalformat, int x, int y, @GLsizei int width, @GLsizei int height); // TODO: check buffer size valid @DeprecatedGL void glGetConvolutionFilter(@GLenum int target, @GLenum int format, @GLenum int type, @OutParameter @BufferObject(BufferKind.PackPBO) @Check @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer image); @StripPostfix("params") @DeprecatedGL void glGetConvolutionParameterfv(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @StripPostfix("params") @DeprecatedGL void glGetConvolutionParameteriv(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); // TODO: check buffer size valid @DeprecatedGL void glSeparableFilter2D(@GLenum int target, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, @GLenum int format, @GLenum int type, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer row, @BufferObject(BufferKind.UnpackPBO) @Check @Const @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer column); // TODO: check buffer size valid @DeprecatedGL void glGetSeparableFilter(@GLenum int target, @GLenum int format, @GLenum int type, @OutParameter @BufferObject(BufferKind.PackPBO) @Check @GLbyte @GLshort @GLint @GLfloat @GLdouble Buffer row, @BufferObject(BufferKind.PackPBO) @Check @GLbyte @GLshort @GLint @GLdouble Buffer column, @BufferObject(BufferKind.PackPBO) @Check @GLbyte @GLshort @GLint @GLdouble Buffer span); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/APPLE_client_storage.java0000644000175000017500000000332611543426511024473 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface APPLE_client_storage { /** Accepted by the <pname> parameters of PixelStore: */ int GL_UNPACK_CLIENT_STORAGE_APPLE = 0x85B2; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_mirror_clamp.java0000644000175000017500000000376011543426511025540 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_texture_mirror_clamp { /** * Accepted by the <param> parameter of TexParameteri and TexParameterf, * and by the <params> parameter of TexParameteriv and TexParameterfv, * when their <pname> parameter is TEXTURE_WRAP_S, TEXTURE_WRAP_T, * or TEXTURE_WRAP_R: */ int GL_MIRROR_CLAMP_EXT = 0x8742; int GL_MIRROR_CLAMP_TO_EDGE_EXT = 0x8743; int GL_MIRROR_CLAMP_TO_BORDER_EXT = 0x8912; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_compression_rgtc.java0000644000175000017500000000412311543426511026370 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.Extension; @Extension(postfix = "ARB", className = "ARBTextureCompressionRGTC") public interface ARB_texture_compression_rgtc { /** * Accepted by the <internalformat> parameter of TexImage2D, * CopyTexImage2D, and CompressedTexImage2D and the <format> parameter * of CompressedTexSubImage2D: */ int GL_COMPRESSED_RED_RGTC1 = 0x8DBB; int GL_COMPRESSED_SIGNED_RED_RGTC1 = 0x8DBC; int GL_COMPRESSED_RED_GREEN_RGTC2 = 0x8DBD; int GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2 = 0x8DBE; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_fragment_program2.java0000644000175000017500000000362311543426511024567 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_fragment_program2 { /** * Accepted by the <pname> parameter of GetProgramivARB: */ int GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV = 0x88F4; int GL_MAX_PROGRAM_CALL_DEPTH_NV = 0x88F5; int GL_MAX_PROGRAM_IF_DEPTH_NV = 0x88F6; int GL_MAX_PROGRAM_LOOP_DEPTH_NV = 0x88F7; int GL_MAX_PROGRAM_LOOP_COUNT_NV = 0x88F8; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_swizzle.java0000644000175000017500000000414511543426511024557 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_texture_swizzle { /** * Accepted by the <pname> parameters of TexParameteri, * TexParameterf, TexParameteriv, TexParameterfv, * GetTexParameterfv, and GetTexParameteriv: */ int GL_TEXTURE_SWIZZLE_R_EXT = 0x8E42; int GL_TEXTURE_SWIZZLE_G_EXT = 0x8E43; int GL_TEXTURE_SWIZZLE_B_EXT = 0x8E44; int GL_TEXTURE_SWIZZLE_A_EXT = 0x8E45; /** * Accepted by the <pname> parameters of TexParameteriv, * TexParameterfv, GetTexParameterfv, and GetTexParameteriv: */ int GL_TEXTURE_SWIZZLE_RGBA_EXT = 0x8E46; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_evaluators.java0000644000175000017500000001034611543426511023340 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLfloat; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.*; public interface NV_evaluators { int GL_EVAL_2D_NV = 0x86C0; int GL_EVAL_TRIANGULAR_2D_NV = 0x86C1; int GL_MAP_TESSELLATION_NV = 0x86C2; int GL_MAP_ATTRIB_U_ORDER_NV = 0x86C3; int GL_MAP_ATTRIB_V_ORDER_NV = 0x86C4; int GL_EVAL_FRACTIONAL_TESSELLATION_NV = 0x86C5; int GL_EVAL_VERTEX_ATTRIB0_NV = 0x86C6; int GL_EVAL_VERTEX_ATTRIB1_NV = 0x86C7; int GL_EVAL_VERTEX_ATTRIB2_NV = 0x86C8; int GL_EVAL_VERTEX_ATTRIB3_NV = 0x86C9; int GL_EVAL_VERTEX_ATTRIB4_NV = 0x86CA; int GL_EVAL_VERTEX_ATTRIB5_NV = 0x86CB; int GL_EVAL_VERTEX_ATTRIB6_NV = 0x86CC; int GL_EVAL_VERTEX_ATTRIB7_NV = 0x86CD; int GL_EVAL_VERTEX_ATTRIB8_NV = 0x86CE; int GL_EVAL_VERTEX_ATTRIB9_NV = 0x86CF; int GL_EVAL_VERTEX_ATTRIB10_NV = 0x86D0; int GL_EVAL_VERTEX_ATTRIB11_NV = 0x86D1; int GL_EVAL_VERTEX_ATTRIB12_NV = 0x86D2; int GL_EVAL_VERTEX_ATTRIB13_NV = 0x86D3; int GL_EVAL_VERTEX_ATTRIB14_NV = 0x86D4; int GL_EVAL_VERTEX_ATTRIB15_NV = 0x86D5; int GL_MAX_MAP_TESSELLATION_NV = 0x86D6; int GL_MAX_RATIONAL_EVAL_ORDER_NV = 0x86D7; void glGetMapControlPointsNV(@GLenum int target, @GLuint int index, @GLenum int type, @GLsizei int ustride, @GLsizei int vstride, boolean packed, @OutParameter @Check @Const @GLfloat Buffer pPoints); void glMapControlPointsNV(@GLenum int target, @GLuint int index, @GLenum int type, @GLsizei int ustride, @GLsizei int vstride, int uorder, int vorder, boolean packed, @Check @Const @GLfloat Buffer pPoints); @StripPostfix("params") void glMapParameterfvNV(@GLenum int target, @GLenum int pname, @Check("4") @Const FloatBuffer params); @StripPostfix("params") void glMapParameterivNV(@GLenum int target, @GLenum int pname, @Check("4") @Const IntBuffer params); @StripPostfix("params") void glGetMapParameterfvNV(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") @Const FloatBuffer params); @StripPostfix("params") void glGetMapParameterivNV(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") @Const IntBuffer params); @StripPostfix("params") void glGetMapAttribParameterfvNV(@GLenum int target, @GLuint int index, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @StripPostfix("params") void glGetMapAttribParameterivNV(@GLenum int target, @GLuint int index, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); void glEvalMapsNV(@GLenum int target, @GLenum int mode); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_instanced_arrays.java0000644000175000017500000000361611543426511024567 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLuint; public interface ARB_instanced_arrays { /** * Accepted by the <pname> parameters of GetVertexAttribdv, * GetVertexAttribfv, and GetVertexAttribiv: */ int GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB = 0x88FE; void glVertexAttribDivisorARB(@GLuint int index, @GLuint int divisor); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_env_dot3.java0000644000175000017500000000324611543426511024536 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_texture_env_dot3 { int GL_DOT3_RGB_ARB = 0x86AE; int GL_DOT3_RGBA_ARB = 0x86AF; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/AMD_debug_output.java0000644000175000017500000001162111543426511023734 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.PointerWrapper; import org.lwjgl.util.generator.Alias; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.ByteBuffer; import java.nio.IntBuffer; @Alias(value = "AMDX_debug_output", postfix = "X") public interface AMD_debug_output { /** Tokens accepted by GetIntegerv: */ int GL_MAX_DEBUG_MESSAGE_LENGTH_AMD = 0x9143, GL_MAX_DEBUG_LOGGED_MESSAGES_AMD = 0x9144, GL_DEBUG_LOGGED_MESSAGES_AMD = 0x9145; /** * Tokens accepted by DebugMessageEnableAMD, GetDebugMessageLogAMD, * DebugMessageInsertAMD, and DEBUGPROCAMD callback function * for <severity>: */ int GL_DEBUG_SEVERITY_HIGH_AMD = 0x9146, GL_DEBUG_SEVERITY_MEDIUM_AMD = 0x9147, GL_DEBUG_SEVERITY_LOW_AMD = 0x9148; /** * Tokens accepted by DebugMessageEnableAMD, GetDebugMessageLogAMD, * and DEBUGPROCAMD callback function for <category>: */ int GL_DEBUG_CATEGORY_API_ERROR_AMD = 0x9149, GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD = 0x914A, GL_DEBUG_CATEGORY_DEPRECATION_AMD = 0x914B, GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD = 0x914C, GL_DEBUG_CATEGORY_PERFORMANCE_AMD = 0x914D, GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD = 0x914E, GL_DEBUG_CATEGORY_APPLICATION_AMD = 0x914F, GL_DEBUG_CATEGORY_OTHER_AMD = 0x9150; void glDebugMessageEnableAMD(@GLenum int category, @GLenum int severity, @AutoSize(value = "ids", canBeNull = true) @GLsizei int count, @Check(canBeNull = true) @Const @GLuint IntBuffer ids, boolean enabled); void glDebugMessageInsertAMD(@GLenum int category, @GLenum int severity, @GLuint int id, @AutoSize("buf") @GLsizei int length, @Const @GLchar ByteBuffer buf); @Alternate("glDebugMessageInsertAMD") void glDebugMessageInsertAMD(@GLenum int category, @GLenum int severity, @GLuint int id, @Constant("buf.length()") @GLsizei int length, CharSequence buf); /** * The {@code AMDDebugOutputCallback.Handler} implementation passed to this method will be used for * AMD_debug_output messages. If callback is null, any previously registered handler for the current * thread will be unregistered and stop receiving messages. * * @param callback the callback function to use */ @Code( // Create a GlobalRef to the callback object and register it with the current context. javaBeforeNative = "\t\tlong userParam = callback == null ? 0 : CallbackUtil.createGlobalRef(callback.getHandler());\n" + "\t\tCallbackUtil.registerContextCallbackAMD(userParam);" ) void glDebugMessageCallbackAMD(@PointerWrapper(value = "GLDEBUGPROCAMD", canBeNull = true) AMDDebugOutputCallback callback, @Constant("userParam") @PointerWrapper("GLvoid *") long userParam); @GLuint int glGetDebugMessageLogAMD(@GLuint int count, @AutoSize(value = "messageLog", canBeNull = true) @GLsizei int logSize, @Check(value = "count", canBeNull = true) @GLenum IntBuffer categories, @Check(value = "count", canBeNull = true) @GLuint IntBuffer severities, @Check(value = "count", canBeNull = true) @GLuint IntBuffer ids, @Check(value = "count", canBeNull = true) @GLsizei IntBuffer lengths, @Check(canBeNull = true) @OutParameter @GLchar ByteBuffer messageLog); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_half_float_pixel.java0000644000175000017500000000377111543426511024540 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_half_float_pixel { /** * Accepted by the <type> parameter of DrawPixels, ReadPixels, * TexImage1D, TexImage2D, TexImage3D, GetTexImage, TexSubImage1D, * TexSubImage2D, TexSubImage3D, GetHistogram, GetMinmax, * ConvolutionFilter1D, ConvolutionFilter2D, GetConvolutionFilter, * SeparableFilter2D, GetSeparableFilter, ColorTable, ColorSubTable, * and GetColorTable: */ int GL_HALF_FLOAT_ARB = 0x140B; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_fragment_program_option.java0000644000175000017500000000315511543426511026075 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_fragment_program_option { } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_timer_query.java0000644000175000017500000000565011543426511023603 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.LongBuffer; @Extension(postfix = "") public interface ARB_timer_query { /** * Accepted by the <target> parameter of BeginQuery, EndQuery, and * GetQueryiv: */ int GL_TIME_ELAPSED = 0x88BF; /** * Accepted by the <target> parameter of GetQueryiv and QueryCounter. * Accepted by the <value> parameter of GetBooleanv, GetIntegerv, * GetInteger64v, GetFloatv, and GetDoublev: */ int GL_TIMESTAMP = 0x8E28; @Reuse("GL33") void glQueryCounter(@GLuint int id, @GLenum int target); @Reuse("GL33") @StripPostfix("params") void glGetQueryObjecti64v(@GLuint int id, @GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer params); @Reuse("GL33") @Alternate("glGetQueryObjecti64v") @GLreturn("params") @StripPostfix("params") void glGetQueryObjecti64v2(@GLuint int id, @GLenum int pname, @OutParameter @GLint64 LongBuffer params); @Reuse("GL33") @StripPostfix("params") void glGetQueryObjectui64v(@GLuint int id, @GLenum int pname, @OutParameter @Check("1") @GLuint64 LongBuffer params); @Reuse("GL33") @Alternate("glGetQueryObjectui64v") @GLreturn("params") @StripPostfix("params") void glGetQueryObjectui64v2(@GLuint int id, @GLenum int pname, @OutParameter @GLuint64 LongBuffer params); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_gpu_program_parameters.java0000644000175000017500000000421011543426511026026 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.*; public interface EXT_gpu_program_parameters { @StripPostfix("params") void glProgramEnvParameters4fvEXT(@GLenum int target, @GLuint int index, @GLsizei int count, @Check("count << 2") @Const FloatBuffer params); @StripPostfix("params") void glProgramLocalParameters4fvEXT(@GLenum int target, @GLuint int index, @GLsizei int count, @Check("count << 2") @Const FloatBuffer params); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_shadow_ambient.java0000644000175000017500000000322611543426511024217 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_shadow_ambient { int GL_TEXTURE_COMPARE_FAIL_VALUE_ARB = 0x80BF; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_mirrored_repeat.java0000644000175000017500000000322411543426511026174 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_texture_mirrored_repeat { int GL_MIRRORED_REPEAT_ARB = 0x8370; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_depth_texture.java0000644000175000017500000000430711543426511024120 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_depth_texture { /** * Accepted by the <internalFormat> parameter of TexImage1D, TexImage2D, * CopyTexImage1D and CopyTexImage2D: */ int GL_DEPTH_COMPONENT16_ARB = 0x81A5; int GL_DEPTH_COMPONENT24_ARB = 0x81A6; int GL_DEPTH_COMPONENT32_ARB = 0x81A7; /** * Accepted by the <pname> parameter of GetTexLevelParameterfv and * GetTexLevelParameteriv: */ int GL_TEXTURE_DEPTH_SIZE_ARB = 0x884A; /** * Accepted by the <pname> parameter of TexParameterf, TexParameteri, * TexParameterfv, TexParameteriv, GetTexParameterfv, and GetTexParameteriv: */ int GL_DEPTH_TEXTURE_MODE_ARB = 0x884B; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_vertex_blend.java0000644000175000017500000001104011543426511023705 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.*; public interface ARB_vertex_blend { int GL_MAX_VERTEX_UNITS_ARB = 0x86A4; int GL_ACTIVE_VERTEX_UNITS_ARB = 0x86A5; int GL_WEIGHT_SUM_UNITY_ARB = 0x86A6; int GL_VERTEX_BLEND_ARB = 0x86A7; int GL_CURRENT_WEIGHT_ARB = 0x86A8; int GL_WEIGHT_ARRAY_TYPE_ARB = 0x86A9; int GL_WEIGHT_ARRAY_STRIDE_ARB = 0x86AA; int GL_WEIGHT_ARRAY_SIZE_ARB = 0x86AB; int GL_WEIGHT_ARRAY_POINTER_ARB = 0x86AC; int GL_WEIGHT_ARRAY_ARB = 0x86AD; int GL_MODELVIEW0_ARB = 0x1700; int GL_MODELVIEW1_ARB = 0x850a; int GL_MODELVIEW2_ARB = 0x8722; int GL_MODELVIEW3_ARB = 0x8723; int GL_MODELVIEW4_ARB = 0x8724; int GL_MODELVIEW5_ARB = 0x8725; int GL_MODELVIEW6_ARB = 0x8726; int GL_MODELVIEW7_ARB = 0x8727; int GL_MODELVIEW8_ARB = 0x8728; int GL_MODELVIEW9_ARB = 0x8729; int GL_MODELVIEW10_ARB = 0x872A; int GL_MODELVIEW11_ARB = 0x872B; int GL_MODELVIEW12_ARB = 0x872C; int GL_MODELVIEW13_ARB = 0x872D; int GL_MODELVIEW14_ARB = 0x872E; int GL_MODELVIEW15_ARB = 0x872F; int GL_MODELVIEW16_ARB = 0x8730; int GL_MODELVIEW17_ARB = 0x8731; int GL_MODELVIEW18_ARB = 0x8732; int GL_MODELVIEW19_ARB = 0x8733; int GL_MODELVIEW20_ARB = 0x8734; int GL_MODELVIEW21_ARB = 0x8735; int GL_MODELVIEW22_ARB = 0x8736; int GL_MODELVIEW23_ARB = 0x8737; int GL_MODELVIEW24_ARB = 0x8738; int GL_MODELVIEW25_ARB = 0x8739; int GL_MODELVIEW26_ARB = 0x873A; int GL_MODELVIEW27_ARB = 0x873B; int GL_MODELVIEW28_ARB = 0x873C; int GL_MODELVIEW29_ARB = 0x873D; int GL_MODELVIEW30_ARB = 0x873E; int GL_MODELVIEW31_ARB = 0x873F; @StripPostfix("pWeights") void glWeightbvARB(@AutoSize("pWeights") int size, ByteBuffer pWeights); @StripPostfix("pWeights") void glWeightsvARB(@AutoSize("pWeights") int size, ShortBuffer pWeights); @StripPostfix("pWeights") void glWeightivARB(@AutoSize("pWeights") int size, IntBuffer pWeights); @StripPostfix("pWeights") void glWeightfvARB(@AutoSize("pWeights") int size, FloatBuffer pWeights); @StripPostfix("pWeights") void glWeightdvARB(@AutoSize("pWeights") int size, DoubleBuffer pWeights); @StripPostfix("pWeights") void glWeightubvARB(@AutoSize("pWeights") int size, @GLubyte ByteBuffer pWeights); @StripPostfix("pWeights") void glWeightusvARB(@AutoSize("pWeights") int size, @GLushort ShortBuffer pWeights); @StripPostfix("pWeights") void glWeightuivARB(@AutoSize("pWeights") int size, @GLuint IntBuffer pWeights); void glWeightPointerARB(int size, @AutoType("pPointer") @GLenum int type, @GLsizei int stride, @CachedReference @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLbyte @GLubyte @GLshort @GLushort @GLint @GLuint @GLfloat @GLdouble Buffer pPointer); void glVertexBlendARB(int count); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_map_buffer_range.java0000644000175000017500000000653611543426511024524 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.ByteBuffer; public interface ARB_map_buffer_range { /** Accepted by the <access> parameter of MapBufferRange: */ int GL_MAP_READ_BIT = 0x0001; int GL_MAP_WRITE_BIT = 0x0002; int GL_MAP_INVALIDATE_RANGE_BIT = 0x0004; int GL_MAP_INVALIDATE_BUFFER_BIT = 0x0008; int GL_MAP_FLUSH_EXPLICIT_BIT = 0x0010; int GL_MAP_UNSYNCHRONIZED_BIT = 0x0020; /** * glMapBufferRange maps a GL buffer object range to a ByteBuffer. The old_buffer argument can be null, * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null, * it will be returned if it points to the same mapped memory and has the same capacity as the buffer object, * otherwise a new ByteBuffer is created. That way, an application will normally use glMapBufferRange like this: *

      * ByteBuffer mapped_buffer; mapped_buffer = glMapBufferRange(..., ..., ..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapBufferRange(..., ..., ..., ..., mapped_buffer); *

      * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused. * * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created. * * @return A ByteBuffer representing the mapped buffer memory. */ @Reuse("GL30") @CachedResult(isRange = true) @GLvoid @AutoSize("length") ByteBuffer glMapBufferRange(@GLenum int target, @GLintptr long offset, @GLsizeiptr long length, @GLbitfield int access); @Reuse("GL30") void glFlushMappedBufferRange(@GLenum int target, @GLintptr long offset, @GLsizeiptr long length); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/APPLE_row_bytes.java0000644000175000017500000000345411543426511023510 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface APPLE_row_bytes { /** * Accepted by the <pname> parameter of PixelStorei and the <pname> * parameter of GetIntegerv: */ int GL_PACK_ROW_BYTES_APPLE = 0x8A15; int GL_UNPACK_ROW_BYTES_APPLE = 0x8A16; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ATI_texture_float.java0000644000175000017500000000424111543426511024127 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ATI_texture_float { /** * Accepted by the <internalFormat> parameter of TexImage1D, * TexImage2D, and TexImage3D: */ int GL_RGBA_FLOAT32_ATI = 0x8814; int GL_RGB_FLOAT32_ATI = 0x8815; int GL_ALPHA_FLOAT32_ATI = 0x8816; int GL_INTENSITY_FLOAT32_ATI = 0x8817; int GL_LUMINANCE_FLOAT32_ATI = 0x8818; int GL_LUMINANCE_ALPHA_FLOAT32_ATI = 0x8819; int GL_RGBA_FLOAT16_ATI = 0x881A; int GL_RGB_FLOAT16_ATI = 0x881B; int GL_ALPHA_FLOAT16_ATI = 0x881C; int GL_INTENSITY_FLOAT16_ATI = 0x881D; int GL_LUMINANCE_FLOAT16_ATI = 0x881E; int GL_LUMINANCE_ALPHA_FLOAT16_ATI = 0x881F; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_non_power_of_two.java0000644000175000017500000000315711543426511026401 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_texture_non_power_of_two { } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_cube_map.java0000644000175000017500000000421411543426511024564 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_texture_cube_map { int GL_NORMAL_MAP_ARB = 0x8511; int GL_REFLECTION_MAP_ARB = 0x8512; int GL_TEXTURE_CUBE_MAP_ARB = 0x8513; int GL_TEXTURE_BINDING_CUBE_MAP_ARB = 0x8514; int GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = 0x8515; int GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = 0x8516; int GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = 0x8517; int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = 0x8518; int GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = 0x8519; int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = 0x851A; int GL_PROXY_TEXTURE_CUBE_MAP_ARB = 0x851B; int GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB = 0x851C; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_depth_clamp.java0000644000175000017500000000347311543426511023517 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_depth_clamp { /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, * and by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_DEPTH_CLAMP = 0x864F; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_compatibility.java0000644000175000017500000000314311543426511024102 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_compatibility { }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/AMD_seamless_cubemap_per_texture.java0000644000175000017500000000356111543426511027170 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface AMD_seamless_cubemap_per_texture { /** * Accepted by the <pname> parameter of TexParameterf, TexParameteri, * TexParameterfv, TexParameteriv, GetTexParameterfv, and GetTexParameteriv: */ int GL_TEXTURE_CUBE_MAP_SEAMLESS = ARB_seamless_cube_map.GL_TEXTURE_CUBE_MAP_SEAMLESS; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/HP_occlusion_test.java0000644000175000017500000000371011543426511024171 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface HP_occlusion_test { /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, by * the <pname> of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev : */ int GL_OCCLUSION_TEST_HP = 0x8165; /** * Accepted by the <pname> of GetBooleanv, GetIntegerv, GetFloatv, and * GetDoublev : */ int GL_OCCLUSION_TEST_RESULT_HP = 0x8166; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_separate_shader_objects.java0000644000175000017500000000447711543426511026143 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLchar; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.ByteBuffer; public interface EXT_separate_shader_objects { /** Accepted by <type> parameter to GetIntegerv and GetFloatv: */ int GL_ACTIVE_PROGRAM_EXT = 0x8B8D; void glUseShaderProgramEXT(@GLenum int type, @GLuint int program); void glActiveProgramEXT(@GLuint int program); @GLuint int glCreateShaderProgramEXT(@GLenum int type, @NullTerminated @Const @GLchar ByteBuffer string); @Alternate("glCreateShaderProgramEXT") @GLuint int glCreateShaderProgramEXT(@GLenum int type, @NullTerminated CharSequence string); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_half_float.java0000644000175000017500000001276511543426511023261 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLhalf; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.*; public interface NV_half_float { /** * Accepted by the <type> argument of VertexPointer, NormalPointer, * ColorPointer, TexCoordPointer, FogCoordPointerEXT, * SecondaryColorPointerEXT, VertexWeightPointerEXT, VertexAttribPointerNV, * DrawPixels, ReadPixels, TexImage1D, TexImage2D, TexImage3D, TexSubImage1D, * TexSubImage2D, TexSubImage3D, and GetTexImage: */ int GL_HALF_FLOAT_NV = 0x140B; @NoErrorCheck void glVertex2hNV(@GLhalf short x, @GLhalf short y); @NoErrorCheck void glVertex3hNV(@GLhalf short x, @GLhalf short y, @GLhalf short z); @NoErrorCheck void glVertex4hNV(@GLhalf short x, @GLhalf short y, @GLhalf short z, @GLhalf short w); @NoErrorCheck void glNormal3hNV(@GLhalf short nx, @GLhalf short ny, @GLhalf short nz); @NoErrorCheck void glColor3hNV(@GLhalf short red, @GLhalf short green, @GLhalf short blue); @NoErrorCheck void glColor4hNV(@GLhalf short red, @GLhalf short green, @GLhalf short blue, @GLhalf short alpha); @NoErrorCheck void glTexCoord1hNV(@GLhalf short s); @NoErrorCheck void glTexCoord2hNV(@GLhalf short s, @GLhalf short t); @NoErrorCheck void glTexCoord3hNV(@GLhalf short s, @GLhalf short t, @GLhalf short r); @NoErrorCheck void glTexCoord4hNV(@GLhalf short s, @GLhalf short t, @GLhalf short r, @GLhalf short q); @NoErrorCheck void glMultiTexCoord1hNV(@GLenum int target, @GLhalf short s); @NoErrorCheck void glMultiTexCoord2hNV(@GLenum int target, @GLhalf short s, @GLhalf short t); @NoErrorCheck void glMultiTexCoord3hNV(@GLenum int target, @GLhalf short s, @GLhalf short t, @GLhalf short r); @NoErrorCheck void glMultiTexCoord4hNV(@GLenum int target, @GLhalf short s, @GLhalf short t, @GLhalf short r, @GLhalf short q); @NoErrorCheck void glFogCoordhNV(@GLhalf short fog); @NoErrorCheck void glSecondaryColor3hNV(@GLhalf short red, @GLhalf short green, @GLhalf short blue); @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") @NoErrorCheck void glVertexWeighthNV(@GLhalf short weight); @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") @NoErrorCheck void glVertexAttrib1hNV(@GLuint int index, @GLhalf short x); @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") @NoErrorCheck void glVertexAttrib2hNV(@GLuint int index, @GLhalf short x, @GLhalf short y); @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") @NoErrorCheck void glVertexAttrib3hNV(@GLuint int index, @GLhalf short x, @GLhalf short y, @GLhalf short z); @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") @NoErrorCheck void glVertexAttrib4hNV(@GLuint int index, @GLhalf short x, @GLhalf short y, @GLhalf short z, @GLhalf short w); @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") @NoErrorCheck @StripPostfix("attribs") void glVertexAttribs1hvNV(@GLuint int index, @AutoSize("attribs") @GLsizei int n, @Const @GLhalf ShortBuffer attribs); @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") @NoErrorCheck @StripPostfix("attribs") void glVertexAttribs2hvNV(@GLuint int index, @AutoSize(value = "attribs", expression = " >> 1") @GLsizei int n, @Const @GLhalf ShortBuffer attribs); @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") @NoErrorCheck @StripPostfix("attribs") void glVertexAttribs3hvNV(@GLuint int index, @AutoSize(value = "attribs", expression = " / 3") @GLsizei int n, @Const @GLhalf ShortBuffer attribs); @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") @NoErrorCheck @StripPostfix("attribs") void glVertexAttribs4hvNV(@GLuint int index, @AutoSize(value = "attribs", expression = " >> 2") @GLsizei int n, @Const @GLhalf ShortBuffer attribs); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_fragment_program.java0000644000175000017500000000574711543426511024577 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_fragment_program extends ARB_program { /** * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, by the * <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev, * and by the <target> parameter of ProgramStringARB, BindProgramARB, * ProgramEnvParameter4[df][v]ARB, ProgramLocalParameter4[df][v]ARB, * GetProgramEnvParameter[df]vARB, GetProgramLocalParameter[df]vARB, * GetProgramivARB and GetProgramStringARB. */ int GL_FRAGMENT_PROGRAM_ARB = 0x8804; /** * Accepted by the <pname> parameter of GetProgramivARB: */ int GL_PROGRAM_ALU_INSTRUCTIONS_ARB = 0x8805; int GL_PROGRAM_TEX_INSTRUCTIONS_ARB = 0x8806; int GL_PROGRAM_TEX_INDIRECTIONS_ARB = 0x8807; int GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = 0x8808; int GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = 0x8809; int GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = 0x880A; int GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB = 0x880B; int GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB = 0x880C; int GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB = 0x880D; int GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = 0x880E; int GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = 0x880F; int GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = 0x8810; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_MAX_TEXTURE_COORDS_ARB = 0x8871; int GL_MAX_TEXTURE_IMAGE_UNITS_ARB = 0x8872; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_abgr.java0000644000175000017500000000316611543426511022205 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_abgr { int GL_ABGR_EXT = 0x8000; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_blend_func_separate.java0000644000175000017500000000366111543426511025255 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; public interface EXT_blend_func_separate { int GL_BLEND_DST_RGB_EXT = 0x80C8; int GL_BLEND_SRC_RGB_EXT = 0x80C9; int GL_BLEND_DST_ALPHA_EXT = 0x80CA; int GL_BLEND_SRC_ALPHA_EXT = 0x80CB; void glBlendFuncSeparateEXT(@GLenum int sfactorRGB, @GLenum int dfactorRGB, @GLenum int sfactorAlpha, @GLenum int dfactorAlpha); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_gpu_shader4.java0000644000175000017500000001730511543426511023477 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.nio.ShortBuffer; public interface EXT_gpu_shader4 { /** * Accepted by the <pname> parameters of GetVertexAttribdv, * GetVertexAttribfv, GetVertexAttribiv, GetVertexAttribIivEXT, and * GetVertexAttribIuivEXT: */ int GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT = 0x88FD; /** Returned by the <type> parameter of GetActiveUniform: */ int GL_SAMPLER_1D_ARRAY_EXT = 0x8DC0; int GL_SAMPLER_2D_ARRAY_EXT = 0x8DC1; int GL_SAMPLER_BUFFER_EXT = 0x8DC2; int GL_SAMPLER_1D_ARRAY_SHADOW_EXT = 0x8DC3; int GL_SAMPLER_2D_ARRAY_SHADOW_EXT = 0x8DC4; int GL_SAMPLER_CUBE_SHADOW_EXT = 0x8DC5; int GL_UNSIGNED_INT = 0x1405; int GL_UNSIGNED_INT_VEC2_EXT = 0x8DC6; int GL_UNSIGNED_INT_VEC3_EXT = 0x8DC7; int GL_UNSIGNED_INT_VEC4_EXT = 0x8DC8; int GL_INT_SAMPLER_1D_EXT = 0x8DC9; int GL_INT_SAMPLER_2D_EXT = 0x8DCA; int GL_INT_SAMPLER_3D_EXT = 0x8DCB; int GL_INT_SAMPLER_CUBE_EXT = 0x8DCC; int GL_INT_SAMPLER_2D_RECT_EXT = 0x8DCD; int GL_INT_SAMPLER_1D_ARRAY_EXT = 0x8DCE; int GL_INT_SAMPLER_2D_ARRAY_EXT = 0x8DCF; int GL_INT_SAMPLER_BUFFER_EXT = 0x8DD0; int GL_UNSIGNED_INT_SAMPLER_1D_EXT = 0x8DD1; int GL_UNSIGNED_INT_SAMPLER_2D_EXT = 0x8DD2; int GL_UNSIGNED_INT_SAMPLER_3D_EXT = 0x8DD3; int GL_UNSIGNED_INT_SAMPLER_CUBE_EXT = 0x8DD4; int GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT = 0x8DD5; int GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT = 0x8DD6; int GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT = 0x8DD7; int GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT = 0x8DD8; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_MIN_PROGRAM_TEXEL_OFFSET_EXT = 0x8904; int GL_MAX_PROGRAM_TEXEL_OFFSET_EXT = 0x8905; @NoErrorCheck void glVertexAttribI1iEXT(@GLuint int index, int x); @NoErrorCheck void glVertexAttribI2iEXT(@GLuint int index, int x, int y); @NoErrorCheck void glVertexAttribI3iEXT(@GLuint int index, int x, int y, int z); @NoErrorCheck void glVertexAttribI4iEXT(@GLuint int index, int x, int y, int z, int w); @NoErrorCheck void glVertexAttribI1uiEXT(@GLuint int index, @GLuint int x); @NoErrorCheck void glVertexAttribI2uiEXT(@GLuint int index, @GLuint int x, @GLuint int y); @NoErrorCheck void glVertexAttribI3uiEXT(@GLuint int index, @GLuint int x, @GLuint int y, @GLuint int z); @NoErrorCheck void glVertexAttribI4uiEXT(@GLuint int index, @GLuint int x, @GLuint int y, @GLuint int z, @GLuint int w); @NoErrorCheck @StripPostfix("v") void glVertexAttribI1ivEXT(@GLuint int index, @Check("1") @Const IntBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI2ivEXT(@GLuint int index, @Check("2") @Const IntBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI3ivEXT(@GLuint int index, @Check("3") @Const IntBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI4ivEXT(@GLuint int index, @Check("4") @Const IntBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI1uivEXT(@GLuint int index, @Check("1") @Const @GLuint IntBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI2uivEXT(@GLuint int index, @Check("2") @Const @GLuint IntBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI3uivEXT(@GLuint int index, @Check("3") @Const @GLuint IntBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI4uivEXT(@GLuint int index, @Check("4") @Const @GLuint IntBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI4bvEXT(@GLuint int index, @Check("4") @Const ByteBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI4svEXT(@GLuint int index, @Check("4") @Const ShortBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI4ubvEXT(@GLuint int index, @Check("4") @Const @GLubyte ByteBuffer v); @NoErrorCheck @StripPostfix("v") void glVertexAttribI4usvEXT(@GLuint int index, @Check("4") @Const @GLushort ShortBuffer v); void glVertexAttribIPointerEXT(@GLuint int index, int size, @GLenum int type, @GLsizei int stride, @CachedReference @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLbyte @GLubyte @GLshort @GLushort @GLint @GLuint Buffer buffer); @StripPostfix("params") void glGetVertexAttribIivEXT(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @StripPostfix("params") void glGetVertexAttribIuivEXT(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") @GLuint IntBuffer params); void glUniform1uiEXT(int location, @GLuint int v0); void glUniform2uiEXT(int location, @GLuint int v0, @GLuint int v1); void glUniform3uiEXT(int location, @GLuint int v0, @GLuint int v1, @GLuint int v2); void glUniform4uiEXT(int location, @GLuint int v0, @GLuint int v1, @GLuint int v2, @GLuint int v3); @StripPostfix("value") void glUniform1uivEXT(int location, @AutoSize("value") @GLsizei int count, @Const @GLuint IntBuffer value); @StripPostfix("value") void glUniform2uivEXT(int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const @GLuint IntBuffer value); @StripPostfix("value") void glUniform3uivEXT(int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const @GLuint IntBuffer value); @StripPostfix("value") void glUniform4uivEXT(int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const @GLuint IntBuffer value); @StripPostfix("params") void glGetUniformuivEXT(@GLuint int program, int location, @OutParameter @Check @GLuint IntBuffer params); void glBindFragDataLocationEXT(@GLuint int program, @GLuint int colorNumber, @NullTerminated @Const @GLchar ByteBuffer name); @Alternate("glBindFragDataLocationEXT") void glBindFragDataLocationEXT(@GLuint int program, @GLuint int colorNumber, @NullTerminated CharSequence name); int glGetFragDataLocationEXT(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name); @Alternate("glGetFragDataLocationEXT") int glGetFragDataLocationEXT(@GLuint int program, @NullTerminated CharSequence name); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_fragment_coord_conventions.java0000644000175000017500000000316011543426511026646 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_fragment_coord_conventions { }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_vertex_array_bgra.java0000644000175000017500000000337211543426511024777 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_vertex_array_bgra { /** * Accepted by the <size> parameter of ColorPointer, * SecondaryColorPointer, and VertexAttribPointer: */ int GL_BGRA = 0x80E1; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_vertex_program.java0000644000175000017500000001464711543426511024310 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.*; public interface ARB_vertex_program extends ARB_program { /** * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, by the * <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev, * and by the <target> parameter of ProgramStringARB, BindProgramARB, * ProgramEnvParameter4[df][v]ARB, ProgramLocalParameter4[df][v]ARB, * GetProgramEnvParameter[df]vARB, GetProgramLocalParameter[df]vARB, * GetProgramivARB, and GetProgramStringARB. */ int GL_VERTEX_PROGRAM_ARB = 0x8620; /** * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, and by * the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and * GetDoublev: */ int GL_VERTEX_PROGRAM_POINT_SIZE_ARB = 0x8642; int GL_VERTEX_PROGRAM_TWO_SIDE_ARB = 0x8643; int GL_COLOR_SUM_ARB = 0x8458; /** Accepted by the <pname> parameter of GetVertexAttrib[dfi]vARB: */ int GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB = 0x8622; int GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB = 0x8623; int GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB = 0x8624; int GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB = 0x8625; int GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB = 0x886A; int GL_CURRENT_VERTEX_ATTRIB_ARB = 0x8626; /** Accepted by the <pname> parameter of GetVertexAttribPointervARB: */ int GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB = 0x8645; /** Accepted by the <pname> parameter of GetProgramivARB: */ int GL_PROGRAM_ADDRESS_REGISTERS_ARB = 0x88B0; int GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB = 0x88B1; int GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 0x88B2; int GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 0x88B3; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_MAX_VERTEX_ATTRIBS_ARB = 0x8869; @Reuse("ARBVertexShader") @NoErrorCheck void glVertexAttrib1sARB(@GLuint int index, short x); @Reuse("ARBVertexShader") @NoErrorCheck void glVertexAttrib1fARB(@GLuint int index, float x); @Reuse("ARBVertexShader") @NoErrorCheck void glVertexAttrib1dARB(@GLuint int index, double x); @Reuse("ARBVertexShader") @NoErrorCheck void glVertexAttrib2sARB(@GLuint int index, short x, short y); @Reuse("ARBVertexShader") @NoErrorCheck void glVertexAttrib2fARB(@GLuint int index, float x, float y); @Reuse("ARBVertexShader") @NoErrorCheck void glVertexAttrib2dARB(@GLuint int index, double x, double y); @Reuse("ARBVertexShader") @NoErrorCheck void glVertexAttrib3sARB(@GLuint int index, short x, short y, short z); @Reuse("ARBVertexShader") @NoErrorCheck void glVertexAttrib3fARB(@GLuint int index, float x, float y, float z); @Reuse("ARBVertexShader") @NoErrorCheck void glVertexAttrib3dARB(@GLuint int index, double x, double y, double z); @Reuse("ARBVertexShader") @NoErrorCheck void glVertexAttrib4sARB(@GLuint int index, short x, short y, short z, short w); @Reuse("ARBVertexShader") @NoErrorCheck void glVertexAttrib4fARB(@GLuint int index, float x, float y, float z, float w); @Reuse("ARBVertexShader") @NoErrorCheck void glVertexAttrib4dARB(@GLuint int index, double x, double y, double z, double w); @Reuse("ARBVertexShader") @NoErrorCheck void glVertexAttrib4NubARB(@GLuint int index, @GLubyte byte x, @GLubyte byte y, @GLubyte byte z, @GLubyte byte w); @Reuse("ARBVertexShader") void glVertexAttribPointerARB(@GLuint int index, int size, @AutoType("buffer") @GLenum int type, boolean normalized, @GLsizei int stride, @CachedReference(index = "index", name = "glVertexAttribPointer_buffer") @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLbyte @GLubyte @GLshort @GLushort @GLint @GLuint @GLfloat @GLdouble Buffer buffer); @Reuse("ARBVertexShader") void glEnableVertexAttribArrayARB(@GLuint int index); @Reuse("ARBVertexShader") void glDisableVertexAttribArrayARB(@GLuint int index); @Reuse("ARBVertexShader") @StripPostfix("params") void glGetVertexAttribfvARB(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); @Reuse("ARBVertexShader") @StripPostfix("params") void glGetVertexAttribdvARB(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") DoubleBuffer params); @Reuse("ARBVertexShader") @StripPostfix("params") void glGetVertexAttribivARB(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Reuse("ARBVertexShader") @StripPostfix("result") void glGetVertexAttribPointervARB(@GLuint int index, @GLenum int pname, @Result @GLvoid ByteBuffer result); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java0000644000175000017500000002215511543426511024215 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.*; @Dependent @Extension(postfix = "") public interface ARB_gpu_shader_fp64 { /** * Returned in the <type> parameter of GetActiveUniform, and * GetTransformFeedbackVarying: */ int GL_DOUBLE = GL11.GL_DOUBLE; int GL_DOUBLE_VEC2 = 0x8FFC; int GL_DOUBLE_VEC3 = 0x8FFD; int GL_DOUBLE_VEC4 = 0x8FFE; int GL_DOUBLE_MAT2 = 0x8F46; int GL_DOUBLE_MAT3 = 0x8F47; int GL_DOUBLE_MAT4 = 0x8F48; int GL_DOUBLE_MAT2x3 = 0x8F49; int GL_DOUBLE_MAT2x4 = 0x8F4A; int GL_DOUBLE_MAT3x2 = 0x8F4B; int GL_DOUBLE_MAT3x4 = 0x8F4C; int GL_DOUBLE_MAT4x2 = 0x8F4D; int GL_DOUBLE_MAT4x3 = 0x8F4E; @Reuse("GL40") void glUniform1d(int location, double x); @Reuse("GL40") void glUniform2d(int location, double x, double y); @Reuse("GL40") void glUniform3d(int location, double x, double y, double z); @Reuse("GL40") void glUniform4d(int location, double x, double y, double z, double w); @Reuse("GL40") @StripPostfix("value") void glUniform1dv(int location, @AutoSize("value") @GLsizei int count, @Const DoubleBuffer value); @Reuse("GL40") @StripPostfix("value") void glUniform2dv(int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const DoubleBuffer value); @Reuse("GL40") @StripPostfix("value") void glUniform3dv(int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const DoubleBuffer value); @Reuse("GL40") @StripPostfix("value") void glUniform4dv(int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const DoubleBuffer value); @Reuse("GL40") @StripPostfix("value") void glUniformMatrix2dv(int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL40") @StripPostfix("value") void glUniformMatrix3dv(int location, @AutoSize(value = "value", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL40") @StripPostfix("value") void glUniformMatrix4dv(int location, @AutoSize(value = "value", expression = " >> 4") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL40") @StripPostfix("value") void glUniformMatrix2x3dv(int location, @AutoSize(value = "value", expression = " / (2 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL40") @StripPostfix("value") void glUniformMatrix2x4dv(int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL40") @StripPostfix("value") void glUniformMatrix3x2dv(int location, @AutoSize(value = "value", expression = " / (3 * 2)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL40") @StripPostfix("value") void glUniformMatrix3x4dv(int location, @AutoSize(value = "value", expression = " / (3 * 4)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL40") @StripPostfix("value") void glUniformMatrix4x2dv(int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL40") @StripPostfix("value") void glUniformMatrix4x3dv(int location, @AutoSize(value = "value", expression = " / (4 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL40") @StripPostfix("params") void glGetUniformdv(@GLuint int program, int location, @OutParameter @Check DoubleBuffer params); // ---- @Dependent("GL_EXT_direct_state_access") void glProgramUniform1dEXT(@GLuint int program, int location, double x); @Dependent("GL_EXT_direct_state_access") void glProgramUniform2dEXT(@GLuint int program, int location, double x, double y); @Dependent("GL_EXT_direct_state_access") void glProgramUniform3dEXT(@GLuint int program, int location, double x, double y, double z); @Dependent("GL_EXT_direct_state_access") void glProgramUniform4dEXT(@GLuint int program, int location, double x, double y, double z, double w); @Dependent("GL_EXT_direct_state_access") @StripPostfix(value="value", extension="EXT") void glProgramUniform1dvEXT(@GLuint int program, int location, @AutoSize(value = "value") @GLsizei int count, @Const DoubleBuffer value); @Dependent("GL_EXT_direct_state_access") @StripPostfix(value = "value", extension = "EXT") void glProgramUniform2dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const DoubleBuffer value); @Dependent("GL_EXT_direct_state_access") @StripPostfix(value = "value", extension = "EXT") void glProgramUniform3dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const DoubleBuffer value); @Dependent("GL_EXT_direct_state_access") @StripPostfix(value = "value", extension = "EXT") void glProgramUniform4dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const DoubleBuffer value); @Dependent("GL_EXT_direct_state_access") @StripPostfix(value = "value", extension = "EXT") void glProgramUniformMatrix2dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Dependent("GL_EXT_direct_state_access") @StripPostfix(value = "value", extension = "EXT") void glProgramUniformMatrix3dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Dependent("GL_EXT_direct_state_access") @StripPostfix(value = "value", extension = "EXT") void glProgramUniformMatrix4dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 4") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Dependent("GL_EXT_direct_state_access") @StripPostfix(value = "value", extension = "EXT") void glProgramUniformMatrix2x3dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (2 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Dependent("GL_EXT_direct_state_access") @StripPostfix(value = "value", extension = "EXT") void glProgramUniformMatrix2x4dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Dependent("GL_EXT_direct_state_access") @StripPostfix(value = "value", extension = "EXT") void glProgramUniformMatrix3x2dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 2)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Dependent("GL_EXT_direct_state_access") @StripPostfix(value = "value", extension = "EXT") void glProgramUniformMatrix3x4dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 4)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Dependent("GL_EXT_direct_state_access") @StripPostfix(value = "value", extension = "EXT") void glProgramUniformMatrix4x2dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Dependent("GL_EXT_direct_state_access") @StripPostfix(value = "value", extension = "EXT") void glProgramUniformMatrix4x3dvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (4 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_primitive_restart.java0000644000175000017500000000432611543426511024730 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLuint; @ForceInit public interface NV_primitive_restart { /** * Accepted by the <array> parameter of EnableClientState and * DisableClientState, by the <cap> parameter of IsEnabled, and by * the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and * GetDoublev: */ int GL_PRIMITIVE_RESTART_NV = 0x8558; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_PRIMITIVE_RESTART_INDEX_NV = 0x8559; void glPrimitiveRestartNV(); void glPrimitiveRestartIndexNV(@GLuint int index); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ATI_fragment_shader.java0000644000175000017500000001526411543426511024402 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.*; public interface ATI_fragment_shader { int GL_FRAGMENT_SHADER_ATI = 0x8920; int GL_REG_0_ATI = 0x8921; int GL_REG_1_ATI = 0x8922; int GL_REG_2_ATI = 0x8923; int GL_REG_3_ATI = 0x8924; int GL_REG_4_ATI = 0x8925; int GL_REG_5_ATI = 0x8926; int GL_REG_6_ATI = 0x8927; int GL_REG_7_ATI = 0x8928; int GL_REG_8_ATI = 0x8929; int GL_REG_9_ATI = 0x892A; int GL_REG_10_ATI = 0x892B; int GL_REG_11_ATI = 0x892C; int GL_REG_12_ATI = 0x892D; int GL_REG_13_ATI = 0x892E; int GL_REG_14_ATI = 0x892F; int GL_REG_15_ATI = 0x8930; int GL_REG_16_ATI = 0x8931; int GL_REG_17_ATI = 0x8932; int GL_REG_18_ATI = 0x8933; int GL_REG_19_ATI = 0x8934; int GL_REG_20_ATI = 0x8935; int GL_REG_21_ATI = 0x8936; int GL_REG_22_ATI = 0x8937; int GL_REG_23_ATI = 0x8938; int GL_REG_24_ATI = 0x8939; int GL_REG_25_ATI = 0x893A; int GL_REG_26_ATI = 0x893B; int GL_REG_27_ATI = 0x893C; int GL_REG_28_ATI = 0x893D; int GL_REG_29_ATI = 0x893E; int GL_REG_30_ATI = 0x893F; int GL_REG_31_ATI = 0x8940; int GL_CON_0_ATI = 0x8941; int GL_CON_1_ATI = 0x8942; int GL_CON_2_ATI = 0x8943; int GL_CON_3_ATI = 0x8944; int GL_CON_4_ATI = 0x8945; int GL_CON_5_ATI = 0x8946; int GL_CON_6_ATI = 0x8947; int GL_CON_7_ATI = 0x8948; int GL_CON_8_ATI = 0x8949; int GL_CON_9_ATI = 0x894A; int GL_CON_10_ATI = 0x894B; int GL_CON_11_ATI = 0x894C; int GL_CON_12_ATI = 0x894D; int GL_CON_13_ATI = 0x894E; int GL_CON_14_ATI = 0x894F; int GL_CON_15_ATI = 0x8950; int GL_CON_16_ATI = 0x8951; int GL_CON_17_ATI = 0x8952; int GL_CON_18_ATI = 0x8953; int GL_CON_19_ATI = 0x8954; int GL_CON_20_ATI = 0x8955; int GL_CON_21_ATI = 0x8956; int GL_CON_22_ATI = 0x8957; int GL_CON_23_ATI = 0x8958; int GL_CON_24_ATI = 0x8959; int GL_CON_25_ATI = 0x895A; int GL_CON_26_ATI = 0x895B; int GL_CON_27_ATI = 0x895C; int GL_CON_28_ATI = 0x895D; int GL_CON_29_ATI = 0x895E; int GL_CON_30_ATI = 0x895F; int GL_CON_31_ATI = 0x8960; int GL_MOV_ATI = 0x8961; int GL_ADD_ATI = 0x8963; int GL_MUL_ATI = 0x8964; int GL_SUB_ATI = 0x8965; int GL_DOT3_ATI = 0x8966; int GL_DOT4_ATI = 0x8967; int GL_MAD_ATI = 0x8968; int GL_LERP_ATI = 0x8969; int GL_CND_ATI = 0x896A; int GL_CND0_ATI = 0x896B; int GL_DOT2_ADD_ATI = 0x896C; int GL_SECONDARY_INTERPOLATOR_ATI = 0x896D; int GL_NUM_FRAGMENT_REGISTERS_ATI = 0x896E; int GL_NUM_FRAGMENT_CONSTANTS_ATI = 0x896F; int GL_NUM_PASSES_ATI = 0x8970; int GL_NUM_INSTRUCTIONS_PER_PASS_ATI = 0x8971; int GL_NUM_INSTRUCTIONS_TOTAL_ATI = 0x8972; int GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI = 0x8973; int GL_NUM_LOOPBACK_COMPONENTS_ATI = 0x8974; int GL_COLOR_ALPHA_PAIRING_ATI = 0x8975; int GL_SWIZZLE_STR_ATI = 0x8976; int GL_SWIZZLE_STQ_ATI = 0x8977; int GL_SWIZZLE_STR_DR_ATI = 0x8978; int GL_SWIZZLE_STQ_DQ_ATI = 0x8979; int GL_SWIZZLE_STRQ_ATI = 0x897A; int GL_SWIZZLE_STRQ_DQ_ATI = 0x897B; int GL_RED_BIT_ATI = 0x00000001; int GL_GREEN_BIT_ATI = 0x00000002; int GL_BLUE_BIT_ATI = 0x00000004; int GL_2X_BIT_ATI = 0x00000001; int GL_4X_BIT_ATI = 0x00000002; int GL_8X_BIT_ATI = 0x00000004; int GL_HALF_BIT_ATI = 0x00000008; int GL_QUARTER_BIT_ATI = 0x00000010; int GL_EIGHTH_BIT_ATI = 0x00000020; int GL_SATURATE_BIT_ATI = 0x00000040; int GL_COMP_BIT_ATI = 0x00000002; int GL_NEGATE_BIT_ATI = 0x00000004; int GL_BIAS_BIT_ATI = 0x00000008; @GLuint int glGenFragmentShadersATI(@GLuint int range); void glBindFragmentShaderATI(@GLuint int id); void glDeleteFragmentShaderATI(@GLuint int id); void glBeginFragmentShaderATI(); void glEndFragmentShaderATI(); void glPassTexCoordATI(@GLuint int dst, @GLuint int coord, @GLenum int swizzle); void glSampleMapATI(@GLuint int dst, @GLuint int interp, @GLenum int swizzle); void glColorFragmentOp1ATI(@GLenum int op, @GLuint int dst, @GLuint int dstMask, @GLuint int dstMod, @GLuint int arg1, @GLuint int arg1Rep, @GLuint int arg1Mod); void glColorFragmentOp2ATI(@GLenum int op, @GLuint int dst, @GLuint int dstMask, @GLuint int dstMod, @GLuint int arg1, @GLuint int arg1Rep, @GLuint int arg1Mod, @GLuint int arg2, @GLuint int arg2Rep, @GLuint int arg2Mod); void glColorFragmentOp3ATI(@GLenum int op, @GLuint int dst, @GLuint int dstMask, @GLuint int dstMod, @GLuint int arg1, @GLuint int arg1Rep, @GLuint int arg1Mod, @GLuint int arg2, @GLuint int arg2Rep, @GLuint int arg2Mod, @GLuint int arg3, @GLuint int arg3Rep, @GLuint int arg3Mod); void glAlphaFragmentOp1ATI(@GLenum int op, @GLuint int dst, @GLuint int dstMod, @GLuint int arg1, @GLuint int arg1Rep, @GLuint int arg1Mod); void glAlphaFragmentOp2ATI(@GLenum int op, @GLuint int dst, @GLuint int dstMod, @GLuint int arg1, @GLuint int arg1Rep, @GLuint int arg1Mod, @GLuint int arg2, @GLuint int arg2Rep, @GLuint int arg2Mod); void glAlphaFragmentOp3ATI(@GLenum int op, @GLuint int dst, @GLuint int dstMod, @GLuint int arg1, @GLuint int arg1Rep, @GLuint int arg1Mod, @GLuint int arg2, @GLuint int arg2Rep, @GLuint int arg2Mod, @GLuint int arg3, @GLuint int arg3Rep, @GLuint int arg3Mod); // TODO:is the @Check correct? void glSetFragmentShaderConstantATI(@GLuint int dst, @Check("4") @Const FloatBuffer pfValue); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_shading_language_100.java0000644000175000017500000000333611543426511025075 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_shading_language_100 { /** * Accepted by the <name> parameter of GetString: */ int GL_SHADING_LANGUAGE_VERSION_ARB = 0x8B8C; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_multisample_coverage.java0000644000175000017500000000344611543426511025365 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_multisample_coverage { /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, * GetIntegerv, and GetFloatv: */ int GL_COVERAGE_SAMPLES_NV = 0x80A9; int GL_COLOR_SAMPLES_NV = 0x8E20; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ATI_separate_stencil.java0000644000175000017500000000412111543426511024564 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLuint; public interface ATI_separate_stencil { int GL_STENCIL_BACK_FUNC_ATI = 0x8800; int GL_STENCIL_BACK_FAIL_ATI = 0x8801; int GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI = 0x8802; int GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI = 0x8803; void glStencilOpSeparateATI(@GLenum int face, @GLenum int sfail, @GLenum int dpfail, @GLenum int dppass); void glStencilFuncSeparateATI(@GLenum int frontfunc, @GLenum int backfunc, int ref, @GLuint int mask); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java0000644000175000017500000002613611543426511025052 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.IntBuffer; @Extension(postfix = "") public interface ARB_framebuffer_object { /** * Accepted by the <target> parameter of BindFramebuffer, * CheckFramebufferStatus, FramebufferTexture{1D|2D|3D}, * FramebufferRenderbuffer, and * GetFramebufferAttachmentParameteriv: */ int GL_FRAMEBUFFER = 0x8D40; int GL_READ_FRAMEBUFFER = 0x8CA8; int GL_DRAW_FRAMEBUFFER = 0x8CA9; /** * Accepted by the <target> parameter of BindRenderbuffer, * RenderbufferStorage, and GetRenderbufferParameteriv, and * returned by GetFramebufferAttachmentParameteriv: */ int GL_RENDERBUFFER = 0x8D41; /** * Accepted by the <internalformat> parameter of * RenderbufferStorage: */ int GL_STENCIL_INDEX1 = 0x8D46; int GL_STENCIL_INDEX4 = 0x8D47; int GL_STENCIL_INDEX8 = 0x8D48; int GL_STENCIL_INDEX16 = 0x8D49; /** Accepted by the <pname> parameter of GetRenderbufferParameteriv: */ int GL_RENDERBUFFER_WIDTH = 0x8D42; int GL_RENDERBUFFER_HEIGHT = 0x8D43; int GL_RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; int GL_RENDERBUFFER_RED_SIZE = 0x8D50; int GL_RENDERBUFFER_GREEN_SIZE = 0x8D51; int GL_RENDERBUFFER_BLUE_SIZE = 0x8D52; int GL_RENDERBUFFER_ALPHA_SIZE = 0x8D53; int GL_RENDERBUFFER_DEPTH_SIZE = 0x8D54; int GL_RENDERBUFFER_STENCIL_SIZE = 0x8D55; int GL_RENDERBUFFER_SAMPLES = 0x8CAB; /** * Accepted by the <pname> parameter of * GetFramebufferAttachmentParameteriv: */ int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4; int GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210; int GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211; int GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212; int GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213; int GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214; int GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215; int GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216; int GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217; /** Returned in <params> by GetFramebufferAttachmentParameteriv: */ int GL_SRGB = 0x8C40; int GL_UNSIGNED_NORMALIZED = 0x8C17; int GL_FRAMEBUFFER_DEFAULT = 0x8218; int GL_INDEX = 0x8222; /** * Accepted by the <attachment> parameter of * FramebufferTexture{1D|2D|3D}, FramebufferRenderbuffer, and * GetFramebufferAttachmentParameteriv */ int GL_COLOR_ATTACHMENT0 = 0x8CE0; int GL_COLOR_ATTACHMENT1 = 0x8CE1; int GL_COLOR_ATTACHMENT2 = 0x8CE2; int GL_COLOR_ATTACHMENT3 = 0x8CE3; int GL_COLOR_ATTACHMENT4 = 0x8CE4; int GL_COLOR_ATTACHMENT5 = 0x8CE5; int GL_COLOR_ATTACHMENT6 = 0x8CE6; int GL_COLOR_ATTACHMENT7 = 0x8CE7; int GL_COLOR_ATTACHMENT8 = 0x8CE8; int GL_COLOR_ATTACHMENT9 = 0x8CE9; int GL_COLOR_ATTACHMENT10 = 0x8CEA; int GL_COLOR_ATTACHMENT11 = 0x8CEB; int GL_COLOR_ATTACHMENT12 = 0x8CEC; int GL_COLOR_ATTACHMENT13 = 0x8CED; int GL_COLOR_ATTACHMENT14 = 0x8CEE; int GL_COLOR_ATTACHMENT15 = 0x8CEF; int GL_DEPTH_ATTACHMENT = 0x8D00; int GL_STENCIL_ATTACHMENT = 0x8D20; int GL_DEPTH_STENCIL_ATTACHMENT = 0x821A; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_MAX_SAMPLES = 0x8D57; /** Returned by CheckFramebufferStatus(): */ int GL_FRAMEBUFFER_COMPLETE = 0x8CD5; int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; int GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 0x8CDB; int GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0x8CDC; int GL_FRAMEBUFFER_UNSUPPORTED = 0x8CDD; int GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56; int GL_FRAMEBUFFER_UNDEFINED = 0x8219; /** * Accepted by the <pname> parameters of GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_FRAMEBUFFER_BINDING = 0x8CA6; // alias DRAW_FRAMEBUFFER_BINDING int GL_DRAW_FRAMEBUFFER_BINDING = 0x8CA6; int GL_READ_FRAMEBUFFER_BINDING = 0x8CAA; int GL_RENDERBUFFER_BINDING = 0x8CA7; int GL_MAX_COLOR_ATTACHMENTS = 0x8CDF; int GL_MAX_RENDERBUFFER_SIZE = 0x84E8; /** Returned by GetError(): */ int GL_INVALID_FRAMEBUFFER_OPERATION = 0x0506; /** * Accepted by the <format> parameter of DrawPixels, ReadPixels, * TexImage1D, TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D, * TexSubImage3D, and GetTexImage, by the <type> parameter of * CopyPixels, by the <internalformat> parameter of TexImage1D, * TexImage2D, TexImage3D, CopyTexImage1D, CopyTexImage2D, and * RenderbufferStorage, and returned in the <data> parameter of * GetTexLevelParameter and GetRenderbufferParameteriv: */ int GL_DEPTH_STENCIL = 0x84F9; /** * Accepted by the <type> parameter of DrawPixels, ReadPixels, * TexImage1D, TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D, * TexSubImage3D, and GetTexImage: */ int GL_UNSIGNED_INT_24_8 = 0x84FA; /** * Accepted by the <internalformat> parameter of TexImage1D, * TexImage2D, TexImage3D, CopyTexImage1D, CopyTexImage2D, and * RenderbufferStorage, and returned in the <data> parameter of * GetTexLevelParameter and GetRenderbufferParameteriv: */ int GL_DEPTH24_STENCIL8 = 0x88F0; /** Accepted by the <value> parameter of GetTexLevelParameter: */ int GL_TEXTURE_STENCIL_SIZE = 0x88F1; @Reuse("GL30") boolean glIsRenderbuffer(@GLuint int renderbuffer); @Reuse("GL30") void glBindRenderbuffer(@GLenum int target, @GLuint int renderbuffer); @Reuse("GL30") void glDeleteRenderbuffers(@AutoSize("renderbuffers") @GLsizei int n, @Const @GLuint IntBuffer renderbuffers); @Reuse("GL30") @Alternate("glDeleteRenderbuffers") void glDeleteRenderbuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, renderbuffer), 0", keepParam = true) int renderbuffer); @Reuse("GL30") void glGenRenderbuffers(@AutoSize("renderbuffers") @GLsizei int n, @OutParameter @GLuint IntBuffer renderbuffers); @Reuse("GL30") @Alternate("glGenRenderbuffers") @GLreturn("renderbuffers") void glGenRenderbuffers2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer renderbuffers); @Reuse("GL30") void glRenderbufferStorage(@GLenum int target, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); @Reuse("GL30") void glRenderbufferStorageMultisample(@GLenum int target, @GLsizei int samples, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); @Reuse("GL30") @StripPostfix("params") void glGetRenderbufferParameteriv(@GLenum int target, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); @Reuse("GL30") @Alternate("glGetRenderbufferParameteriv") @GLreturn("params") @StripPostfix("params") void glGetRenderbufferParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @Reuse("GL30") boolean glIsFramebuffer(@GLuint int framebuffer); @Reuse("GL30") void glBindFramebuffer(@GLenum int target, @GLuint int framebuffer); @Reuse("GL30") void glDeleteFramebuffers(@AutoSize("framebuffers") @GLsizei int n, @Const @GLuint IntBuffer framebuffers); @Reuse("GL30") @Alternate("glDeleteFramebuffers") void glDeleteFramebuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, framebuffer), 0", keepParam = true) int framebuffer); @Reuse("GL30") void glGenFramebuffers(@AutoSize("framebuffers") @GLsizei int n, @OutParameter @GLuint IntBuffer framebuffers); @Reuse("GL30") @Alternate("glGenFramebuffers") @GLreturn("framebuffers") void glGenFramebuffers2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer framebuffers); @Reuse("GL30") @GLenum int glCheckFramebufferStatus(@GLenum int target); @Reuse("GL30") void glFramebufferTexture1D(@GLenum int target, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level); @Reuse("GL30") void glFramebufferTexture2D(@GLenum int target, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level); @Reuse("GL30") void glFramebufferTexture3D(@GLenum int target, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level, int layer); @Reuse("GL30") void glFramebufferTextureLayer(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, int layer); @Reuse("GL30") void glFramebufferRenderbuffer(@GLenum int target, @GLenum int attachment, @GLenum int renderbuffertarget, @GLuint int renderbuffer); @Reuse("GL30") @StripPostfix("params") void glGetFramebufferAttachmentParameteriv(@GLenum int target, @GLenum int attachment, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); @Reuse("GL30") @Alternate("glGetFramebufferAttachmentParameteriv") @GLreturn("params") @StripPostfix("params") void glGetFramebufferAttachmentParameteriv2(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter IntBuffer params); @Reuse("GL30") void glBlitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, @GLbitfield int mask, @GLenum int filter); @Reuse("GL30") void glGenerateMipmap(@GLenum int target); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_env_add.java0000644000175000017500000000314611543426511024414 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_texture_env_add { } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_depth_buffer_float.java0000644000175000017500000000426311543426511025057 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_depth_buffer_float { /** * Accepted by the <internalformat> parameter of TexImage1D, TexImage2D, * TexImage3D, CopyTexImage1D, CopyTexImage2D, and RenderbufferStorageEXT, * and returned in the <data> parameter of GetTexLevelParameter and * GetRenderbufferParameterivEXT: */ int GL_DEPTH_COMPONENT32F = 0x8CAC; int GL_DEPTH32F_STENCIL8 = 0x8CAD; /** * Accepted by the <type> parameter of DrawPixels, ReadPixels, TexImage1D, * TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D, TexSubImage3D, and * GetTexImage: */ int GL_FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_blend_equation_separate.java0000644000175000017500000000366411543426511026152 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLenum; public interface EXT_blend_equation_separate { /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_BLEND_EQUATION_RGB_EXT = 0x8009; int GL_BLEND_EQUATION_ALPHA_EXT = 0x883D; void glBlendEquationSeparateEXT(@GLenum int modeRGB, @GLenum int modeAlpha); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_matrix_palette.java0000644000175000017500000000567611543426511024270 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.*; public interface ARB_matrix_palette { int GL_MATRIX_PALETTE_ARB = 0x8840; int GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB = 0x8841; int GL_MAX_PALETTE_MATRICES_ARB = 0x8842; int GL_CURRENT_PALETTE_MATRIX_ARB = 0x8843; int GL_MATRIX_INDEX_ARRAY_ARB = 0x8844; int GL_CURRENT_MATRIX_INDEX_ARB = 0x8845; int GL_MATRIX_INDEX_ARRAY_SIZE_ARB = 0x8846; int GL_MATRIX_INDEX_ARRAY_TYPE_ARB = 0x8847; int GL_MATRIX_INDEX_ARRAY_STRIDE_ARB = 0x8848; int GL_MATRIX_INDEX_ARRAY_POINTER_ARB = 0x8849; void glCurrentPaletteMatrixARB(int index); void glMatrixIndexPointerARB(int size, @AutoType("pPointer") @GLenum int type, @GLsizei int stride, @CachedReference @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLubyte @GLushort @GLuint Buffer pPointer); @StripPostfix("pIndices") void glMatrixIndexubvARB(@AutoSize("pIndices") int size, @GLubyte ByteBuffer pIndices); @StripPostfix("pIndices") void glMatrixIndexusvARB(@AutoSize("pIndices") int size, @GLushort ShortBuffer pIndices); @StripPostfix("pIndices") void glMatrixIndexuivARB(@AutoSize("pIndices") int size, @GLuint IntBuffer pIndices); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java0000644000175000017500000003460511543426511026103 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.ByteBuffer; import java.nio.DoubleBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; @Extension(postfix = "") public interface ARB_separate_shader_objects { /** Accepted by <stages> parameter to UseProgramStages: */ int GL_VERTEX_SHADER_BIT = 0x00000001, GL_FRAGMENT_SHADER_BIT = 0x00000002, GL_GEOMETRY_SHADER_BIT = 0x00000004, GL_TESS_CONTROL_SHADER_BIT = 0x00000008, GL_TESS_EVALUATION_SHADER_BIT = 0x00000010, GL_ALL_SHADER_BITS = 0xFFFFFFFF; /** * Accepted by the <pname> parameter of ProgramParameteri and * GetProgramiv: */ int GL_PROGRAM_SEPARABLE = 0x8258; /** Accepted by <type> parameter to GetProgramPipelineiv: */ int GL_ACTIVE_PROGRAM = 0x8259; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetInteger64v, GetFloatv, and GetDoublev: */ int GL_PROGRAM_PIPELINE_BINDING = 0x825A; @Reuse("GL41") void glUseProgramStages(@GLuint int pipeline, @GLbitfield int stages, @GLuint int program); @Reuse("GL41") void glActiveShaderProgram(@GLuint int pipeline, @GLuint int program); @Reuse("GL41") @StripPostfix(value = "strings", postfix = "v") @GLuint int glCreateShaderProgramv(@GLenum int type, @GLsizei int count, @Check @Const @Indirect @GLchar ByteBuffer strings); @Reuse("GL41") @Alternate("glCreateShaderProgramv") @StripPostfix(value = "string", postfix = "v") @GLuint int glCreateShaderProgramv(@GLenum int type, @Constant("1") @GLsizei int count, @NullTerminated CharSequence string); @Reuse("GL41") @Alternate("glCreateShaderProgramv") @StripPostfix(value = "strings", postfix = "v") @GLuint int glCreateShaderProgramv(@GLenum int type, @Constant("strings.length") @GLsizei int count, @Const @NullTerminated @PointerArray(value = "count") CharSequence[] strings); @Reuse("GL41") void glBindProgramPipeline(@GLuint int pipeline); @Reuse("GL41") void glDeleteProgramPipelines(@AutoSize("pipelines") @GLsizei int n, @Const @GLuint IntBuffer pipelines); @Reuse("GL41") @Alternate("glDeleteProgramPipelines") void glDeleteProgramPipelines(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, pipeline), 0", keepParam = true) int pipeline); @Reuse("GL41") void glGenProgramPipelines(@AutoSize("pipelines") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines); @Reuse("GL41") @Alternate("glGenProgramPipelines") @GLreturn("pipelines") void glGenProgramPipelines2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines); @Reuse("GL41") boolean glIsProgramPipeline(@GLuint int pipeline); @Reuse("GL41") void glProgramParameteri(@GLuint int program, @GLenum int pname, int value); @Reuse("GL41") @StripPostfix("params") void glGetProgramPipelineiv(@GLuint int pipeline, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); @Reuse("GL41") @Alternate("glGetProgramPipelineiv") @GLreturn("params") @StripPostfix("params") void glGetProgramPipelineiv2(@GLuint int pipeline, @GLenum int pname, @OutParameter IntBuffer params); @Reuse("GL41") void glProgramUniform1i(@GLuint int program, int location, int v0); @Reuse("GL41") void glProgramUniform2i(@GLuint int program, int location, int v0, int v1); @Reuse("GL41") void glProgramUniform3i(@GLuint int program, int location, int v0, int v1, int v2); @Reuse("GL41") void glProgramUniform4i(@GLuint int program, int location, int v0, int v1, int v2, int v3); @Reuse("GL41") void glProgramUniform1f(@GLuint int program, int location, float v0); @Reuse("GL41") void glProgramUniform2f(@GLuint int program, int location, float v0, float v1); @Reuse("GL41") void glProgramUniform3f(@GLuint int program, int location, float v0, float v1, float v2); @Reuse("GL41") void glProgramUniform4f(@GLuint int program, int location, float v0, float v1, float v2, float v3); @Reuse("GL41") void glProgramUniform1d(@GLuint int program, int location, double v0); @Reuse("GL41") void glProgramUniform2d(@GLuint int program, int location, double v0, double v1); @Reuse("GL41") void glProgramUniform3d(@GLuint int program, int location, double v0, double v1, double v2); @Reuse("GL41") void glProgramUniform4d(@GLuint int program, int location, double v0, double v1, double v2, double v3); @Reuse("GL41") @StripPostfix("value") void glProgramUniform1iv(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const IntBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniform2iv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const IntBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniform3iv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const IntBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniform4iv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const IntBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniform1fv(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const FloatBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniform2fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const FloatBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniform3fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const FloatBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniform4fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const FloatBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniform1dv(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const DoubleBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniform2dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const DoubleBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniform3dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const DoubleBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniform4dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const DoubleBuffer value); @Reuse("GL41") void glProgramUniform1ui(@GLuint int program, int location, int v0); @Reuse("GL41") void glProgramUniform2ui(@GLuint int program, int location, int v0, int v1); @Reuse("GL41") void glProgramUniform3ui(@GLuint int program, int location, int v0, int v1, int v2); @Reuse("GL41") void glProgramUniform4ui(@GLuint int program, int location, int v0, int v1, int v2, int v3); @Reuse("GL41") @StripPostfix("value") void glProgramUniform1uiv(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const IntBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniform2uiv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const IntBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniform3uiv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const IntBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniform4uiv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const IntBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix2fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix3fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix4fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 4") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix2dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix3dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix4dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 4") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix2x3fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (2 * 3)") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix3x2fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 2)") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix2x4fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix4x2fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix3x4fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 4)") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix4x3fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (4 * 3)") @GLsizei int count, boolean transpose, @Const FloatBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix2x3dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (2 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix3x2dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 2)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix2x4dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix4x2dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix3x4dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 4)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL41") @StripPostfix("value") void glProgramUniformMatrix4x3dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (4 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value); @Reuse("GL41") void glValidateProgramPipeline(@GLuint int pipeline); @Reuse("GL41") void glGetProgramPipelineInfoLog(@GLuint int pipeline, @AutoSize("infoLog") @GLsizei int bufSize, @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, @OutParameter @GLchar ByteBuffer infoLog); @Reuse("GL41") @Alternate("glGetProgramPipelineInfoLog") @GLreturn(value = "infoLog", maxLength = "bufSize") void glGetProgramPipelineInfoLog2(@GLuint int pipeline, @GLsizei int bufSize, @OutParameter @GLsizei @Constant("infoLog_length, 0") IntBuffer length, @OutParameter @GLchar ByteBuffer infoLog); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/GL32.java0000644000175000017500000003270711543426511021224 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.PointerWrapper; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.Buffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.LongBuffer; public interface GL32 { // ---------------------------------------------------------- // ----------------------[ OpenGL 3.2 ]---------------------- // ---------------------------------------------------------- int GL_CONTEXT_PROFILE_MASK = 0x9126; int GL_CONTEXT_CORE_PROFILE_BIT = 0x00000001; int GL_CONTEXT_COMPATIBILITY_PROFILE_BIT = 0x00000002; int GL_MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122; int GL_MAX_GEOMETRY_INPUT_COMPONENTS = 0x9123; int GL_MAX_GEOMETRY_OUTPUT_COMPONENTS = 0x9124; int GL_MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125; // --------------------------------------------------------------------- // ----------------------[ ARB_vertex_array_bgra ]---------------------- // --------------------------------------------------------------------- int GL_BGRA = 0x80E1; // ----------------------------------------------------------------------------- // ----------------------[ ARB_draw_elements_base_vertex ]---------------------- // ----------------------------------------------------------------------------- void glDrawElementsBaseVertex(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type, @BufferObject(BufferKind.ElementVBO) @Const @GLubyte @GLushort @GLuint Buffer indices, int basevertex); void glDrawRangeElementsBaseVertex(@GLenum int mode, @GLuint int start, @GLuint int end, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type, @BufferObject(BufferKind.ElementVBO) @Const @GLubyte @GLushort @GLuint Buffer indices, int basevertex); void glDrawElementsInstancedBaseVertex(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type, @BufferObject(BufferKind.ElementVBO) @Const @GLubyte @GLushort @GLuint Buffer indices, @GLsizei int primcount, int basevertex); //void glMultiDrawElementsBaseVertex(@GLenum int mode, @GLsizei*count, @GLenum int type, void**indices, @GLsizei int primcount, int*basevertex) // -------------------------------------------------------------------- // ----------------------[ ARB_provoking_vertex ]---------------------- // -------------------------------------------------------------------- /** Accepted by the <mode> parameter of ProvokingVertex: */ int GL_FIRST_VERTEX_CONVENTION = 0x8E4D; int GL_LAST_VERTEX_CONVENTION = 0x8E4E; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_PROVOKING_VERTEX = 0x8E4F; int GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION = 0x8E4C; void glProvokingVertex(@GLenum int mode); // --------------------------------------------------------------------- // ----------------------[ ARB_seamless_cube_map ]---------------------- // --------------------------------------------------------------------- /** * Accepted by the <cap> parameter of Enable, Disable and IsEnabled, * and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv * and GetDoublev: */ int GL_TEXTURE_CUBE_MAP_SEAMLESS = 0x884F; // ----------------------------------------------------------------------- // ----------------------[ ARB_texture_multisample ]---------------------- // ----------------------------------------------------------------------- /** Accepted by the <pname> parameter of GetMultisamplefv: */ int GL_SAMPLE_POSITION = 0x8E50; /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, and by * the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and * GetDoublev: */ int GL_SAMPLE_MASK = 0x8E51; /** * Accepted by the <target> parameter of GetBooleani_v and * GetIntegeri_v: */ int GL_SAMPLE_MASK_VALUE = 0x8E52; /** * Accepted by the <target> parameter of BindTexture and * TexImage2DMultisample: */ int GL_TEXTURE_2D_MULTISAMPLE = 0x9100; /** Accepted by the <target> parameter of TexImage2DMultisample: */ int GL_PROXY_TEXTURE_2D_MULTISAMPLE = 0x9101; /** * Accepted by the <target> parameter of BindTexture and * TexImage3DMultisample: */ int GL_TEXTURE_2D_MULTISAMPLE_ARRAY = 0x9102; /** Accepted by the <target> parameter of TexImage3DMultisample: */ int GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY = 0x9103; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv, * and GetFloatv: */ int GL_MAX_SAMPLE_MASK_WORDS = 0x8E59; int GL_MAX_COLOR_TEXTURE_SAMPLES = 0x910E; int GL_MAX_DEPTH_TEXTURE_SAMPLES = 0x910F; int GL_MAX_INTEGER_SAMPLES = 0x9110; int GL_TEXTURE_BINDING_2D_MULTISAMPLE = 0x9104; int GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY = 0x9105; /** Accepted by the <pname> parameter of GetTexLevelParameter */ int GL_TEXTURE_SAMPLES = 0x9106; int GL_TEXTURE_FIXED_SAMPLE_LOCATIONS = 0x9107; /** Returned by the <type> parameter of GetActiveUniform: */ int GL_SAMPLER_2D_MULTISAMPLE = 0x9108; int GL_INT_SAMPLER_2D_MULTISAMPLE = 0x9109; int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE = 0x910A; int GL_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910B; int GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910C; int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910D; void glTexImage2DMultisample(@GLenum int target, @GLsizei int samples, int internalformat, @GLsizei int width, @GLsizei int height, boolean fixedsamplelocations); void glTexImage3DMultisample(@GLenum int target, @GLsizei int samples, int internalformat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, boolean fixedsamplelocations); @StripPostfix("val") void glGetMultisamplefv(@GLenum int pname, @GLuint int index, @OutParameter @Check("2") FloatBuffer val); void glSampleMaski(@GLuint int index, @GLbitfield int mask); // --------------------------------------------------------------- // ----------------------[ ARB_depth_clamp ]---------------------- // --------------------------------------------------------------- /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, * and by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_DEPTH_CLAMP = 0x864F; // -------------------------------------------------------------------- // ----------------------[ ARB_geometry_shader4 ]---------------------- // -------------------------------------------------------------------- /** * Accepted by the <type> parameter of CreateShader and returned by the * <params> parameter of GetShaderiv: */ int GL_GEOMETRY_SHADER = 0x8DD9; /** * Accepted by the <pname> parameter of ProgramParameteriEXT and * GetProgramiv: */ int GL_GEOMETRY_VERTICES_OUT = 0x8DDA; int GL_GEOMETRY_INPUT_TYPE = 0x8DDB; int GL_GEOMETRY_OUTPUT_TYPE = 0x8DDC; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS = 0x8C29; //int GL_MAX_GEOMETRY_VARYING_COMPONENTS = 0x8DDD; -- Missing from 3.2 spec //int GL_MAX_VERTEX_VARYING_COMPONENTS = 0x8DDE; -- Missing from 3.2 spec int GL_MAX_VARYING_COMPONENTS = 0x8B4B; int GL_MAX_GEOMETRY_UNIFORM_COMPONENTS = 0x8DDF; int GL_MAX_GEOMETRY_OUTPUT_VERTICES = 0x8DE0; int GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS = 0x8DE1; /** * Accepted by the <mode> parameter of Begin, DrawArrays, * MultiDrawArrays, DrawElements, MultiDrawElements, and * DrawRangeElements: */ int GL_LINES_ADJACENCY = 0xA; int GL_LINE_STRIP_ADJACENCY = 0xB; int GL_TRIANGLES_ADJACENCY = 0xC; int GL_TRIANGLE_STRIP_ADJACENCY = 0xD; /** Returned by CheckFramebufferStatusEXT: */ int GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 0x8DA8; int GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT = 0x8DA9; /** * Accepted by the <pname> parameter of GetFramebufferAttachment- * ParameterivEXT: */ int GL_FRAMEBUFFER_ATTACHMENT_LAYERED = 0x8DA7; int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4; /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, * and by the <pname> parameter of GetIntegerv, GetFloatv, GetDoublev, * and GetBooleanv: */ int GL_PROGRAM_POINT_SIZE = 0x8642; void glFramebufferTexture(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level); // -------------------------------------------------------- // ----------------------[ ARB_sync ]---------------------- // -------------------------------------------------------- /** Accepted as the <pname> parameter of GetInteger64v: */ int GL_MAX_SERVER_WAIT_TIMEOUT = 0x9111; /** Accepted as the <pname> parameter of GetSynciv: */ int GL_OBJECT_TYPE = 0x9112; int GL_SYNC_CONDITION = 0x9113; int GL_SYNC_STATUS = 0x9114; int GL_SYNC_FLAGS = 0x9115; /** Returned in <values> for GetSynciv <pname> OBJECT_TYPE: */ int GL_SYNC_FENCE = 0x9116; /** Returned in <values> for GetSynciv <pname> SYNC_CONDITION: */ int GL_SYNC_GPU_COMMANDS_COMPLETE = 0x9117; /** Returned in <values> for GetSynciv <pname> SYNC_STATUS: */ int GL_UNSIGNALED = 0x9118; int GL_SIGNALED = 0x9119; /** Accepted in the <flags> parameter of ClientWaitSync: */ int GL_SYNC_FLUSH_COMMANDS_BIT = 0x00000001; /** Accepted in the <timeout> parameter of WaitSync: */ long GL_TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFFl; /** Returned by ClientWaitSync: */ int GL_ALREADY_SIGNALED = 0x911A; int GL_TIMEOUT_EXPIRED = 0x911B; int GL_CONDITION_SATISFIED = 0x911C; int GL_WAIT_FAILED = 0x911D; @PointerWrapper("GLsync") GLSync glFenceSync(@GLenum int condition, @GLbitfield int flags); boolean glIsSync(@PointerWrapper("GLsync") GLSync sync); void glDeleteSync(@PointerWrapper("GLsync") GLSync sync); @GLenum int glClientWaitSync(@PointerWrapper("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout); void glWaitSync(@PointerWrapper("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout); @StripPostfix("data") void glGetInteger64v(@GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer data); @Alternate("glGetInteger64v") @GLreturn("data") @StripPostfix("data") void glGetInteger64v2(@GLenum int pname, @OutParameter @GLint64 LongBuffer data); @StripPostfix("data") @Optional(reason = "NV's 3.2 implementation does not expose this (last driver checked: 19?.??)") void glGetInteger64i_v(@GLenum int value, @GLuint int index, @OutParameter @Check("4") @GLint64 LongBuffer data); @Alternate("glGetInteger64i_v") @GLreturn("data") @StripPostfix("data") void glGetInteger64i_v2(@GLenum int value, @GLuint int index, @OutParameter @GLint64 LongBuffer data); @StripPostfix("values") void glGetSynciv(@PointerWrapper("GLsync") GLSync sync, @GLenum int pname, @AutoSize("values") @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter IntBuffer values); @Alternate("glGetSynciv") @GLreturn("values") @StripPostfix("values") void glGetSynciv2(@PointerWrapper("GLsync") GLSync sync, @GLenum int pname, @Constant("1") @GLsizei int bufSize, @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, @OutParameter IntBuffer values); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ATI_vertex_streams.java0000644000175000017500000000731211543426511024317 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; public interface ATI_vertex_streams { int GL_MAX_VERTEX_STREAMS_ATI = 0x876B; int GL_VERTEX_SOURCE_ATI = 0x876C; int GL_VERTEX_STREAM0_ATI = 0x876D; int GL_VERTEX_STREAM1_ATI = 0x876E; int GL_VERTEX_STREAM2_ATI = 0x876F; int GL_VERTEX_STREAM3_ATI = 0x8770; int GL_VERTEX_STREAM4_ATI = 0x8771; int GL_VERTEX_STREAM5_ATI = 0x8772; int GL_VERTEX_STREAM6_ATI = 0x8773; int GL_VERTEX_STREAM7_ATI = 0x8774; @NoErrorCheck void glVertexStream2fATI(@GLenum int stream, float x, float y); @NoErrorCheck void glVertexStream2dATI(@GLenum int stream, double x, double y); @NoErrorCheck void glVertexStream2iATI(@GLenum int stream, int x, int y); @NoErrorCheck void glVertexStream2sATI(@GLenum int stream, short x, short y); @NoErrorCheck void glVertexStream3fATI(@GLenum int stream, float x, float y, float z); @NoErrorCheck void glVertexStream3dATI(@GLenum int stream, double x, double y, double z); @NoErrorCheck void glVertexStream3iATI(@GLenum int stream, int x, int y, int z); @NoErrorCheck void glVertexStream3sATI(@GLenum int stream, short x, short y, short z); @NoErrorCheck void glVertexStream4fATI(@GLenum int stream, float x, float y, float z, float w); @NoErrorCheck void glVertexStream4dATI(@GLenum int stream, double x, double y, double z, double w); @NoErrorCheck void glVertexStream4iATI(@GLenum int stream, int x, int y, int z, int w); @NoErrorCheck void glVertexStream4sATI(@GLenum int stream, short x, short y, short z, short w); @NoErrorCheck void glNormalStream3bATI(@GLenum int stream, byte x, byte y, byte z); @NoErrorCheck void glNormalStream3fATI(@GLenum int stream, float x, float y, float z); @NoErrorCheck void glNormalStream3dATI(@GLenum int stream, double x, double y, double z); @NoErrorCheck void glNormalStream3iATI(@GLenum int stream, int x, int y, int z); @NoErrorCheck void glNormalStream3sATI(@GLenum int stream, short x, short y, short z); void glClientActiveVertexStreamATI(@GLenum int stream); void glVertexBlendEnvfATI(@GLenum int pname, float param); void glVertexBlendEnviATI(@GLenum int pname, int param); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_multisample.java0000644000175000017500000000407711543426511023574 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLclampf; public interface ARB_multisample { int GL_MULTISAMPLE_ARB = 0x809D; int GL_SAMPLE_ALPHA_TO_COVERAGE_ARB = 0x809E; int GL_SAMPLE_ALPHA_TO_ONE_ARB = 0x809F; int GL_SAMPLE_COVERAGE_ARB = 0x80A0; int GL_SAMPLE_BUFFERS_ARB = 0x80A8; int GL_SAMPLES_ARB = 0x80A9; int GL_SAMPLE_COVERAGE_VALUE_ARB = 0x80AA; int GL_SAMPLE_COVERAGE_INVERT_ARB = 0x80AB; int GL_MULTISAMPLE_BIT_ARB = 0x20000000; void glSampleCoverageARB(@GLclampf float value, boolean invert); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/AMD_depth_clamp_separate.java0000644000175000017500000000356011543426511025375 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface AMD_depth_clamp_separate { /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, * and by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_DEPTH_CLAMP_NEAR_AMD = 0x901E, GL_DEPTH_CLAMP_FAR_AMD = 0x901F; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_vertex_program2_option.java0000644000175000017500000000342611543426511025672 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_vertex_program2_option { /** * Accepted by the <pname> parameter of GetProgramivARB: */ int GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV = 0x88F4; int GL_MAX_PROGRAM_CALL_DEPTH_NV = 0x88F5; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_shader_bit_encoding.java0000644000175000017500000000315111543426511025202 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_shader_bit_encoding { }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_texture_shader.java0000644000175000017500000001447711543426511024212 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_texture_shader { /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, * and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * and GetDoublev, and by the <target> parameter of TexEnvf, TexEnvfv, * TexEnvi, TexEnviv, GetTexEnvfv, and GetTexEnviv. */ int GL_TEXTURE_SHADER_NV = 0x86DE; /** * When the <target> parameter of TexEnvf, TexEnvfv, TexEnvi, TexEnviv, * GetTexEnvfv, and GetTexEnviv is TEXTURE_SHADER_NV, then the value * of <pname> may be: */ int GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV = 0x86D9; int GL_SHADER_OPERATION_NV = 0x86DF; int GL_OFFSET_TEXTURE_SCALE_NV = 0x86E2; int GL_OFFSET_TEXTURE_BIAS_NV = 0x86E3; int GL_OFFSET_TEXTURE_2D_SCALE_NV = GL_OFFSET_TEXTURE_SCALE_NV; int GL_OFFSET_TEXTURE_2D_BIAS_NV = GL_OFFSET_TEXTURE_BIAS_NV; int GL_PREVIOUS_TEXTURE_INPUT_NV = 0x86E4; /** * When the <target> parameter of TexEnvfv, TexEnviv, GetTexEnvfv, and * GetTexEnviv is TEXTURE_SHADER_NV, then the value of <pname> may be: */ int GL_CULL_MODES_NV = 0x86E0; int GL_OFFSET_TEXTURE_MATRIX_NV = 0x86E1; int GL_OFFSET_TEXTURE_2D_MATRIX_NV = GL_OFFSET_TEXTURE_MATRIX_NV; int GL_CONST_EYE_NV = 0x86E5; /** * When the <target> parameter GetTexEnvfv and GetTexEnviv is * TEXTURE_SHADER_NV, then the value of <pname> may be: */ int GL_SHADER_CONSISTENT_NV = 0x86DD; /** * When the <target> and <pname> parameters of TexEnvf, TexEnvfv, * TexEnvi, and TexEnviv are TEXTURE_SHADER_NV and SHADER_OPERATION_NV * respectively, then the value of <param> or the value pointed to by * <params> may be: */ int GL_PASS_THROUGH_NV = 0x86E6; int GL_CULL_FRAGMENT_NV = 0x86E7; int GL_OFFSET_TEXTURE_2D_NV = 0x86E8; int GL_OFFSET_TEXTURE_RECTANGLE_NV = 0x864C; int GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV = 0x864D; int GL_DEPENDENT_AR_TEXTURE_2D_NV = 0x86E9; int GL_DEPENDENT_GB_TEXTURE_2D_NV = 0x86EA; int GL_DOT_PRODUCT_NV = 0x86EC; int GL_DOT_PRODUCT_DEPTH_REPLACE_NV = 0x86ED; int GL_DOT_PRODUCT_TEXTURE_2D_NV = 0x86EE; int GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV = 0x864E; int GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV = 0x86F0; int GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV = 0x86F1; int GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV = 0x86F2; int GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV = 0x86F3; /** * Accepted by the <format> parameter of GetTexImage, TexImage1D, * TexImage2D, TexSubImage1D, and TexSubImage2D. */ int GL_HILO_NV = 0x86F4; int GL_DSDT_NV = 0x86F5; int GL_DSDT_MAG_NV = 0x86F6; int GL_DSDT_MAG_VIB_NV = 0x86F7; /** * Accepted by the <type> parameter of GetTexImage, TexImage1D, * TexImage2D, TexSubImage1D, and TexSubImage2D. */ int GL_UNSIGNED_INT_S8_S8_8_8_NV = 0x86DA; int GL_UNSIGNED_INT_8_8_S8_S8_REV_NV = 0x86DB; /** * Accepted by the <internalformat> parameter of CopyTexImage1D, * CopyTexImage2D, TexImage1D, and TexImage2D. */ int GL_SIGNED_RGBA_NV = 0x86FB; int GL_SIGNED_RGBA8_NV = 0x86FC; int GL_SIGNED_RGB_NV = 0x86FE; int GL_SIGNED_RGB8_NV = 0x86FF; int GL_SIGNED_LUMINANCE_NV = 0x8701; int GL_SIGNED_LUMINANCE8_NV = 0x8702; int GL_SIGNED_LUMINANCE_ALPHA_NV = 0x8703; int GL_SIGNED_LUMINANCE8_ALPHA8_NV = 0x8704; int GL_SIGNED_ALPHA_NV = 0x8705; int GL_SIGNED_ALPHA8_NV = 0x8706; int GL_SIGNED_INTENSITY_NV = 0x8707; int GL_SIGNED_INTENSITY8_NV = 0x8708; int GL_SIGNED_RGB_UNSIGNED_ALPHA_NV = 0x870C; int GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV = 0x870D; /** * Accepted by the <internalformat> parameter of TexImage1D and * TexImage2D. */ int GL_HILO16_NV = 0x86F8; int GL_SIGNED_HILO_NV = 0x86F9; int GL_SIGNED_HILO16_NV = 0x86FA; int GL_DSDT8_NV = 0x8709; int GL_DSDT8_MAG8_NV = 0x870A; int GL_DSDT_MAG_INTENSITY_NV = 0x86DC; int GL_DSDT8_MAG8_INTENSITY8_NV = 0x870B; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, GetDoublev, PixelTransferf, and PixelTransferi. */ int GL_HI_SCALE_NV = 0x870E; int GL_LO_SCALE_NV = 0x870F; int GL_DS_SCALE_NV = 0x8710; int GL_DT_SCALE_NV = 0x8711; int GL_MAGNITUDE_SCALE_NV = 0x8712; int GL_VIBRANCE_SCALE_NV = 0x8713; int GL_HI_BIAS_NV = 0x8714; int GL_LO_BIAS_NV = 0x8715; int GL_DS_BIAS_NV = 0x8716; int GL_DT_BIAS_NV = 0x8717; int GL_MAGNITUDE_BIAS_NV = 0x8718; int GL_VIBRANCE_BIAS_NV = 0x8719; /** * Accepted by the <pname> parameter of TexParameteriv, TexParameterfv, * GetTexParameterfv and GetTexParameteriv. */ int GL_TEXTURE_BORDER_VALUES_NV = 0x871A; /** * Accepted by the <pname> parameter of GetTexLevelParameterfv and * GetTexLevelParameteriv. */ int GL_TEXTURE_HI_SIZE_NV = 0x871B; int GL_TEXTURE_LO_SIZE_NV = 0x871C; int GL_TEXTURE_DS_SIZE_NV = 0x871D; int GL_TEXTURE_DT_SIZE_NV = 0x871E; int GL_TEXTURE_MAG_SIZE_NV = 0x871F; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_explicit_attrib_location.java0000644000175000017500000000315611543426511026313 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_explicit_attrib_location { }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_explicit_multisample.java0000644000175000017500000000777711543426511025426 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; public interface NV_explicit_multisample { /** Accepted by the <pname> parameter of GetMultisamplefvNV: */ int GL_SAMPLE_POSITION_NV = 0x8E50; /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, and by * the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and * GetDoublev: */ int GL_SAMPLE_MASK_NV = 0x8E51; /** * Accepted by the <pname> parameter of GetBooleanIndexedvEXT and * GetIntegerIndexedvEXT: */ int GL_SAMPLE_MASK_VALUE_NV = 0x8E52; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv, * and GetFloatv: */ int GL_TEXTURE_BINDING_RENDERBUFFER_NV = 0x8E53; int GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV = 0x8E54; int GL_MAX_SAMPLE_MASK_WORDS_NV = 0x8E59; /** Accepted by the <target> parameter of BindTexture, and TexRenderbufferNV: */ int GL_TEXTURE_RENDERBUFFER_NV = 0x8E55; /** Returned by the <type> parameter of GetActiveUniform: */ int GL_SAMPLER_RENDERBUFFER_NV = 0x8E56; int GL_INT_SAMPLER_RENDERBUFFER_NV = 0x8E57; int GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV = 0x8E58; @Reuse("EXTDrawBuffers2") @StripPostfix(value = "data", extension = "EXT") void glGetBooleanIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("4") @GLboolean ByteBuffer data); @Reuse("EXTDrawBuffers2") @Alternate("glGetBooleanIndexedvEXT") @GLreturn("data") @StripPostfix(value = "data", extension = "EXT") void glGetBooleanIndexedvEXT2(@GLenum int pname, @GLuint int index, @OutParameter @GLboolean ByteBuffer data); @Reuse("EXTDrawBuffers2") @StripPostfix(value = "data", extension = "EXT") void glGetIntegerIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") IntBuffer data); @Reuse("EXTDrawBuffers2") @Alternate("glGetIntegerIndexedvEXT") @GLreturn("data") @StripPostfix(value = "data", extension = "EXT") void glGetIntegerIndexedvEXT2(@GLenum int pname, @GLuint int index, @OutParameter IntBuffer data); @StripPostfix("val") void glGetMultisamplefvNV(@GLenum int pname, @GLuint int index, @OutParameter @Check("2") FloatBuffer val); void glSampleMaskIndexedNV(@GLuint int index, @GLbitfield int mask); void glTexRenderbufferNV(@GLenum int target, @GLuint int renderbuffer); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_blend_square.java0000644000175000017500000000314211543426511023613 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_blend_square { } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_texture_env_combine.java0000644000175000017500000000454311543426511025302 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_texture_env_combine { int GL_COMBINE_ARB = 0x8570; int GL_COMBINE_RGB_ARB = 0x8571; int GL_COMBINE_ALPHA_ARB = 0x8572; int GL_SOURCE0_RGB_ARB = 0x8580; int GL_SOURCE1_RGB_ARB = 0x8581; int GL_SOURCE2_RGB_ARB = 0x8582; int GL_SOURCE0_ALPHA_ARB = 0x8588; int GL_SOURCE1_ALPHA_ARB = 0x8589; int GL_SOURCE2_ALPHA_ARB = 0x858A; int GL_OPERAND0_RGB_ARB = 0x8590; int GL_OPERAND1_RGB_ARB = 0x8591; int GL_OPERAND2_RGB_ARB = 0x8592; int GL_OPERAND0_ALPHA_ARB = 0x8598; int GL_OPERAND1_ALPHA_ARB = 0x8599; int GL_OPERAND2_ALPHA_ARB = 0x859A; int GL_RGB_SCALE_ARB = 0x8573; int GL_ADD_SIGNED_ARB = 0x8574; int GL_INTERPOLATE_ARB = 0x8575; int GL_SUBTRACT_ARB = 0x84E7; int GL_CONSTANT_ARB = 0x8576; int GL_PRIMARY_COLOR_ARB = 0x8577; int GL_PREVIOUS_ARB = 0x8578; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_vertex_attrib_64bit.java0000644000175000017500000000723711543426511025167 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.Buffer; import java.nio.DoubleBuffer; @Dependent public interface EXT_vertex_attrib_64bit { /** Returned in the <type> parameter of GetActiveAttrib: */ int GL_DOUBLE_VEC2_EXT = 0x8FFC; int GL_DOUBLE_VEC3_EXT = 0x8FFD; int GL_DOUBLE_VEC4_EXT = 0x8FFE; int GL_DOUBLE_MAT2_EXT = 0x8F46; int GL_DOUBLE_MAT3_EXT = 0x8F47; int GL_DOUBLE_MAT4_EXT = 0x8F48; int GL_DOUBLE_MAT2x3_EXT = 0x8F49; int GL_DOUBLE_MAT2x4_EXT = 0x8F4A; int GL_DOUBLE_MAT3x2_EXT = 0x8F4B; int GL_DOUBLE_MAT3x4_EXT = 0x8F4C; int GL_DOUBLE_MAT4x2_EXT = 0x8F4D; int GL_DOUBLE_MAT4x3_EXT = 0x8F4E; void glVertexAttribL1dEXT(@GLuint int index, double x); void glVertexAttribL2dEXT(@GLuint int index, double x, double y); void glVertexAttribL3dEXT(@GLuint int index, double x, double y, double z); void glVertexAttribL4dEXT(@GLuint int index, double x, double y, double z, double w); @StripPostfix("v") void glVertexAttribL1dvEXT(@GLuint int index, @Const @Check("1") DoubleBuffer v); @StripPostfix("v") void glVertexAttribL2dvEXT(@GLuint int index, @Const @Check("2") DoubleBuffer v); @StripPostfix("v") void glVertexAttribL3dvEXT(@GLuint int index, @Const @Check("3") DoubleBuffer v); @StripPostfix("v") void glVertexAttribL4dvEXT(@GLuint int index, @Const @Check("4") DoubleBuffer v); void glVertexAttribLPointerEXT(@GLuint int index, int size, @Constant("GL11.GL_DOUBLE") @GLenum int type, @GLsizei int stride, @CachedReference(index = "index", name = "glVertexAttribPointer_buffer") @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLdouble Buffer pointer); @StripPostfix("params") void glGetVertexAttribLdvEXT(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") DoubleBuffer params); @Reuse("ARBVertexAttrib64bit") @Dependent("EXT_direct_state_access") void glVertexArrayVertexAttribLOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLuint int index, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_shader_stencil_export.java0000644000175000017500000000315311543426511025622 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_shader_stencil_export { }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_debug_output.java0000644000175000017500000001425611543426511023746 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLchar; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.ByteBuffer; import java.nio.IntBuffer; public interface ARB_debug_output { /** * Tokens accepted by the <target> parameters of Enable, Disable, * and IsEnabled: */ int GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB = 0x8242; /** * Tokens accepted by the <value> parameters of GetBooleanv, * GetIntegerv, GetFloatv, and GetDoublev: */ int GL_MAX_DEBUG_MESSAGE_LENGTH_ARB = 0x9143, GL_MAX_DEBUG_LOGGED_MESSAGES_ARB = 0x9144, GL_DEBUG_LOGGED_MESSAGES_ARB = 0x9145, GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB = 0x8243; /** Tokens accepted by the <pname> parameter of GetPointerv: */ int GL_DEBUG_CALLBACK_FUNCTION_ARB = 0x8244, GL_DEBUG_CALLBACK_USER_PARAM_ARB = 0x8245; /** * Tokens accepted or provided by the <source> parameters of * DebugMessageControlARB, DebugMessageInsertARB and DEBUGPROCARB, * and the <sources> parameter of GetDebugMessageLogARB: */ int GL_DEBUG_SOURCE_API_ARB = 0x8246, GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB = 0x8247, GL_DEBUG_SOURCE_SHADER_COMPILER_ARB = 0x8248, GL_DEBUG_SOURCE_THIRD_PARTY_ARB = 0x8249, GL_DEBUG_SOURCE_APPLICATION_ARB = 0x824A, GL_DEBUG_SOURCE_OTHER_ARB = 0x824B; /** * Tokens accepted or provided by the <type> parameters of * DebugMessageControlARB, DebugMessageInsertARB and DEBUGPROCARB, * and the <types> parameter of GetDebugMessageLogARB: */ int GL_DEBUG_TYPE_ERROR_ARB = 0x824C, GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB = 0x824D, GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB = 0x824E, GL_DEBUG_TYPE_PORTABILITY_ARB = 0x824F, GL_DEBUG_TYPE_PERFORMANCE_ARB = 0x8250, GL_DEBUG_TYPE_OTHER_ARB = 0x8251; /** * Tokens accepted or provided by the <severity> parameters of * DebugMessageControlARB, DebugMessageInsertARB and DEBUGPROCARB * callback functions, and the <severities> parameter of * GetDebugMessageLogARB: */ int GL_DEBUG_SEVERITY_HIGH_ARB = 0x9146, GL_DEBUG_SEVERITY_MEDIUM_ARB = 0x9147, GL_DEBUG_SEVERITY_LOW_ARB = 0x9148; void glDebugMessageControlARB(@GLenum int source, @GLenum int type, @GLenum int severity, @AutoSize(value = "ids", canBeNull = true) @GLsizei int count, @Check(canBeNull = true) @Const @GLuint IntBuffer ids, boolean enabled); void glDebugMessageInsertARB(@GLenum int source, @GLenum int type, @GLuint int id, @GLenum int severity, @AutoSize("buf") @GLsizei int length, @Const @GLchar ByteBuffer buf); @Alternate("glDebugMessageInsertARB") void glDebugMessageInsertARB(@GLenum int source, @GLenum int type, @GLuint int id, @GLenum int severity, @Constant("buf.length()") @GLsizei int length, CharSequence buf); /** * The {@code ARBDebugOutputCallback.Handler} implementation passed to this method will be used for * ARB_debug_output messages. If callback is null, any previously registered handler for the current * thread will be unregistered and stop receiving messages. * * @param callback the callback function to use */ @Code( // Create a GlobalRef to the callback object and register it with the current context. javaBeforeNative = "\t\tlong userParam = callback == null ? 0 : CallbackUtil.createGlobalRef(callback.getHandler());\n" + "\t\tCallbackUtil.registerContextCallbackARB(userParam);" ) void glDebugMessageCallbackARB(@PointerWrapper(value = "GLDEBUGPROCARB", canBeNull = true) ARBDebugOutputCallback callback, @Constant("userParam") @PointerWrapper("GLvoid *") long userParam); @GLuint int glGetDebugMessageLogARB(@GLuint int count, @AutoSize(value = "messageLog", canBeNull = true) @GLsizei int logSize, @Check(value = "count", canBeNull = true) @GLenum IntBuffer sources, @Check(value = "count", canBeNull = true) @GLenum IntBuffer types, @Check(value = "count", canBeNull = true) @GLuint IntBuffer ids, @Check(value = "count", canBeNull = true) @GLenum IntBuffer severities, @Check(value = "count", canBeNull = true) @GLsizei IntBuffer lengths, @Check(canBeNull = true) @OutParameter @GLchar ByteBuffer messageLog); // Not really useful and a pain to implement in Java //void glGetPointerv(@GLenum int pname, void**params); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_draw_buffers2.java0000644000175000017500000000556011543426511024025 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLboolean; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLreturn; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.IntBuffer; import java.nio.ByteBuffer; public interface EXT_draw_buffers2 { void glColorMaskIndexedEXT(@GLuint int buf, boolean r, boolean g, boolean b, boolean a); @StripPostfix("data") void glGetBooleanIndexedvEXT(@GLenum int value, @GLuint int index, @OutParameter @Check("4") @GLboolean ByteBuffer data); @Alternate("glGetBooleanIndexedvEXT") @GLreturn("data") @StripPostfix("data") void glGetBooleanIndexedvEXT2(@GLenum int value, @GLuint int index, @OutParameter @GLboolean ByteBuffer data); @StripPostfix("data") void glGetIntegerIndexedvEXT(@GLenum int value, @GLuint int index, @OutParameter @Check("4") IntBuffer data); @Alternate("glGetIntegerIndexedvEXT") @GLreturn("data") @StripPostfix("data") void glGetIntegerIndexedvEXT2(@GLenum int value, @GLuint int index, @OutParameter IntBuffer data); void glEnableIndexedEXT(@GLenum int target, @GLuint int index); void glDisableIndexedEXT(@GLenum int target, @GLuint int index); boolean glIsEnabledIndexedEXT(@GLenum int target, @GLuint int index); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_shader_image_load_store.java0000644000175000017500000001130611543426511026110 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLbitfield; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLuint; public interface EXT_shader_image_load_store { /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_MAX_IMAGE_UNITS_EXT = 0x8F38; int GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT = 0x8F39; int GL_MAX_IMAGE_SAMPLES_EXT = 0x906D; /** Accepted by the <target> parameter of GetIntegeri_v and GetBooleani_v: */ int GL_IMAGE_BINDING_NAME_EXT = 0x8F3A; int GL_IMAGE_BINDING_LEVEL_EXT = 0x8F3B; int GL_IMAGE_BINDING_LAYERED_EXT = 0x8F3C; int GL_IMAGE_BINDING_LAYER_EXT = 0x8F3D; int GL_IMAGE_BINDING_ACCESS_EXT = 0x8F3E; int GL_IMAGE_BINDING_FORMAT_EXT = 0x906E; /** Accepted by the <barriers> parameter of MemoryBarrierEXT: */ int GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT = 0x00000001; int GL_ELEMENT_ARRAY_BARRIER_BIT_EXT = 0x00000002; int GL_UNIFORM_BARRIER_BIT_EXT = 0x00000004; int GL_TEXTURE_FETCH_BARRIER_BIT_EXT = 0x00000008; int GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT = 0x00000020; int GL_COMMAND_BARRIER_BIT_EXT = 0x00000040; int GL_PIXEL_BUFFER_BARRIER_BIT_EXT = 0x00000080; int GL_TEXTURE_UPDATE_BARRIER_BIT_EXT = 0x00000100; int GL_BUFFER_UPDATE_BARRIER_BIT_EXT = 0x00000200; int GL_FRAMEBUFFER_BARRIER_BIT_EXT = 0x00000400; int GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT = 0x00000800; int GL_ATOMIC_COUNTER_BARRIER_BIT_EXT = 0x00001000; int GL_ALL_BARRIER_BITS_EXT = 0xFFFFFFFF; /** Returned by the <type> parameter of GetActiveUniform: */ int GL_IMAGE_1D_EXT = 0x904C; int GL_IMAGE_2D_EXT = 0x904D; int GL_IMAGE_3D_EXT = 0x904E; int GL_IMAGE_2D_RECT_EXT = 0x904F; int GL_IMAGE_CUBE_EXT = 0x9050; int GL_IMAGE_BUFFER_EXT = 0x9051; int GL_IMAGE_1D_ARRAY_EXT = 0x9052; int GL_IMAGE_2D_ARRAY_EXT = 0x9053; int GL_IMAGE_CUBE_MAP_ARRAY_EXT = 0x9054; int GL_IMAGE_2D_MULTISAMPLE_EXT = 0x9055; int GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT = 0x9056; int GL_INT_IMAGE_1D_EXT = 0x9057; int GL_INT_IMAGE_2D_EXT = 0x9058; int GL_INT_IMAGE_3D_EXT = 0x9059; int GL_INT_IMAGE_2D_RECT_EXT = 0x905A; int GL_INT_IMAGE_CUBE_EXT = 0x905B; int GL_INT_IMAGE_BUFFER_EXT = 0x905C; int GL_INT_IMAGE_1D_ARRAY_EXT = 0x905D; int GL_INT_IMAGE_2D_ARRAY_EXT = 0x905E; int GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT = 0x905F; int GL_INT_IMAGE_2D_MULTISAMPLE_EXT = 0x9060; int GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT = 0x9061; int GL_UNSIGNED_INT_IMAGE_1D_EXT = 0x9062; int GL_UNSIGNED_INT_IMAGE_2D_EXT = 0x9063; int GL_UNSIGNED_INT_IMAGE_3D_EXT = 0x9064; int GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT = 0x9065; int GL_UNSIGNED_INT_IMAGE_CUBE_EXT = 0x9066; int GL_UNSIGNED_INT_IMAGE_BUFFER_EXT = 0x9067; int GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT = 0x9068; int GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT = 0x9069; int GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT = 0x906A; int GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT = 0x906B; int GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT = 0x906C; void glBindImageTextureEXT(@GLuint int index, @GLuint int texture, int level, boolean layered, int layer, @GLenum int access, int format); void glMemoryBarrierEXT(@GLbitfield int barriers); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_texture_barrier.java0000644000175000017500000000320311543426511024353 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_texture_barrier { void glTextureBarrierNV(); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_multitexture.java0000644000175000017500000001035211543426511024004 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; public interface ARB_multitexture { int GL_TEXTURE0_ARB = 0x84C0; int GL_TEXTURE1_ARB = 0x84C1; int GL_TEXTURE2_ARB = 0x84C2; int GL_TEXTURE3_ARB = 0x84C3; int GL_TEXTURE4_ARB = 0x84C4; int GL_TEXTURE5_ARB = 0x84C5; int GL_TEXTURE6_ARB = 0x84C6; int GL_TEXTURE7_ARB = 0x84C7; int GL_TEXTURE8_ARB = 0x84C8; int GL_TEXTURE9_ARB = 0x84C9; int GL_TEXTURE10_ARB = 0x84CA; int GL_TEXTURE11_ARB = 0x84CB; int GL_TEXTURE12_ARB = 0x84CC; int GL_TEXTURE13_ARB = 0x84CD; int GL_TEXTURE14_ARB = 0x84CE; int GL_TEXTURE15_ARB = 0x84CF; int GL_TEXTURE16_ARB = 0x84D0; int GL_TEXTURE17_ARB = 0x84D1; int GL_TEXTURE18_ARB = 0x84D2; int GL_TEXTURE19_ARB = 0x84D3; int GL_TEXTURE20_ARB = 0x84D4; int GL_TEXTURE21_ARB = 0x84D5; int GL_TEXTURE22_ARB = 0x84D6; int GL_TEXTURE23_ARB = 0x84D7; int GL_TEXTURE24_ARB = 0x84D8; int GL_TEXTURE25_ARB = 0x84D9; int GL_TEXTURE26_ARB = 0x84DA; int GL_TEXTURE27_ARB = 0x84DB; int GL_TEXTURE28_ARB = 0x84DC; int GL_TEXTURE29_ARB = 0x84DD; int GL_TEXTURE30_ARB = 0x84DE; int GL_TEXTURE31_ARB = 0x84DF; int GL_ACTIVE_TEXTURE_ARB = 0x84E0; int GL_CLIENT_ACTIVE_TEXTURE_ARB = 0x84E1; int GL_MAX_TEXTURE_UNITS_ARB = 0x84E2; void glClientActiveTextureARB(@GLenum int texture); void glActiveTextureARB(@GLenum int texture); @NoErrorCheck void glMultiTexCoord1fARB(@GLenum int target, float s); @NoErrorCheck void glMultiTexCoord1dARB(@GLenum int target, double s); @NoErrorCheck void glMultiTexCoord1iARB(@GLenum int target, int s); @NoErrorCheck void glMultiTexCoord1sARB(@GLenum int target, short s); @NoErrorCheck void glMultiTexCoord2fARB(@GLenum int target, float s, float t); @NoErrorCheck void glMultiTexCoord2dARB(@GLenum int target, double s, double t); @NoErrorCheck void glMultiTexCoord2iARB(@GLenum int target, int s, int t); @NoErrorCheck void glMultiTexCoord2sARB(@GLenum int target, short s, short t); @NoErrorCheck void glMultiTexCoord3fARB(@GLenum int target, float s, float t, float r); @NoErrorCheck void glMultiTexCoord3dARB(@GLenum int target, double s, double t, double r); @NoErrorCheck void glMultiTexCoord3iARB(@GLenum int target, int s, int t, int r); @NoErrorCheck void glMultiTexCoord3sARB(@GLenum int target, short s, short t, short r); @NoErrorCheck void glMultiTexCoord4fARB(@GLenum int target, float s, float t, float r, float q); @NoErrorCheck void glMultiTexCoord4dARB(@GLenum int target, double s, double t, double r, double q); @NoErrorCheck void glMultiTexCoord4iARB(@GLenum int target, int s, int t, int r, int q); @NoErrorCheck void glMultiTexCoord4sARB(@GLenum int target, short s, short t, short r, short q); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_sRGB_decode.java0000644000175000017500000000442511543426511025151 0ustar zero79zero79/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_texture_sRGB_decode { /** * Accepted by the <pname> parameter of TexParameterf, TexParameteri, * GetTexParameterfv, GetTexParameteriv, SamplerParameteri, * SamplerParameterf, SamplerParameteriv, SamplerParameterfv, * SamplerParameterIiv, SamplerParameterIuiv, GetSamplerParameteriv, * GetSamplerParameterfv, GetSamplerParameterIiv, and GetSamplerParameterIuiv: */ int GL_TEXTURE_SRGB_DECODE_EXT = 0x8A48; /** * Accepted by the <enum> parameter of TexParameterf, TexParameteri, * SamplerParameteri, SamplerParameterf, SamplerParameteriv, SamplerParameterfv, * SamplerParameterIiv and SamplerParameterIuiv: */ int GL_DECODE_EXT = 0x8A49, GL_SKIP_DECODE_EXT = 0x8A4A; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java0000644000175000017500000000547511543426511024333 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLreturn; import org.lwjgl.util.generator.opengl.GLsizei; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.IntBuffer; public interface AMD_name_gen_delete { /** Accepted as the <identifier> parameter of GenNamesAMD and DeleteNamesAMD: */ int GL_DATA_BUFFER_AMD = 0x9151, GL_PERFORMANCE_MONITOR_AMD = 0x9152, GL_QUERY_OBJECT_AMD = 0x9153, GL_VERTEX_ARRAY_OBJECT_AMD = 0x9154, GL_SAMPLER_OBJECT_AMD = 0x9155; void glGenNamesAMD(@GLenum int identifier, @AutoSize("names") @GLuint int num, @OutParameter @GLuint IntBuffer names); @Alternate("glGenNamesAMD") @GLreturn("names") void glGenNamesAMD2(@GLenum int identifier, @Constant("1") @GLsizei int num, @OutParameter @GLuint IntBuffer names); void glDeleteNamesAMD(@GLenum int identifier, @AutoSize("names") @GLsizei int num, @Const @GLuint IntBuffer names); @Alternate("glDeleteNamesAMD") void glDeleteNamesAMD(@GLenum int identifier, @Constant("1") @GLsizei int num, @Constant(value = "APIUtil.getBufferInt().put(0, name), 0", keepParam = true) int name); boolean glIsNameAMD(@GLenum int identifier, @GLuint int name); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_cl_event.java0000644000175000017500000000452111543426511023031 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.opencl.CLContext; import org.lwjgl.opencl.CLEvent; import org.lwjgl.util.generator.Extension; import org.lwjgl.util.generator.Imports; import org.lwjgl.util.generator.PointerWrapper; import org.lwjgl.util.generator.opengl.GLbitfield; @Imports("org.lwjgl.opencl.*") @Extension(postfix = "ARB", className = "ARBCLEvent") public interface ARB_cl_event { /** Returned in <values> for GetSynciv <pname> OBJECT_TYPE. */ int GL_SYNC_CL_EVENT_ARB = 0x8240; /** Returned in <values> for GetSynciv <pname> SYNC_CONDITION. */ int GL_SYNC_CL_EVENT_COMPLETE_ARB = 0x8241; @PointerWrapper("GLsync") GLSync glCreateSyncFromCLeventARB(@PointerWrapper("cl_context") CLContext context, @PointerWrapper("cl_event") CLEvent event, @GLbitfield int flags); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/APPLE_element_array.java0000644000175000017500000000637511543426511024327 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.Buffer; import java.nio.IntBuffer; public interface APPLE_element_array { /** * Accepted by the <array> parameter of EnableClientState and * DisableClientState and the <value> parameter of IsEnabled: */ int GL_ELEMENT_ARRAY_APPLE = 0x8768; /** * Accepted by the <value> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_ELEMENT_ARRAY_TYPE_APPLE = 0x8769; /** Accepted by the <pname> parameter of GetPointerv: */ int GL_ELEMENT_ARRAY_POINTER_APPLE = 0x876A; void glElementPointerAPPLE(@AutoType("pointer") @GLenum int type, @Check @Const @GLubyte @GLushort @GLuint Buffer pointer); void glDrawElementArrayAPPLE(@GLenum int mode, int first, @GLsizei int count); void glDrawRangeElementArrayAPPLE(@GLenum int mode, @GLuint int start, @GLuint int end, int first, @GLsizei int count); void glMultiDrawElementArrayAPPLE(@GLenum int mode, @Const IntBuffer first, @Const @Check("first.remaining()") @GLsizei IntBuffer count, @AutoSize("first") @GLsizei int primcount); void glMultiDrawRangeElementArrayAPPLE(@GLenum int mode, @GLuint int start, @GLuint int end, @Const IntBuffer first, @Const @Check("first.remaining()") @GLsizei IntBuffer count, @AutoSize("first") @GLsizei int primcount); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/APPLE_float_pixels.java0000644000175000017500000000467311543426511024170 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface APPLE_float_pixels { /** * Accepted by the parameters of DrawPixels, ReadPixels, TexImage1D, * TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D, TexSubImage3D, and * GetTexImage: */ int GL_HALF_APPLE = 0x140B; /** Accepted by the GetBooleanv: */ int GL_COLOR_FLOAT_APPLE = 0x8A0F; /** * Accepted by the parameter of TexImage1D, * TexImage2D, and TexImage3D: */ int GL_RGBA_FLOAT32_APPLE = 0x8814; int GL_RGB_FLOAT32_APPLE = 0x8815; int GL_ALPHA_FLOAT32_APPLE = 0x8816; int GL_INTENSITY_FLOAT32_APPLE = 0x8817; int GL_LUMINANCE_FLOAT32_APPLE = 0x8818; int GL_LUMINANCE_ALPHA_FLOAT32_APPLE = 0x8819; int GL_RGBA_FLOAT16_APPLE = 0x881A; int GL_RGB_FLOAT16_APPLE = 0x881B; int GL_ALPHA_FLOAT16_APPLE = 0x881C; int GL_INTENSITY_FLOAT16_APPLE = 0x881D; int GL_LUMINANCE_FLOAT16_APPLE = 0x881E; int GL_LUMINANCE_ALPHA_FLOAT16_APPLE = 0x881F; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_texture_shader3.java0000644000175000017500000000464011543426511024264 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_texture_shader3 { int GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV = 0x8850; int GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV = 0x8851; int GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV = 0x8852; int GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV = 0x8853; int GL_OFFSET_HILO_TEXTURE_2D_NV = 0x8854; int GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV = 0x8855; int GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV = 0x8856; int GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV = 0x8857; int GL_DEPENDENT_HILO_TEXTURE_2D_NV = 0x8858; int GL_DEPENDENT_RGB_TEXTURE_3D_NV = 0x8859; int GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV = 0x885A; int GL_DOT_PRODUCT_PASS_THROUGH_NV = 0x885B; int GL_DOT_PRODUCT_TEXTURE_1D_NV = 0x885C; int GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV = 0x885D; int GL_HILO8_NV = 0x885E; int GL_SIGNED_HILO8_NV = 0x885F; int GL_FORCE_BLUE_TO_ONE_NV = 0x8860; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NVX_gpu_memory_info.java0000644000175000017500000000401111543426511024471 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** Experimental extension, may be removed/changed in the future. */ public interface NVX_gpu_memory_info { /** Accepted by the <pname> parameter of GetIntegerv: */ int GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX = 0x9047; int GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX = 0x9048; int GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX = 0x9049; int GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX = 0x904A; int GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX = 0x904B; }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_window_pos.java0000644000175000017500000000421511543426511023422 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.DeprecatedGL; @DeprecatedGL public interface ARB_window_pos { @DeprecatedGL void glWindowPos2fARB(float x, float y); @DeprecatedGL void glWindowPos2dARB(double x, double y); @DeprecatedGL void glWindowPos2iARB(int x, int y); @DeprecatedGL void glWindowPos2sARB(short x, short y); @DeprecatedGL void glWindowPos3fARB(float x, float y, float z); @DeprecatedGL void glWindowPos3dARB(double x, double y, double z); @DeprecatedGL void glWindowPos3iARB(int x, int y, int z); @DeprecatedGL void glWindowPos3sARB(short x, short y, short z); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/APPLE_vertex_program_evaluators.java0000644000175000017500000000723111543426511027001 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.Check; import org.lwjgl.util.generator.Const; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.DoubleBuffer; import java.nio.FloatBuffer; public interface APPLE_vertex_program_evaluators { /** * Accepted by the <pname> parameter of EnableVertexAttribAPPLE, * DisableVertexAttribAPPLE, and IsVertexAttribEnabledAPPLE. */ int GL_VERTEX_ATTRIB_MAP1_APPLE = 0x8A00; int GL_VERTEX_ATTRIB_MAP2_APPLE = 0x8A01; /** * Accepted by the <pname> parameter of GetVertexAttribdvARB, * GetVertexAttribfvARB, and GetVertexAttribivARB. */ int GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE = 0x8A02; int GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE = 0x8A03; int GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE = 0x8A04; int GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE = 0x8A05; int GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE = 0x8A06; int GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE = 0x8A07; int GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE = 0x8A08; int GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE = 0x8A09; void glEnableVertexAttribAPPLE(@GLuint int index, @GLenum int pname); void glDisableVertexAttribAPPLE(@GLuint int index, @GLenum int pname); boolean glIsVertexAttribEnabledAPPLE(@GLuint int index, @GLenum int pname); void glMapVertexAttrib1dAPPLE(@GLuint int index, @GLuint int size, double u1, double u2, int stride, int order, @Check @Const DoubleBuffer points); void glMapVertexAttrib1fAPPLE(@GLuint int index, @GLuint int size, float u1, float u2, int stride, int order, @Check @Const FloatBuffer points); void glMapVertexAttrib2dAPPLE(@GLuint int index, @GLuint int size, double u1, double u2, int ustride, int uorder, double v1, double v2, int vstride, int vorder, @Check @Const DoubleBuffer points); void glMapVertexAttrib2fAPPLE(@GLuint int index, @GLuint int size, float u1, float u2, int ustride, int uorder, float v1, float v2, int vstride, int vorder, @Check @Const FloatBuffer points); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_fragment_shader.java0000644000175000017500000000440211543426511024361 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface ARB_fragment_shader { /** * Accepted by the <shaderType> argument of CreateShaderObjectARB and * returned by the <params> parameter of GetObjectParameter{fi}vARB: */ int GL_FRAGMENT_SHADER_ARB = 0x8B30; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB = 0x8B49; int GL_MAX_TEXTURE_COORDS_ARB = 0x8871; int GL_MAX_TEXTURE_IMAGE_UNITS_ARB = 0x8872; /** * Accepted by the <target> parameter of Hint and the <pname> parameter of * GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev: */ int GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB = 0x8B8B; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_texture_expand_normal.java0000644000175000017500000000350611543426511025562 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_texture_expand_normal { /** * Accepted by the <pname> parameters of TexParameteri, * TexParameteriv, TexParameterf, TexParameterfv, GetTexParameteri, * and GetTexParameteriv: */ int GL_TEXTURE_UNSIGNED_REMAP_MODE_NV = 0x888F; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_provoking_vertex.java0000644000175000017500000000414211543426511024644 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.Reuse; import org.lwjgl.util.generator.opengl.GLenum; public interface ARB_provoking_vertex { /** Accepted by the <mode> parameter of ProvokingVertex: */ int GL_FIRST_VERTEX_CONVENTION = 0x8E4D; int GL_LAST_VERTEX_CONVENTION = 0x8E4E; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_PROVOKING_VERTEX = 0x8E4F; int GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION = 0x8E4C; @Reuse("GL32") void glProvokingVertex(@GLenum int mode); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/GL33.java0000644000175000017500000003546411543426511021230 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.LongBuffer; @DeprecatedGL public interface GL33 { // ----------------------------------------------------------------------- // ----------------------[ ARB_blend_func_extended ]---------------------- // ----------------------------------------------------------------------- /** * Accepted by the <src> and <dst> parameters of BlendFunc and * BlendFunci, and by the <srcRGB>, <dstRGB>, <srcAlpha> and <dstAlpha> * parameters of BlendFuncSeparate and BlendFuncSeparatei: */ int GL_SRC1_COLOR = 0x88F9; int GL_SRC1_ALPHA = GL15.GL_SRC1_ALPHA; int GL_ONE_MINUS_SRC1_COLOR = 0x88FA; int GL_ONE_MINUS_SRC1_ALPHA = 0x88FB; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv * and GetDoublev: */ int GL_MAX_DUAL_SOURCE_DRAW_BUFFERS = 0x88FC; void glBindFragDataLocationIndexed(@GLuint int program, @GLuint int colorNumber, @GLuint int index, @NullTerminated @Const @GLchar ByteBuffer name); @Alternate("glBindFragDataLocationIndexed") void glBindFragDataLocationIndexed(@GLuint int program, @GLuint int colorNumber, @GLuint int index, @NullTerminated CharSequence name); int glGetFragDataIndex(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name); @Alternate("glGetFragDataIndex") int glGetFragDataIndex(@GLuint int program, @NullTerminated CharSequence name); // -------------------------------------------------------------------- // ----------------------[ ARB_occlusion_query2 ]---------------------- // -------------------------------------------------------------------- /** * Accepted by the <target> parameter of BeginQuery, EndQuery, * and GetQueryiv: */ int GL_ANY_SAMPLES_PASSED = 0x8C2F; // ------------------------------------------------------------------- // ----------------------[ ARB_sampler_objects ]---------------------- // ------------------------------------------------------------------- /** * Accepted by the <value> parameter of the GetBooleanv, GetIntegerv, * GetInteger64v, GetFloatv and GetDoublev functions: */ int GL_SAMPLER_BINDING = 0x8919; void glGenSamplers(@AutoSize("samplers") @GLsizei int count, @OutParameter @GLuint IntBuffer samplers); @Alternate("glGenSamplers") @GLreturn("samplers") void glGenSamplers2(@Constant("1") @GLsizei int count, @OutParameter @GLuint IntBuffer samplers); void glDeleteSamplers(@AutoSize("samplers") @GLsizei int count, @Const @GLuint IntBuffer samplers); @Alternate("glDeleteSamplers") void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtil.getBufferInt().put(0, sampler), 0", keepParam = true) int sampler); boolean glIsSampler(@GLuint int sampler); void glBindSampler(@GLenum int unit, @GLuint int sampler); void glSamplerParameteri(@GLuint int sampler, @GLenum int pname, int param); void glSamplerParameterf(@GLuint int sampler, @GLenum int pname, float param); @StripPostfix("params") void glSamplerParameteriv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const IntBuffer params); @StripPostfix("params") void glSamplerParameterfv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const FloatBuffer params); @StripPostfix("params") void glSamplerParameterIiv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const IntBuffer params); @StripPostfix("params") void glSamplerParameterIuiv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const @GLuint IntBuffer params); @StripPostfix("params") void glGetSamplerParameteriv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); @Alternate("glGetSamplerParameteriv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetSamplerParameteriv2(@GLuint int sampler, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") void glGetSamplerParameterfv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter FloatBuffer params); @Alternate("glGetSamplerParameterfv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetSamplerParameterfv2(@GLuint int sampler, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") void glGetSamplerParameterIiv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); @Alternate("glGetSamplerParameterIiv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetSamplerParameterIiv2(@GLuint int sampler, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") void glGetSamplerParameterIuiv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); @Alternate("glGetSamplerParameterIuiv") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetSamplerParameterIuiv2(@GLuint int sampler, @GLenum int pname, @OutParameter IntBuffer params); // ------------------------------------------------------------------- // ----------------------[ ARB_texture_rgb10_a2ui ]---------------------- // ------------------------------------------------------------------- /** * Accepted by the <internalFormat> parameter of TexImage1D, TexImage2D, * TexImage3D, CopyTexImage1D, CopyTexImage2D, RenderbufferStorage and * RenderbufferStorageMultisample: */ int GL_RGB10_A2UI = 0x906F; // ------------------------------------------------------------------- // ----------------------[ ARB_texture_swizzle ]---------------------- // ------------------------------------------------------------------- /** * Accepted by the <pname> parameters of TexParameteri, * TexParameterf, TexParameteriv, TexParameterfv, * GetTexParameterfv, and GetTexParameteriv: */ int GL_TEXTURE_SWIZZLE_R = 0x8E42; int GL_TEXTURE_SWIZZLE_G = 0x8E43; int GL_TEXTURE_SWIZZLE_B = 0x8E44; int GL_TEXTURE_SWIZZLE_A = 0x8E45; /** * Accepted by the <pname> parameters of TexParameteriv, * TexParameterfv, GetTexParameterfv, and GetTexParameteriv: */ int GL_TEXTURE_SWIZZLE_RGBA = 0x8E46; // --------------------------------------------------------------- // ----------------------[ ARB_timer_query ]---------------------- // --------------------------------------------------------------- /** * Accepted by the <target> parameter of BeginQuery, EndQuery, and * GetQueryiv: */ int GL_TIME_ELAPSED = 0x88BF; /** * Accepted by the <target> parameter of GetQueryiv and QueryCounter. * Accepted by the <value> parameter of GetBooleanv, GetIntegerv, * GetInteger64v, GetFloatv, and GetDoublev: */ int GL_TIMESTAMP = 0x8E28; void glQueryCounter(@GLuint int id, @GLenum int target); @StripPostfix("params") void glGetQueryObjecti64v(@GLuint int id, @GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer params); @Alternate("glGetQueryObjecti64v") @GLreturn("params") @StripPostfix("params") void glGetQueryObjecti64v2(@GLuint int id, @GLenum int pname, @OutParameter @GLint64 LongBuffer params); @StripPostfix("params") void glGetQueryObjectui64v(@GLuint int id, @GLenum int pname, @OutParameter @Check("1") @GLuint64 LongBuffer params); @Alternate("glGetQueryObjectui64v") @GLreturn("params") @StripPostfix("params") void glGetQueryObjectui64v2(@GLuint int id, @GLenum int pname, @OutParameter @GLuint64 LongBuffer params); // -------------------------------------------------------------------- // ----------------------[ ARB_instanced_arrays ]---------------------- // -------------------------------------------------------------------- /** * Accepted by the <pname> parameters of GetVertexAttribdv, * GetVertexAttribfv, and GetVertexAttribiv: */ int GL_VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE; void glVertexAttribDivisor(@GLuint int index, @GLuint int divisor); // ------------------------------------------------------------------------------ // ----------------------[ ARB_vertex_type_2_10_10_10_rev ]---------------------- // ------------------------------------------------------------------------------ /** * Accepted by the <type> parameter of VertexAttribPointer, VertexPointer, * NormalPointer, ColorPointer, SecondaryColorPointer, TexCoordPointer, * VertexAttribP{1234}ui, VertexP*, TexCoordP*, MultiTexCoordP*, NormalP3ui, * ColorP*, SecondaryColorP* and VertexAttribP* */ int GL_INT_2_10_10_10_REV = 0x8D9F; @NoErrorCheck @DeprecatedGL void glVertexP2ui(@GLenum int type, @GLuint int value); @NoErrorCheck @DeprecatedGL void glVertexP3ui(@GLenum int type, @GLuint int value); @NoErrorCheck @DeprecatedGL void glVertexP4ui(@GLenum int type, @GLuint int value); @NoErrorCheck @DeprecatedGL @StripPostfix("value") void glVertexP2uiv(@GLenum int type, @Check("2") @Const @GLuint IntBuffer value); @NoErrorCheck @DeprecatedGL @StripPostfix("value") void glVertexP3uiv(@GLenum int type, @Check("3") @Const @GLuint IntBuffer value); @NoErrorCheck @DeprecatedGL @StripPostfix("value") void glVertexP4uiv(@GLenum int type, @Check("4") @Const @GLuint IntBuffer value); @NoErrorCheck @DeprecatedGL void glTexCoordP1ui(@GLenum int type, @GLuint int coords); @NoErrorCheck @DeprecatedGL void glTexCoordP2ui(@GLenum int type, @GLuint int coords); @NoErrorCheck @DeprecatedGL void glTexCoordP3ui(@GLenum int type, @GLuint int coords); @NoErrorCheck @DeprecatedGL void glTexCoordP4ui(@GLenum int type, @GLuint int coords); @NoErrorCheck @DeprecatedGL @StripPostfix("coords") void glTexCoordP1uiv(@GLenum int type, @Check("1") @Const @GLuint IntBuffer coords); @NoErrorCheck @DeprecatedGL @StripPostfix("coords") void glTexCoordP2uiv(@GLenum int type, @Check("2") @Const @GLuint IntBuffer coords); @NoErrorCheck @DeprecatedGL @StripPostfix("coords") void glTexCoordP3uiv(@GLenum int type, @Check("3") @Const @GLuint IntBuffer coords); @NoErrorCheck @DeprecatedGL @StripPostfix("coords") void glTexCoordP4uiv(@GLenum int type, @Check("4") @Const @GLuint IntBuffer coords); @NoErrorCheck @DeprecatedGL void glMultiTexCoordP1ui(@GLenum int texture, @GLenum int type, @GLuint int coords); @NoErrorCheck @DeprecatedGL void glMultiTexCoordP2ui(@GLenum int texture, @GLenum int type, @GLuint int coords); @NoErrorCheck @DeprecatedGL void glMultiTexCoordP3ui(@GLenum int texture, @GLenum int type, @GLuint int coords); @NoErrorCheck @DeprecatedGL void glMultiTexCoordP4ui(@GLenum int texture, @GLenum int type, @GLuint int coords); @NoErrorCheck @DeprecatedGL @StripPostfix("coords") void glMultiTexCoordP1uiv(@GLenum int texture, @GLenum int type, @Check("1") @Const @GLuint IntBuffer coords); @NoErrorCheck @DeprecatedGL @StripPostfix("coords") void glMultiTexCoordP2uiv(@GLenum int texture, @GLenum int type, @Check("2") @Const @GLuint IntBuffer coords); @NoErrorCheck @DeprecatedGL @StripPostfix("coords") void glMultiTexCoordP3uiv(@GLenum int texture, @GLenum int type, @Check("3") @Const @GLuint IntBuffer coords); @NoErrorCheck @DeprecatedGL @StripPostfix("coords") void glMultiTexCoordP4uiv(@GLenum int texture, @GLenum int type, @Check("4") @Const @GLuint IntBuffer coords); @NoErrorCheck @DeprecatedGL void glNormalP3ui(@GLenum int type, @GLuint int coords); @NoErrorCheck @DeprecatedGL @StripPostfix("coords") void glNormalP3uiv(@GLenum int type, @Check("3") @Const @GLuint IntBuffer coords); @NoErrorCheck @DeprecatedGL void glColorP3ui(@GLenum int type, @GLuint int color); @NoErrorCheck @DeprecatedGL void glColorP4ui(@GLenum int type, @GLuint int color); @NoErrorCheck @DeprecatedGL @StripPostfix("color") void glColorP3uiv(@GLenum int type, @Check("3") @Const @GLuint IntBuffer color); @NoErrorCheck @DeprecatedGL @StripPostfix("color") void glColorP4uiv(@GLenum int type, @Check("4") @Const @GLuint IntBuffer color); @NoErrorCheck @DeprecatedGL void glSecondaryColorP3ui(@GLenum int type, @GLuint int color); @NoErrorCheck @DeprecatedGL @StripPostfix("color") void glSecondaryColorP3uiv(@GLenum int type, @Check("3") @Const @GLuint IntBuffer color); @NoErrorCheck @DeprecatedGL void glVertexAttribP1ui(@GLuint int index, @GLenum int type, boolean normalized, @GLuint int value); @NoErrorCheck @DeprecatedGL void glVertexAttribP2ui(@GLuint int index, @GLenum int type, boolean normalized, @GLuint int value); @NoErrorCheck @DeprecatedGL void glVertexAttribP3ui(@GLuint int index, @GLenum int type, boolean normalized, @GLuint int value); @NoErrorCheck @DeprecatedGL void glVertexAttribP4ui(@GLuint int index, @GLenum int type, boolean normalized, @GLuint int value); @NoErrorCheck @DeprecatedGL @StripPostfix("value") void glVertexAttribP1uiv(@GLuint int index, @GLenum int type, boolean normalized, @Check("1") @Const @GLuint IntBuffer value); @NoErrorCheck @DeprecatedGL @StripPostfix("value") void glVertexAttribP2uiv(@GLuint int index, @GLenum int type, boolean normalized, @Check("2") @Const @GLuint IntBuffer value); @NoErrorCheck @DeprecatedGL @StripPostfix("value") void glVertexAttribP3uiv(@GLuint int index, @GLenum int type, boolean normalized, @Check("3") @Const @GLuint IntBuffer value); @NoErrorCheck @DeprecatedGL @StripPostfix("value") void glVertexAttribP4uiv(@GLuint int index, @GLenum int type, boolean normalized, @Check("4") @Const @GLuint IntBuffer value); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_shadow_funcs.java0000644000175000017500000000314311543426511023750 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_shadow_funcs { } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/AMD_shader_stencil_export.java0000644000175000017500000000315311543426511025617 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface AMD_shader_stencil_export { }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_vertex_type_2_10_10_10_rev.java0000644000175000017500000001612311543426511026006 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.IntBuffer; @Extension(postfix = "", className = "ARBVertexType2_10_10_10_REV") public interface ARB_vertex_type_2_10_10_10_rev { /** * Accepted by the <type> parameter of VertexAttribPointer, VertexPointer, * NormalPointer, ColorPointer, SecondaryColorPointer, TexCoordPointer, * VertexAttribP{1234}ui, VertexP*, TexCoordP*, MultiTexCoordP*, NormalP3ui, * ColorP*, SecondaryColorP* and VertexAttribP* */ int GL_UNSIGNED_INT_2_10_10_10_REV = GL12.GL_UNSIGNED_INT_2_10_10_10_REV; int GL_INT_2_10_10_10_REV = 0x8D9F; @Reuse("GL33") @NoErrorCheck void glVertexP2ui(@GLenum int type, @GLuint int value); @Reuse("GL33") @NoErrorCheck void glVertexP3ui(@GLenum int type, @GLuint int value); @Reuse("GL33") @NoErrorCheck void glVertexP4ui(@GLenum int type, @GLuint int value); @Reuse("GL33") @NoErrorCheck @StripPostfix("value") void glVertexP2uiv(@GLenum int type, @Check("2") @Const @GLuint IntBuffer value); @Reuse("GL33") @NoErrorCheck @StripPostfix("value") void glVertexP3uiv(@GLenum int type, @Check("3") @Const @GLuint IntBuffer value); @Reuse("GL33") @NoErrorCheck @StripPostfix("value") void glVertexP4uiv(@GLenum int type, @Check("4") @Const @GLuint IntBuffer value); @Reuse("GL33") @NoErrorCheck void glTexCoordP1ui(@GLenum int type, @GLuint int coords); @Reuse("GL33") @NoErrorCheck void glTexCoordP2ui(@GLenum int type, @GLuint int coords); @Reuse("GL33") @NoErrorCheck void glTexCoordP3ui(@GLenum int type, @GLuint int coords); @Reuse("GL33") @NoErrorCheck void glTexCoordP4ui(@GLenum int type, @GLuint int coords); @Reuse("GL33") @NoErrorCheck @StripPostfix("coords") void glTexCoordP1uiv(@GLenum int type, @Check("1") @Const @GLuint IntBuffer coords); @Reuse("GL33") @NoErrorCheck @StripPostfix("coords") void glTexCoordP2uiv(@GLenum int type, @Check("2") @Const @GLuint IntBuffer coords); @Reuse("GL33") @NoErrorCheck @StripPostfix("coords") void glTexCoordP3uiv(@GLenum int type, @Check("3") @Const @GLuint IntBuffer coords); @Reuse("GL33") @NoErrorCheck @StripPostfix("coords") void glTexCoordP4uiv(@GLenum int type, @Check("4") @Const @GLuint IntBuffer coords); @Reuse("GL33") @NoErrorCheck void glMultiTexCoordP1ui(@GLenum int texture, @GLenum int type, @GLuint int coords); @Reuse("GL33") @NoErrorCheck void glMultiTexCoordP2ui(@GLenum int texture, @GLenum int type, @GLuint int coords); @Reuse("GL33") @NoErrorCheck void glMultiTexCoordP3ui(@GLenum int texture, @GLenum int type, @GLuint int coords); @Reuse("GL33") @NoErrorCheck void glMultiTexCoordP4ui(@GLenum int texture, @GLenum int type, @GLuint int coords); @Reuse("GL33") @NoErrorCheck @StripPostfix("coords") void glMultiTexCoordP1uiv(@GLenum int texture, @GLenum int type, @Check("1") @Const @GLuint IntBuffer coords); @Reuse("GL33") @NoErrorCheck @StripPostfix("coords") void glMultiTexCoordP2uiv(@GLenum int texture, @GLenum int type, @Check("2") @Const @GLuint IntBuffer coords); @Reuse("GL33") @NoErrorCheck @StripPostfix("coords") void glMultiTexCoordP3uiv(@GLenum int texture, @GLenum int type, @Check("3") @Const @GLuint IntBuffer coords); @Reuse("GL33") @NoErrorCheck @StripPostfix("coords") void glMultiTexCoordP4uiv(@GLenum int texture, @GLenum int type, @Check("4") @Const @GLuint IntBuffer coords); @Reuse("GL33") @NoErrorCheck void glNormalP3ui(@GLenum int type, @GLuint int coords); @Reuse("GL33") @NoErrorCheck @StripPostfix("coords") void glNormalP3uiv(@GLenum int type, @Check("3") @Const @GLuint IntBuffer coords); @Reuse("GL33") @NoErrorCheck void glColorP3ui(@GLenum int type, @GLuint int color); @Reuse("GL33") @NoErrorCheck void glColorP4ui(@GLenum int type, @GLuint int color); @Reuse("GL33") @NoErrorCheck @StripPostfix("color") void glColorP3uiv(@GLenum int type, @Check("3") @Const @GLuint IntBuffer color); @Reuse("GL33") @NoErrorCheck @StripPostfix("color") void glColorP4uiv(@GLenum int type, @Check("4") @Const @GLuint IntBuffer color); @Reuse("GL33") @NoErrorCheck void glSecondaryColorP3ui(@GLenum int type, @GLuint int color); @Reuse("GL33") @NoErrorCheck @StripPostfix("color") void glSecondaryColorP3uiv(@GLenum int type, @Check("3") @Const @GLuint IntBuffer color); @Reuse("GL33") @NoErrorCheck void glVertexAttribP1ui(@GLuint int index, @GLenum int type, boolean normalized, @GLuint int value); @Reuse("GL33") @NoErrorCheck void glVertexAttribP2ui(@GLuint int index, @GLenum int type, boolean normalized, @GLuint int value); @Reuse("GL33") @NoErrorCheck void glVertexAttribP3ui(@GLuint int index, @GLenum int type, boolean normalized, @GLuint int value); @Reuse("GL33") @NoErrorCheck void glVertexAttribP4ui(@GLuint int index, @GLenum int type, boolean normalized, @GLuint int value); @Reuse("GL33") @NoErrorCheck @StripPostfix("value") void glVertexAttribP1uiv(@GLuint int index, @GLenum int type, boolean normalized, @Check("1") @Const @GLuint IntBuffer value); @Reuse("GL33") @NoErrorCheck @StripPostfix("value") void glVertexAttribP2uiv(@GLuint int index, @GLenum int type, boolean normalized, @Check("2") @Const @GLuint IntBuffer value); @Reuse("GL33") @NoErrorCheck @StripPostfix("value") void glVertexAttribP3uiv(@GLuint int index, @GLenum int type, boolean normalized, @Check("3") @Const @GLuint IntBuffer value); @Reuse("GL33") @NoErrorCheck @StripPostfix("value") void glVertexAttribP4uiv(@GLuint int index, @GLenum int type, boolean normalized, @Check("4") @Const @GLuint IntBuffer value); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_env_combine.java0000644000175000017500000000447511543426511025342 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_texture_env_combine { int GL_COMBINE_EXT = 0x8570; int GL_COMBINE_RGB_EXT = 0x8571; int GL_COMBINE_ALPHA_EXT = 0x8572; int GL_SOURCE0_RGB_EXT = 0x8580; int GL_SOURCE1_RGB_EXT = 0x8581; int GL_SOURCE2_RGB_EXT = 0x8582; int GL_SOURCE0_ALPHA_EXT = 0x8588; int GL_SOURCE1_ALPHA_EXT = 0x8589; int GL_SOURCE2_ALPHA_EXT = 0x858A; int GL_OPERAND0_RGB_EXT = 0x8590; int GL_OPERAND1_RGB_EXT = 0x8591; int GL_OPERAND2_RGB_EXT = 0x8592; int GL_OPERAND0_ALPHA_EXT = 0x8598; int GL_OPERAND1_ALPHA_EXT = 0x8599; int GL_OPERAND2_ALPHA_EXT = 0x859A; int GL_RGB_SCALE_EXT = 0x8573; int GL_ADD_SIGNED_EXT = 0x8574; int GL_INTERPOLATE_EXT = 0x8575; int GL_CONSTANT_EXT = 0x8576; int GL_PRIMARY_COLOR_EXT = 0x8577; int GL_PREVIOUS_EXT = 0x8578; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_integer.java0000644000175000017500000001261411543426511024505 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLreturn; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.IntBuffer; public interface EXT_texture_integer { /** * Accepted by the <pname> parameters of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_RGBA_INTEGER_MODE_EXT = 0x8D9E; /** * Accepted by the <internalFormat> parameter of TexImage1D, * TexImage2D, and TexImage3D: */ int GL_RGBA32UI_EXT = 0x8D70; int GL_RGB32UI_EXT = 0x8D71; int GL_ALPHA32UI_EXT = 0x8D72; int GL_INTENSITY32UI_EXT = 0x8D73; int GL_LUMINANCE32UI_EXT = 0x8D74; int GL_LUMINANCE_ALPHA32UI_EXT = 0x8D75; int GL_RGBA16UI_EXT = 0x8D76; int GL_RGB16UI_EXT = 0x8D77; int GL_ALPHA16UI_EXT = 0x8D78; int GL_INTENSITY16UI_EXT = 0x8D79; int GL_LUMINANCE16UI_EXT = 0x8D7A; int GL_LUMINANCE_ALPHA16UI_EXT = 0x8D7B; int GL_RGBA8UI_EXT = 0x8D7C; int GL_RGB8UI_EXT = 0x8D7D; int GL_ALPHA8UI_EXT = 0x8D7E; int GL_INTENSITY8UI_EXT = 0x8D7F; int GL_LUMINANCE8UI_EXT = 0x8D80; int GL_LUMINANCE_ALPHA8UI_EXT = 0x8D81; int GL_RGBA32I_EXT = 0x8D82; int GL_RGB32I_EXT = 0x8D83; int GL_ALPHA32I_EXT = 0x8D84; int GL_INTENSITY32I_EXT = 0x8D85; int GL_LUMINANCE32I_EXT = 0x8D86; int GL_LUMINANCE_ALPHA32I_EXT = 0x8D87; int GL_RGBA16I_EXT = 0x8D88; int GL_RGB16I_EXT = 0x8D89; int GL_ALPHA16I_EXT = 0x8D8A; int GL_INTENSITY16I_EXT = 0x8D8B; int GL_LUMINANCE16I_EXT = 0x8D8C; int GL_LUMINANCE_ALPHA16I_EXT = 0x8D8D; int GL_RGBA8I_EXT = 0x8D8E; int GL_RGB8I_EXT = 0x8D8F; int GL_ALPHA8I_EXT = 0x8D90; int GL_INTENSITY8I_EXT = 0x8D91; int GL_LUMINANCE8I_EXT = 0x8D92; int GL_LUMINANCE_ALPHA8I_EXT = 0x8D93; /** * Accepted by the <format> parameter of TexImage1D, TexImage2D, * TexImage3D, TexSubImage1D, TexSubImage2D, TexSubImage3D, * DrawPixels and ReadPixels: */ int GL_RED_INTEGER_EXT = 0x8D94; int GL_GREEN_INTEGER_EXT = 0x8D95; int GL_BLUE_INTEGER_EXT = 0x8D96; int GL_ALPHA_INTEGER_EXT = 0x8D97; int GL_RGB_INTEGER_EXT = 0x8D98; int GL_RGBA_INTEGER_EXT = 0x8D99; int GL_BGR_INTEGER_EXT = 0x8D9A; int GL_BGRA_INTEGER_EXT = 0x8D9B; int GL_LUMINANCE_INTEGER_EXT = 0x8D9C; int GL_LUMINANCE_ALPHA_INTEGER_EXT = 0x8D9D; void glClearColorIiEXT(int r, int g, int b, int a); void glClearColorIuiEXT(@GLuint int r, @GLuint int g, @GLuint int b, @GLuint int a); @StripPostfix("params") void glTexParameterIivEXT(@GLenum int target, @GLenum int pname, @Check("4") IntBuffer params); @Alternate("glTexParameterIivEXT") @StripPostfix(value = "param", postfix = "v") void glTexParameterIivEXT(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param); @StripPostfix("params") void glTexParameterIuivEXT(@GLenum int target, @GLenum int pname, @Check("4") @GLuint IntBuffer params); @Alternate("glTexParameterIuivEXT") @StripPostfix(value = "param", postfix = "v") void glTexParameterIuivEXT(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param); @StripPostfix("params") void glGetTexParameterIivEXT(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetTexParameterIivEXT") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetTexParameterIivEXT2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") void glGetTexParameterIuivEXT(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") @GLuint IntBuffer params); @Alternate("glGetTexParameterIuivEXT") @GLreturn("params") @StripPostfix(value = "params", postfix = "v") void glGetTexParameterIuivEXT2(@GLenum int target, @GLenum int pname, @OutParameter @GLuint IntBuffer params); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_float_buffer.java0000644000175000017500000000644111543426511023612 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_float_buffer { /** * Accepted by the <internalformat> parameter of TexImage2D and * CopyTexImage2D: */ int GL_FLOAT_R_NV = 0x8880; int GL_FLOAT_RG_NV = 0x8881; int GL_FLOAT_RGB_NV = 0x8882; int GL_FLOAT_RGBA_NV = 0x8883; int GL_FLOAT_R16_NV = 0x8884; int GL_FLOAT_R32_NV = 0x8885; int GL_FLOAT_RG16_NV = 0x8886; int GL_FLOAT_RG32_NV = 0x8887; int GL_FLOAT_RGB16_NV = 0x8888; int GL_FLOAT_RGB32_NV = 0x8889; int GL_FLOAT_RGBA16_NV = 0x888A; int GL_FLOAT_RGBA32_NV = 0x888B; /** * Accepted by the <pname> parameter of GetTexLevelParameterfv and * GetTexLevelParameteriv: */ int GL_TEXTURE_FLOAT_COMPONENTS_NV = 0x888C; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_FLOAT_CLEAR_COLOR_VALUE_NV = 0x888D; int GL_FLOAT_RGBA_MODE_NV = 0x888E; /** * Accepted in the <piAttributes> array of wglGetPixelFormatAttribivARB and * wglGetPixelFormatAttribfvARB and in the <piAttribIList> and * <pfAttribFList> arrays of wglChoosePixelFormatARB: */ /* int WGL_FLOAT_COMPONENTS_NV = 0x20B0; int WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = 0x20B1; int WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV = 0x20B2; int WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV = 0x20B3; int WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV = 0x20B4; */ /** * Accepted in the <piAttribIList> array of wglCreatePbufferARB and returned * in the <value> parameter of wglQueryPbufferARB when <iAttribute> is * WGL_TEXTURE_FORMAT_ARB: */ /* int WGL_TEXTURE_FLOAT_R_NV = 0x20B5; int WGL_TEXTURE_FLOAT_RG_NV = 0x20B6; int WGL_TEXTURE_FLOAT_RGB_NV = 0x20B7; int WGL_TEXTURE_FLOAT_RGBA_NV = 0x20B8; */ } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_draw_instanced.java0000644000175000017500000000411011543426511024245 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.*; import java.nio.Buffer; public interface EXT_draw_instanced { void glDrawArraysInstancedEXT(@GLenum int mode, int first, @GLsizei int count, @GLsizei int primcount); void glDrawElementsInstancedEXT(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type, @BufferObject(BufferKind.ElementVBO) @Const @GLubyte @GLushort @GLuint Buffer indices, @GLsizei int primcount); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/GL31.java0000644000175000017500000003143311543426511021216 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; public interface GL31 { // ---------------------------------------------------------- // ----------------------[ OpenGL 3.1 ]---------------------- // ---------------------------------------------------------- int GL_RED_SNORM = 0x8F90; int GL_RG_SNORM = 0x8F91; int GL_RGB_SNORM = 0x8F92; int GL_RGBA_SNORM = 0x8F93; int GL_R8_SNORM = 0x8F94; int GL_RG8_SNORM = 0x8F95; int GL_RGB8_SNORM = 0x8F96; int GL_RGBA8_SNORM = 0x8F97; int GL_R16_SNORM = 0x8F98; int GL_RG16_SNORM = 0x8F99; int GL_RGB16_SNORM = 0x8F9A; int GL_RGBA16_SNORM = 0x8F9B; int GL_SIGNED_NORMALIZED = 0x8F9C; // ------------------------------------------------------------------ // ----------------------[ ARB_draw_instanced ]---------------------- // ------------------------------------------------------------------ void glDrawArraysInstanced(@GLenum int mode, int first, @GLsizei int count, @GLsizei int primcount); void glDrawElementsInstanced(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type, @BufferObject(BufferKind.ElementVBO) @Const @GLubyte @GLushort @GLuint Buffer indices, @GLsizei int primcount); // --------------------------------------------------------------- // ----------------------[ EXT_copy_buffer ]---------------------- // --------------------------------------------------------------- int GL_COPY_READ_BUFFER = 0x8F36; int GL_COPY_WRITE_BUFFER = 0x8F37; void glCopyBufferSubData(@GLenum int readtarget, @GLenum int writetarget, @GLintptr long readoffset, @GLintptr long writeoffset, @GLsizeiptr long size); // -------------------------------------------------------------------- // ----------------------[ NV_primitive_restart ]---------------------- // -------------------------------------------------------------------- /** * Accepted by the <cap> parameter of IsEnabled, and by * the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and * GetDoublev: */ int GL_PRIMITIVE_RESTART = 0x8F9D; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_PRIMITIVE_RESTART_INDEX = 0x8F9E; void glPrimitiveRestartIndex(@GLuint int index); // ------------------------------------------------------------------------- // ----------------------[ ARB_texture_buffer_object ]---------------------- // ------------------------------------------------------------------------- /** * Accepted by the <target> parameter of BindBuffer, BufferData, * BufferSubData, MapBuffer, MapBufferRange, BindTexture, UnmapBuffer, * GetBufferSubData, GetBufferParameteriv, GetBufferPointerv, and TexBuffer, * and the parameter of GetBooleanv, GetDoublev, GetFloatv, and * GetIntegerv: */ int GL_TEXTURE_BUFFER = 0x8C2A; /** * Accepted by the <pname> parameters of GetBooleanv, GetDoublev, * GetFloatv, and GetIntegerv: */ int GL_MAX_TEXTURE_BUFFER_SIZE = 0x8C2B; int GL_TEXTURE_BINDING_BUFFER = 0x8C2C; int GL_TEXTURE_BUFFER_DATA_STORE_BINDING = 0x8C2D; int GL_TEXTURE_BUFFER_FORMAT = 0x8C2E; void glTexBuffer(@GLenum int target, @GLenum int internalformat, @GLuint int buffer); // --------------------------------------------------------------------- // ----------------------[ ARB_texture_rectangle ]---------------------- // --------------------------------------------------------------------- /** * Accepted by the <cap> parameter of Enable, Disable and IsEnabled; * by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv * and GetDoublev; and by the <target> parameter of BindTexture, * GetTexParameterfv, GetTexParameteriv, TexParameterf, TexParameteri, * TexParameterfv and TexParameteriv: * Accepted by the <target> parameter of GetTexImage, * GetTexLevelParameteriv, GetTexLevelParameterfv, TexImage2D, * CopyTexImage2D, TexSubImage2D and CopySubTexImage2D: */ int GL_TEXTURE_RECTANGLE = 0x84F5; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv and GetDoublev: */ int GL_TEXTURE_BINDING_RECTANGLE = 0x84F6; /** * Accepted by the <target> parameter of GetTexLevelParameteriv, * GetTexLevelParameterfv, GetTexParameteriv and TexImage2D: */ int GL_PROXY_TEXTURE_RECTANGLE = 0x84F7; /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, * GetIntegerv and GetFloatv: */ int GL_MAX_RECTANGLE_TEXTURE_SIZE = 0x84F8; /** * Returned by <type> parameter of GetActiveUniform when the location * <index> for program object <program> is of type sampler2DRect: */ int GL_SAMPLER_2D_RECT = 0x8B63; /** * Returned by <type> parameter of GetActiveUniform when the location * <index> for program object <program> is of type sampler2DRectShadow: */ int GL_SAMPLER_2D_RECT_SHADOW = 0x8B64; // ------------------------------------------------------------------------- // ----------------------[ ARB_uniform_buffer_object ]---------------------- // ------------------------------------------------------------------------- /** * Accepted by the <target> parameters of BindBuffer, BufferData, * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, and * GetBufferPointerv: */ int GL_UNIFORM_BUFFER = 0x8A11; /** * Accepted by the <pname> parameter of GetIntegeri_v, GetBooleanv, * GetIntegerv, GetFloatv, and GetDoublev: */ int GL_UNIFORM_BUFFER_BINDING = 0x8A28; /** Accepted by the <pname> parameter of GetIntegeri_v: */ int GL_UNIFORM_BUFFER_START = 0x8A29; int GL_UNIFORM_BUFFER_SIZE = 0x8A2A; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ int GL_MAX_VERTEX_UNIFORM_BLOCKS = 0x8A2B; int GL_MAX_GEOMETRY_UNIFORM_BLOCKS = 0x8A2C; int GL_MAX_FRAGMENT_UNIFORM_BLOCKS = 0x8A2D; int GL_MAX_COMBINED_UNIFORM_BLOCKS = 0x8A2E; int GL_MAX_UNIFORM_BUFFER_BINDINGS = 0x8A2F; int GL_MAX_UNIFORM_BLOCK_SIZE = 0x8A30; int GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 0x8A31; int GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS = 0x8A32; int GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 0x8A33; int GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT = 0x8A34; /** Accepted by the <pname> parameter of GetProgramiv: */ int GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 0x8A35; int GL_ACTIVE_UNIFORM_BLOCKS = 0x8A36; /** Accepted by the <pname> parameter of GetActiveUniformsiv: */ int GL_UNIFORM_TYPE = 0x8A37; int GL_UNIFORM_SIZE = 0x8A38; int GL_UNIFORM_NAME_LENGTH = 0x8A39; int GL_UNIFORM_BLOCK_INDEX = 0x8A3A; int GL_UNIFORM_OFFSET = 0x8A3B; int GL_UNIFORM_ARRAY_STRIDE = 0x8A3C; int GL_UNIFORM_MATRIX_STRIDE = 0x8A3D; int GL_UNIFORM_IS_ROW_MAJOR = 0x8A3E; /** Accepted by the <pname> parameter of GetActiveUniformBlockiv: */ int GL_UNIFORM_BLOCK_BINDING = 0x8A3F; int GL_UNIFORM_BLOCK_DATA_SIZE = 0x8A40; int GL_UNIFORM_BLOCK_NAME_LENGTH = 0x8A41; int GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS = 0x8A42; int GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8A43; int GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8A44; int GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER = 0x8A45; int GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8A46; /** Returned by GetActiveUniformsiv and GetUniformBlockIndex */ int GL_INVALID_INDEX = 0xFFFFFFFF; void glGetUniformIndices(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount, @Const @NullTerminated("uniformIndices.remaining()") @GLchar @PointerArray("uniformCount") ByteBuffer uniformNames, @OutParameter @GLuint IntBuffer uniformIndices); @Alternate("glGetUniformIndices") void glGetUniformIndices(@GLuint int program, @Constant("uniformNames.length") @GLsizei int uniformCount, @Const @NullTerminated @PointerArray("uniformCount") CharSequence[] uniformNames, @OutParameter @Check("uniformNames.length") @GLuint IntBuffer uniformIndices); @StripPostfix("params") void glGetActiveUniformsiv(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount, @Const @GLuint IntBuffer uniformIndices, @GLenum int pname, @OutParameter @Check("uniformIndices.remaining()") @GLint IntBuffer params); @Alternate("glGetActiveUniformsiv") @GLreturn("params") @StripPostfix("params") void glGetActiveUniformsiv(@GLuint int program, @Constant("1") @GLsizei int uniformCount, @Constant(value = "params.put(1, uniformIndex), 1", keepParam = true) int uniformIndex, // Reuse params buffer @GLenum int pname, @OutParameter @GLint IntBuffer params); void glGetActiveUniformName(@GLuint int program, @GLuint int uniformIndex, @AutoSize("uniformName") @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer uniformName); @Alternate("glGetActiveUniformName") @GLreturn(value = "uniformName", maxLength = "bufSize") void glGetActiveUniformName2(@GLuint int program, @GLuint int uniformIndex, @GLsizei int bufSize, @OutParameter @GLsizei @Constant("uniformName_length, 0") IntBuffer length, @OutParameter @GLchar ByteBuffer uniformName); @GLuint int glGetUniformBlockIndex(@GLuint int program, @Const @NullTerminated @GLchar ByteBuffer uniformBlockName); @Alternate("glGetUniformBlockIndex") @GLuint int glGetUniformBlockIndex(@GLuint int program, @NullTerminated CharSequence uniformBlockName); @StripPostfix("params") void glGetActiveUniformBlockiv(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname, @OutParameter @Check(value = "16") @GLint IntBuffer params); @Alternate("glGetActiveUniformBlockiv") @GLreturn("params") @StripPostfix("params") void glGetActiveUniformBlockiv2(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname, @OutParameter @GLint IntBuffer params); void glGetActiveUniformBlockName(@GLuint int program, @GLuint int uniformBlockIndex, @AutoSize("uniformBlockName") @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer uniformBlockName); @Alternate("glGetActiveUniformBlockName") @GLreturn(value = "uniformBlockName", maxLength = "bufSize") void glGetActiveUniformBlockName2(@GLuint int program, @GLuint int uniformBlockIndex, @GLsizei int bufSize, @OutParameter @GLsizei @Constant("uniformBlockName_length, 0") IntBuffer length, @OutParameter @GLchar ByteBuffer uniformBlockName); void glUniformBlockBinding(@GLuint int program, @GLuint int uniformBlockIndex, @GLuint int uniformBlockBinding); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/APPLE_object_purgeable.java0000644000175000017500000000607211543426511024766 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLreturn; import org.lwjgl.util.generator.opengl.GLuint; import java.nio.IntBuffer; public interface APPLE_object_purgeable { /** * Accepted by the <option> parameter of ObjectPurgeable, and returned * by ObjectPurgeable: */ int GL_RELEASED_APPLE = 0x8A19; int GL_VOLATILE_APPLE = 0x8A1A; /** * Accepted by the <option> parameters of ObjectUnpurgeable, and * returned by ObjectUnpurgeable: */ int GL_RETAINED_APPLE = 0x8A1B; int GL_UNDEFINED_APPLE = 0x8A1C; /** Accepted by the <pname> parameters of GetObjectParameteriv: */ int GL_PURGEABLE_APPLE = 0x8A1D; /** * Accepted by the <objectType> parameters of ObjectPurgeableAPPLE, * ObjectUnpurgeableAPPLE and GetObjectParameteriv: */ int GL_BUFFER_OBJECT_APPLE = 0x85B3; @GLenum int glObjectPurgeableAPPLE(@GLenum int objectType, @GLuint int name, @GLenum int option); @GLenum int glObjectUnpurgeableAPPLE(@GLenum int objectType, @GLuint int name, @GLenum int option); @StripPostfix("params") void glGetObjectParameterivAPPLE(@GLenum int objectType, @GLuint int name, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); @Alternate("glGetObjectParameterivAPPLE") @GLreturn("params") @StripPostfix("params") void glGetObjectParameterivAPPLE2(@GLenum int objectType, @GLuint int name, @GLenum int pname, @OutParameter IntBuffer params); }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_texture_sRGB.java0000644000175000017500000000507011543426511023643 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface EXT_texture_sRGB { /** Accepted by the <internalformat> parameter of TexImage1D, TexImage2D, TexImage3D, CopyTexImage1D, CopyTexImage2D. */ int GL_SRGB_EXT = 0x8C40; int GL_SRGB8_EXT = 0x8C41; int GL_SRGB_ALPHA_EXT = 0x8C42; int GL_SRGB8_ALPHA8_EXT = 0x8C43; int GL_SLUMINANCE_ALPHA_EXT = 0x8C44; int GL_SLUMINANCE8_ALPHA8_EXT = 0x8C45; int GL_SLUMINANCE_EXT = 0x8C46; int GL_SLUMINANCE8_EXT = 0x8C47; int GL_COMPRESSED_SRGB_EXT = 0x8C48; int GL_COMPRESSED_SRGB_ALPHA_EXT = 0x8C49; int GL_COMPRESSED_SLUMINANCE_EXT = 0x8C4A; int GL_COMPRESSED_SLUMINANCE_ALPHA_EXT = 0x8C4B; /** Accepted by the <internalformat> parameter of TexImage2D, CopyTexImage2D, and CompressedTexImage2DARB and the <format> parameter of CompressedTexSubImage2DARB. */ int GL_COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C; int GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8C4D; int GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E; int GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F; } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java0000644000175000017500000000734711543426511024710 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.opengl.GLuint; import org.lwjgl.util.generator.opengl.GLvoid; import java.nio.*; public interface ATI_map_object_buffer { /** * glMapObjectBufferATI maps an ATI vertex array object to a ByteBuffer. The old_buffer argument can be null, * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null, * it will be returned if it points to the same mapped memory and has the same capacity as the vertex array object, * otherwise a new ByteBuffer is created. That way, an application will normally use glMapObjectBufferATI like this: *

      * ByteBuffer mapped_buffer; mapped_buffer = glMapObjectBufferATI(..., null); ... // Another map on the same buffer mapped_buffer = glMapObjectBufferATI(..., mapped_buffer); *

      * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused. *

      * The version of this method without an explicit length argument calls glGetObjectBufferATI internally to * retrieve the current vertex array object size, which may cause a pipeline flush and reduce application performance. *

      * The version of this method with an explicit length argument is a fast alternative to the one without. No GL call * is made to retrieve the vertex array object size, so the user is responsible for tracking and using the appropriate length.
      * Security warning: The length argument should match the vertex array object size. Reading from or writing to outside * the memory region that corresponds to the mapped vertex array object will cause native crashes. * * @param length the length of the mapped memory in bytes. * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created. * * @return A ByteBuffer representing the mapped buffer memory. */ @CachedResult @GLvoid @AutoSize("GLChecks.getBufferObjectSizeATI(caps, buffer)") ByteBuffer glMapObjectBufferATI(@GLuint int buffer); void glUnmapObjectBufferATI(@GLuint int buffer); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_vertex_program4.java0000644000175000017500000000314511543426511024302 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_vertex_program4 { }lwjgl-2.7.1/src/templates/org/lwjgl/opengl/NV_geometry_shader4.java0000644000175000017500000000314711543426511024421 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; public interface NV_geometry_shader4 { } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java0000644000175000017500000000540311543426511023703 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLsizei; import java.nio.*; public interface ARB_draw_buffers { /** * Accepted by the <pname> parameters of GetIntegerv, GetFloatv, * and GetDoublev: */ int GL_MAX_DRAW_BUFFERS_ARB = 0x8824; int GL_DRAW_BUFFER0_ARB = 0x8825; int GL_DRAW_BUFFER1_ARB = 0x8826; int GL_DRAW_BUFFER2_ARB = 0x8827; int GL_DRAW_BUFFER3_ARB = 0x8828; int GL_DRAW_BUFFER4_ARB = 0x8829; int GL_DRAW_BUFFER5_ARB = 0x882A; int GL_DRAW_BUFFER6_ARB = 0x882B; int GL_DRAW_BUFFER7_ARB = 0x882C; int GL_DRAW_BUFFER8_ARB = 0x882D; int GL_DRAW_BUFFER9_ARB = 0x882E; int GL_DRAW_BUFFER10_ARB = 0x882F; int GL_DRAW_BUFFER11_ARB = 0x8830; int GL_DRAW_BUFFER12_ARB = 0x8831; int GL_DRAW_BUFFER13_ARB = 0x8832; int GL_DRAW_BUFFER14_ARB = 0x8833; int GL_DRAW_BUFFER15_ARB = 0x8834; void glDrawBuffersARB(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers); @Alternate("glDrawBuffersARB") void glDrawBuffersARB(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer); } lwjgl-2.7.1/src/templates/org/lwjgl/opengl/EXT_compiled_vertex_array.java0000644000175000017500000000351611543426511025660 0ustar zero79zero79/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import org.lwjgl.util.generator.opengl.GLsizei; public interface EXT_compiled_vertex_array { int GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = 0x81A8; int GL_ARRAY_ELEMENT_LOCK_COUNT_EXT = 0x81A9; void glLockArraysEXT(int first, @GLsizei int count); void glUnlockArraysEXT(); }