[SCM] lwjgl - Lightweight Java Game Library branch, upstream, updated. upstream/2.5+dfsg-1-g09bd29f

Michael Gilbert gilbert-guest at alioth.debian.org
Sun Apr 3 21:01:57 UTC 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "lwjgl - Lightweight Java Game Library".

The branch, upstream has been updated
       via  09bd29f33e456dfa8ed08d4ecf6caaa361e780d7 (commit)
      from  afc97edc2e4d07895a320e7197543c181195f55c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 build.xml                                          |  225 ++--
 platform_build/build-applet.xml                    |  110 +-
 platform_build/build-definitions.xml               |  138 ++-
 platform_build/build-generator.xml                 |  135 ++-
 platform_build/build-maven.xml                     |  155 +++
 platform_build/build-webstart.xml                  |  153 ++-
 platform_build/linux_ant/build.xml                 |   14 +-
 src/java/org/lwjgl/BufferChecks.java               |  105 ++-
 src/java/org/lwjgl/BufferUtils.java                |   51 +-
 src/java/org/lwjgl/DefaultSysImplementation.java   |    5 +-
 src/java/org/lwjgl/LWJGLUtil.java                  |  195 +++-
 src/java/org/lwjgl/LinuxSysImplementation.java     |    9 +-
 src/java/org/lwjgl/MacOSXSysImplementation.java    |    6 +-
 src/java/org/lwjgl/NondirectBufferWrapper.java     |   10 +-
 src/java/org/lwjgl/PointerBuffer.java              |  951 ++++++++++++++++
 src/java/org/lwjgl/PointerWrapper.java             |   43 +
 src/java/org/lwjgl/PointerWrapperAbstract.java     |   92 ++
 src/java/org/lwjgl/Sys.java                        |   51 +-
 src/java/org/lwjgl/SysImplementation.java          |    9 +-
 src/java/org/lwjgl/WindowsSysImplementation.java   |   26 +-
 src/java/org/lwjgl/examples/Game.java              |  109 +-
 .../org/lwjgl/examples/spaceinvaders/Entity.java   |   54 +-
 .../org/lwjgl/examples/spaceinvaders/Game.java     |  151 ++--
 .../lwjgl/examples/spaceinvaders/GameApplet.java   |   34 +-
 .../lwjgl/examples/spaceinvaders/ShotEntity.java   |   38 +-
 .../lwjgl/examples/spaceinvaders/SoundManager.java |   80 +-
 .../org/lwjgl/examples/spaceinvaders/Sprite.java   |   66 +-
 .../org/lwjgl/examples/spaceinvaders/Texture.java  |   44 +-
 .../examples/spaceinvaders/TextureLoader.java      |  226 ++--
 src/java/org/lwjgl/input/Controller.java           |  218 ++--
 src/java/org/lwjgl/input/ControllerEvent.java      |   68 +-
 src/java/org/lwjgl/input/Controllers.java          |  146 ++--
 src/java/org/lwjgl/input/Cursor.java               |   82 +-
 src/java/org/lwjgl/input/JInputController.java     |  158 ++--
 src/java/org/lwjgl/input/Keyboard.java             |   42 +-
 src/java/org/lwjgl/input/Mouse.java                |   32 +-
 src/java/org/lwjgl/input/OpenGLPackageAccess.java  |   38 +-
 src/java/org/lwjgl/openal/AL.java                  |   82 +-
 src/java/org/lwjgl/openal/ALC10.java               |  124 +-
 src/java/org/lwjgl/openal/ALC11.java               |   72 +-
 src/java/org/lwjgl/openal/ALCcontext.java          |   52 +-
 src/java/org/lwjgl/openal/ALCdevice.java           |   74 +-
 src/java/org/lwjgl/openal/EFXUtil.java             |   99 +-
 src/java/org/lwjgl/opencl/APIUtil.java             |  544 +++++++++
 .../org/lwjgl/opencl/APPLEContextLoggingUtil.java  |   77 ++
 src/java/org/lwjgl/opencl/CL.java                  |  152 +++
 .../org/lwjgl/opencl/CLBuildProgramCallback.java   |   61 +
 src/java/org/lwjgl/opencl/CLCallback.java          |   59 +
 src/java/org/lwjgl/opencl/CLChecks.java            |  268 +++++
 src/java/org/lwjgl/opencl/CLCommandQueue.java      |  112 ++
 src/java/org/lwjgl/opencl/CLContext.java           |  282 +++++
 src/java/org/lwjgl/opencl/CLContextCallback.java   |   78 ++
 src/java/org/lwjgl/opencl/CLDevice.java            |  206 ++++
 src/java/org/lwjgl/opencl/CLEvent.java             |  124 ++
 src/java/org/lwjgl/opencl/CLEventCallback.java     |   61 +
 src/java/org/lwjgl/opencl/CLFunctionAddress.java   |   47 +
 src/java/org/lwjgl/opencl/CLKernel.java            |  262 +++++
 src/java/org/lwjgl/opencl/CLMem.java               |  279 +++++
 .../opencl/CLMemObjectDestructorCallback.java      |   52 +
 src/java/org/lwjgl/opencl/CLNativeKernel.java      |   59 +
 src/java/org/lwjgl/opencl/CLObject.java            |   51 +
 src/java/org/lwjgl/opencl/CLObjectChild.java       |   58 +
 src/java/org/lwjgl/opencl/CLObjectRegistry.java    |   54 +
 .../org/lwjgl/opencl/CLObjectRegistryGlobal.java   |   57 +
 src/java/org/lwjgl/opencl/CLObjectRetainable.java  |   70 ++
 src/java/org/lwjgl/opencl/CLPlatform.java          |  231 ++++
 src/java/org/lwjgl/opencl/CLProgram.java           |  220 ++++
 src/java/org/lwjgl/opencl/CLSampler.java           |   85 ++
 src/java/org/lwjgl/opencl/CallbackUtil.java        |  200 ++++
 src/java/org/lwjgl/opencl/FastLongMap.java         |  239 ++++
 src/java/org/lwjgl/opencl/InfoUtil.java            |   51 +
 src/java/org/lwjgl/opencl/InfoUtilAbstract.java    |  135 +++
 src/java/org/lwjgl/opencl/InfoUtilFactory.java     |  606 ++++++++++
 src/java/org/lwjgl/opencl/OpenCLException.java     |   54 +
 src/java/org/lwjgl/opencl/Util.java                |   68 ++
 src/java/org/lwjgl/opencl/api/CLBufferRegion.java  |   62 +
 src/java/org/lwjgl/opencl/api/CLImageFormat.java   |   60 +
 src/java/org/lwjgl/opencl/api/Filter.java          |   51 +
 .../org/lwjgl/opengl/AMDDebugOutputCallback.java   |   41 +-
 src/java/org/lwjgl/opengl/APIUtil.java             |  302 +++++
 .../org/lwjgl/opengl/ARBDebugOutputCallback.java   |  197 ++++
 src/java/org/lwjgl/opengl/AWTGLCanvas.java         |   15 +-
 src/java/org/lwjgl/opengl/AWTSurfaceLock.java      |   16 +-
 src/java/org/lwjgl/opengl/AWTUtil.java             |   11 +-
 src/java/org/lwjgl/opengl/AbstractDrawable.java    |    8 +
 src/java/org/lwjgl/opengl/BaseReferences.java      |   92 +-
 src/java/org/lwjgl/opengl/CallbackUtil.java        |  157 +++
 src/java/org/lwjgl/opengl/Context.java             |   43 +-
 src/java/org/lwjgl/opengl/ContextAttribs.java      |   71 +-
 src/java/org/lwjgl/opengl/Display.java             |   25 +-
 src/java/org/lwjgl/opengl/DisplayMode.java         |    6 +-
 src/java/org/lwjgl/opengl/Drawable.java            |   12 +
 src/java/org/lwjgl/opengl/FastIntMap.java          |  238 ++++
 src/java/org/lwjgl/opengl/GLChecks.java            |   75 +-
 src/java/org/lwjgl/opengl/GLContext.java           |  101 +-
 src/java/org/lwjgl/opengl/GLSync.java              |   14 +-
 src/java/org/lwjgl/opengl/GLUConstants.java        |   10 +-
 src/java/org/lwjgl/opengl/GlobalLock.java          |   28 +-
 .../lwjgl/opengl/LinuxCanvasImplementation.java    |   32 +-
 .../lwjgl/opengl/LinuxContextImplementation.java   |    8 +-
 src/java/org/lwjgl/opengl/LinuxDisplay.java        |  123 ++-
 src/java/org/lwjgl/opengl/LinuxEvent.java          |   24 +-
 src/java/org/lwjgl/opengl/LinuxKeycodes.java       |  732 ++++++------
 src/java/org/lwjgl/opengl/LinuxMouse.java          |   14 +-
 src/java/org/lwjgl/opengl/MacOSXDisplay.java       |   51 +-
 .../org/lwjgl/opengl/MacOSXDisplayPeerInfo.java    |    6 +-
 src/java/org/lwjgl/opengl/MacOSXFrame.java         |    6 +-
 .../org/lwjgl/opengl/MacOSXMouseEventQueue.java    |   16 +-
 src/java/org/lwjgl/opengl/PeerInfo.java            |    8 +-
 src/java/org/lwjgl/opengl/ReferencesStack.java     |    4 +-
 src/java/org/lwjgl/opengl/RenderTexture.java       |    8 +-
 src/java/org/lwjgl/opengl/StateTracker.java        |  111 ++-
 src/java/org/lwjgl/opengl/Util.java                |   31 +-
 .../lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java   |    6 +-
 .../lwjgl/opengl/WindowsCanvasImplementation.java  |    6 +-
 .../lwjgl/opengl/WindowsContextImplementation.java |    8 +-
 src/java/org/lwjgl/opengl/WindowsDisplay.java      |  187 ++--
 src/java/org/lwjgl/opengl/WindowsKeyboard.java     |    4 +-
 src/java/org/lwjgl/opengl/WindowsKeycodes.java     |  416 ++++----
 src/java/org/lwjgl/opengl/WindowsRegistry.java     |   12 +-
 src/java/org/lwjgl/opengl/XRandR.java              |   64 +-
 src/java/org/lwjgl/test/DisplayTest.java           |  126 +-
 src/java/org/lwjgl/test/WindowCreationTest.java    |   86 +-
 .../org/lwjgl/test/applet/AppletLoaderTest.java    |   32 +-
 src/java/org/lwjgl/test/applet/GearsApplet.java    |  300 +++---
 src/java/org/lwjgl/test/applet/OpenAL.java         |  107 +-
 src/java/org/lwjgl/test/applet/OpenGL.java         |   61 +-
 src/java/org/lwjgl/test/applet/Speed.java          |   67 +-
 src/java/org/lwjgl/test/applet/Test.java           |   30 +-
 .../lwjgl/test/glu/tessellation/TessCallback.java  |   15 +-
 .../test/glu/tessellation/TessellationTest.java    |   95 +-
 src/java/org/lwjgl/test/input/HWCursorTest.java    |  205 ++--
 src/java/org/lwjgl/test/input/KeyboardTest.java    |   75 +-
 .../org/lwjgl/test/input/MouseCreationTest.java    |  111 +-
 src/java/org/lwjgl/test/input/MouseTest.java       |  229 ++--
 src/java/org/lwjgl/test/input/TestControllers.java |   62 +-
 src/java/org/lwjgl/test/openal/BasicTest.java      |   52 +-
 src/java/org/lwjgl/test/openal/EFX10Test.java      |    2 +-
 src/java/org/lwjgl/test/openal/OpenALInfo.java     |  149 ++--
 src/java/org/lwjgl/test/openal/PositionTest.java   |  241 ++--
 src/java/org/lwjgl/test/opencl/HelloOpenCL.java    |  198 ++++
 src/java/org/lwjgl/test/opencl/gl/DemoFractal.java |  897 +++++++++++++++
 src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl    |   81 ++
 .../lwjgl/test/opengl/FullScreenWindowedTest.java  |   85 +-
 src/java/org/lwjgl/test/opengl/Gears.java          |  222 ++--
 src/java/org/lwjgl/test/opengl/PbufferTest.java    |  140 ++--
 src/java/org/lwjgl/test/opengl/SyncTest.java       |   30 +-
 src/java/org/lwjgl/test/opengl/VBOIndexTest.java   |   73 +-
 src/java/org/lwjgl/test/opengl/VBOTest.java        |   59 +-
 src/java/org/lwjgl/test/opengl/VersionTest.java    |   19 +-
 src/java/org/lwjgl/test/opengl/awt/AWTGears.java   |  174 ++--
 .../org/lwjgl/test/opengl/awt/AWTGearsCanvas.java  |  233 ++--
 src/java/org/lwjgl/test/opengl/awt/AWTTest.java    |   69 +-
 src/java/org/lwjgl/test/opengl/awt/DemoBox.java    |  295 +++---
 .../lwjgl/test/opengl/awt/DisplayParentTest.java   |   41 +-
 .../opengl/multithread/BackgroundLoadTest.java     |   81 +-
 .../test/opengl/multithread/BackgroundLoader.java  |   25 +-
 .../lwjgl/test/opengl/pbuffers/PbufferTest.java    |  108 +-
 .../lwjgl/test/opengl/pbuffers/UniqueRenderer.java |    7 +-
 .../test/opengl/pbuffers/UniqueRendererRTT.java    |    5 +-
 src/java/org/lwjgl/test/opengl/shaders/Shader.java |   34 +-
 .../org/lwjgl/test/opengl/shaders/ShaderFP.java    |   43 +-
 .../org/lwjgl/test/opengl/shaders/ShaderFSH.java   |   54 +-
 .../org/lwjgl/test/opengl/shaders/ShaderUNI.java   |   59 +-
 .../org/lwjgl/test/opengl/shaders/ShaderVP.java    |   23 +-
 .../org/lwjgl/test/opengl/shaders/ShaderVSH.java   |   34 +-
 .../org/lwjgl/test/opengl/shaders/ShadersTest.java |   71 +-
 src/java/org/lwjgl/util/Display.java               |  145 ++--
 src/java/org/lwjgl/util/ReadableColor.java         |  118 +-
 src/java/org/lwjgl/util/ReadableDimension.java     |   42 +-
 src/java/org/lwjgl/util/ReadablePoint.java         |   42 +-
 src/java/org/lwjgl/util/ReadableRectangle.java     |   36 +-
 src/java/org/lwjgl/util/Renderable.java            |   42 +-
 src/java/org/lwjgl/util/Timer.java                 |   64 +-
 src/java/org/lwjgl/util/WaveData.java              |   14 +-
 src/java/org/lwjgl/util/WritableColor.java         |   70 +-
 src/java/org/lwjgl/util/WritableDimension.java     |   40 +-
 src/java/org/lwjgl/util/WritablePoint.java         |   40 +-
 src/java/org/lwjgl/util/WritableRectangle.java     |   44 +-
 src/java/org/lwjgl/util/XPMFile.java               |   72 +-
 src/java/org/lwjgl/util/applet/AppletLoader.java   | 1085 +++++++++++--------
 src/java/org/lwjgl/util/generator/Alternate.java   |    3 +
 src/java/org/lwjgl/util/generator/AutoSize.java    |    7 +-
 src/java/org/lwjgl/util/generator/Check.java       |    6 +-
 src/java/org/lwjgl/util/generator/Code.java        |   20 +-
 src/java/org/lwjgl/util/generator/Constant.java    |    6 +-
 src/java/org/lwjgl/util/generator/Extern.java      |   46 +
 .../org/lwjgl/util/generator/GenerateAutos.java    |    6 +-
 .../util/generator/GeneratorProcessorFactory.java  |   43 +-
 .../org/lwjgl/util/generator/GeneratorVisitor.java |  129 ++-
 src/java/org/lwjgl/util/generator/Helper.java      |   46 +
 src/java/org/lwjgl/util/generator/Imports.java     |   46 +
 .../lwjgl/util/generator/JNITypeTranslator.java    |   11 +-
 .../lwjgl/util/generator/JavaMethodsGenerator.java |  416 +++++--
 .../lwjgl/util/generator/JavaTypeTranslator.java   |   49 +-
 .../util/generator/NativeMethodStubsGenerator.java |  350 ++++--
 src/java/org/lwjgl/util/generator/NativeType.java  |    7 +-
 .../lwjgl/util/generator/NativeTypeTranslator.java |   99 +-
 .../org/lwjgl/util/generator/PointerArray.java     |   48 +
 .../org/lwjgl/util/generator/PointerWrapper.java   |   46 +
 .../lwjgl/util/generator/PostfixTranslator.java    |    7 +-
 src/java/org/lwjgl/util/generator/Private.java     |   46 +
 .../util/generator/RegisterStubsGenerator.java     |   42 +-
 src/java/org/lwjgl/util/generator/Reuse.java       |   49 +
 .../lwjgl/util/generator/SignatureTranslator.java  |   32 +-
 src/java/org/lwjgl/util/generator/TypeInfo.java    |   12 +-
 src/java/org/lwjgl/util/generator/TypeMap.java     |   26 +-
 .../lwjgl/util/generator/TypedefsGenerator.java    |   27 +-
 src/java/org/lwjgl/util/generator/Utils.java       |   92 ++-
 .../org/lwjgl/util/generator/openal/ALTypeMap.java |  242 ++++
 .../org/lwjgl/util/generator/openal/ALboolean.java |   49 +
 .../org/lwjgl/util/generator/openal/ALbyte.java    |   49 +
 .../org/lwjgl/util/generator/openal/ALdouble.java  |   49 +
 .../org/lwjgl/util/generator/openal/ALenum.java    |   49 +
 .../org/lwjgl/util/generator/openal/ALfloat.java   |   49 +
 .../org/lwjgl/util/generator/openal/ALint.java     |   49 +
 .../org/lwjgl/util/generator/openal/ALshort.java   |   49 +
 .../org/lwjgl/util/generator/openal/ALsizei.java   |   49 +
 .../org/lwjgl/util/generator/openal/ALubyte.java   |   49 +
 .../org/lwjgl/util/generator/openal/ALuint.java    |   49 +
 .../org/lwjgl/util/generator/openal/ALvoid.java    |   49 +
 .../generator/opencl/CLCapabilitiesGenerator.java  |  159 +++
 .../util/generator/opencl/CLDeviceExtension.java   |   41 +
 .../opencl/CLGeneratorProcessorFactory.java        |  181 +++
 .../opencl/CLPDCapabilitiesGenerator.java          |  148 +++
 .../util/generator/opencl/CLPlatformExtension.java |   41 +
 .../org/lwjgl/util/generator/opencl/CLTypeMap.java |  266 +++++
 .../lwjgl/util/generator/opencl/cl_bitfield.java   |   43 +
 .../org/lwjgl/util/generator/opencl/cl_bool.java   |   43 +
 .../org/lwjgl/util/generator/opencl/cl_byte.java   |   43 +
 .../org/lwjgl/util/generator/opencl/cl_char.java   |   43 +
 .../org/lwjgl/util/generator/opencl/cl_double.java |   43 +
 .../org/lwjgl/util/generator/opencl/cl_float.java  |   43 +
 .../org/lwjgl/util/generator/opencl/cl_int.java    |   42 +
 .../org/lwjgl/util/generator/opencl/cl_long.java   |   43 +
 .../org/lwjgl/util/generator/opencl/cl_short.java  |   43 +
 .../org/lwjgl/util/generator/opencl/cl_uchar.java  |   43 +
 .../org/lwjgl/util/generator/opencl/cl_uint.java   |   42 +
 .../org/lwjgl/util/generator/opencl/cl_void.java   |   45 +
 .../org/lwjgl/util/generator/opencl/size_t.java    |   43 +
 .../generator/opengl/GLCapabilitiesGenerator.java  |  328 ++++++
 .../opengl/GLGeneratorProcessorFactory.java        |  189 +++
 .../GLReferencesGeneratorProcessorFactory.java     |  208 ++++
 .../org/lwjgl/util/generator/opengl/GLTypeMap.java |  324 ++++++
 .../lwjgl/util/generator/opengl/GLbitfield.java    |   49 +
 .../org/lwjgl/util/generator/opengl/GLboolean.java |   49 +
 .../org/lwjgl/util/generator/opengl/GLbyte.java    |   49 +
 .../org/lwjgl/util/generator/opengl/GLchar.java    |   49 +
 .../org/lwjgl/util/generator/opengl/GLcharARB.java |   49 +
 .../org/lwjgl/util/generator/opengl/GLclampd.java  |   49 +
 .../org/lwjgl/util/generator/opengl/GLclampf.java  |   49 +
 .../org/lwjgl/util/generator/opengl/GLdouble.java  |   49 +
 .../org/lwjgl/util/generator/opengl/GLenum.java    |   49 +
 .../org/lwjgl/util/generator/opengl/GLfloat.java   |   49 +
 .../org/lwjgl/util/generator/opengl/GLhalf.java    |   49 +
 .../lwjgl/util/generator/opengl/GLhandleARB.java   |   49 +
 .../org/lwjgl/util/generator/opengl/GLint.java     |   49 +
 .../org/lwjgl/util/generator/opengl/GLint64.java   |   42 +
 .../lwjgl/util/generator/opengl/GLint64EXT.java    |   42 +
 .../org/lwjgl/util/generator/opengl/GLintptr.java  |   49 +
 .../lwjgl/util/generator/opengl/GLintptrARB.java   |   49 +
 .../org/lwjgl/util/generator/opengl/GLreturn.java  |   57 +
 .../org/lwjgl/util/generator/opengl/GLshort.java   |   49 +
 .../org/lwjgl/util/generator/opengl/GLsizei.java   |   49 +
 .../lwjgl/util/generator/opengl/GLsizeiptr.java    |   49 +
 .../lwjgl/util/generator/opengl/GLsizeiptrARB.java |   49 +
 .../org/lwjgl/util/generator/opengl/GLtime.java    |   49 +
 .../org/lwjgl/util/generator/opengl/GLubyte.java   |   49 +
 .../org/lwjgl/util/generator/opengl/GLuint.java    |   49 +
 .../org/lwjgl/util/generator/opengl/GLuint64.java  |   42 +
 .../lwjgl/util/generator/opengl/GLuint64EXT.java   |   42 +
 .../org/lwjgl/util/generator/opengl/GLushort.java  |   49 +
 .../org/lwjgl/util/generator/opengl/GLvoid.java    |   52 +
 src/java/org/lwjgl/util/glu/Cylinder.java          |   89 +-
 src/java/org/lwjgl/util/glu/Disk.java              |  107 +-
 src/java/org/lwjgl/util/glu/GLU.java               |   13 +-
 src/java/org/lwjgl/util/glu/GLUtessellator.java    |   26 +-
 .../org/lwjgl/util/glu/GLUtessellatorCallback.java |   30 +-
 src/java/org/lwjgl/util/glu/MipMap.java            |   76 +-
 src/java/org/lwjgl/util/glu/PartialDisk.java       |  153 ++--
 src/java/org/lwjgl/util/glu/PixelStoreState.java   |   60 +-
 src/java/org/lwjgl/util/glu/Project.java           |   52 +-
 src/java/org/lwjgl/util/glu/Quadric.java           |   63 +-
 src/java/org/lwjgl/util/glu/Registry.java          |   30 +-
 src/java/org/lwjgl/util/glu/Sphere.java            |  116 +-
 src/java/org/lwjgl/util/glu/Util.java              |  101 +-
 .../lwjgl/util/glu/tessellation/GLUhalfEdge.java   |    2 +-
 .../util/glu/tessellation/GLUtessellatorImpl.java  |   97 +-
 .../org/lwjgl/util/glu/tessellation/Normal.java    |    2 +-
 .../org/lwjgl/util/glu/tessellation/PriorityQ.java |    2 +-
 .../lwjgl/util/glu/tessellation/PriorityQHeap.java |    2 +-
 .../lwjgl/util/glu/tessellation/PriorityQSort.java |    2 +-
 .../org/lwjgl/util/glu/tessellation/Render.java    |   36 +-
 .../org/lwjgl/util/glu/tessellation/Sweep.java     |   16 +-
 src/java/org/lwjgl/util/jinput/KeyMap.java         |   28 +-
 src/java/org/lwjgl/util/jinput/LWJGLKeyboard.java  |   62 +-
 src/java/org/lwjgl/util/jinput/LWJGLMouse.java     |   74 +-
 src/java/org/lwjgl/util/vector/Matrix.java         |   54 +-
 src/java/org/lwjgl/util/vector/Matrix2f.java       |  138 ++--
 src/java/org/lwjgl/util/vector/Matrix3f.java       |   96 +-
 src/java/org/lwjgl/util/vector/Matrix4f.java       |  166 ++--
 src/java/org/lwjgl/util/vector/Quaternion.java     |   94 +-
 src/java/org/lwjgl/util/vector/ReadableVector.java |   32 +-
 .../org/lwjgl/util/vector/ReadableVector2f.java    |   30 +-
 .../org/lwjgl/util/vector/ReadableVector3f.java    |   28 +-
 .../org/lwjgl/util/vector/ReadableVector4f.java    |   30 +-
 src/java/org/lwjgl/util/vector/Vector.java         |   46 +-
 src/java/org/lwjgl/util/vector/Vector2f.java       |   34 +-
 src/java/org/lwjgl/util/vector/Vector3f.java       |   38 +-
 .../org/lwjgl/util/vector/WritableVector2f.java    |   40 +-
 .../org/lwjgl/util/vector/WritableVector3f.java    |   36 +-
 .../org/lwjgl/util/vector/WritableVector4f.java    |   36 +-
 src/native/common/CL/cl.h                          |  998 ++++++++++++++++
 src/native/common/CL/cl_d3d10.h                    |  126 ++
 src/native/common/CL/cl_ext.h                      |  213 ++++
 src/native/common/CL/cl_gl.h                       |  155 +++
 src/native/common/CL/cl_gl_ext.h                   |   69 ++
 src/native/common/CL/cl_platform.h                 | 1198 ++++++++++++++++++++
 src/native/common/OpenCL/cl_platform.h             |  296 +++++
 src/native/common/common_tools.c                   |  167 ++--
 src/native/common/common_tools.h                   |   36 +-
 src/native/common/extal.c                          |   36 +-
 src/native/common/extal.h                          |   32 +-
 src/native/common/extcl.c                          |   67 ++
 src/native/common/extcl.h                          |   91 ++
 src/native/common/extcl_types.h                    |   72 ++
 src/native/common/extgl.h                          |   67 +-
 src/native/common/extgl_types.h                    |   55 +
 src/native/common/opencl.h                         |   56 +
 src/native/common/org_lwjgl_BufferUtils.c          |    5 +
 src/native/common/org_lwjgl_openal_AL.c            |   32 +-
 src/native/common/org_lwjgl_opencl_CL.c            |   60 +
 src/native/common/org_lwjgl_opencl_CallbackUtil.c  |  229 ++++
 src/native/common/org_lwjgl_opengl_CallbackUtil.c  |  112 ++
 src/native/linux/linux_al.c                        |   32 +-
 src/native/linux/linux_cl.c                        |   64 ++
 src/native/linux/org_lwjgl_opengl_Display.c        |    6 +-
 .../org_lwjgl_opengl_LinuxContextImplementation.c  |   14 +-
 src/native/macosx/macosx_al.c                      |   36 +-
 src/native/macosx/macosx_cl.c                      |  114 ++
 ...org_lwjgl_opengl_WindowsContextImplementation.c |   18 +-
 src/native/windows/windows_al.c                    |   36 +-
 src/native/windows/windows_cl.c                    |   73 ++
 src/templates/org/lwjgl/openal/AL10.java           |    7 +-
 src/templates/org/lwjgl/openal/AL11.java           |   58 +-
 src/templates/org/lwjgl/openal/EFX10.java          |   17 +-
 .../lwjgl/opencl/AMD_device_attribute_query.java   |   45 +
 src/templates/org/lwjgl/opencl/AMD_fp64.java       |   39 +
 src/templates/org/lwjgl/opencl/AMD_media_ops.java  |   39 +
 src/templates/org/lwjgl/opencl/AMD_printf.java     |   39 +
 .../opencl/APPLE_ContextLoggingFunctions.java      |   64 ++
 .../lwjgl/opencl/APPLE_SetMemObjectDestructor.java |   55 +
 .../org/lwjgl/opencl/APPLE_gl_sharing.java         |   82 ++
 src/templates/org/lwjgl/opencl/CL10.java           | 1163 +++++++++++++++++++
 src/templates/org/lwjgl/opencl/CL10GL.java         |  138 +++
 src/templates/org/lwjgl/opencl/CL11.java           |  203 ++++
 .../org/lwjgl/opencl/EXT_device_fission.java       |  144 +++
 .../org/lwjgl/opencl/EXT_migrate_memobject.java    |   77 ++
 .../org/lwjgl/opencl/KHR_3d_image_writes.java      |   39 +
 .../lwjgl/opencl/KHR_byte_addressable_store.java   |   39 +
 .../org/lwjgl/opencl/KHR_d3d10_sharing.java        |   39 +
 src/templates/org/lwjgl/opencl/KHR_fp16.java       |   42 +
 src/templates/org/lwjgl/opencl/KHR_fp64.java       |   42 +
 src/templates/org/lwjgl/opencl/KHR_gl_event.java   |   56 +
 src/templates/org/lwjgl/opencl/KHR_gl_sharing.java |   77 ++
 .../opencl/KHR_global_int32_base_atomics.java      |   39 +
 .../opencl/KHR_global_int32_extended_atomics.java  |   39 +
 src/templates/org/lwjgl/opencl/KHR_icd.java        |   58 +
 .../org/lwjgl/opencl/KHR_int64_base_atomics.java   |   39 +
 .../lwjgl/opencl/KHR_int64_extended_atomics.java   |   39 +
 .../lwjgl/opencl/KHR_local_int32_base_atomics.java |   39 +
 .../opencl/KHR_local_int32_extended_atomics.java   |   39 +
 .../lwjgl/opencl/KHR_select_fprounding_mode.java   |   39 +
 .../org/lwjgl/opencl/NV_compiler_options.java      |   39 +
 .../lwjgl/opencl/NV_device_attribute_query.java    |   48 +
 .../org/lwjgl/opencl/NV_pragma_unroll.java         |   39 +
 .../org/lwjgl/opengl/AMD_debug_output.java         |   17 +-
 .../org/lwjgl/opengl/AMD_depth_clamp_separate.java |   44 +
 .../org/lwjgl/opengl/AMD_draw_buffers_blend.java   |    4 +-
 .../org/lwjgl/opengl/AMD_name_gen_delete.java      |    7 +-
 .../org/lwjgl/opengl/AMD_performance_monitor.java  |    6 +-
 .../opengl/AMD_vertex_shader_tessellator.java      |    2 +-
 .../org/lwjgl/opengl/APPLE_element_array.java      |    1 +
 src/templates/org/lwjgl/opengl/APPLE_fence.java    |    7 +-
 .../org/lwjgl/opengl/APPLE_flush_buffer_range.java |    6 +-
 .../org/lwjgl/opengl/APPLE_object_purgeable.java   |    4 +
 .../org/lwjgl/opengl/APPLE_texture_range.java      |    3 +
 .../lwjgl/opengl/APPLE_vertex_array_object.java    |    6 +-
 .../org/lwjgl/opengl/APPLE_vertex_array_range.java |    6 +-
 .../opengl/APPLE_vertex_program_evaluators.java    |    4 +-
 .../org/lwjgl/opengl/ARB_ES2_compatibility.java    |   86 ++
 .../org/lwjgl/opengl/ARB_blend_func_extended.java  |    7 +
 .../org/lwjgl/opengl/ARB_buffer_object.java        |    8 +-
 src/templates/org/lwjgl/opengl/ARB_cl_event.java   |   54 +
 .../org/lwjgl/opengl/ARB_color_buffer_float.java   |    2 +-
 .../org/lwjgl/opengl/ARB_copy_buffer.java          |    8 +-
 .../org/lwjgl/opengl/ARB_debug_output.java         |  138 +++
 .../org/lwjgl/opengl/ARB_draw_buffers.java         |    5 +-
 .../org/lwjgl/opengl/ARB_draw_buffers_blend.java   |    4 +-
 .../opengl/ARB_draw_elements_base_vertex.java      |    4 +
 .../org/lwjgl/opengl/ARB_draw_indirect.java        |    4 +
 .../org/lwjgl/opengl/ARB_draw_instanced.java       |    1 +
 .../org/lwjgl/opengl/ARB_framebuffer_object.java   |   32 +-
 .../org/lwjgl/opengl/ARB_geometry_shader4.java     |    4 +-
 .../org/lwjgl/opengl/ARB_get_program_binary.java   |   73 ++
 .../org/lwjgl/opengl/ARB_gpu_shader_fp64.java      |   20 +
 src/templates/org/lwjgl/opengl/ARB_imaging.java    |    7 +-
 .../org/lwjgl/opengl/ARB_instanced_arrays.java     |    2 +-
 .../org/lwjgl/opengl/ARB_map_buffer_range.java     |    5 +-
 .../org/lwjgl/opengl/ARB_matrix_palette.java       |    1 +
 .../org/lwjgl/opengl/ARB_multisample.java          |    2 +-
 .../org/lwjgl/opengl/ARB_multitexture.java         |    1 +
 .../org/lwjgl/opengl/ARB_occlusion_query.java      |    7 +-
 .../org/lwjgl/opengl/ARB_point_parameters.java     |    1 +
 src/templates/org/lwjgl/opengl/ARB_program.java    |    4 +-
 .../org/lwjgl/opengl/ARB_provoking_vertex.java     |    4 +-
 src/templates/org/lwjgl/opengl/ARB_robustness.java |  191 ++++
 .../org/lwjgl/opengl/ARB_sample_shading.java       |    2 +-
 .../org/lwjgl/opengl/ARB_sampler_objects.java      |   27 +-
 .../lwjgl/opengl/ARB_separate_shader_objects.java  |  338 ++++++
 .../org/lwjgl/opengl/ARB_shader_objects.java       |   12 +-
 .../org/lwjgl/opengl/ARB_shader_precision.java     |   35 +
 .../lwjgl/opengl/ARB_shader_stencil_export.java    |   35 +
 .../org/lwjgl/opengl/ARB_shader_subroutine.java    |   15 +
 .../lwjgl/opengl/ARB_shading_language_include.java |    8 +-
 src/templates/org/lwjgl/opengl/ARB_sync.java       |   30 +-
 .../org/lwjgl/opengl/ARB_tessellation_shader.java  |    3 +
 .../lwjgl/opengl/ARB_texture_buffer_object.java    |    4 +-
 .../org/lwjgl/opengl/ARB_texture_compression.java  |    3 +
 .../org/lwjgl/opengl/ARB_texture_multisample.java  |    8 +
 .../org/lwjgl/opengl/ARB_timer_query.java          |    7 +
 .../org/lwjgl/opengl/ARB_transform_feedback2.java  |   16 +-
 .../org/lwjgl/opengl/ARB_transform_feedback3.java  |    9 +
 .../lwjgl/opengl/ARB_uniform_buffer_object.java    |   23 +-
 .../org/lwjgl/opengl/ARB_vertex_array_object.java  |   12 +-
 .../org/lwjgl/opengl/ARB_vertex_attrib_64bit.java  |   99 ++
 .../org/lwjgl/opengl/ARB_vertex_blend.java         |    1 +
 .../org/lwjgl/opengl/ARB_vertex_program.java       |   21 +
 .../org/lwjgl/opengl/ARB_vertex_shader.java        |    8 +-
 .../opengl/ARB_vertex_type_2_10_10_10_rev.java     |   40 +
 .../org/lwjgl/opengl/ARB_viewport_array.java       |  144 +++
 .../org/lwjgl/opengl/ATI_draw_buffers.java         |    5 +-
 .../org/lwjgl/opengl/ATI_element_array.java        |    1 +
 .../org/lwjgl/opengl/ATI_envmap_bumpmap.java       |    1 +
 .../org/lwjgl/opengl/ATI_fragment_shader.java      |    2 +
 .../org/lwjgl/opengl/ATI_map_object_buffer.java    |    4 +-
 .../org/lwjgl/opengl/ATI_pn_triangles.java         |    2 +-
 .../org/lwjgl/opengl/ATI_separate_stencil.java     |    3 +-
 .../org/lwjgl/opengl/ATI_vertex_array_object.java  |    2 +
 .../opengl/ATI_vertex_attrib_array_object.java     |    3 +
 .../org/lwjgl/opengl/ATI_vertex_streams.java       |    1 +
 .../org/lwjgl/opengl/EXT_bindable_uniform.java     |    4 +-
 .../org/lwjgl/opengl/EXT_blend_color.java          |    2 +-
 .../lwjgl/opengl/EXT_blend_equation_separate.java  |    2 +-
 .../org/lwjgl/opengl/EXT_blend_func_separate.java  |    2 +-
 .../org/lwjgl/opengl/EXT_blend_minmax.java         |    2 +-
 .../lwjgl/opengl/EXT_compiled_vertex_array.java    |    2 +-
 .../org/lwjgl/opengl/EXT_depth_bounds_test.java    |    2 +-
 .../org/lwjgl/opengl/EXT_direct_state_access.java  |   80 +-
 .../org/lwjgl/opengl/EXT_draw_buffers2.java        |    5 +
 .../org/lwjgl/opengl/EXT_draw_instanced.java       |    1 +
 .../org/lwjgl/opengl/EXT_draw_range_elements.java  |    1 +
 src/templates/org/lwjgl/opengl/EXT_fog_coord.java  |    4 +
 .../org/lwjgl/opengl/EXT_framebuffer_blit.java     |    4 +-
 .../lwjgl/opengl/EXT_framebuffer_multisample.java  |    4 +-
 .../org/lwjgl/opengl/EXT_framebuffer_object.java   |    9 +-
 .../org/lwjgl/opengl/EXT_geometry_shader4.java     |    4 +-
 .../lwjgl/opengl/EXT_gpu_program_parameters.java   |    3 +
 .../org/lwjgl/opengl/EXT_gpu_shader4.java          |    2 +
 .../org/lwjgl/opengl/EXT_multi_draw_arrays.java    |    2 +
 .../org/lwjgl/opengl/EXT_paletted_texture.java     |    1 +
 .../org/lwjgl/opengl/EXT_point_parameters.java     |    1 +
 .../org/lwjgl/opengl/EXT_provoking_vertex.java     |    2 +-
 .../org/lwjgl/opengl/EXT_secondary_color.java      |    1 +
 .../lwjgl/opengl/EXT_separate_shader_objects.java  |    4 +
 .../lwjgl/opengl/EXT_shader_image_load_store.java  |    6 +-
 .../org/lwjgl/opengl/EXT_stencil_clear_tag.java    |    3 +-
 .../org/lwjgl/opengl/EXT_stencil_two_side.java     |    2 +-
 .../org/lwjgl/opengl/EXT_texture_array.java        |    6 +-
 .../lwjgl/opengl/EXT_texture_buffer_object.java    |    4 +-
 .../org/lwjgl/opengl/EXT_texture_integer.java      |    8 +-
 .../org/lwjgl/opengl/EXT_texture_sRGB_decode.java  |   53 +
 .../org/lwjgl/opengl/EXT_timer_query.java          |    2 +
 .../org/lwjgl/opengl/EXT_transform_feedback.java   |    6 +-
 .../org/lwjgl/opengl/EXT_vertex_attrib_64bit.java  |    2 +
 .../org/lwjgl/opengl/EXT_vertex_shader.java        |    1 +
 .../org/lwjgl/opengl/EXT_vertex_weighting.java     |    3 +
 src/templates/org/lwjgl/opengl/GL11.java           |   10 +-
 src/templates/org/lwjgl/opengl/GL12.java           |    5 +-
 src/templates/org/lwjgl/opengl/GL13.java           |    7 +-
 src/templates/org/lwjgl/opengl/GL14.java           |    5 +-
 src/templates/org/lwjgl/opengl/GL15.java           |   10 +-
 src/templates/org/lwjgl/opengl/GL20.java           |   20 +-
 src/templates/org/lwjgl/opengl/GL21.java           |    2 +-
 src/templates/org/lwjgl/opengl/GL30.java           |   63 +-
 src/templates/org/lwjgl/opengl/GL31.java           |    6 +-
 src/templates/org/lwjgl/opengl/GL32.java           |   27 +-
 src/templates/org/lwjgl/opengl/GL33.java           |    4 +-
 src/templates/org/lwjgl/opengl/GL40.java           |   10 +-
 src/templates/org/lwjgl/opengl/GL41.java           |  473 ++++++++
 .../org/lwjgl/opengl/GREMEDY_string_marker.java    |    2 +
 .../org/lwjgl/opengl/NV_conditional_render.java    |    4 +-
 src/templates/org/lwjgl/opengl/NV_copy_image.java  |    6 +-
 src/templates/org/lwjgl/opengl/NV_evaluators.java  |    4 +
 .../org/lwjgl/opengl/NV_explicit_multisample.java  |    8 +-
 src/templates/org/lwjgl/opengl/NV_fence.java       |    7 +-
 .../org/lwjgl/opengl/NV_fragment_program.java      |    3 +
 .../NV_framebuffer_multisample_coverage.java       |    6 +-
 .../org/lwjgl/opengl/NV_geometry_program4.java     |    8 +-
 .../org/lwjgl/opengl/NV_gpu_program4.java          |    3 +
 src/templates/org/lwjgl/opengl/NV_gpu_shader5.java |   40 +-
 src/templates/org/lwjgl/opengl/NV_half_float.java  |   22 +-
 .../org/lwjgl/opengl/NV_occlusion_query.java       |    7 +-
 .../lwjgl/opengl/NV_parameter_buffer_object.java   |    3 +
 .../org/lwjgl/opengl/NV_pixel_data_range.java      |    1 +
 .../org/lwjgl/opengl/NV_point_sprite.java          |    1 +
 .../org/lwjgl/opengl/NV_primitive_restart.java     |    1 +
 src/templates/org/lwjgl/opengl/NV_program.java     |    6 +-
 .../org/lwjgl/opengl/NV_register_combiners.java    |    3 +
 .../org/lwjgl/opengl/NV_register_combiners2.java   |    1 +
 .../org/lwjgl/opengl/NV_shader_buffer_load.java    |    3 +
 .../org/lwjgl/opengl/NV_transform_feedback.java    |    8 +-
 .../org/lwjgl/opengl/NV_transform_feedback2.java   |    7 +-
 .../org/lwjgl/opengl/NV_vertex_array_range.java    |    3 +-
 .../opengl/NV_vertex_attrib_integer_64bit.java     |    1 +
 .../opengl/NV_vertex_buffer_unified_memory.java    |    2 +
 .../org/lwjgl/opengl/NV_vertex_program.java        |    3 +-
 527 files changed, 31343 insertions(+), 7472 deletions(-)

diff --git a/build.xml b/build.xml
index 857af24..8d25e18 100644
--- a/build.xml
+++ b/build.xml
@@ -6,6 +6,7 @@
 	<import file="platform_build/build-generator.xml"/>
 	<import file="platform_build/build-applet.xml"/>
 	<import file="platform_build/build-webstart.xml"/>
+	<import file="platform_build/build-maven.xml"/>
 
 	<!-- ================================================================== -->
 	<!-- Everything below this line is targets.															-->
@@ -16,75 +17,87 @@
 	<!-- Initialize build			 																							-->
 	<!-- ================================================================== -->
 	<target name="-initialize">
-		<mkdir dir="${lwjgl.bin}" 								taskname="initialiazing bin folder" />
-		<mkdir dir="${lwjgl.bin}/lwjgl" 					taskname="initialiazing bin folder" />
-		<mkdir dir="${lwjgl.lib}" 								taskname="initialiazing lib folder" />
-		<mkdir dir="${lwjgl.dist}" 								taskname="initialiazing dist folder" />
-		<mkdir dir="${lwjgl.docs}/javadoc" 				taskname="initialiazing docs folder" />
-		<mkdir dir="${lwjgl.res}" 								taskname="initialiazing res folder" />
-		<mkdir dir="${lwjgl.temp}" 								taskname="initialiazing temp folder" />
-		<mkdir dir="${lwjgl.temp}/jar" 						taskname="initialiazing temp/jar folder" />
-		<mkdir dir="${lwjgl.temp}/doc" 						taskname="initialiazing temp/doc folder" />
-		<mkdir dir="${lwjgl.temp}/res" 						taskname="initialiazing temp/res folder" />
-		<mkdir dir="${lwjgl.temp}/native" 				taskname="initialiazing temp/native folder" />
-		<mkdir dir="${lwjgl.temp}/native/windows" 	taskname="initialiazing temp/windows folder" />
-		<mkdir dir="${lwjgl.temp}/native/linux" 	taskname="initialiazing temp/linux folder" />
-		<mkdir dir="${lwjgl.temp}/native/macosx" 	taskname="initialiazing temp/macosx folder" />
-		<mkdir dir="${lwjgl.temp}/native/solaris" taskname="initialiazing temp/solaris folder" />
+		<mkdir dir="${lwjgl.bin}"                   taskname="initialiazing bin folder" />
+		<mkdir dir="${lwjgl.bin}/lwjgl"             taskname="initialiazing native bin folder" />
+		<mkdir dir="${lwjgl.lib}"                   taskname="initialiazing lib folder" />
+		<mkdir dir="${lwjgl.dist}"                  taskname="initialiazing dist folder" />
+		<mkdir dir="${lwjgl.docs}/javadoc"          taskname="initialiazing docs folder" />
+		<mkdir dir="${lwjgl.res}"                   taskname="initialiazing res folder" />
+		<mkdir dir="${lwjgl.temp}"                  taskname="initialiazing temp folder" />
+		<mkdir dir="${lwjgl.temp}/jar"              taskname="initialiazing temp/jar folder" />
+		<mkdir dir="${lwjgl.temp}/doc"              taskname="initialiazing temp/doc folder" />
+		<mkdir dir="${lwjgl.temp}/res"              taskname="initialiazing temp/res folder" />
+		<mkdir dir="${lwjgl.temp}/native"           taskname="initialiazing temp/native folder" />
+		<mkdir dir="${lwjgl.temp}/native/windows"   taskname="initialiazing temp/windows folder" />
+		<mkdir dir="${lwjgl.temp}/native/linux"     taskname="initialiazing temp/linux folder" />
+		<mkdir dir="${lwjgl.temp}/native/macosx"    taskname="initialiazing temp/macosx folder" />
+		<mkdir dir="${lwjgl.temp}/native/solaris"   taskname="initialiazing temp/solaris folder" />
 	</target>
-	
+
 	<!-- Cleans up any files created during the execution of this script -->
-	<target name="clean" description="Cleans the diectories controlled by this ant script" depends="clean-generated">
-		<delete dir="${lwjgl.temp}" quiet="true" failonerror="false" taskname="cleaning temp folder" />
-		<delete dir="${lwjgl.docs}/javadoc" quiet="true" failonerror="false" taskname="cleaning javadoc folder" />
-		<delete dir="${lwjgl.bin}" quiet="true" failonerror="false" taskname="cleaning bin folder" />
-	</target>
-	
+	<target name="clean" description="Cleans all directories controlled by this ant script" depends="clean-java, clean-native"/>
+
+    <!-- Cleans up any non-native files created during the execution of this script -->
+    <target name="clean-java" description="Cleans non-native files generated by this ant script" depends="clean-generated">
+        <delete dir="${lwjgl.temp}" quiet="true" failonerror="false" taskname="cleaning temp folder" />
+        <delete dir="${lwjgl.docs}/javadoc" quiet="true" failonerror="false" taskname="cleaning javadoc folder" />
+        <!-- Delete java classes only to avoid unnecessary native recompilation -->
+        <delete dir="${lwjgl.bin}/org" quiet="true" failonerror="false" taskname="cleaning bin folder" />
+    </target>
+
+    <!-- Useful when we need to force native recompilation -->
+    <target name="clean-native" description="Cleans native files generated by this ant script" depends="clean-generated-native">
+        <delete dir="${lwjgl.bin}/lwjgl" quiet="true" failonerror="false" taskname="cleaning native bin folder" />
+    </target>
+
 	<!-- Creates a distribution of LWJGL -->
 	<target name="release" description="Creates a distribution of LWJGL using supplied native binaries">
 		<!-- Warn user -->
 		<echo message="Before running the release target, please manually compile all platforms and place required files in ${lwjgl.lib}/windows, ${lwjgl.lib}/linux and ${lwjgl.lib}/macosx${line.separator}Missing files will result in a successfull built, but with incomplete release zips"/>
-  	<input 
-  		message="All data in the ${lwjgl.dist} folder will be deleted. Continue? "
-    	validargs="yes,no"
-    	addproperty="do.delete"
-  	/>
-  	<condition property="do.abort">
-    	<equals arg1="no" arg2="${do.delete}"/>
-  	</condition>
-  	<fail if="do.abort">Build aborted by user.</fail>
-  	
-  	<!-- prepare -->
-  	<delete dir="${lwjgl.dist}" quiet="true" failonerror="false" />
-  	<antcall target="clean" />
-  	<antcall target="-initialize" />
-
-  	<!-- compile and create jars -->
-	<antcall target="generate-debug"/>
-	<antcall target="compile" />
-  	<antcall target="-createdebugjars" />
+        <input
+            message="All data in the ${lwjgl.dist} folder will be deleted. Continue? "
+            validargs="yes,no"
+            addproperty="do.delete"
+        />
+        <condition property="do.abort">
+            <equals arg1="no" arg2="${do.delete}"/>
+        </condition>
+        <fail if="do.abort">Build aborted by user.</fail>
+
+        <!-- prepare -->
+        <delete dir="${lwjgl.dist}" quiet="true" failonerror="false" />
+        <antcall target="clean-java" />
+        <antcall target="-initialize" />
+
+        <!-- compile and create debug jars -->
+        <antcall target="generate-debug" />
+        <antcall target="compile" />
+        <antcall target="-createdebugjars" />
+
 		<!-- Generator will skip all templates if we don't clean -->
-		<delete dir="${lwjgl.bin}" quiet="true" failonerror="false" taskname="cleaning bin folder" />
-		<mkdir dir="${lwjgl.bin}" taskname="initialiazing bin folder" />
-	<antcall target="generate-all"/>
-  	<antcall target="compile" />
-  	<antcall target="-createjars" />
-	<antcall target="-jars_NoDEP" />
- 	<antcall target="javadoc" />
-	<antcall target="applet-release" />
-  	
-  	<!-- copy resources to res folder -->
- 	<copy todir="${lwjgl.temp}/res">
-    	<fileset dir="res"/>
-  	</copy>
-  	
-  	<!-- copy docs -->
+		<delete dir="${lwjgl.bin}/org" quiet="true" failonerror="false" taskname="cleaning bin folder" />
+
+        <!-- compile and create jars -->
+        <antcall target="generate-all" />
+        <antcall target="compile" />
+        <antcall target="-createjars" />
+
+        <antcall target="-jars_NoDEP" />
+        <antcall target="javadoc" />
+        <antcall target="applet-release" />
+
+        <!-- copy resources to res folder -->
+        <copy todir="${lwjgl.temp}/res">
+            <fileset dir="res"/>
+        </copy>
+
+  	    <!-- copy docs -->
  		<copy todir="${lwjgl.temp}/doc">
     	<fileset dir="${lwjgl.docs}">
     		<patternset refid="lwjgl-docs.fileset" />
     	</fileset>
-  	</copy>
-		
+      	</copy>
+
 		<!-- create distribution from files in libs/ and temp/ -->
 		<antcall target="-distribution_javadoc" />
 		<antcall target="-distribution_source" />
@@ -105,7 +118,7 @@
 			</fileset>
 		</move>
 	</target>
-	
+
 	<!-- Packages the java files -->
 	<target name="-createdebugjars">
 		<!-- Create lwjgl.jar -->
@@ -116,7 +129,7 @@
 			</manifest>
 		</jar>
 	</target>
-	
+
 	<!-- Packages the java files -->
 	<target name="-createjars">
 		<!-- Create lwjgl.jar -->
@@ -126,9 +139,10 @@
 				<attribute name="Sealed" value="true"/>
 			</manifest>
 		</jar>
-		
+
 		<!-- Create lwjgl_util_applet.jar -->
 		<jar destfile="${lwjgl.temp}/jar/lwjgl_util_applet.jar" taskname="lwjgl_util_applet.jar">
+			<fileset dir="${lwjgl.res}" includes="applet*"/>
 			<fileset refid="lwjgl_util_applet.fileset" />
 			<manifest>
 				<attribute name="Sealed" value="true"/>
@@ -151,7 +165,7 @@
 	<target name="-distribute">
 		<delete>
 			<fileset dir="${lwjgl.temp}/native/" includes="**/*"/>
-		</delete>	
+		</delete>
 
 		<copy todir="${lwjgl.temp}/jar">
 			<fileset dir="${lwjgl.lib}/" includes="*.jar"/>
@@ -175,20 +189,20 @@
 			<fileset dir="${lwjgl.lib}/solaris">
 				<patternset refid="lwjgl-solaris.fileset" />
 			</fileset>
-		</copy>		
-		
+		</copy>
+
 		<!-- create base package -->
 		<zip destfile="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip">
 			<zipfileset dir="${lwjgl.temp}" prefix="lwjgl-${lwjgl.version}/">
 				<patternset refid="lwjgl_base"/>
-			</zipfileset>			
+			</zipfileset>
 		</zip>
-		
+
 		<!-- create applet package -->
 		<zip destfile="${lwjgl.dist}/lwjgl_applet-${lwjgl.version}.zip">
 			<zipfileset dir="." prefix="lwjgl_applet-${lwjgl.version}/">
 				<patternset refid="lwjgl_applet"/>
-			</zipfileset>			
+			</zipfileset>
 		</zip>
 	</target>
 
@@ -196,14 +210,14 @@
 	<target name="-distribution_javadoc">
 		<zip destfile="${lwjgl.dist}/lwjgl-docs-${lwjgl.version}.zip" basedir="${lwjgl.docs}" includes="javadoc/**" />
 	</target>
-	
+
 	<!-- Creates a versioned distribution of the source code -->
 	<target name="-distribution_source">
 		<zip destfile="${lwjgl.dist}/lwjgl-source-${lwjgl.version}.zip">
 			<fileset refid="lwjgl.source.fileset" />
 		</zip>
-	</target>	
-	
+	</target>
+
 	<!-- Generates the native headers from source files -->
 	<target name="headers" description="invokes javah on java classes" depends="compile">
 		<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux" force="yes">
@@ -219,7 +233,7 @@
 			<class name="org.lwjgl.opengl.LinuxContextImplementation" />
 			<class name="org.lwjgl.opengl.LinuxCanvasImplementation" />
 		</javah>
-		
+
 		<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows" force="yes">
 			<class name="org.lwjgl.opengl.WindowsKeyboard" />
 			<class name="org.lwjgl.opengl.WindowsPbufferPeerInfo" />
@@ -231,7 +245,7 @@
 			<class name="org.lwjgl.opengl.WindowsDisplayPeerInfo" />
 			<class name="org.lwjgl.opengl.WindowsContextImplementation" />
 		</javah>
-		
+
 		<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes">
 			<class name="org.lwjgl.MacOSXSysImplementation" />
 			<class name="org.lwjgl.opengl.MacOSXMouseEventQueue" />
@@ -241,7 +255,7 @@
 			<class name="org.lwjgl.opengl.MacOSXDisplay" />
 			<class name="org.lwjgl.opengl.MacOSXContextImplementation" />
 		</javah>
-		
+
 		<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}" force="yes">
 			<class name="org.lwjgl.opengl.AWTSurfaceLock" />
 			<class name="org.lwjgl.DefaultSysImplementation" />
@@ -251,16 +265,19 @@
 			<class name="org.lwjgl.openal.AL" />
 			<class name="org.lwjgl.opengl.GLContext" />
 			<class name="org.lwjgl.opengl.Pbuffer" />
-			<class name="org.lwjgl.opengl.AMDDebugOutputCallback" />
+			<class name="org.lwjgl.opengl.CallbackUtil" />
+            <class name="org.lwjgl.opencl.CL" />
+            <class name="org.lwjgl.opencl.CallbackUtil" />
+      <class name="org.lwjgl.BufferUtils" />
 		</javah>
 	</target>
-	
+
 	<target name="touch-version">
 		<touch file="${lwjgl.src.native}/windows/org_lwjgl_opengl_Display.c"/>
 		<touch file="${lwjgl.src.native}/linux/org_lwjgl_opengl_Display.c"/>
 		<touch file="${lwjgl.src.native}/macosx/org_lwjgl_opengl_Display.m"/>
 	</target>
-	
+
 	<target name="version-mismatch">
 		<loadfile srcfile="${lwjgl.src}/java/org/lwjgl/WindowsSysImplementation.java" property="lwjgl.java.windows.version">
 			<filterchain>
@@ -275,7 +292,7 @@
 	    		<containsstring contains="JNI_VERSION ="/>
 				</tokenfilter>
 			</filterchain>
-		</loadfile>			
+		</loadfile>
 		<loadfile srcfile="${lwjgl.src}/java/org/lwjgl/MacOSXSysImplementation.java" property="lwjgl.java.macosx.version">
 			<filterchain>
 				<tokenfilter>
@@ -296,7 +313,7 @@
 	    		<containsstring contains="#define org_lwjgl_LinuxSysImplementation_JNI_VERSION"/>
 				</tokenfilter>
 			</filterchain>
-		</loadfile>				
+		</loadfile>
 		<loadfile srcfile="${lwjgl.src.native}/macosx/org_lwjgl_MacOSXSysImplementation.h" property="lwjgl.native.macosx.version">
 			<filterchain>
 				<tokenfilter>
@@ -306,25 +323,26 @@
 		</loadfile>
 		<echo>
 			lwjgl.java.windows.version = ${lwjgl.java.windows.version}
-			lwjgl.native.windows.version = ${lwjgl.native.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.native.linux.version = ${lwjgl.native.linux.version}
 			lwjgl.java.macosx.version = ${lwjgl.java.macosx.version}
-			lwjgl.native.macosx.version = ${lwjgl.native.macosx.version}			
+			lwjgl.native.macosx.version = ${lwjgl.native.macosx.version}
 		</echo>
 	</target>
-	
+
 	<macrodef name="version-check">
 	  <attribute name="platform"/>
 	  <sequential>
 			<java classname="org.lwjgl.test.NativeTest" logError="false" resultproperty="nativetest.res" outputproperty="nativetest.out" errorproperty="nativetest.err" fork="true">
 				<jvmarg value="-Djava.library.path=libs/@{platform}"/>
+                <jvmarg value="-Dorg.lwjgl.util.Debug=true"/>
 	    	<classpath>
 	      	<pathelement path="${lwjgl.bin}"/>
 	        <pathelement path="${java.class.path}"/>
 	      </classpath>
 	    </java>
-	    
+
 	    <fail message="Unable to load native library: ${nativetest.err}">
 	     <condition>
 	       <not>
@@ -332,28 +350,30 @@
 	       </not>
 	     </condition>
 	   </fail>
-	   
+
 	   <echo message="Successfully executed NativeTest"/>
 		</sequential>
 	</macrodef>
-	
+
 	<!-- Compiles the Java source code -->
 	<target name="compile" description="Compiles the java source code" depends="-initialize">
-		<javac debug="yes" destdir="${lwjgl.bin}" source="1.4" target="1.4" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar" taskname="core">
+		<javac debug="yes" destdir="${lwjgl.bin}" source="1.5" target="1.5" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar" taskname="core">
+            <!--<compilerarg value="-Xlint:unchecked"/>-->
 			<src path="${lwjgl.src}/java/"/>
 			<src path="${lwjgl.src}/generated/"/>
 			<include name="org/lwjgl/*.java"/>
 			<include name="org/lwjgl/input/**"/>
 			<include name="org/lwjgl/opengl/**"/>
 			<include name="org/lwjgl/openal/**"/>
+            <include name="org/lwjgl/opencl/**"/>
 			<include name="org/lwjgl/util/**"/>
 			<exclude name="org/lwjgl/util/generator/**"/>
 		</javac>
-		<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/test/**" source="1.4" target="1.4" taskname="test" />
-		<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/examples/**" source="1.4" target="1.4" taskname="examples" />
-	</target>	
-	
-	<target name="compile_native" depends="headers, touch-version, version-mismatch" description="Compiles the native files">
+		<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/test/**" source="1.5" target="1.5" taskname="test" />
+		<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/examples/**" source="1.5" target="1.5" taskname="examples" />
+	</target>
+
+	<target name="compile_native" depends="-initialize, headers, touch-version, version-mismatch" description="Compiles the native files">
 		<condition property="lwjgl.platform.windows">
 			<os family="windows" />
 		</condition>
@@ -373,7 +393,7 @@
 			<os name="Mac OS X" />
 		</condition>
 		<antcall target="-compile_native_macosx" />
-	</target>	
+	</target>
 
 	<!-- Compiles LWJGL on Win32 platforms  -->
 	<target name="-compile_native_win32" if="lwjgl.platform.windows">
@@ -409,7 +429,7 @@
 		<copy file="${lwjgl.bin}/lwjgl/liblwjgl.jnilib" todir="${lwjgl.lib}/macosx"/>
 		<version-check platform="macosx"/>
 	</target>
-	
+
 	<target name="repack200" description="Pack200-repack a jar file">
 		<pack200 src="${input}" destfile="${output}" repack="true"/>
 	</target>
@@ -429,7 +449,7 @@
     	<arg value="${output}"/>
    	</java>
 	</target>
-	
+
 	<target name="compress-sign-class">
 		<antcall target="repack200">
 			<param name="input" value="${dir}${jarfile}.jar"/>
@@ -442,20 +462,21 @@
 		</antcall>
 		<antcall target="lzma">
 			<param name="input" value="${dir}${jarfile}.jar.pack"/>
-			<param name="output" value="${dir}${jarfile}.jar.pack.lzma"/>
+			<param name="output" value="${outputdir}${jarfile}.jar.pack.lzma"/>
 		</antcall>
-		<delete file="${dir}${jarfile}-repack.jar"/>
+		<!--delete file="${dir}${jarfile}-repack.jar"/-->
 		<delete file="${dir}${jarfile}.jar.pack"/>
-		<delete file="${dir}${jarfile}.jar"/>
+		<!--delete file="${dir}${jarfile}.jar"/-->
+		<rename src="${dir}${jarfile}-repack.jar" dest="${dir}${jarfile}.jar" replace="yes"/>
 	</target>
-	
+
 	<target name="compress-resource">
 		<antcall target="lzma">
 			<param name="input" value="${input}"/>
 			<param name="output" value="${output}"/>
 		</antcall>
 	</target>
-	
+
 	<target name="applettest" depends="applet">
 		<exec executable="appletviewer">
 			<arg value="-J-Djava.security.policy=applet/appletviewer.policy"/>
@@ -485,11 +506,11 @@
 			<sysproperty key="java.library.path" value="${native_path_expanded}"/>
 			<arg line="${args}"/>
 		</java>
-	</target>	
-	
+	</target>
+
 	<!-- Creates the Javadoc -->
 	<target name="javadoc" description="Creates javadoc from java source code">
-		<javadoc destdir="${lwjgl.docs}/javadoc" classpath="${lwjgl.lib}/jinput.jar" author="true" version="true" use="true" source="1.4" windowtitle="LWJGL API" useexternalfile="true">
+		<javadoc destdir="${lwjgl.docs}/javadoc" classpath="${lwjgl.lib}/jinput.jar" author="true" version="true" use="true" source="1.5" windowtitle="LWJGL API" useexternalfile="true">
 			<fileset refid="lwjgl.javadoc.fileset" />
 			<doctitle><![CDATA[<h1>Lightweight Java Game Toolkit</h1>]]></doctitle>
 			<bottom><![CDATA[<i>Copyright &#169; 2002-2009 lwjgl.org. All Rights Reserved.</i>]]></bottom>
diff --git a/platform_build/build-applet.xml b/platform_build/build-applet.xml
index abf00c9..588347d 100644
--- a/platform_build/build-applet.xml
+++ b/platform_build/build-applet.xml
@@ -3,7 +3,7 @@
 	<!-- Create our packer task -->
 	<taskdef name="pack200" classname="com.sun.tools.apache.ant.pack200.Pack200Task" classpath="platform_build/Pack200Task.jar"/>
 
-	<target name="applet" depends="all">
+	<target name="applet">
 		<antcall target="-applet">
 		    <param name="keystore" value="applet/lwjglkeystore"/>
 			<param name="alias" value="lwjgl"/>			
@@ -31,121 +31,117 @@
 	<target name="-applet">
 	
 		<!-- Create lwjgl_applet.jar -->
-		<jar destfile="applet/lwjgl_applet.jar" taskname="lwjgl_applet.jar">
+		<jar destfile="applet/basic/lwjgl_applet.jar" taskname="lwjgl_applet.jar">
 			<fileset refid="lwjgl_applet.fileset" />
 		</jar>
 		
 		<!-- create each of the native jars -->
-		<jar destfile="applet/windows_natives.jar" taskname="windows_natives.jar">
+		<jar destfile="applet/basic/windows_natives.jar" taskname="windows_natives.jar">
 			<fileset dir="${lwjgl.lib}/windows">
 				<patternset refid="lwjgl-windows.fileset"/>
 			</fileset>
 		</jar>
-		<signjar jar="applet/windows_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+		<signjar jar="applet/basic/windows_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
 		
-		<jar destfile="applet/linux_natives.jar" taskname="linux_natives.jar">
+		<jar destfile="applet/basic/linux_natives.jar" taskname="linux_natives.jar">
 			<fileset dir="${lwjgl.lib}/linux">
 				<patternset refid="lwjgl-linux.fileset"/>
 			</fileset>
 		</jar>
-		<signjar jar="applet/linux_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+		<signjar jar="applet/basic/linux_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
 			
-		<jar destfile="applet/macosx_natives.jar" taskname="macosx_natives.jar">
+		<jar destfile="applet/basic/macosx_natives.jar" taskname="macosx_natives.jar">
 			<fileset dir="${lwjgl.lib}/macosx">
 				<patternset refid="lwjgl-macosx.fileset"/>
 			</fileset>
 		</jar>
-		<signjar jar="applet/macosx_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+		<signjar jar="applet/basic/macosx_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
 		
-		<jar destfile="applet/solaris_natives.jar" taskname="solaris_natives.jar">
+		<jar destfile="applet/basic/solaris_natives.jar" taskname="solaris_natives.jar">
 			<fileset dir="${lwjgl.lib}/solaris">
 				<patternset refid="lwjgl-solaris.fileset"/>
 			</fileset>
 		</jar>
-		<signjar jar="applet/solaris_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>		
-			
-  	<jar destfile="${lwjgl.lib}/lwjgl_util_applet.jar" update="true">
-  		<fileset dir="${lwjgl.res}" includes="applet*"/>
-  	</jar>
+		<signjar jar="applet/basic/solaris_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>		
 
-	  	<copy file="${lwjgl.lib}/lwjgl.jar" todir="applet" overwrite="true"/>
-		<copy file="${lwjgl.lib}/lwjgl-debug.jar" todir="applet" overwrite="true"/>
-		<copy file="${lwjgl.lib}/lwjgl_util_applet.jar" todir="applet" overwrite="true"/>
-		<copy file="${lwjgl.lib}/lwjgl_util.jar" todir="applet" overwrite="true"/>
-		<copy file="${lwjgl.lib}/jinput.jar" todir="applet" overwrite="true"/>
-		<copy file="${lwjgl.lib}/lzma.jar" todir="applet" overwrite="true"/>
-		<zip destfile="applet/res.jar">
-		  <zipfileset dir="${lwjgl.res}" includes="Footsteps.wav, ILtest.tga, Missing_you.mod"/>
-		</zip>
-		<signjar jar="applet/lwjgl_util_applet.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
-		<signjar jar="applet/lzma.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+	  	<copy file="${lwjgl.lib}/lwjgl.jar" todir="applet/basic" overwrite="true"/>
+		<copy file="${lwjgl.lib}/lwjgl-debug.jar" todir="applet/basic" overwrite="true"/>
+		<copy file="${lwjgl.lib}/lwjgl_util_applet.jar" todir="applet/basic" overwrite="true"/>
+		<copy file="${lwjgl.lib}/lwjgl_util.jar" todir="applet/basic" overwrite="true"/>
+		<copy file="${lwjgl.lib}/jinput.jar" todir="applet/basic" overwrite="true"/>
+		<copy file="${lwjgl.lib}/lzma.jar" todir="applet/advance" overwrite="true"/>
 		
+		<signjar jar="applet/basic/lwjgl_util_applet.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+		<signjar jar="applet/advance/lzma.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+		<copy file="applet/basic/lwjgl_util_applet.jar" todir="applet/advance" overwrite="true"/>
+
 		<!-- LZMA only, for 1.4 only clients -->
-		<antcall target="compress-resource">
-			<param name="input" value="applet/lwjgl.jar"/>
-			<param name="output" value="applet/lwjgl.jar.lzma"/>
+		<!--antcall target="compress-resource">
+			<param name="input" value="applet/basic/lwjgl.jar"/>
+			<param name="output" value="applet/advance/lwjgl.jar.lzma"/>
 		</antcall>
 		<antcall target="compress-resource">
-			<param name="input" value="applet/lwjgl-debug.jar"/>
-			<param name="output" value="applet/lwjgl-debug.jar.lzma"/>
+			<param name="input" value="applet/basic/lwjgl-debug.jar"/>
+			<param name="output" value="applet/advance/lwjgl-debug.jar.lzma"/>
 		</antcall>
 		
 		<antcall target="compress-resource">
-			<param name="input" value="applet/lwjgl_util.jar"/>
-			<param name="output" value="applet/lwjgl_util.jar.lzma"/>
+			<param name="input" value="applet/basic/lwjgl_util.jar"/>
+			<param name="output" value="applet/advance/lwjgl_util.jar.lzma"/>
 		</antcall>
 		<antcall target="compress-resource">
-			<param name="input" value="applet/jinput.jar"/>
-			<param name="output" value="applet/jinput.jar.lzma"/>
+			<param name="input" value="applet/basic/jinput.jar"/>
+			<param name="output" value="applet/advance/jinput.jar.lzma"/>
 		</antcall>
 		<antcall target="compress-resource">
-			<param name="input" value="applet/lwjgl_applet.jar"/>
-			<param name="output" value="applet/lwjgl_applet.jar.lzma"/>
+			<param name="input" value="applet/basic/lwjgl_applet.jar"/>
+			<param name="output" value="applet/advance/lwjgl_applet.jar.lzma"/>
 		</antcall>
 		<antcall target="compress-resource">
-			<param name="input" value="applet/windows_natives.jar"/>
-			<param name="output" value="applet/windows_natives.jar.lzma"/>
-		</antcall>		
+			<param name="input" value="applet/basic/windows_natives.jar"/>
+			<param name="output" value="applet/advance/windows_natives.jar.lzma"/>
+		</antcall -->
+		
 		<antcall target="compress-sign-class">
-			<param name="dir" value="applet/"/>
+			<param name="dir" value="applet/basic/"/>
+			<param name="outputdir" value="applet/advance/"/>
 			<param name="jarfile" value="lwjgl"/>
 		</antcall>
 		<antcall target="compress-sign-class">
-			<param name="dir" value="applet/"/>
+			<param name="dir" value="applet/basic/"/>
+			<param name="outputdir" value="applet/advance/"/>
 			<param name="jarfile" value="lwjgl-debug"/>
 		</antcall>
 		<antcall target="compress-sign-class">
-			<param name="dir" value="applet/"/>
+			<param name="dir" value="applet/basic/"/>
+			<param name="outputdir" value="applet/advance/"/>
 			<param name="jarfile" value="lwjgl_util"/>
 		</antcall>
 		<antcall target="compress-sign-class">
-			<param name="dir" value="applet/"/>
+			<param name="dir" value="applet/basic/"/>
+			<param name="outputdir" value="applet/advance/"/>
 			<param name="jarfile" value="jinput"/>
 		</antcall>
 		<antcall target="compress-sign-class">
-			<param name="dir" value="applet/"/>
+			<param name="dir" value="applet/basic/"/>
+			<param name="outputdir" value="applet/advance/"/>
 			<param name="jarfile" value="lwjgl_applet"/>
 		</antcall>
 		<antcall target="compress-resource">
-			<param name="input" value="applet/windows_natives.jar"/>
-			<param name="output" value="applet/windows_natives.jar.lzma"/>
+			<param name="input" value="applet/basic/windows_natives.jar"/>
+			<param name="output" value="applet/advance/windows_natives.jar.lzma"/>
 		</antcall>
 		<antcall target="compress-resource">
-			<param name="input" value="applet/macosx_natives.jar"/>
-			<param name="output" value="applet/macosx_natives.jar.lzma"/>
+			<param name="input" value="applet/basic/macosx_natives.jar"/>
+			<param name="output" value="applet/advance/macosx_natives.jar.lzma"/>
 		</antcall>
 		<antcall target="compress-resource">
-			<param name="input" value="applet/linux_natives.jar"/>
-			<param name="output" value="applet/linux_natives.jar.lzma"/>
+			<param name="input" value="applet/basic/linux_natives.jar"/>
+			<param name="output" value="applet/advance/linux_natives.jar.lzma"/>
 		</antcall>
 		<antcall target="compress-resource">
-			<param name="input" value="applet/solaris_natives.jar"/>
-			<param name="output" value="applet/solaris_natives.jar.lzma"/>
-		</antcall>		
-		
-		<antcall target="compress-resource">
-			<param name="input" value="applet/res.jar"/>
-			<param name="output" value="applet/res.jar.lzma"/>
+			<param name="input" value="applet/basic/solaris_natives.jar"/>
+			<param name="output" value="applet/advance/solaris_natives.jar.lzma"/>
 		</antcall>
 	</target>
 </project>
\ No newline at end of file
diff --git a/platform_build/build-definitions.xml b/platform_build/build-definitions.xml
index c977dc4..14dbc91 100644
--- a/platform_build/build-definitions.xml
+++ b/platform_build/build-definitions.xml
@@ -2,35 +2,44 @@
 	<!-- ================================================================== -->
 	<!-- Global properties for build 																				-->
 	<!-- ================================================================== -->
-	<property name="lwjgl.src" 						location="src" />
-	<property name="lwjgl.src.native" 		location="${lwjgl.src}/native" />
-	<property name="lwjgl.src.headers" 		location="${lwjgl.src.native}/common" />
-	<property name="lwjgl.src.templates"	location="${lwjgl.src}/templates" />
-	<property name="lwjgl.bin" 						location="bin" />
-	<property name="lwjgl.lib" 						location="libs" />
-	<property name="lwjgl.dist" 					location="dist" />
-	<property name="lwjgl.docs" 					location="doc" />
-	<property name="lwjgl.temp" 					location="temp" />
-	<property name="lwjgl.res" 						location="res" />
-	<property name="lwjgl.version" 				value="2.5" />
+	<property name="lwjgl.src" 					location="src" />
+	<property name="lwjgl.src.native" 			location="${lwjgl.src}/native" />
+	<property name="lwjgl.src.headers" 			location="${lwjgl.src.native}/common" />
+	<property name="lwjgl.src.templates"		location="${lwjgl.src}/templates" />
+	<property name="lwjgl.bin" 					location="bin" />
+	<property name="lwjgl.lib" 					location="libs" />
+	<property name="lwjgl.dist" 				location="dist" />
+	<property name="lwjgl.docs" 				location="doc" />
+	<property name="lwjgl.temp" 				location="temp" />
+	<property name="lwjgl.res" 					location="res" />
+	<property name="lwjgl.version" 				value="2.7.1" />
+	<property name="lwjgl.web" 						location="www" />
 
 	<property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/AMD*.java,org/lwjgl/opengl/APPLE*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/NVX*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java,org/lwjgl/opengl/GREMEDY*.java"/>
+    <property name="opencl-template-pattern-extensions" value="org/lwjgl/opencl/KHR*.java,org/lwjgl/opencl/EXT*.java,org/lwjgl/opencl/APPLE*.java,org/lwjgl/opencl/AMD*.java,org/lwjgl/opencl/NV*.java"/>
+    <property name="opencl-template-pattern" value="org/lwjgl/opencl/CL*.java,${opencl-template-pattern-extensions}"/>
+
 	<!-- ================================================================== -->
 	<!-- Filesets used for targets 																					-->
 	<!-- ================================================================== -->
 
 	<!-- Files to include in the lwjgl.jar file -->
 	<fileset id="lwjgl.fileset" dir="${lwjgl.bin}">
-		<include name="org/**/*" />
-		<exclude name="org/lwjgl/d3d/**" />
-		<exclude name="org/lwjgl/test/**" />
-		<exclude name="org/lwjgl/util/**" />
-		<exclude name="org/lwjgl/examples/**" />
+		<patternset id="lwjgl.package.pattern">
+			<include name="org/**/*" />
+			<exclude name="org/lwjgl/d3d/**" />
+			<exclude name="org/lwjgl/test/**" />
+			<exclude name="org/lwjgl/util/**" />
+			<exclude name="org/lwjgl/examples/**" />
+		</patternset>
 	</fileset>
-
+	
+	<!-- Files to include in the lwjgl_util_applet.jar file -->
 	<fileset id="lwjgl_util_applet.fileset" dir="${lwjgl.bin}">
-		<exclude name="**.*"/>
-		<include name="org/lwjgl/util/applet/**"/>
+		<patternset id="lwjgl_util_applet.package.pattern">
+			<exclude name="**.*"/>
+			<include name="org/lwjgl/util/applet/**"/>
+		</patternset>
 	</fileset>
 
 	<!-- Files to include in the lwjgl_test.jar file -->
@@ -39,26 +48,27 @@
 		<include name="org/lwjgl/test/**" />
 		<include name="org/lwjgl/examples/**" />
 	</fileset>
-  
+
   <!-- More files to include in the lwjgl_test.jar file -->
 	<fileset id="lwjgl_test_extra.fileset" dir="${lwjgl.src}/java">
 		<exclude name="**.*" />
-		<include name="org/lwjgl/test/opengl/shaders/shaderFP.fp" />
-    <include name="org/lwjgl/test/opengl/shaders/shaderFP.vp" />
-    <include name="org/lwjgl/test/opengl/shaders/shaderFSH.fsh" />
-    <include name="org/lwjgl/test/opengl/shaders/shaderFSH.vsh" />
-    <include name="org/lwjgl/test/opengl/shaders/shaderVP.vp" />
-    <include name="org/lwjgl/test/opengl/shaders/shaderVSH.vsh" />
-    <include name="org/lwjgl/test/opengl/shaders/shaderUNI.vsh" />
-	</fileset>  
+		<include name="org/lwjgl/test/opengl/shaders/*.fp" />
+        <include name="org/lwjgl/test/opengl/shaders/*.vp" />
+        <include name="org/lwjgl/test/opengl/shaders/*.vsh" />
+        <include name="org/lwjgl/test/opengl/shaders/*.fsh" />
+        <include name="org/lwjgl/test/opencl/gl/*.cl" />
+	</fileset>
 
 	<!-- Files to include in the lwjgl_util.jar file -->
 	<fileset id="lwjgl_util.fileset" dir="${lwjgl.bin}">
-		<exclude name="**.*" />
-		<exclude name="org/lwjgl/util/generator/**" />
-		<exclude name="org/lwjgl/util/applet/**" />
-		<include name="org/lwjgl/util/**" />
+		<patternset id="lwjgl_util.package.pattern">
+			<exclude name="**.*" />
+			<exclude name="org/lwjgl/util/generator/**" />
+			<exclude name="org/lwjgl/util/applet/**" />
+			<include name="org/lwjgl/util/**" />
+		</patternset>
 	</fileset>
+		
 
 	<!-- Files to include in the lwjgl_applet.jar file -->
 	<fileset id="lwjgl_applet.fileset" dir="${lwjgl.bin}">
@@ -66,7 +76,7 @@
 		<include name="org/lwjgl/test/applet/**"/>
 		<include name="org/lwjgl/test/opengl/awt/AWTGearsCanvas.class"/>
 	</fileset>
-	
+
 	<!-- Files to make Javadoc from -->
 	<fileset id="lwjgl.javadoc.fileset" dir="${lwjgl.src}">
 		<include name="**/*.java" />
@@ -88,36 +98,48 @@
 
 	<!-- Files to include in windows package -->
 	<patternset id="lwjgl-windows.fileset">
-		<include name="lwjgl.dll" />
-		<include name="lwjgl64.dll" />
-		<include name="OpenAL32.dll" />
-		<include name="OpenAL64.dll" />
-    	<include name="jinput-dx8*.dll" />
-    	<include name="jinput-raw*.dll" />
+		<patternset id="lwjgl-windows-lwjgl.fileset">
+			<include name="lwjgl.dll" />
+			<include name="lwjgl64.dll" />
+			<include name="OpenAL32.dll" />
+			<include name="OpenAL64.dll" />
+		</patternset>
+		<patternset id="lwjgl-windows-jinput.fileset">
+	    	<include name="jinput-dx8*.dll" />
+	    	<include name="jinput-raw*.dll" />
+		</patternset>
 	</patternset>
-	
+
 	<!-- Files to include in linux, glibc2.3 package -->
 	<patternset id="lwjgl-linux.fileset">
-		<include name="liblwjgl*.so" />
-		<include name="libopenal*.so" />    
-		<include name="libjinput-linux.so" />
-		<include name="libjinput-linux64.so" />
+		<patternset id="lwjgl-linux-lwjgl.fileset">
+			<include name="liblwjgl*.so" />
+			<include name="libopenal*.so" />
+		</patternset>
+		<patternset id="lwjgl-linux-jinput.fileset">	
+			<include name="libjinput-linux.so" />
+			<include name="libjinput-linux64.so" />
+		</patternset>
 	</patternset>
-	
+
 	<!-- Files to include in mac os x package -->
 	<patternset id="lwjgl-macosx.fileset">
-		<include name="liblwjgl.jnilib" />
-		<include name="openal.dylib" />
-	    <include name="libjinput-osx.jnilib" />
-	    <include name="libjinput-osx-legacy.jnilib" />
+		<patternset id="lwjgl-macosx-lwjgl.fileset">
+			<include name="liblwjgl.jnilib" />
+			<include name="openal.dylib" />
+		</patternset>
+		<patternset id="lwjgl-macosx-jinput.fileset">
+		    <include name="libjinput-osx.jnilib" />
+		    <include name="libjinput-osx-legacy.jnilib" />
+		</patternset>
 	</patternset>
-	
+
 	<!-- Files to include in solaris package -->
 	<patternset id="lwjgl-solaris.fileset">
 		<include name="liblwjgl*.so" />
-		<include name="libopenal.so" />    
+		<include name="libopenal*.so" />
 	</patternset>
-	
+
 	<!-- Files to include in source distribution -->
 	<fileset id="lwjgl.source.fileset" dir=".">
         <include name="build.xml" />
@@ -132,7 +154,7 @@
 		<exclude name="res/Missing_you.mod" />
 		<exclude name="res/phero*.*" />
 	</patternset>
-	
+
 	<!-- files in the optional package -->
 	<patternset id="lwjgl_optional">
 		<include name="res/**" />
@@ -143,17 +165,17 @@
 		<include name="doc/CREDITS" />
 		<include name="doc/LICENSE" />
 		<include name="doc/README" />
-	</patternset>	
-	
+	</patternset>
+
 	<!-- files in the lwjgl_applet package -->
 	<patternset id="lwjgl_applet">
 		<include name="applet/**" />
 		<exclude name="applet/appletviewer.policy" />
 		<exclude name="applet/lwjglkeystore" />
-	</patternset>		
-	
+	</patternset>
+
 	<uptodate property="lwjgl.main.built" targetfile="${lwjgl.lib}/windows/lwjgl.dll" >
 	    <srcfiles dir= "${lwjgl.src.native}/common" includes="*.c*"/>
 	    <srcfiles dir= "${lwjgl.src.native}/windows" includes="*.c"/>
 	</uptodate>
-</project>
\ No newline at end of file
+</project>
diff --git a/platform_build/build-generator.xml b/platform_build/build-generator.xml
index b9bac2d..6904f76 100644
--- a/platform_build/build-generator.xml
+++ b/platform_build/build-generator.xml
@@ -1,30 +1,53 @@
 <project name="generator">
 
 	<!-- clean the generated files -->
-	<target name="clean-generated" description="Deletes the generated java and native source">
+	<target name="clean-generated" description="Deletes the generated java source">
 		<delete quiet="true" failonerror="false">
 			<fileset dir="${lwjgl.src}/generated" includes="**"/>
-			<fileset dir="${lwjgl.src.native}/generated" includes="**"/>
 		</delete>
 	</target>
-	
+
+    <target name="clean-generated-native" description="Deletes the generated native source" depends="clean-generated">
+        <delete quiet="false" failonerror="false">
+            <fileset dir="${lwjgl.src.native}/generated" includes="**"/>
+        </delete>
+    </target>
+
 	<!-- Compiles the Java generator source code -->
 	<target name="generators" description="Compiles the native method generators">
 		<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/util/generator/**.java" source="1.5" target="1.5" taskname="generator">
+            <include name="org/lwjgl/util/generator/openal/**.java"/>
+            <include name="org/lwjgl/util/generator/opengl/**.java"/>
+            <include name="org/lwjgl/util/generator/opencl/**.java"/>
 			<compilerarg value="-Xlint:all"/>
 		</javac>
         <!-- Compile helper classes used by the templates -->
-		<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" source="1.4" target="1.4" taskname="generator">
+		<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" source="1.5" target="1.5" taskname="generator">
+            <include name="org/lwjgl/PointerWrapper.java"/>
+            <include name="org/lwjgl/PointerBuffer.java"/>
+            <!-- OpenGL -->
 			<include name="org/lwjgl/opengl/GLSync.java"/>
             <include name="org/lwjgl/opengl/AMDDebugOutputCallback.java"/>
-			<include name="org/lwjgl/opengl/PointerWrapper.java"/>
+            <include name="org/lwjgl/opengl/ARBDebugOutputCallback.java"/>
+            <!-- OpenCL -->
+            <include name="org/lwjgl/opencl/CLPlatform.java"/>
+            <include name="org/lwjgl/opencl/CLDevice.java"/>
+            <include name="org/lwjgl/opencl/CLContext.java"/>
+            <include name="org/lwjgl/opencl/CLContextCallback.java"/>
+            <include name="org/lwjgl/opencl/CLCommandQueue.java"/>
+            <include name="org/lwjgl/opencl/CLMem.java"/>
+            <include name="org/lwjgl/opencl/CLMemObjectDestructorCallback.java"/>
+            <include name="org/lwjgl/opencl/CLBuildProgramCallback.java"/>
+            <include name="org/lwjgl/opencl/CLNativeKernel.java"/>
+            <include name="org/lwjgl/opencl/CLEventCallback.java"/>
+            <include name="org/lwjgl/opencl/CLFunctionAddress.java"/>
 		</javac>
 	</target>
 
 	<!-- Proxy target to generate it all -->
-	<target name="generate-all" depends="generate-openal, generate-opengl, generate-opengl-capabilities, generate-opengl-references" description="Generates java and native source"/>
+	<target name="generate-all" depends="generate-openal, generate-opengl, generate-opengl-capabilities, generate-opengl-references, generate-opencl, generate-opencl-capabilities" description="Generates java and native source"/>
 
-	<target name="generate-debug" depends="generate-openal-debug, generate-opengl-debug, generate-opengl-capabilities-debug, generate-opengl-references" description="Generates java and native source"/>
+	<target name="generate-debug" depends="generate-openal-debug, generate-opengl-debug, generate-opengl-capabilities-debug, generate-opengl-references, generate-opencl-debug, generate-opencl-capabilities-debug" description="Generates java and native source with debug functionality"/>
 
 	<!-- Generate OpenAL -->
 	<target name="generate-openal" depends="generators" description="Generates java and native source for AL">
@@ -38,11 +61,11 @@
 			<arg path="${lwjgl.src}/generated"/>
 			<arg value="-d"/>
 			<arg path="${lwjgl.src.native}/generated"/>
-			<arg value="-Atypemap=org.lwjgl.util.generator.ALTypeMap"/>
+			<arg value="-Atypemap=org.lwjgl.util.generator.openal.ALTypeMap"/>
 			<fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java, org/lwjgl/openal/EFX10.java"/>
 		</apply>
 	</target>
-	
+
 	<!-- Generate OpenAL [DEBUG] -->
 	<target name="generate-openal-debug" depends="generators" description="Generates java and native source for AL">
 		<apply executable="apt" parallel="true">
@@ -55,7 +78,7 @@
 			<arg path="${lwjgl.src}/generated"/>
 			<arg value="-d"/>
 			<arg path="${lwjgl.src.native}/generated"/>
-			<arg value="-Atypemap=org.lwjgl.util.generator.ALTypeMap"/>
+			<arg value="-Atypemap=org.lwjgl.util.generator.openal.ALTypeMap"/>
 			<arg value="-Ageneratechecks"/>
 			<fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java, org/lwjgl/openal/EFX10.java"/>
 		</apply>
@@ -74,7 +97,7 @@
 			<arg value="-d"/>
 			<arg path="${lwjgl.src.native}/generated"/>
 			<arg value="-Acontextspecific"/>
-			<arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/>
+			<arg value="-Atypemap=org.lwjgl.util.generator.opengl.GLTypeMap"/>
 			<fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/>
 		</apply>
 	</target>
@@ -93,17 +116,17 @@
 			<arg path="${lwjgl.src.native}/generated"/>
 			<arg value="-Ageneratechecks"/>
 			<arg value="-Acontextspecific"/>
-			<arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/>
+			<arg value="-Atypemap=org.lwjgl.util.generator.opengl.GLTypeMap"/>
 			<fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/>
 		</apply>
 	</target>
 
-	<!-- Generate references -->
+	<!-- Generate OpenGL references -->
 	<target name="generate-opengl-references" depends="generators" description="Generates java and native source for GL">
 		<apply executable="apt" parallel="true">
 			<arg value="-nocompile"/>
 			<arg value="-factory"/>
-			<arg value="org.lwjgl.util.generator.ReferencesGeneratorProcessorFactory"/>
+			<arg value="org.lwjgl.util.generator.opengl.GLReferencesGeneratorProcessorFactory"/>
 			<arg value="-cp"/>
 			<arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
 			<arg value="-s"/>
@@ -111,13 +134,13 @@
 			<fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/>
 		</apply>
 	</target>
-	
-	<!-- Generate context capabilities -->
+
+	<!-- Generate OpenGL context capabilities -->
 	<target name="generate-opengl-capabilities" depends="generators" description="Generates java and native source for GL">
 		<apply executable="apt" parallel="true">
 			<arg value="-nocompile"/>
 			<arg value="-factory"/>
-			<arg value="org.lwjgl.util.generator.ContextGeneratorProcessorFactory"/>
+			<arg value="org.lwjgl.util.generator.opengl.GLGeneratorProcessorFactory"/>
 			<arg value="-cp"/>
 			<arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
 			<arg value="-s"/>
@@ -125,14 +148,14 @@
 			<arg value="-Acontextspecific"/>
 			<fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/>
 		</apply>
-	</target>	
-	
-	<!-- Generate context capabilities [DEBUG] -->
+	</target>
+
+	<!-- Generate OpenGL context capabilities [DEBUG] -->
 	<target name="generate-opengl-capabilities-debug" depends="generators" description="Generates java and native source for GL">
 		<apply executable="apt" parallel="true">
 			<arg value="-nocompile"/>
 			<arg value="-factory"/>
-			<arg value="org.lwjgl.util.generator.ContextGeneratorProcessorFactory"/>
+			<arg value="org.lwjgl.util.generator.opengl.GLGeneratorProcessorFactory"/>
 			<arg value="-cp"/>
 			<arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
 			<arg value="-s"/>
@@ -141,5 +164,73 @@
 			<arg value="-Acontextspecific"/>
 			<fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/>
 		</apply>
-	</target>	
+	</target>
+
+    <!-- Generate OpenCL -->
+    <target name="generate-opencl" depends="generators" description="Generates java and native source for CL">
+        <apply executable="apt" parallel="true">
+            <arg value="-nocompile"/>
+            <arg value="-factory"/>
+            <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/>
+            <arg value="-cp"/>
+            <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
+            <arg value="-s"/>
+            <arg path="${lwjgl.src}/generated"/>
+            <arg value="-d"/>
+            <arg path="${lwjgl.src.native}/generated"/>
+            <arg value="-Acontextspecific"/>
+            <arg value="-Atypemap=org.lwjgl.util.generator.opencl.CLTypeMap"/>
+            <fileset dir="${lwjgl.src.templates}" includes="${opencl-template-pattern}"/>
+        </apply>
+    </target>
+
+    <!-- Generate OpenCL [DEBUG] -->
+    <target name="generate-opencl-debug" depends="generators" description="Generates java and native source for CL">
+        <apply executable="apt" parallel="true">
+            <arg value="-nocompile"/>
+            <arg value="-factory"/>
+            <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/>
+            <arg value="-cp"/>
+            <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
+            <arg value="-s"/>
+            <arg path="${lwjgl.src}/generated"/>
+            <arg value="-d"/>
+            <arg path="${lwjgl.src.native}/generated"/>
+            <arg value="-Ageneratechecks"/>
+            <arg value="-Acontextspecific"/>
+            <arg value="-Atypemap=org.lwjgl.util.generator.opencl.CLTypeMap"/>
+            <fileset dir="${lwjgl.src.templates}" includes="${opencl-template-pattern}"/>
+        </apply>
+    </target>
+
+    <!-- Generate OpenCL capabilities -->
+    <target name="generate-opencl-capabilities" depends="generators" description="Generates capabilities for CL">
+        <apply executable="apt" parallel="true">
+            <arg value="-nocompile"/>
+            <arg value="-factory"/>
+            <arg value="org.lwjgl.util.generator.opencl.CLGeneratorProcessorFactory"/>
+            <arg value="-cp"/>
+            <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
+            <arg value="-s"/>
+            <arg path="${lwjgl.src}/generated"/>
+            <arg value="-Acontextspecific"/>
+            <fileset dir="${lwjgl.src.templates}" includes="${opencl-template-pattern}"/>
+        </apply>
+    </target>
+
+    <!-- Generate OpenCL capabilities [DEBUG] -->
+    <target name="generate-opencl-capabilities-debug" depends="generators" description="Generates capabilities for CL">
+        <apply executable="apt" parallel="true">
+            <arg value="-nocompile"/>
+            <arg value="-factory"/>
+            <arg value="org.lwjgl.util.generator.opencl.CLGeneratorProcessorFactory"/>
+            <arg value="-cp"/>
+            <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
+            <arg value="-s"/>
+            <arg path="${lwjgl.src}/generated"/>
+            <arg value="-Ageneratechecks"/>
+            <arg value="-Acontextspecific"/>
+            <fileset dir="${lwjgl.src.templates}" includes="${opencl-template-pattern}"/>
+        </apply>
+    </target>
 </project>
diff --git a/platform_build/build-maven.xml b/platform_build/build-maven.xml
new file mode 100644
index 0000000..cc50683
--- /dev/null
+++ b/platform_build/build-maven.xml
@@ -0,0 +1,155 @@
+<project name="maven">
+	<property name="lwjgl.src.java" 		location="${lwjgl.src}/java" />
+	<property name="lwjgl.src.generated" 	location="${lwjgl.src}/generated" />
+	<property name="lwjgl.maven"			location="maven" />
+	<property name="lwjgl.dstMaven"			location="${lwjgl.temp}/maven" />
+	
+	<property name="lwjgl.src.java" 		location="${lwjgl.src}/java" />
+
+	<property name="lwjgl-maven-version" value="2.7.0"/>
+
+	<fileset id="lwjgl-sources.manual.fileset" dir="${lwjgl.src.java}">
+		<patternset refid="lwjgl.package.pattern" />
+	</fileset>
+
+	<fileset id="lwjgl-sources.generated.fileset" dir="${lwjgl.src.generated}">
+		<include name="**/*" />
+	</fileset>
+	<fileset id="lwjgl_util_applet-sources.fileset" dir="${lwjgl.src.java}">
+		<patternset refid="lwjgl_util_applet.package.pattern" />
+	</fileset>
+
+	<fileset id="lwjgl_util-sources.fileset" dir="${lwjgl.src.java}">
+		<patternset refid="lwjgl_util.package.pattern" />
+	</fileset>
+
+
+	<target name="maven-full">
+		<antcall target="clean-java" />
+		<antcall target="-initialize" />
+		
+		<antcall target="generate-all" />
+		<antcall target="compile" />
+        <antcall target="-createjars" />
+        <antcall target="maven"/>
+	</target>
+	
+	<target name="maven">
+		<delete dir="${lwjgl.dstMaven}" quiet="true" failonerror="false" taskname="cleaning maven dist" />
+		<mkdir dir="${lwjgl.dstMaven}"   taskname="initialiazing temp maven folder" />
+		<antcall target="-copylwjgljars" />
+		<antcall target="-createmavensourcejars" />
+		<antcall target="-createmavenjavadocs" />
+		<antcall target="-createmavennativejars" />
+		<antcall target="-copymavenpoms"/>
+		<antcall target="-copymavendeploybuild"/>
+		<antcall target="-copymaventdist"/>
+	</target>
+
+
+	<target name="-copylwjgljars">
+		<copy todir="${lwjgl.dstMaven}">
+			<fileset dir="${lwjgl.temp}/jar/">
+				<patternset>
+					<include name="lwjgl.jar" />
+					<include name="lwjgl_util.jar" />
+					<include name="lwjgl_util_applet.jar" />
+				</patternset>
+			</fileset>
+		</copy>
+	</target>
+
+	<!-- Packages the java files -->
+	<target name="-createmavensourcejars">
+
+		<jar destfile="${lwjgl.dstMaven}/lwjgl-sources.jar" taskname="lwjgl-sources.jar">
+			<fileset refid="lwjgl-sources.manual.fileset" />
+			<fileset refid="lwjgl-sources.generated.fileset" />
+		</jar>
+		
+		<jar destfile="${lwjgl.dstMaven}/lwjgl_util_applet-sources.jar"	taskname="lwjgl_util_applet-sources.jar">
+			<fileset refid="lwjgl_util_applet-sources.fileset" />
+		</jar>
+		
+		<jar destfile="${lwjgl.dstMaven}/lwjgl_util-sources.jar" taskname="lwjgl_util-sources.jar">
+			<fileset refid="lwjgl_util-sources.fileset" />
+		</jar>
+	</target>
+	
+	<target name="-createmavenjavadocs">
+	<!-- Creates the Javadoc -->
+	
+		<javadoc destdir="${lwjgl.dstMaven}/lwjgl-javadoc" classpath="${lwjgl.lib}/jinput.jar" author="true" version="true" use="true" source="1.5" windowtitle="LWJGL API" useexternalfile="true">
+			<fileset refid="lwjgl-sources.manual.fileset"/>
+			<fileset refid="lwjgl-sources.generated.fileset"/>
+			<doctitle><![CDATA[<h1>Lightweight Java Game Toolkit</h1>]]></doctitle>
+			<bottom><![CDATA[<i>Copyright &#169; 2002-2010 lwjgl.org. All Rights Reserved.</i>]]></bottom>
+		</javadoc>
+		<jar destfile="${lwjgl.dstMaven}/lwjgl-javadoc.jar" taskname="lwjgl-javadoc.jar">
+			<fileset dir="${lwjgl.dstMaven}/lwjgl-javadoc" />
+		</jar>
+		
+		<javadoc destdir="${lwjgl.dstMaven}/lwjgl_util-javadoc" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/lwjgl.jar" author="true" version="true" use="true" source="1.5" windowtitle="LWJGL UTIL API" useexternalfile="true">
+			<fileset refid="lwjgl_util-sources.fileset"/>
+			<doctitle><![CDATA[<h1>Lightweight Java Game Toolkit</h1>]]></doctitle>
+			<bottom><![CDATA[<i>Copyright &#169; 2002-2010 lwjgl.org. All Rights Reserved.</i>]]></bottom>
+		</javadoc>
+		<jar destfile="${lwjgl.dstMaven}/lwjgl_util-javadoc.jar" taskname="lwjgl_util-javadoc.jar">
+			<fileset dir="${lwjgl.dstMaven}/lwjgl_util-javadoc" />
+		</jar>
+		
+		<javadoc destdir="${lwjgl.dstMaven}/lwjgl_util_applet-javadoc" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/lwjgl.jar" author="true" version="true" use="true" source="1.5" windowtitle="LWJGL UTIL API" useexternalfile="true">
+			<fileset refid="lwjgl_util_applet-sources.fileset"/>
+			<doctitle><![CDATA[<h1>Lightweight Java Game Toolkit</h1>]]></doctitle>
+			<bottom><![CDATA[<i>Copyright &#169; 2002-2010 lwjgl.org. All Rights Reserved.</i>]]></bottom>
+		</javadoc>
+		<jar destfile="${lwjgl.dstMaven}/lwjgl_util_applet-javadoc.jar" taskname="lwjgl_util_applet-javadoc.jar">
+			<fileset dir="${lwjgl.dstMaven}/lwjgl_util_applet-javadoc" />
+		</jar>
+		
+		<delete dir="${lwjgl.dstMaven}/lwjgl-javadoc" quiet="true" failonerror="false" taskname="cleaning maven javadoc temps lwjgl" />
+		<delete dir="${lwjgl.dstMaven}/lwjgl_util-javadoc" quiet="true" failonerror="false" taskname="cleaning maven javadoc temps lwjgl_util" />
+		<delete dir="${lwjgl.dstMaven}/lwjgl_util_applet-javadoc" quiet="true" failonerror="false" taskname="cleaning maven javadoc temps lwjgl_util_applet" />
+	</target>
+	
+	<target name="-createmavennativejars">
+		<jar destfile="${lwjgl.dstMaven}/lwjgl-platform-natives-win.jar" taskname="lwjgl-platform-natives-win.jar">
+			<fileset dir="${lwjgl.lib}/windows">
+				<patternset refid="lwjgl-windows-lwjgl.fileset"/>
+			</fileset>
+		</jar>
+		<jar destfile="${lwjgl.dstMaven}/lwjgl-platform-natives-linux.jar" taskname="lwjgl-platform-natives-linux.jar">
+			<fileset dir="${lwjgl.lib}/linux">
+				<patternset refid="lwjgl-linux-lwjgl.fileset"/>
+			</fileset>
+		</jar>
+		<jar destfile="${lwjgl.dstMaven}/lwjgl-platform-natives-mac.jar" taskname="lwjgl-platform-natives-mac.jar">
+			<fileset dir="${lwjgl.lib}/macosx">
+				<patternset refid="lwjgl-macosx-lwjgl.fileset"/>
+			</fileset>
+		</jar>
+	</target>
+
+	<target name="-copymavenpoms">
+		<copy todir="${lwjgl.dstMaven}">
+			<fileset dir="${lwjgl.maven}">
+				<include name="*.pom" />
+			</fileset>
+			<filterset>
+      			<filter token="VERSION" value="${lwjgl-maven-version}"/>
+    		</filterset>	
+		</copy>
+	</target>
+	
+	<target name="-copymavendeploybuild">
+		<copy todir="${lwjgl.dstMaven}">
+			<fileset dir="${lwjgl.maven}">
+				<include name="build.xml" />
+			</fileset>
+		</copy>
+	</target>
+
+	<target name="-copymaventdist">
+		<zip destfile="${lwjgl.dist}/lwjgl-maven-${lwjgl.version}.zip" basedir="${lwjgl.temp}" includes="maven/**" />
+	</target>
+</project>
\ No newline at end of file
diff --git a/platform_build/build-webstart.xml b/platform_build/build-webstart.xml
index 96aec03..23fec03 100644
--- a/platform_build/build-webstart.xml
+++ b/platform_build/build-webstart.xml
@@ -11,98 +11,171 @@
 		<input 	message="Please type the password for the keystore" addproperty="sign.pwd"/>
 
 		<antcall target="-webstart_demo">
-		    <param name="keystore" value="signing/matzon_java_code_signing.keystore"/>
-			<param name="alias" value="oddlabs_java_code_signing"/>
+		    <param name="keystore" value="signing/lwjgl.jks"/>
+			<param name="alias" value="lwjgl"/>
 			<param name="password" value="${sign.pwd}"/>
 		  </antcall>
 	</target>	
 	
-	<!-- -->
+	<!-- Create webstart demo and extension from release files -->
 	<target name="-webstart_demo" description="Using released files, creates the necessary files used for jnlp demos">
 	
 		<!-- delete existing temp -->
 		<delete dir="${lwjgl.temp}"/>		
 		
-		<!-- unzip common files -->
-		<unzip src="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.temp}/jnlp/temp" overwrite="true"/>
-		<copy file="${lwjgl.lib}/lwjgl_test.jar" tofile="${lwjgl.temp}/jnlp/temp/lwjgl-${lwjgl.version}/lwjgl_test.jar"/>
-		<copy file="${lwjgl.lib}/lwjgl_util.jar" tofile="${lwjgl.temp}/jnlp/temp/lwjgl-${lwjgl.version}/lwjgl_util.jar"/>
+		<!-- unzip release to temp dir -->
+		<unzip src="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.temp}/webstart/temp" overwrite="true"/>
 		
-		<!-- move files to unified structure -->
-		<move todir="${lwjgl.temp}/jnlp/temp">
-			<fileset dir="${lwjgl.temp}/jnlp/temp/lwjgl-${lwjgl.version}/">
-				<include name="**"/>
-			</fileset>
-		</move>
+		<!-- DEMO SECTION -->
+		<move file="${lwjgl.temp}/webstart/temp/lwjgl-${lwjgl.version}/jar/lwjgl_test.jar" tofile="${lwjgl.temp}/webstart/lwjgl_test.jar"/>
+		<jar destfile="${lwjgl.temp}/webstart/lwjgl_test.jar" update="true">
+			<manifest>
+				<attribute name="Sealed" value="true"/>
+			</manifest>
+		</jar>				
+		<jar destfile="${lwjgl.temp}/webstart/media.jar" basedir="${lwjgl.res}">
+			<manifest>
+				<attribute name="Sealed" value="true"/>
+			</manifest>		
+		</jar>
 		
-		<!-- move relevant files to root -->
-		<move todir="${lwjgl.temp}/jnlp/" flatten="true">
-			<fileset dir="${lwjgl.temp}/jnlp/temp">
+		<!-- EXTENSION SECTION -->
+		<move todir="${lwjgl.temp}/webstart/${lwjgl.version}/" flatten="true">
+			<fileset dir="${lwjgl.temp}/webstart/temp">
 				<include name="**/jinput.jar"/>
 				<include name="**/lwjgl*.jar"/>
+				<exclude name="**/lwjgl_util_applet.jar"/>
+				<exclude name="**/lwjgl-debug.jar"/>
 			</fileset>
 		</move>
 		
-		<!-- update Trusted-Library -->
-		<jar destfile="${lwjgl.temp}/jnlp/lwjgl.jar" update="true">
+		<jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/lwjgl.jar" update="true">
 			<manifest>
+				<attribute name="Specification-Title" 			value="LWJGL ${lwjgl.version}"/>
+				<attribute name="Specification-Version" 		value="${lwjgl.version}"/>
+				<attribute name="Specification-Vendor" 			value="lwjgl.org"/>
+				<attribute name="Implementation-Title" 			value="LWJGL ${lwjgl.version}"/>
+				<attribute name="Implementation-Version" 		value="${lwjgl.version}"/>
+				<attribute name="Implementation-Vendor" 		value="lwjgl.org"/>
+				<attribute name="Implementation-Vendor-Id" 	value="org.lwjgl"/>
+				<attribute name="Extension-Name" 						value="org.lwjgl"/>
 				<attribute name="Sealed" value="true"/>
 				<attribute name="Trusted-Library" value="true"/>
 			</manifest>
 		</jar>
 		
-		<jar destfile="${lwjgl.temp}/jnlp/jinput.jar" update="true">
+		<jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/jinput.jar" update="true">
 			<manifest>
+				<attribute name="Specification-Title" 			value="LWJGL ${lwjgl.version}"/>
+				<attribute name="Specification-Version" 		value="${lwjgl.version}"/>
+				<attribute name="Specification-Vendor" 			value="lwjgl.org"/>
+				<attribute name="Implementation-Title" 			value="LWJGL ${lwjgl.version}"/>
+				<attribute name="Implementation-Version" 		value="${lwjgl.version}"/>
+				<attribute name="Implementation-Vendor" 		value="lwjgl.org"/>
+				<attribute name="Implementation-Vendor-Id" 	value="org.lwjgl"/>
+				<attribute name="Extension-Name" 						value="org.lwjgl"/>
 				<attribute name="Sealed" value="true"/>
+				<attribute name="Trusted-Library" value="true"/>
 			</manifest>
 		</jar>
 		
-		<jar destfile="${lwjgl.temp}/jnlp/lwjgl_util.jar" update="true">
+		<jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/lwjgl_util.jar" update="true">
 			<manifest>
+				<attribute name="Specification-Title" 			value="LWJGL ${lwjgl.version}"/>
+				<attribute name="Specification-Version" 		value="${lwjgl.version}"/>
+				<attribute name="Specification-Vendor" 			value="lwjgl.org"/>
+				<attribute name="Implementation-Title" 			value="LWJGL ${lwjgl.version}"/>
+				<attribute name="Implementation-Version" 		value="${lwjgl.version}"/>
+				<attribute name="Implementation-Vendor" 		value="lwjgl.org"/>
+				<attribute name="Implementation-Vendor-Id" 	value="org.lwjgl"/>
+				<attribute name="Extension-Name" 						value="org.lwjgl"/>
 				<attribute name="Sealed" value="true"/>
+				<attribute name="Trusted-Library" value="true"/>
 			</manifest>
-		</jar>		
-		
-		<!-- create native jars -->
-		<jar destfile="${lwjgl.temp}/jnlp/native_windows.jar" basedir="${lwjgl.temp}/jnlp/temp/native/windows">
-			<manifest>
-				<attribute name="Sealed" value="true"/>
-			</manifest>		
 		</jar>
 		
-		<jar destfile="${lwjgl.temp}/jnlp/native_linux.jar" basedir="${lwjgl.temp}/jnlp/temp/native/linux">
+		<!-- create native jars -->
+		<jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/native_windows.jar" basedir="${lwjgl.temp}/webstart/temp/lwjgl-${lwjgl.version}/native/windows">
 			<manifest>
+				<attribute name="Specification-Title" 			value="LWJGL ${lwjgl.version}"/>
+				<attribute name="Specification-Version" 		value="${lwjgl.version}"/>
+				<attribute name="Specification-Vendor" 			value="lwjgl.org"/>
+				<attribute name="Implementation-Title" 			value="LWJGL ${lwjgl.version}"/>
+				<attribute name="Implementation-Version" 		value="${lwjgl.version}"/>
+				<attribute name="Implementation-Vendor" 		value="lwjgl.org"/>
+				<attribute name="Implementation-Vendor-Id" 	value="org.lwjgl"/>
+				<attribute name="Extension-Name" 						value="org.lwjgl"/>
 				<attribute name="Sealed" value="true"/>
+				<attribute name="Trusted-Library" value="true"/>
 			</manifest>		
 		</jar>
 		
-		<jar destfile="${lwjgl.temp}/jnlp/native_macosx.jar" basedir="${lwjgl.temp}/jnlp/temp/native/macosx">
+		<jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/native_linux.jar" basedir="${lwjgl.temp}/webstart/temp/lwjgl-${lwjgl.version}/native/linux">
 			<manifest>
+				<attribute name="Specification-Title" 			value="LWJGL ${lwjgl.version}"/>
+				<attribute name="Specification-Version" 		value="${lwjgl.version}"/>
+				<attribute name="Specification-Vendor" 			value="lwjgl.org"/>
+				<attribute name="Implementation-Title" 			value="LWJGL ${lwjgl.version}"/>
+				<attribute name="Implementation-Version" 		value="${lwjgl.version}"/>
+				<attribute name="Implementation-Vendor" 		value="lwjgl.org"/>
+				<attribute name="Implementation-Vendor-Id" 	value="org.lwjgl"/>
+				<attribute name="Extension-Name" 						value="org.lwjgl"/>
 				<attribute name="Sealed" value="true"/>
+				<attribute name="Trusted-Library" value="true"/>
 			</manifest>		
 		</jar>
 		
-		<jar destfile="${lwjgl.temp}/jnlp/native_solaris.jar" basedir="${lwjgl.temp}/jnlp/temp/native/solaris">
+		<jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/native_macosx.jar" basedir="${lwjgl.temp}/webstart/temp/lwjgl-${lwjgl.version}/native/macosx">
 			<manifest>
+				<attribute name="Specification-Title" 			value="LWJGL ${lwjgl.version}"/>
+				<attribute name="Specification-Version" 		value="${lwjgl.version}"/>
+				<attribute name="Specification-Vendor" 			value="lwjgl.org"/>
+				<attribute name="Implementation-Title" 			value="LWJGL ${lwjgl.version}"/>
+				<attribute name="Implementation-Version" 		value="${lwjgl.version}"/>
+				<attribute name="Implementation-Vendor" 		value="lwjgl.org"/>
+				<attribute name="Implementation-Vendor-Id" 	value="org.lwjgl"/>
+				<attribute name="Extension-Name" 						value="org.lwjgl"/>
 				<attribute name="Sealed" value="true"/>
+				<attribute name="Trusted-Library" value="true"/>
 			</manifest>		
 		</jar>
 		
-		<!-- create media jar -->
-		<jar destfile="${lwjgl.temp}/jnlp/media.jar" basedir="${lwjgl.res}">
+		<jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/native_solaris.jar" basedir="${lwjgl.temp}/webstart/temp/lwjgl-${lwjgl.version}/native/solaris">
 			<manifest>
+				<attribute name="Specification-Title" 			value="LWJGL ${lwjgl.version}"/>
+				<attribute name="Specification-Version" 		value="${lwjgl.version}"/>
+				<attribute name="Specification-Vendor" 			value="lwjgl.org"/>
+				<attribute name="Implementation-Title" 			value="LWJGL ${lwjgl.version}"/>
+				<attribute name="Implementation-Version" 		value="${lwjgl.version}"/>
+				<attribute name="Implementation-Vendor" 		value="lwjgl.org"/>
+				<attribute name="Implementation-Vendor-Id" 	value="org.lwjgl"/>
+				<attribute name="Extension-Name" 						value="org.lwjgl"/>
 				<attribute name="Sealed" value="true"/>
+				<attribute name="Trusted-Library" value="true"/>
 			</manifest>		
 		</jar>
 	
 		<!-- sign 'em -->
-		<signjar jar="${lwjgl.temp}/jnlp/lwjgl.jar" 		alias="${alias}" keystore="${keystore}" storepass="${password}"/>
-		<signjar jar="${lwjgl.temp}/jnlp/lwjgl_util.jar" 	alias="${alias}" keystore="${keystore}" storepass="${password}"/>
-		<signjar jar="${lwjgl.temp}/jnlp/native_solaris.jar" 	alias="${alias}" keystore="${keystore}" storepass="${password}"/>
-		<signjar jar="${lwjgl.temp}/jnlp/native_linux.jar" 	alias="${alias}" keystore="${keystore}" storepass="${password}"/>
-		<signjar jar="${lwjgl.temp}/jnlp/native_macosx.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
-		<signjar jar="${lwjgl.temp}/jnlp/native_windows.jar" 	alias="${alias}" keystore="${keystore}" storepass="${password}"/>
-		<signjar jar="${lwjgl.temp}/jnlp/jinput.jar" 		alias="${alias}" keystore="${keystore}" storepass="${password}"/>
-		<signjar jar="${lwjgl.temp}/jnlp/media.jar" 		alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+		<signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/lwjgl.jar" 						alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+		<signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/lwjgl_util.jar" 			alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+		<signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/jinput.jar" 					alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+		<signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/native_solaris.jar" 	alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+		<signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/native_linux.jar" 		alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+		<signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/native_macosx.jar" 		alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+		<signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/native_windows.jar" 	alias="${alias}" keystore="${keystore}" storepass="${password}"/>
+		
+		<!-- copy over extension jnlp file -->
+		<copy todir="${lwjgl.temp}/webstart/${lwjgl.version}">
+    	<fileset dir="${lwjgl.web}/webstart">
+    		<include name="extension.jnlp"/>
+    	</fileset>
+    	<filterset>
+      	<filter token="LWJGL_VERSION" value="${lwjgl.version}"/>
+    	</filterset>
+  	</copy>
+		
+		<!-- nuke extracted dir -->
+		<delete dir="${lwjgl.temp}/webstart/temp"/>
+
 	</target>
 </project>
\ No newline at end of file
diff --git a/platform_build/linux_ant/build.xml b/platform_build/linux_ant/build.xml
index 7e45c52..0058f05 100644
--- a/platform_build/linux_ant/build.xml
+++ b/platform_build/linux_ant/build.xml
@@ -16,7 +16,7 @@
 			<fileset dir="." includes="*.so"/>
 		</delete>
 	</target>
-	
+
     <target name="compile">
 		<exec executable="uname" outputproperty="hwplatform">
 			<arg value="-m"/>
@@ -27,10 +27,10 @@
 		<condition property="cflags_pthread" value="-pthreads" else="-pthread">
 			<os name="SunOS" />
 		</condition>
-		<condition property="version_script_flags32" value="" else="-Wl,--version-script=${native}/linux/lwjgl.map">
+		<condition property="version_script_flags32" value="" else="-Wl,--version-script='${native}/linux/lwjgl.map'">
 			<os name="SunOS" />
 		</condition>
-		<condition property="version_script_flags64" value="-m64" else="-Wl,--version-script=${native}/linux/lwjgl.map">
+		<condition property="version_script_flags64" value="-m64" else="-Wl,--version-script='${native}/linux/lwjgl.map'">
 			<and>
 				<os name="SunOS" />
 			</and>
@@ -50,7 +50,7 @@
 				</or>
     		</not>
     	</condition>
-    	
+
     	<!-- On linux, the 64 bit jre doesn't have the 32 bit libs -->
     	<condition property="build.64bit.only">
     		<and>
@@ -58,11 +58,11 @@
     			<equals arg1="${hwplatform}" arg2="x86_64"/>
     		</and>
     	</condition>
-    	
+
     	<antcall target="compile32"/>
     	<antcall target="compile64"/>
     </target>
-	
+
     <target name="compile32" unless="build.64bit.only">
     	<mkdir dir="x32"/>
     	<apply dir="x32" executable="gcc" skipemptyfilesets="true" failonerror="true">
@@ -89,7 +89,7 @@
 		</apply>
     </target>
 
-    <target name="compile64" unless="build.32bit.only">    	
+    <target name="compile64" unless="build.32bit.only">
     	<mkdir dir="x64"/>
     	<apply dir="x64" executable="gcc" skipemptyfilesets="true" failonerror="true">
 			<arg line="${cflags64} ${cflags_pthread}"/>
diff --git a/src/java/org/lwjgl/BufferChecks.java b/src/java/org/lwjgl/BufferChecks.java
index b35a4a4..94301fc 100644
--- a/src/java/org/lwjgl/BufferChecks.java
+++ b/src/java/org/lwjgl/BufferChecks.java
@@ -31,13 +31,7 @@
  */
 package org.lwjgl;
 
-import java.nio.Buffer;
-import java.nio.ByteBuffer;
-import java.nio.DoubleBuffer;
-import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
-import java.nio.ShortBuffer;
-import java.nio.LongBuffer;
+import java.nio.*;
 
 /**
  * <p>A class to check buffer boundaries in general. If there is unsufficient space
@@ -48,8 +42,8 @@ import java.nio.LongBuffer;
  * </p>
  * @author cix_foo <cix_foo at users.sourceforge.net>
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3334 $
- * $Id: BufferChecks.java 3334 2010-04-22 23:21:48Z spasi $
+ * @version $Revision: 3419 $
+ * $Id: BufferChecks.java 3419 2010-09-30 17:21:50Z spasi $
  */
 public class BufferChecks {
 	/** Static methods only! */
@@ -87,9 +81,23 @@ public class BufferChecks {
 		}
 	}
 
-	/** Helper methods to ensure an IntBuffer is null-terminated */
+	/** Helper method to ensure an IntBuffer is null-terminated */
 	public static void checkNullTerminated(IntBuffer buf) {
-		if ( buf.get(buf.limit() - 1) != 0 ) {
+		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");
 		}
 	}
@@ -138,6 +146,15 @@ public class BufferChecks {
 		}
 	}
 
+	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.
 	 */
@@ -145,6 +162,18 @@ public class BufferChecks {
 		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.
@@ -161,6 +190,41 @@ public class BufferChecks {
 		}
 	}
 
+	/**
+	 * 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);
@@ -202,4 +266,21 @@ public class BufferChecks {
 			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);
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/BufferUtils.java b/src/java/org/lwjgl/BufferUtils.java
index 1c81fd3..5a14797 100644
--- a/src/java/org/lwjgl/BufferUtils.java
+++ b/src/java/org/lwjgl/BufferUtils.java
@@ -45,8 +45,8 @@ import java.nio.ShortBuffer;
  * Some often-used Buffer code for creating native buffers of the appropriate size.
  *
  * @author $Author: matzon $
- * @version $Revision: 2983 $
- * $Id: BufferUtils.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3456 $
+ * $Id: BufferUtils.java 3456 2010-11-24 21:48:23Z matzon $
  */
 
 public final class BufferUtils {
@@ -121,6 +121,16 @@ public final class BufferUtils {
 	}
 
 	/**
+	 * 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) {
@@ -145,4 +155,41 @@ public final class BufferUtils {
 		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);
 }
diff --git a/src/java/org/lwjgl/DefaultSysImplementation.java b/src/java/org/lwjgl/DefaultSysImplementation.java
index c52e777..e9a67ae 100644
--- a/src/java/org/lwjgl/DefaultSysImplementation.java
+++ b/src/java/org/lwjgl/DefaultSysImplementation.java
@@ -35,11 +35,12 @@ package org.lwjgl;
 /**
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3055 $
- * $Id: DefaultSysImplementation.java 3055 2008-04-30 14:58:47Z 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() {
diff --git a/src/java/org/lwjgl/LWJGLUtil.java b/src/java/org/lwjgl/LWJGLUtil.java
index ad4e82f..a645571 100644
--- a/src/java/org/lwjgl/LWJGLUtil.java
+++ b/src/java/org/lwjgl/LWJGLUtil.java
@@ -32,16 +32,15 @@
 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.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
+import java.util.*;
 
 /**
  * <p>
@@ -49,8 +48,8 @@ import java.util.StringTokenizer;
  * </p>
  *
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 3334 $
- * $Id: LWJGLUtil.java 3334 2010-04-22 23:21:48Z spasi $
+ * @version $Revision: 3475 $
+ * $Id: LWJGLUtil.java 3475 2011-01-23 07:48:50Z matzon $
  */
 public class LWJGLUtil {
 	public static final int PLATFORM_LINUX 				= 1;
@@ -59,9 +58,9 @@ public class LWJGLUtil {
 	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[] { 
+	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,
@@ -106,7 +105,7 @@ public class LWJGLUtil {
 	});
 
 	/** LWJGL Logo - 32 by 32 pixels */
-	public static final ByteBuffer	LWJGLIcon32x32		= BufferUtils.createByteBuffer(32 * 32 * 4).put(new byte[] { 
+	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,
@@ -269,11 +268,23 @@ public class LWJGLUtil {
 
 	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
@@ -281,19 +292,9 @@ public class LWJGLUtil {
 	 * @return the current platform type
 	 */
 	public static int getPlatform() {
-		String osName = getPrivilegedProperty("os.name");
-
-		if (osName.startsWith("Windows")) {
-			return PLATFORM_WINDOWS;
-		} else if (osName.startsWith("Linux") || osName.startsWith("FreeBSD") || osName.startsWith("SunOS")) {
-			return PLATFORM_LINUX;
-		} else if (osName.startsWith("Mac OS X")) {
-			return PLATFORM_MACOSX;
-		} else {
-			throw new LinkageError("Unknown platform: " + osName);
-		}
+		return PLATFORM;
 	}
-	
+
 
 	/**
 	 * @see #PLATFORM_WINDOWS_NAME
@@ -312,7 +313,7 @@ public class LWJGLUtil {
 			default:
 				return "unknown";
 		}
-	}	
+	}
 
 	/**
 	 * Locates the paths required by a library.
@@ -336,7 +337,7 @@ public class LWJGLUtil {
 	 */
 	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();
+		List<String> possible_paths = new ArrayList<String>();
 
 		String classloader_path = getPathFromClassLoader(libname, classloader);
 		if (classloader_path != null) {
@@ -344,26 +345,25 @@ public class LWJGLUtil {
 			possible_paths.add(classloader_path);
 		}
 
-		for (int i = 0; i < platform_lib_names.length; i++) {
-			String platform_lib_name = platform_lib_names[i];
+		for ( String platform_lib_name : platform_lib_names ) {
 			String lwjgl_classloader_path = getPathFromClassLoader("lwjgl", classloader);
-			if (lwjgl_classloader_path != null) {
+			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);
+				                   + File.separator + platform_lib_name);
 			}
 
 			// add Installer path
 			String alternative_path = getPrivilegedProperty("org.lwjgl.librarypath");
-			if (alternative_path != null) {
+			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()) {
+			while ( st.hasMoreTokens() ) {
 				String path = st.nextToken();
 				possible_paths.add(path + File.separator + platform_lib_name);
 			}
@@ -377,15 +377,13 @@ public class LWJGLUtil {
 		}
 
 		//create needed string array
-		String[] paths = new String[possible_paths.size()];
-		possible_paths.toArray(paths);
-		return paths;
+		return possible_paths.toArray(new String[possible_paths.size()]);
 	}
 
 	static void execPrivileged(final String[] cmd_array) throws Exception {
 		try {
-			Process process = (Process)AccessController.doPrivileged(new PrivilegedExceptionAction() {
-				public Object run() throws Exception {
+			Process process = AccessController.doPrivileged(new PrivilegedExceptionAction<Process>() {
+				public Process run() throws Exception {
 					return Runtime.getRuntime().exec(cmd_array);
 				}
 			});
@@ -399,8 +397,8 @@ public class LWJGLUtil {
 	}
 
 	private static String getPrivilegedProperty(final String property_name) {
-		return (String)AccessController.doPrivileged(new PrivilegedAction() {
-			public Object run() {
+		return AccessController.doPrivileged(new PrivilegedAction<String>() {
+			public String run() {
 				return System.getProperty(property_name);
 			}
 		});
@@ -420,16 +418,15 @@ public class LWJGLUtil {
 	private static String getPathFromClassLoader(final String libname, final ClassLoader classloader) {
 		try {
 			log("getPathFromClassLoader: searching for: " + libname);
-			Class c = classloader.getClass();
+			Class<?> c = classloader.getClass();
 			while (c != null) {
-				final Class clazz = c;
+				final Class<?> clazz = c;
 				try {
-					return (String)AccessController.doPrivileged(new PrivilegedExceptionAction() {
-						public Object run() throws Exception {
-							Method findLibrary = clazz.getDeclaredMethod("findLibrary", new Class[]{String.class});
+					return AccessController.doPrivileged(new PrivilegedExceptionAction<String>() {
+						public String run() throws Exception {
+							Method findLibrary = clazz.getDeclaredMethod("findLibrary", String.class);
 							findLibrary.setAccessible(true);
-							Object[] arguments = new Object[] {libname};
-							String path = (String)findLibrary.invoke(classloader, arguments);
+							String path = (String)findLibrary.invoke(classloader, libname);
 							return path;
 						}
 					});
@@ -448,17 +445,17 @@ public class LWJGLUtil {
 	 * Gets a boolean property as a privileged action.
 	 */
 	private static boolean getPrivilegedBoolean(final String property_name) {
-		Boolean value = (Boolean)AccessController.doPrivileged(new PrivilegedAction() {
-			public Object run() {	
-				return new Boolean(Boolean.getBoolean(property_name));
+		Boolean value = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+			public Boolean run() {
+				return Boolean.getBoolean(property_name);
 			}
 		});
-		return value.booleanValue();
-	}	
-	
+		return value;
+	}
+
 	/**
 	 * Prints the given message to System.err if DEBUG is true.
-	 * 
+	 *
 	 * @param msg Message to print
 	 */
 	public static void log(String msg) {
@@ -466,7 +463,7 @@ public class LWJGLUtil {
 			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
@@ -489,5 +486,93 @@ public class LWJGLUtil {
 		}
 		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.
+	 * <p>
+	 * 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<Integer, String> getClassTokens(final TokenFilter filter, final Map<Integer, String> 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.
+	 * <p>
+	 * 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<Integer, String> getClassTokens(final TokenFilter filter, Map<Integer, String> target, final Iterable<Class> tokenClasses) {
+		if ( target == null )
+			target = new HashMap<Integer, String>();
+
+		final int TOKEN_MODIFIERS = Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL;
+
+		for ( final Class tokenClass : tokenClasses ) {
+			for ( final Field field : tokenClass.getDeclaredFields() ) {
+				// Get only <public static final int> 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&nbsp;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);
+
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/LinuxSysImplementation.java b/src/java/org/lwjgl/LinuxSysImplementation.java
index 8d57248..a630b3e 100644
--- a/src/java/org/lwjgl/LinuxSysImplementation.java
+++ b/src/java/org/lwjgl/LinuxSysImplementation.java
@@ -35,11 +35,11 @@ package org.lwjgl;
 /**
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3298 $
- * $Id: LinuxSysImplementation.java 3298 2010-03-28 23:11:17Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: LinuxSysImplementation.java 3418 2010-09-28 21:11:35Z spasi $
  */
 final class LinuxSysImplementation extends J2SESysImplementation {
-	private final static int JNI_VERSION = 18;
+	private static final int JNI_VERSION = 19;
 
 	static {
 		java.awt.Toolkit.getDefaultToolkit(); // This will make sure libjawt.so is loaded
@@ -55,8 +55,7 @@ final class LinuxSysImplementation extends J2SESysImplementation {
 
 		String[] browsers = {"xdg-open", "firefox", "mozilla", "opera", "konqueror", "nautilus", "galeon", "netscape"};
 
-		for (int i = 0; i < browsers.length; i ++) {
-			final String browser = browsers[i];
+		for ( final String browser : browsers ) {
 			try {
 				LWJGLUtil.execPrivileged(new String[] { browser, url });
 				return true;
diff --git a/src/java/org/lwjgl/MacOSXSysImplementation.java b/src/java/org/lwjgl/MacOSXSysImplementation.java
index 8da1e92..3b6b32f 100644
--- a/src/java/org/lwjgl/MacOSXSysImplementation.java
+++ b/src/java/org/lwjgl/MacOSXSysImplementation.java
@@ -38,11 +38,11 @@ import com.apple.eio.FileManager;
 /**
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3298 $
- * $Id: MacOSXSysImplementation.java 3298 2010-03-28 23:11:17Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: MacOSXSysImplementation.java 3418 2010-09-28 21:11:35Z spasi $
  */
 final class MacOSXSysImplementation extends J2SESysImplementation {
-	private final static int JNI_VERSION = 18;
+	private static final int JNI_VERSION = 19;
 
 	static {
 		// Make sure AWT is properly initialized. This avoids hangs on Mac OS X 10.3
diff --git a/src/java/org/lwjgl/NondirectBufferWrapper.java b/src/java/org/lwjgl/NondirectBufferWrapper.java
index 5b73e2e..72825e3 100644
--- a/src/java/org/lwjgl/NondirectBufferWrapper.java
+++ b/src/java/org/lwjgl/NondirectBufferWrapper.java
@@ -49,16 +49,16 @@ import java.nio.ByteOrder;
  * $Id: BufferChecks.java 2762 2007-04-11 16:13:05Z elias_naur $
  */
 public final class NondirectBufferWrapper {
-	private final static int INITIAL_BUFFER_SIZE = 1;
+	private static final int INITIAL_BUFFER_SIZE = 1;
 
-	private final static ThreadLocal thread_buffer = new ThreadLocal() {
-		protected Object initialValue() {
+	private static final ThreadLocal<CachedBuffers> thread_buffer = new ThreadLocal<CachedBuffers>() {
+		protected CachedBuffers initialValue() {
 			return new CachedBuffers(INITIAL_BUFFER_SIZE);
 		}
 	};
 
 	private static CachedBuffers getCachedBuffers(int minimum_byte_size) {
-		CachedBuffers buffers = (CachedBuffers)thread_buffer.get();
+		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);
@@ -378,7 +378,7 @@ public final class NondirectBufferWrapper {
 		return direct_buffer;
 	}
 
-	private final static class CachedBuffers {
+	private static final class CachedBuffers {
 		private final ByteBuffer byte_buffer;
 		private final ShortBuffer short_buffer_big;
 		private final IntBuffer int_buffer_big;
diff --git a/src/java/org/lwjgl/PointerBuffer.java b/src/java/org/lwjgl/PointerBuffer.java
new file mode 100644
index 0000000..3e81f69
--- /dev/null
+++ b/src/java/org/lwjgl/PointerBuffer.java
@@ -0,0 +1,951 @@
+/*
+ * 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. </p>
+	 *
+	 * @return The capacity of this buffer
+	 */
+	public final int capacity() {
+		return view.capacity();
+	}
+
+	/**
+	 * Returns this buffer's position. </p>
+	 *
+	 * @return The position of this buffer
+	 */
+	public final int position() {
+		return view.position();
+	}
+
+	/**
+	 * Returns this buffer's position, in bytes. </p>
+	 *
+	 * @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. </p>
+	 *
+	 * @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 <tt>newPosition</tt> do not hold
+	 */
+	public final PointerBuffer position(int newPosition) {
+		view.position(newPosition);
+		return this;
+	}
+
+	/**
+	 * Returns this buffer's limit. </p>
+	 *
+	 * @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. </p>
+	 *
+	 * @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 <tt>newLimit</tt> do not hold
+	 */
+	public final PointerBuffer limit(int newLimit) {
+		view.limit(newLimit);
+		return this;
+	}
+
+	/**
+	 * Sets this buffer's mark at its position. </p>
+	 *
+	 * @return This buffer
+	 */
+	public final PointerBuffer mark() {
+		view.mark();
+		return this;
+	}
+
+	/**
+	 * Resets this buffer's position to the previously-marked position.
+	 * <p/>
+	 * <p> Invoking this method neither changes nor discards the mark's
+	 * value. </p>
+	 *
+	 * @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.
+	 * <p/>
+	 * <p> Invoke this method before using a sequence of channel-read or
+	 * <i>put</i> operations to fill this buffer.  For example:
+	 * <p/>
+	 * <blockquote><pre>
+	 * buf.clear();     // Prepare buffer for reading
+	 * in.read(buf);    // Read data</pre></blockquote>
+	 * <p/>
+	 * <p> 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. </p>
+	 *
+	 * @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.
+	 * <p/>
+	 * <p> After a sequence of channel-read or <i>put</i> operations, invoke
+	 * this method to prepare for a sequence of channel-write or relative
+	 * <i>get</i> operations.  For example:
+	 * <p/>
+	 * <blockquote><pre>
+	 * 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</pre></blockquote>
+	 * <p/>
+	 * <p> This method is often used in conjunction with the {@link
+	 * java.nio.ByteBuffer#compact compact} method when transferring data from
+	 * one place to another.  </p>
+	 *
+	 * @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.
+	 * <p/>
+	 * <p> Invoke this method before a sequence of channel-write or <i>get</i>
+	 * operations, assuming that the limit has already been set
+	 * appropriately.  For example:
+	 * <p/>
+	 * <blockquote><pre>
+	 * out.write(buf);    // Write remaining data
+	 * buf.rewind();      // Rewind buffer
+	 * buf.get(array);    // Copy data into array</pre></blockquote>
+	 *
+	 * @return This buffer
+	 */
+	public final PointerBuffer rewind() {
+		view.rewind();
+		return this;
+	}
+
+	/**
+	 * Returns the number of elements between the current position and the
+	 * limit. </p>
+	 *
+	 * @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. </p>
+	 *
+	 * @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. </p>
+	 *
+	 * @return <tt>true</tt> 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.
+	 * <p/>
+	 * <p> The new buffer's position will be zero, its limit will be its
+	 * capacity, and its mark will be undefined.  </p>
+	 *
+	 * @param capacity The new buffer's capacity, in pointers
+	 *
+	 * @return The new pointer buffer
+	 *
+	 * @throws IllegalArgumentException If the <tt>capacity</tt> 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.
+	 * <p/>
+	 * <p> 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.
+	 * <p/>
+	 * <p> 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.  </p>
+	 *
+	 * @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.
+	 * <p/>
+	 * <p> 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.
+	 * <p/>
+	 * <p> 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.  </p>
+	 *
+	 * @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.
+	 * <p/>
+	 * <p> 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.
+	 * <p/>
+	 * <p> The new buffer's capacity, limit and position will be
+	 * identical to those of this buffer.
+	 * <p/>
+	 * <p> If this buffer is itself read-only then this method behaves in
+	 * exactly the same way as the {@link #duplicate duplicate} method.  </p>
+	 *
+	 * @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 <i>get</i> method.  Reads the long at this buffer's
+	 * current position, and then increments the position. </p>
+	 *
+	 * @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 <i>put</i> method&nbsp;&nbsp;<i>(optional operation)</i>.
+	 * <p/>
+	 * <p> Writes the given long into this buffer at the current
+	 * position, and then increments the position. </p>
+	 *
+	 * @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 <i>get</i> method.  Reads the long at the given
+	 * index. </p>
+	 *
+	 * @param index The index from which the long will be read
+	 *
+	 * @return The long at the given index
+	 *
+	 * @throws IndexOutOfBoundsException If <tt>index</tt> 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 <i>put</i> method&nbsp;&nbsp;<i>(optional operation)</i>.
+	 * <p/>
+	 * <p> Writes the given long into this buffer at the given
+	 * index. </p>
+	 *
+	 * @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 <tt>index</tt> 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 <i>get</i> method.
+	 * <p/>
+	 * <p> 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
+	 * <tt>length</tt>&nbsp;<tt>&gt;</tt>&nbsp;<tt>remaining()</tt>, then no
+	 * longs are transferred and a {@link BufferUnderflowException} is
+	 * thrown.
+	 * <p/>
+	 * <p> Otherwise, this method copies <tt>length</tt> 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 <tt>length</tt>.
+	 * <p/>
+	 * <p> In other words, an invocation of this method of the form
+	 * <tt>src.get(dst,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as
+	 * the loop
+	 * <p/>
+	 * <pre>
+	 *     for (int i = off; i < off + len; i++)
+	 *         dst[i] = src.get(); </pre>
+	 * <p/>
+	 * except that it first checks that there are sufficient longs in
+	 * this buffer and it is potentially much more efficient. </p>
+	 *
+	 * @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
+	 *               <tt>dst.length</tt>
+	 * @param length The maximum number of longs to be written to the given
+	 *               array; must be non-negative and no larger than
+	 *               <tt>dst.length - offset</tt>
+	 *
+	 * @return This buffer
+	 *
+	 * @throws BufferUnderflowException  If there are fewer than <tt>length</tt> longs
+	 *                                   remaining in this buffer
+	 * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+	 *                                   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 <i>get</i> method.
+	 * <p/>
+	 * <p> This method transfers longs from this buffer into the given
+	 * destination array.  An invocation of this method of the form
+	 * <tt>src.get(a)</tt> behaves in exactly the same way as the invocation
+	 * <p/>
+	 * <pre>
+	 *     src.get(a, 0, a.length) </pre>
+	 *
+	 * @return This buffer
+	 *
+	 * @throws BufferUnderflowException If there are fewer than <tt>length</tt> longs
+	 *                                  remaining in this buffer
+	 */
+	public PointerBuffer get(long[] dst) {
+		return get(dst, 0, dst.length);
+	}
+
+	/**
+	 * Relative bulk <i>put</i> method&nbsp;&nbsp;<i>(optional operation)</i>.
+	 * <p/>
+	 * <p> 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
+	 * <tt>src.remaining()</tt>&nbsp;<tt>&gt;</tt>&nbsp;<tt>remaining()</tt>,
+	 * then no longs are transferred and a {@link
+	 * BufferOverflowException} is thrown.
+	 * <p/>
+	 * <p> Otherwise, this method copies
+	 * <i>n</i>&nbsp;=&nbsp;<tt>src.remaining()</tt> longs from the given
+	 * buffer into this buffer, starting at each buffer's current position.
+	 * The positions of both buffers are then incremented by <i>n</i>.
+	 * <p/>
+	 * <p> In other words, an invocation of this method of the form
+	 * <tt>dst.put(src)</tt> has exactly the same effect as the loop
+	 * <p/>
+	 * <pre>
+	 *     while (src.hasRemaining())
+	 *         dst.put(src.get()); </pre>
+	 * <p/>
+	 * except that it first checks that there is sufficient space in this
+	 * buffer and it is potentially much more efficient. </p>
+	 *
+	 * @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 <i>put</i> method&nbsp;&nbsp;<i>(optional operation)</i>.
+	 * <p/>
+	 * <p> 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
+	 * <tt>length</tt>&nbsp;<tt>&gt;</tt>&nbsp;<tt>remaining()</tt>, then no
+	 * longs are transferred and a {@link BufferOverflowException} is
+	 * thrown.
+	 * <p/>
+	 * <p> Otherwise, this method copies <tt>length</tt> 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 <tt>length</tt>.
+	 * <p/>
+	 * <p> In other words, an invocation of this method of the form
+	 * <tt>dst.put(src,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as
+	 * the loop
+	 * <p/>
+	 * <pre>
+	 *     for (int i = off; i < off + len; i++)
+	 *         dst.put(a[i]); </pre>
+	 * <p/>
+	 * except that it first checks that there is sufficient space in this
+	 * buffer and it is potentially much more efficient. </p>
+	 *
+	 * @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 <tt>array.length</tt>
+	 * @param length The number of longs to be read from the given array;
+	 *               must be non-negative and no larger than
+	 *               <tt>array.length - offset</tt>
+	 *
+	 * @return This buffer
+	 *
+	 * @throws BufferOverflowException   If there is insufficient space in this buffer
+	 * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+	 *                                   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 <i>put</i> method&nbsp;&nbsp;<i>(optional operation)</i>.
+	 * <p/>
+	 * <p> This method transfers the entire content of the given source
+	 * long array into this buffer.  An invocation of this method of the
+	 * form <tt>dst.put(a)</tt> behaves in exactly the same way as the
+	 * invocation
+	 * <p/>
+	 * <pre>
+	 *     dst.put(a, 0, a.length) </pre>
+	 *
+	 * @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&nbsp;&nbsp;<i>(optional operation)</i>.
+	 * <p/>
+	 * <p> 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 <i>p</i>&nbsp;=&nbsp;<tt>position()</tt> is copied
+	 * to index zero, the long at index <i>p</i>&nbsp;+&nbsp;1 is copied
+	 * to index one, and so forth until the long at index
+	 * <tt>limit()</tt>&nbsp;-&nbsp;1 is copied to index
+	 * <i>n</i>&nbsp;=&nbsp;<tt>limit()</tt>&nbsp;-&nbsp;<tt>1</tt>&nbsp;-&nbsp;<i>p</i>.
+	 * The buffer's position is then set to <i>n+1</i> and its limit is set to
+	 * its capacity.  The mark, if defined, is discarded.
+	 * <p/>
+	 * <p> 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 <i>put</i>
+	 * method. </p>
+	 *
+	 * @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.
+	 * <p/>
+	 * <p> The byte order of a pointer buffer created by allocation or by
+	 * wrapping an existing <tt>long</tt> array is the {@link
+	 * ByteOrder#nativeOrder </code>native order<code>} of the underlying
+	 * hardware.  The byte order of a pointer buffer created as a <a
+	 * href="ByteBuffer.html#views">view</a> of a byte buffer is that of the
+	 * byte buffer at the moment that the view is created.  </p>
+	 *
+	 * @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.  </p>
+	 *
+	 * @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.
+	 * <p/>
+	 * <p> The hash code of a pointer buffer depends only upon its remaining
+	 * elements; that is, upon the elements from <tt>position()</tt> up to, and
+	 * including, the element at <tt>limit()</tt>&nbsp;-&nbsp;<tt>1</tt>.
+	 * <p/>
+	 * <p> 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.  </p>
+	 *
+	 * @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.
+	 * <p/>
+	 * <p> Two pointer buffers are equal if, and only if,
+	 * <p/>
+	 * <p><ol>
+	 * <p/>
+	 * <li><p> They have the same element type,  </p></li>
+	 * <p/>
+	 * <li><p> They have the same number of remaining elements, and
+	 * </p></li>
+	 * <p/>
+	 * <li><p> The two sequences of remaining elements, considered
+	 * independently of their starting positions, are pointwise equal.
+	 * </p></li>
+	 * <p/>
+	 * </ol>
+	 * <p/>
+	 * <p> A pointer buffer is not equal to any other type of object.  </p>
+	 *
+	 * @param ob The object to which this buffer is to be compared
+	 *
+	 * @return <tt>true</tt> 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.
+	 * <p/>
+	 * <p> 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.
+	 * <p/>
+	 * <p> 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();
+		}
+
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/PointerWrapper.java b/src/java/org/lwjgl/PointerWrapper.java
new file mode 100644
index 0000000..25bad96
--- /dev/null
+++ b/src/java/org/lwjgl/PointerWrapper.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl;
+
+/**
+ * A common interface for classes that wrap pointer addresses.
+ *
+ * @author Spasi
+ */
+public interface PointerWrapper {
+
+	long getPointer();
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/PointerWrapperAbstract.java b/src/java/org/lwjgl/PointerWrapperAbstract.java
new file mode 100644
index 0000000..972fb49
--- /dev/null
+++ b/src/java/org/lwjgl/PointerWrapperAbstract.java
@@ -0,0 +1,92 @@
+/*
+ * 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() + ")";
+	}
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/Sys.java b/src/java/org/lwjgl/Sys.java
index 7b2c528..0634934 100644
--- a/src/java/org/lwjgl/Sys.java
+++ b/src/java/org/lwjgl/Sys.java
@@ -46,27 +46,28 @@ import org.lwjgl.input.Mouse;
  * System class (named Sys so as not to conflict with java.lang.System)
  * </p>
  * @author cix_foo <cix_foo at users.sourceforge.net>
- * @version $Revision: 3353 $
- * $Id: Sys.java 3353 2010-05-24 22:39:06Z matzon $
+ * @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.5";
+	private static final String VERSION = "2.7.1";
+
+	private static final String POSTFIX64BIT = "64";
 
 	/** The implementation instance to delegate platform specific behavior to */
-	private final static SysImplementation implementation;
+	private static final SysImplementation implementation;
+	private static final boolean is64Bit;
 
-	private final static String POSTFIX64BIT = "64";
-  
 	private static void doLoadLibrary(final String lib_name) {
-		AccessController.doPrivileged(new PrivilegedAction() {
+		AccessController.doPrivileged(new PrivilegedAction<Object>() {
 			public Object run() {
 				String library_path = System.getProperty("org.lwjgl.librarypath");
 				if (library_path != null) {
-					System.load(library_path + File.separator + 
+					System.load(library_path + File.separator +
 						System.mapLibraryName(lib_name));
 				} else {
 					System.loadLibrary(lib_name);
@@ -91,17 +92,18 @@ public final class Sys {
 			// 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 libary version is '" + native_jni_version + "'");
+                             "', native library version is '" + native_jni_version + "'");
 		implementation.setDebug(LWJGLUtil.DEBUG);
 	}
 
@@ -130,13 +132,18 @@ public final class Sys {
 	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.
@@ -208,22 +215,22 @@ public final class Sys {
 		// 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 = (Method)AccessController.doPrivileged(new PrivilegedExceptionAction() {
-				public Object run() throws Exception {
-					return serviceManagerClass.getMethod("lookup", new Class[] {String.class});
+			final Class<?> serviceManagerClass = Class.forName("javax.jnlp.ServiceManager");
+			Method lookupMethod = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
+				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 = (Method)AccessController.doPrivileged(new PrivilegedExceptionAction() {
-				public Object run() throws Exception {
-					return basicServiceClass.getMethod("showDocument", new Class[] {URL.class});
+			final Class<?> basicServiceClass = Class.forName("javax.jnlp.BasicService");
+			Method showDocumentMethod = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
+				public Method run() throws Exception {
+					return basicServiceClass.getMethod("showDocument", URL.class);
 				}
 			});
 			try {
-				Boolean ret = (Boolean) showDocumentMethod.invoke(basicService, new Object[] {new URL(url)});
-				return ret.booleanValue();
+				Boolean ret = (Boolean)showDocumentMethod.invoke(basicService, new URL(url));
+				return ret;
 			} catch (MalformedURLException e) {
 				e.printStackTrace(System.err);
 				return false;
diff --git a/src/java/org/lwjgl/SysImplementation.java b/src/java/org/lwjgl/SysImplementation.java
index 3dcda4e..0a32968 100644
--- a/src/java/org/lwjgl/SysImplementation.java
+++ b/src/java/org/lwjgl/SysImplementation.java
@@ -37,8 +37,8 @@ package org.lwjgl;
  *
  * @author cix_foo <cix_foo at users.sourceforge.net>
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3054 $
- * $Id: SysImplementation.java 3054 2008-04-30 14:34:54Z elias_naur $
+ * @version $Revision: 3426 $
+ * $Id: SysImplementation.java 3426 2010-10-01 22:20:14Z spasi $
  */
 interface SysImplementation {
 	/**
@@ -51,6 +51,11 @@ interface SysImplementation {
 	 */
 	int getJNIVersion();
 
+	/**
+	 * Returns the platform's pointer size in bytes
+	 */
+	int getPointerSize();
+
 	void setDebug(boolean debug);
 
 	/**
diff --git a/src/java/org/lwjgl/WindowsSysImplementation.java b/src/java/org/lwjgl/WindowsSysImplementation.java
index 578fc65..6932ff1 100644
--- a/src/java/org/lwjgl/WindowsSysImplementation.java
+++ b/src/java/org/lwjgl/WindowsSysImplementation.java
@@ -41,16 +41,16 @@ import org.lwjgl.opengl.Display;
 /**
  * <p>
  * @author $Author: spasi $
- * @version $Revision: 3300 $
- * $Id: WindowsSysImplementation.java 3300 2010-03-31 20:56:07Z spasi $
+ * @version $Revision: 3418 $
+ * $Id: WindowsSysImplementation.java 3418 2010-09-28 21:11:35Z spasi $
  */
 final class WindowsSysImplementation extends DefaultSysImplementation {
-	private final static int JNI_VERSION = 22; 
+	private static final int JNI_VERSION = 23;
 
 	static {
 		Sys.initialize();
 	}
-	
+
 	public int getRequiredJNIVersion() {
 		return JNI_VERSION;
 	}
@@ -64,7 +64,7 @@ final class WindowsSysImplementation extends DefaultSysImplementation {
 	}
 	private static native long nGetTime();
 
-	public final boolean has64Bit() {
+	public boolean has64Bit() {
 		return true;
 	}
 
@@ -75,19 +75,17 @@ final class WindowsSysImplementation extends DefaultSysImplementation {
 		 * public
 		 */
 		try {
-			Long hwnd_obj = (Long)AccessController.doPrivileged(new PrivilegedExceptionAction() {
-				public Object run() throws Exception {
-					Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation", null);
+			return AccessController.doPrivileged(new PrivilegedExceptionAction<Long>() {
+				public Long run() throws Exception {
+					Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation");
 					getImplementation_method.setAccessible(true);
-					Object display_impl = getImplementation_method.invoke(null, null);
-					Class WindowsDisplay_class = Class.forName("org.lwjgl.opengl.WindowsDisplay");
-					Method getHwnd_method = WindowsDisplay_class.getDeclaredMethod("getHwnd", null);
+					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);
-					Long hwnd = (Long)getHwnd_method.invoke(display_impl, null);
-					return hwnd;
+					return (Long)getHwnd_method.invoke(display_impl);
 				}
 			});
-			return hwnd_obj.longValue();
 		} catch (PrivilegedActionException e) {
 			throw new Error(e);
 		}
diff --git a/src/java/org/lwjgl/examples/Game.java b/src/java/org/lwjgl/examples/Game.java
index 8bb7d8c..9a227ac 100644
--- a/src/java/org/lwjgl/examples/Game.java
+++ b/src/java/org/lwjgl/examples/Game.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -35,35 +35,36 @@ import org.lwjgl.Sys;
 import org.lwjgl.input.Keyboard;
 import org.lwjgl.openal.AL;
 import org.lwjgl.opengl.Display;
-import org.lwjgl.opengl.GL11;
+
+import static org.lwjgl.opengl.GL11.*;
 
 /**
  *
  * This is a <em>very basic</em> skeleton to init a game and run it.
  *
- * @author $Author: matzon $
- * @version $Revision: 3108 $
- * $Id: Game.java 3108 2008-07-02 20:00:49Z matzon $
+ * @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
@@ -78,10 +79,10 @@ public class Game {
 		} finally {
 			cleanup();
 		}
-		
+
 		System.exit(0);
 	}
-	
+
 	/**
 	 * Initialise the game
 	 * @throws Exception if init fails
@@ -94,25 +95,25 @@ public class Game {
 
     // 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.
-		GL11.glMatrixMode(GL11.GL_PROJECTION);
-		GL11.glLoadIdentity();
-		GL11.glOrtho(0.0, Display.getDisplayMode().getWidth(), 0.0, Display.getDisplayMode().getHeight(), -1.0, 1.0);
-		GL11.glMatrixMode(GL11.GL_MODELVIEW);
-		GL11.glLoadIdentity();
-		GL11.glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
-		
+		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")
 	 */
@@ -120,7 +121,7 @@ public class Game {
 		while (!finished) {
 			// Always call Window.update(), all the time
 			Display.update();
-			
+
 			if (Display.isCloseRequested()) {
 				// Check for O/S close requests
 				finished = true;
@@ -144,7 +145,7 @@ public class Game {
 			}
 		}
 	}
-	
+
 	/**
 	 * Do any game-specific cleanup
 	 */
@@ -153,11 +154,11 @@ public class Game {
 
 		// Stop the sound
 		AL.destroy();
-		
+
 		// Close the window
 		Display.destroy();
 	}
-	
+
 	/**
 	 * Do all calculations, handle input, etc.
 	 */
@@ -170,24 +171,24 @@ public class Game {
     // TODO: all your game logic goes here.
     angle += 2.0f % 360;
 	}
-	
+
 	/**
 	 * Render the current frame
 	 */
 	private static void render() {
-		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT);
+		glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
 
     // TODO: all your rendering goes here
-    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
-    GL11.glPushMatrix();
-    GL11.glTranslatef(Display.getDisplayMode().getWidth() / 2, Display.getDisplayMode().getHeight() / 2, 0.0f);
-    GL11.glRotatef(angle, 0, 0, 1.0f);
-    GL11.glBegin(GL11.GL_QUADS);
-    GL11.glVertex2i(-50, -50);
-    GL11.glVertex2i(50, -50);
-    GL11.glVertex2i(50, 50);
-    GL11.glVertex2i(-50, 50);
-    GL11.glEnd();
-    GL11.glPopMatrix();
+    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();
 	}
 }
diff --git a/src/java/org/lwjgl/examples/spaceinvaders/Entity.java b/src/java/org/lwjgl/examples/spaceinvaders/Entity.java
index ca9e09b..85d6dad 100644
--- a/src/java/org/lwjgl/examples/spaceinvaders/Entity.java
+++ b/src/java/org/lwjgl/examples/spaceinvaders/Entity.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -37,13 +37,13 @@ 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 {
@@ -71,12 +71,12 @@ public abstract class Entity {
 
 	/**
 	 * Construct a entity based on a sprite image and a location.
-	 * 
-	 * @param ref The reference to the image to be displayed for this entity
+	 *
+	 * @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
 	 */
-	public Entity(Sprite sprite, int x, int y) {
+	protected Entity(Sprite sprite, int x, int y) {
 		this.sprite = sprite;
 		this.x = x;
 		this.y = y;
@@ -85,7 +85,7 @@ public abstract class Entity {
 	/**
 	 * 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) {
@@ -96,7 +96,7 @@ public abstract class Entity {
 
 	/**
 	 * Set the horizontal speed of this entity
-	 * 
+	 *
 	 * @param dx The horizontal speed of this entity (pixels/sec)
 	 */
 	public void setHorizontalMovement(float dx) {
@@ -105,7 +105,7 @@ public abstract class Entity {
 
 	/**
 	 * Set the vertical speed of this entity
-	 * 
+	 *
 	 * @param dy The vertical speed of this entity (pixels/sec)
 	 */
 	public void setVerticalMovement(float dy) {
@@ -114,7 +114,7 @@ public abstract class Entity {
 
 	/**
 	 * Get the horizontal speed of this entity
-	 * 
+	 *
 	 * @return The horizontal speed of this entity (pixels/sec)
 	 */
 	public float getHorizontalMovement() {
@@ -123,7 +123,7 @@ public abstract class Entity {
 
 	/**
 	 * Get the vertical speed of this entity
-	 * 
+	 *
 	 * @return The vertical speed of this entity (pixels/sec)
 	 */
 	public float getVerticalMovement() {
@@ -146,7 +146,7 @@ public abstract class Entity {
 
 	/**
 	 * Get the x location of this entity
-	 * 
+	 *
 	 * @return The x location of this entity
 	 */
 	public int getX() {
@@ -155,7 +155,7 @@ public abstract class Entity {
 
 	/**
 	 * Get the y location of this entity
-	 * 
+	 *
 	 * @return The y location of this entity
 	 */
 	public int getY() {
@@ -164,7 +164,7 @@ public abstract class Entity {
 
 	/**
 	 * 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
 	 */
@@ -177,7 +177,7 @@ public abstract class Entity {
 
 	/**
 	 * Notification that this entity collided with another.
-	 * 
+	 *
 	 * @param other The entity with which this entity collided.
 	 */
 	public abstract void collidedWith(Entity other);
diff --git a/src/java/org/lwjgl/examples/spaceinvaders/Game.java b/src/java/org/lwjgl/examples/spaceinvaders/Game.java
index 051dba4..02deb13 100644
--- a/src/java/org/lwjgl/examples/spaceinvaders/Game.java
+++ b/src/java/org/lwjgl/examples/spaceinvaders/Game.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -39,32 +39,33 @@ import org.lwjgl.input.Keyboard;
 import org.lwjgl.input.Mouse;
 import org.lwjgl.opengl.Display;
 import org.lwjgl.opengl.DisplayMode;
-import org.lwjgl.opengl.GL11;
+
+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. 
- * 
+ * 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.
- * 
+ *
  * <p>
  * NOTE:<br>
  * This game is a LWJGLized implementation of the Space Invaders game by Kevin
- * Glass. The original implementation is renderer agnostic and supports other 
+ * 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, 
+ * 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:<br>
  * <a href="http://www.cokeandcode.com/" target="_blank">http://www.cokeandcode.com</a>
  * </p>
- * 
+ *
  * @author Kevin Glass
  * @author Brian Matzon
  */
@@ -83,10 +84,10 @@ public class Game {
 	private TextureLoader	textureLoader;
 
 	/** The list of all the entities that exist in our game */
-	private ArrayList			entities							= new ArrayList();
+	private ArrayList<Entity>			entities							= new ArrayList<Entity>();
 
 	/** The list of entities that need to be removed from the game this loop */
-	private ArrayList			removeList						= new ArrayList();
+	private ArrayList<Entity>			removeList						= new ArrayList<Entity>();
 
 	/** The entity representing the player */
 	private ShipEntity		ship;
@@ -113,7 +114,7 @@ public class Game {
 	private float					moveSpeed							= 300;
 
 	/** The time at which last fired a shot */
-	private long					lastFire							= 0;
+	private long					lastFire;
 
 	/** The interval between our players shot (ms) */
 	private long					firingInterval				= 500;
@@ -125,16 +126,16 @@ public class Game {
 	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	= false;
+	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		= false;
+	private boolean				fireHasBeenReleased;
 
 	/** The time since the last record of fps */
-	private long					lastFpsTime						= 0;
+	private long					lastFpsTime;
 
 	/** The recorded fps */
 	private int						fps;
@@ -167,15 +168,14 @@ public class Game {
 
   /** Mouse movement on x axis */
 	private int	mouseX;
-	
+
 	/** Is this an application or applet */
-	private static boolean isApplication = false;
+	private static boolean isApplication;
 
 	/**
 	 * Construct our game and set it running.
 	 * @param fullscreen
-	 * 
-	 * @param renderingType The type of rendering to use (should be one of the contansts from ResourceFactory)
+	 *
 	 */
 	public Game(boolean fullscreen) {
 		this.fullscreen = fullscreen;
@@ -184,7 +184,7 @@ public class Game {
 
 	/**
 	 * Get the high resolution time in milliseconds
-	 * 
+	 *
 	 * @return The high resolution time in milliseconds
 	 */
 	public static long getTime() {
@@ -196,8 +196,8 @@ public class Game {
 	}
 
 	/**
-	 * Sleep for a fixed number of milliseconds. 
-	 * 
+	 * Sleep for a fixed number of milliseconds.
+	 *
 	 * @param duration The amount of time in milliseconds to sleep for
 	 */
 	public static void sleep(long duration) {
@@ -217,25 +217,25 @@ public class Game {
 			Display.setTitle(WINDOW_TITLE);
 			Display.setFullscreen(fullscreen);
 			Display.create();
-	      
+
 			// grab the mouse, dont want that hideous cursor when we're playing!
-			if (isApplication) {	
+			if (isApplication) {
 				Mouse.setGrabbed(true);
 			}
 
 			// enable textures since we're going to use these for our sprites
-			GL11.glEnable(GL11.GL_TEXTURE_2D);
+			glEnable(GL_TEXTURE_2D);
 
 			// disable the OpenGL depth test since we're rendering 2D graphics
-			GL11.glDisable(GL11.GL_DEPTH_TEST);
+			glDisable(GL_DEPTH_TEST);
 
-			GL11.glMatrixMode(GL11.GL_PROJECTION);
-			GL11.glLoadIdentity();
+			glMatrixMode(GL_PROJECTION);
+			glLoadIdentity();
 
-			GL11.glOrtho(0, width, height, 0, -1, 1);
-			GL11.glMatrixMode(GL11.GL_MODELVIEW);
-			GL11.glLoadIdentity();
-			GL11.glViewport(0, 0, width, height);
+			glOrtho(0, width, height, 0, -1, 1);
+			glMatrixMode(GL_MODELVIEW);
+			glLoadIdentity();
+			glViewport(0, 0, width, height);
 
 			textureLoader = new TextureLoader();
 
@@ -289,7 +289,7 @@ public class Game {
           "height=" + height,
           "freq=" + 60,
           "bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel()
-         }); 
+         });
       return true;
     } catch (Exception e) {
       e.printStackTrace();
@@ -341,7 +341,7 @@ public class Game {
 	/**
 	 * 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) {
@@ -349,7 +349,7 @@ public class Game {
 	}
 
 	/**
-	 * Notification that the player has died. 
+	 * Notification that the player has died.
 	 */
 	public void notifyDeath() {
 		if (!waitingForKeyPress) {
@@ -382,10 +382,8 @@ public class Game {
 
 		// if there are still some aliens left then they all need to get faster, so
 		// speed up all the existing aliens
-		for (int i = 0; i < entities.size(); i++) {
-			Entity entity = (Entity) entities.get(i);
-
-			if (entity instanceof AlienEntity) {
+		for ( Entity entity : entities ) {
+			if ( entity instanceof AlienEntity ) {
 				// speed up by 2%
 				entity.setHorizontalMovement(entity.getHorizontalMovement() * 1.02f);
 			}
@@ -396,7 +394,7 @@ public class Game {
 
 	/**
 	 * Attempt to fire a shot from the player. Its called "try"
-	 * since we must first check that the player can fire at this 
+	 * 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() {
@@ -421,9 +419,9 @@ public class Game {
 	private void gameLoop() {
 		while (Game.gameRunning) {
 			// clear screen
-			GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
-			GL11.glMatrixMode(GL11.GL_MODELVIEW);
-			GL11.glLoadIdentity();
+			glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+			glMatrixMode(GL_MODELVIEW);
+			glLoadIdentity();
 
 			// let subsystem paint
 			frameRendering();
@@ -431,7 +429,7 @@ public class Game {
 			// update window contents
 			Display.update();
 		}
-		
+
 		// clean up
 		soundManager.destroy();
 		Display.destroy();
@@ -462,25 +460,23 @@ public class Game {
 
 		// cycle round asking each entity to move itself
 		if (!waitingForKeyPress && !soundManager.isPlayingSound()) {
-			for (int i = 0; i < entities.size(); i++) {
-				Entity entity = (Entity) entities.get(i);
+			for ( Entity entity : entities ) {
 				entity.move(delta);
 			}
 		}
 
 		// cycle round drawing all the entities we have in the game
-		for (int i = 0; i < entities.size(); i++) {
-			Entity entity = (Entity) entities.get(i);
+		for ( Entity entity : entities ) {
 			entity.draw();
 		}
 
 		// brute force collisions, compare every entity against
-		// every other entity. If any of them collide notify 
+		// 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 = (Entity) entities.get(p);
-				Entity him = (Entity) entities.get(s);
+				Entity me = entities.get(p);
+				Entity him = entities.get(s);
 
 				if (me.collidesWith(him)) {
 					me.collidedWith(him);
@@ -497,21 +493,20 @@ public class Game {
 		// be resolved, cycle round every entity requesting that
 		// their personal logic should be considered.
 		if (logicRequiredThisLoop) {
-			for (int i = 0; i < entities.size(); i++) {
-				Entity entity = (Entity) entities.get(i);
+			for ( Entity entity : entities ) {
 				entity.doLogic();
 			}
 
 			logicRequiredThisLoop = false;
 		}
 
-		// if we're waiting for an "any key" press then draw the 
-		// current message 
+		// 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 
+		// 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);
@@ -557,23 +552,23 @@ public class Game {
 	}
 
 	/**
-	 * @param key_left
+	 * @param direction
 	 * @return
 	 */
 	private boolean hasInput(int direction) {
     switch(direction) {
     	case Keyboard.KEY_LEFT:
-        return 
+        return
           Keyboard.isKeyDown(Keyboard.KEY_LEFT) ||
           mouseX < 0;
-      
+
       case Keyboard.KEY_RIGHT:
-        return 
+        return
           Keyboard.isKeyDown(Keyboard.KEY_RIGHT) ||
           mouseX > 0;
-      
+
       case Keyboard.KEY_SPACE:
-        return 
+        return
           Keyboard.isKeyDown(Keyboard.KEY_SPACE) ||
           Mouse.isButtonDown(0);
     }
@@ -584,18 +579,18 @@ public class Game {
 	 * 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 && argv[0].equalsIgnoreCase("-fullscreen"))).execute();
+		new Game((argv.length > 0 && "-fullscreen".equalsIgnoreCase(argv[0]))).execute();
 		System.exit(0);
 	}
 
 	/**
-	 * 
+	 *
 	 */
 	public void execute() {
 		gameLoop();
@@ -604,7 +599,7 @@ public class Game {
 	/**
 	 * 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.
 	 */
diff --git a/src/java/org/lwjgl/examples/spaceinvaders/GameApplet.java b/src/java/org/lwjgl/examples/spaceinvaders/GameApplet.java
index 32386df..e3a9a3a 100644
--- a/src/java/org/lwjgl/examples/spaceinvaders/GameApplet.java
+++ b/src/java/org/lwjgl/examples/spaceinvaders/GameApplet.java
@@ -8,27 +8,27 @@ 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 
+	 * 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();
 				}
@@ -39,8 +39,8 @@ public class GameApplet extends Applet {
 		};
 		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
@@ -55,15 +55,15 @@ public class GameApplet extends Applet {
 	}
 
 	public void start() {
-		
+
 	}
 
 	public void stop() {
-		
+
 	}
-	
+
 	/**
-	 * Applet Destroy method will remove the canvas, before canvas is destroyed it will notify 
+	 * 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() {
@@ -71,21 +71,21 @@ public class GameApplet extends Applet {
 		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 
+	 * 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 final void addNotify() {
+				public void addNotify() {
 					super.addNotify();
 					startLWJGL();
 				}
-				public final void removeNotify() {
+				public void removeNotify() {
 					stopLWJGL();
 					super.removeNotify();
 				}
diff --git a/src/java/org/lwjgl/examples/spaceinvaders/ShotEntity.java b/src/java/org/lwjgl/examples/spaceinvaders/ShotEntity.java
index eceafb0..7e1a12d 100644
--- a/src/java/org/lwjgl/examples/spaceinvaders/ShotEntity.java
+++ b/src/java/org/lwjgl/examples/spaceinvaders/ShotEntity.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -33,7 +33,7 @@ package org.lwjgl.examples.spaceinvaders;
 
 /**
  * An entity representing a shot fired by the player's ship
- * 
+ *
  * @author Kevin Glass
  * @author Brian Matzon
  */
@@ -49,11 +49,11 @@ public class ShotEntity extends Entity {
 	private Game							game;
 
 	/** True if this shot has been "used", i.e. its hit something */
-	private boolean						used				= false;
+	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
@@ -68,7 +68,7 @@ public class ShotEntity extends Entity {
 
   /**
    * Reinitializes this entity, for reuse
-   * 
+   *
    * @param x new x coordinate
    * @param y new y coordinate
    */
@@ -80,7 +80,7 @@ public class ShotEntity extends Entity {
 
 	/**
 	 * Request that this shot moved based on time elapsed
-	 * 
+	 *
 	 * @param delta The time that has elapsed since last move
 	 */
 	public void move(long delta) {
@@ -96,7 +96,7 @@ public class ShotEntity extends Entity {
 	/**
 	 * Notification that this shot has collided with another
 	 * entity
-	 * 
+	 *
 	 * @param other The other entity with which we've collided
 	 */
 	public void collidedWith(Entity other) {
diff --git a/src/java/org/lwjgl/examples/spaceinvaders/SoundManager.java b/src/java/org/lwjgl/examples/spaceinvaders/SoundManager.java
index e0e78d6..b10c65c 100644
--- a/src/java/org/lwjgl/examples/spaceinvaders/SoundManager.java
+++ b/src/java/org/lwjgl/examples/spaceinvaders/SoundManager.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -47,29 +47,29 @@ import org.lwjgl.util.WaveData;
  * whether it's playing.
  * </p>
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 2983 $
- * $Id: SoundManager.java 2983 2008-04-07 18:36:09Z 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
    */
@@ -78,13 +78,13 @@ public class SoundManager {
 
   /**
    * Plays a sound effect
-   * @param buffer Buffer index to play gotten from addSound 
+   * @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);
@@ -101,7 +101,7 @@ public class SoundManager {
       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
@@ -109,27 +109,27 @@ public class SoundManager {
   public boolean isPlayingSound() {
   	return AL10.alGetSourcei(sources[sources.length-1], AL10.AL_SOURCE_STATE) == AL10.AL_PLAYING;
   }
-  
+
   /**
    * Initializes the SoundManager
-   * 
-   * @param sources Number of sources to create
+   *
+   * @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) {
@@ -137,10 +137,10 @@ public class SoundManager {
       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
    */
@@ -149,26 +149,26 @@ public class SoundManager {
     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();        
-    
+    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();
@@ -176,12 +176,12 @@ public class SoundManager {
 
       // 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();
     }
diff --git a/src/java/org/lwjgl/examples/spaceinvaders/Sprite.java b/src/java/org/lwjgl/examples/spaceinvaders/Sprite.java
index 845346c..9a082a4 100644
--- a/src/java/org/lwjgl/examples/spaceinvaders/Sprite.java
+++ b/src/java/org/lwjgl/examples/spaceinvaders/Sprite.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -33,12 +33,12 @@ package org.lwjgl.examples.spaceinvaders;
 
 import java.io.IOException;
 
-import org.lwjgl.opengl.GL11;
+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
  */
@@ -55,8 +55,8 @@ public class Sprite {
 
 	/**
 	 * Create a new sprite from a specified image.
-	 * 
-	 * @param window The window in which the sprite will be displayed
+	 *
+	 * @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) {
@@ -72,7 +72,7 @@ public class Sprite {
 
 	/**
 	 * Get the width of this sprite in pixels
-	 * 
+	 *
 	 * @return The width of this sprite in pixels
 	 */
 	public int getWidth() {
@@ -81,7 +81,7 @@ public class Sprite {
 
 	/**
 	 * Get the height of this sprite in pixels
-	 * 
+	 *
 	 * @return The height of this sprite in pixels
 	 */
 	public int getHeight() {
@@ -90,38 +90,38 @@ public class Sprite {
 
 	/**
 	 * 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
-		GL11.glPushMatrix();
+		glPushMatrix();
 
 		// bind to the appropriate texture for this sprite
 		texture.bind();
 
 		// translate to the right location and prepare to draw
-		GL11.glTranslatef(x, y, 0);
+		glTranslatef(x, y, 0);
 
 		// draw a quad textured to match the sprite
-		GL11.glBegin(GL11.GL_QUADS);
+		glBegin(GL_QUADS);
 		{
-			GL11.glTexCoord2f(0, 0);
-			GL11.glVertex2f(0, 0);
+			glTexCoord2f(0, 0);
+			glVertex2f(0, 0);
 
-			GL11.glTexCoord2f(0, texture.getHeight());
-			GL11.glVertex2f(0, height);
+			glTexCoord2f(0, texture.getHeight());
+			glVertex2f(0, height);
 
-			GL11.glTexCoord2f(texture.getWidth(), texture.getHeight());
-			GL11.glVertex2f(width, height);
+			glTexCoord2f(texture.getWidth(), texture.getHeight());
+			glVertex2f(width, height);
 
-			GL11.glTexCoord2f(texture.getWidth(), 0);
-			GL11.glVertex2f(width, 0);
+			glTexCoord2f(texture.getWidth(), 0);
+			glVertex2f(width, 0);
 		}
-		GL11.glEnd();
+		glEnd();
 
 		// restore the model view matrix to prevent contamination
-		GL11.glPopMatrix();
+		glPopMatrix();
 	}
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/examples/spaceinvaders/Texture.java b/src/java/org/lwjgl/examples/spaceinvaders/Texture.java
index 0503172..f3cde23 100644
--- a/src/java/org/lwjgl/examples/spaceinvaders/Texture.java
+++ b/src/java/org/lwjgl/examples/spaceinvaders/Texture.java
@@ -1,43 +1,43 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 package org.lwjgl.examples.spaceinvaders;
 
-import org.lwjgl.opengl.GL11;
+import static org.lwjgl.opengl.GL11.*;
 
 /**
- * A texture to be bound within OpenGL. This object is responsible for 
+ * 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
@@ -75,7 +75,7 @@ public class Texture {
 	/**
 	 * Create a new texture
 	 *
-	 * @param target The GL target 
+	 * @param target The GL target
 	 * @param textureID The GL texture ID
 	 */
 	public Texture(int target, int textureID) {
@@ -85,11 +85,9 @@ public class Texture {
 
 	/**
 	 * Bind the specified GL context to a texture
-	 *
-	 * @param gl The GL context to bind to
 	 */
 	public void bind() {
-		GL11.glBindTexture(target, textureID);
+		glBindTexture(target, textureID);
 	}
 
 	/**
@@ -121,7 +119,7 @@ public class Texture {
 		return height;
 	}
 
-	/** 
+	/**
 	 * Get the width of the original image
 	 *
 	 * @return The width of the original image
@@ -149,7 +147,7 @@ public class Texture {
 	}
 
 	/**
-	 * Set the height of this texture 
+	 * Set the height of this texture
 	 *
 	 * @param texHeight The height of the texture
 	 */
@@ -159,7 +157,7 @@ public class Texture {
 	}
 
 	/**
-	 * Set the width of this texture 
+	 * Set the width of this texture
 	 *
 	 * @param texWidth The width of the texture
 	 */
diff --git a/src/java/org/lwjgl/examples/spaceinvaders/TextureLoader.java b/src/java/org/lwjgl/examples/spaceinvaders/TextureLoader.java
index 8a74484..51c0c8b 100644
--- a/src/java/org/lwjgl/examples/spaceinvaders/TextureLoader.java
+++ b/src/java/org/lwjgl/examples/spaceinvaders/TextureLoader.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -33,6 +33,7 @@ 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;
@@ -41,7 +42,6 @@ import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferByte;
 import java.awt.image.Raster;
 import java.awt.image.WritableRaster;
-import java.io.BufferedInputStream;
 import java.io.IOException;
 import java.net.URL;
 import java.nio.ByteBuffer;
@@ -50,17 +50,18 @@ import java.nio.IntBuffer;
 import java.util.HashMap;
 import java.util.Hashtable;
 
-import javax.imageio.ImageIO;
+import javax.swing.ImageIcon;
 
 import org.lwjgl.BufferUtils;
-import org.lwjgl.opengl.GL11;
+
+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 
+ *
+ * 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.
@@ -70,21 +71,19 @@ import org.lwjgl.opengl.GL11;
  */
 public class TextureLoader {
     /** The table of textures that have been loaded in this loader */
-    private HashMap table = new HashMap();
+    private HashMap<String, Texture> table = new HashMap<String, Texture>();
 
     /** 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); 
-    
-    /** 
+    private IntBuffer textureIDBuffer = BufferUtils.createIntBuffer(1);
+
+    /**
      * Create a new texture loader based on the game panel
-     *
-     * @param gl The GL content in which the textures should be loaded
      */
     public TextureLoader() {
         glAlphaColorModel = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
@@ -93,7 +92,7 @@ public class TextureLoader {
                                             false,
                                             ComponentColorModel.TRANSLUCENT,
                                             DataBuffer.TYPE_BYTE);
-                                            
+
         glColorModel = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
                                             new int[] {8,8,8,0},
                                             false,
@@ -101,17 +100,17 @@ public class TextureLoader {
                                             ComponentColorModel.OPAQUE,
                                             DataBuffer.TYPE_BYTE);
     }
-    
+
     /**
-     * Create a new texture ID 
+     * Create a new texture ID
      *
      * @return A new texture ID
      */
     private int createTextureID() {
-      GL11.glGenTextures(textureIDBuffer); 
+      glGenTextures(textureIDBuffer);
       return textureIDBuffer.get(0);
-    } 
-    
+    }
+
     /**
      * Load a texture
      *
@@ -120,23 +119,23 @@ public class TextureLoader {
      * @throws IOException Indicates a failure to access the resource
      */
     public Texture getTexture(String resourceName) throws IOException {
-        Texture tex = (Texture) table.get(resourceName);
-        
+        Texture tex = table.get(resourceName);
+
         if (tex != null) {
             return tex;
         }
-        
+
         tex = getTexture(resourceName,
-                         GL11.GL_TEXTURE_2D, // target
-                         GL11.GL_RGBA,     // dst pixel format
-                         GL11.GL_LINEAR, // min filter (unused)
-                         GL11.GL_LINEAR);
-        
+                         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.
@@ -149,66 +148,66 @@ public class TextureLoader {
      * @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 = 0;
-        
-        // create the texture ID for this texture 
-        int textureID = createTextureID(); 
-        Texture texture = new Texture(target,textureID); 
-        
-        // bind this texture 
-        GL11.glBindTexture(target, textureID); 
- 
-        BufferedImage bufferedImage = loadImage(resourceName); 
+    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 = GL11.GL_RGBA;
+            srcPixelFormat = GL_RGBA;
         } else {
-            srcPixelFormat = GL11.GL_RGB;
+            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);
         }
 
-        // convert that image into a byte buffer of texture data 
-        ByteBuffer textureBuffer = convertImageData(bufferedImage,texture); 
-        
-        if (target == GL11.GL_TEXTURE_2D) { 
-            GL11.glTexParameteri(target, GL11.GL_TEXTURE_MIN_FILTER, minFilter); 
-            GL11.glTexParameteri(target, GL11.GL_TEXTURE_MAG_FILTER, magFilter); 
-        } 
- 
         // produce a texture from the byte buffer
-        GL11.glTexImage2D(target, 
-                      0, 
-                      dstPixelFormat, 
-                      get2Fold(bufferedImage.getWidth()), 
-                      get2Fold(bufferedImage.getHeight()), 
-                      0, 
-                      srcPixelFormat, 
-                      GL11.GL_UNSIGNED_BYTE, 
-                      textureBuffer ); 
-        
-        return texture; 
-    } 
-    
+        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 int get2Fold(int fold) {
+    private static int get2Fold(int fold) {
         int ret = 2;
         while (ret < fold) {
             ret *= 2;
         }
         return ret;
-    } 
-    
+    }
+
     /**
      * Convert the buffered image to a texture
      *
@@ -216,14 +215,14 @@ public class TextureLoader {
      * @param texture The texture to store the data into
      * @return A buffer containing the data
      */
-    private ByteBuffer convertImageData(BufferedImage bufferedImage,Texture texture) { 
-        ByteBuffer imageBuffer = null; 
+    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()) {
@@ -232,10 +231,10 @@ public class TextureLoader {
         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()) {
@@ -245,41 +244,48 @@ public class TextureLoader {
             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 
+
+        // build a byte buffer from the temporary image
         // that be used by OpenGL to produce a texture.
-        byte[] data = ((DataBufferByte) texImage.getRaster().getDataBuffer()).getData(); 
+        byte[] data = ((DataBufferByte) texImage.getRaster().getDataBuffer()).getData();
 
-        imageBuffer = ByteBuffer.allocateDirect(data.length); 
-        imageBuffer.order(ByteOrder.nativeOrder()); 
-        imageBuffer.put(data, 0, data.length); 
+        imageBuffer = ByteBuffer.allocateDirect(data.length);
+        imageBuffer.order(ByteOrder.nativeOrder());
+        imageBuffer.put(data, 0, data.length);
         imageBuffer.flip();
-        
-        return imageBuffer; 
-    } 
-    
-    /** 
+
+        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 { 
+    private BufferedImage loadImage(String ref) throws IOException {
         URL url = TextureLoader.class.getClassLoader().getResource(ref);
-        
+
         if (url == null) {
             throw new IOException("Cannot find: " + ref);
         }
-        
-        BufferedImage bufferedImage = ImageIO.read(new BufferedInputStream(getClass().getClassLoader().getResourceAsStream(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;
-    }   
+    }
 }
diff --git a/src/java/org/lwjgl/input/Controller.java b/src/java/org/lwjgl/input/Controller.java
index 4d2c3f4..2721ff6 100644
--- a/src/java/org/lwjgl/input/Controller.java
+++ b/src/java/org/lwjgl/input/Controller.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -35,239 +35,239 @@ 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
 	 */
-	public String getName();
+	String getName();
 
 	/**
 	 * Get the index of this controller in the collection
-	 * 
+	 *
 	 * @return The index of this controller in the collection
 	 */
-	public int getIndex();
-	
+	int getIndex();
+
 	/**
 	 * Retrieve the number of buttons available on this controller
-	 * 
+	 *
 	 * @return The number of butotns available on this controller
 	 */
-	public int getButtonCount();
-	
+	int getButtonCount();
+
 	/**
-	 * Get the name of the specified button. Be warned, often this is 
+	 * 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);
-	
+	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
 	 */
-	public boolean isButtonPressed(int index);
-	
+	boolean isButtonPressed(int index);
+
 	/**
 	 * Poll the controller for new data. This will also update
 	 * events
 	 */
-	public void poll();
-	
-	/** 
+	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();
-	
-	/** 
+	float getPovX();
+
+	/**
 	 * 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();
-	
+	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
 	 */
-	public float getDeadZone(int index);
-	
+	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
 	 */
-	public void setDeadZone(int index,float zone);
-	
+	void setDeadZone(int index,float zone);
+
 	/**
-	 * Retrieve the number of axes available on this controller. 
-	 * 
+	 * Retrieve the number of axes available on this controller.
+	 *
 	 * @return The number of axes available on this controller.
 	 */
-	public int getAxisCount();
-	
+	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.
 	 */
-	public String getAxisName(int index);
-	
+	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. 
-	 * 
+	 * 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);
-	
+	float getAxisValue(int index);
+
 	/**
-	 * Get the value from the X axis if there is one. If no X axis is 
+	 * 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();
-	
+	float getXAxisValue();
+
 	/**
 	 * Get the dead zone for the X axis.
-	 * 
+	 *
 	 * @return The dead zone for the X axis
 	 */
-	public float getXAxisDeadZone();
-	
+	float getXAxisDeadZone();
+
 	/**
 	 * Set the dead zone for the X axis
-	 * 
+	 *
 	 * @param zone The dead zone to use for the X axis
 	 */
-	public void setXAxisDeadZone(float zone);
+	void setXAxisDeadZone(float zone);
 
 	/**
-	 * Get the value from the Y axis if there is one. If no Y axis is 
+	 * 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();
-	
+	float getYAxisValue();
+
 	/**
 	 * Get the dead zone for the Y axis.
-	 * 
+	 *
 	 * @return The dead zone for the Y axis
 	 */
-	public float getYAxisDeadZone();
+	float getYAxisDeadZone();
 
 	/**
 	 * Set the dead zone for the Y axis
-	 * 
+	 *
 	 * @param zone The dead zone to use for the Y axis
 	 */
-	public void setYAxisDeadZone(float zone);
-	
+	void setYAxisDeadZone(float zone);
+
 	/**
-	 * Get the value from the Z axis if there is one. If no Z axis is 
+	 * 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();
-	
+	float getZAxisValue();
+
 	/**
 	 * Get the dead zone for the Z axis.
-	 * 
+	 *
 	 * @return The dead zone for the Z axis
 	 */
-	public float getZAxisDeadZone();
+	float getZAxisDeadZone();
 
 	/**
 	 * Set the dead zone for the Z axis
-	 * 
+	 *
 	 * @param zone The dead zone to use for the Z axis
 	 */
-	public void setZAxisDeadZone(float zone);
-	
+	void setZAxisDeadZone(float zone);
+
 	/**
-	 * Get the value from the RX axis if there is one. If no RX axis is 
+	 * 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();
-	
+	float getRXAxisValue();
+
 	/**
 	 * Get the dead zone for the RX axis.
-	 * 
+	 *
 	 * @return The dead zone for the RX axis
 	 */
-	public float getRXAxisDeadZone();
+	float getRXAxisDeadZone();
 
 	/**
 	 * Set the dead zone for the RX axis
-	 * 
+	 *
 	 * @param zone The dead zone to use for the RX axis
 	 */
-	public void setRXAxisDeadZone(float zone);
-	
+	void setRXAxisDeadZone(float zone);
+
 	/**
-	 * Get the value from the RY axis if there is one. If no RY axis is 
+	 * 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();
-	
+	float getRYAxisValue();
+
 	/**
 	 * Get the dead zone for the RY axis.
-	 * 
+	 *
 	 * @return The dead zone for the RY axis
 	 */
-	public float getRYAxisDeadZone();
+	float getRYAxisDeadZone();
 
 	/**
 	 * Set the dead zone for the RY axis
-	 * 
+	 *
 	 * @param zone The dead zone to use for the RY axis
 	 */
-	public void setRYAxisDeadZone(float zone);
-	
+	void setRYAxisDeadZone(float zone);
+
 	/**
-	 * Get the value from the RZ axis if there is one. If no RZ axis is 
+	 * 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();
-	
+	float getRZAxisValue();
+
 	/**
 	 * Get the dead zone for the RZ axis.
-	 * 
+	 *
 	 * @return The dead zone for the RZ axis
 	 */
-	public float getRZAxisDeadZone();
+	float getRZAxisDeadZone();
 
 	/**
 	 * Set the dead zone for the RZ axis
-	 * 
+	 *
 	 * @param zone The dead zone to use for the RZ axis
 	 */
-	public void setRZAxisDeadZone(float zone);
+	void setRZAxisDeadZone(float zone);
 }
diff --git a/src/java/org/lwjgl/input/ControllerEvent.java b/src/java/org/lwjgl/input/ControllerEvent.java
index 824036a..e0b114a 100644
--- a/src/java/org/lwjgl/input/ControllerEvent.java
+++ b/src/java/org/lwjgl/input/ControllerEvent.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -33,7 +33,7 @@ package org.lwjgl.input;
 
 /**
  * An event occuring on a controller.
- * 
+ *
  * @author Kevin Glass
  */
 class ControllerEvent {
@@ -45,7 +45,7 @@ class ControllerEvent {
 	public static final int POVX = 3;
 	/** Indicates the event was caused by a pov Y */
 	public static final int POVY = 4;
-	
+
 	/** The controller generating the event */
 	private Controller source;
 	/** The index of the input (axis or button) that generated the event */
@@ -58,10 +58,10 @@ class ControllerEvent {
 	private boolean yaxis;
 	/** The time stamp of this event */
 	private long timeStamp;
-	
+
 	/**
 	 * Create a new event
-	 * 
+	 *
 	 * @param source The source of the event
 	 * @param timeStamp The time stamp given for this event
 	 * @param type The type of control generating this event
@@ -69,7 +69,7 @@ class ControllerEvent {
 	 * @param xaxis True if this event was caused by the x-axis
 	 * @param yaxis True if this event was caused by the y-axis
 	 */
-	public ControllerEvent(Controller source,long timeStamp, int type,int index,boolean xaxis,boolean yaxis) {
+	ControllerEvent(Controller source,long timeStamp, int type,int index,boolean xaxis,boolean yaxis) {
 		this.source = source;
 		this.timeStamp = timeStamp;
 		this.type = type;
@@ -77,38 +77,38 @@ class ControllerEvent {
 		this.xaxis = xaxis;
 		this.yaxis = yaxis;
 	}
-	
+
 	/**
 	 * Get the time stamp given for this event. As with nanoTime()
 	 * this value means nothing other than giving ordering
-	 * 
+	 *
 	 * @return The time stamp given for this event
 	 */
 	public long getTimeStamp() {
 		return timeStamp;
 	}
-	
+
 	/**
 	 * Get the controller that generated this event
-	 * 
+	 *
 	 * @return The controller that generated this event
 	 */
 	public Controller getSource() {
 		return source;
 	}
-	
+
 	/**
 	 * Get the index of the control generating this event
-	 * 
+	 *
 	 * @return The index of the control generating this event
 	 */
 	public int getControlIndex() {
 		return index;
 	}
-	
+
 	/**
 	 * Check if this event was generated by a button
-	 * 
+	 *
 	 * @return True if this event was generated by a button
 	 */
 	public boolean isButton() {
@@ -117,7 +117,7 @@ class ControllerEvent {
 
 	/**
 	 * Check if this event was generated by a axis
-	 * 
+	 *
 	 * @return True if this event was generated by a axis
 	 */
 	public boolean isAxis() {
@@ -126,25 +126,25 @@ class ControllerEvent {
 
 	/**
 	 * Check if this event was generated by a pov
-	 * 
+	 *
 	 * @return True if this event was generated by a pov
 	 */
 	public boolean isPovY() {
 		return type == POVY;
 	}
 	/**
-	 * 
+	 *
 	 * Check if this event was generated by a pov
-	 * 
+	 *
 	 * @return True if this event was generated by a pov
 	 */
 	public boolean isPovX() {
 		return type == POVX;
 	}
-	
+
 	/**
 	 * Check if this event was caused by the X axis
-	 * 
+	 *
 	 * @return True if this event was caused by the X axis
 	 */
 	public boolean isXAxis() {
@@ -153,13 +153,13 @@ class ControllerEvent {
 
 	/**
 	 * Check if this event was caused by the Y axis
-	 * 
+	 *
 	 * @return True if this event was caused by the Y axis
 	 */
 	public boolean isYAxis() {
 		return yaxis;
 	}
-	
+
 	/*
 	 * @see java.lang.Object#toString()
 	 */
diff --git a/src/java/org/lwjgl/input/Controllers.java b/src/java/org/lwjgl/input/Controllers.java
index 13bca38..15a80c2 100644
--- a/src/java/org/lwjgl/input/Controllers.java
+++ b/src/java/org/lwjgl/input/Controllers.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -39,98 +39,92 @@ 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();
+	private static ArrayList<JInputController> controllers = new ArrayList<JInputController>();
 	/** The number of controllers */
 	private static int controllerCount;
-	
+
 	/** The current list of events */
-	private static ArrayList events = new ArrayList();
+	private static ArrayList<ControllerEvent> events = new ArrayList<ControllerEvent>();
 	/** 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 (int i=0;i<found.length;i++) {
-				net.java.games.input.Controller c = found[i];
-	
-				if ((!c.getType().equals(net.java.games.input.Controller.Type.KEYBOARD)) &&
-					(!c.getType().equals(net.java.games.input.Controller.Type.MOUSE))) {
+			ArrayList<net.java.games.input.Controller> lollers = new ArrayList<net.java.games.input.Controller>();
+			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);
 				}
 			}
-				
-			int length = lollers.size();
-			
-			for (int i=0;i<length;i++) {
-				net.java.games.input.Controller c = (net.java.games.input.Controller) lollers.get(i);
-	
+
+			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[] sub = c.getControllers();
-		if (sub.length == 0) {
+		net.java.games.input.Controller[] subControllers = c.getControllers();
+		if (subControllers.length == 0) {
 			JInputController controller = new JInputController(controllerCount,c);
-			
+
 			controllers.add(controller);
 			controllerCount++;
 		} else {
-			for (int i=0;i<sub.length;i++) {
-				createController(sub[i]);
+			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 (Controller) controllers.get(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.
@@ -140,17 +134,17 @@ public class Controllers {
 			getController(i).poll();
 		}
 	}
-	
+
 	/**
 	 * Clear any events stored for the controllers in this set
 	 */
 	public static void clearEvents() {
 		events.clear();
 	}
-	
+
 	/**
 	 * Move to the next event that has been stored.
-	 * 
+	 *
 	 * @return True if there is still an event to process
 	 */
 	public static boolean next() {
@@ -158,19 +152,19 @@ public class Controllers {
 			event = null;
 			return false;
 		}
-		
-		event = (ControllerEvent) events.remove(0);
-		
+
+		event = events.remove(0);
+
 		return event != null;
 	}
-	
+
 	/**
 	 * @return True if Controllers has been created
 	 */
 	public static boolean isCreated() {
 		return created;
-	}	
-	
+	}
+
 	/**
 	 * Destroys any resources used by the controllers
 	 */
@@ -185,35 +179,35 @@ public class Controllers {
 //		for (int i=0;i<controllers.size();i++) {
 //			//
 //		}
-//		
+//
 //		// cleanup
 //		event = null;
 //		events.clear();
 //		controllers.clear();
 //		controllerCount = 0;
 	}
-	
+
 	/**
 	 * Get the source of the current event
-	 * 
+	 *
 	 * @return The source of the current event
 	 */
 	public static Controller getEventSource() {
 		return event.getSource();
 	}
-	
+
 	/**
 	 * Get the index of the control that caused the current event
-	 * 
+	 *
 	 * @return The index of the control that cause the current event
 	 */
 	public static int getEventControlIndex() {
 		return event.getControlIndex();
 	}
-	
+
 	/**
 	 * Check if the current event was caused by a button
-	 * 
+	 *
 	 * @return True if the current event was caused by a button
 	 */
 	public static boolean isEventButton() {
@@ -222,16 +216,16 @@ public class Controllers {
 
 	/**
 	 * Check if the current event was caused by a axis
-	 * 
+	 *
 	 * @return True if the current event was caused by a axis
 	 */
 	public static boolean isEventAxis() {
 		return event.isAxis();
 	}
-	
+
 	/**
 	 * Check if the current event was caused by movement on the x-axis
-	 * 
+	 *
 	 * @return True if the current event was cause by movement on the x-axis
 	 */
 	public static boolean isEventXAxis() {
@@ -240,43 +234,43 @@ public class Controllers {
 
 	/**
 	 * Check if the current event was caused by movement on the y-axis
-	 * 
+	 *
 	 * @return True if the current event was caused by movement on the y-axis
 	 */
 	public static boolean isEventYAxis() {
 		return event.isYAxis();
 	}
-	
+
 	/**
 	 * Check if the current event was cause by the POV x-axis
-	 * 
+	 *
 	 * @return True if the current event was caused by the POV x-axis
 	 */
 	public static boolean isEventPovX() {
 		return event.isPovX();
 	}
-	
+
 	/**
 	 * Check if the current event was cause by the POV x-axis
-	 * 
+	 *
 	 * @return True if the current event was caused by the POV x-axis
 	 */
 	public static boolean isEventPovY() {
 		return event.isPovY();
 	}
-	
+
 	/**
 	 * Get the timestamp assigned to the current event
-	 * 
+	 *
 	 * @return The timestamp assigned ot the current event
 	 */
 	public static long getEventNanoseconds() {
 		return event.getTimeStamp();
 	}
-	
+
 	/**
 	 * Add an event to the stack of events that have been caused
-	 * 
+	 *
 	 * @param event The event to add to the list
 	 */
 	static void addEvent(ControllerEvent event) {
diff --git a/src/java/org/lwjgl/input/Cursor.java b/src/java/org/lwjgl/input/Cursor.java
index 256e24c..23d5e8f 100644
--- a/src/java/org/lwjgl/input/Cursor.java
+++ b/src/java/org/lwjgl/input/Cursor.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -45,8 +45,8 @@ import org.lwjgl.Sys;
  * class can be used with Mouse.setCursor(), if available.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 2983 $
- * $Id: Cursor.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: Cursor.java 3418 2010-09-28 21:11:35Z spasi $
  */
 
 public class Cursor {
@@ -61,12 +61,12 @@ public class Cursor {
 
 	/** First element to display */
 	private final CursorElement[] cursors;
-	
+
 	/** Index into list of cursors */
-	private int index = 0;
+	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.
@@ -81,7 +81,7 @@ public class Cursor {
 	 * @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)
@@ -100,8 +100,8 @@ public class Cursor {
 
 			Sys.initialize();
 
-			// Hmm 
-			yHotspot = height - 1 - yHotspot;		
+			// Hmm
+			yHotspot = height - 1 - yHotspot;
 
 			// create cursor (or cursors if multiple images supplied)
 			cursors = createCursors(width, height, xHotspot, yHotspot, numImages, images, delays);
@@ -162,14 +162,14 @@ public class Cursor {
 		// 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:
@@ -178,7 +178,7 @@ public class Cursor {
 				// create our cursor elements
 				cursors = new CursorElement[numImages];
 				for(int i=0; i<numImages; i++) {
-					
+
 					// iterate through the images, and make sure that the pixels are either 0xffxxxxxx or 0x00000000
 					int size = width * height;
 					for(int j=0; j<size; j++) {
@@ -188,7 +188,7 @@ public class Cursor {
 							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();
@@ -208,13 +208,13 @@ public class Cursor {
 				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 height Height of images
 	 * @param numImages How many images to flip
 	 * @param images Source images
 	 * @param images_copy Destination images
@@ -228,7 +228,7 @@ public class Cursor {
 
 	/**
 	 * @param width Width of image
-	 * @param height Height of images 
+	 * @param height Height of images
 	 * @param start_index index into source buffer to copy to
 	 * @param images Source images
 	 * @param images_copy Destination images
@@ -245,8 +245,8 @@ public class Cursor {
 				images_copy.put(index2, temp_pixel);
 			}
 		}
-	}	
-	
+	}
+
 	/**
 	 * Gets the native handle associated with the cursor object.
 	 */
@@ -254,12 +254,12 @@ public class Cursor {
 		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
@@ -276,8 +276,8 @@ public class Cursor {
 					// ignore
 				}
 			}
-			for(int i=0; i<cursors.length; i++) {
-				Mouse.getImplementation().destroyCursor(cursors[i].cursorHandle);
+			for ( CursorElement cursor : cursors ) {
+				Mouse.getImplementation().destroyCursor(cursor.cursorHandle);
 			}
 			destroyed = true;
 		}
@@ -300,24 +300,24 @@ public class Cursor {
 		return cursors.length > 1 && cursors[index].timeout < System.currentTimeMillis();
 	}
 
-	/** 
-	 * Changes to the next cursor 
+	/**
+	 * 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;
 
diff --git a/src/java/org/lwjgl/input/JInputController.java b/src/java/org/lwjgl/input/JInputController.java
index 2bf740d..04e4aa5 100644
--- a/src/java/org/lwjgl/input/JInputController.java
+++ b/src/java/org/lwjgl/input/JInputController.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -34,13 +34,15 @@ 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 {
@@ -49,11 +51,11 @@ class JInputController implements Controller {
 	/** 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();
+	private ArrayList<Component> buttons = new ArrayList<Component>();
 	/** The Axes that have been detected on the JInput controller */
-	private ArrayList axes = new ArrayList();
+	private ArrayList<Component> axes = new ArrayList<Component>();
 	/** The POVs that have been detected on the JInput controller */
-	private ArrayList pov = new ArrayList();
+	private ArrayList<Component> pov = new ArrayList<Component>();
 	/** The state of the buttons last check */
 	private boolean[] buttonState;
 	/** The values that were read from the pov last check */
@@ -76,72 +78,72 @@ class JInputController implements Controller {
 	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
 	 */
-	public JInputController(int index,net.java.games.input.Controller target) {
+	JInputController(int index,net.java.games.input.Controller target) {
 		this.target = target;
 		this.index = index;
-		
+
 		Component[] sourceAxes = target.getComponents();
-		
-		for (int i=0;i<sourceAxes.length;i++) {
-			if (sourceAxes[i].getIdentifier() instanceof Component.Identifier.Button) {
-				buttons.add(sourceAxes[i]);		
-			} else if (sourceAxes[i].getIdentifier().equals(Component.Identifier.Axis.POV)) {
-				pov.add(sourceAxes[i]);
+
+		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(sourceAxes[i]);
+				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 (int i=0;i<sourceAxes.length;i++) {
-			if (sourceAxes[i].getIdentifier() instanceof Component.Identifier.Button) {
-				buttonState[buttonsCount] = sourceAxes[i].getPollData() != 0;
+		for ( Component sourceAxis : sourceAxes ) {
+			if ( sourceAxis.getIdentifier() instanceof Button ) {
+				buttonState[buttonsCount] = sourceAxis.getPollData() != 0;
 				buttonsCount++;
-			} else if (sourceAxes[i].getIdentifier().equals(Component.Identifier.Axis.POV)) {
+			} else if ( sourceAxis.getIdentifier().equals(Axis.POV) ) {
 				// no account for POV yet
 				// pov.add(sourceAxes[i]);
 			} else {
-				axesValue[axesCount] = sourceAxes[i].getPollData();
-				if (sourceAxes[i].getIdentifier().equals(Component.Identifier.Axis.X)) {
+				axesValue[axesCount] = sourceAxis.getPollData();
+				if ( sourceAxis.getIdentifier().equals(Axis.X) ) {
 					xaxis = axesCount;
 				}
-				if (sourceAxes[i].getIdentifier().equals(Component.Identifier.Axis.Y)) {
+				if ( sourceAxis.getIdentifier().equals(Axis.Y) ) {
 					yaxis = axesCount;
 				}
-				if (sourceAxes[i].getIdentifier().equals(Component.Identifier.Axis.Z)) {
+				if ( sourceAxis.getIdentifier().equals(Axis.Z) ) {
 					zaxis = axesCount;
 				}
-				if (sourceAxes[i].getIdentifier().equals(Component.Identifier.Axis.RX)) {
+				if ( sourceAxis.getIdentifier().equals(Axis.RX) ) {
 					rxaxis = axesCount;
 				}
-				if (sourceAxes[i].getIdentifier().equals(Component.Identifier.Axis.RY)) {
+				if ( sourceAxis.getIdentifier().equals(Axis.RY) ) {
 					ryaxis = axesCount;
 				}
-				if (sourceAxes[i].getIdentifier().equals(Component.Identifier.Axis.RZ)) {
+				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.length;i++) {
 			axesMax[i] = 1.0f;
 			deadZones[i] = 0.05f;
@@ -174,9 +176,7 @@ class JInputController implements Controller {
 	 * @see org.lwjgl.input.Controller#getButtonName(int)
 	 */
 	public String getButtonName(int index) {
-		Component button = (Component) buttons.get(index);
-		
-		return button.getName();
+		return buttons.get(index).getName();
 	}
 
 	/*
@@ -191,10 +191,10 @@ class JInputController implements Controller {
 	 */
 	public void poll() {
 		target.poll();
-		
+
 		Event event = new Event();
 		EventQueue queue = target.getEventQueue();
-		
+
 		while (queue.getNextEvent(event)) {
 			// handle button event
 			if (buttons.contains(event.getComponent())) {
@@ -205,7 +205,7 @@ class JInputController implements Controller {
 				// fire button pressed event
 				Controllers.addEvent(new ControllerEvent(this,event.getNanos(),ControllerEvent.BUTTON,buttonIndex,false,false));
 			}
-			
+
 			// handle pov events
 			if (pov.contains(event.getComponent())) {
 				Component povComponent = event.getComponent();
@@ -221,13 +221,13 @@ class JInputController implements Controller {
 					Controllers.addEvent(new ControllerEvent(this,event.getNanos(),ControllerEvent.POVY,0,false,false));
 				}
 			}
-			
+
 			// handle axis updates
 			if (axes.contains(event.getComponent())) {
 				Component axis = event.getComponent();
 				int axisIndex = axes.indexOf(axis);
 				float value = axis.getPollData();
-				
+
 				// fixed dead zone since most axis don't report it :(
 				if (Math.abs(value) < deadZones[axisIndex]) {
 					value = 0;
@@ -238,7 +238,7 @@ class JInputController implements Controller {
 				if (Math.abs(value) > axesMax[axisIndex]) {
 					axesMax[axisIndex] = Math.abs(value);
 				}
-				
+
 				// normalize the value based on maximum value read in the past
 				value /= axesMax[axisIndex];
 				// fire event
@@ -260,9 +260,7 @@ class JInputController implements Controller {
 	 * @see org.lwjgl.input.Controller#getAxisName(int)
 	 */
 	public String getAxisName(int index) {
-		Component axis = (Component) axes.get(index);
-		
-		return axis.getName();
+		return axes.get(index).getName();
 	}
 
 	/*
@@ -279,7 +277,7 @@ class JInputController implements Controller {
 		if (xaxis == -1) {
 			return 0;
 		}
-		
+
 		return getAxisValue(xaxis);
 	}
 
@@ -290,7 +288,7 @@ class JInputController implements Controller {
 		if (yaxis == -1) {
 			return 0;
 		}
-		
+
 		return getAxisValue(yaxis);
 	}
 
@@ -301,7 +299,7 @@ class JInputController implements Controller {
 		if (xaxis == -1) {
 			return 0;
 		}
-		
+
 		return getDeadZone(xaxis);
 	}
 
@@ -312,7 +310,7 @@ class JInputController implements Controller {
 		if (yaxis == -1) {
 			return 0;
 		}
-		
+
 		return getDeadZone(yaxis);
 	}
 
@@ -351,7 +349,7 @@ class JInputController implements Controller {
 		if (zaxis == -1) {
 			return 0;
 		}
-		
+
 		return getAxisValue(zaxis);
 	}
 
@@ -362,7 +360,7 @@ class JInputController implements Controller {
 		if (zaxis == -1) {
 			return 0;
 		}
-		
+
 		return getDeadZone(zaxis);
 	}
 
@@ -380,7 +378,7 @@ class JInputController implements Controller {
 		if (rxaxis == -1) {
 			return 0;
 		}
-		
+
 		return getAxisValue(rxaxis);
 	}
 
@@ -391,7 +389,7 @@ class JInputController implements Controller {
 		if (rxaxis == -1) {
 			return 0;
 		}
-		
+
 		return getDeadZone(rxaxis);
 	}
 
@@ -409,7 +407,7 @@ class JInputController implements Controller {
 		if (ryaxis == -1) {
 			return 0;
 		}
-		
+
 		return getAxisValue(ryaxis);
 	}
 
@@ -420,7 +418,7 @@ class JInputController implements Controller {
 		if (ryaxis == -1) {
 			return 0;
 		}
-		
+
 		return getDeadZone(ryaxis);
 	}
 
@@ -438,7 +436,7 @@ class JInputController implements Controller {
 		if (rzaxis == -1) {
 			return 0;
 		}
-		
+
 		return getAxisValue(rzaxis);
 	}
 
@@ -449,7 +447,7 @@ class JInputController implements Controller {
 		if (rzaxis == -1) {
 			return 0;
 		}
-		
+
 		return getDeadZone(rzaxis);
 	}
 
@@ -467,20 +465,20 @@ class JInputController implements Controller {
 		if (pov.size() == 0) {
 			return 0;
 		}
-		
+
 		float value = povValues[0];
-		
-		if ((value == Component.POV.DOWN_LEFT) || 
+
+		if ((value == Component.POV.DOWN_LEFT) ||
 		    (value == Component.POV.UP_LEFT) ||
 		    (value == Component.POV.LEFT)) {
 			return -1;
 		}
-		if ((value == Component.POV.DOWN_RIGHT) || 
+		if ((value == Component.POV.DOWN_RIGHT) ||
 		    (value == Component.POV.UP_RIGHT) ||
 		    (value == Component.POV.RIGHT)) {
 			return 1;
 		}
-		
+
 		return 0;
 	}
 
@@ -491,22 +489,22 @@ class JInputController implements Controller {
 		if (pov.size() == 0) {
 			return 0;
 		}
-		
+
 		float value = povValues[0];
-		
-		if ((value == Component.POV.DOWN_LEFT) || 
+
+		if ((value == Component.POV.DOWN_LEFT) ||
 		    (value == Component.POV.DOWN_RIGHT) ||
 		    (value == Component.POV.DOWN)) {
 			return 1;
 		}
-		if ((value == Component.POV.UP_LEFT) || 
+		if ((value == Component.POV.UP_LEFT) ||
 		    (value == Component.POV.UP_RIGHT) ||
 		    (value == Component.POV.UP)) {
 			return -1;
 		}
-		
+
 		return 0;
 	}
-	
-	
+
+
 }
diff --git a/src/java/org/lwjgl/input/Keyboard.java b/src/java/org/lwjgl/input/Keyboard.java
index 10d8d14..dd4d060 100644
--- a/src/java/org/lwjgl/input/Keyboard.java
+++ b/src/java/org/lwjgl/input/Keyboard.java
@@ -51,8 +51,8 @@ import org.lwjgl.opengl.InputImplementation;
  * @author cix_foo <cix_foo at users.sourceforge.net>
  * @author elias_naur <elias_naur at users.sourceforge.net>
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 2983 $
- * $Id: Keyboard.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3463 $
+ * $Id: Keyboard.java 3463 2010-12-15 18:48:56Z kappa1 $
  */
 public class Keyboard {
 	/** Internal use - event size in bytes */
@@ -217,25 +217,25 @@ public class Keyboard {
 
 	/** Key names */
 	private static final String[] keyName = new String[255];
-	private static final Map keyMap = new HashMap(253);
+	private static final Map<String, Integer> keyMap = new HashMap<String, Integer>(253);
 	private static int counter;
 
 	static {
 		// Use reflection to find out key names
-		Field[] field = Keyboard.class.getFields();
+		Field[] fields = Keyboard.class.getFields();
 		try {
-			for (int i = 0; i < field.length; i++) {
-				if (Modifier.isStatic(field[i].getModifiers())
-					&& Modifier.isPublic(field[i].getModifiers())
-					&& Modifier.isFinal(field[i].getModifiers())
-					&& field[i].getType().equals(int.class)
-					&& field[i].getName().startsWith("KEY_")) {
-
-					int key = field[i].getInt(null);
-					String name = field[i].getName().substring(4);
+			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, new Integer(key));
-					counter ++;
+					keyMap.put(name, key);
+					counter++;
 				}
 
 			}
@@ -355,7 +355,7 @@ public class Keyboard {
 	 * Polls the keyboard for its current state. Access the polled values using the
 	 * <code>isKeyDown</code> method.
 	 * By using this method, it is possible to "miss" keyboard keys if you don't
-	 * poll fast enough. 
+	 * poll fast enough.
 	 *
 	 * To use buffered values, you have to call <code>next</code> for each event you
 	 * want to read. You can query which key caused the event by using
@@ -426,11 +426,11 @@ public class Keyboard {
 	 * @param keyName The key name
 	 */
 	public static synchronized int getKeyIndex(String keyName) {
-		Integer ret = (Integer) keyMap.get(keyName);
+		Integer ret = keyMap.get(keyName);
 		if (ret == null)
 			return KEY_NONE;
 		else
-			return ret.intValue();
+			return ret;
 	}
 
 	/**
@@ -531,7 +531,7 @@ public class Keyboard {
    * 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() {
@@ -541,7 +541,7 @@ public class Keyboard {
 	}
 
 	/**
-	 * Gets the state of the tkey that generated the
+	 * Gets the state of the key that generated the
 	 * current event
 	 *
 	 * @return True if key was down, or false if released
@@ -576,7 +576,7 @@ public class Keyboard {
 		}
 	}
 
-	private final static class KeyEvent {
+	private static final class KeyEvent {
 		/** The current keyboard character being examined */
 		private int character;
 
diff --git a/src/java/org/lwjgl/input/Mouse.java b/src/java/org/lwjgl/input/Mouse.java
index 06cabc8..a14d6a6 100644
--- a/src/java/org/lwjgl/input/Mouse.java
+++ b/src/java/org/lwjgl/input/Mouse.java
@@ -59,8 +59,8 @@ import org.lwjgl.opengl.InputImplementation;
  * @author cix_foo <cix_foo at users.sourceforge.net>
  * @author elias_naur <elias_naur at users.sourceforge.net>
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 3337 $
- * $Id: Mouse.java 3337 2010-04-29 17:37:18Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: Mouse.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public class Mouse {
 	/** Internal use - event size in bytes */
@@ -103,7 +103,7 @@ public class Mouse {
 	private static String[]		buttonName;
 
 	/** hashmap of button names, for fast lookup */
-	private static final Map	buttonMap									= new HashMap(16);
+	private static final Map<String, Integer>	buttonMap									= new HashMap<String, Integer>(16);
 
 	/** Lazy initialization */
 	private static boolean		initialized;
@@ -135,9 +135,9 @@ public class Mouse {
 	private static boolean		isGrabbed;
 
 	private static InputImplementation implementation;
-  
+
 	/** Whether we need cursor animation emulation */
-	private static final boolean emulateCursorAnimation = 	LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_WINDOWS || 
+	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");
@@ -213,7 +213,7 @@ public class Mouse {
 			}
 		}
 	}
-	
+
 	/**
 	 * Static initialization
 	 */
@@ -224,7 +224,7 @@ public class Mouse {
 		buttonName = new String[16];
 		for (int i = 0; i < 16; i++) {
 			buttonName[i] = "BUTTON" + i;
-			buttonMap.put(buttonName[i], new Integer(i));
+			buttonMap.put(buttonName[i], i);
 		}
 
 		initialized = true;
@@ -308,7 +308,7 @@ public class Mouse {
 	 * Polls the mouse for its current state. Access the polled values using the
 	 * get<value> methods.
 	 * By using this method, it is possible to "miss" mouse click events if you don't
-	 * poll fast enough. 
+	 * poll fast enough.
 	 *
 	 * To use buffered values, you have to call <code>next</code> for each event you
 	 * want to read. You can query which button caused the event by using
@@ -401,11 +401,11 @@ public class Mouse {
 	 */
 	public static int getButtonIndex(String buttonName) {
 		synchronized (OpenGLPackageAccess.global_lock) {
-			Integer ret = (Integer) buttonMap.get(buttonName);
+			Integer ret = buttonMap.get(buttonName);
 			if (ret == null)
 				return -1;
 			else
-				return ret.intValue();
+				return ret;
 		}
 	}
 
@@ -626,13 +626,13 @@ public class Mouse {
 					// 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();
@@ -663,12 +663,12 @@ public class Mouse {
 
         /** Gets a boolean property as a privileged action. */
 	static boolean getPrivilegedBoolean(final String property_name) {
-		Boolean value = (Boolean)AccessController.doPrivileged(new PrivilegedAction() {
-			public Object run() {
-				return new Boolean(Boolean.getBoolean(property_name));
+		Boolean value = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+			public Boolean run() {
+				return Boolean.getBoolean(property_name);
 			}
 		});
-		return value.booleanValue();
+		return value;
 	}
 
         /**
diff --git a/src/java/org/lwjgl/input/OpenGLPackageAccess.java b/src/java/org/lwjgl/input/OpenGLPackageAccess.java
index c4cb792..fc21336 100644
--- a/src/java/org/lwjgl/input/OpenGLPackageAccess.java
+++ b/src/java/org/lwjgl/input/OpenGLPackageAccess.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -45,11 +45,11 @@ import java.security.PrivilegedActionException;
  * package through (privileged) reflection.
  */
 final class OpenGLPackageAccess {
-	final static Object global_lock;
+	static final Object global_lock;
 
 	static {
 		try {
-			global_lock = AccessController.doPrivileged(new PrivilegedExceptionAction() {
+			global_lock = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
 				public Object run() throws Exception {
 					Field lock_field = Class.forName("org.lwjgl.opengl.GlobalLock").getDeclaredField("lock");
 					lock_field.setAccessible(true);
@@ -66,11 +66,11 @@ final class OpenGLPackageAccess {
 		 * public
 		 */
 		try {
-			return (InputImplementation)AccessController.doPrivileged(new PrivilegedExceptionAction() {
-				public Object run() throws Exception {
-					Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation", null);
+			return AccessController.doPrivileged(new PrivilegedExceptionAction<InputImplementation>() {
+				public InputImplementation run() throws Exception {
+					Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation");
 					getImplementation_method.setAccessible(true);
-					return getImplementation_method.invoke(null, null);
+					return (InputImplementation)getImplementation_method.invoke(null);
 				}
 			});
 		} catch (PrivilegedActionException e) {
diff --git a/src/java/org/lwjgl/openal/AL.java b/src/java/org/lwjgl/openal/AL.java
index 9c9bc70..b6e8bec 100644
--- a/src/java/org/lwjgl/openal/AL.java
+++ b/src/java/org/lwjgl/openal/AL.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -42,19 +42,19 @@ import org.lwjgl.Sys;
  * </p>
  *
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 3348 $
- * $Id: AL.java 3348 2010-05-24 21:54:37Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: AL.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public final class AL {
 	/** ALCdevice instance. */
-	protected static ALCdevice device;
+	static ALCdevice device;
 
 	/** Current ALCcontext. */
-	protected static ALCcontext context;
+	static ALCcontext context;
 
 	/** Have we been created? */
 	private static boolean created;
-	
+
 	static {
 		Sys.initialize();
 	}
@@ -64,16 +64,14 @@ public final class AL {
 
 	/**
 	 * Native method to create AL instance
-	 * 
-	 * @param oalPaths Array of strings containing paths to search for OpenAL library
+	 *
+	 * @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.
-	 * 
-	 * @param oalPaths Array of strings containing paths to search for OpenAL library
 	 */
 	private static native void nCreateDefault() throws LWJGLException;
 
@@ -81,36 +79,36 @@ public final class AL {
 	 * 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. 
-	 * 
+	 * 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) 
+	 * @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;
@@ -133,14 +131,14 @@ public final class AL {
 		}
 		String[] oalPaths = LWJGLUtil.getLibraryPaths(libname, library_names, AL.class.getClassLoader());
 		LWJGLUtil.log("Found " + oalPaths.length + " OpenAL paths");
-		for (int i = 0; i < oalPaths.length; i++) {
+		for ( String oalPath : oalPaths ) {
 			try {
-				nCreate(oalPaths[i]);
+				nCreate(oalPath);
 				created = true;
 				init(deviceArguments, contextFrequency, contextRefresh, contextSynchronized, openDevice);
 				break;
 			} catch (LWJGLException e) {
-				LWJGLUtil.log("Failed to load " + oalPaths[i] + ": " + e.getMessage());
+				LWJGLUtil.log("Failed to load " + oalPath + ": " + e.getMessage());
 			}
 		}
 		if (!created && LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX) {
@@ -157,18 +155,18 @@ public final class AL {
 		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, 
+							ALCcontext.createAttributeList(contextFrequency, contextRefresh,
 								contextSynchronized ? ALC10.ALC_TRUE : ALC10.ALC_FALSE));
 				}
 				ALC10.alcMakeContextCurrent(context);
@@ -177,7 +175,7 @@ public final class AL {
 			destroy();
 			throw e;
 		}
-				
+
 		ALC11.initialize();
 
 		// Load EFX10 native stubs if ALC_EXT_EFX is supported.
@@ -197,7 +195,7 @@ public final class AL {
 	 * 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. 
+	 * it defaults to 44100Hz mixing @ 60Hz refresh.
 	 */
 	public static void create() throws LWJGLException {
 		create(null, 44100, 60, false);
@@ -228,7 +226,7 @@ public final class AL {
 	}
 
 	private static native void resetNativeStubs(Class clazz);
-	
+
 	/**
 	 * @return handle to the default AL context.
 	 */
diff --git a/src/java/org/lwjgl/openal/ALC10.java b/src/java/org/lwjgl/openal/ALC10.java
index 1125060..5ad66bd 100644
--- a/src/java/org/lwjgl/openal/ALC10.java
+++ b/src/java/org/lwjgl/openal/ALC10.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -39,7 +39,7 @@ import org.lwjgl.BufferChecks;
 import org.lwjgl.LWJGLException;
 
 /**
- * 
+ *
  * <p>
  * 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
@@ -49,19 +49,19 @@ import org.lwjgl.LWJGLException;
  * implementation, which has to map the available backends to unique device
  * specifiers (represented as strings).
  * </p>
- * 
+ *
  * @author Brian Matzon <brian at matzon.dk>
  * @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 HashMap contexts = new HashMap();
-	
+	static final HashMap<Long, ALCcontext> contexts = new HashMap<Long, ALCcontext>();
+
 	/** List of active devices */
-	static HashMap devices = new HashMap();	
-	
+	static final HashMap<Long, ALCdevice> devices = new HashMap<Long, ALCdevice>();
+
 	/** Bad value */
 	public static final int ALC_INVALID = 0;
 
@@ -80,7 +80,7 @@ public final class ALC10 {
 	/** 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;
@@ -116,7 +116,7 @@ public final class ALC10 {
 	public static final int ALC_INVALID_CONTEXT = 0xA002;
 
 	/**
-	 * A function was called at inappropriate time, or in an inappropriate way, 
+	 * 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.
 	 */
@@ -129,24 +129,24 @@ public final class ALC10 {
 	public static final int ALC_INVALID_VALUE = 0xA004;
 
 	/**
-	 * A function could not be completed, because there is not enough 
+	 * 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.
-	 * 
+	 *
 	 * <code>ALC_DEFAULT_DEVICE_SPECIFIER</code> - The specifer string for the default device
-	 * <code>ALC_DEVICE_SPECIFIER</code> - The specifer string for the device 
+	 * <code>ALC_DEVICE_SPECIFIER</code> - The specifer string for the device
 	 * <code>ALC_EXTENSIONS</code> - The extensions string for diagnostics and printing.
 	 *
 	 * In addition, printable error message strings are provided for all valid error tokens,
 	 * including <code>ALC_NO_ERROR</code>,<code>ALC_INVALID_DEVICE</code>, <code>ALC_INVALID_CONTEXT</code>,
 	 * <code>ALC_INVALID_ENUM</code>, <code>ALC_INVALID_VALUE</code>.
-	 * 
+	 *
 	 * @param pname Property to get
 	 * @return String property from device
 	 */
@@ -156,7 +156,7 @@ public final class ALC10 {
 		Util.checkALCError(device);
 		return result;
 	}
-	native static String nalcGetString(long device, int pname);
+	static native String nalcGetString(long device, int pname);
 
 	/**
 	 * The application can query ALC for information using an integer query function.
@@ -164,11 +164,11 @@ public final class ALC10 {
 	* device will generate an <code>ALC_INVALID_DEVICE</code> error. The application has to
 	* specify the size of the destination buffer provided. A <code>null</code> destination or a zero
 	* size parameter will cause ALC to ignore the query.
-	* 
+	*
 	* <code>ALC_MAJOR_VERSION</code> - Major version query.
 	* <code>ALC_MINOR_VERSION</code> - Minor version query.
-	* <code>ALC_ATTRIBUTES_SIZE</code> - The size required for the zero-terminated attributes list, 
-	* for the current context. <code>null</code> is an invalid device. <code>null</code> (no current context 
+	* <code>ALC_ATTRIBUTES_SIZE</code> - The size required for the zero-terminated attributes list,
+	* for the current context. <code>null</code> is an invalid device. <code>null</code> (no current context
 	* for the specified device) is legal.
 	* <code>ALC_ALL_ATTRIBUTES</code> - Expects a destination of <code>ALC_CURRENT_ATTRIBUTES_SIZE</code>,
 	* and provides the attribute list for the current context of the specified device.
@@ -183,7 +183,7 @@ public final class ALC10 {
 		nalcGetIntegerv(getDevice(device), pname, integerdata.remaining(), integerdata, integerdata.position());
 		Util.checkALCError(device);
 	}
-	native static void nalcGetIntegerv(long device, int pname, int size, Buffer integerdata, int offset);
+	static native void nalcGetIntegerv(long device, int pname, int size, Buffer integerdata, int offset);
 
 	/**
 	 * The <code>alcOpenDevice</code> function allows the application (i.e. the client program) to
@@ -202,18 +202,18 @@ public final class ALC10 {
 		if(device_address != 0) {
 			ALCdevice device = new ALCdevice(device_address);
 			synchronized (ALC10.devices) {
-				devices.put(new Long(device_address), device);
+				devices.put(device_address, device);
 			}
 			return device;
 		}
 		return null;
 	}
-	native static long nalcOpenDevice(String devicename);
+	static native long nalcOpenDevice(String devicename);
 
 	/**
 	 * The <code>alcCloseDevice</code> function allows the application (i.e. the client program) to
 	* disconnect from a device (i.e. the server).
-	* 
+	*
 	* If deviceHandle is <code>null</code> or invalid, an <code>ALC_INVALID_DEVICE</code> error will be
 	* generated. Once closed, a deviceHandle is invalid.
 	 *
@@ -226,15 +226,15 @@ public final class ALC10 {
 			devices.remove(new Long(device.device));
 		}
 		return result;
-		
+
 	}
-	native static boolean nalcCloseDevice(long device);
+	static native boolean nalcCloseDevice(long device);
 
 	/**
 	 * A context is created using <code>alcCreateContext</code>. The device parameter has to be a valid
 	* device. The attribute list can be <code>null</code>, 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
@@ -248,25 +248,25 @@ public final class ALC10 {
 	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(new Long(context_address), context);
+				contexts.put(context_address, context);
 				device.addContext(context);
 			}
 			return context;
 		}
 		return null;
 	}
-	native static long nalcCreateContext(long device, IntBuffer attrList);
+	static native long nalcCreateContext(long device, IntBuffer attrList);
 
 	/**
 	 * To make a Context current with respect to AL Operation (state changes by issueing
 	* commands), <code>alcMakeContextCurrent</code> is used. The context parameter can be <code>null</code>
 	* 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
@@ -278,7 +278,7 @@ public final class ALC10 {
 	public static int alcMakeContextCurrent(ALCcontext context) {
 		return nalcMakeContextCurrent(getContext(context));
 	}
-	native static int nalcMakeContextCurrent(long context);
+	static native int nalcMakeContextCurrent(long context);
 
 	/**
 	 * The current context is the only context accessible to state changes by AL commands
@@ -294,7 +294,7 @@ public final class ALC10 {
 	public static void alcProcessContext(ALCcontext context) {
 		nalcProcessContext(getContext(context));
 	}
-	native static void nalcProcessContext(long context);
+	static native void nalcProcessContext(long context);
 
 	/**
 	 * The application can query for, and obtain an handle to, the current context for the
@@ -307,12 +307,12 @@ public final class ALC10 {
 		long context_address = nalcGetCurrentContext();
 		if(context_address != 0) {
 			synchronized (ALC10.contexts) {
-				context = (ALCcontext) ALC10.contexts.get(new Long(context_address));
+				context = ALC10.contexts.get(context_address);
 			}
 		}
 		return context;
 	}
-	native static long nalcGetCurrentContext();
+	static native long nalcGetCurrentContext();
 
 	/**
 	 * The application can query for, and obtain an handle to, the device of a given context.
@@ -324,19 +324,19 @@ public final class ALC10 {
 		long device_address = nalcGetContextsDevice(getContext(context));
 		if (device_address != 0) {
 			synchronized (ALC10.devices) {
-				device = (ALCdevice) ALC10.devices.get(new Long(device_address));
+				device = ALC10.devices.get(device_address);
 			}
 		}
 		return device;
-	}	
-	native static long nalcGetContextsDevice(long context);
+	}
+	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 <code>alcSuspendContext</code>.
-	 * 
+	 *
 	 * Repeated calls to <code>alcSuspendContext</code> are legal, and do not affect a context that is
 	 * already marked as suspended. The default state of a context created by
 	 * <code>alcCreateContext</code> is that it is marked as suspended.
@@ -346,7 +346,7 @@ public final class ALC10 {
 	public static void alcSuspendContext(ALCcontext context) {
 		nalcSuspendContext(getContext(context));
 	}
-	native static void nalcSuspendContext(long context);
+	static native void nalcSuspendContext(long context);
 
 	/**
 	 * The correct way to destroy a context is to first release it using <code>alcMakeCurrent</code> and
@@ -362,15 +362,15 @@ public final class ALC10 {
 			context.setInvalid();
 		}
 	}
-	native static void nalcDestroyContext(long context);
+	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 <code>alcGetError</code> 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.
 	* <code>ALC_INVALID_DEVICE</code> - The Context argument does not name a valid context.
 	* <code>ALC_INVALID_CONTEXT</code> - The Context argument does not name a valid context.
@@ -382,7 +382,7 @@ public final class ALC10 {
 	public static int alcGetError(ALCdevice device) {
 		return nalcGetError(getDevice(device));
 	}
-	native static int nalcGetError(long device);
+	static native int nalcGetError(long device);
 
 	/**
 	* Verify that a given extension is available for the current context and the device it
@@ -398,13 +398,13 @@ public final class ALC10 {
 		Util.checkALCError(device);
 		return result;
 	}
-	native static boolean nalcIsExtensionPresent(long device, String extName);
+	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 <code>null</code> name parameter will cause an <code>ALC_INVALID_VALUE</code> error.
 	 *
 	 * @param enumName name of enum to find
@@ -415,8 +415,8 @@ public final class ALC10 {
 		Util.checkALCError(device);
 		return result;
 	}
-	native static int nalcGetEnumValue(long device, String enumName);
-	
+	static native int nalcGetEnumValue(long device, String enumName);
+
 	static long getDevice(ALCdevice device) {
 		if(device != null) {
 			Util.checkALCValidDevice(device);
@@ -424,13 +424,13 @@ public final class ALC10 {
 		}
 		return 0L;
 	}
-	
+
 	static long getContext(ALCcontext context) {
 		if(context != null) {
 			Util.checkALCValidContext(context);
 			return context.context;
 		}
 		return 0L;
-	}	
+	}
 
 }
diff --git a/src/java/org/lwjgl/openal/ALC11.java b/src/java/org/lwjgl/openal/ALC11.java
index 1f7f88d..a1708cd 100644
--- a/src/java/org/lwjgl/openal/ALC11.java
+++ b/src/java/org/lwjgl/openal/ALC11.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -41,33 +41,33 @@ import org.lwjgl.LWJGLUtil;
 
 /**
  * <p>
- * The ALC11 class implements features in OpenAL 1.1, specifically 
+ * The ALC11 class implements features in OpenAL 1.1, specifically
  * ALC methods and properties.
  * </p>
- * 
+ *
  * @author Brian Matzon <brian at matzon.dk>
  * @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
@@ -82,9 +82,9 @@ public final class ALC11 {
 	 * 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.
-	 * 
+	 *
 	 * <i>LWJGL SPECIFIC: the actual created device is managed internally in lwjgl</i>
-	 * 
+	 *
 	 * @param devicename Name of device to open for capture
 	 * @param frequency Frequency of samples to capture
 	 * @param format Format of samples to capture
@@ -96,18 +96,18 @@ public final class ALC11 {
 		if(device_address != 0) {
 			ALCdevice device = new ALCdevice(device_address);
 			synchronized (ALC10.devices) {
-				ALC10.devices.put(new Long(device_address), device);
+				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.
@@ -126,7 +126,7 @@ public final class ALC11 {
 	/**
 	 * 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
@@ -137,7 +137,7 @@ public final class ALC11 {
 		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.
@@ -153,11 +153,11 @@ public final class ALC11 {
 	/**
 	 * 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
 	 */
@@ -165,9 +165,9 @@ public final class ALC11 {
 		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
@@ -178,18 +178,18 @@ public final class ALC11 {
 			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+ 
+
+			// 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);
diff --git a/src/java/org/lwjgl/openal/ALCcontext.java b/src/java/org/lwjgl/openal/ALCcontext.java
index c7c8d39..2dabd18 100644
--- a/src/java/org/lwjgl/openal/ALCcontext.java
+++ b/src/java/org/lwjgl/openal/ALCcontext.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -37,7 +37,7 @@ 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
@@ -46,20 +46,20 @@ import org.lwjgl.BufferUtils;
  * AL and ALC are threadsafe.
  *
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 2983 $
- * $Id: ALCcontext.java 2983 2008-04-07 18:36:09Z 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 = false;
-	
-	/** 
-	 * Creates a new instance of ALCcontext 
-	 * 
+	private boolean valid;
+
+	/**
+	 * Creates a new instance of ALCcontext
+	 *
 	 * @param context address of actual context
 	 */
 	ALCcontext(long context) {
@@ -97,19 +97,19 @@ public final class ALCcontext {
 
 		return attribList;
 	}
-	
+
 	/**
 	 * Marks this context as invalid
 	 *
 	 */
 	void setInvalid() {
 		valid = false;
-	}    
-	
+	}
+
 	/**
 	 * @return true if this context is still valid
 	 */
 	public boolean isValid() {
 		return valid;
-	}	
+	}
 }
diff --git a/src/java/org/lwjgl/openal/ALCdevice.java b/src/java/org/lwjgl/openal/ALCdevice.java
index 887839f..3329770 100644
--- a/src/java/org/lwjgl/openal/ALCdevice.java
+++ b/src/java/org/lwjgl/openal/ALCdevice.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -36,7 +36,7 @@ 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
@@ -45,22 +45,22 @@ import java.util.Iterator;
  * which has to map the available backends to unique device specifiers.
  *
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 2983 $
- * $Id: ALCdevice.java 2983 2008-04-07 18:36:09Z 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 = false;
-    
+    private boolean valid;
+
 	/** List of contexts belonging to the device */
-	private HashMap contexts = new HashMap();
-    
-    /** 
-     * Creates a new instance of ALCdevice 
+	private final HashMap<Long, ALCcontext> contexts = new HashMap<Long, ALCcontext>();
+
+    /**
+     * Creates a new instance of ALCdevice
      *
      * @param device address of actual device
      */
@@ -68,7 +68,7 @@ public final class ALCdevice {
         this.device = device;
         this.valid = true;
     }
-    
+
     /*
      * @see java.lang.Object#equals(java.lang.Object)
      */
@@ -78,28 +78,28 @@ public final class ALCdevice {
 		}
 		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(new Long(context.context), context);
+			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(new Long(context.context));
-		}		
-	}	
+			contexts.remove(context.context);
+		}
+	}
 
 	/**
 	 * Marks this device and all of its contexts invalid
@@ -107,14 +107,12 @@ public final class ALCdevice {
 	void setInvalid() {
 		valid = false;
 		synchronized (contexts) {
-			for(Iterator i = contexts.values().iterator(); i.hasNext();) {
-				ALCcontext context = (ALCcontext) i.next();
+			for ( ALCcontext context : contexts.values() )
 				context.setInvalid();
-			}
 		}
 		contexts.clear();
-	}    
-	
+	}
+
 	/**
 	 * @return true if this device is still valid
 	 */
diff --git a/src/java/org/lwjgl/openal/EFXUtil.java b/src/java/org/lwjgl/openal/EFXUtil.java
index 780e3f6..c028e74 100644
--- a/src/java/org/lwjgl/openal/EFXUtil.java
+++ b/src/java/org/lwjgl/openal/EFXUtil.java
@@ -1,36 +1,39 @@
-/* 
+/*
  * 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 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 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.
@@ -62,7 +65,7 @@ public final class EFXUtil {
         if (!AL.isCreated()) {
             throw new OpenALException("OpenAL has not been created.");
         }
-        return ALC10.alcIsExtensionPresent(AL.getDevice(), EFX10.ALC_EXT_EFX_NAME);
+        return ALC10.alcIsExtensionPresent(AL.getDevice(), ALC_EXT_EFX_NAME);
     }
 
     /**
@@ -78,20 +81,20 @@ public final class EFXUtil {
     public static boolean isEffectSupported(final int effectType) {
         // Make sure type is a real effect.
         switch (effectType) {
-            case EFX10.AL_EFFECT_NULL:
-            case EFX10.AL_EFFECT_EAXREVERB:
-            case EFX10.AL_EFFECT_REVERB:
-            case EFX10.AL_EFFECT_CHORUS:
-            case EFX10.AL_EFFECT_DISTORTION:
-            case EFX10.AL_EFFECT_ECHO:
-            case EFX10.AL_EFFECT_FLANGER:
-            case EFX10.AL_EFFECT_FREQUENCY_SHIFTER:
-            case EFX10.AL_EFFECT_VOCAL_MORPHER:
-            case EFX10.AL_EFFECT_PITCH_SHIFTER:
-            case EFX10.AL_EFFECT_RING_MODULATOR:
-            case EFX10.AL_EFFECT_AUTOWAH:
-            case EFX10.AL_EFFECT_COMPRESSOR:
-            case EFX10.AL_EFFECT_EQUALIZER:
+            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);
@@ -113,10 +116,10 @@ public final class EFXUtil {
     public static boolean isFilterSupported(final int filterType) {
         // Make sure type is a real filter.
         switch (filterType) {
-            case EFX10.AL_FILTER_NULL:
-            case EFX10.AL_FILTER_LOWPASS:
-            case EFX10.AL_FILTER_HIGHPASS:
-            case EFX10.AL_FILTER_BANDPASS:
+            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);
@@ -148,54 +151,54 @@ public final class EFXUtil {
         if (isEfxSupported()) {
 
             // Try to create object in order to check AL's response.
-            AL10.alGetError();
+            alGetError();
             int genError;
             int testObject = 0;
             try {
                 switch (objectType) { // Create object based on type
                     case EFFECT:
-                        testObject = EFX10.alGenEffects();
+                        testObject = alGenEffects();
                         break;
                     case FILTER:
-                        testObject = EFX10.alGenFilters();
+                        testObject = alGenFilters();
                         break;
                     default:
                         throw new IllegalArgumentException("Invalid objectType: " + objectType);
                 }
-                genError = AL10.alGetError();
+                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 = AL10.AL_OUT_OF_MEMORY;
+                    genError = AL_OUT_OF_MEMORY;
                 } else {
-                    genError = AL10.AL_INVALID_OPERATION;
+                    genError = AL_INVALID_OPERATION;
                 }
             }
 
-            if (genError == AL10.AL_NO_ERROR) {
+            if (genError == AL_NO_ERROR) {
                 // Successfully created, now try to set type.
-                AL10.alGetError();
+                alGetError();
                 int setError;
                 try {
                     switch (objectType) { // Set based on object type
                         case EFFECT:
-                            EFX10.alEffecti(testObject, EFX10.AL_EFFECT_TYPE, typeValue);
+                            alEffecti(testObject, AL_EFFECT_TYPE, typeValue);
                             break;
                         case FILTER:
-                            EFX10.alFilteri(testObject, EFX10.AL_FILTER_TYPE, typeValue);
+                            alFilteri(testObject, AL_FILTER_TYPE, typeValue);
                             break;
                         default:
                             throw new IllegalArgumentException("Invalid objectType: " + objectType);
                     }
-                    setError = AL10.alGetError();
+                    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 = AL10.AL_INVALID_VALUE;
+                    setError = AL_INVALID_VALUE;
                 }
 
-                if (setError == AL10.AL_NO_ERROR) {
+                if (setError == AL_NO_ERROR) {
                     supported = true;
                 }
 
@@ -203,10 +206,10 @@ public final class EFXUtil {
                 try {
                     switch (objectType) { // Set based on object type
                         case EFFECT:
-                            EFX10.alDeleteEffects(testObject);
+                            alDeleteEffects(testObject);
                             break;
                         case FILTER:
-                            EFX10.alDeleteFilters(testObject);
+                            alDeleteFilters(testObject);
                             break;
                         default:
                             throw new IllegalArgumentException("Invalid objectType: " + objectType);
@@ -215,7 +218,7 @@ public final class EFXUtil {
                     // Don't care about cleanup errors.
                 }
 
-            } else if (genError == AL10.AL_OUT_OF_MEMORY) {
+            } else if (genError == AL_OUT_OF_MEMORY) {
                 throw new OpenALException(genError);
             }
         }
diff --git a/src/java/org/lwjgl/opencl/APIUtil.java b/src/java/org/lwjgl/opencl/APIUtil.java
new file mode 100644
index 0000000..c40010a
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/APIUtil.java
@@ -0,0 +1,544 @@
+/*
+ * 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<char[]> arrayTL = new ThreadLocal<char[]>() {
+		protected char[] initialValue() { return new char[INITIAL_BUFFER_SIZE]; }
+	};
+
+	private static final ThreadLocal<ByteBuffer> bufferByteTL = new ThreadLocal<ByteBuffer>() {
+		protected ByteBuffer initialValue() { return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); }
+	};
+
+	private static final ThreadLocal<PointerBuffer> bufferPointerTL = new ThreadLocal<PointerBuffer>() {
+		protected PointerBuffer initialValue() { return BufferUtils.createPointerBuffer(INITIAL_BUFFER_SIZE); }
+	};
+
+	private static final ThreadLocal<PointerBuffer> lengthsTL = new ThreadLocal<PointerBuffer>() {
+		protected PointerBuffer initialValue() { return BufferUtils.createPointerBuffer(INITIAL_LENGTHS_SIZE); }
+	};
+
+	private static final ThreadLocal<Buffers> buffersTL = new ThreadLocal<Buffers>() {
+		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<String> getExtensions(final String extensionList) {
+		final Set<String> extensions = new HashSet<String>();
+
+		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 <T extends CLObjectChild> void releaseObjects(final CLObjectRegistry<T> registry, final ObjectDestructor<T> destructor) {
+		if ( registry.isEmpty() )
+			return;
+
+		for ( Entry<T> entry : registry.getAll() ) {
+			final T object = entry.value;
+			while ( object.isValid() )
+				destructor.release(object);
+		}
+	}
+
+	private static final ObjectDestructor<CLDevice> DESTRUCTOR_CLSubDevice = new ObjectDestructor<CLDevice>() {
+		public void release(final CLDevice object) { clReleaseDeviceEXT(object); }
+	};
+	private static final ObjectDestructor<CLMem> DESTRUCTOR_CLMem = new ObjectDestructor<CLMem>() {
+		public void release(final CLMem object) { clReleaseMemObject(object); }
+	};
+	private static final ObjectDestructor<CLCommandQueue> DESTRUCTOR_CLCommandQueue = new ObjectDestructor<CLCommandQueue>() {
+		public void release(final CLCommandQueue object) { clReleaseCommandQueue(object); }
+	};
+	private static final ObjectDestructor<CLSampler> DESTRUCTOR_CLSampler = new ObjectDestructor<CLSampler>() {
+		public void release(final CLSampler object) { clReleaseSampler(object); }
+	};
+	private static final ObjectDestructor<CLProgram> DESTRUCTOR_CLProgram = new ObjectDestructor<CLProgram>() {
+		public void release(final CLProgram object) { clReleaseProgram(object); }
+	};
+	private static final ObjectDestructor<CLKernel> DESTRUCTOR_CLKernel = new ObjectDestructor<CLKernel>() {
+		public void release(final CLKernel object) { clReleaseKernel(object); }
+	};
+	private static final ObjectDestructor<CLEvent> DESTRUCTOR_CLEvent = new ObjectDestructor<CLEvent>() {
+		public void release(final CLEvent object) { clReleaseEvent(object); }
+	};
+
+	private interface ObjectDestructor<T extends CLObjectChild> {
+
+		void release(T object);
+
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/APPLEContextLoggingUtil.java b/src/java/org/lwjgl/opencl/APPLEContextLoggingUtil.java
new file mode 100644
index 0000000..9f62741
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/APPLEContextLoggingUtil.java
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ * <p/>
+ * 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() {}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CL.java b/src/java/org/lwjgl/opencl/CL.java
new file mode 100644
index 0000000..794da74
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CL.java
@@ -0,0 +1,152 @@
+/*
+ * 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);
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLBuildProgramCallback.java b/src/java/org/lwjgl/opencl/CLBuildProgramCallback.java
new file mode 100644
index 0000000..4056357
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLBuildProgramCallback.java
@@ -0,0 +1,61 @@
+/*
+ * 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);
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLCallback.java b/src/java/org/lwjgl/opencl/CLCallback.java
new file mode 100644
index 0000000..48aa024
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLCallback.java
@@ -0,0 +1,59 @@
+/*
+ * 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;
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLChecks.java b/src/java/org/lwjgl/opencl/CLChecks.java
new file mode 100644
index 0000000..bb60836
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLChecks.java
@@ -0,0 +1,268 @@
+/*
+ * 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));
+		}
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLCommandQueue.java b/src/java/org/lwjgl/opencl/CLCommandQueue.java
new file mode 100644
index 0000000..f4e02ed
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLCommandQueue.java
@@ -0,0 +1,112 @@
+/*
+ * 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<CLContext> {
+
+	private static final InfoUtil<CLCommandQueue> util = CLPlatform.getInfoUtilInstance(CLCommandQueue.class, "CL_COMMAND_QUEUE_UTIL");
+
+	private final CLDevice device;
+
+	private final CLObjectRegistry<CLEvent> clEvents;
+
+	CLCommandQueue(final long pointer, final CLContext context, final CLDevice device) {
+		super(pointer, context);
+		if ( isValid() ) {
+			this.device = device;
+			this.clEvents = new CLObjectRegistryGlobal<CLEvent>(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<CLEvent> 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);
+		}
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLContext.java b/src/java/org/lwjgl/opencl/CLContext.java
new file mode 100644
index 0000000..346a23c
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLContext.java
@@ -0,0 +1,282 @@
+/*
+ * 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<CLPlatform> {
+
+	private static final CLContextUtil util = (CLContextUtil)CLPlatform.getInfoUtilInstance(CLContext.class, "CL_CONTEXT_UTIL");
+
+	private final CLObjectRegistry<CLCommandQueue> clCommandQueues;
+	private final CLObjectRegistry<CLMem> clMems;
+	private final CLObjectRegistry<CLSampler> clSamplers;
+	private final CLObjectRegistry<CLProgram> clPrograms;
+	private final CLObjectRegistry<CLEvent> clEvents;
+
+	/** Global registry for build callbacks. */
+	static final FastLongMap<CLProgram> clProgramsGlobal = new FastLongMap<CLProgram>();
+
+	/** Global registry for event callbacks. */
+	static final FastLongMap<CLEvent> clEventsGlobal = new FastLongMap<CLEvent>();
+
+	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<CLCommandQueue>();
+			clMems = new CLObjectRegistry<CLMem>();
+			clSamplers = new CLObjectRegistry<CLSampler>();
+			clPrograms = new CLObjectRegistryGlobal<CLProgram>(clProgramsGlobal);
+			clEvents = new CLObjectRegistryGlobal<CLEvent>(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<CLDevice> 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<CLDevice> 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<CLDevice> 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<CLDevice> getInfoDevices() {
+		return util.getInfoDevices(this);
+	}
+
+	public List<CLImageFormat> getSupportedImageFormats(final long flags, final int image_type) {
+		return getSupportedImageFormats(flags, image_type, null);
+	}
+
+	public List<CLImageFormat> getSupportedImageFormats(final long flags, final int image_type, final Filter<CLImageFormat> filter) {
+		return util.getSupportedImageFormats(this, flags, image_type, filter);
+	}
+
+	/** CLContext utility methods interface. */
+	interface CLContextUtil extends InfoUtil<CLContext> {
+
+		List<CLDevice> getInfoDevices(CLContext context);
+
+		CLContext create(CLPlatform platform, List<CLDevice> 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<CLImageFormat> getSupportedImageFormats(CLContext context, final long flags, final int image_type, Filter<CLImageFormat> filter);
+
+	}
+
+	// -------[ IMPLEMENTATION STUFF BELOW ]-------
+
+	CLObjectRegistry<CLCommandQueue> getCLCommandQueueRegistry() { return clCommandQueues; }
+
+	CLObjectRegistry<CLMem> getCLMemRegistry() { return clMems; }
+
+	CLObjectRegistry<CLSampler> getCLSamplerRegistry() { return clSamplers; }
+
+	CLObjectRegistry<CLProgram> getCLProgramRegistry() { return clPrograms; }
+
+	CLObjectRegistry<CLEvent> getCLEventRegistry() { return clEvents; }
+
+	static CLProgram getCLProgramGlobal(final long id) { return clProgramsGlobal.get(id); }
+
+	static CLEvent getCLEventGlobal(final long id) { return clEventsGlobal.get(id); }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLContextCallback.java b/src/java/org/lwjgl/opencl/CLContextCallback.java
new file mode 100644
index 0000000..ab33b70
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLContextCallback.java
@@ -0,0 +1,78 @@
+/*
+ * 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);
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLDevice.java b/src/java/org/lwjgl/opencl/CLDevice.java
new file mode 100644
index 0000000..b9130bf
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLDevice.java
@@ -0,0 +1,206 @@
+/*
+ * 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<CLDevice> {
+
+	private static final InfoUtil<CLDevice> util = CLPlatform.getInfoUtilInstance(CLDevice.class, "CL_DEVICE_UTIL");
+
+	private final CLPlatform platform;
+	private final CLObjectRegistry<CLDevice> 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<CLDevice>();
+			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<CLDevice> 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);
+		}
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLEvent.java b/src/java/org/lwjgl/opencl/CLEvent.java
new file mode 100644
index 0000000..9e98acd
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLEvent.java
@@ -0,0 +1,124 @@
+/*
+ * 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<CLContext> {
+
+	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<CLEvent> {
+
+		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);
+			}
+		}
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLEventCallback.java b/src/java/org/lwjgl/opencl/CLEventCallback.java
new file mode 100644
index 0000000..43bb665
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLEventCallback.java
@@ -0,0 +1,61 @@
+/*
+ * 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);
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLFunctionAddress.java b/src/java/org/lwjgl/opencl/CLFunctionAddress.java
new file mode 100644
index 0000000..77f2c95
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLFunctionAddress.java
@@ -0,0 +1,47 @@
+/*
+ * 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);
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLKernel.java b/src/java/org/lwjgl/opencl/CLKernel.java
new file mode 100644
index 0000000..39fcb9e
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLKernel.java
@@ -0,0 +1,262 @@
+/*
+ * 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<CLProgram> {
+
+	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<CLKernel> {
+
+		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);
+		}
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLMem.java b/src/java/org/lwjgl/opencl/CLMem.java
new file mode 100644
index 0000000..28af2c6
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLMem.java
@@ -0,0 +1,279 @@
+/*
+ * 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<CLContext> {
+
+	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> {
+
+		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);
+		}
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLMemObjectDestructorCallback.java b/src/java/org/lwjgl/opencl/CLMemObjectDestructorCallback.java
new file mode 100644
index 0000000..9e84fd2
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLMemObjectDestructorCallback.java
@@ -0,0 +1,52 @@
+/*
+ * 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);
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLNativeKernel.java b/src/java/org/lwjgl/opencl/CLNativeKernel.java
new file mode 100644
index 0000000..f137535
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLNativeKernel.java
@@ -0,0 +1,59 @@
+/*
+ * 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 <code>execute</code> 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);
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLObject.java b/src/java/org/lwjgl/opencl/CLObject.java
new file mode 100644
index 0000000..72fc9c3
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLObject.java
@@ -0,0 +1,51 @@
+/*
+ * 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;
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLObjectChild.java b/src/java/org/lwjgl/opencl/CLObjectChild.java
new file mode 100644
index 0000000..bebefd1
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLObjectChild.java
@@ -0,0 +1,58 @@
+/*
+ * 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<P extends CLObject> 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;
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLObjectRegistry.java b/src/java/org/lwjgl/opencl/CLObjectRegistry.java
new file mode 100644
index 0000000..5fed8cd
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLObjectRegistry.java
@@ -0,0 +1,54 @@
+package org.lwjgl.opencl;
+
+import org.lwjgl.LWJGLUtil;
+
+/**
+ * A CLObjectChild container.
+ *
+ * @author Spasi
+ */
+class CLObjectRegistry<T extends CLObjectChild> {
+
+	private FastLongMap<T> 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<FastLongMap.Entry<T>> getAll() {
+		return registry;
+	}
+
+	void registerObject(final T object) {
+		final FastLongMap<T> 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<T> getMap() {
+		if ( registry == null )
+			registry = new FastLongMap<T>();
+
+		return registry;
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLObjectRegistryGlobal.java b/src/java/org/lwjgl/opencl/CLObjectRegistryGlobal.java
new file mode 100644
index 0000000..7c77f08
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLObjectRegistryGlobal.java
@@ -0,0 +1,57 @@
+/*
+ * 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<T extends CLObjectChild> extends CLObjectRegistry<T> {
+
+	private final FastLongMap<T> globalRegistry;
+
+	CLObjectRegistryGlobal(final FastLongMap<T> 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());
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLObjectRetainable.java b/src/java/org/lwjgl/opencl/CLObjectRetainable.java
new file mode 100644
index 0000000..7c6b4a9
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLObjectRetainable.java
@@ -0,0 +1,70 @@
+/*
+ * 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;
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLPlatform.java b/src/java/org/lwjgl/opencl/CLPlatform.java
new file mode 100644
index 0000000..ea04a07
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLPlatform.java
@@ -0,0 +1,231 @@
+/*
+ * 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<CLPlatform> clPlatforms = new FastLongMap<CLPlatform>();
+
+	private final CLObjectRegistry<CLDevice> clDevices;
+
+	/** Global registry for build callbacks. */
+	static final FastLongMap<CLDevice> clDevicesGlobal = new FastLongMap<CLDevice>();
+
+	private Object caps;
+
+	CLPlatform(final long pointer) {
+		super(pointer);
+
+		if ( isValid() ) {
+			clPlatforms.put(pointer, this);
+			clDevices = new CLObjectRegistryGlobal<CLDevice>(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 <T extends CLObject> InfoUtil<T> getInfoUtilInstance(final Class<T> clazz, final String fieldName) {
+		InfoUtil<T> instance = null;
+		try {
+			final Class<?> infoUtil = Class.forName("org.lwjgl.opencl.InfoUtilFactory");
+			instance = (InfoUtil<T>)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<CLPlatform> 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<CLPlatform> getPlatforms(final Filter<CLPlatform> 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<CLDevice> 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<CLDevice> getDevices(final int device_type, final Filter<CLDevice> filter) {
+		return util.getDevices(this, device_type, filter);
+	}
+
+	/** CLPlatform utility methods interface. */
+	interface CLPlatformUtil extends InfoUtil<CLPlatform> {
+
+		List<CLPlatform> getPlatforms(Filter<CLPlatform> filter);
+
+		List<CLDevice> getDevices(CLPlatform platform, int device_type, final Filter<CLDevice> 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<CLDevice> getCLDeviceRegistry() { return clDevices; }
+
+	static CLDevice getCLDeviceGlobal(final long id) { return clDevicesGlobal.get(id); }
+
+	/**
+	 * Called from <code>clGetDeviceIDs</code> 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 <code>clGetContextInfo</code> 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);
+		}
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLProgram.java b/src/java/org/lwjgl/opencl/CLProgram.java
new file mode 100644
index 0000000..1318276
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLProgram.java
@@ -0,0 +1,220 @@
+/*
+ * 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<CLContext> {
+
+	private static final CLProgramUtil util = (CLProgramUtil)CLPlatform.getInfoUtilInstance(CLProgram.class, "CL_PROGRAM_UTIL");
+
+	private final CLObjectRegistry<CLKernel> clKernels;
+
+	CLProgram(final long pointer, final CLContext context) {
+		super(pointer, context);
+
+		if ( isValid() ) {
+			context.getCLProgramRegistry().registerObject(this);
+			clKernels = new CLObjectRegistry<CLKernel>();
+		} 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 <code>target</code>
+	 * 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 <code>target</code> 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<CLProgram> {
+
+		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<CLKernel> 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);
+		}
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CLSampler.java b/src/java/org/lwjgl/opencl/CLSampler.java
new file mode 100644
index 0000000..6408b66
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CLSampler.java
@@ -0,0 +1,85 @@
+/*
+ * 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<CLContext> {
+
+	private static final InfoUtil<CLSampler> 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);
+		}
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/CallbackUtil.java b/src/java/org/lwjgl/opencl/CallbackUtil.java
new file mode 100644
index 0000000..531e9bd
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/CallbackUtil.java
@@ -0,0 +1,200 @@
+/*
+ * 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<CLContext, Long> contextUserData = new HashMap<CLContext, Long>();
+
+	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 <code>APPLEContextLoggingUtil.SYSTEM_LOG_CALLBACK</code> 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 <code>APPLEContextLoggingUtil.STD_OUT_CALLBACK</code> 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 <code>APPLEContextLoggingUtil.STD_ERR_CALLBACK</code> is used.
+	 *
+	 * @return the callback function address
+	 *
+	 * @see APPLEContextLoggingUtil#STD_ERR_CALLBACK
+	 */
+	static native long getLogMessageToStderrAPPLE();
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/FastLongMap.java b/src/java/org/lwjgl/opencl/FastLongMap.java
new file mode 100644
index 0000000..a8a1382
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/FastLongMap.java
@@ -0,0 +1,239 @@
+/*
+ * 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 at apache.org)
+ * @author Stephen Colebourne
+ * @author Nathan Sweet
+ */
+final class FastLongMap<V> implements Iterable<FastLongMap.Entry<V>> {
+
+	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<V>[] table = this.table;
+		int index = index(key);
+
+		// Check if key already exists.
+		for ( Entry<V> 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<V>(key, value, table[index]);
+
+		if ( size++ >= threshold )
+			rehash(table);
+
+		return null;
+	}
+
+	private void rehash(final Entry<V>[] table) {
+		final int newCapacity = 2 * capacity;
+		final int newMask = newCapacity - 1;
+
+		final Entry<V>[] newTable = new Entry[newCapacity];
+
+		for ( int i = 0, index; i < table.length; i++ ) {
+			Entry<V> e = table[i];
+			if ( e == null ) continue;
+			do {
+				final Entry<V> 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<V> e = table[index]; e != null; e = e.next )
+			if ( e.key == key ) return e.value;
+		return null;
+	}
+
+	public boolean containsValue(Object value) {
+		final Entry<V>[] table = this.table;
+		for ( int i = table.length - 1; i >= 0; i-- )
+			for ( Entry<V> 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<V> 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<V> prev = table[index];
+		Entry<V> e = prev;
+		while ( e != null ) {
+			Entry<V> 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<V>[] 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<Entry<V>> {
+
+		private int nextIndex;
+		private Entry<V> current;
+
+		EntryIterator() {
+			reset();
+		}
+
+		public void reset() {
+			current = null;
+			// Find first bucket.
+			final Entry<V>[] 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<V> next() {
+			// Next entry in current bucket.
+			Entry<V> 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<V>[] 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<T> {
+
+		final long key;
+		T value;
+		Entry<T> next;
+
+		Entry(long key, T value, Entry<T> next) {
+			this.key = key;
+			this.value = value;
+			this.next = next;
+		}
+
+		public long getKey() {
+			return key;
+		}
+
+		public T getValue() {
+			return value;
+		}
+
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/InfoUtil.java b/src/java/org/lwjgl/opencl/InfoUtil.java
new file mode 100644
index 0000000..c7cc060
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/InfoUtil.java
@@ -0,0 +1,51 @@
+/*
+ * 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<T extends CLObject> {
+
+	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);
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/InfoUtilAbstract.java b/src/java/org/lwjgl/opencl/InfoUtilAbstract.java
new file mode 100644
index 0000000..25f854d
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/InfoUtilAbstract.java
@@ -0,0 +1,135 @@
+/*
+ * 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<T extends CLObject> implements InfoUtil<T> {
+
+	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);
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/InfoUtilFactory.java b/src/java/org/lwjgl/opencl/InfoUtilFactory.java
new file mode 100644
index 0000000..c633ae7
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/InfoUtilFactory.java
@@ -0,0 +1,606 @@
+/*
+ * 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<CLCommandQueue> CL_COMMAND_QUEUE_UTIL = new InfoUtilAbstract<CLCommandQueue>() {
+		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<CLContext> 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<CLDevice> 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<CLDevice> devices = new ArrayList<CLDevice>(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<CLDevice> 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<CLImageFormat> getSupportedImageFormats(final CLContext context, final long flags, final int image_type, final Filter<CLImageFormat> 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<CLImageFormat> formats = new ArrayList<CLImageFormat>(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<CLDevice> CL_DEVICE_UTIL = new CLDeviceUtil();
+	private static final class CLDeviceUtil extends InfoUtilAbstract<CLDevice> {
+
+		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<CLEvent> 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<CLKernel> 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<CLMem> 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<CLPlatform> 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<CLPlatform> getPlatforms(final Filter<CLPlatform> 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<CLPlatform> platforms = new ArrayList<CLPlatform>(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<CLDevice> getDevices(final CLPlatform platform, final int device_type, final Filter<CLDevice> 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<CLDevice> devices = new ArrayList<CLDevice>(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<CLProgram> 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<CLSampler> CL_SAMPLER_UTIL = new InfoUtilAbstract<CLSampler>() {
+		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);
+		}
+	};
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/OpenCLException.java b/src/java/org/lwjgl/opencl/OpenCLException.java
new file mode 100644
index 0000000..a0c9093
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/OpenCLException.java
@@ -0,0 +1,54 @@
+/*
+ * 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);
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/Util.java b/src/java/org/lwjgl/opencl/Util.java
new file mode 100644
index 0000000..106d2a8
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/Util.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR 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<Integer, String> 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) + ")");
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/api/CLBufferRegion.java b/src/java/org/lwjgl/opencl/api/CLBufferRegion.java
new file mode 100644
index 0000000..b0d72d3
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/api/CLBufferRegion.java
@@ -0,0 +1,62 @@
+/*
+ * 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;
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/api/CLImageFormat.java b/src/java/org/lwjgl/opencl/api/CLImageFormat.java
new file mode 100644
index 0000000..f0cd023
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/api/CLImageFormat.java
@@ -0,0 +1,60 @@
+/*
+ * 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;
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opencl/api/Filter.java b/src/java/org/lwjgl/opencl/api/Filter.java
new file mode 100644
index 0000000..6f7db60
--- /dev/null
+++ b/src/java/org/lwjgl/opencl/api/Filter.java
@@ -0,0 +1,51 @@
+/*
+ * 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<T> {
+
+	/**
+	 * 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);
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java b/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java
index 0038161..4fcaa65 100644
--- a/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java
+++ b/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java
@@ -31,6 +31,8 @@
  */
 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
@@ -39,7 +41,7 @@ package org.lwjgl.opengl;
  *
  * @author Spasi
  */
-public final class AMDDebugOutputCallback implements PointerWrapper {
+public final class AMDDebugOutputCallback extends PointerWrapperAbstract {
 
 	/** Severity levels. */
 	private static final int GL_DEBUG_SEVERITY_HIGH_AMD = 0x9146,
@@ -56,10 +58,23 @@ public final class AMDDebugOutputCallback implements PointerWrapper {
 		GL_DEBUG_CATEGORY_APPLICATION_AMD = 0x914F,
 		GL_DEBUG_CATEGORY_OTHER_AMD = 0x9150;
 
-	private final long pointer;
+	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 a AMDDebugOutputCallback with a default callback handler.
+	 * Creates an AMDDebugOutputCallback with a default callback handler.
 	 * The default handler will simply print the message on System.err.
 	 */
 	public AMDDebugOutputCallback() {
@@ -120,29 +135,21 @@ public final class AMDDebugOutputCallback implements PointerWrapper {
 	}
 
 	/**
-	 * Creates a AMDDebugOutputCallback with the specified callback handlers.
+	 * 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) {
-		try {
-			// We have to call registerHandler reflectively because we need this class to compile before we run the Generator.
-			// The registerHandler method depends on org.lwjgl.opengl.Context, if we touched that we would need to compile
-			// the whole library (which is not possible).
-			Class.forName("org.lwjgl.opengl.AMDDebugOutputUtil").getMethod("registerHandler", new Class[] { Handler.class }).invoke(null, new Object[] { handler });
-		} catch (Exception e) {
-			throw new RuntimeException(e.getCause() != null ? e.getCause() : e);
-		}
-		this.pointer = getFunctionPointer();
-	}
+		super(CALLBACK_POINTER);
 
-	public long getPointer() {
-		return pointer;
+		this.handler = handler;
 	}
 
-	private static native long getFunctionPointer();
+	Handler getHandler() {
+		return handler;
+	}
 
 	/** Implementations of this interface can be used to receive AMD_debug_output notifications. */
 	public interface Handler {
diff --git a/src/java/org/lwjgl/opengl/APIUtil.java b/src/java/org/lwjgl/opengl/APIUtil.java
new file mode 100644
index 0000000..2b0d521
--- /dev/null
+++ b/src/java/org/lwjgl/opengl/APIUtil.java
@@ -0,0 +1,302 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) 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<char[]> arrayTL = new ThreadLocal<char[]>() {
+		protected char[] initialValue() { return new char[INITIAL_BUFFER_SIZE]; }
+	};
+
+	private static final ThreadLocal<ByteBuffer> bufferTL = new ThreadLocal<ByteBuffer>() {
+		protected ByteBuffer initialValue() { return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); }
+	};
+
+	private static final ThreadLocal<IntBuffer> lengthsTL = new ThreadLocal<IntBuffer>() {
+		protected IntBuffer initialValue() { return BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE); }
+	};
+
+	private static final ThreadLocal<Buffers> buffersTL = new ThreadLocal<Buffers>() {
+		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);
+		}
+
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengl/ARBDebugOutputCallback.java b/src/java/org/lwjgl/opengl/ARBDebugOutputCallback.java
new file mode 100644
index 0000000..e1b02dd
--- /dev/null
+++ b/src/java/org/lwjgl/opengl/ARBDebugOutputCallback.java
@@ -0,0 +1,197 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) 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);
+
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengl/AWTGLCanvas.java b/src/java/org/lwjgl/opengl/AWTGLCanvas.java
index d19f76d..543da00 100644
--- a/src/java/org/lwjgl/opengl/AWTGLCanvas.java
+++ b/src/java/org/lwjgl/opengl/AWTGLCanvas.java
@@ -33,6 +33,7 @@ package org.lwjgl.opengl;
 
 import org.lwjgl.LWJGLException;
 import org.lwjgl.LWJGLUtil;
+import org.lwjgl.PointerBuffer;
 import org.lwjgl.Sys;
 
 import java.awt.*;
@@ -47,14 +48,14 @@ import java.awt.event.HierarchyListener;
  * <p/>
  *
  * @author $Author: spasi $
- *         $Id: AWTGLCanvas.java 3334 2010-04-22 23:21:48Z spasi $
- * @version $Revision: 3334 $
+ *         $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 final static AWTCanvasImplementation implementation;
+	private static final AWTCanvasImplementation implementation;
 	private boolean update_context;
 	private Object SYNC_LOCK = new Object();
 
@@ -258,6 +259,14 @@ public class AWTGLCanvas extends Canvas implements DrawableLWJGL, ComponentListe
 		}
 	}
 
+	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
diff --git a/src/java/org/lwjgl/opengl/AWTSurfaceLock.java b/src/java/org/lwjgl/opengl/AWTSurfaceLock.java
index 5ff0ad2..cc40960 100644
--- a/src/java/org/lwjgl/opengl/AWTSurfaceLock.java
+++ b/src/java/org/lwjgl/opengl/AWTSurfaceLock.java
@@ -43,16 +43,16 @@ import org.lwjgl.LWJGLUtil;
 /**
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3116 $
- * $Id: AWTSurfaceLock.java 3116 2008-08-19 16:46:03Z spasi $
+ * @version $Revision: 3418 $
+ * $Id: AWTSurfaceLock.java 3418 2010-09-28 21:11:35Z spasi $
  */
 final class AWTSurfaceLock {
 
-	private final static int	WAIT_DELAY_MILLIS	= 100;
+	private static final int	WAIT_DELAY_MILLIS	= 100;
 
 	private final ByteBuffer	lock_buffer;
 
-	private boolean				firstLockSucceeded	= false;
+	private boolean				firstLockSucceeded;
 
 	AWTSurfaceLock() {
 		lock_buffer = createHandle();
@@ -83,13 +83,11 @@ final class AWTSurfaceLock {
 			return lockAndInitHandle(lock_buffer, component);
 		else
 			try {
-				final Object result = AccessController.doPrivileged(new PrivilegedExceptionAction() {
-
-					public Object run() throws LWJGLException {
-						return Boolean.valueOf(lockAndInitHandle(lock_buffer, component));
+				firstLockSucceeded = AccessController.doPrivileged(new PrivilegedExceptionAction<Boolean>() {
+					public Boolean run() throws LWJGLException {
+						return lockAndInitHandle(lock_buffer, component);
 					}
 				});
-				firstLockSucceeded = ((Boolean) result).booleanValue();
 				return firstLockSucceeded;
 			} catch (PrivilegedActionException e) {
 				throw (LWJGLException) e.getException();
diff --git a/src/java/org/lwjgl/opengl/AWTUtil.java b/src/java/org/lwjgl/opengl/AWTUtil.java
index 1185523..ada599a 100644
--- a/src/java/org/lwjgl/opengl/AWTUtil.java
+++ b/src/java/org/lwjgl/opengl/AWTUtil.java
@@ -87,12 +87,11 @@ final class AWTUtil {
 
 	public static Robot createRobot(final Component component) {
 		try {
-			Robot robot = (Robot)AccessController.doPrivileged(new PrivilegedExceptionAction() {
-				public Object run() throws Exception {
+			return AccessController.doPrivileged(new PrivilegedExceptionAction<Robot>() {
+				public Robot run() throws Exception {
 					return new Robot(component.getGraphicsConfiguration().getDevice());
 				}
 			});
-			return robot;
 		} catch (PrivilegedActionException e) {
 			LWJGLUtil.log("Got exception while creating robot: " + e.getCause());
 			return null;
@@ -112,8 +111,8 @@ final class AWTUtil {
 		try {
 			final GraphicsConfiguration config = component.getGraphicsConfiguration();
 			if (config != null) {
-				PointerInfo pointer_info = (PointerInfo)AccessController.doPrivileged(new PrivilegedExceptionAction() {
-					public Object run() throws Exception {
+				PointerInfo pointer_info = AccessController.doPrivileged(new PrivilegedExceptionAction<PointerInfo>() {
+					public PointerInfo run() throws Exception {
 						return MouseInfo.getPointerInfo();
 					}
 				});
@@ -123,7 +122,7 @@ final class AWTUtil {
 				}
 				return null;
 			}
-		} catch (PrivilegedActionException e) {
+		} catch (Exception e) {
 			LWJGLUtil.log("Failed to query pointer location: " + e.getCause());
 		}
 		return null;
diff --git a/src/java/org/lwjgl/opengl/AbstractDrawable.java b/src/java/org/lwjgl/opengl/AbstractDrawable.java
index 18778a8..8823597 100644
--- a/src/java/org/lwjgl/opengl/AbstractDrawable.java
+++ b/src/java/org/lwjgl/opengl/AbstractDrawable.java
@@ -2,6 +2,7 @@ package org.lwjgl.opengl;
 
 import org.lwjgl.LWJGLException;
 import org.lwjgl.LWJGLUtil;
+import org.lwjgl.PointerBuffer;
 
 /**
  * @author Spasi
@@ -73,6 +74,13 @@ abstract class AbstractDrawable implements DrawableLWJGL {
 		}
 	}
 
+	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.");
diff --git a/src/java/org/lwjgl/opengl/BaseReferences.java b/src/java/org/lwjgl/opengl/BaseReferences.java
index 7058cce..26b6c71 100644
--- a/src/java/org/lwjgl/opengl/BaseReferences.java
+++ b/src/java/org/lwjgl/opengl/BaseReferences.java
@@ -34,14 +34,20 @@ 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;
-    Buffer[] glVertexAttribPointer_buffer;
-    Buffer[] glTexCoordPointer_buffer;
+	int elementArrayBuffer;
+	int arrayBuffer;
+	final Buffer[] glVertexAttribPointer_buffer;
+	final Buffer[] glTexCoordPointer_buffer;
 	int glClientActiveTexture;
 
+	int vertexArrayObject;
+
 	int pixelPackBuffer;
 	int pixelUnpackBuffer;
 
@@ -49,49 +55,53 @@ class BaseReferences {
 
 	BaseReferences(ContextCapabilities caps) {
 		int max_vertex_attribs;
-		if (caps.OpenGL20 || caps.GL_ARB_vertex_shader)
-			max_vertex_attribs = GL11.glGetInteger(ARBVertexShader.GL_MAX_VERTEX_ATTRIBS_ARB);
+		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];
+		glVertexAttribPointer_buffer = new Buffer[max_vertex_attribs];
 
 		int max_texture_units;
-		if (caps.OpenGL20)
-			max_texture_units = GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS);
-		else if (caps.OpenGL13 || caps.GL_ARB_multitexture)
-			max_texture_units = GL11.glGetInteger(GL13.GL_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.pixelPackBuffer = 0;
-	    this.pixelUnpackBuffer = 0;
-
-	    this.indirectBuffer = 0;
-    }
-
-    void copy(BaseReferences references, int mask) {
-	    if ( (mask & GL11.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.indirectBuffer = references.indirectBuffer;
-	    }
-
-	    if ( (mask & GL11.GL_CLIENT_PIXEL_STORE_BIT) != 0 ) {
+		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;
-	    }
-    }
+		}
+	}
 }
diff --git a/src/java/org/lwjgl/opengl/CallbackUtil.java b/src/java/org/lwjgl/opengl/CallbackUtil.java
new file mode 100644
index 0000000..0c938e7
--- /dev/null
+++ b/src/java/org/lwjgl/opengl/CallbackUtil.java
@@ -0,0 +1,157 @@
+/*
+ * 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<Context, Long> contextUserParamsARB = new HashMap<Context, Long>();
+	/** Context -> Long */
+	private static final Map<Context, Long> contextUserParamsAMD = new HashMap<Context, Long>();
+
+	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<Context, Long> 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);
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengl/Context.java b/src/java/org/lwjgl/opengl/Context.java
index 1933558..e9e9833 100644
--- a/src/java/org/lwjgl/opengl/Context.java
+++ b/src/java/org/lwjgl/opengl/Context.java
@@ -33,11 +33,15 @@ 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.*;
+
 /**
  * <p/>
  * Context encapsulates an OpenGL context.
@@ -46,16 +50,16 @@ import java.nio.IntBuffer;
  * This class is thread-safe.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3332 $
- *          $Id: Context.java 3332 2010-04-20 18:21:05Z spasi $
+ * @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 final static ContextImplementation implementation;
+	private static final ContextImplementation implementation;
 
 	/** The current Context */
-	private final static ThreadLocal current_context_local = new ThreadLocal();
+	private static final ThreadLocal<Context> current_context_local = new ThreadLocal<Context>();
 
 	/** Handle to the native GL rendering context */
 	private final ByteBuffer handle;
@@ -99,7 +103,7 @@ final class Context {
 	}
 
 	static Context getCurrentContext() {
-		return (Context)current_context_local.get();
+		return current_context_local.get();
 	}
 
 	/** Create a context with the specified peer info and shared context */
@@ -206,6 +210,7 @@ final class Context {
 			try {
 				releaseDrawable();
 				implementation.destroy(peer_info, handle);
+				CallbackUtil.unregisterCallbacks(this);
 				destroyed = true;
 				thread = null;
 				GLContext.unloadOpenGLLibrary();
@@ -245,15 +250,37 @@ final class Context {
 			return;
 		destroy_requested = true;
 		boolean was_current = isCurrent();
-		int error = GL11.GL_NO_ERROR;
+		int error = GL_NO_ERROR;
 		if ( was_current ) {
 			if ( GLContext.getCapabilities() != null && GLContext.getCapabilities().OpenGL11 )
-				error = GL11.glGetError();
+				error = glGetError();
 			releaseCurrentContext();
 		}
 		checkDestroy();
-		if ( was_current && error != GL11.GL_NO_ERROR )
+		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();
+		}
+	}
+
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengl/ContextAttribs.java b/src/java/org/lwjgl/opengl/ContextAttribs.java
index a056b64..552a1bb 100644
--- a/src/java/org/lwjgl/opengl/ContextAttribs.java
+++ b/src/java/org/lwjgl/opengl/ContextAttribs.java
@@ -56,6 +56,15 @@ import java.nio.IntBuffer;
  */
 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;
 
@@ -63,9 +72,13 @@ public final class ContextAttribs {
 
 	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);
@@ -82,14 +95,6 @@ public final class ContextAttribs {
 
 		this.majorVersion = majorVersion;
 		this.minorVersion = minorVersion;
-
-		this.layerPlane = 0;
-
-		this.debug = false;
-		this.forwardCompatible = false;
-
-		this.profileCore = false;
-		this.profileCompatibility = false;
 	}
 
 	private ContextAttribs(final ContextAttribs attribs) {
@@ -100,9 +105,13 @@ public final class ContextAttribs {
 
 		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() {
@@ -133,6 +142,10 @@ public final class ContextAttribs {
 		return profileCompatibility;
 	}
 
+	public boolean isProfileES() {
+		return profileES;
+	}
+
 	public ContextAttribs withLayer(final int layerPlane) {
 		if ( layerPlane < 0 )
 			throw new IllegalArgumentException("Invalid layer plane specified: " + layerPlane);
@@ -193,6 +206,37 @@ public final class ContextAttribs {
 		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:
@@ -221,6 +265,8 @@ public final class ContextAttribs {
 			flags |= implementation.getDebugBit();
 		if ( forwardCompatible )
 			flags |= implementation.getForwardCompatibleBit();
+		if ( robustAccess )
+			flags |= CONTEXT_ROBUST_ACCESS_BIT_ARB;
 		if ( 0 < flags )
 			attribCount++;
 
@@ -229,6 +275,8 @@ public final class ContextAttribs {
 			profileMask |= implementation.getProfileCoreBit();
 		else if ( profileCompatibility )
 			profileMask |= implementation.getProfileCompatibilityBit();
+		else if ( profileES )
+			profileMask |= CONTEXT_ES2_PROFILE_BIT_EXT;
 		if ( 0 < profileMask )
 			attribCount++;
 
@@ -247,6 +295,8 @@ public final class ContextAttribs {
 			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();
@@ -254,13 +304,16 @@ public final class ContextAttribs {
 	}
 
 	public String toString() {
-		StringBuffer sb = new StringBuffer(32);
+		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");
diff --git a/src/java/org/lwjgl/opengl/Display.java b/src/java/org/lwjgl/opengl/Display.java
index e90db80..8ec43a8 100644
--- a/src/java/org/lwjgl/opengl/Display.java
+++ b/src/java/org/lwjgl/opengl/Display.java
@@ -62,6 +62,8 @@ 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() {
@@ -114,9 +116,9 @@ public final class Display {
 	private static boolean parent_resized;
 
 	/** Initial Background Color of Display */
-	private static float r = 0, g = 0, b = 0;
+	private static float r, g, b;
 
-	private static ComponentListener component_listener = new ComponentAdapter() {
+	private static final ComponentListener component_listener = new ComponentAdapter() {
 		public void componentResized(ComponentEvent e) {
 			synchronized ( GlobalLock.lock ) {
 				parent_resized = true;
@@ -201,7 +203,7 @@ public final class Display {
 			}
 
 			// We'll use a HashSet to filter out the duplicated modes
-			HashSet modes = new HashSet(unfilteredModes.length);
+			HashSet<DisplayMode> modes = new HashSet<DisplayMode>(unfilteredModes.length);
 
 			modes.addAll(Arrays.asList(unfilteredModes));
 			DisplayMode[] filteredModes = new DisplayMode[modes.size()];
@@ -638,7 +640,7 @@ public final class Display {
 	 * 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 GL11.glGetError()
+	 * @throws OpenGLException if an OpenGL error has occured since the last call to glGetError()
 	 */
 	public static void swapBuffers() throws LWJGLException {
 		synchronized ( GlobalLock.lock ) {
@@ -731,7 +733,7 @@ public final class Display {
 	}
 
 	private static void removeShutdownHook() {
-		AccessController.doPrivileged(new PrivilegedAction() {
+		AccessController.doPrivileged(new PrivilegedAction<Object>() {
 			public Object run() {
 				Runtime.getRuntime().removeShutdownHook(shutdown_hook);
 				return null;
@@ -740,7 +742,7 @@ public final class Display {
 	}
 
 	private static void registerShutdownHook() {
-		AccessController.doPrivileged(new PrivilegedAction() {
+		AccessController.doPrivileged(new PrivilegedAction<Object>() {
 			public Object run() {
 				Runtime.getRuntime().addShutdownHook(shutdown_hook);
 				return null;
@@ -903,9 +905,9 @@ public final class Display {
 
 	private static void initContext() {
 		// set background clear color
-		GL11.glClearColor(r, g, b, 1.0f);
+		glClearColor(r, g, b, 0.0f);
 		// Clear window to avoid the desktop "showing through"
-		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
+		glClear(GL_COLOR_BUFFER_BIT);
 		update();
 	}
 
@@ -915,12 +917,11 @@ public final class Display {
 
 	/** Gets a boolean property as a privileged action. */
 	static boolean getPrivilegedBoolean(final String property_name) {
-		Boolean value = (Boolean)AccessController.doPrivileged(new PrivilegedAction() {
-			public Object run() {
-				return new Boolean(Boolean.getBoolean(property_name));
+		return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+			public Boolean run() {
+				return Boolean.getBoolean(property_name);
 			}
 		});
-		return value.booleanValue();
 	}
 
 	private static void initControls() {
diff --git a/src/java/org/lwjgl/opengl/DisplayMode.java b/src/java/org/lwjgl/opengl/DisplayMode.java
index 6bbe3aa..a6e6fb7 100644
--- a/src/java/org/lwjgl/opengl/DisplayMode.java
+++ b/src/java/org/lwjgl/opengl/DisplayMode.java
@@ -38,8 +38,8 @@ package org.lwjgl.opengl;
  * getAvailableDisplayModes()</code> method.
  *
  * @author cix_foo <cix_foo at users.sourceforge.net>
- * @version $Revision: 3171 $
- * $Id: DisplayMode.java 3171 2008-12-28 17:50:08Z elias_naur $
+ * @version $Revision: 3418 $
+ * $Id: DisplayMode.java 3418 2010-09-28 21:11:35Z spasi $
  */
 
 public final class DisplayMode {
@@ -128,7 +128,7 @@ public final class DisplayMode {
 	 * @see java.lang.Object#toString()
 	 */
 	public String toString() {
-		StringBuffer sb = new StringBuffer(32);
+		StringBuilder sb = new StringBuilder(32);
 		sb.append(width);
 		sb.append(" x ");
 		sb.append(height);
diff --git a/src/java/org/lwjgl/opengl/Drawable.java b/src/java/org/lwjgl/opengl/Drawable.java
index 84327aa..d5fdc4b 100644
--- a/src/java/org/lwjgl/opengl/Drawable.java
+++ b/src/java/org/lwjgl/opengl/Drawable.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.LWJGLException;
+import org.lwjgl.PointerBuffer;
 
 /**
  * The Drawable interface describes an OpenGL drawable with an associated
@@ -62,4 +63,15 @@ public interface Drawable {
 	/** Destroys the Drawable. */
 	void destroy();
 
+	/**
+	 * Sets the appropriate khr_gl_sharing properties in the target <code>PointerBuffer</code>,
+	 * so that if it is used in a <code>clCreateContext(FromType)</code> call, the created CL
+	 * context will be sharing objects with this <code>Drawable</code>'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;
+
 }
diff --git a/src/java/org/lwjgl/opengl/FastIntMap.java b/src/java/org/lwjgl/opengl/FastIntMap.java
new file mode 100644
index 0000000..f28d12b
--- /dev/null
+++ b/src/java/org/lwjgl/opengl/FastIntMap.java
@@ -0,0 +1,238 @@
+/*
+ * 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 at apache.org)
+ * @author Stephen Colebourne
+ * @author Nathan Sweet
+ */
+final class FastIntMap<V> implements Iterable<FastIntMap.Entry<V>> {
+
+	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<V>[] table = this.table;
+		int index = index(key);
+
+		// Check if key already exists.
+		for ( Entry<V> 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<V>(key, value, table[index]);
+
+		if ( size++ >= threshold )
+			rehash(table);
+
+		return null;
+	}
+
+	private void rehash(final Entry<V>[] table) {
+		final int newCapacity = 2 * capacity;
+		final int newMask = newCapacity - 1;
+
+		final Entry<V>[] newTable = new Entry[newCapacity];
+
+		for ( int i = 0, index; i < table.length; i++ ) {
+			Entry<V> e = table[i];
+			if ( e == null ) continue;
+			do {
+				final Entry<V> 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<V> e = table[index]; e != null; e = e.next )
+			if ( e.key == key ) return e.value;
+		return null;
+	}
+
+	public boolean containsValue(Object value) {
+		final Entry<V>[] table = this.table;
+		for ( int i = table.length - 1; i >= 0; i-- )
+			for ( Entry<V> 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<V> 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<V> prev = table[index];
+		Entry<V> e = prev;
+		while ( e != null ) {
+			Entry<V> 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<V>[] 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<Entry<V>> {
+
+		private int nextIndex;
+		private Entry<V> current;
+
+		EntryIterator() {
+			reset();
+		}
+
+		public void reset() {
+			current = null;
+			// Find first bucket.
+			final Entry<V>[] 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<V> next() {
+			// Next entry in current bucket.
+			Entry<V> 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<V>[] 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<T> {
+
+		final int key;
+		T value;
+		Entry<T> next;
+
+		Entry(int key, T value, Entry<T> next) {
+			this.key = key;
+			this.value = value;
+			this.next = next;
+		}
+
+		public int getKey() {
+			return key;
+		}
+
+		public T getValue() {
+			return value;
+		}
+
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengl/GLChecks.java b/src/java/org/lwjgl/opengl/GLChecks.java
index ca0116e..d0aeff3 100644
--- a/src/java/org/lwjgl/opengl/GLChecks.java
+++ b/src/java/org/lwjgl/opengl/GLChecks.java
@@ -32,11 +32,18 @@
 package org.lwjgl.opengl;
 
 import java.nio.Buffer;
-import java.nio.IntBuffer;
 
 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
@@ -47,8 +54,8 @@ import org.lwjgl.LWJGLUtil;
  * Thrown by the debug build library of the LWJGL if any OpenGL operation causes an error.
  *
  * @author cix_foo <cix_foo at users.sourceforge.net>
- * @version $Revision: 3334 $
- * $Id: GLChecks.java 3334 2010-04-22 23:21:48Z spasi $
+ * @version $Revision: 3459 $
+ * $Id: GLChecks.java 3459 2010-11-29 17:21:05Z spasi $
  */
 class GLChecks {
 
@@ -56,83 +63,79 @@ class GLChecks {
 	private GLChecks() {
 	}
 
-	static References getReferences(ContextCapabilities caps) {
-		return StateTracker.getReferencesStack(caps).getReferences();
-	}
-
 	static int getBufferObjectSize(ContextCapabilities caps, int buffer_enum) {
-		return GL15.glGetBufferParameter(buffer_enum, GL15.GL_BUFFER_SIZE);
+		return glGetBufferParameter(buffer_enum, GL_BUFFER_SIZE);
 	}
 
 	static int getBufferObjectSizeARB(ContextCapabilities caps, int buffer_enum) {
-		return ARBBufferObject.glGetBufferParameterARB(buffer_enum, ARBBufferObject.GL_BUFFER_SIZE_ARB);
+		return glGetBufferParameterARB(buffer_enum, GL_BUFFER_SIZE_ARB);
 	}
 
 	static int getBufferObjectSizeATI(ContextCapabilities caps, int buffer) {
-		return ATIVertexArrayObject.glGetObjectBufferATI(buffer, ATIVertexArrayObject.GL_OBJECT_BUFFER_SIZE_ATI);
+		return glGetObjectBufferATI(buffer, GL_OBJECT_BUFFER_SIZE_ATI);
 	}
 
 	static int getNamedBufferObjectSize(ContextCapabilities caps, int buffer) {
-		return EXTDirectStateAccess.glGetNamedBufferParameterEXT(buffer, GL15.GL_BUFFER_SIZE);
+		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.getReferencesStack(caps).getReferences().arrayBuffer != 0 )
+		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.getReferencesStack(caps).getReferences().arrayBuffer == 0 )
+		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.getReferencesStack(caps).getReferences().elementArrayBuffer != 0 )
+		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.getReferencesStack(caps).getReferences().elementArrayBuffer == 0 )
+		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.getReferencesStack(caps).getReferences().indirectBuffer != 0 )
+		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.getReferencesStack(caps).getReferences().indirectBuffer == 0 )
+		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.getReferencesStack(caps).getReferences().pixelPackBuffer != 0 )
+		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.getReferencesStack(caps).getReferences().pixelPackBuffer == 0 )
+		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.getReferencesStack(caps).getReferences().pixelUnpackBuffer != 0 )
+		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.getReferencesStack(caps).getReferences().pixelUnpackBuffer == 0 )
+		if ( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).pixelUnpackBuffer == 0 )
 			throw new OpenGLException("Cannot use offsets when Pixel Unpack Buffer Object is disabled");
 	}
 
@@ -193,17 +196,17 @@ class GLChecks {
 	private static int calculateBytesPerPixel(int format, int type) {
 		int bpe;
 		switch ( type ) {
-			case GL11.GL_UNSIGNED_BYTE:
-			case GL11.GL_BYTE:
+			case GL_UNSIGNED_BYTE:
+			case GL_BYTE:
 				bpe = 1;
 				break;
-			case GL11.GL_UNSIGNED_SHORT:
-			case GL11.GL_SHORT:
+			case GL_UNSIGNED_SHORT:
+			case GL_SHORT:
 				bpe = 2;
 				break;
-			case GL11.GL_UNSIGNED_INT:
-			case GL11.GL_INT:
-			case GL11.GL_FLOAT:
+			case GL_UNSIGNED_INT:
+			case GL_INT:
+			case GL_FLOAT:
 				bpe = 4;
 				break;
 			default :
@@ -213,21 +216,21 @@ class GLChecks {
 		}
 		int epp;
 		switch ( format ) {
-			case GL11.GL_LUMINANCE:
-			case GL11.GL_ALPHA:
+			case GL_LUMINANCE:
+			case GL_ALPHA:
 				epp = 1;
 				break;
 
-			case GL11.GL_LUMINANCE_ALPHA:
+			case GL_LUMINANCE_ALPHA:
 				epp = 2;
 				break;
-			case GL11.GL_RGB:
-			case EXTBgra.GL_BGR_EXT:
+			case GL_RGB:
+			case GL_BGR_EXT:
 				epp = 3;
 				break;
-			case GL11.GL_RGBA:
-			case EXTAbgr.GL_ABGR_EXT:
-			case EXTBgra.GL_BGRA_EXT:
+			case GL_RGBA:
+			case GL_ABGR_EXT:
+			case GL_BGRA_EXT:
 				epp = 4;
 				break;
 			default :
diff --git a/src/java/org/lwjgl/opengl/GLContext.java b/src/java/org/lwjgl/opengl/GLContext.java
index f315894..897a869 100644
--- a/src/java/org/lwjgl/opengl/GLContext.java
+++ b/src/java/org/lwjgl/opengl/GLContext.java
@@ -31,18 +31,20 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.BufferUtils;
 import org.lwjgl.LWJGLException;
 import org.lwjgl.LWJGLUtil;
 import org.lwjgl.Sys;
 
 import java.lang.reflect.Method;
-import java.nio.IntBuffer;
 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.*;
+
 /**
  * <p/>
  * Manages GL contexts. Before any rendering is done by a LWJGL system, a call should be made to GLContext.useContext() with a
@@ -54,13 +56,13 @@ import java.util.*;
  * That way, multiple threads can have multiple contexts current and render to them concurrently.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3355 $
- *          $Id: GLContext.java 3355 2010-05-27 22:56:29Z spasi $
+ * @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 final static ThreadLocal current_capabilities = new ThreadLocal();
+	private static final ThreadLocal<ContextCapabilities> current_capabilities = new ThreadLocal<ContextCapabilities>();
 
 	/**
 	 * The getCapabilities() method is a potential hot spot in any LWJGL application, since
@@ -92,13 +94,13 @@ public final class GLContext {
 	 * Simple lock-free cache of CapabilitesEntryCache to avoid allocating more than one
 	 * cache entry per thread
 	 */
-	private final static ThreadLocal thread_cache_entries = new ThreadLocal();
+	private static final ThreadLocal<CapabilitiesCacheEntry> thread_cache_entries = new ThreadLocal<CapabilitiesCacheEntry>();
 
 	/**
 	 * The weak mapping from context Object instances to ContextCapabilities. Used
 	 * to avoid recreating a ContextCapabilities every time a context is made current.
 	 */
-	private final static Map capability_cache = new WeakHashMap();
+	private static final Map<Object, ContextCapabilities> capability_cache = new WeakHashMap<Object, ContextCapabilities>();
 
 	/** Reference count of the native opengl implementation library */
 	private static int gl_ref_count;
@@ -127,7 +129,7 @@ public final class GLContext {
 	}
 
 	private static ContextCapabilities getThreadLocalCapabilities() {
-		return ((ContextCapabilities)current_capabilities.get());
+		return current_capabilities.get();
 	}
 
 	/**
@@ -139,7 +141,7 @@ public final class GLContext {
 	static void setCapabilities(ContextCapabilities capabilities) {
 		current_capabilities.set(capabilities);
 
-		CapabilitiesCacheEntry thread_cache_entry = (CapabilitiesCacheEntry)thread_cache_entries.get();
+		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);
@@ -155,8 +157,8 @@ public final class GLContext {
 	 * 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 = (String)AccessController.doPrivileged(new PrivilegedAction() {
-			public Object run() {
+		String os_name = AccessController.doPrivileged(new PrivilegedAction<String>() {
+			public String run() {
 				return System.getProperty("os.name");
 			}
 		});
@@ -177,8 +179,8 @@ public final class GLContext {
 	 * @return the function pointer address
 	 */
 	static long getFunctionAddress(String[] aliases) {
-		for ( int i = 0; i < aliases.length; i++ ) {
-			long address = getFunctionAddress(aliases[i]);
+		for ( String alias : aliases ) {
+			long address = getFunctionAddress(alias);
 			if ( address != 0 )
 				return address;
 		}
@@ -195,10 +197,10 @@ public final class GLContext {
 	 *
 	 * @return the context profile mask, will be 0 for any version < 3.2
 	 */
-	static int getSupportedExtensions(final Set supported_extensions) {
+	static int getSupportedExtensions(final Set<String> supported_extensions) {
 		// Detect OpenGL version first
 
-		final String version = GL11.glGetString(GL11.GL_VERSION);
+		final String version = glGetString(GL_VERSION);
 		if ( version == null )
 			throw new IllegalStateException("glGetString(GL_VERSION) returned null - possibly caused by missing current context.");
 
@@ -215,43 +217,26 @@ public final class GLContext {
 			LWJGLUtil.log("The major and/or minor OpenGL version is malformed: " + e.getMessage());
 		}
 
-		// ----------------------[ 4.X ]----------------------
-		if ( 4 <= majorVersion )
-			supported_extensions.add("OpenGL40");
-
-		// ----------------------[ 3.X ]----------------------
-		if ( 3 < majorVersion || (3 == majorVersion && 3 <= minorVersion) )
-			supported_extensions.add("OpenGL33");
-		if ( 3 < majorVersion || (3 == majorVersion && 2 <= minorVersion) )
-			supported_extensions.add("OpenGL32");
-		if ( 3 < majorVersion || (3 == majorVersion && 1 <= minorVersion) )
-			supported_extensions.add("OpenGL31");
-		if ( 3 <= majorVersion )
-			supported_extensions.add("OpenGL30");
-
-		// ----------------------[ 2.X ]----------------------
-		if ( 2 < majorVersion || (2 == majorVersion && 1 <= minorVersion) )
-			supported_extensions.add("OpenGL21");
-		if ( 2 <= majorVersion )
-			supported_extensions.add("OpenGL20");
-
-		// ----------------------[ 1.X ]----------------------
-		if ( 1 < majorVersion || 5 <= minorVersion )
-			supported_extensions.add("OpenGL15");
-		if ( 1 < majorVersion || 4 <= minorVersion )
-			supported_extensions.add("OpenGL14");
-		if ( 1 < majorVersion || 3 <= minorVersion )
-			supported_extensions.add("OpenGL13");
-		if ( 1 < majorVersion || 2 <= minorVersion )
-			supported_extensions.add("OpenGL12");
-		if ( 1 < majorVersion || 1 <= minorVersion )
-			supported_extensions.add("OpenGL11");
+		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 = GL11.glGetString(GL11.GL_EXTENSIONS);
+			final String extensions_string = glGetString(GL_EXTENSIONS);
 			if ( extensions_string == null )
 				throw new IllegalStateException("glGetString(GL_EXTENSIONS) returned null - is there a context current?");
 
@@ -260,24 +245,20 @@ public final class GLContext {
 				supported_extensions.add(tokenizer.nextToken());
 		} else {
 			// Use forward compatible indexed EXTENSIONS
-			final IntBuffer buffer = BufferUtils.createIntBuffer(16);
-			GL11.glGetInteger(GL30.GL_NUM_EXTENSIONS, buffer);
-			final int extensionCount = buffer.get(0);
+			final int extensionCount = glGetInteger(GL_NUM_EXTENSIONS);
 
 			for ( int i = 0; i < extensionCount; i++ )
-				supported_extensions.add(GL30.glGetStringi(GL11.GL_EXTENSIONS, 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
 
-				GL11.glGetInteger(GL32.GL_CONTEXT_PROFILE_MASK, buffer);
-
 				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();
-					profileMask = buffer.get(0);
 				} catch (OpenGLException e) {
 					LWJGLUtil.log("Failed to retrieve CONTEXT_PROFILE_MASK");
 				}
@@ -291,14 +272,14 @@ public final class GLContext {
 	 * 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) {
+	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() {
+				AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
 					public Object run() throws Exception {
-						Method init_stubs_method = extension_class.getDeclaredMethod("initNativeStubs", null);
-						init_stubs_method.invoke(null, null);
+						Method init_stubs_method = extension_class.getDeclaredMethod("initNativeStubs");
+						init_stubs_method.invoke(null);
 						return null;
 					}
 				});
@@ -357,7 +338,7 @@ public final class GLContext {
 			did_auto_load = true;
 		}
 		try {
-			ContextCapabilities capabilities = (ContextCapabilities)capability_cache.get(context);
+			ContextCapabilities capabilities = capability_cache.get(context);
 			if ( capabilities == null ) {
 				/*
 				 * The capabilities object registers itself as current. This behaviour is caused
@@ -401,7 +382,7 @@ public final class GLContext {
 	/** Native method to clear native stub bindings */
 	static native void resetNativeStubs(Class clazz);
 
-	private final static class CapabilitiesCacheEntry {
+	private static final class CapabilitiesCacheEntry {
 
 		Thread owner;
 		ContextCapabilities capabilities;
diff --git a/src/java/org/lwjgl/opengl/GLSync.java b/src/java/org/lwjgl/opengl/GLSync.java
index 721990e..f9166b0 100644
--- a/src/java/org/lwjgl/opengl/GLSync.java
+++ b/src/java/org/lwjgl/opengl/GLSync.java
@@ -31,19 +31,17 @@
  */
 package org.lwjgl.opengl;
 
+import org.lwjgl.PointerWrapperAbstract;
+
 /**
+ * This class is a wrapper around a GLsync pointer.
+ *
  * @author spasi <spasi at users.sourceforge.net>
  */
-public final class GLSync implements PointerWrapper {
-
-	private final long sync;
+public final class GLSync extends PointerWrapperAbstract {
 
 	GLSync(final long sync) {
-		this.sync = sync;
-	}
-
-	public long getPointer() {
-		return sync;
+		super(sync);
 	}
 
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengl/GLUConstants.java b/src/java/org/lwjgl/opengl/GLUConstants.java
index 7023b8c..356e6a5 100644
--- a/src/java/org/lwjgl/opengl/GLUConstants.java
+++ b/src/java/org/lwjgl/opengl/GLUConstants.java
@@ -31,13 +31,15 @@
  */
 package org.lwjgl.opengl;
 
+import static org.lwjgl.opengl.GL11.*;
+
 /**
  * <p/>
  * GLU constants.
  *
  * @author cix_foo <cix_foo at users.sourceforge.net>
- * @version $Revision: 2983 $
- * $Id: GLUConstants.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: GLUConstants.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public interface GLUConstants {
 
@@ -52,7 +54,7 @@ public interface GLUConstants {
 	int GLU_EXTENSIONS = 100801;
 
 	/* Boolean */
-	int GLU_TRUE = GL11.GL_TRUE;
-	int GLU_FALSE = GL11.GL_FALSE;
+	int GLU_TRUE = GL_TRUE;
+	int GLU_FALSE = GL_FALSE;
 
 }
diff --git a/src/java/org/lwjgl/opengl/GlobalLock.java b/src/java/org/lwjgl/opengl/GlobalLock.java
index a834f01..0dc7c5e 100644
--- a/src/java/org/lwjgl/opengl/GlobalLock.java
+++ b/src/java/org/lwjgl/opengl/GlobalLock.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -36,5 +36,5 @@ package org.lwjgl.opengl;
  * synchronize access to Display.
  */
 final class GlobalLock {
-	final static Object lock = new Object();
+	static final Object lock = new Object();
 }
diff --git a/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java b/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java
index 65e35ea..4b068bc 100644
--- a/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java
+++ b/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java
@@ -44,19 +44,19 @@ import org.lwjgl.LWJGLUtil;
 /**
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3002 $
- * $Id: LinuxCanvasImplementation.java 3002 2008-04-10 20:25:54Z 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 = (Method)AccessController.doPrivileged(new PrivilegedExceptionAction() {
-				public Object run() throws Exception {
-					return device.getClass().getMethod("getScreen", null);
+			Method getScreen_method = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
+				public Method run() throws Exception {
+					return device.getClass().getMethod("getScreen");
 				}
 			});
-			Integer screen = (Integer)getScreen_method.invoke(device, null);
-			return screen.intValue();
+			Integer screen = (Integer)getScreen_method.invoke(device);
+			return screen;
 		} catch (Exception e) {
 			throw new LWJGLException(e);
 		}
@@ -64,13 +64,13 @@ final class LinuxCanvasImplementation implements AWTCanvasImplementation {
 
 	private static int getVisualIDFromConfiguration(final GraphicsConfiguration configuration) throws LWJGLException {
 		try {
-			Method getVisual_method = (Method)AccessController.doPrivileged(new PrivilegedExceptionAction() {
-				public Object run() throws Exception {
-					return configuration.getClass().getMethod("getVisual", null);
+			Method getVisual_method = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
+				public Method run() throws Exception {
+					return configuration.getClass().getMethod("getVisual");
 				}
 			});
-			Integer visual = (Integer)getVisual_method.invoke(configuration, null);
-			return visual.intValue();
+			Integer visual = (Integer)getVisual_method.invoke(configuration);
+			return visual;
 		} catch (Exception e) {
 			throw new LWJGLException(e);
 		}
@@ -90,10 +90,10 @@ final class LinuxCanvasImplementation implements AWTCanvasImplementation {
 			int screen = getScreenFromDevice(device);
 			int visual_id_matching_format = findVisualIDFromFormat(screen, pixel_format);
 			GraphicsConfiguration[] configurations = device.getConfigurations();
-			for (int i = 0; i < configurations.length; i++) {
-				int visual_id = getVisualIDFromConfiguration(configurations[i]);
-				if (visual_id == visual_id_matching_format)
-					return configurations[i];
+			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);
diff --git a/src/java/org/lwjgl/opengl/LinuxContextImplementation.java b/src/java/org/lwjgl/opengl/LinuxContextImplementation.java
index a048074..4ad98be 100644
--- a/src/java/org/lwjgl/opengl/LinuxContextImplementation.java
+++ b/src/java/org/lwjgl/opengl/LinuxContextImplementation.java
@@ -38,8 +38,8 @@ import java.nio.IntBuffer;
 
 /**
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3116 $
- *          $Id: LinuxContextImplementation.java 3116 2008-08-19 16:46:03Z spasi $
+ * @version $Revision: 3412 $
+ *          $Id: LinuxContextImplementation.java 3412 2010-09-26 23:43:24Z spasi $
  */
 final class LinuxContextImplementation implements ContextImplementation {
 
@@ -59,6 +59,10 @@ final class LinuxContextImplementation implements ContextImplementation {
 
 	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 {
 	}
 
diff --git a/src/java/org/lwjgl/opengl/LinuxDisplay.java b/src/java/org/lwjgl/opengl/LinuxDisplay.java
index 6721692..2795538 100644
--- a/src/java/org/lwjgl/opengl/LinuxDisplay.java
+++ b/src/java/org/lwjgl/opengl/LinuxDisplay.java
@@ -54,32 +54,31 @@ import org.lwjgl.opengl.XRandR.Screen;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 final class LinuxDisplay implements DisplayImplementation {
 	/* X11 constants */
-	public final static int CurrentTime = 0;
-	public final static int GrabSuccess = 0;
-	public final static int AutoRepeatModeOff  = 0;
-	public final static int AutoRepeatModeOn = 1;
-	public final static int AutoRepeatModeDefault = 2;
-	public final static int None = 0;
-
-	private final static int KeyPressMask = 1 << 0;
-	private final static int KeyReleaseMask = 1 << 1;
-	private final static int ButtonPressMask = 1 << 2;
-	private final static int ButtonReleaseMask = 1 << 3;
-
-	private final static int NotifyAncestor = 0;
-	private final static int NotifyNonlinear = 3;
-	private final static int NotifyPointer = 5;
-	private final static int NotifyPointerRoot = 6;
-	private final static int NotifyDetailNone = 7;
-
-	private final static int SetModeInsert = 0;
-	private final static int SaveSetRoot = 1;
-	private final static int SaveSetUnmap = 1;
+	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;
@@ -99,7 +98,7 @@ final class LinuxDisplay implements DisplayImplementation {
 	private static long current_window;
 	private static long saved_error_handler;
 
-	private static int display_connection_usage_count = 0;
+	private static int display_connection_usage_count;
 
 	/** Event buffer */
 	private final LinuxEvent event_buffer = new LinuxEvent();
@@ -120,7 +119,7 @@ final class LinuxDisplay implements DisplayImplementation {
 	/** Saved mode to restore with */
 	private DisplayMode saved_mode;
 	private DisplayMode current_mode;
-	
+
 	private Screen[] savedXrandrConfig;
 
 	private boolean keyboard_grabbed;
@@ -137,7 +136,8 @@ final class LinuxDisplay implements DisplayImplementation {
 	private long parent_window;
 	private boolean xembedded;
 	private boolean parent_focus;
-
+	private boolean mouseInside = true;
+	
 	private LinuxKeyboard keyboard;
 	private LinuxMouse mouse;
 
@@ -369,7 +369,7 @@ final class LinuxDisplay implements DisplayImplementation {
 	}
 	static native int nUngrabPointer(long display);
 
-	private boolean isFullscreen() {
+	private static boolean isFullscreen() {
 		return current_window_mode == FULLSCREEN_LEGACY || current_window_mode == FULLSCREEN_NETWM;
 	}
 
@@ -397,7 +397,7 @@ final class LinuxDisplay implements DisplayImplementation {
 	}
 	private static native void nDefineCursor(long display, long window, long cursor_handle);
 
-	private boolean isLegacyFullscreen() {
+	private static boolean isLegacyFullscreen() {
 		return current_window_mode == FULLSCREEN_LEGACY;
 	}
 
@@ -544,7 +544,7 @@ final class LinuxDisplay implements DisplayImplementation {
 		try {
 			if( current_displaymode_extension == XRANDR && savedXrandrConfig.length > 0 )
 			{
-				AccessController.doPrivileged(new PrivilegedAction() {
+				AccessController.doPrivileged(new PrivilegedAction<Object>() {
 					public Object run() {
 						XRandR.setConfiguration( savedXrandrConfig );
 						return null;
@@ -607,7 +607,7 @@ final class LinuxDisplay implements DisplayImplementation {
 		}
 	}
 
-	private void setGammaRampOnTmpDisplay(ByteBuffer native_gamma) throws LWJGLException {
+	private static void setGammaRampOnTmpDisplay(ByteBuffer native_gamma) throws LWJGLException {
 		incDisplay();
 		try {
 			nSetGammaRamp(getDisplay(), getDefaultScreen(), native_gamma);
@@ -644,8 +644,8 @@ final class LinuxDisplay implements DisplayImplementation {
 				throw new LWJGLException("No modes available");
 			switch (current_displaymode_extension) {
 				case XRANDR:
-					savedXrandrConfig = (Screen[])AccessController.doPrivileged(new PrivilegedAction() {
-						public Object run() {
+					savedXrandrConfig = AccessController.doPrivileged(new PrivilegedAction<Screen[]>() {
+						public Screen[] run() {
 							return XRandR.getConfiguration();
 						}
 					});
@@ -778,6 +778,12 @@ final class LinuxDisplay implements DisplayImplementation {
 				case LinuxEvent.Expose:
 					dirty = true;
 					break;
+				case LinuxEvent.EnterNotify:
+					mouseInside = true;
+					break;
+				case LinuxEvent.LeaveNotify:
+					mouseInside = false;
+					break;
 				default:
 					break;
 			}
@@ -872,10 +878,10 @@ final class LinuxDisplay implements DisplayImplementation {
 
 	private void checkInput() {
 		if (parent == null) return;
-		
+
 		if (parent_focus != parent.hasFocus()) {
 			parent_focus = parent.hasFocus();
-			
+
 			if (parent_focus) {
 				setInputFocusUnsafe(current_window);
 			}
@@ -892,17 +898,19 @@ final class LinuxDisplay implements DisplayImplementation {
 		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 void setInputFocusUnsafe(long window) {
+	private static void setInputFocusUnsafe(long window) {
 		try {
 			setInputFocus(getDisplay(), window, CurrentTime);
 			sync(getDisplay(), false);
@@ -923,7 +931,7 @@ final class LinuxDisplay implements DisplayImplementation {
 			try {
 				if( current_displaymode_extension == XRANDR && savedXrandrConfig.length > 0 )
 				{
-					AccessController.doPrivileged(new PrivilegedAction() {
+					AccessController.doPrivileged(new PrivilegedAction<Object>() {
 						public Object run() {
 							XRandR.setConfiguration( savedXrandrConfig );
 							return null;
@@ -1088,7 +1096,7 @@ final class LinuxDisplay implements DisplayImplementation {
 			incDisplay();
 			try {
 				long cursor = nCreateCursor(getDisplay(), width, height, xHotspot, yHotspot, numImages, images, images.position(), delays, delays != null ? delays.position() : -1);
-				return new Long(cursor);
+				return cursor;
 			} catch (LWJGLException e) {
 				decDisplay();
 				throw e;
@@ -1099,7 +1107,7 @@ final class LinuxDisplay implements DisplayImplementation {
 	}
 
 	private static long getCursorHandle(Object cursor_handle) {
-		return cursor_handle != null ? ((Long)cursor_handle).longValue() : None;
+		return cursor_handle != null ? (Long)cursor_handle : None;
 	}
 
 	public void destroyCursor(Object cursorHandle) {
@@ -1215,12 +1223,12 @@ final class LinuxDisplay implements DisplayImplementation {
 		try {
 			incDisplay();
 			try {
-				for (int i=0;i<icons.length;i++) {
-					int size = icons[i].limit() / 4;
+				for ( ByteBuffer icon : icons ) {
+					int size = icon.limit() / 4;
 					int dimension = (int)Math.sqrt(size);
-					if (dimension > 0) {
-						ByteBuffer icon_rgb = convertIcon(icons[i], dimension, dimension);
-						ByteBuffer icon_mask = convertIconMask(icons[i], dimension, dimension);
+					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;
 					}
@@ -1247,9 +1255,9 @@ final class LinuxDisplay implements DisplayImplementation {
 		return Display.getDisplayMode().getHeight();
 	}
 
-        public boolean isInsideWindow() {
-            return true;
-        }
+	public boolean isInsideWindow() {
+		return mouseInside;
+	}
 
 	/**
 	 * Helper class for managing Compiz's workarounds. We need this to enable Legacy
@@ -1272,7 +1280,7 @@ final class LinuxDisplay implements DisplayImplementation {
 			if ( Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.nocompiz_lfs") )
 				return;
 
-			AccessController.doPrivileged(new PrivilegedAction() {
+			AccessController.doPrivileged(new PrivilegedAction<Object>() {
 				public Object run() {
 					try {
 						// Check if Compiz is active
@@ -1291,9 +1299,9 @@ final class LinuxDisplay implements DisplayImplementation {
 								private static final String KEY = "/org/freedesktop/compiz/workarounds/allscreens/legacy_fullscreen";
 
 								public boolean hasLegacyFullscreenSupport() throws LWJGLException {
-									final List output = Compiz.run(new String[] {
+									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.");
@@ -1311,9 +1319,9 @@ final class LinuxDisplay implements DisplayImplementation {
 								}
 
 								public void setLegacyFullscreenSupport(final boolean state) throws LWJGLException {
-									if ( Compiz.run(new String[] {
+									if ( Compiz.run(
 										"dbus-send", "--type=method_call", "--dest=org.freedesktop.compiz", KEY, "org.freedesktop.compiz.set", "boolean:" + Boolean.toString(state)
-									}) == null )
+									) == null )
 										throw new LWJGLException("Failed to apply Compiz LFS workaround.");
 								}
 							};
@@ -1377,7 +1385,7 @@ final class LinuxDisplay implements DisplayImplementation {
 			if ( !applyFix )
 				return;
 
-			AccessController.doPrivileged(new PrivilegedAction() {
+			AccessController.doPrivileged(new PrivilegedAction<Object>() {
 				public Object run() {
 					try {
 						provider.setLegacyFullscreenSupport(enabled);
@@ -1389,8 +1397,8 @@ final class LinuxDisplay implements DisplayImplementation {
 			});
 		}
 
-		private static List run(final String[] command) throws LWJGLException {
-			final List output = new ArrayList();
+		private static List<String> run(final String... command) throws LWJGLException {
+			final List<String> output = new ArrayList<String>();
 
 			try {
 				final Process p = Runtime.getRuntime().exec(command);
@@ -1417,13 +1425,12 @@ final class LinuxDisplay implements DisplayImplementation {
 		}
 
 		private static boolean isProcessActive(final String processName) throws LWJGLException {
-			final List output = run(new String[] { "ps", "-C", processName });
+			final List<String> output = run(new String[] { "ps", "-C", processName });
 			if ( output == null )
 				return false;
 
-			for ( Iterator iter = output.iterator(); iter.hasNext(); ) {
-				final String line = (String)iter.next();
-				if ( line.contains(processName) );
+			for ( final String line : output ) {
+				if ( line.contains(processName) )
 					return true;
 			}
 
diff --git a/src/java/org/lwjgl/opengl/LinuxEvent.java b/src/java/org/lwjgl/opengl/LinuxEvent.java
index a29b76e..fb8e982 100644
--- a/src/java/org/lwjgl/opengl/LinuxEvent.java
+++ b/src/java/org/lwjgl/opengl/LinuxEvent.java
@@ -41,17 +41,19 @@ import java.nio.ByteBuffer;
  * $Id: LinuxPeerInfo.java 2286 2006-03-23 19:32:21Z matzon $
  */
 final class LinuxEvent {
-	public final static int FocusIn         = 9;
-	public final static int FocusOut        = 10;
-	public final static int KeyPress        = 2;
-	public final static int KeyRelease      = 3;
-	public final static int ButtonPress     = 4;
-	public final static int ButtonRelease      = 5;
-	public final static int MotionNotify       = 6;
-	public final static int UnmapNotify     = 18;
-	public final static int MapNotify       = 19;
-	public final static int Expose          = 12;
-	public final static int ClientMessage       = 33;
+	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;
 
diff --git a/src/java/org/lwjgl/opengl/LinuxKeycodes.java b/src/java/org/lwjgl/opengl/LinuxKeycodes.java
index 9542d08..c57cbd0 100644
--- a/src/java/org/lwjgl/opengl/LinuxKeycodes.java
+++ b/src/java/org/lwjgl/opengl/LinuxKeycodes.java
@@ -38,111 +38,111 @@ package org.lwjgl.opengl;
 import org.lwjgl.input.Keyboard;
 
 final class LinuxKeycodes {
-	public final static int XK_Kanji                         = 0xff21;
-
-	public final static int XK_ISO_Left_Tab                  = 0xfe20;
-	
-	public final static int XK_dead_grave                    = 0xfe50;
-	public final static int XK_dead_acute                    = 0xfe51;
-	public final static int XK_dead_circumflex               = 0xfe52;
-	public final static int XK_dead_tilde                    = 0xfe53;
-	public final static int XK_dead_macron                   = 0xfe54;
-	public final static int XK_dead_breve                    = 0xfe55;
-	public final static int XK_dead_abovedot                 = 0xfe56;
-	public final static int XK_dead_diaeresis                = 0xfe57;
-	public final static int XK_dead_abovering                = 0xfe58;
-	public final static int XK_dead_doubleacute              = 0xfe59;
-	public final static int XK_dead_caron                    = 0xfe5a;
-	public final static int XK_dead_cedilla                  = 0xfe5b;
-	public final static int XK_dead_ogonek                   = 0xfe5c;
-	public final static int XK_dead_iota                     = 0xfe5d;
-	public final static int XK_dead_voiced_sound             = 0xfe5e;
-	public final static int XK_dead_semivoiced_sound         = 0xfe5f;
-	public final static int XK_dead_belowdot                 = 0xfe60;
-	public final static int XK_dead_hook                     = 0xfe61;
-	public final static int XK_dead_horn                     = 0xfe62;
-
-	public final static int XK_BackSpace                     = 0xff08;
-	public final static int XK_Tab                           = 0xff09;
-	public final static int XK_Linefeed                      = 0xff0a;
-	public final static int XK_Clear                         = 0xff0b;
-	public final static int XK_Return                        = 0xff0d;
-	public final static int XK_Pause                         = 0xff13;
-	public final static int XK_Scroll_Lock                   = 0xff14;
-	public final static int XK_Sys_Req                       = 0xff15;
-	public final static int XK_Escape                        = 0xff1b;
-	public final static int XK_Delete                        = 0xffff;
-
-	public final static int XK_Home                          = 0xff50;
-	public final static int XK_Left                          = 0xff51;
-	public final static int XK_Up                            = 0xff52;
-	public final static int XK_Right                         = 0xff53;
-	public final static int XK_Down                          = 0xff54;
-	public final static int XK_Prior                         = 0xff55;
-	public final static int XK_Page_Up                       = 0xff55;
-	public final static int XK_Next                          = 0xff56;
-	public final static int XK_Page_Down                     = 0xff56;
-	public final static int XK_End                           = 0xff57;
-	public final static int XK_Begin                         = 0xff58;
+	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 final static int XK_Select                        = 0xff60;
-	public final static int XK_Print                         = 0xff61;
-	public final static int XK_Execute                       = 0xff62;
-	public final static int XK_Insert                        = 0xff63;
-	public final static int XK_Undo                          = 0xff65;
-	public final static int XK_Redo                          = 0xff66;
-	public final static int XK_Menu                          = 0xff67;
-	public final static int XK_Find                          = 0xff68;
-	public final static int XK_Cancel                        = 0xff69;
-	public final static int XK_Help                          = 0xff6a;
-	public final static int XK_Break                         = 0xff6b;
-	public final static int XK_Mode_switch                   = 0xff7e;
-	public final static int XK_script_switch                 = 0xff7e;
-	public final static int XK_Num_Lock                      = 0xff7f;
+	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 final static int XK_KP_Space                      = 0xff80;
-	public final static int XK_KP_Tab                        = 0xff89;
-	public final static int XK_KP_Enter                      = 0xff8d;
-	public final static int XK_KP_F1                         = 0xff91;
-	public final static int XK_KP_F2                         = 0xff92;
-	public final static int XK_KP_F3                         = 0xff93;
-	public final static int XK_KP_F4                         = 0xff94;
-	public final static int XK_KP_Home                       = 0xff95;
-	public final static int XK_KP_Left                       = 0xff96;
-	public final static int XK_KP_Up                         = 0xff97;
-	public final static int XK_KP_Right                      = 0xff98;
-	public final static int XK_KP_Down                       = 0xff99;
-	public final static int XK_KP_Prior                      = 0xff9a;
-	public final static int XK_KP_Page_Up                    = 0xff9a;
-	public final static int XK_KP_Next                       = 0xff9b;
-	public final static int XK_KP_Page_Down                  = 0xff9b;
-	public final static int XK_KP_End                        = 0xff9c;
-	public final static int XK_KP_Begin                      = 0xff9d;
-	public final static int XK_KP_Insert                     = 0xff9e;
-	public final static int XK_KP_Delete                     = 0xff9f;
-	public final static int XK_KP_Equal                      = 0xffbd;
-	public final static int XK_KP_Multiply                   = 0xffaa;
-	public final static int XK_KP_Add                        = 0xffab;
-	public final static int XK_KP_Separator                  = 0xffac;
-	public final static int XK_KP_Subtract                   = 0xffad;
-	public final static int XK_KP_Decimal                    = 0xffae;
-	public final static int XK_KP_Divide                     = 0xffaf;
-
-	public final static int XK_KP_0                          = 0xffb0;
-	public final static int XK_KP_1                          = 0xffb1;
-	public final static int XK_KP_2                          = 0xffb2;
-	public final static int XK_KP_3                          = 0xffb3;
-	public final static int XK_KP_4                          = 0xffb4;
-	public final static int XK_KP_5                          = 0xffb5;
-	public final static int XK_KP_6                          = 0xffb6;
-	public final static int XK_KP_7                          = 0xffb7;
-	public final static int XK_KP_8                          = 0xffb8;
-	public final static int XK_KP_9                          = 0xffb9;
+	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;
 
 
 
@@ -153,285 +153,285 @@ final class LinuxKeycodes {
  * We've not found a keyboard with more than 35 function keys total.
  */
 
-	public final static int XK_F1                            = 0xffbe;
-	public final static int XK_F2                            = 0xffbf;
-	public final static int XK_F3                            = 0xffc0;
-	public final static int XK_F4                            = 0xffc1;
-	public final static int XK_F5                            = 0xffc2;
-	public final static int XK_F6                            = 0xffc3;
-	public final static int XK_F7                            = 0xffc4;
-	public final static int XK_F8                            = 0xffc5;
-	public final static int XK_F9                            = 0xffc6;
-	public final static int XK_F10                           = 0xffc7;
-	public final static int XK_F11                           = 0xffc8;
-	public final static int XK_L1                            = 0xffc8;
-	public final static int XK_F12                           = 0xffc9;
-	public final static int XK_L2                            = 0xffc9;
-	public final static int XK_F13                           = 0xffca;
-	public final static int XK_L3                            = 0xffca;
-	public final static int XK_F14                           = 0xffcb;
-	public final static int XK_L4                            = 0xffcb;
-	public final static int XK_F15                           = 0xffcc;
-	public final static int XK_L5                            = 0xffcc;
-	public final static int XK_F16                           = 0xffcd;
-	public final static int XK_L6                            = 0xffcd;
-	public final static int XK_F17                           = 0xffce;
-	public final static int XK_L7                            = 0xffce;
-	public final static int XK_F18                           = 0xffcf;
-	public final static int XK_L8                            = 0xffcf;
-	public final static int XK_F19                           = 0xffd0;
-	public final static int XK_L9                            = 0xffd0;
-	public final static int XK_F20                           = 0xffd1;
-	public final static int XK_L10                           = 0xffd1;
-	public final static int XK_F21                           = 0xffd2;
-	public final static int XK_R1                            = 0xffd2;
-	public final static int XK_F22                           = 0xffd3;
-	public final static int XK_R2                            = 0xffd3;
-	public final static int XK_F23                           = 0xffd4;
-	public final static int XK_R3                            = 0xffd4;
-	public final static int XK_F24                           = 0xffd5;
-	public final static int XK_R4                            = 0xffd5;
-	public final static int XK_F25                           = 0xffd6;
-	public final static int XK_R5                            = 0xffd6;
-	public final static int XK_F26                           = 0xffd7;
-	public final static int XK_R6                            = 0xffd7;
-	public final static int XK_F27                           = 0xffd8;
-	public final static int XK_R7                            = 0xffd8;
-	public final static int XK_F28                           = 0xffd9;
-	public final static int XK_R8                            = 0xffd9;
-	public final static int XK_F29                           = 0xffda;
-	public final static int XK_R9                            = 0xffda;
-	public final static int XK_F30                           = 0xffdb;
-	public final static int XK_R10                           = 0xffdb;
-	public final static int XK_F31                           = 0xffdc;
-	public final static int XK_R11                           = 0xffdc;
-	public final static int XK_F32                           = 0xffdd;
-	public final static int XK_R12                           = 0xffdd;
-	public final static int XK_F33                           = 0xffde;
-	public final static int XK_R13                           = 0xffde;
-	public final static int XK_F34                           = 0xffdf;
-	public final static int XK_R14                           = 0xffdf;
-	public final static int XK_F35                           = 0xffe0;
-	public final static int XK_R15                           = 0xffe0;
+	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 final static int XK_Shift_L                       = 0xffe1;
-	public final static int XK_Shift_R                       = 0xffe2;
-	public final static int XK_Control_L                     = 0xffe3;
-	public final static int XK_Control_R                     = 0xffe4;
-	public final static int XK_Caps_Lock                     = 0xffe5;
-	public final static int XK_Shift_Lock                    = 0xffe6;
-
-	public final static int XK_Meta_L                        = 0xffe7;
-	public final static int XK_Meta_R                        = 0xffe8;
-	public final static int XK_Alt_L                         = 0xffe9;
-	public final static int XK_Alt_R                         = 0xffea;
-	public final static int XK_Super_L                       = 0xffeb;
-	public final static int XK_Super_R                       = 0xffec;
-	public final static int XK_Hyper_L                       = 0xffed;
-	public final static int XK_Hyper_R                       = 0xffee;
-	public final static int XK_space                         = 0x0020;
-	public final static int XK_exclam                        = 0x0021;
-	public final static int XK_quotedbl                      = 0x0022;
-	public final static int XK_numbersign                    = 0x0023;
-	public final static int XK_dollar                        = 0x0024;
-	public final static int XK_percent                       = 0x0025;
-	public final static int XK_ampersand                     = 0x0026;
-	public final static int XK_apostrophe                    = 0x0027;
-	public final static int XK_quoteright                    = 0x0027;
-	public final static int XK_parenleft                     = 0x0028;
-	public final static int XK_parenright                    = 0x0029;
-	public final static int XK_asterisk                      = 0x002a;
-	public final static int XK_plus                          = 0x002b;
-	public final static int XK_comma                         = 0x002c;
-	public final static int XK_minus                         = 0x002d;
-	public final static int XK_period                        = 0x002e;
-	public final static int XK_slash                         = 0x002f;
-
-	public final static int XK_0                             = 0x0030;
-	public final static int XK_1                             = 0x0031;
-	public final static int XK_2                             = 0x0032;
-	public final static int XK_3                             = 0x0033;
-	public final static int XK_4                             = 0x0034;
-	public final static int XK_5                             = 0x0035;
-	public final static int XK_6                             = 0x0036;
-	public final static int XK_7                             = 0x0037;
-	public final static int XK_8                             = 0x0038;
-	public final static int XK_9                             = 0x0039;
-	public final static int XK_colon                         = 0x003a;
-	public final static int XK_semicolon                     = 0x003b;
-	public final static int XK_less                          = 0x003c;
-	public final static int XK_equal                         = 0x003d;
-	public final static int XK_greater                       = 0x003e;
-	public final static int XK_question                      = 0x003f;
-	public final static int XK_at                            = 0x0040;
-	public final static int XK_A                             = 0x0041;
-	public final static int XK_B                             = 0x0042;
-	public final static int XK_C                             = 0x0043;
-	public final static int XK_D                             = 0x0044;
-	public final static int XK_E                             = 0x0045;
-	public final static int XK_F                             = 0x0046;
-	public final static int XK_G                             = 0x0047;
-	public final static int XK_H                             = 0x0048;
-	public final static int XK_I                             = 0x0049;
-	public final static int XK_J                             = 0x004a;
-	public final static int XK_K                             = 0x004b;
-	public final static int XK_L                             = 0x004c;
-	public final static int XK_M                             = 0x004d;
-	public final static int XK_N                             = 0x004e;
-	public final static int XK_O                             = 0x004f;
-	public final static int XK_P                             = 0x0050;
-	public final static int XK_Q                             = 0x0051;
-	public final static int XK_R                             = 0x0052;
-	public final static int XK_S                             = 0x0053;
-	public final static int XK_T                             = 0x0054;
-	public final static int XK_U                             = 0x0055;
-	public final static int XK_V                             = 0x0056;
-	public final static int XK_W                             = 0x0057;
-	public final static int XK_X                             = 0x0058;
-	public final static int XK_Y                             = 0x0059;
-	public final static int XK_Z                             = 0x005a;
-	public final static int XK_bracketleft                   = 0x005b;
-	public final static int XK_backslash                     = 0x005c;
-	public final static int XK_bracketright                  = 0x005d;
-	public final static int XK_asciicircum                   = 0x005e;
-	public final static int XK_underscore                    = 0x005f;
-	public final static int XK_grave                         = 0x0060;
-	public final static int XK_quoteleft                     = 0x0060;
-	public final static int XK_a                             = 0x0061;
-	public final static int XK_b                             = 0x0062;
-	public final static int XK_c                             = 0x0063;
-	public final static int XK_d                             = 0x0064;
-	public final static int XK_e                             = 0x0065;
-	public final static int XK_f                             = 0x0066;
-	public final static int XK_g                             = 0x0067;
-	public final static int XK_h                             = 0x0068;
-	public final static int XK_i                             = 0x0069;
-	public final static int XK_j                             = 0x006a;
-	public final static int XK_k                             = 0x006b;
-	public final static int XK_l                             = 0x006c;
-	public final static int XK_m                             = 0x006d;
-	public final static int XK_n                             = 0x006e;
-	public final static int XK_o                             = 0x006f;
-	public final static int XK_p                             = 0x0070;
-	public final static int XK_q                             = 0x0071;
-	public final static int XK_r                             = 0x0072;
-	public final static int XK_s                             = 0x0073;
-	public final static int XK_t                             = 0x0074;
-	public final static int XK_u                             = 0x0075;
-	public final static int XK_v                             = 0x0076;
-	public final static int XK_w                             = 0x0077;
-	public final static int XK_x                             = 0x0078;
-	public final static int XK_y                             = 0x0079;
-	public final static int XK_z                             = 0x007a;
-	public final static int XK_braceleft                     = 0x007b;
-	public final static int XK_bar                           = 0x007c;
-	public final static int XK_braceright                    = 0x007d;
-	public final static int XK_asciitilde                    = 0x007e;
-
-	public final static int XK_nobreakspace                  = 0x00a0;
-	public final static int XK_exclamdown                    = 0x00a1;
-	public final static int XK_cent                          = 0x00a2;
-	public final static int XK_sterling                      = 0x00a3;
-	public final static int XK_currency                      = 0x00a4;
-	public final static int XK_yen                           = 0x00a5;
-	public final static int XK_brokenbar                     = 0x00a6;
-	public final static int XK_section                       = 0x00a7;
-	public final static int XK_diaeresis                     = 0x00a8;
-	public final static int XK_copyright                     = 0x00a9;
-	public final static int XK_ordfeminine                   = 0x00aa;
-	public final static int XK_guillemotleft                 = 0x00ab;
-	public final static int XK_notsign                       = 0x00ac;
-	public final static int XK_hyphen                        = 0x00ad;
-	public final static int XK_registered                    = 0x00ae;
-	public final static int XK_macron                        = 0x00af;
-	public final static int XK_degree                        = 0x00b0;
-	public final static int XK_plusminus                     = 0x00b1;
-	public final static int XK_twosuperior                   = 0x00b2;
-	public final static int XK_threesuperior                 = 0x00b3;
-	public final static int XK_acute                         = 0x00b4;
-	public final static int XK_mu                            = 0x00b5;
-	public final static int XK_paragraph                     = 0x00b6;
-	public final static int XK_periodcentered                = 0x00b7;
-	public final static int XK_cedilla                       = 0x00b8;
-	public final static int XK_onesuperior                   = 0x00b9;
-	public final static int XK_masculine                     = 0x00ba;
-	public final static int XK_guillemotright                = 0x00bb;
-	public final static int XK_onequarter                    = 0x00bc;
-	public final static int XK_onehalf                       = 0x00bd;
-	public final static int XK_threequarters                 = 0x00be;
-	public final static int XK_questiondown                  = 0x00bf;
-	public final static int XK_Agrave                        = 0x00c0;
-	public final static int XK_Aacute                        = 0x00c1;
-	public final static int XK_Acircumflex                   = 0x00c2;
-	public final static int XK_Atilde                        = 0x00c3;
-	public final static int XK_Adiaeresis                    = 0x00c4;
-	public final static int XK_Aring                         = 0x00c5;
-	public final static int XK_AE                            = 0x00c6;
-	public final static int XK_Ccedilla                      = 0x00c7;
-	public final static int XK_Egrave                        = 0x00c8;
-	public final static int XK_Eacute                        = 0x00c9;
-	public final static int XK_Ecircumflex                   = 0x00ca;
-	public final static int XK_Ediaeresis                    = 0x00cb;
-	public final static int XK_Igrave                        = 0x00cc;
-	public final static int XK_Iacute                        = 0x00cd;
-	public final static int XK_Icircumflex                   = 0x00ce;
-	public final static int XK_Idiaeresis                    = 0x00cf;
-	public final static int XK_ETH                           = 0x00d0;
-	public final static int XK_Eth                           = 0x00d0;
-	public final static int XK_Ntilde                        = 0x00d1;
-	public final static int XK_Ograve                        = 0x00d2;
-	public final static int XK_Oacute                        = 0x00d3;
-	public final static int XK_Ocircumflex                   = 0x00d4;
-	public final static int XK_Otilde                        = 0x00d5;
-	public final static int XK_Odiaeresis                    = 0x00d6;
-	public final static int XK_multiply                      = 0x00d7;
-	public final static int XK_Oslash                        = 0x00d8;
-	public final static int XK_Ooblique                      = 0x00d8;
-	public final static int XK_Ugrave                        = 0x00d9;
-	public final static int XK_Uacute                        = 0x00da;
-	public final static int XK_Ucircumflex                   = 0x00db;
-	public final static int XK_Udiaeresis                    = 0x00dc;
-	public final static int XK_Yacute                        = 0x00dd;
-	public final static int XK_THORN                         = 0x00de;
-	public final static int XK_Thorn                         = 0x00de;
-	public final static int XK_ssharp                        = 0x00df;
-	public final static int XK_agrave                        = 0x00e0;
-	public final static int XK_aacute                        = 0x00e1;
-	public final static int XK_acircumflex                   = 0x00e2;
-	public final static int XK_atilde                        = 0x00e3;
-	public final static int XK_adiaeresis                    = 0x00e4;
-	public final static int XK_aring                         = 0x00e5;
-	public final static int XK_ae                            = 0x00e6;
-	public final static int XK_ccedilla                      = 0x00e7;
-	public final static int XK_egrave                        = 0x00e8;
-	public final static int XK_eacute                        = 0x00e9;
-	public final static int XK_ecircumflex                   = 0x00ea;
-	public final static int XK_ediaeresis                    = 0x00eb;
-	public final static int XK_igrave                        = 0x00ec;
-	public final static int XK_iacute                        = 0x00ed;
-	public final static int XK_icircumflex                   = 0x00ee;
-	public final static int XK_idiaeresis                    = 0x00ef;
-	public final static int XK_eth                           = 0x00f0;
-	public final static int XK_ntilde                        = 0x00f1;
-	public final static int XK_ograve                        = 0x00f2;
-	public final static int XK_oacute                        = 0x00f3;
-	public final static int XK_ocircumflex                   = 0x00f4;
-	public final static int XK_otilde                        = 0x00f5;
-	public final static int XK_odiaeresis                    = 0x00f6;
-	public final static int XK_division                      = 0x00f7;
-	public final static int XK_oslash                        = 0x00f8;
-	public final static int XK_ooblique                      = 0x00f8;
-	public final static int XK_ugrave                        = 0x00f9;
-	public final static int XK_uacute                        = 0x00fa;
-	public final static int XK_ucircumflex                   = 0x00fb;
-	public final static int XK_udiaeresis                    = 0x00fc;
-	public final static int XK_yacute                        = 0x00fd;
-	public final static int XK_thorn                         = 0x00fe;
-	public final static int XK_ydiaeresis                    = 0x00ff;
-
-	public final static int XK_ISO_Level3_Shift              = 0xfe03;
+	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) {
diff --git a/src/java/org/lwjgl/opengl/LinuxMouse.java b/src/java/org/lwjgl/opengl/LinuxMouse.java
index 407d926..7383ec1 100644
--- a/src/java/org/lwjgl/opengl/LinuxMouse.java
+++ b/src/java/org/lwjgl/opengl/LinuxMouse.java
@@ -49,14 +49,14 @@ final class LinuxMouse {
 	private static final int WHEEL_SCALE = 120;
 
 	/* X11 constants */
-	private final static int Button1 = 1;
-	private final static int Button2 = 2;
-	private final static int Button3 = 3;
-	private final static int Button4 = 4;
-	private final static int Button5 = 5;
+	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 final static int ButtonPress = 4;
-	private final static int ButtonRelease = 5;
+	private static final int ButtonPress = 4;
+	private static final int ButtonRelease = 5;
 
 	private final long display;
 	private final long window;
diff --git a/src/java/org/lwjgl/opengl/MacOSXDisplay.java b/src/java/org/lwjgl/opengl/MacOSXDisplay.java
index ea58d0e..eaccaee 100644
--- a/src/java/org/lwjgl/opengl/MacOSXDisplay.java
+++ b/src/java/org/lwjgl/opengl/MacOSXDisplay.java
@@ -58,6 +58,8 @@ 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;
@@ -75,7 +77,7 @@ final class MacOSXDisplay implements DisplayImplementation {
 
 	MacOSXDisplay() {
 		try {
-			AccessController.doPrivileged(new PrivilegedExceptionAction() {
+			AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
 				public Object run() throws Exception {
 					Application.getApplication().addApplicationListener(new ApplicationAdapter() {
 						public void handleQuit(ApplicationEvent event) {
@@ -126,7 +128,7 @@ final class MacOSXDisplay implements DisplayImplementation {
 			canvas_listener = null;
 		}
 		if (frame != null) {
-			AccessController.doPrivileged(new PrivilegedAction() {
+			AccessController.doPrivileged(new PrivilegedAction<Object>() {
 				public Object run() {
 					if (MacOSXFrame.getDevice().getFullScreenWindow() == frame)
 						MacOSXFrame.getDevice().setFullScreenWindow(null);
@@ -154,18 +156,19 @@ final class MacOSXDisplay implements DisplayImplementation {
 		return null;
 	}
 
-	private boolean equals(java.awt.DisplayMode awt_mode, DisplayMode mode) {
+	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 (int i = 0; i < awt_modes.length; i++)
-			if (equals(awt_modes[i], mode)) {
-				requested_mode = awt_modes[i];
+		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");
 	}
 
@@ -178,7 +181,7 @@ final class MacOSXDisplay implements DisplayImplementation {
 
 	private native void restoreGamma();
 
-	private DisplayMode createLWJGLDisplayMode(java.awt.DisplayMode awt_mode) {
+	private static DisplayMode createLWJGLDisplayMode(java.awt.DisplayMode awt_mode) {
 		int bit_depth;
 		int refresh_rate;
 		int awt_bit_depth = awt_mode.getBitDepth();
@@ -200,17 +203,15 @@ final class MacOSXDisplay implements DisplayImplementation {
 
 	public DisplayMode[] getAvailableDisplayModes() throws LWJGLException {
 		java.awt.DisplayMode[] awt_modes = MacOSXFrame.getDevice().getDisplayModes();
-		List modes = new ArrayList();
-		for (int i = 0; i < awt_modes.length; i++)
-			if (awt_modes[i].getBitDepth() >= 16)
-				modes.add(createLWJGLDisplayMode(awt_modes[i]));
-		DisplayMode[] mode_list = new DisplayMode[modes.size()];
-		modes.toArray(mode_list);
-		return mode_list;
+		List<DisplayMode> modes = new ArrayList<DisplayMode>();
+		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) 
+		if (frame != null)
 			frame.setTitle(title);
 	}
 
@@ -247,7 +248,7 @@ final class MacOSXDisplay implements DisplayImplementation {
 		}
 	}
 
-	private final static IntBuffer current_viewport = BufferUtils.createIntBuffer(16);
+	private static final IntBuffer current_viewport = BufferUtils.createIntBuffer(16);
 	public void update() {
 		boolean should_update = canvas_listener.syncShouldUpdateContext();
 		/*
@@ -282,8 +283,8 @@ final class MacOSXDisplay implements DisplayImplementation {
 		if (should_update) {
 			drawable.context.update();
 			/* This is necessary to make sure the context won't "forget" about the view size */
-			GL11.glGetInteger(GL11.GL_VIEWPORT, current_viewport);
-			GL11.glViewport(current_viewport.get(0), current_viewport.get(1), current_viewport.get(2), current_viewport.get(3));
+			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())
@@ -432,7 +433,7 @@ final class MacOSXDisplay implements DisplayImplementation {
 	public boolean isBufferLost(PeerInfo handle) {
 		return false;
 	}
-	
+
 	public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format,
 			IntBuffer pixelFormatCaps,
 			IntBuffer pBufferAttribs) throws LWJGLException {
@@ -466,30 +467,30 @@ final class MacOSXDisplay implements DisplayImplementation {
 	public int setIcon(ByteBuffer[] icons) {
 /*		int size = 0;
 		int biggest = -1;
-		
+
 		for (int i=0;i<icons.length;i++) {
 			if (icons[i].remaining() > 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;
diff --git a/src/java/org/lwjgl/opengl/MacOSXDisplayPeerInfo.java b/src/java/org/lwjgl/opengl/MacOSXDisplayPeerInfo.java
index 3122ee1..02df340 100644
--- a/src/java/org/lwjgl/opengl/MacOSXDisplayPeerInfo.java
+++ b/src/java/org/lwjgl/opengl/MacOSXDisplayPeerInfo.java
@@ -38,11 +38,11 @@ import org.lwjgl.LWJGLException;
 /**
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3116 $
- * $Id: MacOSXDisplayPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $
+ * @version $Revision: 3418 $
+ * $Id: MacOSXDisplayPeerInfo.java 3418 2010-09-28 21:11:35Z spasi $
  */
 final class MacOSXDisplayPeerInfo extends MacOSXCanvasPeerInfo {
-	private boolean locked = false;
+	private boolean locked;
 
 	MacOSXDisplayPeerInfo(PixelFormat pixel_format, boolean support_pbuffer) throws LWJGLException {
 		super(pixel_format, support_pbuffer);
diff --git a/src/java/org/lwjgl/opengl/MacOSXFrame.java b/src/java/org/lwjgl/opengl/MacOSXFrame.java
index e258522..502b16c 100644
--- a/src/java/org/lwjgl/opengl/MacOSXFrame.java
+++ b/src/java/org/lwjgl/opengl/MacOSXFrame.java
@@ -56,7 +56,7 @@ 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;
 
@@ -78,7 +78,7 @@ final class MacOSXFrame extends Frame implements WindowListener, ComponentListen
 		setUndecorated(fullscreen || undecorated);
 		if ( fullscreen ) {
 			try {
-				AccessController.doPrivileged(new PrivilegedExceptionAction() {
+				AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
 					public Object run() throws Exception {
 						getDevice().setFullScreenWindow(MacOSXFrame.this);
 						getDevice().setDisplayMode(requested_mode);
@@ -110,7 +110,7 @@ final class MacOSXFrame extends Frame implements WindowListener, ComponentListen
 		Insets insets = getInsets();
 		setBounds(x, y, width + insets.left + insets.right, height + insets.top + insets.bottom);
 	}
-	
+
 	public Rectangle syncGetBounds() {
 		synchronized ( this ) {
 			return bounds;
diff --git a/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java b/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java
index 75922d8..b232bec 100644
--- a/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java
+++ b/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java
@@ -54,17 +54,17 @@ final class MacOSXMouseEventQueue extends MouseEventQueue {
 	}
 
 	public void setGrabbed(boolean grab) {
-		super.setGrabbed(grab);
-		warpCursor();
-		grabMouse(grab);
+		if (is_grabbed != grab) {
+			super.setGrabbed(grab);
+			warpCursor();
+			grabMouse(grab);
+		}
 	}
 	
 	private static synchronized void grabMouse(boolean grab) {
-		if (is_grabbed != grab) {
-			is_grabbed = grab;
-			if (!grab)
-				nGrabMouse(grab);
-		}
+		is_grabbed = grab;
+		if (!grab)
+			nGrabMouse(grab);
 	}
 
 	protected void resetCursorToCenter() {
diff --git a/src/java/org/lwjgl/opengl/PeerInfo.java b/src/java/org/lwjgl/opengl/PeerInfo.java
index bc3386c..4603e35 100644
--- a/src/java/org/lwjgl/opengl/PeerInfo.java
+++ b/src/java/org/lwjgl/opengl/PeerInfo.java
@@ -39,8 +39,8 @@ import org.lwjgl.LWJGLUtil;
 /**
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3116 $
- * $Id: PeerInfo.java 3116 2008-08-19 16:46:03Z spasi $
+ * @version $Revision: 3418 $
+ * $Id: PeerInfo.java 3418 2010-09-28 21:11:35Z spasi $
  */
 abstract class PeerInfo {
 	private final ByteBuffer handle;
@@ -55,7 +55,7 @@ abstract class PeerInfo {
 		doLockAndInitHandle();
 	}
 
-	public synchronized final void unlock() throws LWJGLException {
+	public final synchronized void unlock() throws LWJGLException {
 		if (lock_count <= 0)
 			throw new IllegalStateException("PeerInfo not locked!");
 		if (Thread.currentThread() != locking_thread)
@@ -71,7 +71,7 @@ abstract class PeerInfo {
 	protected abstract void doLockAndInitHandle() throws LWJGLException;
 	protected abstract void doUnlock() throws LWJGLException;
 
-	public synchronized final ByteBuffer lockAndGetHandle() throws LWJGLException {
+	public final synchronized ByteBuffer lockAndGetHandle() throws LWJGLException {
 		Thread this_thread = Thread.currentThread();
 		while (locking_thread != null && locking_thread != this_thread) {
 			try {
diff --git a/src/java/org/lwjgl/opengl/ReferencesStack.java b/src/java/org/lwjgl/opengl/ReferencesStack.java
index fbb5c7c..30893d6 100644
--- a/src/java/org/lwjgl/opengl/ReferencesStack.java
+++ b/src/java/org/lwjgl/opengl/ReferencesStack.java
@@ -31,6 +31,8 @@
  */
 package org.lwjgl.opengl;
 
+import static org.lwjgl.opengl.GL11.*;
+
 class ReferencesStack {
 	private References[] references_stack;
 	private int stack_pos;
@@ -44,7 +46,7 @@ class ReferencesStack {
 		if (pos == references_stack.length) {
 			growStack();
 		}
-		references_stack[pos].copy(references_stack[pos - 1], GL11.GL_ALL_CLIENT_ATTRIB_BITS);
+		references_stack[pos].copy(references_stack[pos - 1], GL_ALL_CLIENT_ATTRIB_BITS);
 	}
 
 	public References popState(int mask) {
diff --git a/src/java/org/lwjgl/opengl/RenderTexture.java b/src/java/org/lwjgl/opengl/RenderTexture.java
index 212dafb..b9c8ab1 100644
--- a/src/java/org/lwjgl/opengl/RenderTexture.java
+++ b/src/java/org/lwjgl/opengl/RenderTexture.java
@@ -35,6 +35,8 @@ 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 {
 
@@ -214,13 +216,13 @@ public final class RenderTexture {
 
 		if ( useRGB ) {
 			pixelFormatCaps.put(isRectangle ? WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV : WGL_BIND_TO_TEXTURE_RGB_ARB);
-			pixelFormatCaps.put(GL11.GL_TRUE);
+			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(GL11.GL_TRUE);
+			pixelFormatCaps.put(GL_TRUE);
 
 			pBufferAttribs.put(WGL_TEXTURE_FORMAT_ARB);
 			pBufferAttribs.put(WGL_TEXTURE_RGBA_ARB);
@@ -228,7 +230,7 @@ public final class RenderTexture {
 
 		if ( useDepth ) {
 			pixelFormatCaps.put(isRectangle ? WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV : WGL_BIND_TO_TEXTURE_DEPTH_NV);
-			pixelFormatCaps.put(GL11.GL_TRUE);
+			pixelFormatCaps.put(GL_TRUE);
 
 			pBufferAttribs.put(WGL_DEPTH_TEXTURE_FORMAT_NV);
 			pBufferAttribs.put(WGL_TEXTURE_DEPTH_COMPONENT_NV);
diff --git a/src/java/org/lwjgl/opengl/StateTracker.java b/src/java/org/lwjgl/opengl/StateTracker.java
index 47a1ed6..0c071d4 100644
--- a/src/java/org/lwjgl/opengl/StateTracker.java
+++ b/src/java/org/lwjgl/opengl/StateTracker.java
@@ -31,12 +31,22 @@
  */
 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<VAOState> vaoMap = new FastIntMap<VAOState>();
+
 	StateTracker() {
 		attrib_stack = new StateStack(0);
 	}
@@ -71,29 +81,82 @@ final class StateTracker {
 		references_stack.pushState();
 	}
 
-	static ReferencesStack getReferencesStack(ContextCapabilities caps) {
-		return caps.tracker.references_stack;
+	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<VAOState> 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;
+
 	}
 
-        static void bindBuffer(ContextCapabilities caps, int target, int buffer) {
-            ReferencesStack references_stack = getReferencesStack(caps);
-            switch(target) {
-                case GL15.GL_ELEMENT_ARRAY_BUFFER:
-                    references_stack.getReferences().elementArrayBuffer = buffer;
-                    break;
-                case GL15.GL_ARRAY_BUFFER:
-                    references_stack.getReferences().arrayBuffer = buffer;
-                    break;
-                case GL21.GL_PIXEL_PACK_BUFFER:
-	                references_stack.getReferences().pixelPackBuffer = buffer;
-	                break;
-	            case GL21.GL_PIXEL_UNPACK_BUFFER:
-		            references_stack.getReferences().pixelUnpackBuffer = buffer;
-		            break;
-	            case GL40.GL_DRAW_INDIRECT_BUFFER:
-		            references_stack.getReferences().indirectBuffer = buffer;
-		            break;
-
-            }
-        }
-}
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengl/Util.java b/src/java/org/lwjgl/opengl/Util.java
index 9fc9bd8..0543792 100644
--- a/src/java/org/lwjgl/opengl/Util.java
+++ b/src/java/org/lwjgl/opengl/Util.java
@@ -31,28 +31,31 @@
  */
 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 <cix_foo at users.sourceforge.net>
- * @version $Revision: 3316 $
+ * @version $Revision: 3418 $
  */
 
 public final class Util {
 	/** No c'tor */
 	private Util() {
 	}
-	
+
 	/**
-	 * Throws OpenGLException if GL11.glGetError() returns anything else than GL11.GL_NO_ERROR
+	 * 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 = GL11.glGetError();
-		if ( err != GL11.GL_NO_ERROR ) {
+		int err = glGetError();
+		if ( err != GL_NO_ERROR ) {
 			throw new OpenGLException(err);
 		}
 	}
@@ -62,23 +65,23 @@ public final class Util {
 	 */
 	public static String translateGLErrorString(int error_code) {
 		switch (error_code) {
-			case GL11.GL_NO_ERROR:
+			case GL_NO_ERROR:
 				return "No error";
-			case GL11.GL_INVALID_ENUM:
+			case GL_INVALID_ENUM:
 				return "Invalid enum";
-			case GL11.GL_INVALID_VALUE:
+			case GL_INVALID_VALUE:
 				return "Invalid value";
-			case GL11.GL_INVALID_OPERATION:
+			case GL_INVALID_OPERATION:
 				return "Invalid operation";
-			case GL11.GL_STACK_OVERFLOW:
+			case GL_STACK_OVERFLOW:
 				return "Stack overflow";
-			case GL11.GL_STACK_UNDERFLOW:
+			case GL_STACK_UNDERFLOW:
 				return "Stack underflow";
-			case GL11.GL_OUT_OF_MEMORY:
+			case GL_OUT_OF_MEMORY:
 				return "Out of memory";
-			case ARBImaging.GL_TABLE_TOO_LARGE:
+			case GL_TABLE_TOO_LARGE:
 				return "Table too large";
-			case EXTFramebufferObject.GL_INVALID_FRAMEBUFFER_OPERATION_EXT:
+			case GL_INVALID_FRAMEBUFFER_OPERATION:
 				return "Invalid framebuffer operation";
 			default:
 				return null;
diff --git a/src/java/org/lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java b/src/java/org/lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java
index da237ba..24b7a40 100644
--- a/src/java/org/lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java
+++ b/src/java/org/lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java
@@ -40,14 +40,14 @@ import java.awt.Canvas;
 /**
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3116 $
- * $Id: WindowsAWTGLCanvasPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $
+ * @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= false;
+	private boolean has_pixel_format;
 
 	WindowsAWTGLCanvasPeerInfo(Canvas component, PixelFormat pixel_format) {
 		this.component = component;
diff --git a/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java b/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java
index 50ecc5e..b3d58b7 100644
--- a/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java
+++ b/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java
@@ -44,14 +44,14 @@ import org.lwjgl.LWJGLUtil;
 /**
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3002 $
- * $Id: WindowsCanvasImplementation.java 3002 2008-04-10 20:25:54Z 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() {
+		AccessController.doPrivileged(new PrivilegedAction<Object>() {
 			public Object run() {
 				try {
 					System.loadLibrary("jawt");
diff --git a/src/java/org/lwjgl/opengl/WindowsContextImplementation.java b/src/java/org/lwjgl/opengl/WindowsContextImplementation.java
index e49e613..6c84431 100644
--- a/src/java/org/lwjgl/opengl/WindowsContextImplementation.java
+++ b/src/java/org/lwjgl/opengl/WindowsContextImplementation.java
@@ -39,8 +39,8 @@ import java.nio.IntBuffer;
 
 /**
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3116 $
- *          $Id: WindowsContextImplementation.java 3116 2008-08-19 16:46:03Z spasi $
+ * @version $Revision: 3412 $
+ *          $Id: WindowsContextImplementation.java 3412 2010-09-26 23:43:24Z spasi $
  */
 final class WindowsContextImplementation implements ContextImplementation {
 
@@ -55,6 +55,10 @@ final class WindowsContextImplementation implements ContextImplementation {
 
 	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 )
diff --git a/src/java/org/lwjgl/opengl/WindowsDisplay.java b/src/java/org/lwjgl/opengl/WindowsDisplay.java
index 6a32c3c..e2e31da 100644
--- a/src/java/org/lwjgl/opengl/WindowsDisplay.java
+++ b/src/java/org/lwjgl/opengl/WindowsDisplay.java
@@ -51,87 +51,87 @@ import org.lwjgl.input.Keyboard;
 import org.lwjgl.input.Mouse;
 
 final class WindowsDisplay implements DisplayImplementation {
-	private final static int GAMMA_LENGTH = 256;
-	
-	private final static int WM_CANCELMODE                    = 0x001F;
-	private final static int WM_MOUSEMOVE                     = 0x0200;
-	private final static int WM_LBUTTONDOWN                   = 0x0201;
-	private final static int WM_LBUTTONUP                     = 0x0202;
-	private final static int WM_LBUTTONDBLCLK                 = 0x0203;
-	private final static int WM_RBUTTONDOWN                   = 0x0204;
-	private final static int WM_RBUTTONUP                     = 0x0205;
-	private final static int WM_RBUTTONDBLCLK                 = 0x0206;
-	private final static int WM_MBUTTONDOWN                   = 0x0207;
-	private final static int WM_MBUTTONUP                     = 0x0208;
-	private final static int WM_MBUTTONDBLCLK                 = 0x0209;
-	private final static int WM_MOUSEWHEEL                    = 0x020A;
-	private final static int WM_CAPTURECHANGED                = 0x0215;
-        private final static int WM_MOUSELEAVE                    = 0x02A3;
-	private final static int WM_KEYDOWN						  = 256;
-	private final static int WM_KEYUP						  = 257;
-	private final static int WM_SYSKEYUP					  = 261;
-	private final static int WM_SYSKEYDOWN					  = 260;
-	private final static int WM_SYSCHAR                          = 262;
-	private final static int WM_CHAR                          = 258;
-	private final static int WM_SETICON						  = 0x0080;
-
-	private final static int WM_QUIT						  = 0x0012;
-	private final static int WM_SYSCOMMAND					  = 0x0112;
-	private final static int WM_PAINT 						  = 0x000F;
-	private final static int WM_KILLFOCUS                     = 8;
-	private final static int WM_SETFOCUS                      = 7;
-
-	private final static int SC_SIZE          = 0xF000;
-	private final static int SC_MOVE          = 0xF010;
-	private final static int SC_MINIMIZE      = 0xF020;
-	private final static int SC_MAXIMIZE      = 0xF030;
-	private final static int SC_NEXTWINDOW    = 0xF040;
-	private final static int SC_PREVWINDOW    = 0xF050;
-	private final static int SC_CLOSE         = 0xF060;
-	private final static int SC_VSCROLL       = 0xF070;
-	private final static int SC_HSCROLL       = 0xF080;
-	private final static int SC_MOUSEMENU     = 0xF090;
-	private final static int SC_KEYMENU       = 0xF100;
-	private final static int SC_ARRANGE       = 0xF110;
-	private final static int SC_RESTORE       = 0xF120;
-	private final static int SC_TASKLIST      = 0xF130;
-	private final static int SC_SCREENSAVE    = 0xF140;
-	private final static int SC_HOTKEY        = 0xF150;
-	private final static int SC_DEFAULT       = 0xF160;
-	private final static int SC_MONITORPOWER  = 0xF170;
-	private final static int SC_CONTEXTHELP   = 0xF180;
-	private final static int SC_SEPARATOR     = 0xF00F;
-
-	final static int SM_CXCURSOR      = 13;
-	final static int SM_CYCURSOR      = 14;
-	final static int SM_CMOUSEBUTTONS      = 43;
-	final static int SM_MOUSEWHEELPRESENT = 75;
-
-	private final static int SIZE_RESTORED        = 0;
-	private final static int SIZE_MINIMIZED       = 1;
-	private final static int SIZE_MAXIMIZED       = 2;
-	private final static int WM_SIZE          = 0x0005;
-	private final static int WM_ACTIVATE          = 0x0006;
-	private final static int     WA_INACTIVE      = 0;
-	private final static int     WA_ACTIVE        = 1;
-	private final static int     WA_CLICKACTIVE   = 2;
-	private final static int SW_SHOWMINNOACTIVE   = 7;
-	private final static int SW_SHOWDEFAULT       = 10;
-	private final static int SW_RESTORE           = 9;
-
-	private final static int ICON_SMALL           = 0;
-	private final static int ICON_BIG           = 1;
-
-	private final static IntBuffer rect_buffer = BufferUtils.createIntBuffer(4);
-	private final static Rect rect = new Rect();
-	private final static Rect rect2 = new Rect();
+	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 = false;
+	private static boolean hasParent;
 
 	private WindowsKeyboard keyboard;
 	private WindowsMouse mouse;
@@ -156,8 +156,8 @@ final class WindowsDisplay implements DisplayImplementation {
 	private long large_icon;
 
 	private int captureMouse = -1;
-        private boolean trackingMouse = false;
-        private boolean mouseInside = false;
+        private boolean trackingMouse;
+        private boolean mouseInside;
 
 	WindowsDisplay() {
 		current_display = this;
@@ -378,7 +378,7 @@ final class WindowsDisplay implements DisplayImplementation {
 		String driver = getAdapter();
 		if (driver != null) {
 			String[] drivers = driver.split(",");
-			if(drivers.length>0) {				
+			if(drivers.length>0) {
 				WindowsFileVersion version = nGetVersion(drivers[0] + ".dll");
 				if (version != null)
 					return version.toString();
@@ -664,19 +664,19 @@ final class WindowsDisplay implements DisplayImplementation {
 
 		int small_icon_size = 16;
 		int large_icon_size = 32;
-		for (int i=0;i<icons.length;i++) {
-			int size = icons[i].limit() / 4;
+		for ( ByteBuffer icon : icons ) {
+			int size = icon.limit() / 4;
 
-			if ((((int) Math.sqrt(size)) == small_icon_size) && (!done_small)) {
+			if ( (((int)Math.sqrt(size)) == small_icon_size) && (!done_small) ) {
 				freeSmallIcon();
-				small_icon = createIcon(small_icon_size, small_icon_size, icons[i].asIntBuffer());
+				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)) {
+			if ( (((int)Math.sqrt(size)) == large_icon_size) && (!done_large) ) {
 				freeLargeIcon();
-				large_icon = createIcon(large_icon_size, large_icon_size, icons[i].asIntBuffer());
+				large_icon = createIcon(large_icon_size, large_icon_size, icon.asIntBuffer());
 				sendMessage(hwnd, WM_SETICON, ICON_BIG, large_icon);
 				used++;
 				done_large = true;
@@ -692,20 +692,20 @@ final class WindowsDisplay implements DisplayImplementation {
 	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());
 		}
@@ -720,10 +720,10 @@ final class WindowsDisplay implements DisplayImplementation {
 			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);
@@ -747,11 +747,6 @@ final class WindowsDisplay implements DisplayImplementation {
 		int scan_code = (int)((lParam >>> 16) & 0xFF);
 		if (keyboard != null) {
 			keyboard.handleKey((int)wParam, scan_code, extended != 0, state, millis, repeat);
-			
-			if(captureMouse != -1 && keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
-				nReleaseCapture();
-				captureMouse = -1;
-			}
 		}
 	}
 
@@ -869,7 +864,7 @@ final class WindowsDisplay implements DisplayImplementation {
 					// Set key state to pressed
 					long fake_lparam = lParam & ~(1 << 31);
 					// Set key previous state to released
-					fake_lparam = fake_lparam & ~(1 << 30);
+					fake_lparam &= ~(1 << 30);
 					handleKeyButton(wParam, fake_lparam, millis);
 				}
 				/* Fall through */
@@ -923,7 +918,7 @@ final class WindowsDisplay implements DisplayImplementation {
 	public int getHeight() {
 		return Display.getDisplayMode().getHeight();
 	}
-	
+
 	private int firstMouseButtonDown() {
 		for(int i=0; i<Mouse.getButtonCount(); i++) {
 			if(Mouse.isButtonDown(i)) {
diff --git a/src/java/org/lwjgl/opengl/WindowsKeyboard.java b/src/java/org/lwjgl/opengl/WindowsKeyboard.java
index 753069f..92ab149 100644
--- a/src/java/org/lwjgl/opengl/WindowsKeyboard.java
+++ b/src/java/org/lwjgl/opengl/WindowsKeyboard.java
@@ -44,9 +44,9 @@ import org.lwjgl.LWJGLException;
 import org.lwjgl.input.Keyboard;
 
 final class WindowsKeyboard {
-	private final static int MAPVK_VK_TO_VSC = 0;
+	private static final int MAPVK_VK_TO_VSC = 0;
 
-	private final static int BUFFER_SIZE = 50;
+	private static final int BUFFER_SIZE = 50;
 
 	private final long hwnd;
 	private final ByteBuffer keyboard_state;
diff --git a/src/java/org/lwjgl/opengl/WindowsKeycodes.java b/src/java/org/lwjgl/opengl/WindowsKeycodes.java
index b9c6021..a5d1cd2 100644
--- a/src/java/org/lwjgl/opengl/WindowsKeycodes.java
+++ b/src/java/org/lwjgl/opengl/WindowsKeycodes.java
@@ -38,177 +38,177 @@ package org.lwjgl.opengl;
 import org.lwjgl.input.Keyboard;
 
 final class WindowsKeycodes {
-	public final static int VK_LBUTTON        = 0x01;
-	public final static int VK_RBUTTON        = 0x02;
-	public final static int VK_CANCEL         = 0x03;
-	public final static int VK_MBUTTON        = 0x04;    /* NOT contiguous with L & RBUTTON */
+	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 final static int VK_XBUTTON1       = 0x05;    /* NOT contiguous with L & RBUTTON */
-	public final static int VK_XBUTTON2       = 0x06;    /* 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 final static int VK_BACK           = 0x08;
-	public final static int VK_TAB            = 0x09;
+	public static final int VK_BACK           = 0x08;
+	public static final int VK_TAB            = 0x09;
 
 /*
  * 0x0A - 0x0B : reserved
  */
 
-	public final static int VK_CLEAR          = 0x0C;
-	public final static int VK_RETURN         = 0x0D;
-
-	public final static int VK_SHIFT          = 0x10;
-	public final static int VK_CONTROL        = 0x11;
-	public final static int VK_MENU           = 0x12;
-	public final static int VK_PAUSE          = 0x13;
-	public final static int VK_CAPITAL        = 0x14;
-
-	public final static int VK_KANA           = 0x15;
-	public final static int VK_HANGEUL        = 0x15;  /* old name - should be here for compatibility */
-	public final static int VK_HANGUL         = 0x15;
-	public final static int VK_JUNJA          = 0x17;
-	public final static int VK_FINAL          = 0x18;
-	public final static int VK_HANJA          = 0x19;
-	public final static int VK_KANJI          = 0x19;
-
-	public final static int VK_ESCAPE         = 0x1B;
-
-	public final static int VK_CONVERT        = 0x1C;
-	public final static int VK_NONCONVERT     = 0x1D;
-	public final static int VK_ACCEPT         = 0x1E;
-	public final static int VK_MODECHANGE     = 0x1F;
-
-	public final static int VK_SPACE          = 0x20;
-	public final static int VK_PRIOR          = 0x21;
-	public final static int VK_NEXT           = 0x22;
-	public final static int VK_END            = 0x23;
-	public final static int VK_HOME           = 0x24;
-	public final static int VK_LEFT           = 0x25;
-	public final static int VK_UP             = 0x26;
-	public final static int VK_RIGHT          = 0x27;
-	public final static int VK_DOWN           = 0x28;
-	public final static int VK_SELECT         = 0x29;
-	public final static int VK_PRINT          = 0x2A;
-	public final static int VK_EXECUTE        = 0x2B;
-	public final static int VK_SNAPSHOT       = 0x2C;
-	public final static int VK_INSERT         = 0x2D;
-	public final static int VK_DELETE         = 0x2E;
-	public final static int VK_HELP           = 0x2F;
+	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 final static int VK_0			  = 0x30;
-	public final static int VK_1			  = 0x31;
-	public final static int VK_2			  = 0x32;
-	public final static int VK_3			  = 0x33;
-	public final static int VK_4			  = 0x34;
-	public final static int VK_5			  = 0x35;
-	public final static int VK_6			  = 0x36;
-	public final static int VK_7			  = 0x37;
-	public final static int VK_8			  = 0x38;
-	public final static int VK_9			  = 0x39;
-
-	public final static int VK_A			  = 0x41;
-	public final static int VK_B			  = 0x42;
-	public final static int VK_C			  = 0x43;
-	public final static int VK_D			  = 0x44;
-	public final static int VK_E			  = 0x45;
-	public final static int VK_F			  = 0x46;
-	public final static int VK_G			  = 0x47;
-	public final static int VK_H			  = 0x48;
-	public final static int VK_I			  = 0x49;
-	public final static int VK_J			  = 0x4A;
-	public final static int VK_K			  = 0x4B;
-	public final static int VK_L			  = 0x4C;
-	public final static int VK_M			  = 0x4D;
-	public final static int VK_N			  = 0x4E;
-	public final static int VK_O			  = 0x4F;
-	public final static int VK_P			  = 0x50;
-	public final static int VK_Q			  = 0x51;
-	public final static int VK_R			  = 0x52;
-	public final static int VK_S			  = 0x53;
-	public final static int VK_T			  = 0x54;
-	public final static int VK_U			  = 0x55;
-	public final static int VK_V			  = 0x56;
-	public final static int VK_W			  = 0x57;
-	public final static int VK_X			  = 0x58;
-	public final static int VK_Y			  = 0x59;
-	public final static int VK_Z			  = 0x5A;
-
-	public final static int VK_LWIN           = 0x5B;
-	public final static int VK_RWIN           = 0x5C;
-	public final static int VK_APPS           = 0x5D;
+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 final static int VK_SLEEP          = 0x5F;
-
-	public final static int VK_NUMPAD0        = 0x60;
-	public final static int VK_NUMPAD1        = 0x61;
-	public final static int VK_NUMPAD2        = 0x62;
-	public final static int VK_NUMPAD3        = 0x63;
-	public final static int VK_NUMPAD4        = 0x64;
-	public final static int VK_NUMPAD5        = 0x65;
-	public final static int VK_NUMPAD6        = 0x66;
-	public final static int VK_NUMPAD7        = 0x67;
-	public final static int VK_NUMPAD8        = 0x68;
-	public final static int VK_NUMPAD9        = 0x69;
-	public final static int VK_MULTIPLY       = 0x6A;
-	public final static int VK_ADD            = 0x6B;
-	public final static int VK_SEPARATOR      = 0x6C;
-	public final static int VK_SUBTRACT       = 0x6D;
-	public final static int VK_DECIMAL        = 0x6E;
-	public final static int VK_DIVIDE         = 0x6F;
-	public final static int VK_F1             = 0x70;
-	public final static int VK_F2             = 0x71;
-	public final static int VK_F3             = 0x72;
-	public final static int VK_F4             = 0x73;
-	public final static int VK_F5             = 0x74;
-	public final static int VK_F6             = 0x75;
-	public final static int VK_F7             = 0x76;
-	public final static int VK_F8             = 0x77;
-	public final static int VK_F9             = 0x78;
-	public final static int VK_F10            = 0x79;
-	public final static int VK_F11            = 0x7A;
-	public final static int VK_F12            = 0x7B;
-	public final static int VK_F13            = 0x7C;
-	public final static int VK_F14            = 0x7D;
-	public final static int VK_F15            = 0x7E;
-	public final static int VK_F16            = 0x7F;
-	public final static int VK_F17            = 0x80;
-	public final static int VK_F18            = 0x81;
-	public final static int VK_F19            = 0x82;
-	public final static int VK_F20            = 0x83;
-	public final static int VK_F21            = 0x84;
-	public final static int VK_F22            = 0x85;
-	public final static int VK_F23            = 0x86;
-	public final static int VK_F24            = 0x87;
+	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 final static int VK_NUMLOCK        = 0x90;
-	public final static int VK_SCROLL         = 0x91;
+	public static final int VK_NUMLOCK        = 0x90;
+	public static final int VK_SCROLL         = 0x91;
 
 /*
  * NEC PC-9800 kbd definitions
  */
-	public final static int VK_OEM_NEC_EQUAL  = 0x92;   // '=' key on numpad
+public static final int VK_OEM_NEC_EQUAL  = 0x92;   // '=' key on numpad
 /*
  * Fujitsu/OASYS kbd definitions
  */
-	public final static int VK_OEM_FJ_JISHO   = 0x92;   // 'Dictionary' key
-	public final static int VK_OEM_FJ_MASSHOU = 0x93;   // 'Unregister word' key
-	public final static int VK_OEM_FJ_TOUROKU = 0x94;   // 'Register word' key
-	public final static int VK_OEM_FJ_LOYA    = 0x95;   // 'Left OYAYUBI' key
-	public final static int VK_OEM_FJ_ROYA    = 0x96;   // 'Right OYAYUBI' key
+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
@@ -219,44 +219,44 @@ final class WindowsKeycodes {
  * Used only as parameters to GetAsyncKeyState() and GetKeyState().
  * No other API or message will distinguish left and right keys in this way.
  */
-	public final static int VK_LSHIFT         = 0xA0;
-	public final static int VK_RSHIFT         = 0xA1;
-	public final static int VK_LCONTROL       = 0xA2;
-	public final static int VK_RCONTROL       = 0xA3;
-	public final static int VK_LMENU          = 0xA4;
-	public final static int VK_RMENU          = 0xA5;
-
-	public final static int VK_BROWSER_BACK        = 0xA6;
-	public final static int VK_BROWSER_FORWARD     = 0xA7;
-	public final static int VK_BROWSER_REFRESH     = 0xA8;
-	public final static int VK_BROWSER_STOP        = 0xA9;
-	public final static int VK_BROWSER_SEARCH      = 0xAA;
-	public final static int VK_BROWSER_FAVORITES   = 0xAB;
-	public final static int VK_BROWSER_HOME        = 0xAC;
-
-	public final static int VK_VOLUME_MUTE         = 0xAD;
-	public final static int VK_VOLUME_DOWN         = 0xAE;
-	public final static int VK_VOLUME_UP           = 0xAF;
-	public final static int VK_MEDIA_NEXT_TRACK    = 0xB0;
-	public final static int VK_MEDIA_PREV_TRACK    = 0xB1;
-	public final static int VK_MEDIA_STOP          = 0xB2;
-	public final static int VK_MEDIA_PLAY_PAUSE    = 0xB3;
-	public final static int VK_LAUNCH_MAIL         = 0xB4;
-	public final static int VK_LAUNCH_MEDIA_SELECT = 0xB5;
-	public final static int VK_LAUNCH_APP1         = 0xB6;
-	public final static int VK_LAUNCH_APP2         = 0xB7;
+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 final static int VK_OEM_1          = 0xBA;   // ';:' for US
-	public final static int VK_OEM_PLUS       = 0xBB;   // '+' any country
-	public final static int VK_OEM_COMMA      = 0xBC;   // ',' any country
-	public final static int VK_OEM_MINUS      = 0xBD;   // '-' any country
-	public final static int VK_OEM_PERIOD     = 0xBE;   // '.' any country
-	public final static int VK_OEM_2          = 0xBF;   // '/?' for US
-	public final static int VK_OEM_3          = 0xC0;   // '`~' for US
+	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
@@ -266,11 +266,11 @@ final class WindowsKeycodes {
  * 0xD8 - 0xDA : unassigned
  */
 
-	public final static int VK_OEM_4          = 0xDB;  //  '[{' for US
-	public final static int VK_OEM_5          = 0xDC;  //  '\|' for US
-	public final static int VK_OEM_6          = 0xDD;  //  ']}' for US
-	public final static int VK_OEM_7          = 0xDE;  //  ''"' for US
-	public final static int VK_OEM_8          = 0xDF;
+	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
@@ -279,48 +279,48 @@ final class WindowsKeycodes {
 /*
  * Various extended or enhanced keyboards
  */
-	public final static int VK_OEM_AX         = 0xE1;  //  'AX' key on Japanese AX kbd
-	public final static int VK_OEM_102        = 0xE2;  //  "<>" or "\|" on RT 102-key kbd.
-	public final static int VK_ICO_HELP       = 0xE3;  //  Help key on ICO
-	public final static int VK_ICO_00         = 0xE4;  //  00 key on ICO
+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 final static int VK_PROCESSKEY     = 0xE5;
+	public static final int VK_PROCESSKEY     = 0xE5;
 
-	public final static int VK_ICO_CLEAR      = 0xE6;
+	public static final int VK_ICO_CLEAR      = 0xE6;
 
 
-	public final static int VK_PACKET         = 0xE7;
+	public static final int VK_PACKET         = 0xE7;
 
 /*
  * 0xE8 : unassigned
  */
-	
+
 /*
  * Nokia/Ericsson definitions
  */
-	public final static int VK_OEM_RESET      = 0xE9;
-	public final static int VK_OEM_JUMP       = 0xEA;
-	public final static int VK_OEM_PA1        = 0xEB;
-	public final static int VK_OEM_PA2        = 0xEC;
-	public final static int VK_OEM_PA3        = 0xED;
-	public final static int VK_OEM_WSCTRL     = 0xEE;
-	public final static int VK_OEM_CUSEL      = 0xEF;
-	public final static int VK_OEM_ATTN       = 0xF0;
-	public final static int VK_OEM_FINISH     = 0xF1;
-	public final static int VK_OEM_COPY       = 0xF2;
-	public final static int VK_OEM_AUTO       = 0xF3;
-	public final static int VK_OEM_ENLW       = 0xF4;
-	public final static int VK_OEM_BACKTAB    = 0xF5;
-
-	public final static int VK_ATTN           = 0xF6;
-	public final static int VK_CRSEL          = 0xF7;
-	public final static int VK_EXSEL          = 0xF8;
-	public final static int VK_EREOF          = 0xF9;
-	public final static int VK_PLAY           = 0xFA;
-	public final static int VK_ZOOM           = 0xFB;
-	public final static int VK_NONAME         = 0xFC;
-	public final static int VK_PA1            = 0xFD;
-	public final static int VK_OEM_CLEAR      = 0xFE;
+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) {
diff --git a/src/java/org/lwjgl/opengl/WindowsRegistry.java b/src/java/org/lwjgl/opengl/WindowsRegistry.java
index f84e682..50e8635 100644
--- a/src/java/org/lwjgl/opengl/WindowsRegistry.java
+++ b/src/java/org/lwjgl/opengl/WindowsRegistry.java
@@ -40,15 +40,15 @@ import org.lwjgl.LWJGLException;
 import org.lwjgl.Sys;
 
 final class WindowsRegistry {
-	final static int HKEY_CLASSES_ROOT = 1;
-	final static int HKEY_CURRENT_USER = 2;
-	final static int HKEY_LOCAL_MACHINE = 3;
-	final static int HKEY_USERS = 4;
+	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
 	 */
@@ -64,6 +64,6 @@ final class WindowsRegistry {
 		}
 		return nQueryRegistrationKey(root_key, subkey, value);
 	}
-	
+
 	private static native String nQueryRegistrationKey(int root_key, String subkey, String value) throws LWJGLException;
 }
diff --git a/src/java/org/lwjgl/opengl/XRandR.java b/src/java/org/lwjgl/opengl/XRandR.java
index 519ef62..0df903f 100644
--- a/src/java/org/lwjgl/opengl/XRandR.java
+++ b/src/java/org/lwjgl/opengl/XRandR.java
@@ -42,20 +42,20 @@ 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 /* <String, Screen[]> */screens;
+	private static Map<String, Screen[]> screens;
 
 	private static void populate()
 	{
 		if( screens == null )
 		{
-			screens = new HashMap/* <String, Screen[]> */();
+			screens = new HashMap<String, Screen[]>();
 
 			// ProcessBuilder pb = new ProcessBuilder( "xrandr", "-q" );
 			// pb.redirectErrorStream();
@@ -64,8 +64,8 @@ public class XRandR
 				// Process p= pb.start();
 				Process p = Runtime.getRuntime().exec( new String[] { "xrandr", "-q" } );
 
-				List/* <Screen> */currentList = new ArrayList/* <Screen> */();
-				List/* <Screen> */possibles = new ArrayList/* <Screen> */();
+				List<Screen> currentList = new ArrayList<Screen>();
+				List<Screen> possibles = new ArrayList<Screen>();
 				String name = null;
 
 				BufferedReader br = new BufferedReader( new InputStreamReader( p.getInputStream() ) );
@@ -75,7 +75,7 @@ public class XRandR
 					line = line.trim();
 					String[] sa = line.split( "\\s+" );
 
-					if( sa[ 1 ].equals( "connected" ) )
+					if( "connected".equals(sa[1]) )
 					{
 						// found a new screen block
 						if( name != null )
@@ -97,7 +97,7 @@ public class XRandR
 
 				screens.put( name, possibles.toArray( new Screen[ possibles.size() ] ) );
 
-				current = (Screen[]) currentList.toArray(new Screen[currentList.size()]);
+				current = currentList.toArray(new Screen[currentList.size()]);
 			}
 			catch( Throwable e )
 			{
@@ -116,7 +116,7 @@ public class XRandR
 	{
 		populate();
 
-		return (Screen[]) current.clone();
+		return current.clone();
 	}
 
 	/**
@@ -125,42 +125,34 @@ public class XRandR
 	 * @throws IllegalArgumentException
 	 *            if no screens are specified
 	 */
-	public static void setConfiguration( Screen[]/* ... */screens )
+	public static void setConfiguration(Screen... screens)
 	{
 		if( screens.length == 0 )
-		{
 			throw new IllegalArgumentException( "Must specify at least one screen" );
-		}
 
-		List/* <String> */cmd = new ArrayList/* <String> */();
+		List<String> cmd = new ArrayList<String>();
 		cmd.add( "xrandr" );
 
 		// switch off those in the current set not in the new set
-		for( int i = 0; i < current.length; i++ )
-		{
+		for ( Screen screen : current ) {
 			boolean found = false;
-			for( int j = 0; j < screens.length; j++ )
-			{
-				if( screens[ j ].name.equals( current[ i ].name ) )
-				{
+			for ( Screen screen1 : screens ) {
+				if ( screen1.name.equals(screen.name) ) {
 					found = true;
 					break;
 				}
 			}
 
-			if( !found )
-			{
-				cmd.add( "--output" );
-				cmd.add( current[ i ].name );
-				cmd.add( "--off" );
+			if ( !found ) {
+				cmd.add("--output");
+				cmd.add(screen.name);
+				cmd.add("--off");
 			}
 		}
 
 		// set up new set
-		for( int i = 0; i < screens.length; i++ )
-		{
-			screens[ i ].getArgs( cmd );
-		}
+		for ( Screen screen : screens )
+			screen.getArgs(cmd);
 
 		try
 		{
@@ -168,7 +160,7 @@ public class XRandR
 			// pb.redirectErrorStream();
 			// Process p = pb.start();
 			Process p =
-					Runtime.getRuntime().exec( ( String[] ) cmd.toArray( new String[ cmd.size() ] ) );
+					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;
@@ -191,7 +183,7 @@ public class XRandR
 	public static String[] getScreenNames()
 	{
 		populate();
-		return ( String[] ) screens.keySet().toArray( new String[ screens.size() ] );
+		return screens.keySet().toArray( new String[ screens.size() ] );
 	}
 
 	/**
@@ -203,7 +195,7 @@ public class XRandR
 	{
 		populate();
 		// clone the array to prevent held copies being altered
-		return (Screen[]) ((Screen[]) screens.get(name)).clone();
+		return screens.get(name).clone();
 	}
 
 	private static final Pattern SCREEN_PATTERN1 =
@@ -214,7 +206,7 @@ public class XRandR
 	/**
 	 * 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
@@ -223,7 +215,7 @@ public class XRandR
 	 *           config string, format either widthxheight or
 	 *           widthxheight+xPos+yPos
 	 */
-	private static void parseScreen( List /* <Screen> */list, String name, String what )
+	private static void parseScreen( List<Screen> list, String name, String what )
 	{
 		Matcher m = SCREEN_PATTERN1.matcher( what );
 		if( !m.matches() )
@@ -254,7 +246,7 @@ public class XRandR
 	/**
 	 * Encapsulates the configuration of a monitor. Resolution is
 	 * fixed, position is mutable
-	 * 
+	 *
 	 * @author ryanm
 	 */
 	public static class Screen implements Cloneable
@@ -277,12 +269,12 @@ public class XRandR
 		/**
 		 * Position on the x-axis, in pixels
 		 */
-		public int xPos = 0;
+		public int xPos;
 
 		/**
 		 * Position on the y-axis, in pixels
 		 */
-		public int yPos = 0;
+		public int yPos;
 
 		private Screen( String name, int width, int height, int xPos, int yPos )
 		{
@@ -293,7 +285,7 @@ public class XRandR
 			this.yPos = yPos;
 		}
 
-		private void getArgs( List/* <String> */argList )
+		private void getArgs( List<String> argList )
 		{
 			argList.add( "--output" );
 			argList.add( name );
diff --git a/src/java/org/lwjgl/test/DisplayTest.java b/src/java/org/lwjgl/test/DisplayTest.java
index 5bac454..2d7085c 100644
--- a/src/java/org/lwjgl/test/DisplayTest.java
+++ b/src/java/org/lwjgl/test/DisplayTest.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -40,17 +40,17 @@ import org.lwjgl.opengl.DisplayMode;
  * Test class for Display & DisplayMode
  *
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 2983 $
- * $Id: DisplayTest.java 2983 2008-04-07 18:36:09Z 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
    */
@@ -58,31 +58,31 @@ public class DisplayTest {
     currentTest();
     queryModesTest();
     setDisplayModeTest();
-    setDisplayConfigurationTest();    
+    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()      + "@" + 
+    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();
@@ -92,7 +92,7 @@ public class DisplayTest {
       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:");
@@ -104,42 +104,42 @@ public class DisplayTest {
     }
     System.out.println("---- Test query ----");
   }
-  
-  
+
+
   /**
    * Tests setting display modes
    */
   private void setDisplayModeTest() throws LWJGLException {
     DisplayMode mode = null;
     DisplayMode[] modes = null;
-    
+
     System.out.println("==== Test setDisplayMode ====");
     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);
     }
-    
+
     // find a mode
     System.out.print("Looking for 640x480...");
-    for(int i=0; i<modes.length;i++) {
-      if (modes[i].getWidth()  == 640  &&
-          modes[i].getHeight() == 480) {
-        mode = modes[i];
-        System.out.println("found!");
-        break;
-      }
-    }
-    
+	  for ( DisplayMode mode1 : modes ) {
+		  if ( mode1.getWidth() == 640 &&
+		       mode1.getHeight() == 480 ) {
+			  mode = mode1;
+			  System.out.println("found!");
+			  break;
+		  }
+	  }
+
     // no mode check
     if (mode == null) {
       System.out.println("error\nFATAL: Unable to find basic mode.");
       System.exit(-1);
     }
-    
+
     // change to mode, and wait a bit
     System.out.print("Changing to mode...");
     try {
@@ -151,13 +151,13 @@ public class DisplayTest {
       System.exit(-1);
     }
     System.out.println("done");
-    
-    System.out.println("Resolution: " + 
-        Display.getDisplayMode().getWidth()      + "x" + 
-        Display.getDisplayMode().getHeight()     + "x" + 
-        Display.getDisplayMode().getBitsPerPixel()      + "@" + 
+
+    System.out.println("Resolution: " +
+        Display.getDisplayMode().getWidth()      + "x" +
+        Display.getDisplayMode().getHeight()     + "x" +
+        Display.getDisplayMode().getBitsPerPixel()      + "@" +
         Display.getDisplayMode().getFrequency()  + "Hz");
-    
+
     pause(5000);
 
     // reset
@@ -168,34 +168,34 @@ public class DisplayTest {
         e.printStackTrace();
     }
     System.out.println("done");
-    
-    System.out.println("---- Test setDisplayMode ----");    
+
+    System.out.println("---- Test setDisplayMode ----");
   }
-  
+
   /**
    * Tests the DisplayConfiguration
    */
   private void setDisplayConfigurationTest() {
     System.out.println("==== Test setDisplayConfigurationTest ====");
-    
+
     System.out.println("Testing normal setting");
     changeConfig(1.0f, 0f, 1f);
-    
+
     System.out.println("Testing gamma settings");
     changeConfig(5.0f, 0f, 1f);
     changeConfig(0.5f, 0f, 1f);
-    
+
     System.out.println("Testing brightness settings");
     changeConfig(1.0f, -1.0f, 1f);
     changeConfig(1.0f, -0.5f, 1f);
     changeConfig(1.0f, 0.5f, 1f);
     changeConfig(1.0f, 1.0f, 1f);
-    
+
     System.out.println("Testing contrast settings");
     changeConfig(1.0f, 0f, 0f);
     changeConfig(1.0f, 0f, 0.5f);
     changeConfig(1.0f, 0f, 10000.0f);
-    
+
     System.out.print("resetting...");
     try {
         Display.setFullscreen(false);
@@ -203,13 +203,13 @@ public class DisplayTest {
         e.printStackTrace();
     }
     System.out.println("done");
-    
+
     System.out.println("---- Test setDisplayConfigurationTest ----");
   }
-  
+
   /**
    * Changes the Displat configuration
-   * 
+   *
    * @param gamma gamma value to change to
    * @param brightness brightness value to change to
    * @param contrast contrast value to change to
@@ -226,7 +226,7 @@ public class DisplayTest {
 
   /**
    * Pause current thread for a specified time
-   * 
+   *
    * @param time milliseconds to sleep
    */
   private void pause(long time) {
@@ -238,11 +238,11 @@ public class DisplayTest {
 		  } catch (InterruptedException inte) {
 		  }
 	  }
-  }  
-  
+  }
+
   /**
    * Tests the Sys class, and serves as basic usage test
-   * 
+   *
    * @param args ignored
    */
   public static void main(String[] args) throws LWJGLException {
diff --git a/src/java/org/lwjgl/test/WindowCreationTest.java b/src/java/org/lwjgl/test/WindowCreationTest.java
index 1ef1603..f27e7f3 100644
--- a/src/java/org/lwjgl/test/WindowCreationTest.java
+++ b/src/java/org/lwjgl/test/WindowCreationTest.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -37,26 +37,28 @@ 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 <brian at matzon.dk>
  */
 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		= 0;
+	private int						window_x;
 
 	/** Window position y */
-	private int						window_y		= 0;
+	private int						window_y;
 
 	/** Color being cleared to */
 	private float					color				= 0f;
@@ -65,13 +67,13 @@ public class WindowCreationTest {
 	private int						direction		= 1;
 
 	/** Whether we're running */
-	private boolean				running			= false;
+	private boolean				running;
 
 	/** Whether we're in fullscreen mode */
-	private boolean				fullscreen	= false;
-	
+	private boolean				fullscreen;
+
 	/**
-	 * Initializes the test 
+	 * Initializes the test
 	 * @return true if initialization was successfull
 	 */
 	public boolean initialize() {
@@ -79,16 +81,16 @@ public class WindowCreationTest {
 			// 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) {
@@ -96,7 +98,7 @@ public class WindowCreationTest {
 		}
 		return false;
 	}
-	
+
 	/** Locate fixed modes */
 	private void findFixedModes() {
 		// get 640*480 modes
@@ -151,7 +153,7 @@ public class WindowCreationTest {
 	}
 
 	/**
-	 * Handles the input 
+	 * Handles the input
 	 */
 	private void handleInput() {
 		while (Keyboard.next()) {
@@ -165,14 +167,14 @@ public class WindowCreationTest {
 			if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
 				running = false;
 			}
-			
+
 			// check for listing of modes
 			if (Keyboard.getEventKey() == Keyboard.KEY_L) {
 				for(int i=0;i<fixed_modes.length; i++) {
 					System.out.println("[" + i + "]: " + fixed_modes[i]);
 				}
 			}
-			
+
 			// check for display mode
 			// ================================
 			if (Keyboard.getEventKey() == Keyboard.KEY_0) { setMode(0); }
@@ -181,7 +183,7 @@ public class WindowCreationTest {
 			if (Keyboard.getEventKey() == Keyboard.KEY_3) {	setMode(3); }
 			if (Keyboard.getEventKey() == Keyboard.KEY_4) {	setMode(4); }
 			if (Keyboard.getEventKey() == Keyboard.KEY_5) {	setMode(5); }
-			if (Keyboard.getEventKey() == Keyboard.KEY_6) {	setMode(6); }		
+			if (Keyboard.getEventKey() == Keyboard.KEY_6) {	setMode(6); }
 			if (Keyboard.getEventKey() == Keyboard.KEY_7) {	setMode(7); }
 			if (Keyboard.getEventKey() == Keyboard.KEY_8) {	setMode(8); }
 			// --------------------------------
@@ -232,13 +234,13 @@ public class WindowCreationTest {
 			}
 		}
 	}
-	
+
 	private void setMode(int mode) {
 		if(fixed_modes[mode] == null) {
 			System.out.println("Unable to set mode. Not valid: " + mode);
 			return;
 		}
-		
+
 		try {
 			Display.setDisplayMode(fixed_modes[mode]);
 		} catch (LWJGLException le) {
@@ -251,8 +253,8 @@ public class WindowCreationTest {
 	 *
 	 */
 	private void render() {
-		GL11.glClearColor(color, color, color, 1f);
-		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
+		glClearColor(color, color, color, 1f);
+		glClear(GL_COLOR_BUFFER_BIT);
 
 		color += direction * .05f;
 
@@ -267,19 +269,19 @@ public class WindowCreationTest {
 
 	/**
 	 * 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" + 
+		                   "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" + 
+		                   "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();
@@ -304,9 +306,9 @@ public class WindowCreationTest {
 		}
 		return false;
 	}
-	
-	/** 
-	 * Gets a specific display mode 
+
+	/**
+	 * Gets a specific display mode
 	 */
 	private DisplayMode getDisplayMode(int width, int height, int bpp, int freq) {
 		DisplayMode[] dm = null;
diff --git a/src/java/org/lwjgl/test/applet/AppletLoaderTest.java b/src/java/org/lwjgl/test/applet/AppletLoaderTest.java
index 453c6a9..825596d 100644
--- a/src/java/org/lwjgl/test/applet/AppletLoaderTest.java
+++ b/src/java/org/lwjgl/test/applet/AppletLoaderTest.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -36,8 +36,8 @@ import java.awt.BorderLayout;
 import java.awt.Canvas;
 
 public class AppletLoaderTest extends Applet {
-	
-	Test test = null;
+
+	Test test;
 
 	public void destroy() {
 		super.destroy();
@@ -57,7 +57,7 @@ public class AppletLoaderTest extends Applet {
 
 	public void init() {
 		System.out.println("*** init ***");
-		
+
 		setLayout(new BorderLayout());
 		try {
 			test = (Test) Class.forName(getParameter("test")).newInstance();
diff --git a/src/java/org/lwjgl/test/applet/GearsApplet.java b/src/java/org/lwjgl/test/applet/GearsApplet.java
index a8c01d4..7a0d49d 100644
--- a/src/java/org/lwjgl/test/applet/GearsApplet.java
+++ b/src/java/org/lwjgl/test/applet/GearsApplet.java
@@ -6,42 +6,45 @@ import java.awt.Canvas;
 import java.nio.FloatBuffer;
 import org.lwjgl.BufferUtils;
 import org.lwjgl.LWJGLException;
-import org.lwjgl.opengl.ARBTransposeMatrix;
+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.GL11;
 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 = false;
-	
+	boolean running;
+
 	/** variables used to rotate the view */
 	private float view_rotx	= 20.0f;
 	private float view_roty	= 30.0f;
-	private float view_rotz	= 0.0f;
-	
+	private float view_rotz;
+
 	private int gear1;
 	private int	gear2;
 	private int	gear3;
 	private float angle;
-	
-	boolean keyDown = false;
-	
+
+	boolean keyDown;
+
 	private int prevMouseX, prevMouseY;
-	private boolean mouseButtonDown = false;
-	
-	
+	private boolean mouseButtonDown;
+
+
 	/**
-	 * Once the Canvas is created its add notify method will call this method to 
+	 * 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() {
@@ -61,8 +64,8 @@ public class GearsApplet extends Applet {
 		};
 		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
@@ -77,15 +80,15 @@ public class GearsApplet extends Applet {
 	}
 
 	public void start() {
-		
+
 	}
 
 	public void stop() {
-		
+
 	}
-	
+
 	/**
-	 * Applet Destroy method will remove the canvas, before canvas is destroyed it will notify 
+	 * 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() {
@@ -93,21 +96,21 @@ public class GearsApplet extends Applet {
 		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 
+	 * 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 final void addNotify() {
+				public void addNotify() {
 					super.addNotify();
 					startLWJGL();
 				}
-				public final void removeNotify() {
+				public void removeNotify() {
 					stopLWJGL();
 					super.removeNotify();
 				}
@@ -131,22 +134,22 @@ public class GearsApplet extends Applet {
 
 		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 " + (float) (timeUsed / 1000f) + " seconds = "
+				System.out.println(fps + " frames 2 in " + timeUsed / 1000f + " seconds = "
 						+ (fps / (timeUsed / 1000f)));
 				fps = 0;
 			}
-			
+
 			if (Mouse.isButtonDown(0)) {
 				if (!mouseButtonDown) {
 					prevMouseX = Mouse.getX();
@@ -157,25 +160,25 @@ public class GearsApplet extends Applet {
 			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);
@@ -188,38 +191,38 @@ public class GearsApplet extends Applet {
 				}
 			}
 		}
-		
+
 		Display.destroy();
 	}
-	
+
 	public void drawLoop() {
-		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
-		
-		GL11.glPushMatrix();
-		
-		GL11.glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
-		GL11.glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
-		GL11.glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);
-		
-		GL11.glPushMatrix();
-		GL11.glTranslatef(-3.0f, -2.0f, 0.0f);
-		GL11.glRotatef(angle, 0.0f, 0.0f, 1.0f);
-		GL11.glCallList(gear1);
-		GL11.glPopMatrix();
-		
-		GL11.glPushMatrix();
-		GL11.glTranslatef(3.1f, -2.0f, 0.0f);
-		GL11.glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f);
-		GL11.glCallList(gear2);
-		GL11.glPopMatrix();
-		
-		GL11.glPushMatrix();
-		GL11.glTranslatef(-3.1f, 4.2f, 0.0f);
-		GL11.glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f);
-		GL11.glCallList(gear3);
-		GL11.glPopMatrix();
-		
-		GL11.glPopMatrix();
+		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() {
@@ -229,61 +232,62 @@ public class GearsApplet extends Applet {
 			FloatBuffer red = BufferUtils.createFloatBuffer(4).put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f});
 			FloatBuffer green = BufferUtils.createFloatBuffer(4).put(new float[] { 0.0f, 0.8f, 0.2f, 1.0f});
 			FloatBuffer blue = BufferUtils.createFloatBuffer(4).put(new float[] { 0.2f, 0.2f, 1.0f, 1.0f});
-			
+
 			pos.flip();
 			red.flip();
 			green.flip();
 			blue.flip();
-			
-			GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, pos);
-			GL11.glEnable(GL11.GL_CULL_FACE);
-			GL11.glEnable(GL11.GL_LIGHTING);
-			GL11.glEnable(GL11.GL_LIGHT0);
-			GL11.glEnable(GL11.GL_DEPTH_TEST);
+
+			glLight(GL_LIGHT0, GL_POSITION, pos);
+			glEnable(GL_CULL_FACE);
+			glEnable(GL_LIGHTING);
+			glEnable(GL_LIGHT0);
+			glEnable(GL_DEPTH_TEST);
 
 			/* make the gears */
-			gear1 = GL11.glGenLists(1);
-			GL11.glNewList(gear1, GL11.GL_COMPILE);
-			GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, red);
+			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);
-			GL11.glEndList();
-			
-			gear2 = GL11.glGenLists(1);
-			GL11.glNewList(gear2, GL11.GL_COMPILE);
-			GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, green);
+			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);
-			GL11.glEndList();
-			
-			gear3 = GL11.glGenLists(1);
-			GL11.glNewList(gear3, GL11.GL_COMPILE);
-			GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, blue);
+			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);
-			GL11.glEndList();
-			GL11.glEnable(GL11.GL_NORMALIZE);
-			GL11.glMatrixMode(GL11.GL_PROJECTION);
-			
-			System.err.println("GL_VENDOR: " + GL11.glGetString(GL11.GL_VENDOR));
-			System.err.println("GL_RENDERER: " + GL11.glGetString(GL11.GL_RENDERER));
-			System.err.println("GL_VERSION: " + GL11.glGetString(GL11.GL_VERSION));
+			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
-				GL11.glLoadIdentity();
+				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();
-				ARBTransposeMatrix.glLoadTransposeMatrixARB(identityTranspose);
+				glLoadTransposeMatrixARB(identityTranspose);
 			}
 			float h = (float) display_parent.getHeight() / (float) display_parent.getWidth();
-			GL11.glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
-			GL11.glMatrixMode(GL11.GL_MODELVIEW);
-			GL11.glLoadIdentity();
-			GL11.glTranslatef(0.0f, 0.0f, -40.0f);
+			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;
@@ -310,92 +314,92 @@ public class GearsApplet extends Applet {
 		r1 = outer_radius - tooth_depth / 2.0f;
 		r2 = outer_radius + tooth_depth / 2.0f;
 		da = 2.0f * (float) Math.PI / teeth / 4.0f;
-		GL11.glShadeModel(GL11.GL_FLAT);
-		GL11.glNormal3f(0.0f, 0.0f, 1.0f);
+		glShadeModel(GL_FLAT);
+		glNormal3f(0.0f, 0.0f, 1.0f);
 		/* draw front face */
-		GL11.glBegin(GL11.GL_QUAD_STRIP);
+		glBegin(GL_QUAD_STRIP);
 		for (i = 0; i <= teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
-			GL11.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), r1 * (float) Math.sin(angle), width * 0.5f);
 			if (i < teeth) {
-				GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
-				GL11.glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da),
+				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);
 			}
 		}
-		GL11.glEnd();
+		glEnd();
 
 		/* draw front sides of teeth */
-		GL11.glBegin(GL11.GL_QUADS);
+		glBegin(GL_QUADS);
 		for (i = 0; i < teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + 2.0f * da), r2 * (float) Math.sin(angle + 2.0f * da), width * 0.5f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f);
+			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);
 		}
-		GL11.glEnd();
+		glEnd();
 
 		/* draw back face */
-		GL11.glBegin(GL11.GL_QUAD_STRIP);
+		glBegin(GL_QUAD_STRIP);
 		for (i = 0; i <= teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
-			GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
-			GL11.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);
+			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);
 		}
-		GL11.glEnd();
+		glEnd();
 
 		/* draw back sides of teeth */
-		GL11.glBegin(GL11.GL_QUADS);
+		glBegin(GL_QUADS);
 		for (i = 0; i < teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (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(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);
 		}
-		GL11.glEnd();
+		glEnd();
 
 		/* draw outward faces of teeth */
-		GL11.glBegin(GL11.GL_QUAD_STRIP);
+		glBegin(GL_QUAD_STRIP);
 		for (i = 0; i < teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
-			GL11.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);
+			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;
-			GL11.glNormal3f(v, -u, 0.0f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
-			GL11.glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
+			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);
-			GL11.glNormal3f(v, -u, 0.0f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), width * 0.5f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
-			GL11.glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
+			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);
 		}
-		GL11.glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), width * 0.5f);
-		GL11.glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), -width * 0.5f);
-		GL11.glEnd();
+		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();
 
-		GL11.glShadeModel(GL11.GL_SMOOTH);
+		glShadeModel(GL_SMOOTH);
 		/* draw inside radius cylinder */
-		GL11.glBegin(GL11.GL_QUAD_STRIP);
+		glBegin(GL_QUAD_STRIP);
 		for (i = 0; i <= teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glNormal3f(-(float) Math.cos(angle), -(float) Math.sin(angle), 0.0f);
-			GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
-			GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
+			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);
 		}
-		GL11.glEnd();
+		glEnd();
 	}
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/applet/OpenAL.java b/src/java/org/lwjgl/test/applet/OpenAL.java
index 4dc943d..40da22f 100644
--- a/src/java/org/lwjgl/test/applet/OpenAL.java
+++ b/src/java/org/lwjgl/test/applet/OpenAL.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -39,26 +39,27 @@ import org.lwjgl.openal.AL;
 import org.lwjgl.openal.AL10;
 import org.lwjgl.opengl.AWTGLCanvas;
 import org.lwjgl.opengl.Display;
-import org.lwjgl.opengl.GL11;
 import org.lwjgl.util.WaveData;
 
+import static org.lwjgl.opengl.GL11.*;
+
 public class OpenAL extends AWTGLCanvas implements Test {
 
-	float	angle	= 0;
-	
+	float	angle;
+
 	// create 1 buffer and 1 source
     IntBuffer buffers = BufferUtils.createIntBuffer(1);
-    IntBuffer sources = 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() {
@@ -75,7 +76,7 @@ public class OpenAL extends AWTGLCanvas implements Test {
 
 	private void playOpenAL() {
 		int lastError;
-        
+
         // al generate buffers and sources
         buffers.position(0).limit(1);
         AL10.alGenBuffers(buffers);
@@ -88,37 +89,37 @@ public class OpenAL extends AWTGLCanvas implements Test {
         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();        
-        
+      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) {
@@ -126,22 +127,22 @@ public class OpenAL extends AWTGLCanvas implements Test {
 	}
 
 	public void paintGL() {
-		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
-		GL11.glMatrixMode(GL11.GL_PROJECTION_MATRIX);
-		GL11.glLoadIdentity();
-		GL11.glOrtho(0, 640, 0, 480, 1, -1);
-		GL11.glMatrixMode(GL11.GL_MODELVIEW_MATRIX);
-
-		GL11.glPushMatrix();
-		GL11.glTranslatef(320, 240, 0.0f);
-		GL11.glRotatef(angle, 0, 0, 1.0f);
-		GL11.glBegin(GL11.GL_QUADS);
-		GL11.glVertex2i(-50, -50);
-		GL11.glVertex2i(50, -50);
-		GL11.glVertex2i(50, 50);
-		GL11.glVertex2i(-50, 50);
-		GL11.glEnd();
-		GL11.glPopMatrix();
+		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;
 
@@ -152,31 +153,31 @@ public class OpenAL extends AWTGLCanvas implements Test {
 	}
 
 	public void start() {
-		playOpenAL();		
+		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();
 	}
 }
diff --git a/src/java/org/lwjgl/test/applet/OpenGL.java b/src/java/org/lwjgl/test/applet/OpenGL.java
index 10d1c4a..92d59e0 100644
--- a/src/java/org/lwjgl/test/applet/OpenGL.java
+++ b/src/java/org/lwjgl/test/applet/OpenGL.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -35,11 +35,12 @@ import org.lwjgl.LWJGLException;
 import org.lwjgl.input.Keyboard;
 import org.lwjgl.input.Mouse;
 import org.lwjgl.opengl.AWTGLCanvas;
-import org.lwjgl.opengl.GL11;
+
+import static org.lwjgl.opengl.GL11.*;
 
 public class OpenGL extends AWTGLCanvas implements Test {
 
-	float	angle	= 0;
+	float	angle;
 	float x;
 	float y;
 
@@ -47,28 +48,28 @@ public class OpenGL extends AWTGLCanvas implements Test {
 	}
 
 	public void initGL() {
-		GL11.glMatrixMode(GL11.GL_PROJECTION_MATRIX);
-		GL11.glLoadIdentity();
-		GL11.glOrtho(0, 640, 0, 480, 1, -1);
+		glMatrixMode(GL_PROJECTION_MATRIX);
+		glLoadIdentity();
+		glOrtho(0, 640, 0, 480, 1, -1);
 		x = 320;
 		y = 240;
-		GL11.glMatrixMode(GL11.GL_MODELVIEW_MATRIX);
+		glMatrixMode(GL_MODELVIEW_MATRIX);
 		setVSyncEnabled(true);
 	}
 
 	public void paintGL() {
-		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
+		glClear(GL_COLOR_BUFFER_BIT);
 
-		GL11.glPushMatrix();
-		GL11.glTranslatef(x, y, 0.0f);
-		GL11.glRotatef(angle, 0, 0, 1.0f);
-		GL11.glBegin(GL11.GL_QUADS);
-		GL11.glVertex2i(-50, -50);
-		GL11.glVertex2i(50, -50);
-		GL11.glVertex2i(50, 50);
-		GL11.glVertex2i(-50, 50);
-		GL11.glEnd();
-		GL11.glPopMatrix();
+		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;
 
diff --git a/src/java/org/lwjgl/test/applet/Speed.java b/src/java/org/lwjgl/test/applet/Speed.java
index e6e4767..86cf6e5 100644
--- a/src/java/org/lwjgl/test/applet/Speed.java
+++ b/src/java/org/lwjgl/test/applet/Speed.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -33,34 +33,35 @@ package org.lwjgl.test.applet;
 
 import org.lwjgl.LWJGLException;
 import org.lwjgl.opengl.AWTGLCanvas;
-import org.lwjgl.opengl.GL11;
+
+import static org.lwjgl.opengl.GL11.*;
 
 public class Speed extends AWTGLCanvas implements Test {
 
-	private float	angle	= 0;
+	private float	angle;
 	private long startTime = System.currentTimeMillis() + 5000;
-	private long fps = 0;
+	private long fps;
 
 	public Speed() throws LWJGLException {
 	}
 
 	public void paintGL() {
-		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
-		GL11.glMatrixMode(GL11.GL_PROJECTION_MATRIX);
-		GL11.glLoadIdentity();
-		GL11.glOrtho(0, 640, 0, 480, 1, -1);
-		GL11.glMatrixMode(GL11.GL_MODELVIEW_MATRIX);
+		glClear(GL_COLOR_BUFFER_BIT);
+		glMatrixMode(GL_PROJECTION_MATRIX);
+		glLoadIdentity();
+		glOrtho(0, 640, 0, 480, 1, -1);
+		glMatrixMode(GL_MODELVIEW_MATRIX);
 
-		GL11.glPushMatrix();
-		GL11.glTranslatef(320, 240, 0.0f);
-		GL11.glRotatef(angle, 0, 0, 1.0f);
-		GL11.glBegin(GL11.GL_QUADS);
-		GL11.glVertex2i(-50, -50);
-		GL11.glVertex2i(50, -50);
-		GL11.glVertex2i(50, 50);
-		GL11.glVertex2i(-50, 50);
-		GL11.glEnd();
-		GL11.glPopMatrix();
+		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;
 
@@ -77,10 +78,10 @@ public class Speed extends AWTGLCanvas implements Test {
 		} else {
 			long timeUsed = 5000 + (startTime - System.currentTimeMillis());
 			startTime = System.currentTimeMillis() + 5000;
-			System.out.println(fps + " frames in " + (float) (timeUsed / 1000f) + " seconds = "
+			System.out.println(fps + " frames in " + timeUsed / 1000f + " seconds = "
 					+ (fps / (timeUsed / 1000f)));
 			fps = 0;
-		}					
+		}
 	}
 
 	public void start() {
diff --git a/src/java/org/lwjgl/test/applet/Test.java b/src/java/org/lwjgl/test/applet/Test.java
index 22bb583..19699bf 100644
--- a/src/java/org/lwjgl/test/applet/Test.java
+++ b/src/java/org/lwjgl/test/applet/Test.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -33,6 +33,6 @@ package org.lwjgl.test.applet;
 
 
 public interface Test {
-	public void start();
-	public void stop();
+	void start();
+	void stop();
 }
diff --git a/src/java/org/lwjgl/test/glu/tessellation/TessCallback.java b/src/java/org/lwjgl/test/glu/tessellation/TessCallback.java
index 0a58cc6..74eb6e3 100644
--- a/src/java/org/lwjgl/test/glu/tessellation/TessCallback.java
+++ b/src/java/org/lwjgl/test/glu/tessellation/TessCallback.java
@@ -31,13 +31,14 @@
  */
 package org.lwjgl.test.glu.tessellation;
 
-import org.lwjgl.opengl.GL11;
 import org.lwjgl.util.glu.GLUtessellatorCallbackAdapter;
 
+import static org.lwjgl.opengl.GL11.*;
+
 public class TessCallback extends GLUtessellatorCallbackAdapter {
 
 	public void begin(int type) {
-		GL11.glBegin(type);
+		glBegin(type);
 	}
 
 	public void combine(double[] coords, Object[] data, float[] weight, Object[] outData) {
@@ -49,7 +50,7 @@ public class TessCallback extends GLUtessellatorCallbackAdapter {
 			combined[3] = 1;
 			combined[4] = 1;
 			combined[5] = 1;
-			
+
 			outData[i] = new VertexData(combined);
 		}
 //		vertex[0] = coords[0];
@@ -66,15 +67,15 @@ public class TessCallback extends GLUtessellatorCallbackAdapter {
 //
 //		*dataOut = vertex;
 	}
-	
+
 	public void end() {
-		GL11.glEnd();
+		glEnd();
 	}
 
 	public void vertex(Object vertexData) {
 		VertexData vertex = (VertexData) vertexData;
 
-		GL11.glVertex3d(vertex.data[0], vertex.data[1], vertex.data[2]);
-		GL11.glColor3d(vertex.data[3], vertex.data[4], vertex.data[5]);
+		glVertex3d(vertex.data[0], vertex.data[1], vertex.data[2]);
+		glColor3d(vertex.data[3], vertex.data[4], vertex.data[5]);
 	}
 }
diff --git a/src/java/org/lwjgl/test/glu/tessellation/TessellationTest.java b/src/java/org/lwjgl/test/glu/tessellation/TessellationTest.java
index f38dfe4..d02a8cb 100644
--- a/src/java/org/lwjgl/test/glu/tessellation/TessellationTest.java
+++ b/src/java/org/lwjgl/test/glu/tessellation/TessellationTest.java
@@ -33,32 +33,33 @@ package org.lwjgl.test.glu.tessellation;
 import org.lwjgl.LWJGLException;
 import org.lwjgl.opengl.Display;
 import org.lwjgl.opengl.DisplayMode;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.util.glu.GLU;
 import org.lwjgl.util.glu.GLUtessellator;
 
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.util.glu.GLU.*;
+
 public class TessellationTest {
 	private GLUtessellator tesselator;
-	
+
 	void init()
 	{
-		// Create a new tessellation object 
-		tesselator = GLU.gluNewTess();
-	
+		// Create a new tessellation object
+		tesselator = gluNewTess();
+
 		// Set callback functions
 		TessCallback callback = new TessCallback();
-		tesselator.gluTessCallback(GLU.GLU_TESS_VERTEX, callback);
-		tesselator.gluTessCallback(GLU.GLU_TESS_BEGIN, callback);
-		tesselator.gluTessCallback(GLU.GLU_TESS_END, callback);
-		tesselator.gluTessCallback(GLU.GLU_TESS_COMBINE, callback);
+		tesselator.gluTessCallback(GLU_TESS_VERTEX, callback);
+		tesselator.gluTessCallback(GLU_TESS_BEGIN, callback);
+		tesselator.gluTessCallback(GLU_TESS_END, callback);
+		tesselator.gluTessCallback(GLU_TESS_COMBINE, callback);
 	}
 
 	void setWindingRule(int windingRule)
 	{
 		// Set the winding rule
-		tesselator.gluTessProperty(GLU.GLU_TESS_WINDING_RULE, windingRule); 
+		tesselator.gluTessProperty(GLU_TESS_WINDING_RULE, windingRule);
 	}
-	 
+
 	void renderContour(double obj_data[][], int num_vertices)
 	{
 		for (int x = 0; x < num_vertices; x++) //loop through the vertices
@@ -66,7 +67,7 @@ public class TessellationTest {
 			tesselator.gluTessVertex(obj_data[x], 0, new VertexData(obj_data[x])); //store the vertex
 		}
 	}
-	
+
 	void beginPolygon()
 	{
 		tesselator.gluTessBeginPolygon(null);
@@ -76,7 +77,7 @@ public class TessellationTest {
 	{
 		tesselator.gluTessEndPolygon();
 	}
-	
+
 	void beginContour()
 	{
 		tesselator.gluTessBeginContour();
@@ -86,7 +87,7 @@ public class TessellationTest {
 	{
 		tesselator.gluTessEndContour();
 	}
-	
+
 	void end()
 	{
 		tesselator.gluDeleteTess();
@@ -95,47 +96,47 @@ public class TessellationTest {
 	private void createDisplay() throws LWJGLException {
 		int width = 300;
 		int height = 300;
-		
+
 		Display.setDisplayMode(new DisplayMode(width,height));
 		Display.create();
 		Display.setVSyncEnabled(true);
 
-		GL11.glEnable(GL11.GL_TEXTURE_2D);
-		GL11.glShadeModel(GL11.GL_SMOOTH);        
-		GL11.glDisable(GL11.GL_DEPTH_TEST);
-		GL11.glDisable(GL11.GL_LIGHTING);                    
-        
-		GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);                
-        GL11.glClearDepth(1);                                       
-        
-        GL11.glEnable(GL11.GL_BLEND);
-        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
-        
-        GL11.glViewport(0,0,width,height);
-		GL11.glMatrixMode(GL11.GL_MODELVIEW);
-
-		GL11.glMatrixMode(GL11.GL_PROJECTION);
-		GL11.glLoadIdentity();
-		GL11.glOrtho(0, width, height, 0, 1, -1);
-		GL11.glMatrixMode(GL11.GL_MODELVIEW);
+		glEnable(GL_TEXTURE_2D);
+		glShadeModel(GL_SMOOTH);
+		glDisable(GL_DEPTH_TEST);
+		glDisable(GL_LIGHTING);
+
+		glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+        glClearDepth(1);
+
+        glEnable(GL_BLEND);
+        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+        glViewport(0,0,width,height);
+		glMatrixMode(GL_MODELVIEW);
+
+		glMatrixMode(GL_PROJECTION);
+		glLoadIdentity();
+		glOrtho(0, width, height, 0, 1, -1);
+		glMatrixMode(GL_MODELVIEW);
 	}
-	
+
 	private void loop() {
 		while (true) {
 			render();
 			Display.update();
 			Display.sync(100);
-			
+
 			if (Display.isCloseRequested()) {
 				System.exit(0);
 			}
 		}
 	}
-	
+
 	private void render() {
-		GL11.glTranslatef(150,125,0);
-		
-		GL11.glScalef(50,50,1);
+		glTranslatef(150,125,0);
+
+		glScalef(50,50,1);
 		// first polygon: a star-5 vertices and color information
 		double star[][] = { {0.6f,  -0.1f, 0f, 1.0f, 1.0f, 1.0f},
                 {1.35f, 1.4f, 0f, 1.0f, 1.0f, 1.0f},
@@ -148,16 +149,16 @@ public class TessellationTest {
 		                {1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f},
 		                {1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f},
 		                {0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f} };
-		
+
 		//second polygon: a triangle-3 vertices; second contour
 		double tri[][] = {{0.3f, 0.3f, 0.0f, 0.0f, 0.0f, 0.0f},
 		               {0.7f, 0.3f, 0.0f, 0.0f, 0.0f, 0.0f},
 		               {0.5f, 0.7f, 0.0f, 0.0f, 0.0f, 0.0f} };
 
 		// render the first polygon: the textured star
-		
+
 		// set winding rule to positive
-		setWindingRule(GLU.GLU_TESS_WINDING_POSITIVE);
+		setWindingRule(GLU_TESS_WINDING_POSITIVE);
 		beginPolygon();
 		beginContour();
 		renderContour(star, 5);
@@ -166,9 +167,9 @@ public class TessellationTest {
 
 		// render the second polygon: triangle cut out of a quad
 
-		GL11.glTranslatef(-2,0,0);
+		glTranslatef(-2,0,0);
 		// set winding rule to odd
-		setWindingRule(GLU.GLU_TESS_WINDING_ODD);
+		setWindingRule(GLU_TESS_WINDING_ODD);
 		// begin the new polygon
 		beginPolygon();
 		beginContour();
@@ -181,13 +182,13 @@ public class TessellationTest {
 		// delete the tess object
 		end();
 	}
-	
+
 	private void start() throws LWJGLException {
 		createDisplay();
 		init();
 		loop();
 	}
-	
+
 	public static void main(String[] argv) throws LWJGLException {
 		TessellationTest test = new TessellationTest();
 		test.start();
diff --git a/src/java/org/lwjgl/test/input/HWCursorTest.java b/src/java/org/lwjgl/test/input/HWCursorTest.java
index 3ce1bcb..9ad1369 100644
--- a/src/java/org/lwjgl/test/input/HWCursorTest.java
+++ b/src/java/org/lwjgl/test/input/HWCursorTest.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -40,38 +40,39 @@ import org.lwjgl.input.Keyboard;
 import org.lwjgl.input.Mouse;
 import org.lwjgl.opengl.Display;
 import org.lwjgl.opengl.DisplayMode;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.util.glu.GLU;
+
+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 <brian at matzon.dk>
- * @version $Revision: 2983 $
- * $Id: HWCursorTest.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: HWCursorTest.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public class HWCursorTest {
-	
+
 	/** The native cursor */
-	private static Cursor[] cursor = null;
-	
+	private static Cursor[] cursors;
+
 	/** The mouse cursor position */
 	private static int mouse_x;
 	private static int mouse_y;
-	private static int mouse_btn = 0;
-	
+	private static int mouse_btn;
+
 	/**
 	 * Executes the test
 	 */
 	public void execute() {
 		initialize();
-		
+
 		mainLoop();
-		
+
 		cleanup();
 	}
-	
+
 	/**
 	 * Sets the display mode for fullscreen mode
 	 */
@@ -85,15 +86,15 @@ public class HWCursorTest {
 					"height=" + 480,
 					"freq=" + 60,
 					"bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel()
-			}); 
+			});
 			return true;
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
-		
+
 		return false;
-	}  
-	
+	}
+
 	/**
 	 * Initializes the test
 	 */
@@ -102,32 +103,32 @@ public class HWCursorTest {
 			// 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);
 		}
-		
-		cursor = new Cursor[3];
-		
+
+		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();
@@ -138,32 +139,32 @@ public class HWCursorTest {
 			}
 		}
 		cursorImages.flip();
-		cursor[0] = new Cursor(cursorWidth, cursorHeight, cursorWidth/2, cursorHeight/2, cursorImageCount, cursorImages, cursorDelays);
+		cursors[0] = new Cursor(cursorWidth, cursorHeight, cursorWidth/2, cursorHeight/2, cursorImageCount, cursorImages, cursorDelays);
 		// ----------------------------------
-		
+
 		// Create 3 piece animation
 		// ==================================
 		cursorImageCount = 3;
 		cursorImages = ByteBuffer.allocateDirect(cursorWidth*cursorHeight*cursorImageCount*4).order(ByteOrder.nativeOrder()).asIntBuffer();
 		cursorDelays = ByteBuffer.allocateDirect(cursorImageCount*4).order(ByteOrder.nativeOrder()).asIntBuffer();
 		for(int i=0; i<cursorImageCount; i++) {
-			
-			// make a colored square with a chocolate center 
+
+			// make a colored square with a chocolate center
 			int offColor = 0x00000000;
 			int onColor = 0xffff0000;
-			
+
 			// change color according to cursor
 			if(i == 1) {
 				onColor = 0xff00ff00;
 			} else if (i == 2) {
 				onColor = 0xff0000ff;
 			}
-			
+
 			// calculate size of center
 			int centerSize  = (cursorWidth / 5) * (i + 1);
 			int centerLeft  = cursorWidth / 2 - centerSize / 2;
 			int centerRight = cursorWidth / 2 + centerSize / 2;
-			
+
 			// go!
 			for(int j=0; j<cursorWidth; j++) {
 				for(int l=0; l<cursorHeight; l++) {
@@ -178,24 +179,24 @@ public class HWCursorTest {
 		cursorDelays.put(2000).put(2000).put(2000);
 		cursorDelays.flip();
 		cursorImages.flip();
-		
-		cursor[1] = new Cursor(cursorWidth, cursorHeight, cursorWidth/2, cursorHeight/2, cursorImageCount, cursorImages, cursorDelays);
+
+		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[] { 
+										 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<cursorImageCount; i++) {
 			for(int j=0; j<cursorWidth; j++) {
@@ -207,12 +208,12 @@ public class HWCursorTest {
 		}
 		cursorImages.flip();
 		cursorDelays.flip();
-		cursor[2] = new Cursor(cursorWidth, cursorHeight, cursorWidth/2, cursorHeight/2, cursorImageCount, cursorImages, cursorDelays);      
+		cursors[2] = new Cursor(cursorWidth, cursorHeight, cursorWidth/2, cursorHeight/2, cursorImageCount, cursorImages, cursorDelays);
 		// ----------------------------------
-		
-		Mouse.setNativeCursor(cursor[0]);
+
+		Mouse.setNativeCursor(cursors[0]);
 	}
-	
+
 	/**
 	 * Runs the main loop of the "test"
 	 */
@@ -221,20 +222,20 @@ public class HWCursorTest {
 				&& !Display.isCloseRequested()) {
 			// allow subsystem to get a chance to run too
 			Display.update();
-			
+
 			if (Display.isVisible()) {
 				// check keyboard input
 				processKeyboard();
 				processMouse();
-				
+
 				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);
@@ -243,35 +244,35 @@ public class HWCursorTest {
 			}
 		}
 	}
-	
+
 	/**
 	 * Performs the logic
 	 */
 	private void render() {
 		//clear background
-		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
-		
+		glClear(GL_COLOR_BUFFER_BIT);
+
 		// draw white quad
-		GL11.glPushMatrix();
+		glPushMatrix();
 		{
-			GL11.glTranslatef(mouse_x, mouse_y, 0);
-			GL11.glColor3f(1.0f, 1.0f, 1.0f);
-			GL11.glBegin(GL11.GL_QUADS);
+			glTranslatef(mouse_x, mouse_y, 0);
+			glColor3f(1.0f, 1.0f, 1.0f);
+			glBegin(GL_QUADS);
 			{
-				GL11.glColor3f(1.0f, 0.0f, 0.0f); GL11.glVertex2i(-50, -50);
-				GL11.glColor3f(0.0f, 1.0f, 0.0f); GL11.glVertex2i(50, -50);
-				GL11.glColor3f(0.0f, 0.0f, 1.0f); GL11.glVertex2i(50, 50);
-				GL11.glColor3f(1.0f, 0.0f, 1.0f); GL11.glVertex2i(-50, 50);
+				glColor3f(1.0f, 0.0f, 0.0f); glVertex2i(-50, -50);
+				glColor3f(0.0f, 1.0f, 0.0f); glVertex2i(50, -50);
+				glColor3f(0.0f, 0.0f, 1.0f); glVertex2i(50, 50);
+				glColor3f(1.0f, 0.0f, 1.0f); glVertex2i(-50, 50);
 			}
-			GL11.glEnd();
+			glEnd();
 		}
-		GL11.glPopMatrix();
+		glPopMatrix();
 	}
-	
+
 	private void processMouse() {
 		mouse_x = Mouse.getX();
 		mouse_y = Mouse.getY();
-		
+
 		while(Mouse.next()) {
 			int button = Mouse.getEventButton();
 			if(button >= 0 && button < 3 && Mouse.getEventButtonState()) {
@@ -280,14 +281,14 @@ public class HWCursorTest {
 			}
 		}
 	}
-	
+
 	/**
 	 * Processes keyboard input
 	 */
 	private void processKeyboard() {
 		//check for fullscreen key
 		if (Keyboard.isKeyDown(Keyboard.KEY_F)) {
-			
+
 			try {
 				try {
 					Mouse.setNativeCursor(null);
@@ -295,19 +296,19 @@ public class HWCursorTest {
 					e.printStackTrace();
 					System.exit(1);
 				}
-				for(int i=0; i<cursor.length; i++) {
-					cursor[i].destroy();
+				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 {
@@ -317,18 +318,18 @@ public class HWCursorTest {
 					e.printStackTrace();
 					System.exit(1);
 				}
-				for(int i=0; i<cursor.length; i++) {
-					cursor[i].destroy();
+				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);
@@ -336,21 +337,21 @@ public class HWCursorTest {
 				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(cursor[mouse_btn]);
+			Mouse.setNativeCursor(cursors[mouse_btn]);
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
@@ -366,31 +367,31 @@ public class HWCursorTest {
 			e.printStackTrace();
 			System.exit(1);
 		}
-		for(int i=0; i<cursor.length; i++) {
-			cursor[i].destroy();
+		for ( Cursor cursor : cursors ) {
+			cursor.destroy();
 		}
 		Display.destroy();
 	}
-	
+
 	/**
 	 * Initializes OGL
 	 */
 	private void glInit() {
 		// Go into orthographic projection mode.
-		GL11.glMatrixMode(GL11.GL_PROJECTION);
-		GL11.glLoadIdentity();
-		GLU.gluOrtho2D(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight());
-		GL11.glMatrixMode(GL11.GL_MODELVIEW);
-		GL11.glLoadIdentity();
-		GL11.glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
-		
+		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
-		GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-		
+		glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+
 		//sync frame (only works on windows)
 		Display.setVSyncEnabled(true);
 	}
-	
+
 	/**
 	 * Test entry point
 	 */
diff --git a/src/java/org/lwjgl/test/input/KeyboardTest.java b/src/java/org/lwjgl/test/input/KeyboardTest.java
index 1dbf57e..44ca20b 100644
--- a/src/java/org/lwjgl/test/input/KeyboardTest.java
+++ b/src/java/org/lwjgl/test/input/KeyboardTest.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -34,17 +34,18 @@ package org.lwjgl.test.input;
 import org.lwjgl.input.Keyboard;
 import org.lwjgl.opengl.Display;
 import org.lwjgl.opengl.DisplayMode;
-import org.lwjgl.opengl.GL11;
 import org.lwjgl.util.vector.Vector2f;
-import org.lwjgl.util.glu.GLU;
+
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.util.glu.GLU.*;
 
 /**
  * <br>
  * Keyboard test
  *
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 3042 $
- * $Id: KeyboardTest.java 3042 2008-04-22 21:26:39Z elias_naur $
+ * @version $Revision: 3418 $
+ * $Id: KeyboardTest.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public class KeyboardTest {
 
@@ -69,7 +70,7 @@ public class KeyboardTest {
       System.exit(-1);
     }
   }
-  
+
   /**
    * Sets the display mode for fullscreen mode
    */
@@ -83,14 +84,14 @@ public class KeyboardTest {
           "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 {
@@ -105,13 +106,13 @@ public class KeyboardTest {
   }
 
   private void initializeOpenGL() {
-	  GL11.glMatrixMode(GL11.GL_PROJECTION);
-	  GL11.glLoadIdentity();
-	  GLU.gluOrtho2D(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight());
-	  GL11.glMatrixMode(GL11.GL_MODELVIEW);
-	  GL11.glLoadIdentity();
-	  GL11.glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
-	  GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+	  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() {
@@ -159,7 +160,7 @@ public class KeyboardTest {
         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());
         }
@@ -209,20 +210,20 @@ public class KeyboardTest {
   }
 
   private void render() {
-    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
+    glClear(GL_COLOR_BUFFER_BIT);
 
-    GL11.glBegin(GL11.GL_POLYGON);
+    glBegin(GL_POLYGON);
     {
       float color = 1.0f;
-      GL11.glColor3f(color, color, color);
+      glColor3f(color, color, color);
 
-      GL11.glVertex2f(position.x + 0.0f, position.y + 0.0f);
-      GL11.glVertex2f(position.x + 0.0f, position.y + 30.0f);
-      GL11.glVertex2f(position.x + 40.0f, position.y + 30.0f);
-      GL11.glVertex2f(position.x + 60.0f, position.y + 15.f);
-      GL11.glVertex2f(position.x + 40.0f, position.y + 0.0f);
+      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);
     }
-    GL11.glEnd();
+    glEnd();
   }
 
   /**
diff --git a/src/java/org/lwjgl/test/input/MouseCreationTest.java b/src/java/org/lwjgl/test/input/MouseCreationTest.java
index 1b42b37..bc138c5 100644
--- a/src/java/org/lwjgl/test/input/MouseCreationTest.java
+++ b/src/java/org/lwjgl/test/input/MouseCreationTest.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -35,21 +35,22 @@ import org.lwjgl.Sys;
 import org.lwjgl.input.Mouse;
 import org.lwjgl.opengl.Display;
 import org.lwjgl.opengl.DisplayMode;
-import org.lwjgl.opengl.GL11;
 import org.lwjgl.util.vector.Vector2f;
 
+import static org.lwjgl.opengl.GL11.*;
+
 /**
  * <br>
  * Mouse test
  *
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 3108 $
- * $Id: MouseCreationTest.java 3108 2008-07-02 20:00:49Z 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() {
 	}
@@ -65,9 +66,9 @@ public class MouseCreationTest {
       System.exit(-1);
     }
 
-    initializeOpenGL();    
+    initializeOpenGL();
 	}
-  
+
   /**
    * Sets the display mode for fullscreen mode
    */
@@ -81,32 +82,32 @@ public class MouseCreationTest {
           "height=" + 480,
           "freq=" + 60,
           "bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel()
-         }); 
+         });
       return true;
     } catch (Exception e) {
       e.printStackTrace();
     }
 
     return false;
-  }  
-  
+  }
+
 	private void initializeOpenGL() {
-    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+    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.
-	GL11.glMatrixMode(GL11.GL_PROJECTION);
-	GL11.glLoadIdentity();
-	GL11.glOrtho(0.0, Display.getDisplayMode().getWidth(), 0.0, Display.getDisplayMode().getHeight(), -1.0, 1.0);
-	GL11.glMatrixMode(GL11.GL_MODELVIEW);
-	GL11.glLoadIdentity();
-	GL11.glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());    
+	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++) {
@@ -114,12 +115,12 @@ public class MouseCreationTest {
       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();
@@ -128,8 +129,8 @@ public class MouseCreationTest {
 			e.printStackTrace();
 		}
     System.out.println("success");
-    
-    
+
+
     // fullscreen mode
     System.out.println("=========== FULLSCREEN MODE ==============");
     for(int i=0; i<2; i++) {
@@ -137,7 +138,7 @@ public class MouseCreationTest {
       wiggleMouse();
       System.out.println("");
     }
-    
+
     System.out.println("Test completed successfully!");
     System.out.print("Shutting down...");
     Display.destroy();
@@ -149,27 +150,27 @@ public class MouseCreationTest {
 
 		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();
 
@@ -180,30 +181,30 @@ public class MouseCreationTest {
 		}
 		System.out.println("thank you");
 	}
-  
+
 	private void render() {
-    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
+    glClear(GL_COLOR_BUFFER_BIT);
 
-    GL11.glBegin(GL11.GL_POLYGON);
+    glBegin(GL_POLYGON);
     {
       float color = 1.0f;
       int buttonDown = 0;
-      
+
       for(int i=0;i<Mouse.getButtonCount(); i++) {
         if(Mouse.isButtonDown(i)) {
-          color = (1.0f / Mouse.getButtonCount()) * (i+1); 
-          break; 
+          color = (1.0f / Mouse.getButtonCount()) * (i+1);
+          break;
         }
       }
-      GL11.glColor3f(color, color, color);
-      
-      GL11.glVertex2f(position.x + 0.0f, position.y + 0.0f);
-      GL11.glVertex2f(position.x + 0.0f, position.y + 30.0f);
-      GL11.glVertex2f(position.x + 40.0f, position.y + 30.0f);
-      GL11.glVertex2f(position.x + 60.0f, position.y + 15.f);
-      GL11.glVertex2f(position.x + 40.0f, position.y + 0.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);
     }
-    GL11.glEnd();
+    glEnd();
 	}
 
 	/**
diff --git a/src/java/org/lwjgl/test/input/MouseTest.java b/src/java/org/lwjgl/test/input/MouseTest.java
index a6b76ea..9ab57d0 100644
--- a/src/java/org/lwjgl/test/input/MouseTest.java
+++ b/src/java/org/lwjgl/test/input/MouseTest.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -35,55 +35,56 @@ import org.lwjgl.input.Keyboard;
 import org.lwjgl.input.Mouse;
 import org.lwjgl.opengl.Display;
 import org.lwjgl.opengl.DisplayMode;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.util.glu.GLU;
 import org.lwjgl.util.vector.Vector2f;
 import org.lwjgl.util.vector.Vector3f;
 
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.util.glu.GLU.*;
+
 /**
  * <br>
  * Mouse test
  *
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 3240 $
- * $Id: MouseTest.java 3240 2009-09-12 22:15:21Z 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 = 0;
-  
+  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 triangleColor[] = new Vector3f[] { 
+  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 quadColor[] = new Vector3f[] {
+
+  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 = { 
+  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),
@@ -91,11 +92,11 @@ public class MouseTest {
       };
 
   /** Whether the test is closing */
-  private boolean closing = false;
-  
+  private boolean closing;
+
   /** Fullscreen or not */
   public static final boolean FULLSCREEN = false;
-  
+
   /** Creates a new instance of MouseTest */
   public MouseTest() {
   }
@@ -107,7 +108,7 @@ public class MouseTest {
     setupMouse();
     setupKeyboard();
   }
-  
+
   /**
    * Setup display
    */
@@ -123,16 +124,16 @@ public class MouseTest {
       System.exit(-1);
     }
 
-    initializeOpenGL();    
+    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;
@@ -141,20 +142,20 @@ public class MouseTest {
     }
 
     return false;
-  }  
+  }
 
   /**
    * Initializes OpenGL
    *
    */
   private void initializeOpenGL() {
-	  GL11.glMatrixMode(GL11.GL_PROJECTION);
-	  GL11.glLoadIdentity();
-	  GLU.gluOrtho2D(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight());
-	  GL11.glMatrixMode(GL11.GL_MODELVIEW);
-	  GL11.glLoadIdentity();
-	  GL11.glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
-    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+	  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);
   }
 
   /**
@@ -173,7 +174,7 @@ public class MouseTest {
    */
   private void setupMouse() {
   }
-  
+
   /**
    * Creates the keyboard
    */
@@ -187,19 +188,19 @@ public class MouseTest {
     // 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;
         }
@@ -214,7 +215,7 @@ public class MouseTest {
 
   /**
    * Pauses the current thread for a specified time
-   * 
+   *
    * @param time milliseconds to pause
    */
   private void pause(long time) {
@@ -232,16 +233,16 @@ public class MouseTest {
     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
    */
@@ -251,11 +252,11 @@ public class MouseTest {
       if(Mouse.getEventButton() != -1 && Mouse.getEventButtonState()) {
         lastButton = Mouse.getEventButton();
       }
-    }  
-    
+    }
+
     updateState();
   }
-  
+
   /**
    * Updates our "model"
    *
@@ -266,31 +267,31 @@ public class MouseTest {
     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) {
 
@@ -299,23 +300,23 @@ public class MouseTest {
         case -1:
           break;
         case 1:
-          triangleColor[direction].y = 1;
+          triangleColors[direction].y = 1;
           break;
         case 2:
-          triangleColor[direction].z = 1;
+          triangleColors[direction].z = 1;
           break;
         case 3:
-          triangleColor[direction].x = 1;
-          triangleColor[direction].y = 1;
-          triangleColor[direction].z = 1;
+          triangleColors[direction].x = 1;
+          triangleColors[direction].y = 1;
+          triangleColors[direction].z = 1;
           break;
         case 0:   // fall through
         default:
-          triangleColor[direction].x = 1;
+          triangleColors[direction].x = 1;
           break;
       }
     }
-    
+
     // get direction to update in
     if (dw > 0) {
       lastScrollDirection++;
@@ -324,7 +325,7 @@ public class MouseTest {
     } else if (dw == 0) {
       return;
     }
-    
+
     // over/underflow
     if(lastScrollDirection < 0) {
       lastScrollDirection = 3;
@@ -334,84 +335,84 @@ public class MouseTest {
     }
 
     // update colors
-    quadColor[lastScrollDirection].x = (float) Math.random();
-    quadColor[lastScrollDirection].y = (float) Math.random();
-    quadColor[lastScrollDirection].z = (float) Math.random();
+    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(int i=0; i<triangleColor.length; i++) {
-      triangleColor[i].x -= 0.01;
-      triangleColor[i].y -= 0.01;
-      triangleColor[i].z -= 0.01;
-    }   
-  
-    for(int i=0; i<quadColor.length; i++) {
-      quadColor[i].x -= 0.01;
-      quadColor[i].y -= 0.01;
-      quadColor[i].z -= 0.01;
-    }   
+	  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() {
-    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
+    glClear(GL_COLOR_BUFFER_BIT);
 
     // for each triangle, render it at position, rotating degrees for each
     for(int i=0; i<triangles.length; i++) {
-      GL11.glPushMatrix(); {
-        GL11.glTranslatef(triangles[i].x, triangles[i].y, 0);
-        GL11.glRotatef(i*90, 0, 0, 1);
-        
-        GL11.glColor3f(triangleColor[i].x, triangleColor[i].y, triangleColor[i].z);
-        
-        GL11.glBegin(GL11.GL_TRIANGLES); {
-          GL11.glVertex2f(0, triangleSize.y);
-          GL11.glVertex2f(-triangleSize.x, -triangleSize.y);
-          GL11.glVertex2f(+triangleSize.x, -triangleSize.y);
+      glPushMatrix(); {
+        glTranslatef(triangles[i].x, triangles[i].y, 0);
+        glRotatef(i*90, 0, 0, 1);
+
+        glColor3f(triangleColors[i].x, triangleColors[i].y, triangleColors[i].z);
+
+        glBegin(GL_TRIANGLES); {
+          glVertex2f(0, triangleSize.y);
+          glVertex2f(-triangleSize.x, -triangleSize.y);
+          glVertex2f(+triangleSize.x, -triangleSize.y);
         }
-        GL11.glEnd();
+        glEnd();
       }
-      GL11.glPopMatrix();
+      glPopMatrix();
     }
-    
+
     // paint quad in the middle (yes, wasting cpu cycles by not precalculating)
-    GL11.glBegin(GL11.GL_QUADS); {
-      GL11.glColor3f(quadColor[0].x, quadColor[0].y, quadColor[0].z);
-      GL11.glVertex2f(WINDOW_WIDTH/2-triangleSize.x, WINDOW_HEIGHT/2-triangleSize.x);
-      GL11.glColor3f(quadColor[1].x, quadColor[1].y, quadColor[1].z);
-      GL11.glVertex2f(WINDOW_WIDTH/2+triangleSize.x, WINDOW_HEIGHT/2-triangleSize.x);
-      GL11.glColor3f(quadColor[2].x, quadColor[2].y, quadColor[2].z);
-      GL11.glVertex2f(WINDOW_WIDTH/2+triangleSize.x, WINDOW_HEIGHT/2+triangleSize.x);
-      GL11.glColor3f(quadColor[3].x, quadColor[3].y, quadColor[3].z);
-      GL11.glVertex2f(WINDOW_WIDTH/2-triangleSize.x, WINDOW_HEIGHT/2+triangleSize.x);
+    glBegin(GL_QUADS); {
+      glColor3f(quadColors[0].x, quadColors[0].y, quadColors[0].z);
+      glVertex2f(WINDOW_WIDTH/2-triangleSize.x, WINDOW_HEIGHT/2-triangleSize.x);
+      glColor3f(quadColors[1].x, quadColors[1].y, quadColors[1].z);
+      glVertex2f(WINDOW_WIDTH/2+triangleSize.x, WINDOW_HEIGHT/2-triangleSize.x);
+      glColor3f(quadColors[2].x, quadColors[2].y, quadColors[2].z);
+      glVertex2f(WINDOW_WIDTH/2+triangleSize.x, WINDOW_HEIGHT/2+triangleSize.x);
+      glColor3f(quadColors[3].x, quadColors[3].y, quadColors[3].z);
+      glVertex2f(WINDOW_WIDTH/2-triangleSize.x, WINDOW_HEIGHT/2+triangleSize.x);
     }
-    GL11.glEnd();  
+    glEnd();
   }
 
   /**
diff --git a/src/java/org/lwjgl/test/input/TestControllers.java b/src/java/org/lwjgl/test/input/TestControllers.java
index 5c7e083..50d9e34 100644
--- a/src/java/org/lwjgl/test/input/TestControllers.java
+++ b/src/java/org/lwjgl/test/input/TestControllers.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -45,27 +45,27 @@ import org.lwjgl.input.Controllers;
 
 /**
  * Oops. Forgot to document this one.
- * 
+ *
  * @author Kevin Glass
  */
 public class TestControllers extends JPanel {
-	public static int total = 0;
-	
+	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<controller.getButtonCount();i++) {
 			names[i] = new JTextField();
 			names[i].setEditable(false);
@@ -88,7 +88,7 @@ public class TestControllers extends JPanel {
 			values[i].setBounds(100,i*30,100,30);
 			add(values[i]);
 		}
-		
+
 		int i = itemCount - 2;
 		names[i] = new JTextField();
 		names[i].setEditable(false);
@@ -110,9 +110,9 @@ public class TestControllers extends JPanel {
 		values[i].setEditable(false);
 		values[i].setBounds(100,i*30,100,30);
 		add(values[i]);
-		
+
 		total++;
-		
+
 		setPreferredSize(new Dimension(200,30*itemCount));
 		JFrame frame = new JFrame(controller.getName());
 		frame.setContentPane(new JScrollPane(this));
@@ -128,7 +128,7 @@ public class TestControllers extends JPanel {
 		frame.setLocation(index*30,index*30);
 		frame.setVisible(true);
 	}
-	
+
 	public void updateDetails() {
 		for (int i=0;i<controller.getButtonCount();i++) {
 			values[i].setText(""+controller.isButtonPressed(i));
@@ -136,11 +136,11 @@ public class TestControllers extends JPanel {
 		for (int i=buttonCount;i<buttonCount+controller.getAxisCount();i++) {
 			values[i].setText(""+controller.getAxisValue(i-buttonCount));
 		}
-		
+
 		values[itemCount-2].setText(""+controller.getPovX());
 		values[itemCount-1].setText(""+controller.getPovY());
 	}
-	
+
 	public static void main(String[] argv) {
 		try {
 			Controllers.create();
@@ -148,27 +148,27 @@ public class TestControllers extends JPanel {
 			e.printStackTrace();
 			System.exit(0);
 		}
-		
+
 		int count = Controllers.getControllerCount();
 		System.out.println(count+" Controllers Found");
 		for (int i=0;i<count;i++) {
 			Controller controller = Controllers.getController(i);
 			System.out.println(controller.getName());
 		}
-		
+
 		if (count == 0) {
 			System.exit(0);
 		}
-		
+
 		TestControllers[] controllerWindows = new TestControllers[count];
 		for (int i=0;i<count;i++) {
 			controllerWindows[i] = new TestControllers(i);
 		}
-		
+
 		boolean running = true;
 		while (running) {
 			try { Thread.sleep(100); } catch (Exception e) {};
-			
+
 			Controllers.poll();
 
 			while (Controllers.next()) {
@@ -177,7 +177,7 @@ public class TestControllers extends JPanel {
 				System.out.println("\t"+Controllers.getEventSource()+":"+Controllers.getEventControlIndex()+":"+Controllers.isEventButton());
 				System.out.println("\t"+Controllers.isEventXAxis()+":"+Controllers.isEventYAxis());
 			}
-			
+
 			for (int i=0;i<count;i++) {
 				controllerWindows[i].updateDetails();
 			}
diff --git a/src/java/org/lwjgl/test/openal/BasicTest.java b/src/java/org/lwjgl/test/openal/BasicTest.java
index c0763f8..0cfefa0 100644
--- a/src/java/org/lwjgl/test/openal/BasicTest.java
+++ b/src/java/org/lwjgl/test/openal/BasicTest.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -44,20 +44,20 @@ import org.lwjgl.opengl.DisplayMode;
  * This is a basic test, which contains the most used stuff
  *
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 2983 $
- * $Id: BasicTest.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: BasicTest.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public abstract class BasicTest {
 
   /**
    * Creates an instance of PlayTest
    */
-  public BasicTest() {
+  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: ");
@@ -79,7 +79,7 @@ public abstract class BasicTest {
       AL.destroy();
     }
   }
-  
+
   /**
    * Creates a float buffer to hold specified float array
    * - strictly a utility method
@@ -91,16 +91,16 @@ public abstract class BasicTest {
     FloatBuffer temp = BufferUtils.createFloatBuffer(data.length).put(data);
     temp.flip();
     return temp;
-  }  
-  
+  }
+
   /**
    * Pauses the invoking thread for specified milliseconds
-   * 
+   *
    * @param time Milliseconds to sleep
    */
   protected void pause(long time) {
     try {
-      Thread.sleep(time); 
+      Thread.sleep(time);
     } catch (InterruptedException inte) {
     }
   }
@@ -115,7 +115,7 @@ public abstract class BasicTest {
     alExit();
     System.exit(-1);
   }
-  
+
   /**
    * Sets the display mode for fullscreen mode
    */
@@ -129,12 +129,12 @@ public abstract class BasicTest {
           "height=" + 480,
           "freq=" + 60,
           "bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel()
-         }); 
+         });
       return true;
     } catch (Exception e) {
       e.printStackTrace();
     }
 
     return false;
-  }  
+  }
 }
diff --git a/src/java/org/lwjgl/test/openal/EFX10Test.java b/src/java/org/lwjgl/test/openal/EFX10Test.java
index a0ce4a5..d8bb6d8 100644
--- a/src/java/org/lwjgl/test/openal/EFX10Test.java
+++ b/src/java/org/lwjgl/test/openal/EFX10Test.java
@@ -290,7 +290,7 @@ public final class EFX10Test {
         // Create a source and buffer audio data
         final int source = AL10.alGenSources();
         final int buffer = AL10.alGenBuffers();
-        WaveData waveFile = WaveData.create(WaveData.class.getClassLoader().getResourceAsStream("Footsteps.wav"));
+        WaveData waveFile = WaveData.create("Footsteps.wav");
         if (waveFile == null) {
             System.out.println("Failed to load Footsteps.wav! Skipping playback test.");
             AL.destroy();
diff --git a/src/java/org/lwjgl/test/openal/OpenALInfo.java b/src/java/org/lwjgl/test/openal/OpenALInfo.java
index 9a2ec72..d7982c5 100644
--- a/src/java/org/lwjgl/test/openal/OpenALInfo.java
+++ b/src/java/org/lwjgl/test/openal/OpenALInfo.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -74,20 +74,20 @@ public class OpenALInfo {
 		} 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");
@@ -98,10 +98,10 @@ public class OpenALInfo {
 	    } 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));
@@ -110,41 +110,41 @@ public class OpenALInfo {
     	ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MINOR_VERSION, (IntBuffer) version.position(1));
 	    checkForErrors();
 
-	    System.out.println("ALC version: " + (int)version.get(0) + "." + (int)version.get(1));
+	    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(int i=0; i<extensions.length; i++) {
-			if(extensions[i].trim().length() == 0) {
+		for ( String extension : extensions ) {
+			if ( extension.trim().length() == 0 ) {
 				continue;
 			}
-			System.out.println("    " + extensions[i]);
+			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(int i=0; i<extensions.length; i++) {
-			if(extensions[i].trim().length() == 0) {
+		for ( String extension : extensions ) {
+			if ( extension.trim().length() == 0 ) {
 				continue;
 			}
-			System.out.println("    " + extensions[i]);
+			System.out.println("    " + extension);
 		}
-	    checkForErrors();		
+	    checkForErrors();
 	}
-	
+
 	private void printEFXInfo() {
 		if(!EFXUtil.isEfxSupported()) {
 			System.out.println("EFX not available");
 			return;
 		}
-		
-		ALCdevice device = AL.getDevice();		
+
+		ALCdevice device = AL.getDevice();
         IntBuffer major = BufferUtils.createIntBuffer(1);
         IntBuffer minor = BufferUtils.createIntBuffer(1);
         IntBuffer sends = BufferUtils.createIntBuffer(1);
@@ -153,69 +153,62 @@ public class OpenALInfo {
         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", 		new Integer(EFX10.AL_FILTER_LOWPASS));
-        filters.put("High-pass", 		new Integer(EFX10.AL_FILTER_HIGHPASS));
-        filters.put("Band-pass", 		new Integer(EFX10.AL_FILTER_BANDPASS));
-
-        Set entries = filters.entrySet();
-        for(Iterator i = entries.iterator(); i.hasNext();) {
-        	Map.Entry entry = (Entry) i.next();
-        	int value = ((Integer)entry.getValue()).intValue();
-        	String key = (String) entry.getKey();
-        	if(EFXUtil.isFilterSupported(value)) {
-        		System.out.println("    " + key);
-        	}
-        }
-        
+        HashMap<String, Integer> filters = new HashMap<String, Integer>();
+        filters.put("Low-pass", EFX10.AL_FILTER_LOWPASS);
+        filters.put("High-pass", EFX10.AL_FILTER_HIGHPASS);
+        filters.put("Band-pass", EFX10.AL_FILTER_BANDPASS);
+
+        Set<Entry<String, Integer>> entries = filters.entrySet();
+		for ( final Entry<String, Integer> 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", 			new Integer(EFX10.AL_EFFECT_EAXREVERB));
-        effects.put("Reverb", 				new Integer(EFX10.AL_EFFECT_REVERB));
-        effects.put("Chorus", 				new Integer(EFX10.AL_EFFECT_CHORUS));
-        effects.put("Distortion", 			new Integer(EFX10.AL_EFFECT_DISTORTION));
-        effects.put("Echo", 				new Integer(EFX10.AL_EFFECT_ECHO));
-        effects.put("Flanger", 				new Integer(EFX10.AL_EFFECT_FLANGER));
-        effects.put("Frequency Shifter", 	new Integer(EFX10.AL_EFFECT_FREQUENCY_SHIFTER));
-        effects.put("Vocal Morpher", 		new Integer(EFX10.AL_EFFECT_VOCAL_MORPHER));
-        effects.put("Pitch Shifter", 		new Integer(EFX10.AL_EFFECT_PITCH_SHIFTER));
-        effects.put("Ring Modulator", 		new Integer(EFX10.AL_EFFECT_RING_MODULATOR));
-        effects.put("Autowah", 				new Integer(EFX10.AL_EFFECT_AUTOWAH));
-        effects.put("Compressor", 			new Integer(EFX10.AL_EFFECT_COMPRESSOR));
-        effects.put("Equalizer", 			new Integer(EFX10.AL_EFFECT_EQUALIZER));
+        HashMap<String, Integer> effects = new HashMap<String, Integer>();
+        effects.put("EAX Reverb", EFX10.AL_EFFECT_EAXREVERB);
+        effects.put("Reverb", EFX10.AL_EFFECT_REVERB);
+        effects.put("Chorus", EFX10.AL_EFFECT_CHORUS);
+        effects.put("Distortion", EFX10.AL_EFFECT_DISTORTION);
+        effects.put("Echo", EFX10.AL_EFFECT_ECHO);
+        effects.put("Flanger", EFX10.AL_EFFECT_FLANGER);
+        effects.put("Frequency Shifter", EFX10.AL_EFFECT_FREQUENCY_SHIFTER);
+        effects.put("Vocal Morpher", EFX10.AL_EFFECT_VOCAL_MORPHER);
+        effects.put("Pitch Shifter", EFX10.AL_EFFECT_PITCH_SHIFTER);
+        effects.put("Ring Modulator", EFX10.AL_EFFECT_RING_MODULATOR);
+        effects.put("Autowah", EFX10.AL_EFFECT_AUTOWAH);
+        effects.put("Compressor", EFX10.AL_EFFECT_COMPRESSOR);
+        effects.put("Equalizer", EFX10.AL_EFFECT_EQUALIZER);
 
         entries = effects.entrySet();
-        for(Iterator i = entries.iterator(); i.hasNext();) {
-        	Map.Entry entry = (Entry) i.next();
-        	int value = ((Integer)entry.getValue()).intValue();
-        	String key = (String) entry.getKey();
-        	if(EFXUtil.isEffectSupported(value)) {
-        		System.out.println("    " + key);
-        	}
-        }
+		for ( final Entry<String, Integer> 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(int i=0; i<devices.length; i++) {
-			System.out.println("    " + devices[i]);
+		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());
@@ -229,9 +222,9 @@ public class OpenALInfo {
 			if(error != AL10.AL_NO_ERROR) {
 				die("AL", AL10.alGetString(error));
 			}
-		}		
+		}
 	}
-	
+
 	/**
 	 * main entry point
 	 *
diff --git a/src/java/org/lwjgl/test/openal/PositionTest.java b/src/java/org/lwjgl/test/openal/PositionTest.java
index 29a89c4..8c6582e 100644
--- a/src/java/org/lwjgl/test/openal/PositionTest.java
+++ b/src/java/org/lwjgl/test/openal/PositionTest.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -39,20 +39,21 @@ import org.lwjgl.LWJGLUtil;
 import org.lwjgl.input.Keyboard;
 import org.lwjgl.input.Mouse;
 import org.lwjgl.openal.AL;
-import org.lwjgl.openal.AL10;
 import org.lwjgl.opengl.Display;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.util.glu.GLU;
 import org.lwjgl.util.WaveData;
 
+import static org.lwjgl.openal.AL10.*;
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.util.glu.GLU.*;
+
 /**
  * <br>
- * This test demonstrates OpenAL positioning Based on the example by Chad Armstrong 
+ * This test demonstrates OpenAL positioning Based on the example by Chad Armstrong
  * (http://www.edenwaith.com/products/pige/tutorials/openal.php)
- * 
+ *
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 2983 $
- * $Id: PositionTest.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: PositionTest.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public class PositionTest extends BasicTest {
 
@@ -75,10 +76,10 @@ public class PositionTest extends BasicTest {
   public static final int RIGHT = 2;
 
   /** Whether the demo is done */
-  private boolean finished = false;
-  
+  private boolean finished;
+
   /** Whether in pause mode */
-  private boolean pauseMode = false;
+  private boolean pauseMode;
 
   // OpenAL stuff
   // ===================================================
@@ -160,14 +161,14 @@ public class PositionTest extends BasicTest {
     // =====================================================
     LWJGLUtil.log("Setting up OpenGL");
 
-    GL11.glViewport(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
-    GL11.glMatrixMode(GL11.GL_PROJECTION);
-    GL11.glLoadIdentity();
-    GLU.gluPerspective(50.0f, (float) WINDOW_WIDTH / WINDOW_HEIGHT, 0.0f, 50.0f);
-    GL11.glMatrixMode(GL11.GL_MODELVIEW);
-    GL11.glLoadIdentity();
-    GL11.glTranslatef(0.0f, 0.0f, -6.6f);
-    GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+    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);
@@ -177,17 +178,17 @@ public class PositionTest extends BasicTest {
     // =====================================================
     LWJGLUtil.log("Setting up OpenAL");
 
-    AL10.alListener(AL10.AL_POSITION, listenerPosition);
-    AL10.alListener(AL10.AL_VELOCITY, listenerVelocity);
-    AL10.alListener(AL10.AL_ORIENTATION, listenerOrientation);
+    alListener(AL_POSITION, listenerPosition);
+    alListener(AL_VELOCITY, listenerVelocity);
+    alListener(AL_ORIENTATION, listenerOrientation);
 
     // creating buffers
     LWJGLUtil.log("Creating buffers");
-    AL10.alGenBuffers(soundBuffers);
+    alGenBuffers(soundBuffers);
     soundBuffers.rewind();
 
     // creating sources
-    AL10.alGenSources(soundSources);
+    alGenSources(soundSources);
     soundSources.rewind();
 
     // load sound files (left, center, right).wav
@@ -195,37 +196,37 @@ public class PositionTest extends BasicTest {
 
     LWJGLUtil.log("Loading left.wav");
     WaveData left = WaveData.create("left.wav");
-    AL10.alBufferData(soundBuffers.get(LEFT), left.format, left.data, left.samplerate);
-    AL10.alSourcef(soundSources.get(LEFT), AL10.AL_PITCH, 1.0f);
-    AL10.alSourcef(soundSources.get(LEFT), AL10.AL_GAIN, 1.0f);
-    AL10.alSource(soundSources.get(LEFT), AL10.AL_POSITION, leftPosition);
-    AL10.alSource(soundSources.get(LEFT), AL10.AL_VELOCITY, leftVelocity);
-    AL10.alSourcei(soundSources.get(LEFT), AL10.AL_BUFFER, soundBuffers.get(LEFT));
-    AL10.alSourcei(soundSources.get(LEFT), AL10.AL_LOOPING, AL10.AL_TRUE);
+    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");
-    AL10.alBufferData(soundBuffers.get(CENTER), center.format, center.data, center.samplerate);
-    AL10.alSourcef(soundSources.get(CENTER), AL10.AL_PITCH, 1.0f);
-    AL10.alSourcef(soundSources.get(CENTER), AL10.AL_GAIN, 1.0f);
-    AL10.alSource(soundSources.get(CENTER), AL10.AL_POSITION, centerPosition);
-    AL10.alSource(soundSources.get(CENTER), AL10.AL_VELOCITY, centerVelocity);
-    AL10.alSourcei(soundSources.get(CENTER), AL10.AL_BUFFER, soundBuffers.get(CENTER));
-    AL10.alSourcei(soundSources.get(CENTER), AL10.AL_LOOPING, AL10.AL_TRUE);
+    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");
-    AL10.alBufferData(soundBuffers.get(RIGHT), right.format, right.data, right.samplerate);
-    AL10.alSourcef(soundSources.get(RIGHT), AL10.AL_PITCH, 1.0f);
-    AL10.alSourcef(soundSources.get(RIGHT), AL10.AL_GAIN, 1.0f);
-    AL10.alSource(soundSources.get(RIGHT), AL10.AL_POSITION, rightPosition);
-    AL10.alSource(soundSources.get(RIGHT), AL10.AL_VELOCITY, rightVelocity);
-    AL10.alSourcei(soundSources.get(RIGHT), AL10.AL_BUFFER, soundBuffers.get(RIGHT));
-    AL10.alSourcei(soundSources.get(RIGHT), AL10.AL_LOOPING, AL10.AL_TRUE);
+    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);
   }
 
@@ -260,7 +261,7 @@ public class PositionTest extends BasicTest {
 
       // allow window to process internal messages
       Display.update();
-      
+
       // render and paint if !minimized and not dirty
       if(Display.isVisible()) {
         render();
@@ -268,10 +269,10 @@ public class PositionTest extends BasicTest {
         // 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) {
@@ -282,37 +283,37 @@ public class PositionTest extends BasicTest {
       }
     }
   }
-  
+
   /**
    * Starts playing the sounds at different times
    */
   private void startSounds() {
-    AL10.alSourcePlay(soundSources.get(LEFT));
+    alSourcePlay(soundSources.get(LEFT));
     pause(300);
-    AL10.alSourcePlay(soundSources.get(CENTER));
+    alSourcePlay(soundSources.get(CENTER));
     pause(500);
-    AL10.alSourcePlay(soundSources.get(RIGHT));    
+    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;
-      AL10.alSourcePause(soundSources);
+      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");
-    }    
+    }
   }
 
   /**
@@ -330,17 +331,17 @@ public class PositionTest extends BasicTest {
     // Test for play
     // ============================================
     if (Keyboard.isKeyDown(Keyboard.KEY_1)) {
-      AL10.alSourcePlay(soundSources.get(LEFT));
+      alSourcePlay(soundSources.get(LEFT));
       LWJGLUtil.log("Playing left.wav");
     }
 
     if (Keyboard.isKeyDown(Keyboard.KEY_2)) {
-      AL10.alSourcePlay(soundSources.get(CENTER));
+      alSourcePlay(soundSources.get(CENTER));
       LWJGLUtil.log("Playing center.wav");
     }
 
     if (Keyboard.isKeyDown(Keyboard.KEY_3)) {
-      AL10.alSourcePlay(soundSources.get(RIGHT));
+      alSourcePlay(soundSources.get(RIGHT));
       LWJGLUtil.log("Playing right.wav");
     }
     // --------------------------------------------
@@ -348,17 +349,17 @@ public class PositionTest extends BasicTest {
     // Test for stop
     // ============================================
     if (Keyboard.isKeyDown(Keyboard.KEY_4)) {
-      AL10.alSourceStop(soundSources.get(LEFT));
+      alSourceStop(soundSources.get(LEFT));
       LWJGLUtil.log("Stopped left.wav");
     }
 
     if (Keyboard.isKeyDown(Keyboard.KEY_5)) {
-      AL10.alSourceStop(soundSources.get(CENTER));
+      alSourceStop(soundSources.get(CENTER));
       LWJGLUtil.log("Stopped center.wav");
     }
 
     if (Keyboard.isKeyDown(Keyboard.KEY_6)) {
-      AL10.alSourceStop(soundSources.get(RIGHT));
+      alSourceStop(soundSources.get(RIGHT));
       LWJGLUtil.log("Stopped right.wav");
     }
     // --------------------------------------------
@@ -367,12 +368,12 @@ public class PositionTest extends BasicTest {
     // ============================================
     if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) {
       listenerPosition.put(0, listenerPosition.get(0) - 0.1f);
-      AL10.alListener(AL10.AL_POSITION, listenerPosition);
+      alListener(AL_POSITION, listenerPosition);
     }
 
     if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) {
       listenerPosition.put(0, listenerPosition.get(0) + 0.1f);
-      AL10.alListener(AL10.AL_POSITION, listenerPosition);
+      alListener(AL_POSITION, listenerPosition);
     }
 
     if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
@@ -381,7 +382,7 @@ public class PositionTest extends BasicTest {
       } else {
         listenerPosition.put(2, listenerPosition.get(2) - 0.1f);
       }
-      AL10.alListener(AL10.AL_POSITION, listenerPosition);
+      alListener(AL_POSITION, listenerPosition);
     }
 
     if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
@@ -390,10 +391,10 @@ public class PositionTest extends BasicTest {
       } else {
         listenerPosition.put(2, listenerPosition.get(2) + 0.1f);
       }
-      AL10.alListener(AL10.AL_POSITION, listenerPosition);
+      alListener(AL_POSITION, listenerPosition);
     }
     // --------------------------------------------
-    
+
     // Test for movement with Mouse
     // ============================================
     listenerPosition.put(0, listenerPosition.get(0) + (0.01f * Mouse.getDX()));
@@ -404,9 +405,9 @@ public class PositionTest extends BasicTest {
     if (Mouse.isButtonDown(1)) {
       listenerPosition.put(2, listenerPosition.get(2) + 0.1f);
     }
-    
-    AL10.alListener(AL10.AL_POSITION, listenerPosition);
-    
+
+    alListener(AL_POSITION, listenerPosition);
+
     // empty mouse buffer
     while(Mouse.next());
   }
@@ -415,48 +416,48 @@ public class PositionTest extends BasicTest {
    * Render the scene
    */
   private void render() {
-    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
-    GL11.glPushMatrix();
+    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+    glPushMatrix();
     {
-      GL11.glRotatef(20.0f, 1.0f, 1.0f, 0.0f);
+      glRotatef(20.0f, 1.0f, 1.0f, 0.0f);
 
       // left
-      GL11.glPushMatrix();
+      glPushMatrix();
       {
-        GL11.glTranslatef(leftPosition.get(0), leftPosition.get(1), leftPosition.get(2));
-        GL11.glColor3f(1.0f, 0.0f, 0.0f);
+        glTranslatef(leftPosition.get(0), leftPosition.get(1), leftPosition.get(2));
+        glColor3f(1.0f, 0.0f, 0.0f);
         glut.glutWireCube(0.5f);
       }
-      GL11.glPopMatrix();
+      glPopMatrix();
 
       // center
-      GL11.glPushMatrix();
+      glPushMatrix();
       {
-        GL11.glTranslatef(centerPosition.get(0), centerPosition.get(1), centerPosition.get(2));
-        GL11.glColor3f(0.0f, 0.0f, 1.0f);
+        glTranslatef(centerPosition.get(0), centerPosition.get(1), centerPosition.get(2));
+        glColor3f(0.0f, 0.0f, 1.0f);
         glut.glutWireCube(0.5f);
       }
-      GL11.glPopMatrix();
+      glPopMatrix();
 
       // right
-      GL11.glPushMatrix();
+      glPushMatrix();
       {
-        GL11.glTranslatef(rightPosition.get(0), rightPosition.get(1), rightPosition.get(2));
-        GL11.glColor3f(0.0f, 1.0f, 0.0f);
+        glTranslatef(rightPosition.get(0), rightPosition.get(1), rightPosition.get(2));
+        glColor3f(0.0f, 1.0f, 0.0f);
         glut.glutWireCube(0.5f);
       }
-      GL11.glPopMatrix();
+      glPopMatrix();
 
       // listener
-      GL11.glPushMatrix();
+      glPushMatrix();
       {
-        GL11.glTranslatef(listenerPosition.get(0), listenerPosition.get(1), listenerPosition.get(2));
-        GL11.glColor3f(1.0f, 1.0f, 1.0f);
+        glTranslatef(listenerPosition.get(0), listenerPosition.get(1), listenerPosition.get(2));
+        glColor3f(1.0f, 1.0f, 1.0f);
         glut.glutSolidCube(0.5f);
       }
-      GL11.glPopMatrix();
+      glPopMatrix();
     }
-    GL11.glPopMatrix();
+    glPopMatrix();
   }
 
   /**
@@ -464,9 +465,9 @@ public class PositionTest extends BasicTest {
    */
   private void shutdown() {
     LWJGLUtil.log("Shutting down OpenAL");
-    AL10.alSourceStop(soundSources);
-    AL10.alDeleteSources(soundSources);
-    AL10.alDeleteBuffers(soundBuffers);
+    alSourceStop(soundSources);
+    alDeleteSources(soundSources);
+    alDeleteBuffers(soundBuffers);
     AL.destroy();
 
     LWJGLUtil.log("Shutting down Window");
@@ -475,7 +476,7 @@ public class PositionTest extends BasicTest {
 
   /**
    * main entry point
-   * 
+   *
    * @param args
    *          String array containing arguments
    */
@@ -487,7 +488,7 @@ public class PositionTest extends BasicTest {
 
   /**
    * Minute implementation of GLUT: <br>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
@@ -496,7 +497,7 @@ public class PositionTest extends BasicTest {
    * 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.
@@ -521,11 +522,11 @@ public class PositionTest extends BasicTest {
     float v[][] = new float[8][3];
 
     public void glutWireCube(float size) {
-      drawBox(size, GL11.GL_LINE_LOOP);
+      drawBox(size, GL_LINE_LOOP);
     }
 
     public void glutSolidCube(float size) {
-      drawBox(size, GL11.GL_QUADS);
+      drawBox(size, GL_QUADS);
     }
 
     private void drawBox(float size, int type) {
@@ -538,13 +539,13 @@ public class PositionTest extends BasicTest {
       v[1][2] = v[2][2] = v[5][2] = v[6][2] = size / 2;
 
       for (int i = 5; i >= 0; i--) {
-        GL11.glBegin(type);
-        GL11.glNormal3f(n[i][0], n[i][1], n[i][2]);
-        GL11.glVertex3f(v[faces[i][0]][0], v[faces[i][0]][1], v[faces[i][0]][2]);
-        GL11.glVertex3f(v[faces[i][1]][0], v[faces[i][1]][1], v[faces[i][1]][2]);
-        GL11.glVertex3f(v[faces[i][2]][0], v[faces[i][2]][1], v[faces[i][2]][2]);
-        GL11.glVertex3f(v[faces[i][3]][0], v[faces[i][3]][1], v[faces[i][3]][2]);
-        GL11.glEnd();
+        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();
       }
 
     }
diff --git a/src/java/org/lwjgl/test/opencl/HelloOpenCL.java b/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
new file mode 100644
index 0000000..756dba5
--- /dev/null
+++ b/src/java/org/lwjgl/test/opencl/HelloOpenCL.java
@@ -0,0 +1,198 @@
+/*
+ * 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;
+
+import org.lwjgl.BufferUtils;
+import org.lwjgl.LWJGLException;
+import org.lwjgl.LWJGLUtil;
+import org.lwjgl.PointerBuffer;
+import org.lwjgl.opencl.*;
+import org.lwjgl.opencl.api.CLBufferRegion;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+
+import static org.lwjgl.opencl.CL10.*;
+import static org.lwjgl.opencl.CL11.*;
+
+/** Basic OpenCL test. */
+public class HelloOpenCL {
+
+	public HelloOpenCL() {
+	}
+
+	protected static void execute() {
+		try {
+			CL.create();
+
+			final List<CLPlatform> 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<CLDevice> 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();
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java b/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java
new file mode 100644
index 0000000..dc180f4
--- /dev/null
+++ b/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java
@@ -0,0 +1,897 @@
+/*
+ * 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.<br/>
+ * http://en.wikipedia.org/wiki/Mandelbrot_set
+ * <p>
+ * controls:<br/>
+ * keys 1-9 control parallelism level<br/>
+ * space enables/disables slice seperator<br/>
+ * 'd' toggles between 32/64bit floatingpoint precision<br/>
+ * mouse/mousewheel to drag and zoom<br/>
+ * 'Home' to reset the viewport<br/>
+ * </p>
+ *
+ * @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<String> 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<String>();
+
+		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<CLPlatform> 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<CLDevice> glSharingFilter = new Filter<CLDevice>() {
+			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<CLDevice> 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 <count> to change)");
+		System.out.println("Display resolution: " + width + "x" + height + " (Use -res <width> <height> 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);
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl b/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl
new file mode 100644
index 0000000..a1e9728
--- /dev/null
+++ b/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl
@@ -0,0 +1,81 @@
+#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;
+    }
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java b/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java
index 22892f0..124762b 100644
--- a/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java
+++ b/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -36,17 +36,18 @@ import org.lwjgl.input.Keyboard;
 import org.lwjgl.input.Mouse;
 import org.lwjgl.opengl.Display;
 import org.lwjgl.opengl.DisplayMode;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.util.glu.GLU;
 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 <brian at matzon.dk>
- * @version $Revision: 3365 $
- * $Id: FullScreenWindowedTest.java 3365 2010-07-04 18:24:53Z spasi $
+ * @version $Revision: 3418 $
+ * $Id: FullScreenWindowedTest.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public class FullScreenWindowedTest {
 	/** Intended deiplay mode */
@@ -145,23 +146,23 @@ public class FullScreenWindowedTest {
 	}
 	private void render() {
 		//clear background
-		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
+		glClear(GL_COLOR_BUFFER_BIT);
 		// draw white quad
-		GL11.glPushMatrix();
+		glPushMatrix();
 		{
-			GL11.glTranslatef(quadPosition.x, quadPosition.y, 0);
-			GL11.glRotatef(angle, 0.0f, 0.0f, 1.0f);
-			GL11.glColor3f(1.0f, 1.0f, 1.0f);
-			GL11.glBegin(GL11.GL_QUADS);
+			glTranslatef(quadPosition.x, quadPosition.y, 0);
+			glRotatef(angle, 0.0f, 0.0f, 1.0f);
+			glColor3f(1.0f, 1.0f, 1.0f);
+			glBegin(GL_QUADS);
 			{
-				GL11.glVertex2i(-50, -50);
-				GL11.glVertex2i(50, -50);
-				GL11.glVertex2i(50, 50);
-				GL11.glVertex2i(-50, 50);
+				glVertex2i(-50, -50);
+				glVertex2i(50, -50);
+				glVertex2i(50, 50);
+				glVertex2i(-50, 50);
 			}
-			GL11.glEnd();
+			glEnd();
 		}
-		GL11.glPopMatrix();
+		glPopMatrix();
 	}
 	/**
 	 * Processes keyboard input
@@ -235,7 +236,7 @@ public class FullScreenWindowedTest {
 
 	/**
 	 * Retrieves a displaymode, if one such is available
-	 * 
+	 *
 	 * @param width
 	 *            Required width
 	 * @param height
@@ -246,9 +247,9 @@ public class FullScreenWindowedTest {
 	 */
 	private DisplayMode findDisplayMode(int width, int height, int bpp) throws LWJGLException {
 		DisplayMode[] modes = Display.getAvailableDisplayModes();
-		for (int i = 0; i < modes.length; i++) {
-			if (modes[i].getWidth() == width && modes[i].getHeight() == height && modes[i].getBitsPerPixel() >= bpp && modes[i].getFrequency() <= 60) {
-				return modes[i];
+		for ( DisplayMode mode : modes ) {
+			if ( mode.getWidth() == width && mode.getHeight() == height && mode.getBitsPerPixel() >= bpp && mode.getFrequency() <= 60 ) {
+				return mode;
 			}
 		}
 		return Display.getDesktopDisplayMode();
@@ -258,14 +259,14 @@ public class FullScreenWindowedTest {
 	 */
 	private void glInit() {
 		// Go into orthographic projection mode.
-		GL11.glMatrixMode(GL11.GL_PROJECTION);
-		GL11.glLoadIdentity();
-		GLU.gluOrtho2D(0, mode.getWidth(), 0, mode.getHeight());
-		GL11.glMatrixMode(GL11.GL_MODELVIEW);
-		GL11.glLoadIdentity();
-		GL11.glViewport(0, 0, mode.getWidth(), mode.getHeight());
+		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
-		GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+		glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
 		//sync frame (only works on windows)
 		Display.setVSyncEnabled(true);
 	}
diff --git a/src/java/org/lwjgl/test/opengl/Gears.java b/src/java/org/lwjgl/test/opengl/Gears.java
index 0fd2269..48eaf31 100644
--- a/src/java/org/lwjgl/test/opengl/Gears.java
+++ b/src/java/org/lwjgl/test/opengl/Gears.java
@@ -39,19 +39,22 @@ import java.nio.FloatBuffer;
 
 import org.lwjgl.BufferUtils;
 import org.lwjgl.LWJGLException;
-import org.lwjgl.opengl.ARBTransposeMatrix;
+import org.lwjgl.LWJGLUtil;
+import org.lwjgl.Sys;
 import org.lwjgl.opengl.Display;
 import org.lwjgl.opengl.DisplayMode;
-import org.lwjgl.opengl.GL11;
 import org.lwjgl.opengl.GLContext;
 
+import static org.lwjgl.opengl.ARBTransposeMatrix.*;
+import static org.lwjgl.opengl.GL11.*;
+
 /**
  * <p>
  * This is the OpenGL "standard" Gears demo, originally by Brian Paul
  * </p>
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 3276 $
- * $Id: Gears.java 3276 2010-02-21 21:18:17Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: Gears.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public class Gears {
 
@@ -59,7 +62,7 @@ public class Gears {
 
 	private float	view_roty	= 30.0f;
 
-	private float	view_rotz	= 0.0f;
+	private float	view_rotz;
 
 	private int		gear1;
 
@@ -67,7 +70,7 @@ public class Gears {
 
 	private int		gear3;
 
-	private float	angle			= 0.0f;
+	private float	angle;
 
 	public static void main(String[] args) {
 		new Gears().execute();
@@ -75,7 +78,7 @@ public class Gears {
 	}
 
 	/**
-	 * 
+	 *
 	 */
 	private void execute() {
 		try {
@@ -92,14 +95,14 @@ public class Gears {
 	}
 
 	/**
-	 * 
+	 *
 	 */
 	private void destroy() {
 		Display.destroy();
 	}
 
 	/**
-	 * 
+	 *
 	 */
 	private void loop() {
 		long startTime = System.currentTimeMillis() + 5000;
@@ -108,32 +111,32 @@ public class Gears {
 		while (!Display.isCloseRequested()) {
 			angle += 2.0f;
 
-			GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
+			glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
-			GL11.glPushMatrix();
-			GL11.glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
-			GL11.glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
-			GL11.glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);
+			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);
 
-			GL11.glPushMatrix();
-			GL11.glTranslatef(-3.0f, -2.0f, 0.0f);
-			GL11.glRotatef(angle, 0.0f, 0.0f, 1.0f);
-			GL11.glCallList(gear1);
-			GL11.glPopMatrix();
+			glPushMatrix();
+			glTranslatef(-3.0f, -2.0f, 0.0f);
+			glRotatef(angle, 0.0f, 0.0f, 1.0f);
+			glCallList(gear1);
+			glPopMatrix();
 
-			GL11.glPushMatrix();
-			GL11.glTranslatef(3.1f, -2.0f, 0.0f);
-			GL11.glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f);
-			GL11.glCallList(gear2);
-			GL11.glPopMatrix();
+			glPushMatrix();
+			glTranslatef(3.1f, -2.0f, 0.0f);
+			glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f);
+			glCallList(gear2);
+			glPopMatrix();
 
-			GL11.glPushMatrix();
-			GL11.glTranslatef(-3.1f, 4.2f, 0.0f);
-			GL11.glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f);
-			GL11.glCallList(gear3);
-			GL11.glPopMatrix();
+			glPushMatrix();
+			glTranslatef(-3.1f, 4.2f, 0.0f);
+			glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f);
+			glCallList(gear3);
+			glPopMatrix();
 
-			GL11.glPopMatrix();
+			glPopMatrix();
 
 			Display.update();
 			if (startTime > System.currentTimeMillis()) {
@@ -141,7 +144,7 @@ public class Gears {
 			} else {
 				long timeUsed = 5000 + (startTime - System.currentTimeMillis());
 				startTime = System.currentTimeMillis() + 5000;
-				System.out.println(fps + " frames in " + (float) (timeUsed / 1000f) + " seconds = "
+				System.out.println(fps + " frames in " + timeUsed / 1000f + " seconds = "
 						+ (fps / (timeUsed / 1000f)));
 				fps = 0;
 			}
@@ -149,7 +152,7 @@ public class Gears {
 	}
 
 	/**
-	 * 
+	 *
 	 */
 	private void init() throws LWJGLException {
 		// create Window of size 300x300
@@ -164,63 +167,64 @@ public class Gears {
 		FloatBuffer red = BufferUtils.createFloatBuffer(4).put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f});
 		FloatBuffer green = BufferUtils.createFloatBuffer(4).put(new float[] { 0.0f, 0.8f, 0.2f, 1.0f});
 		FloatBuffer blue = BufferUtils.createFloatBuffer(4).put(new float[] { 0.2f, 0.2f, 1.0f, 1.0f});
-		
+
 		pos.flip();
 		red.flip();
 		green.flip();
 		blue.flip();
 
-		GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, pos);
-		GL11.glEnable(GL11.GL_CULL_FACE);
-		GL11.glEnable(GL11.GL_LIGHTING);
-		GL11.glEnable(GL11.GL_LIGHT0);
-		GL11.glEnable(GL11.GL_DEPTH_TEST);
+		glLight(GL_LIGHT0, GL_POSITION, pos);
+		glEnable(GL_CULL_FACE);
+		glEnable(GL_LIGHTING);
+		glEnable(GL_LIGHT0);
+		glEnable(GL_DEPTH_TEST);
 
 		/* make the gears */
-		gear1 = GL11.glGenLists(1);
-		GL11.glNewList(gear1, GL11.GL_COMPILE);
-		GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, red);
+		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);
-		GL11.glEndList();
+		glEndList();
 
-		gear2 = GL11.glGenLists(1);
-		GL11.glNewList(gear2, GL11.GL_COMPILE);
-		GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, green);
+		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);
-		GL11.glEndList();
+		glEndList();
 
-		gear3 = GL11.glGenLists(1);
-		GL11.glNewList(gear3, GL11.GL_COMPILE);
-		GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, blue);
+		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);
-		GL11.glEndList();
+		glEndList();
 
-		GL11.glEnable(GL11.GL_NORMALIZE);
+		glEnable(GL_NORMALIZE);
 
-		GL11.glMatrixMode(GL11.GL_PROJECTION);
+		glMatrixMode(GL_PROJECTION);
 
-		System.err.println("GL_VENDOR: " + GL11.glGetString(GL11.GL_VENDOR));
-		System.err.println("GL_RENDERER: " + GL11.glGetString(GL11.GL_RENDERER));
-		System.err.println("GL_VERSION: " + GL11.glGetString(GL11.GL_VERSION));
+		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
-			GL11.glLoadIdentity();
+			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();
-			ARBTransposeMatrix.glLoadTransposeMatrixARB(identityTranspose);
+			glLoadTransposeMatrixARB(identityTranspose);
 		}
 
 		float h = (float) 300 / (float) 300;
-		GL11.glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
-		GL11.glMatrixMode(GL11.GL_MODELVIEW);
-		GL11.glLoadIdentity();
-		GL11.glTranslatef(0.0f, 0.0f, -40.0f);
+		glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
+		glMatrixMode(GL_MODELVIEW);
+		glLoadIdentity();
+		glTranslatef(0.0f, 0.0f, -40.0f);
 	}
 
 	/**
@@ -245,95 +249,95 @@ public class Gears {
 
 		da = 2.0f * (float) Math.PI / teeth / 4.0f;
 
-		GL11.glShadeModel(GL11.GL_FLAT);
+		glShadeModel(GL_FLAT);
 
-		GL11.glNormal3f(0.0f, 0.0f, 1.0f);
+		glNormal3f(0.0f, 0.0f, 1.0f);
 
 		/* draw front face */
-		GL11.glBegin(GL11.GL_QUAD_STRIP);
+		glBegin(GL_QUAD_STRIP);
 		for (i = 0; i <= teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
-			GL11.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), r1 * (float) Math.sin(angle), width * 0.5f);
 			if (i < teeth) {
-				GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
-				GL11.glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da),
+				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);
 			}
 		}
-		GL11.glEnd();
+		glEnd();
 
 		/* draw front sides of teeth */
-		GL11.glBegin(GL11.GL_QUADS);
+		glBegin(GL_QUADS);
 		for (i = 0; i < teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + 2.0f * da), r2 * (float) Math.sin(angle + 2.0f * da), width * 0.5f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f);
+			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);
 		}
-		GL11.glEnd();
+		glEnd();
 
 		/* draw back face */
-		GL11.glBegin(GL11.GL_QUAD_STRIP);
+		glBegin(GL_QUAD_STRIP);
 		for (i = 0; i <= teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
-			GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
-			GL11.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);
+			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);
 		}
-		GL11.glEnd();
+		glEnd();
 
 		/* draw back sides of teeth */
-		GL11.glBegin(GL11.GL_QUADS);
+		glBegin(GL_QUADS);
 		for (i = 0; i < teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (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(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);
 		}
-		GL11.glEnd();
+		glEnd();
 
 		/* draw outward faces of teeth */
-		GL11.glBegin(GL11.GL_QUAD_STRIP);
+		glBegin(GL_QUAD_STRIP);
 		for (i = 0; i < teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
-			GL11.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);
+			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;
-			GL11.glNormal3f(v, -u, 0.0f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
-			GL11.glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
+			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);
-			GL11.glNormal3f(v, -u, 0.0f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), width * 0.5f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
-			GL11.glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
+			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);
 		}
-		GL11.glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), width * 0.5f);
-		GL11.glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), -width * 0.5f);
-		GL11.glEnd();
+		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();
 
-		GL11.glShadeModel(GL11.GL_SMOOTH);
+		glShadeModel(GL_SMOOTH);
 
 		/* draw inside radius cylinder */
-		GL11.glBegin(GL11.GL_QUAD_STRIP);
+		glBegin(GL_QUAD_STRIP);
 		for (i = 0; i <= teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glNormal3f(-(float) Math.cos(angle), -(float) Math.sin(angle), 0.0f);
-			GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
-			GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
+			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);
 		}
-		GL11.glEnd();
+		glEnd();
 	}
 }
diff --git a/src/java/org/lwjgl/test/opengl/PbufferTest.java b/src/java/org/lwjgl/test/opengl/PbufferTest.java
index 379b7fd..f77c4f3 100644
--- a/src/java/org/lwjgl/test/opengl/PbufferTest.java
+++ b/src/java/org/lwjgl/test/opengl/PbufferTest.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -39,19 +39,20 @@ 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 org.lwjgl.opengl.Pbuffer;
 import org.lwjgl.opengl.PixelFormat;
-import org.lwjgl.util.glu.GLU;
 import org.lwjgl.util.vector.Vector2f;
 
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.util.glu.GLU.*;
+
 /**
  *
  * Tests Pbuffers
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 2983 $
- * $Id: PbufferTest.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: PbufferTest.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public class PbufferTest {
 
@@ -189,25 +190,25 @@ public class PbufferTest {
 	}
     // Pbuffer rendering
     //clear background
-    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
+    glClear(GL_COLOR_BUFFER_BIT);
 
     // draw white quad
-    GL11.glPushMatrix();
+    glPushMatrix();
     {
-      GL11.glTranslatef(quadPosition.x, quadPosition.y, 0);
-      GL11.glRotatef(angle, 0.0f, 0.0f, 1.0f);
-      GL11.glColor3f(1.0f, 1.0f, 1.0f);
-      GL11.glBegin(GL11.GL_QUADS);
+      glTranslatef(quadPosition.x, quadPosition.y, 0);
+      glRotatef(angle, 0.0f, 0.0f, 1.0f);
+      glColor3f(1.0f, 1.0f, 1.0f);
+      glBegin(GL_QUADS);
       {
-        GL11.glVertex2i(-50, -50);
-        GL11.glVertex2i(50, -50);
-        GL11.glVertex2i(50, 50);
-        GL11.glVertex2i(-50, 50);
+        glVertex2i(-50, -50);
+        glVertex2i(50, -50);
+        glVertex2i(50, 50);
+        glVertex2i(-50, 50);
       }
-      GL11.glEnd();
+      glEnd();
     }
-    GL11.glPopMatrix();
-    GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, 0, 0, 512, 512, 0);
+    glPopMatrix();
+    glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 512, 512, 0);
 	try {
 		Display.makeCurrent();
 	} catch (LWJGLException e) {
@@ -215,34 +216,34 @@ public class PbufferTest {
 	}
 
     // OpenGL window rendering
-    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
+    glClear(GL_COLOR_BUFFER_BIT);
     // draw white quad
-    GL11.glPushMatrix();
+    glPushMatrix();
     {
-      GL11.glTranslatef(quadPosition.x, quadPosition.y, 0);
-      GL11.glRotatef(angle, 0.0f, 0.0f, 1.0f);
-      GL11.glColor3f(1.0f, 1.0f, 0.0f);
-      GL11.glBegin(GL11.GL_QUADS);
+      glTranslatef(quadPosition.x, quadPosition.y, 0);
+      glRotatef(angle, 0.0f, 0.0f, 1.0f);
+      glColor3f(1.0f, 1.0f, 0.0f);
+      glBegin(GL_QUADS);
       {
-        GL11.glTexCoord2f(0f, 0f);
-        GL11.glVertex2i(-50, -50);
-        GL11.glTexCoord2f(1f, 0f);
-        GL11.glVertex2i(50, -50);
-        GL11.glTexCoord2f(1f, 1f);
-        GL11.glVertex2i(50, 50);
-        GL11.glTexCoord2f(0f, 1f);
-        GL11.glVertex2i(-50, 50);
+        glTexCoord2f(0f, 0f);
+        glVertex2i(-50, -50);
+        glTexCoord2f(1f, 0f);
+        glVertex2i(50, -50);
+        glTexCoord2f(1f, 1f);
+        glVertex2i(50, 50);
+        glTexCoord2f(0f, 1f);
+        glVertex2i(-50, 50);
       }
-      GL11.glEnd();
+      glEnd();
     }
-    GL11.glPopMatrix();
+    glPopMatrix();
   }
 
   private void initPbuffer() {
       try {
           pbuffer.makeCurrent();
           initGLState(256, 256, 0.5f);
-          GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex_handle);
+          glBindTexture(GL_TEXTURE_2D, tex_handle);
           Display.makeCurrent();
       } catch (Exception e) {
           e.printStackTrace();
@@ -321,7 +322,7 @@ public class PbufferTest {
   private void destroyTexture() {
     IntBuffer buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
     buffer.put(0, tex_handle);
-    GL11.glDeleteTextures(buffer);
+    glDeleteTextures(buffer);
   }
 
   /**
@@ -343,26 +344,23 @@ public class PbufferTest {
    */
   private DisplayMode findDisplayMode(int width, int height, int bpp) throws LWJGLException {
     DisplayMode[] modes = Display.getAvailableDisplayModes();
-    for (int i = 0; i < modes.length; i++) {
-      if (modes[i].getWidth() == width
-        && modes[i].getHeight() == height
-        && modes[i].getBitsPerPixel() >= bpp) {
-        return modes[i];
-      }
-    }
+	  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) {
-    GL11.glMatrixMode(GL11.GL_PROJECTION);
-    GL11.glLoadIdentity();
-    GLU.gluOrtho2D(0, mode.getWidth(), 0, mode.getHeight());
-    GL11.glMatrixMode(GL11.GL_MODELVIEW);
-    GL11.glLoadIdentity();
-    GL11.glViewport(0, 0, width, height);
+    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
-    GL11.glClearColor(color, color, color, 0.0f);
+    glClearColor(color, color, color, 0.0f);
   }
 
   /**
@@ -371,18 +369,18 @@ public class PbufferTest {
   private void glInit() {
     //sync frame (only works on windows)
     Display.setVSyncEnabled(true);
-    
-    GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_REPLACE);
-    GL11.glEnable(GL11.GL_TEXTURE_2D);
+
+    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();
-    GL11.glGenTextures(buffer);
+    glGenTextures(buffer);
     tex_handle = buffer.get(0);
-    GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex_handle);
-    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
-    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
-    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
-    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
+    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);
   }
 
diff --git a/src/java/org/lwjgl/test/opengl/SyncTest.java b/src/java/org/lwjgl/test/opengl/SyncTest.java
index 706bc36..c899d25 100644
--- a/src/java/org/lwjgl/test/opengl/SyncTest.java
+++ b/src/java/org/lwjgl/test/opengl/SyncTest.java
@@ -37,6 +37,9 @@ import org.lwjgl.opengl.*;
 
 import java.util.Random;
 
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.opengl.GL32.*;
+
 /** @author spasi <spasi at users.sourceforge.net> */
 public final class SyncTest {
 
@@ -85,7 +88,7 @@ public final class SyncTest {
 
 		System.out.println("\n---------\n");
 
-		final String version = GL11.glGetString(GL11.GL_VERSION);
+		final String version = glGetString(GL_VERSION);
 
 		System.out.println("GL Version: " + version);
 		System.out.println("ARB_sync: " + GLContext.getCapabilities().GL_ARB_sync);
@@ -99,39 +102,39 @@ public final class SyncTest {
 
 		Random rand = new Random(System.currentTimeMillis());
 		for ( int i = 0; i < clears; i++ ) {
-			GL11.glClearColor(rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), 1.0f);
-			GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
+			glClearColor(rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), 1.0f);
+			glClear(GL_COLOR_BUFFER_BIT);
 		}
 
-		GLSync sync = GL32.glFenceSync(GL32.GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+		GLSync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
 
 		System.out.println("\nWaiting on fence...");
 		long time = Sys.getTime();
-		int status = GL32.glClientWaitSync(sync, 0, timeout < 0 ? GL32.GL_TIMEOUT_IGNORED : timeout * 1000 * 1000);
+		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 GL32.GL_ALREADY_SIGNALED:
+			case GL_ALREADY_SIGNALED:
 				System.out.println("ALREADY_SIGNALED");
 				break;
-			case GL32.GL_CONDITION_SATISFIED:
+			case GL_CONDITION_SATISFIED:
 				System.out.println("CONDITION_SATISFIED");
 				break;
-			case GL32.GL_TIMEOUT_EXPIRED:
+			case GL_TIMEOUT_EXPIRED:
 				System.out.println("TIMEOUT_EXPIRED");
 				break;
-			case GL32.GL_WAIT_FAILED:
+			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: " + (GL32.glGetSync(sync, GL32.GL_SYNC_STATUS) == GL32.GL_UNSIGNALED ? "UNSIGNALED" : "SIGNALED"));
+		System.out.println("Sync Status: " + (glGetSync(sync, GL_SYNC_STATUS) == GL_UNSIGNALED ? "UNSIGNALED" : "SIGNALED"));
 
-		GL32.glDeleteSync(sync);
+		glDeleteSync(sync);
 
-		int error = GL11.glGetError();
+		int error = glGetError();
 		if ( error != 0 )
 			System.out.println("\nTest failed with OpenGL error: " + error);
 		else
@@ -141,8 +144,7 @@ public final class SyncTest {
 	private static DisplayMode chooseMode(DisplayMode[] modes, int width, int height) {
 		DisplayMode bestMode = null;
 
-		for ( int i = 0; i < modes.length; i++ ) {
-			DisplayMode mode = modes[i];
+		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;
diff --git a/src/java/org/lwjgl/test/opengl/VBOIndexTest.java b/src/java/org/lwjgl/test/opengl/VBOIndexTest.java
index 841e832..a699f77 100644
--- a/src/java/org/lwjgl/test/opengl/VBOIndexTest.java
+++ b/src/java/org/lwjgl/test/opengl/VBOIndexTest.java
@@ -31,12 +31,12 @@
  */
 
 /**
- * $Id: VBOIndexTest.java 3344 2010-05-22 16:53:49Z spasi $
+ * $Id: VBOIndexTest.java 3418 2010-09-28 21:11:35Z spasi $
  *
  * Simple java test program.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3344 $
+ * @version $Revision: 3418 $
  */
 
 package org.lwjgl.test.opengl;
@@ -49,13 +49,14 @@ import java.nio.IntBuffer;
 import org.lwjgl.Sys;
 import org.lwjgl.input.Keyboard;
 import org.lwjgl.input.Mouse;
-import org.lwjgl.opengl.ARBBufferObject;
-import org.lwjgl.opengl.ARBVertexBufferObject;
 import org.lwjgl.opengl.Display;
 import org.lwjgl.opengl.DisplayMode;
-import org.lwjgl.opengl.GL11;
 import org.lwjgl.opengl.GLContext;
-import org.lwjgl.util.glu.GLU;
+
+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 {
 
@@ -105,11 +106,11 @@ public final class VBOIndexTest {
 	private static int buffer_id;
 	private static int indices_buffer_id;
 	private static FloatBuffer vertices;
-	private static ByteBuffer mapped_buffer = null;
-	private static FloatBuffer mapped_float_buffer = null;
+	private static ByteBuffer mapped_buffer;
+	private static FloatBuffer mapped_float_buffer;
 	private static IntBuffer indices;
-	private static ByteBuffer mapped_indices_buffer = null;
-	private static IntBuffer mapped_indices_int_buffer = null;
+	private static ByteBuffer mapped_indices_buffer;
+	private static IntBuffer mapped_indices_int_buffer;
 
 	public static void main(String[] arguments) {
 		try {
@@ -161,21 +162,21 @@ public final class VBOIndexTest {
 	 * All rendering is done in here
 	 */
 	private static void render() {
-		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
-		GL11.glPushMatrix();
-		GL11.glTranslatef(Display.getDisplayMode().getWidth() / 2, Display.getDisplayMode().getHeight() / 2, 0.0f);
-		GL11.glRotatef(angle, 0, 0, 1.0f);
+		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 = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB,
-		                                                              ARBBufferObject.GL_WRITE_ONLY_ARB,
+		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 = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB,
-		                                                   ARBBufferObject.GL_WRITE_ONLY_ARB,
+		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();
@@ -188,11 +189,11 @@ public final class VBOIndexTest {
 		mapped_indices_int_buffer.rewind();
 		indices.rewind();
 		mapped_indices_int_buffer.put(indices);
-		if ( ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB) &&
-		     ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB) ) {
-			GL11.glDrawElements(GL11.GL_QUADS, 4, GL11.GL_UNSIGNED_INT, 0);
+		if ( glUnmapBufferARB(GL_ARRAY_BUFFER_ARB) &&
+		     glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB) ) {
+			glDrawElements(GL_QUADS, 4, GL_UNSIGNED_INT, 0);
 		}
-		GL11.glPopMatrix();
+		glPopMatrix();
 	}
 
 	/**
@@ -202,32 +203,32 @@ public final class VBOIndexTest {
 
 		System.out.println("Timer resolution: " + Sys.getTimerResolution());
 		// Go into orthographic projection mode.
-		GL11.glMatrixMode(GL11.GL_PROJECTION);
-		GL11.glLoadIdentity();
-		GLU.gluOrtho2D(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight());
-		GL11.glMatrixMode(GL11.GL_MODELVIEW);
-		GL11.glLoadIdentity();
-		GL11.glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
+		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();
-		ARBBufferObject.glGenBuffersARB(int_buffer);
+		glGenBuffersARB(int_buffer);
 		buffer_id = int_buffer.get(0);
 		indices_buffer_id = int_buffer.get(1);
-		ARBBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, buffer_id);
-		ARBBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, indices_buffer_id);
+		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();
-		ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 2 * 4 * 4, ARBBufferObject.GL_STREAM_DRAW_ARB);
-		ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 4 * 4, ARBBufferObject.GL_STREAM_DRAW_ARB);
-		GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
-		GL11.glVertexPointer(2, GL11.GL_FLOAT, 0, 0);
+		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);
 	}
 
 	/**
@@ -237,7 +238,7 @@ public final class VBOIndexTest {
 		IntBuffer int_buffer = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()).asIntBuffer();
 		int_buffer.put(0, buffer_id);
 		int_buffer.put(1, indices_buffer_id);
-		ARBBufferObject.glDeleteBuffersARB(int_buffer);
+		glDeleteBuffersARB(int_buffer);
 		Display.destroy();
 	}
 }
diff --git a/src/java/org/lwjgl/test/opengl/VBOTest.java b/src/java/org/lwjgl/test/opengl/VBOTest.java
index cb00a52..72dba1b 100644
--- a/src/java/org/lwjgl/test/opengl/VBOTest.java
+++ b/src/java/org/lwjgl/test/opengl/VBOTest.java
@@ -31,12 +31,12 @@
  */
 
 /**
- * $Id: VBOTest.java 3287 2010-03-14 23:24:40Z spasi $
+ * $Id: VBOTest.java 3418 2010-09-28 21:11:35Z spasi $
  *
  * Simple java test program.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3287 $
+ * @version $Revision: 3418 $
  */
 
 package org.lwjgl.test.opengl;
@@ -48,13 +48,14 @@ import java.nio.FloatBuffer;
 import org.lwjgl.Sys;
 import org.lwjgl.input.Keyboard;
 import org.lwjgl.input.Mouse;
-import org.lwjgl.opengl.ARBBufferObject;
-import org.lwjgl.opengl.ARBVertexBufferObject;
 import org.lwjgl.opengl.Display;
 import org.lwjgl.opengl.DisplayMode;
-import org.lwjgl.opengl.GL11;
 import org.lwjgl.opengl.GLContext;
-import org.lwjgl.util.glu.GLU;
+
+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 {
 
@@ -103,8 +104,8 @@ public final class VBOTest {
 	private static float angle;
 	private static int buffer_id;
 	private static FloatBuffer vertices;
-	private static ByteBuffer mapped_buffer = null;
-	private static FloatBuffer mapped_float_buffer = null;
+	private static ByteBuffer mapped_buffer;
+	private static FloatBuffer mapped_float_buffer;
 
 	public static void main(String[] arguments) {
 		try {
@@ -156,12 +157,12 @@ public final class VBOTest {
 	 * All rendering is done in here
 	 */
 	private static void render() {
-		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
-		GL11.glPushMatrix();
-		GL11.glTranslatef(Display.getDisplayMode().getWidth() / 2, Display.getDisplayMode().getHeight() / 2, 0.0f);
-		GL11.glRotatef(angle, 0, 0, 1.0f);
-		ByteBuffer new_mapped_buffer = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB,
-		                                                              ARBBufferObject.GL_WRITE_ONLY_ARB,
+		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();
@@ -169,9 +170,9 @@ public final class VBOTest {
 		mapped_float_buffer.rewind();
 		vertices.rewind();
 		mapped_float_buffer.put(vertices);
-		if ( ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB) )
-			GL11.glDrawArrays(GL11.GL_QUADS, 0, 4);
-		GL11.glPopMatrix();
+		if ( glUnmapBufferARB(GL_ARRAY_BUFFER_ARB) )
+			glDrawArrays(GL_QUADS, 0, 4);
+		glPopMatrix();
 	}
 
 	/**
@@ -180,30 +181,30 @@ public final class VBOTest {
 	private static void init() throws Exception {
 		System.out.println("Timer resolution: " + Sys.getTimerResolution());
 		// Go into orthographic projection mode.
-		GL11.glMatrixMode(GL11.GL_PROJECTION);
-		GL11.glLoadIdentity();
-		GLU.gluOrtho2D(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight());
-		GL11.glMatrixMode(GL11.GL_MODELVIEW);
-		GL11.glLoadIdentity();
-		GL11.glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
+		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 = ARBBufferObject.glGenBuffersARB();
-		ARBBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, buffer_id);
+		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);
-		ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 2 * 4 * 4, ARBBufferObject.GL_STREAM_DRAW_ARB);
-		GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
-		GL11.glVertexPointer(2, GL11.GL_FLOAT, 0, 0);
+		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() {
-		ARBBufferObject.glDeleteBuffersARB(buffer_id);
+		glDeleteBuffersARB(buffer_id);
 		Display.destroy();
 	}
 }
diff --git a/src/java/org/lwjgl/test/opengl/VersionTest.java b/src/java/org/lwjgl/test/opengl/VersionTest.java
index 6f4855c..169c3c4 100644
--- a/src/java/org/lwjgl/test/opengl/VersionTest.java
+++ b/src/java/org/lwjgl/test/opengl/VersionTest.java
@@ -37,6 +37,9 @@ 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.
  *
@@ -81,6 +84,8 @@ public final class VersionTest {
 					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] + "\'");
 			}
@@ -110,11 +115,11 @@ public final class VersionTest {
 
 		System.out.println("Requested " + ca);
 
-		final String version = GL11.glGetString(GL11.GL_VERSION);
+		final String version = glGetString(GL_VERSION);
 
 		boolean deprecated = false;
 		try {
-			GL11.glVertex3f(0.0f, 0.0f, 0.0f);
+			glVertex3f(0.0f, 0.0f, 0.0f);
 			deprecated = true;
 		} catch (Throwable t) {}
 
@@ -127,10 +132,10 @@ public final class VersionTest {
 		final boolean coreProfile;
 
 		if ( 3 < majorVersion || (majorVersion == 3 && 2 <= minorVersion) ) {
-			final int profileMask = GL11.glGetInteger(GL32.GL_CONTEXT_PROFILE_MASK);
+			final int profileMask = glGetInteger(GL_CONTEXT_PROFILE_MASK);
 
-			compatibilityProfile = (profileMask & GL32.GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) != 0;
-			coreProfile = (profileMask & GL32.GL_CONTEXT_CORE_PROFILE_BIT) != 0;
+			compatibilityProfile = (profileMask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) != 0;
+			coreProfile = (profileMask & GL_CONTEXT_CORE_PROFILE_BIT) != 0;
 		} else {
 			compatibilityProfile = false;
 			coreProfile = false;
@@ -213,8 +218,7 @@ public final class VersionTest {
 	private static DisplayMode chooseMode(DisplayMode[] modes, int width, int height) {
 		DisplayMode bestMode = null;
 
-		for ( int i = 0; i < modes.length; i++ ) {
-			DisplayMode mode = modes[i];
+		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;
@@ -236,6 +240,7 @@ public final class VersionTest {
 		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+).");
diff --git a/src/java/org/lwjgl/test/opengl/awt/AWTGears.java b/src/java/org/lwjgl/test/opengl/awt/AWTGears.java
index bb078be..c27d8c0 100644
--- a/src/java/org/lwjgl/test/opengl/awt/AWTGears.java
+++ b/src/java/org/lwjgl/test/opengl/awt/AWTGears.java
@@ -39,11 +39,14 @@ import java.nio.FloatBuffer;
 
 import org.lwjgl.BufferUtils;
 import org.lwjgl.LWJGLException;
-import org.lwjgl.opengl.ARBTransposeMatrix;
+import org.lwjgl.LWJGLUtil;
+import org.lwjgl.Sys;
 import org.lwjgl.opengl.AWTGLCanvas;
-import org.lwjgl.opengl.GL11;
 import org.lwjgl.opengl.GLContext;
 
+import static org.lwjgl.opengl.ARBTransposeMatrix.*;
+import static org.lwjgl.opengl.GL11.*;
+
 /**
  * <p>
  * AWT version of the gears demo
@@ -53,15 +56,15 @@ import org.lwjgl.opengl.GLContext;
  * $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	= 0.0f;
+	private float	view_rotz;
 
 	private int		gear1;
 
@@ -69,7 +72,7 @@ public class AWTGears extends Frame {
 
 	private int		gear3;
 
-	private float	angle			= 0.0f;
+	private float	angle;
 
 	/**
 	 * C'tor
@@ -90,7 +93,7 @@ public class AWTGears extends Frame {
 		pack();
 		setVisible(true);
 	}
-	
+
 	private void setup() {
 		//	 setup ogl
 		FloatBuffer pos = BufferUtils.createFloatBuffer(4).put(new float[] { 5.0f, 5.0f, 10.0f, 0.0f});
@@ -102,59 +105,60 @@ public class AWTGears extends Frame {
 		green.flip();
 		blue.flip();
 
-		GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, pos);
-		GL11.glEnable(GL11.GL_CULL_FACE);
-		GL11.glEnable(GL11.GL_LIGHTING);
-		GL11.glEnable(GL11.GL_LIGHT0);
-		GL11.glEnable(GL11.GL_DEPTH_TEST);
+		glLight(GL_LIGHT0, GL_POSITION, pos);
+		glEnable(GL_CULL_FACE);
+		glEnable(GL_LIGHTING);
+		glEnable(GL_LIGHT0);
+		glEnable(GL_DEPTH_TEST);
 
 		/* make the gears */
-		gear1 = GL11.glGenLists(1);
-		GL11.glNewList(gear1, GL11.GL_COMPILE);
-		GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, red);
+		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);
-		GL11.glEndList();
+		glEndList();
 
-		gear2 = GL11.glGenLists(1);
-		GL11.glNewList(gear2, GL11.GL_COMPILE);
-		GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, green);
+		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);
-		GL11.glEndList();
+		glEndList();
 
-		gear3 = GL11.glGenLists(1);
-		GL11.glNewList(gear3, GL11.GL_COMPILE);
-		GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, blue);
+		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);
-		GL11.glEndList();
+		glEndList();
 
-		GL11.glEnable(GL11.GL_NORMALIZE);
+		glEnable(GL_NORMALIZE);
 
-		GL11.glMatrixMode(GL11.GL_PROJECTION);
+		glMatrixMode(GL_PROJECTION);
 
-		System.err.println("GL_VENDOR: " + GL11.glGetString(GL11.GL_VENDOR));
-		System.err.println("GL_RENDERER: " + GL11.glGetString(GL11.GL_RENDERER));
-		System.err.println("GL_VERSION: " + GL11.glGetString(GL11.GL_VERSION));
+		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
-			GL11.glLoadIdentity();
+			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();
-			ARBTransposeMatrix.glLoadTransposeMatrixARB(identityTranspose);
+			glLoadTransposeMatrixARB(identityTranspose);
 		}
 
 		float h = (float) 300 / (float) 300;
-		GL11.glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
-		GL11.glMatrixMode(GL11.GL_MODELVIEW);
-		GL11.glLoadIdentity();
-		GL11.glTranslatef(0.0f, 0.0f, -40.0f);		
+		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.
@@ -177,97 +181,97 @@ public class AWTGears extends Frame {
 
 		da = 2.0f * (float) Math.PI / teeth / 4.0f;
 
-		GL11.glShadeModel(GL11.GL_FLAT);
+		glShadeModel(GL_FLAT);
 
-		GL11.glNormal3f(0.0f, 0.0f, 1.0f);
+		glNormal3f(0.0f, 0.0f, 1.0f);
 
 		/* draw front face */
-		GL11.glBegin(GL11.GL_QUAD_STRIP);
+		glBegin(GL_QUAD_STRIP);
 		for (i = 0; i <= teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
-			GL11.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), r1 * (float) Math.sin(angle), width * 0.5f);
 			if (i < teeth) {
-				GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
-				GL11.glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da),
+				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);
 			}
 		}
-		GL11.glEnd();
+		glEnd();
 
 		/* draw front sides of teeth */
-		GL11.glBegin(GL11.GL_QUADS);
+		glBegin(GL_QUADS);
 		for (i = 0; i < teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + 2.0f * da), r2 * (float) Math.sin(angle + 2.0f * da), width * 0.5f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f);
+			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);
 		}
-		GL11.glEnd();
+		glEnd();
 
 		/* draw back face */
-		GL11.glBegin(GL11.GL_QUAD_STRIP);
+		glBegin(GL_QUAD_STRIP);
 		for (i = 0; i <= teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
-			GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
-			GL11.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);
+			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);
 		}
-		GL11.glEnd();
+		glEnd();
 
 		/* draw back sides of teeth */
-		GL11.glBegin(GL11.GL_QUADS);
+		glBegin(GL_QUADS);
 		for (i = 0; i < teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (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(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);
 		}
-		GL11.glEnd();
+		glEnd();
 
 		/* draw outward faces of teeth */
-		GL11.glBegin(GL11.GL_QUAD_STRIP);
+		glBegin(GL_QUAD_STRIP);
 		for (i = 0; i < teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
-			GL11.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);
+			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;
-			GL11.glNormal3f(v, -u, 0.0f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
-			GL11.glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
+			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);
-			GL11.glNormal3f(v, -u, 0.0f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), width * 0.5f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
-			GL11.glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
+			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);
 		}
-		GL11.glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), width * 0.5f);
-		GL11.glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), -width * 0.5f);
-		GL11.glEnd();
+		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();
 
-		GL11.glShadeModel(GL11.GL_SMOOTH);
+		glShadeModel(GL_SMOOTH);
 
 		/* draw inside radius cylinder */
-		GL11.glBegin(GL11.GL_QUAD_STRIP);
+		glBegin(GL_QUAD_STRIP);
 		for (i = 0; i <= teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glNormal3f(-(float) Math.cos(angle), -(float) Math.sin(angle), 0.0f);
-			GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
-			GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
+			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);
 		}
-		GL11.glEnd();
-	}	
+		glEnd();
+	}
 
 	public static void main(String[] args) throws LWJGLException {
 		new AWTGears();
diff --git a/src/java/org/lwjgl/test/opengl/awt/AWTGearsCanvas.java b/src/java/org/lwjgl/test/opengl/awt/AWTGearsCanvas.java
index 0291bb5..2a8f1dd 100644
--- a/src/java/org/lwjgl/test/opengl/awt/AWTGearsCanvas.java
+++ b/src/java/org/lwjgl/test/opengl/awt/AWTGearsCanvas.java
@@ -35,12 +35,13 @@ import java.nio.FloatBuffer;
 
 import org.lwjgl.BufferUtils;
 import org.lwjgl.LWJGLException;
-import org.lwjgl.opengl.ARBTransposeMatrix;
 import org.lwjgl.opengl.AWTGLCanvas;
-import org.lwjgl.opengl.GL11;
 import org.lwjgl.opengl.GLContext;
 import org.lwjgl.test.applet.Test;
 
+import static org.lwjgl.opengl.ARBTransposeMatrix.*;
+import static org.lwjgl.opengl.GL11.*;
+
 /**
  * <p>
  * AWT version of the gears demo
@@ -50,12 +51,12 @@ import org.lwjgl.test.applet.Test;
  * $Id$
  */
 public class AWTGearsCanvas extends AWTGLCanvas implements Test {
-	
+
 	private float	view_rotx	= 20.0f;
 
 	private float	view_roty	= 30.0f;
 
-	private float	view_rotz	= 0.0f;
+	private float	view_rotz;
 
 	private int		gear1;
 
@@ -63,10 +64,10 @@ public class AWTGearsCanvas extends AWTGLCanvas implements Test {
 
 	private int		gear3;
 
-	private float	angle			= 0.0f;
+	private float	angle;
 
-	long startTime = 0;
-	long fps = 0;
+	long startTime;
+	long fps;
 	int current_width;
 	int current_height;
 
@@ -78,45 +79,45 @@ public class AWTGearsCanvas extends AWTGLCanvas implements Test {
 	}
 
 	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();
-				GL11.glViewport(0, 0, current_width, current_height);
+				glViewport(0, 0, current_width, current_height);
 			}
-			GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
-	
-			GL11.glPushMatrix();
-			GL11.glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
-			GL11.glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
-			GL11.glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);
-	
-			GL11.glPushMatrix();
-			GL11.glTranslatef(-3.0f, -2.0f, 0.0f);
-			GL11.glRotatef(angle, 0.0f, 0.0f, 1.0f);
-			GL11.glCallList(gear1);
-			GL11.glPopMatrix();
-	
-			GL11.glPushMatrix();
-			GL11.glTranslatef(3.1f, -2.0f, 0.0f);
-			GL11.glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f);
-			GL11.glCallList(gear2);
-			GL11.glPopMatrix();
-	
-			GL11.glPushMatrix();
-			GL11.glTranslatef(-3.1f, 4.2f, 0.0f);
-			GL11.glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f);
-			GL11.glCallList(gear3);
-			GL11.glPopMatrix();
-	
-			GL11.glPopMatrix();					
+			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) {
@@ -127,12 +128,12 @@ public class AWTGearsCanvas extends AWTGLCanvas implements Test {
 		} else {
 			long timeUsed = 5000 + (startTime - System.currentTimeMillis());
 			startTime = System.currentTimeMillis() + 5000;
-			System.out.println(fps + " frames in " + (float) (timeUsed / 1000f) + " seconds = "
+			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});
@@ -144,59 +145,59 @@ public class AWTGearsCanvas extends AWTGLCanvas implements Test {
 		green.flip();
 		blue.flip();
 
-		GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, pos);
-		GL11.glEnable(GL11.GL_CULL_FACE);
-		GL11.glEnable(GL11.GL_LIGHTING);
-		GL11.glEnable(GL11.GL_LIGHT0);
-		GL11.glEnable(GL11.GL_DEPTH_TEST);
+		glLight(GL_LIGHT0, GL_POSITION, pos);
+		glEnable(GL_CULL_FACE);
+		glEnable(GL_LIGHTING);
+		glEnable(GL_LIGHT0);
+		glEnable(GL_DEPTH_TEST);
 
 		/* make the gears */
-		gear1 = GL11.glGenLists(1);
-		GL11.glNewList(gear1, GL11.GL_COMPILE);
-		GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, red);
+		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);
-		GL11.glEndList();
+		glEndList();
 
-		gear2 = GL11.glGenLists(1);
-		GL11.glNewList(gear2, GL11.GL_COMPILE);
-		GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, green);
+		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);
-		GL11.glEndList();
+		glEndList();
 
-		gear3 = GL11.glGenLists(1);
-		GL11.glNewList(gear3, GL11.GL_COMPILE);
-		GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, blue);
+		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);
-		GL11.glEndList();
+		glEndList();
 
-		GL11.glEnable(GL11.GL_NORMALIZE);
+		glEnable(GL_NORMALIZE);
 
-		GL11.glMatrixMode(GL11.GL_PROJECTION);
+		glMatrixMode(GL_PROJECTION);
 
-		System.err.println("GL_VENDOR: " + GL11.glGetString(GL11.GL_VENDOR));
-		System.err.println("GL_RENDERER: " + GL11.glGetString(GL11.GL_RENDERER));
-		System.err.println("GL_VERSION: " + GL11.glGetString(GL11.GL_VERSION));
+		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
-			GL11.glLoadIdentity();
+			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();
-			ARBTransposeMatrix.glLoadTransposeMatrixARB(identityTranspose);
+			glLoadTransposeMatrixARB(identityTranspose);
 		}
 
 		float h = (float) 300 / (float) 300;
-		GL11.glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
-		GL11.glMatrixMode(GL11.GL_MODELVIEW);
-		GL11.glLoadIdentity();
-		GL11.glTranslatef(0.0f, 0.0f, -40.0f);		
+		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.
@@ -219,96 +220,96 @@ public class AWTGearsCanvas extends AWTGLCanvas implements Test {
 
 		da = 2.0f * (float) Math.PI / teeth / 4.0f;
 
-		GL11.glShadeModel(GL11.GL_FLAT);
+		glShadeModel(GL_FLAT);
 
-		GL11.glNormal3f(0.0f, 0.0f, 1.0f);
+		glNormal3f(0.0f, 0.0f, 1.0f);
 
 		/* draw front face */
-		GL11.glBegin(GL11.GL_QUAD_STRIP);
+		glBegin(GL_QUAD_STRIP);
 		for (i = 0; i <= teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
-			GL11.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), r1 * (float) Math.sin(angle), width * 0.5f);
 			if (i < teeth) {
-				GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
-				GL11.glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da),
+				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);
 			}
 		}
-		GL11.glEnd();
+		glEnd();
 
 		/* draw front sides of teeth */
-		GL11.glBegin(GL11.GL_QUADS);
+		glBegin(GL_QUADS);
 		for (i = 0; i < teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + 2.0f * da), r2 * (float) Math.sin(angle + 2.0f * da), width * 0.5f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f);
+			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);
 		}
-		GL11.glEnd();
+		glEnd();
 
 		/* draw back face */
-		GL11.glBegin(GL11.GL_QUAD_STRIP);
+		glBegin(GL_QUAD_STRIP);
 		for (i = 0; i <= teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
-			GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
-			GL11.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);
+			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);
 		}
-		GL11.glEnd();
+		glEnd();
 
 		/* draw back sides of teeth */
-		GL11.glBegin(GL11.GL_QUADS);
+		glBegin(GL_QUADS);
 		for (i = 0; i < teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (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(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);
 		}
-		GL11.glEnd();
+		glEnd();
 
 		/* draw outward faces of teeth */
-		GL11.glBegin(GL11.GL_QUAD_STRIP);
+		glBegin(GL_QUAD_STRIP);
 		for (i = 0; i < teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
-			GL11.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);
+			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;
-			GL11.glNormal3f(v, -u, 0.0f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
-			GL11.glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), width * 0.5f);
-			GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
+			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);
-			GL11.glNormal3f(v, -u, 0.0f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), width * 0.5f);
-			GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
-			GL11.glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
+			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);
 		}
-		GL11.glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), width * 0.5f);
-		GL11.glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), -width * 0.5f);
-		GL11.glEnd();
+		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();
 
-		GL11.glShadeModel(GL11.GL_SMOOTH);
+		glShadeModel(GL_SMOOTH);
 
 		/* draw inside radius cylinder */
-		GL11.glBegin(GL11.GL_QUAD_STRIP);
+		glBegin(GL_QUAD_STRIP);
 		for (i = 0; i <= teeth; i++) {
 			angle = i * 2.0f * (float) Math.PI / teeth;
-			GL11.glNormal3f(-(float) Math.cos(angle), -(float) Math.sin(angle), 0.0f);
-			GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
-			GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
+			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);
 		}
-		GL11.glEnd();
+		glEnd();
 	}
 
 	/*
diff --git a/src/java/org/lwjgl/test/opengl/awt/AWTTest.java b/src/java/org/lwjgl/test/opengl/awt/AWTTest.java
index 40c7a93..7ec24ae 100644
--- a/src/java/org/lwjgl/test/opengl/awt/AWTTest.java
+++ b/src/java/org/lwjgl/test/opengl/awt/AWTTest.java
@@ -38,22 +38,23 @@ import java.awt.event.WindowEvent;
 
 import org.lwjgl.LWJGLException;
 import org.lwjgl.opengl.AWTGLCanvas;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.util.glu.GLU;
+
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.util.glu.GLU.*;
 
 /**
  * <p>
  * Tests AWTGLCanvas functionality
  * <p>
- * @version $Revision: 2983 $
- * @author $Author: matzon $
- * $Id: AWTTest.java 2983 2008-04-07 18:36:09Z matzon $
+ * @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;
 
 	/**
@@ -71,21 +72,21 @@ public class AWTTest extends Frame {
 					if (getWidth() != current_width || getHeight() != current_height) {
 						current_width = getWidth();
 						current_height = getHeight();
-						GL11.glViewport(0, 0, current_width, current_height);
+						glViewport(0, 0, current_width, current_height);
 					}
-					GL11.glViewport(0, 0, getWidth(), getHeight());
-					GL11.glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
-					GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
-					GL11.glMatrixMode(GL11.GL_PROJECTION);
-					GL11.glLoadIdentity();
-					GLU.gluOrtho2D(0.0f, (float) getWidth(), 0.0f, (float) getHeight());
-					GL11.glMatrixMode(GL11.GL_MODELVIEW);
-					GL11.glPushMatrix();
-					GL11.glColor3f(1f, 1f, 0f);
-					GL11.glTranslatef(getWidth() / 2.0f, getHeight() / 2.0f, 0.0f);
-					GL11.glRotatef(angle, 0f, 0f, 1.0f);
-					GL11.glRectf(-50.0f, -50.0f, 50.0f, 50.0f);
-					GL11.glPopMatrix();
+					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) {
@@ -102,27 +103,27 @@ public class AWTTest extends Frame {
 					if (getWidth() != current_width || getHeight() != current_height) {
 						current_width = getWidth();
 						current_height = getHeight();
-						GL11.glViewport(0, 0, current_width, current_height);
+						glViewport(0, 0, current_width, current_height);
 					}
-					GL11.glViewport(0, 0, getWidth(), getHeight());
-					GL11.glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
-					GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
-					GL11.glMatrixMode(GL11.GL_PROJECTION);
-					GL11.glLoadIdentity();
-					GLU.gluOrtho2D(0.0f, (float) getWidth(), 0.0f, (float) getHeight());
-					GL11.glMatrixMode(GL11.GL_MODELVIEW);
-					GL11.glPushMatrix();
-					GL11.glTranslatef(getWidth() / 2.0f, getHeight() / 2.0f, 0.0f);
-					GL11.glRotatef(2*angle, 0f, 0f, -1.0f);
-					GL11.glRectf(-50.0f, -50.0f, 50.0f, 50.0f);
-					GL11.glPopMatrix();
+					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();
diff --git a/src/java/org/lwjgl/test/opengl/awt/DemoBox.java b/src/java/org/lwjgl/test/opengl/awt/DemoBox.java
index 9604b4b..fc9860b 100644
--- a/src/java/org/lwjgl/test/opengl/awt/DemoBox.java
+++ b/src/java/org/lwjgl/test/opengl/awt/DemoBox.java
@@ -51,11 +51,12 @@ import java.util.Hashtable;
 
 import org.lwjgl.BufferUtils;
 import org.lwjgl.LWJGLException;
-import org.lwjgl.opengl.ARBTransposeMatrix;
 import org.lwjgl.opengl.AWTGLCanvas;
-import org.lwjgl.opengl.GL11;
 import org.lwjgl.opengl.GLContext;
 
+import static org.lwjgl.opengl.ARBTransposeMatrix.*;
+import static org.lwjgl.opengl.GL11.*;
+
 /**
  * <p>
  * </p>
@@ -72,13 +73,13 @@ public class DemoBox extends Frame {
 	private Panel						selectionPanel;
 
 	/** Hashtable of demos */
-	private Hashtable				selectableDemos;
+	private Hashtable<String, Demo>				selectableDemos;
 
 	/**
 	 * Creates a new demo box instance
 	 */
 	public DemoBox() {
-		selectableDemos = new Hashtable();
+		selectableDemos = new Hashtable<String, Demo>();
 		selectableDemos.put("default", new NullDemoBox());
 		selectableDemos.put("clear_color", new ClearColorDemoBox());
 		selectableDemos.put("gears", new GearsDemoBox());
@@ -160,7 +161,7 @@ public class DemoBox extends Frame {
 		//demoSelected(demos.getSelectedItem());
 		return true;
 	}
-	
+
 	public void updateFPS(float fps) {
 		if(fps != -1) {
 			setTitle("LWJGL - Demo Box (FPS: " + fps + ")");
@@ -182,7 +183,7 @@ public class DemoBox extends Frame {
 	 */
 	protected void demoSelected(String demo) {
 		System.out.println("Selecting demo: " + demo);
-		demoCanvas.setActiveDemo((Demo) selectableDemos.get(demo));
+		demoCanvas.setActiveDemo(selectableDemos.get(demo));
 	}
 
 	/**
@@ -199,20 +200,20 @@ public class DemoBox extends Frame {
 	 * Interface for a demo
 	 */
 	public interface Demo {
-		public boolean isInitialized();
-		public boolean initialize();
-		public void render();
-		public void destroy();
+		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;
 
@@ -221,15 +222,15 @@ public class DemoBox extends Frame {
 
 		/** Render thread */
 		private Thread	renderThread;
-		
-		public DemoBoxGLCanvas(DemoBox parent) throws LWJGLException {
+
+		private DemoBoxGLCanvas(DemoBox parent) throws LWJGLException {
 			super();
-			this.parent = parent;			
+			this.parent = parent;
 		}
 
 		// FPS
-		long startTime = 0;
-		long fps = 0;			
+		long startTime;
+		long fps;
 
 		protected void paintGL() {
 			synchronized (this) {
@@ -243,20 +244,20 @@ public class DemoBox extends Frame {
 						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 {
@@ -264,7 +265,7 @@ public class DemoBox extends Frame {
 						startTime = System.currentTimeMillis() + 5000;
 						parent.updateFPS((fps / (timeUsed / 1000f)));
 						fps = 0;
-					}					
+					}
 				}
 			}
 		}
@@ -295,7 +296,7 @@ public class DemoBox extends Frame {
 			}
 		}
 
-		public DemoBoxGLCanvas() throws LWJGLException {
+		private DemoBoxGLCanvas() throws LWJGLException {
 			super();
 		}
 
@@ -330,13 +331,13 @@ public class DemoBox extends Frame {
 	// Demo box demo
 	// ========================================================
 	public class ClearColorDemoBox implements Demo {
-		
+
 		private boolean initialized;
 
 		int		direction	= 1;
 
 		float	color;
-		
+
 		public boolean isInitialized() {
 			return initialized;
 		}
@@ -346,8 +347,8 @@ public class DemoBox extends Frame {
 		}
 
 		public void render() {
-			GL11.glClearColor(color, color, color, 1f);
-			GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
+			glClearColor(color, color, color, 1f);
+			glClear(GL_COLOR_BUFFER_BIT);
 
 			color += direction * .05f;
 
@@ -370,20 +371,20 @@ public class DemoBox extends Frame {
 	// Demo box demo
 	// ========================================================
 	public class NullDemoBox implements Demo {
-		
+
 		private boolean initialized;
-		
+
 		public boolean isInitialized() {
 			return initialized;
 		}
 
 		public boolean initialize() {
-			GL11.glClearColor(0, 0, 0, 1f);
+			glClearColor(0, 0, 0, 1f);
 			return true;
 		}
 
 		public void render() {
-			GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
+			glClear(GL_COLOR_BUFFER_BIT);
 		}
 
 		public void destroy() {
@@ -391,18 +392,18 @@ public class DemoBox extends Frame {
 		}
 	}
 	// --------------------------------------------------------
-	
+
 	// 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	= 0.0f;
+		private float	view_rotz;
 
 		private int		gear1;
 
@@ -410,8 +411,8 @@ public class DemoBox extends Frame {
 
 		private int		gear3;
 
-		private float	angle			= 0.0f;		
-		
+		private float	angle;
+
 		public boolean isInitialized() {
 			return initialized;
 		}
@@ -426,93 +427,93 @@ public class DemoBox extends Frame {
 			red.flip();
 			green.flip();
 			blue.flip();
-			
-			GL11.glClearColor(0, 0, 0, 1f);
 
-			GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, pos);
-			GL11.glEnable(GL11.GL_CULL_FACE);
-			GL11.glEnable(GL11.GL_LIGHTING);
-			GL11.glEnable(GL11.GL_LIGHT0);
-			GL11.glEnable(GL11.GL_DEPTH_TEST);
+			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 = GL11.glGenLists(1);
-			GL11.glNewList(gear1, GL11.GL_COMPILE);
-			GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, red);
+			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);
-			GL11.glEndList();
+			glEndList();
 
-			gear2 = GL11.glGenLists(1);
-			GL11.glNewList(gear2, GL11.GL_COMPILE);
-			GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, green);
+			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);
-			GL11.glEndList();
+			glEndList();
 
-			gear3 = GL11.glGenLists(1);
-			GL11.glNewList(gear3, GL11.GL_COMPILE);
-			GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, blue);
+			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);
-			GL11.glEndList();
+			glEndList();
 
-			GL11.glEnable(GL11.GL_NORMALIZE);
+			glEnable(GL_NORMALIZE);
 
-			GL11.glMatrixMode(GL11.GL_PROJECTION);
+			glMatrixMode(GL_PROJECTION);
 
-			System.err.println("GL_VENDOR: " + GL11.glGetString(GL11.GL_VENDOR));
-			System.err.println("GL_RENDERER: " + GL11.glGetString(GL11.GL_RENDERER));
-			System.err.println("GL_VERSION: " + GL11.glGetString(GL11.GL_VERSION));
+			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
-				GL11.glLoadIdentity();
+				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();
-				ARBTransposeMatrix.glLoadTransposeMatrixARB(identityTranspose);
+				glLoadTransposeMatrixARB(identityTranspose);
 			}
 
 			float h = (float) 300 / (float) 300;
-			GL11.glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
-			GL11.glMatrixMode(GL11.GL_MODELVIEW);
-			GL11.glLoadIdentity();
-			GL11.glTranslatef(0.0f, 0.0f, -40.0f);
+			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;
-			GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
-
-			GL11.glPushMatrix();
-			GL11.glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
-			GL11.glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
-			GL11.glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);
-
-			GL11.glPushMatrix();
-			GL11.glTranslatef(-3.0f, -2.0f, 0.0f);
-			GL11.glRotatef(angle, 0.0f, 0.0f, 1.0f);
-			GL11.glCallList(gear1);
-			GL11.glPopMatrix();
-
-			GL11.glPushMatrix();
-			GL11.glTranslatef(3.1f, -2.0f, 0.0f);
-			GL11.glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f);
-			GL11.glCallList(gear2);
-			GL11.glPopMatrix();
-
-			GL11.glPushMatrix();
-			GL11.glTranslatef(-3.1f, 4.2f, 0.0f);
-			GL11.glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f);
-			GL11.glCallList(gear3);
-			GL11.glPopMatrix();
-
-			GL11.glPopMatrix();
+			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.
@@ -535,104 +536,104 @@ public class DemoBox extends Frame {
 
 			da = 2.0f * (float) Math.PI / teeth / 4.0f;
 
-			GL11.glShadeModel(GL11.GL_FLAT);
+			glShadeModel(GL_FLAT);
 
-			GL11.glNormal3f(0.0f, 0.0f, 1.0f);
+			glNormal3f(0.0f, 0.0f, 1.0f);
 
 			/* draw front face */
-			GL11.glBegin(GL11.GL_QUAD_STRIP);
+			glBegin(GL_QUAD_STRIP);
 			for (i = 0; i <= teeth; i++) {
 				angle = i * 2.0f * (float) Math.PI / teeth;
-				GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
-				GL11.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), r1 * (float) Math.sin(angle), width * 0.5f);
 				if (i < teeth) {
-					GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
-					GL11.glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da),
+					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);
 				}
 			}
-			GL11.glEnd();
+			glEnd();
 
 			/* draw front sides of teeth */
-			GL11.glBegin(GL11.GL_QUADS);
+			glBegin(GL_QUADS);
 			for (i = 0; i < teeth; i++) {
 				angle = i * 2.0f * (float) Math.PI / teeth;
-				GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
-				GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
-				GL11.glVertex3f(r2 * (float) Math.cos(angle + 2.0f * da), r2 * (float) Math.sin(angle + 2.0f * da), width * 0.5f);
-				GL11.glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f);
+				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);
 			}
-			GL11.glEnd();
+			glEnd();
 
 			/* draw back face */
-			GL11.glBegin(GL11.GL_QUAD_STRIP);
+			glBegin(GL_QUAD_STRIP);
 			for (i = 0; i <= teeth; i++) {
 				angle = i * 2.0f * (float) Math.PI / teeth;
-				GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
-				GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
-				GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
-				GL11.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);
+				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);
 			}
-			GL11.glEnd();
+			glEnd();
 
 			/* draw back sides of teeth */
-			GL11.glBegin(GL11.GL_QUADS);
+			glBegin(GL_QUADS);
 			for (i = 0; i < teeth; i++) {
 				angle = i * 2.0f * (float) Math.PI / teeth;
-				GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
-				GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
-				GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
-				GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (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(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);
 			}
-			GL11.glEnd();
+			glEnd();
 
 			/* draw outward faces of teeth */
-			GL11.glBegin(GL11.GL_QUAD_STRIP);
+			glBegin(GL_QUAD_STRIP);
 			for (i = 0; i < teeth; i++) {
 				angle = i * 2.0f * (float) Math.PI / teeth;
-				GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
-				GL11.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);
+				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;
-				GL11.glNormal3f(v, -u, 0.0f);
-				GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
-				GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
-				GL11.glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
-				GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), width * 0.5f);
-				GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
+				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);
-				GL11.glNormal3f(v, -u, 0.0f);
-				GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), width * 0.5f);
-				GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
-				GL11.glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
+				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);
 			}
-			GL11.glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), width * 0.5f);
-			GL11.glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), -width * 0.5f);
-			GL11.glEnd();
+			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();
 
-			GL11.glShadeModel(GL11.GL_SMOOTH);
+			glShadeModel(GL_SMOOTH);
 
 			/* draw inside radius cylinder */
-			GL11.glBegin(GL11.GL_QUAD_STRIP);
+			glBegin(GL_QUAD_STRIP);
 			for (i = 0; i <= teeth; i++) {
 				angle = i * 2.0f * (float) Math.PI / teeth;
-				GL11.glNormal3f(-(float) Math.cos(angle), -(float) Math.sin(angle), 0.0f);
-				GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
-				GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
+				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);
 			}
-			GL11.glEnd();
-		}			
+			glEnd();
+		}
 
 		public void destroy() {
-			GL11.glDeleteLists(gear1, 1);
-			GL11.glDeleteLists(gear2, 1);
-			GL11.glDeleteLists(gear3, 1);
+			glDeleteLists(gear1, 1);
+			glDeleteLists(gear2, 1);
+			glDeleteLists(gear3, 1);
 			initialized = false;
 		}
 	}
-	// --------------------------------------------------------	
+	// --------------------------------------------------------
 }
diff --git a/src/java/org/lwjgl/test/opengl/awt/DisplayParentTest.java b/src/java/org/lwjgl/test/opengl/awt/DisplayParentTest.java
index 7eacd8a..b72a06f 100644
--- a/src/java/org/lwjgl/test/opengl/awt/DisplayParentTest.java
+++ b/src/java/org/lwjgl/test/opengl/awt/DisplayParentTest.java
@@ -41,19 +41,20 @@ import org.lwjgl.LWJGLException;
 import org.lwjgl.input.Keyboard;
 import org.lwjgl.input.Mouse;
 import org.lwjgl.opengl.Display;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.util.glu.GLU;
+
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.util.glu.GLU.*;
 
 /**
  * <p>
  * Tests Display.setParent()
  * <p>
- * @version $Revision: 3102 $
- * @author $Author: matzon $
- * $Id: DisplayParentTest.java 3102 2008-06-08 09:30:24Z matzon $
+ * @version $Revision: 3418 $
+ * @author $Author: spasi $
+ * $Id: DisplayParentTest.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public class DisplayParentTest extends Frame {
-	boolean killswitch = false;
+	boolean killswitch;
 	public DisplayParentTest() throws LWJGLException {
 		setTitle("LWJGL Display Parent Test");
 		setSize(640, 320);
@@ -85,23 +86,23 @@ public class DisplayParentTest extends Frame {
 				width = Display.getDisplayMode().getWidth();
 				height = Display.getDisplayMode().getHeight();
 			}
-			
+
 			if(width < 1 || height < 1) {
 				continue;
 			}
-			
-			GL11.glViewport(0, 0, width, height);
-			GL11.glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
-			GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
-			GL11.glMatrixMode(GL11.GL_PROJECTION);
-			GL11.glLoadIdentity();
-			GLU.gluOrtho2D(0.0f, (float) width, 0.0f, (float) height);
-			GL11.glMatrixMode(GL11.GL_MODELVIEW);
-			GL11.glPushMatrix();
-			GL11.glTranslatef(width / 2.0f, height / 2.0f, 0.0f);
-			GL11.glRotatef(2*angle, 0f, 0f, -1.0f);
-			GL11.glRectf(-50.0f, -50.0f, 50.0f, 50.0f);
-			GL11.glPopMatrix();
+
+			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
diff --git a/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoadTest.java b/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoadTest.java
index c068b60..0357e1c 100644
--- a/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoadTest.java
+++ b/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoadTest.java
@@ -36,11 +36,13 @@ import org.lwjgl.LWJGLException;
 import org.lwjgl.input.Keyboard;
 import org.lwjgl.input.Mouse;
 import org.lwjgl.opengl.*;
-import org.lwjgl.util.glu.GLU;
 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:
  * <br>
@@ -85,15 +87,15 @@ public final class BackgroundLoadTest {
 			else {
 				handleIO();
 
-				GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
+				glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
 				renderObject();
 
 				Util.checkGLError();
 
 				// Restore camera position.
-				GL11.glPopMatrix();
-				GL11.glPushMatrix();
+				glPopMatrix();
+				glPushMatrix();
 			}
 
 			Display.update();
@@ -131,59 +133,59 @@ public final class BackgroundLoadTest {
 			kill(e.getMessage());
 		}
 
-		GL11.glViewport(0, 0, displayMode.getWidth(), displayMode.getHeight());
+		glViewport(0, 0, displayMode.getWidth(), displayMode.getHeight());
 
-		GL11.glMatrixMode(GL11.GL_PROJECTION);
-		GL11.glLoadIdentity();
-		GLU.gluPerspective(45, displayMode.getWidth() / (float)displayMode.getHeight(), 1.0f, 10.0f);
+		glMatrixMode(GL_PROJECTION);
+		glLoadIdentity();
+		gluPerspective(45, displayMode.getWidth() / (float)displayMode.getHeight(), 1.0f, 10.0f);
 
-		GL11.glMatrixMode(GL11.GL_MODELVIEW);
-		GL11.glLoadIdentity();
+		glMatrixMode(GL_MODELVIEW);
+		glLoadIdentity();
 
 		// Setup camera position.
-		GL11.glTranslatef(0.0f, 0.0f, -4.0f);
-		GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
-		GL11.glPushMatrix();
+		glTranslatef(0.0f, 0.0f, -4.0f);
+		glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
+		glPushMatrix();
 
-		GL11.glClearDepth(1.0f);
-		GL11.glDepthFunc(GL11.GL_LEQUAL);
+		glClearDepth(1.0f);
+		glDepthFunc(GL_LEQUAL);
 
-		GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
+		glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
 
-		GL11.glFrontFace(GL11.GL_CCW);
-		GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
+		glFrontFace(GL_CCW);
+		glPolygonMode(GL_FRONT, GL_FILL);
 
-		GL11.glCullFace(GL11.GL_BACK);
-		GL11.glEnable(GL11.GL_CULL_FACE);
+		glCullFace(GL_BACK);
+		glEnable(GL_CULL_FACE);
 
-		GL11.glAlphaFunc(GL11.GL_GREATER, 0.0f);
-		GL11.glEnable(GL11.GL_ALPHA_TEST);
+		glAlphaFunc(GL_GREATER, 0.0f);
+		glEnable(GL_ALPHA_TEST);
 
-		GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
-		GL11.glDisable(GL11.GL_BLEND);
+		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+		glDisable(GL_BLEND);
 
-		GL11.glShadeModel(GL11.GL_SMOOTH);
+		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);
-		GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, vectorBuffer);
+		glLight(GL_LIGHT0, GL_DIFFUSE, vectorBuffer);
 
 		vectorBuffer.put(0, 1.0f).put(1, 1.0f).put(2, 1.0f).put(3, 1.0f);
-		GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, vectorBuffer);
+		glLight(GL_LIGHT0, GL_AMBIENT, vectorBuffer);
 
 		vectorBuffer.put(0, 1.0f).put(1, 1.0f).put(2, 0.5f).put(3, 1.0f);
-		GL11.glLight(GL11.GL_LIGHT0, GL11.GL_SPECULAR, vectorBuffer);
+		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
-		GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, vectorBuffer);
+		glLight(GL_LIGHT0, GL_POSITION, vectorBuffer);
 
 		vectorBuffer.put(0, 0.2f).put(1, 0.2f).put(2, 0.2f).put(3, 1.0f);
-		GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, vectorBuffer);
+		glLightModel(GL_LIGHT_MODEL_AMBIENT, vectorBuffer);
 
-		GL11.glEnable(GL11.GL_LIGHT0);
-		GL11.glEnable(GL11.GL_LIGHTING);
+		glEnable(GL_LIGHT0);
+		glEnable(GL_LIGHTING);
 
 		sphere = new Sphere();
 
@@ -222,31 +224,30 @@ public final class BackgroundLoadTest {
 	}
 
 	static void renderObject() {
-		GL11.glColor3f(1.0f, 1.0f, 1.0f);
+		glColor3f(1.0f, 1.0f, 1.0f);
 
 		int texID = backgroundLoader.getTexID();
 		if ( texID == 0 ) {
 			sphere.setTextureFlag(false);
-			GL11.glDisable(GL11.GL_TEXTURE_2D);
+			glDisable(GL_TEXTURE_2D);
 		} else {
 			sphere.setTextureFlag(true);
-			GL11.glEnable(GL11.GL_TEXTURE_2D);
-			GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID);
+			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.
-			GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
-			GL11.glDisable(GL11.GL_TEXTURE_2D);
+			glBindTexture(GL_TEXTURE_2D, 0);
+			glDisable(GL_TEXTURE_2D);
 		}
 	}
 
 	private static DisplayMode chooseMode(DisplayMode[] modes, int width, int height) {
 		DisplayMode bestMode = null;
 
-		for ( int i = 0; i < modes.length; i++ ) {
-			DisplayMode mode = modes[i];
+		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;
diff --git a/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoader.java b/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoader.java
index 475e336..3cd3061 100644
--- a/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoader.java
+++ b/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoader.java
@@ -40,12 +40,13 @@ package org.lwjgl.test.opengl.multithread;
 import org.lwjgl.BufferUtils;
 import org.lwjgl.LWJGLException;
 import org.lwjgl.opengl.Drawable;
-import org.lwjgl.opengl.GL11;
 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;
@@ -97,14 +98,14 @@ abstract class BackgroundLoader {
 					// Create a "dummy" texture while we wait for texture IO
 					createCheckerTexture(Color.RED, Color.WHITE, 2);
 
-					texID = GL11.glGenTextures();
-					GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID);
-					GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, WIDTH, HEIGHT, 0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, texture);
+					texID = glGenTextures();
+					glBindTexture(GL_TEXTURE_2D, texID);
+					glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, WIDTH, HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, texture);
 
-					GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
-					GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
+					glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+					glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 
-					GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
+					glBindTexture(GL_TEXTURE_2D, 0);
 				}
 
 				System.out.println("** Dummy texture created **");
@@ -128,13 +129,13 @@ abstract class BackgroundLoader {
 					else
 						createGradientTexture(Color.GREEN, Color.YELLOW);
 
-					GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID);
-					GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, WIDTH, HEIGHT, 0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, texture);
+					glBindTexture(GL_TEXTURE_2D, texID);
+					glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, WIDTH, HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, texture);
 
-					GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
-					GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
+					glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+					glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 
-					GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
+					glBindTexture(GL_TEXTURE_2D, 0);
 
 					System.out.println("** Created new gradient texture **");
 
diff --git a/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java b/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java
index d3d7f0e..e3c352e 100644
--- a/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java
+++ b/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java
@@ -38,19 +38,20 @@ 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 org.lwjgl.opengl.Pbuffer;
 import org.lwjgl.opengl.PixelFormat;
-import org.lwjgl.util.glu.GLU;
 import org.lwjgl.util.vector.Vector2f;
 
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.util.glu.GLU.*;
+
 /**
  * <p/>
  * Tests Pbuffers
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 2983 $
- * $Id: PbufferTest.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: PbufferTest.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public final class PbufferTest {
 
@@ -215,25 +216,25 @@ public final class PbufferTest {
 		texRenderer.enable();
 
 		// Clear the background
-		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
+		glClear(GL_COLOR_BUFFER_BIT);
 
 		// Draw quad with gradient
-		GL11.glPushMatrix();
+		glPushMatrix();
 		{
-			GL11.glTranslatef(quadPosition.x * texScaleX, quadPosition.y * texScaleY, 0);
-			GL11.glRotatef(angle, 0.0f, 0.0f, 1.0f);
-			GL11.glBegin(GL11.GL_QUADS);
+			glTranslatef(quadPosition.x * texScaleX, quadPosition.y * texScaleY, 0);
+			glRotatef(angle, 0.0f, 0.0f, 1.0f);
+			glBegin(GL_QUADS);
 			{
-				GL11.glColor3f(1.0f, 0.0f, 0.0f);
-				GL11.glVertex2i(-QUAD_SIZE, -QUAD_SIZE);
-				GL11.glVertex2i(QUAD_SIZE, -QUAD_SIZE);
-				GL11.glColor3f(0.0f, 0.0f, 1.0f);
-				GL11.glVertex2i(QUAD_SIZE, QUAD_SIZE);
-				GL11.glVertex2i(-QUAD_SIZE, QUAD_SIZE);
+				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);
 			}
-			GL11.glEnd();
+			glEnd();
 		}
-		GL11.glPopMatrix();
+		glPopMatrix();
 
 		// Refresh the texture
 		texRenderer.updateTexture();
@@ -247,28 +248,28 @@ public final class PbufferTest {
 			throw new RuntimeException(e);
 		}
 
-		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
+		glClear(GL_COLOR_BUFFER_BIT);
 
 		// draw white quad
-		GL11.glPushMatrix();
+		glPushMatrix();
 		{
-			GL11.glTranslatef(quadPosition.x, quadPosition.y, 0);
-			GL11.glRotatef(angle, 0.0f, 0.0f, 1.0f);
-			GL11.glColor3f(1.0f, 1.0f, 1.0f);
-			GL11.glBegin(GL11.GL_QUADS);
+			glTranslatef(quadPosition.x, quadPosition.y, 0);
+			glRotatef(angle, 0.0f, 0.0f, 1.0f);
+			glColor3f(1.0f, 1.0f, 1.0f);
+			glBegin(GL_QUADS);
 			{
-				GL11.glTexCoord2f(0f, 0f);
-				GL11.glVertex2i(-QUAD_SIZE, -QUAD_SIZE);
-				GL11.glTexCoord2f(1f, 0f);
-				GL11.glVertex2i(QUAD_SIZE, -QUAD_SIZE);
-				GL11.glTexCoord2f(1f, 1f);
-				GL11.glVertex2i(QUAD_SIZE, QUAD_SIZE);
-				GL11.glTexCoord2f(0f, 1f);
-				GL11.glVertex2i(-QUAD_SIZE, QUAD_SIZE);
+				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);
 			}
-			GL11.glEnd();
+			glEnd();
 		}
-		GL11.glPopMatrix();
+		glPopMatrix();
 	}
 
 	/**
@@ -334,7 +335,7 @@ public final class PbufferTest {
 		// Destroy texture
 		IntBuffer buffer = BufferUtils.createIntBuffer(1);
 		buffer.put(0, texID);
-		GL11.glDeleteTextures(buffer);
+		glDeleteTextures(buffer);
 
 		texRenderer.destroy();
 		Display.destroy();
@@ -351,27 +352,24 @@ public final class PbufferTest {
 	 */
 	private DisplayMode findDisplayMode(int width, int height, int bpp) throws LWJGLException {
 		DisplayMode[] modes = Display.getAvailableDisplayModes();
-		for ( int i = 0; i < modes.length; i++ ) {
-			if ( modes[i].getWidth() == width
-			     && modes[i].getHeight() == height
-			     && modes[i].getBitsPerPixel() >= bpp ) {
-				return modes[i];
-			}
+		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) {
-		GL11.glMatrixMode(GL11.GL_PROJECTION);
-		GL11.glLoadIdentity();
-		GLU.gluOrtho2D(0, width, 0, height);
+		glMatrixMode(GL_PROJECTION);
+		glLoadIdentity();
+		gluOrtho2D(0, width, 0, height);
 
-		GL11.glMatrixMode(GL11.GL_MODELVIEW);
-		GL11.glLoadIdentity();
-		GL11.glViewport(0, 0, width, height);
+		glMatrixMode(GL_MODELVIEW);
+		glLoadIdentity();
+		glViewport(0, 0, width, height);
 
 		//set clear color
-		GL11.glClearColor(color, color, color, 0.0f);
+		glClearColor(color, color, color, 0.0f);
 	}
 
 	/**
@@ -383,18 +381,18 @@ public final class PbufferTest {
 
 		// Create shared texture
 		IntBuffer buffer = BufferUtils.createIntBuffer(1);
-		GL11.glGenTextures(buffer);
+		glGenTextures(buffer);
 		texID = buffer.get(0);
 
-		GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);
-		GL11.glEnable(GL11.GL_TEXTURE_2D);
+		glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+		glEnable(GL_TEXTURE_2D);
 
-		GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID);
+		glBindTexture(GL_TEXTURE_2D, texID);
 
-		GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
-		GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
-		GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
-		GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
+		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);
 	}
diff --git a/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRenderer.java b/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRenderer.java
index 24fe7f1..e0d8aad 100644
--- a/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRenderer.java
+++ b/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRenderer.java
@@ -33,10 +33,11 @@ package org.lwjgl.test.opengl.pbuffers;
 
 import org.lwjgl.LWJGLException;
 import org.lwjgl.opengl.Display;
-import org.lwjgl.opengl.GL11;
 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) {
@@ -53,7 +54,7 @@ final class UniqueRenderer extends TextureRenderer {
 			pbuffer.makeCurrent();
 
 			PbufferTest.initGLState(width, height, 0.5f);
-			GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID);
+			glBindTexture(GL_TEXTURE_2D, texID);
 
 			Display.makeCurrent();
 		} catch (LWJGLException e) {
@@ -66,7 +67,7 @@ final class UniqueRenderer extends TextureRenderer {
 
 	public void updateTexture() {
 		// Copy the pbuffer contents to the texture.
-		GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, 0, 0, width, height, 0);
+		glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, width, height, 0);
 	}
 
 }
diff --git a/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRendererRTT.java b/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRendererRTT.java
index 9195b6c..6ea04d9 100644
--- a/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRendererRTT.java
+++ b/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRendererRTT.java
@@ -33,11 +33,12 @@ package org.lwjgl.test.opengl.pbuffers;
 
 import org.lwjgl.LWJGLException;
 import org.lwjgl.opengl.Display;
-import org.lwjgl.opengl.GL11;
 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) {
@@ -56,7 +57,7 @@ final class UniqueRendererRTT extends TextureRenderer {
 			pbuffer.makeCurrent();
 
 			PbufferTest.initGLState(width, height, 0.5f);
-			GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID);
+			glBindTexture(GL_TEXTURE_2D, texID);
 
 			Display.makeCurrent();
 		} catch (LWJGLException e) {
diff --git a/src/java/org/lwjgl/test/opengl/shaders/Shader.java b/src/java/org/lwjgl/test/opengl/shaders/Shader.java
index 26497d8..7f281e0 100644
--- a/src/java/org/lwjgl/test/opengl/shaders/Shader.java
+++ b/src/java/org/lwjgl/test/opengl/shaders/Shader.java
@@ -38,15 +38,17 @@
 package org.lwjgl.test.opengl.shaders;
 
 import org.lwjgl.BufferUtils;
-import org.lwjgl.opengl.ARBProgram;
-import org.lwjgl.opengl.ARBShaderObjects;
-import org.lwjgl.opengl.GL11;
 
 import java.io.BufferedInputStream;
+import java.io.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);
@@ -62,13 +64,11 @@ abstract class Shader {
 		String shader = null;
 
 		try {
-			ClassLoader loader = ShadersTest.class.getClassLoader();
-			InputStream inputStream = loader.getResourceAsStream("org/lwjgl/test/opengl/shaders/" + file);
-
-			if ( inputStream == null )
-				ShadersTest.kill("A shader source file could not be found: " + file);
+			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(inputStream);
+			BufferedInputStream stream = new BufferedInputStream(source);
 
 			byte character;
 			while ( (character = (byte)stream.read()) != -1 )
@@ -91,8 +91,8 @@ abstract class Shader {
 	}
 
 	protected static void checkProgramError(String programFile, String programSource) {
-		if ( GL11.glGetError() == GL11.GL_INVALID_OPERATION ) {
-			final int errorPos = GL11.glGetInteger(ARBProgram.GL_PROGRAM_ERROR_POSITION_ARB);
+		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++ ) {
@@ -111,12 +111,12 @@ abstract class Shader {
 
 			ShadersTest.kill("Low-level program error in file: " + programFile
 			                 + "\n\tError line: " + programSource.substring(lineStart, lineEnd)
-			                 + "\n\tError message: " + GL11.glGetString(ARBProgram.GL_PROGRAM_ERROR_STRING_ARB));
+			                 + "\n\tError message: " + glGetString(GL_PROGRAM_ERROR_STRING_ARB));
 		}
 	}
 
 	protected static int getUniformLocation(int ID, String name) {
-		final int location = ARBShaderObjects.glGetUniformLocationARB(ID, name);
+		final int location = glGetUniformLocationARB(ID, name);
 
 		if ( location == -1 )
 			throw new IllegalArgumentException("The uniform \"" + name + "\" does not exist in the Shader Program.");
@@ -125,24 +125,24 @@ abstract class Shader {
 	}
 
 	protected static void printShaderObjectInfoLog(String file, int ID) {
-		final int logLength = ARBShaderObjects.glGetObjectParameteriARB(ID, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB);
+		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(ARBShaderObjects.glGetInfoLogARB(ID, logLength));
+		System.out.println(glGetInfoLogARB(ID, logLength));
 
 	}
 
 	protected static void printShaderProgramInfoLog(int ID) {
-		final int logLength = ARBShaderObjects.glGetObjectParameteriARB(ID, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB);
+		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(ARBShaderObjects.glGetInfoLogARB(ID, logLength));
+		System.out.println(glGetInfoLogARB(ID, logLength));
 	}
 
 }
diff --git a/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java b/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java
index ea99701..0488a82 100644
--- a/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java
+++ b/src/java/org/lwjgl/test/opengl/shaders/ShaderFP.java
@@ -39,9 +39,10 @@
 package org.lwjgl.test.opengl.shaders;
 
 import org.lwjgl.opengl.ARBFragmentProgram;
-import org.lwjgl.opengl.ARBProgram;
 import org.lwjgl.opengl.ARBVertexProgram;
-import org.lwjgl.opengl.GL11;
+
+import static org.lwjgl.opengl.ARBProgram.*;
+import static org.lwjgl.opengl.GL11.*;
 
 final class ShaderFP extends Shader {
 
@@ -60,10 +61,10 @@ final class ShaderFP extends Shader {
 		vpFile = vpShaderFile;
 		vpSource = getShaderText(vpShaderFile);
 
-		vpID = ARBProgram.glGenProgramsARB();
+		vpID = glGenProgramsARB();
 
-		ARBProgram.glBindProgramARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, vpID);
-		ARBProgram.glProgramStringARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, ARBProgram.GL_PROGRAM_FORMAT_ASCII_ARB, vpSource);
+		glBindProgramARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, vpID);
+		glProgramStringARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, vpSource);
 
 		checkProgramError(vpFile, vpSource);
 
@@ -71,37 +72,37 @@ final class ShaderFP extends Shader {
 		fpFile = fpShaderFile;
 		fpSource = getShaderText(fpShaderFile);
 
-		fpID = ARBProgram.glGenProgramsARB();
+		fpID = glGenProgramsARB();
 
-		ARBProgram.glBindProgramARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, fpID);
-		ARBProgram.glProgramStringARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, ARBProgram.GL_PROGRAM_FORMAT_ASCII_ARB, fpSource);
+		glBindProgramARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, fpID);
+		glProgramStringARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, fpSource);
 
 		checkProgramError(fpFile, fpSource);
 	}
 
 	void render() {
-		GL11.glEnable(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB);
-		ARBProgram.glBindProgramARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, vpID);
+		glEnable(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB);
+		glBindProgramARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, vpID);
 
-		GL11.glEnable(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB);
-		ARBProgram.glBindProgramARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, fpID);
+		glEnable(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB);
+		glBindProgramARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, fpID);
 
-		ARBProgram.glProgramLocalParameter4fARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, 0,
-		                                        ShadersTest.getSin(), ShadersTest.getSpecularity() * 8.0f, 0.0f, 0.0f);
+		glProgramLocalParameter4fARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, 0,
+		                             ShadersTest.getSin(), ShadersTest.getSpecularity() * 8.0f, 0.0f, 0.0f);
 
-		ARBProgram.glProgramLocalParameter4fARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, 0,
-		                                        ShadersTest.getSin(), ShadersTest.getSpecularity() * 8.0f,
-		                                        -ShadersTest.getDisplayWidth() * 0.5f, -ShadersTest.getDisplayHeight() * 0.5f);
+		glProgramLocalParameter4fARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, 0,
+		                             ShadersTest.getSin(), ShadersTest.getSpecularity() * 8.0f,
+		                             -ShadersTest.getDisplayWidth() * 0.5f, -ShadersTest.getDisplayHeight() * 0.5f);
 
 		ShadersTest.renderObject();
 
-		GL11.glDisable(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB);
-		GL11.glDisable(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB);
+		glDisable(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB);
+		glDisable(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB);
 	}
 
 	void cleanup() {
-		ARBProgram.glDeleteProgramsARB(vpID);
-		ARBProgram.glDeleteProgramsARB(fpID);
+		glDeleteProgramsARB(vpID);
+		glDeleteProgramsARB(fpID);
 	}
 
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengl/shaders/ShaderFSH.java b/src/java/org/lwjgl/test/opengl/shaders/ShaderFSH.java
index a90b917..1c1f74a 100644
--- a/src/java/org/lwjgl/test/opengl/shaders/ShaderFSH.java
+++ b/src/java/org/lwjgl/test/opengl/shaders/ShaderFSH.java
@@ -38,10 +38,10 @@
 
 package org.lwjgl.test.opengl.shaders;
 
-import org.lwjgl.opengl.ARBFragmentShader;
-import org.lwjgl.opengl.ARBShaderObjects;
-import org.lwjgl.opengl.ARBVertexShader;
-import org.lwjgl.opengl.GL11;
+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 {
 
@@ -64,64 +64,64 @@ final class ShaderFSH extends Shader {
 		this.vshFile = vshFile;
 		vshSource = getShaderText(vshFile);
 
-		vshID = ARBShaderObjects.glCreateShaderObjectARB(ARBVertexShader.GL_VERTEX_SHADER_ARB);
-		ARBShaderObjects.glShaderSourceARB(vshID, vshSource);
-		ARBShaderObjects.glCompileShaderARB(vshID);
+		vshID = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
+		glShaderSourceARB(vshID, vshSource);
+		glCompileShaderARB(vshID);
 
 		printShaderObjectInfoLog(this.vshFile, vshID);
 
-		if ( ARBShaderObjects.glGetObjectParameteriARB(vshID, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE )
+		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 = ARBShaderObjects.glCreateShaderObjectARB(ARBFragmentShader.GL_FRAGMENT_SHADER_ARB);
-		ARBShaderObjects.glShaderSourceARB(fshID, fshSource);
-		ARBShaderObjects.glCompileShaderARB(fshID);
+		fshID = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
+		glShaderSourceARB(fshID, fshSource);
+		glCompileShaderARB(fshID);
 
 		printShaderObjectInfoLog(this.fshFile, fshID);
 
-		if ( ARBShaderObjects.glGetObjectParameteriARB(fshID, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE )
+		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 = ARBShaderObjects.glCreateProgramObjectARB();
+		programID = glCreateProgramObjectARB();
 
-		ARBShaderObjects.glAttachObjectARB(programID, vshID);
-		ARBShaderObjects.glAttachObjectARB(programID, fshID);
+		glAttachObjectARB(programID, vshID);
+		glAttachObjectARB(programID, fshID);
 
-		ARBShaderObjects.glLinkProgramARB(programID);
+		glLinkProgramARB(programID);
 
 		printShaderProgramInfoLog(programID);
 
-		if ( ARBShaderObjects.glGetObjectParameteriARB(programID, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE )
+		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() {
-		ARBShaderObjects.glUseProgramObjectARB(programID);
+		glUseProgramObjectARB(programID);
 
-		ARBShaderObjects.glUniform4fARB(uniformLocation,
-		                                ShadersTest.getSin(), ShadersTest.getSpecularity() * 8.0f,
-		                                -ShadersTest.getDisplayWidth() * 0.5f, -ShadersTest.getDisplayHeight() * 0.5f);
+		glUniform4fARB(uniformLocation,
+		               ShadersTest.getSin(), ShadersTest.getSpecularity() * 8.0f,
+		               -ShadersTest.getDisplayWidth() * 0.5f, -ShadersTest.getDisplayHeight() * 0.5f);
 
 		ShadersTest.renderObject();
 
-		ARBShaderObjects.glUseProgramObjectARB(0);
+		glUseProgramObjectARB(0);
 	}
 
 	void cleanup() {
-		ARBShaderObjects.glDetachObjectARB(programID, vshID);
-		ARBShaderObjects.glDetachObjectARB(programID, fshID);
+		glDetachObjectARB(programID, vshID);
+		glDetachObjectARB(programID, fshID);
 
-		ARBShaderObjects.glDeleteObjectARB(vshID);
-		ARBShaderObjects.glDeleteObjectARB(fshID);
+		glDeleteObjectARB(vshID);
+		glDeleteObjectARB(fshID);
 
-		ARBShaderObjects.glDeleteObjectARB(programID);
+		glDeleteObjectARB(programID);
 	}
 
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java b/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java
index f5a9e41..dafb244 100644
--- a/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java
+++ b/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java
@@ -43,6 +43,11 @@ 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;
@@ -64,52 +69,52 @@ final class ShaderUNI extends Shader {
 		file = shaderFile;
 		source = getShaderText(shaderFile);
 
-		shaderID = GL20.glCreateShader(GL20.GL_VERTEX_SHADER);
-		GL20.glShaderSource(shaderID, source);
-		GL20.glCompileShader(shaderID);
+		shaderID = glCreateShader(GL_VERTEX_SHADER);
+		glShaderSource(shaderID, source);
+		glCompileShader(shaderID);
 
 		printShaderObjectInfoLog(file, shaderID);
 
-		if ( GL20.glGetShader(shaderID, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE )
+		if ( glGetShader(shaderID, GL_COMPILE_STATUS) == GL_FALSE )
 			ShadersTest.kill("A compilation error occured in a vertex shader.");
 
-		programID = GL20.glCreateProgram();
+		programID = glCreateProgram();
 
-		GL20.glAttachShader(programID, shaderID);
-		GL20.glLinkProgram(programID);
+		glAttachShader(programID, shaderID);
+		glLinkProgram(programID);
 
 		printShaderProgramInfoLog(programID);
 
-		if ( GL20.glGetProgram(programID, GL20.GL_LINK_STATUS) == GL11.GL_FALSE )
+		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 = ARBUniformBufferObject.glGetUniformBlockIndex(programID, "test");
-		final int blockSize = ARBUniformBufferObject.glGetActiveUniformBlock(programID, blockIndex, ARBUniformBufferObject.GL_UNIFORM_BLOCK_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 = GL15.glGenBuffers();
-		GL15.glBindBuffer(ARBUniformBufferObject.GL_UNIFORM_BUFFER, bufferID);
-		GL15.glBufferData(ARBUniformBufferObject.GL_UNIFORM_BUFFER, blockSize, GL15.GL_DYNAMIC_DRAW);
+		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
-		ARBUniformBufferObject.glBindBufferBase(ARBUniformBufferObject.GL_UNIFORM_BUFFER, 0, bufferID);
-		ARBUniformBufferObject.glUniformBlockBinding(programID, blockIndex, 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);
 
-		ARBUniformBufferObject.glGetUniformIndices(programID, uniformNames, indexes);
+		glGetUniformIndices(programID, uniformNames, indexes);
 		uniformA_index = indexes.get(0);
 		uniformB_index = indexes.get(1);
 
-		ARBUniformBufferObject.glGetActiveUniforms(programID, indexes, ARBUniformBufferObject.GL_UNIFORM_OFFSET, params);
+		glGetActiveUniforms(programID, indexes, GL_UNIFORM_OFFSET, params);
 		uniformA_offset = params.get(0);
 		uniformB_offset = params.get(1);
 
@@ -123,7 +128,7 @@ final class ShaderUNI extends Shader {
 	}
 
 	void render() {
-		GL20.glUseProgram(programID);
+		glUseProgram(programID);
 
 		//* -- std140 layout
 		// Uniform A
@@ -131,34 +136,34 @@ final class ShaderUNI extends Shader {
 		// Uniform B - str140 alignment at 16 bytes
 		buffer.put(4, 0.0f).put(5, 0.7f).put(6, 0.0f);
 
-		GL15.glBindBuffer(ARBUniformBufferObject.GL_UNIFORM_BUFFER, bufferID);
-		GL15.glBufferData(ARBUniformBufferObject.GL_UNIFORM_BUFFER, buffer, GL15.GL_DYNAMIC_DRAW);
+		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();
-		GL15.glBufferSubData(ARBUniformBufferObject.GL_UNIFORM_BUFFER, uniformA_offset, buffer);
+		glBufferSubData(GL_UNIFORM_BUFFER, uniformA_offset, buffer);
 		// Uniform B
 		buffer.clear();
 		buffer.put(0.0f).put(0.7f).put(0.0f);
 		buffer.flip();
-		GL15.glBufferSubData(ARBUniformBufferObject.GL_UNIFORM_BUFFER, uniformB_offset, buffer);
+		glBufferSubData(GL_UNIFORM_BUFFER, uniformB_offset, buffer);
 		//*/
 
 		ShadersTest.renderObject();
 
-		GL20.glUseProgram(0);
+		glUseProgram(0);
 	}
 
 	void cleanup() {
-		GL15.glDeleteBuffers(bufferID);
+		glDeleteBuffers(bufferID);
 
-		GL20.glDetachShader(programID, shaderID);
+		glDetachShader(programID, shaderID);
 
-		GL20.glDeleteShader(shaderID);
-		GL20.glDeleteProgram(programID);
+		glDeleteShader(shaderID);
+		glDeleteProgram(programID);
 	}
 
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengl/shaders/ShaderVP.java b/src/java/org/lwjgl/test/opengl/shaders/ShaderVP.java
index 024eac4..a57aab3 100644
--- a/src/java/org/lwjgl/test/opengl/shaders/ShaderVP.java
+++ b/src/java/org/lwjgl/test/opengl/shaders/ShaderVP.java
@@ -38,9 +38,8 @@
 
 package org.lwjgl.test.opengl.shaders;
 
-import org.lwjgl.opengl.ARBProgram;
-import org.lwjgl.opengl.ARBVertexProgram;
-import org.lwjgl.opengl.GL11;
+import static org.lwjgl.opengl.ARBVertexProgram.*;
+import static org.lwjgl.opengl.GL11.*;
 
 final class ShaderVP extends Shader {
 
@@ -53,28 +52,28 @@ final class ShaderVP extends Shader {
 		file = shaderFile;
 		source = getShaderText(shaderFile);
 
-		ID = ARBProgram.glGenProgramsARB();
+		ID = glGenProgramsARB();
 
-		ARBProgram.glBindProgramARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, ID);
-		ARBProgram.glProgramStringARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, ARBProgram.GL_PROGRAM_FORMAT_ASCII_ARB, source);
+		glBindProgramARB(GL_VERTEX_PROGRAM_ARB, ID);
+		glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, source);
 
 		checkProgramError(file, source);
 	}
 
 	void render() {
-		GL11.glEnable(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB);
-		ARBProgram.glBindProgramARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, ID);
+		glEnable(GL_VERTEX_PROGRAM_ARB);
+		glBindProgramARB(GL_VERTEX_PROGRAM_ARB, ID);
 
-		ARBProgram.glProgramLocalParameter4fARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, 0,
-		                                        ShadersTest.getSin(), ShadersTest.getSpecularity() * 8.0f, 0.0f, 0.0f);
+		glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 0,
+		                             ShadersTest.getSin(), ShadersTest.getSpecularity() * 8.0f, 0.0f, 0.0f);
 
 		ShadersTest.renderObject();
 
-		GL11.glDisable(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB);
+		glDisable(GL_VERTEX_PROGRAM_ARB);
 	}
 
 	void cleanup() {
-		ARBProgram.glDeleteProgramsARB(ID);
+		glDeleteProgramsARB(ID);
 	}
 
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengl/shaders/ShaderVSH.java b/src/java/org/lwjgl/test/opengl/shaders/ShaderVSH.java
index 3130154..62ccb78 100644
--- a/src/java/org/lwjgl/test/opengl/shaders/ShaderVSH.java
+++ b/src/java/org/lwjgl/test/opengl/shaders/ShaderVSH.java
@@ -38,9 +38,9 @@
 
 package org.lwjgl.test.opengl.shaders;
 
-import org.lwjgl.opengl.ARBShaderObjects;
-import org.lwjgl.opengl.ARBVertexShader;
-import org.lwjgl.opengl.GL11;
+import static org.lwjgl.opengl.ARBShaderObjects.*;
+import static org.lwjgl.opengl.ARBVertexShader.*;
+import static org.lwjgl.opengl.GL11.*;
 
 final class ShaderVSH extends Shader {
 
@@ -56,43 +56,43 @@ final class ShaderVSH extends Shader {
 		file = shaderFile;
 		source = getShaderText(shaderFile);
 
-		shaderID = ARBShaderObjects.glCreateShaderObjectARB(ARBVertexShader.GL_VERTEX_SHADER_ARB);
-		ARBShaderObjects.glShaderSourceARB(shaderID, source);
-		ARBShaderObjects.glCompileShaderARB(shaderID);
+		shaderID = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
+		glShaderSourceARB(shaderID, source);
+		glCompileShaderARB(shaderID);
 
 		printShaderObjectInfoLog(file, shaderID);
 
-		if ( ARBShaderObjects.glGetObjectParameteriARB(shaderID, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE )
+		if ( glGetObjectParameteriARB(shaderID, GL_OBJECT_COMPILE_STATUS_ARB) == GL_FALSE )
 			ShadersTest.kill("A compilation error occured in a vertex shader.");
 
-		programID = ARBShaderObjects.glCreateProgramObjectARB();
+		programID = glCreateProgramObjectARB();
 
-		ARBShaderObjects.glAttachObjectARB(programID, shaderID);
-		ARBShaderObjects.glLinkProgramARB(programID);
+		glAttachObjectARB(programID, shaderID);
+		glLinkProgramARB(programID);
 
 		printShaderProgramInfoLog(programID);
 
-		if ( ARBShaderObjects.glGetObjectParameteriARB(programID, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE )
+		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() {
-		ARBShaderObjects.glUseProgramObjectARB(programID);
+		glUseProgramObjectARB(programID);
 
-		ARBShaderObjects.glUniform2fARB(uniformLocation, ShadersTest.getSin(), ShadersTest.getSpecularity() * 8.0f);
+		glUniform2fARB(uniformLocation, ShadersTest.getSin(), ShadersTest.getSpecularity() * 8.0f);
 
 		ShadersTest.renderObject();
 
-		ARBShaderObjects.glUseProgramObjectARB(0);
+		glUseProgramObjectARB(0);
 	}
 
 	void cleanup() {
-		ARBShaderObjects.glDetachObjectARB(programID, shaderID);
+		glDetachObjectARB(programID, shaderID);
 
-		ARBShaderObjects.glDeleteObjectARB(shaderID);
-		ARBShaderObjects.glDeleteObjectARB(programID);
+		glDeleteObjectARB(shaderID);
+		glDeleteObjectARB(programID);
 	}
 
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java b/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java
index e7a977e..ffcbeb4 100644
--- a/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java
+++ b/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java
@@ -46,9 +46,11 @@ import org.lwjgl.Sys;
 import org.lwjgl.input.Keyboard;
 import org.lwjgl.input.Mouse;
 import org.lwjgl.opengl.*;
-import org.lwjgl.util.glu.GLU;
 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;
@@ -94,7 +96,7 @@ public final class ShadersTest {
 
 				handleIO();
 
-				GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
+				glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
 				if ( shader != null )
 					shader.render();
@@ -102,8 +104,8 @@ public final class ShadersTest {
 					renderObject();
 
 				// Restore camera position.
-				GL11.glPopMatrix();
-				GL11.glPushMatrix();
+				glPopMatrix();
+				glPushMatrix();
 			}
 
 			Display.update();
@@ -178,65 +180,65 @@ public final class ShadersTest {
 			argsError();
 		}
 
-		GL11.glViewport(0, 0, displayMode.getWidth(), displayMode.getHeight());
+		glViewport(0, 0, displayMode.getWidth(), displayMode.getHeight());
 
-		GL11.glMatrixMode(GL11.GL_PROJECTION);
-		GL11.glLoadIdentity();
-		GLU.gluPerspective(45, displayMode.getWidth() / (float)displayMode.getHeight(), 1.0f, 10.0f);
+		glMatrixMode(GL_PROJECTION);
+		glLoadIdentity();
+		gluPerspective(45, displayMode.getWidth() / (float)displayMode.getHeight(), 1.0f, 10.0f);
 
-		GL11.glMatrixMode(GL11.GL_MODELVIEW);
-		GL11.glLoadIdentity();
+		glMatrixMode(GL_MODELVIEW);
+		glLoadIdentity();
 
 		// Setup camera position.
-		GL11.glTranslatef(0.0f, 0.0f, -4.0f);
-		GL11.glRotatef(15.0f, 1.0f, 0.0f, 0.0f);
-		GL11.glPushMatrix();
+		glTranslatef(0.0f, 0.0f, -4.0f);
+		glRotatef(15.0f, 1.0f, 0.0f, 0.0f);
+		glPushMatrix();
 
-		GL11.glClearDepth(1.0f);
-		GL11.glDepthFunc(GL11.GL_LEQUAL);
+		glClearDepth(1.0f);
+		glDepthFunc(GL_LEQUAL);
 
-		GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
+		glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
 
-		GL11.glFrontFace(GL11.GL_CCW);
-		GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
+		glFrontFace(GL_CCW);
+		glPolygonMode(GL_FRONT, GL_FILL);
 
-		GL11.glCullFace(GL11.GL_BACK);
-		GL11.glEnable(GL11.GL_CULL_FACE);
+		glCullFace(GL_BACK);
+		glEnable(GL_CULL_FACE);
 
-		GL11.glAlphaFunc(GL11.GL_NOTEQUAL, 0.0f);
-		GL11.glEnable(GL11.GL_ALPHA_TEST);
+		glAlphaFunc(GL_NOTEQUAL, 0.0f);
+		glEnable(GL_ALPHA_TEST);
 
-		GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
-		GL11.glEnable(GL11.GL_BLEND);
+		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+		glEnable(GL_BLEND);
 
 		// Setup lighting for when we have fixed function fragment rendering.
-		GL11.glShadeModel(GL11.GL_SMOOTH);
+		glShadeModel(GL_SMOOTH);
 
 		if ( shader == null ) {
-			GL11.glEnable(GL11.GL_LIGHTING);
-			GL11.glEnable(GL11.GL_LIGHT0);
+			glEnable(GL_LIGHTING);
+			glEnable(GL_LIGHT0);
 		}
 
 		vectorBuffer.clear();
 		vectorBuffer.put(1.0f).put(1.0f).put(1.0f).put(1.0f);
 		vectorBuffer.clear();
-		GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, vectorBuffer);
+		glLight(GL_LIGHT0, GL_DIFFUSE, vectorBuffer);
 
 		vectorBuffer.put(1.0f).put(1.0f).put(1.0f).put(1.0f);
 		vectorBuffer.clear();
-		GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, vectorBuffer);
+		glLight(GL_LIGHT0, GL_AMBIENT, vectorBuffer);
 
 		vectorBuffer.put(1.0f).put(1.0f).put(0.5f).put(1.0f);
 		vectorBuffer.clear();
-		GL11.glLight(GL11.GL_LIGHT0, GL11.GL_SPECULAR, vectorBuffer);
+		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();
-		GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, vectorBuffer);
+		glLight(GL_LIGHT0, GL_POSITION, vectorBuffer);
 
 		vectorBuffer.put(0.2f).put(0.2f).put(0.2f).put(1.0f);
 		vectorBuffer.clear();
-		GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, vectorBuffer);
+		glLightModel(GL_LIGHT_MODEL_AMBIENT, vectorBuffer);
 
 		sphere = new Sphere();
 	}
@@ -283,15 +285,14 @@ public final class ShadersTest {
 	}
 
 	static void renderObject() {
-		GL11.glColor3b((byte)255, (byte)255, (byte)255);
+		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 ( int i = 0; i < modes.length; i++ ) {
-			DisplayMode mode = modes[i];
+		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;
diff --git a/src/java/org/lwjgl/util/Display.java b/src/java/org/lwjgl/util/Display.java
index 7996b11..00eef0d 100644
--- a/src/java/org/lwjgl/util/Display.java
+++ b/src/java/org/lwjgl/util/Display.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -42,18 +42,18 @@ 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: matzon $
- * @version $Revision: 2983 $
- * $Id: Display.java 2983 2008-04-07 18:36:09Z matzon $
+ * @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
@@ -69,15 +69,15 @@ public final class Display {
 	{
 		// First get the available display modes
 		DisplayMode[] modes = org.lwjgl.opengl.Display.getAvailableDisplayModes();
-		
+
 		if (LWJGLUtil.DEBUG || DEBUG) {
 			System.out.println("Available screen modes:");
-			for (int i = 0; i < modes.length; i ++) {
-				System.out.println(modes[i]);
+			for ( DisplayMode mode : modes ) {
+				System.out.println(mode);
 			}
 		}
-		
-		ArrayList matches = new ArrayList(modes.length);
+
+		ArrayList<DisplayMode> matches = new ArrayList<DisplayMode>(modes.length);
 
 		for (int i = 0; i < modes.length; i ++) {
 			assert modes[i] != null : ""+i+" "+modes.length;
@@ -103,19 +103,19 @@ public final class Display {
 			}
 			matches.add(modes[i]);
 		}
-		
+
 		DisplayMode[] ret = new DisplayMode[matches.size()];
 		matches.toArray(ret);
 		if (LWJGLUtil.DEBUG && DEBUG) {
 			System.out.println("Filtered screen modes:");
-			for (int i = 0; i < ret.length; i ++) {
-				System.out.println(ret[i]);
+			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(),
@@ -130,7 +130,7 @@ public final class Display {
 	 * @see org.lwjgl.opengl.DisplayMode
 	 */
 	public static DisplayMode setDisplayMode(DisplayMode[] dm, final String[] param) throws Exception {
-		
+
 		class FieldAccessor {
 			final String fieldName;
 			final int order;
@@ -158,89 +158,86 @@ public final class Display {
 				throw new IllegalArgumentException("Unknown field "+fieldName);
 			}
 		}
-		
-		class Sorter implements Comparator {
-			
-			final FieldAccessor[] field;
-			
+
+		class Sorter implements Comparator<DisplayMode> {
+
+			final FieldAccessor[] accessors;
+
 			Sorter() {
-				field = new FieldAccessor[param.length];
-				for (int i = 0; i < field.length; i ++) {
+				accessors = new FieldAccessor[param.length];
+				for (int i = 0; i < accessors.length; i ++) {
 					int idx = param[i].indexOf('=');
 					if (idx > 0) {
-						field[i] = new FieldAccessor(param[i].substring(0, idx), 0, Integer.parseInt(param[i].substring(idx + 1, param[i].length())), true);
+						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) == '-') {
-						field[i] = new FieldAccessor(param[i].substring(1), -1, 0, false);
+						accessors[i] = new FieldAccessor(param[i].substring(1), -1, 0, false);
 					} else {
-						field[i] = new FieldAccessor(param[i], 1, 0, false);
+						accessors[i] = new FieldAccessor(param[i], 1, 0, false);
 					}
 				}
 			}
-			
+
 			/**
 			 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
 			 */
-			public int compare(Object o1, Object o2) {
-				DisplayMode dm1 = (DisplayMode) o1;
-				DisplayMode dm2 = (DisplayMode) o2;
-				
-				for (int i = 0; i < field.length; i ++) {
-					int f1 = field[i].getInt(dm1);
-					int f2 = field[i].getInt(dm2);
-					
-					if (field[i].usePreferred && f1 != f2) {
-						if (f1 == field[i].preferred)
+			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 == field[i].preferred)
+						else if ( f2 == accessor.preferred )
 							return 1;
 						else {
 							// Score according to the difference between the values
-							int absf1 = Math.abs(f1 - field[i].preferred);
-							int absf2 = Math.abs(f2 - field[i].preferred);
-							if (absf1 < absf2)
+							int absf1 = Math.abs(f1 - accessor.preferred);
+							int absf2 = Math.abs(f2 - accessor.preferred);
+							if ( absf1 < absf2 )
 								return -1;
-							else if (absf1 > absf2)
+							else if ( absf1 > absf2 )
 								return 1;
 							else
 								continue;
 						}
-					} else if (f1 < f2)
-						return field[i].order;
-					else if (f1 == f2)
+					} else if ( f1 < f2 )
+						return accessor.order;
+					else if ( f1 == f2 )
 						continue;
 					else
-						return -field[i].order;
+						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 (int i = 0; i < dm.length; i ++) {
-				System.out.println(dm[i]);
+			for ( DisplayMode aDm : dm ) {
+				System.out.println(aDm);
 			}
 		}
-		for (int i = 0; i < dm.length; i ++) {
+		for ( DisplayMode aDm : dm ) {
 			try {
-				if (LWJGLUtil.DEBUG || DEBUG)
-					System.out.println("Attempting to set displaymode: "+dm[i]);
-				org.lwjgl.opengl.Display.setDisplayMode(dm[i]);
-				return dm[i];
+				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 "+dm[i]);
+				if ( LWJGLUtil.DEBUG || DEBUG ) {
+					System.out.println("Failed to set display mode to " + aDm);
 					e.printStackTrace();
 				}
 			}
 		}
-		
+
 		throw new Exception("Failed to set display mode.");
 	}
-	
+
 }
diff --git a/src/java/org/lwjgl/util/ReadableColor.java b/src/java/org/lwjgl/util/ReadableColor.java
index ce0491d..26742ea 100644
--- a/src/java/org/lwjgl/util/ReadableColor.java
+++ b/src/java/org/lwjgl/util/ReadableColor.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -35,9 +35,9 @@ import java.nio.ByteBuffer;
 
 /**
  * Readonly interface for Colors
- * @author $Author: matzon $
- * @version $Revision: 2983 $
- * $Id: ReadableColor.java 2983 2008-04-07 18:36:09Z matzon $
+ * @author $Author: spasi $
+ * @version $Revision: 3418 $
+ * $Id: ReadableColor.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public interface ReadableColor {
 
@@ -45,102 +45,102 @@ public interface ReadableColor {
 	 * Return the red component (0..255)
 	 * @return int
 	 */
-	public int getRed();
-	
+	int getRed();
+
 	/**
 	 * Return the red component (0..255)
 	 * @return int
 	 */
-	public int getGreen();
-	
+	int getGreen();
+
 	/**
 	 * Return the red component (0..255)
 	 * @return int
 	 */
-	public int getBlue();
-	
+	int getBlue();
+
 	/**
 	 * Return the red component (0..255)
 	 * @return int
 	 */
-	public int getAlpha();
-	
+	int getAlpha();
+
 	/**
 	 * Return the red component
 	 * @return int
 	 */
-	public byte getRedByte();
-	
+	byte getRedByte();
+
 	/**
 	 * Return the red component
 	 * @return int
 	 */
-	public byte getGreenByte();
-	
+	byte getGreenByte();
+
 	/**
 	 * Return the red component
 	 * @return int
 	 */
-	public byte getBlueByte();
-	
+	byte getBlueByte();
+
 	/**
 	 * Return the red component
 	 * @return int
 	 */
-	public byte getAlphaByte();
-	
+	byte getAlphaByte();
+
 	/**
 	 * Write the RGBA color directly out to a ByteBuffer
 	 * @param dest the buffer to write to
 	 */
-	public void writeRGBA(ByteBuffer dest);
-	
+	void writeRGBA(ByteBuffer dest);
+
 	/**
 	 * Write the RGB color directly out to a ByteBuffer
 	 * @param dest the buffer to write to
 	 */
-	public void writeRGB(ByteBuffer dest);
-	
+	void writeRGB(ByteBuffer dest);
+
 	/**
 	 * Write the ABGR color directly out to a ByteBuffer
 	 * @param dest the buffer to write to
 	 */
-	public void writeABGR(ByteBuffer dest);
-	
+	void writeABGR(ByteBuffer dest);
+
 	/**
 	 * Write the BGR color directly out to a ByteBuffer
 	 * @param dest the buffer to write to
 	 */
-	public void writeBGR(ByteBuffer dest);
-	
+	void writeBGR(ByteBuffer dest);
+
 	/**
 	 * Write the BGRA color directly out to a ByteBuffer
 	 * @param dest the buffer to write to
 	 */
-	public void writeBGRA(ByteBuffer dest);
-	
+	void writeBGRA(ByteBuffer dest);
+
 	/**
 	 * Write the ARGB color directly out to a ByteBuffer
 	 * @param dest the buffer to write to
 	 */
-	public void writeARGB(ByteBuffer dest);
-	
+	void writeARGB(ByteBuffer dest);
+
 	/*
 	 * Some standard colors
 	 */
-	public static final ReadableColor RED = new Color(255, 0, 0);
-	public static final ReadableColor ORANGE = new Color(255, 128, 0);
-	public static final ReadableColor YELLOW = new Color(255, 255, 0);
-	public static final ReadableColor GREEN = new Color(0, 255, 0);
-	public static final ReadableColor CYAN = new Color(0, 255, 255);
-	public static final ReadableColor BLUE = new Color(0, 0, 255);
-	public static final ReadableColor PURPLE = new Color(255, 0, 255);
-	public static final ReadableColor WHITE = new Color(255, 255, 255);
-	public static final ReadableColor BLACK = new Color(0, 0, 0);
-	public static final ReadableColor LTGREY = new Color(192, 192, 192);
-	public static final ReadableColor DKGREY = new Color(64, 64, 64);
-	public static final ReadableColor GREY = new Color(128, 128, 128);
-
-
-	
+	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);
+
+
+
 }
diff --git a/src/java/org/lwjgl/util/ReadableDimension.java b/src/java/org/lwjgl/util/ReadableDimension.java
index a14a55f..1bbabd2 100644
--- a/src/java/org/lwjgl/util/ReadableDimension.java
+++ b/src/java/org/lwjgl/util/ReadableDimension.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -33,9 +33,9 @@ package org.lwjgl.util;
 
 /**
  * Readonly interface for Dimensions
- * @author $Author: matzon $
- * @version $Revision: 2983 $
- * $Id: ReadableDimension.java 2983 2008-04-07 18:36:09Z matzon $
+ * @author $Author: spasi $
+ * @version $Revision: 3418 $
+ * $Id: ReadableDimension.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public interface ReadableDimension {
 
@@ -43,18 +43,18 @@ public interface ReadableDimension {
 	 * Get the width
 	 * @return int
 	 */
-	public int getWidth();
-	
+	int getWidth();
+
 	/**
 	 * Get the height
 	 * @return int
 	 */
-	public int getHeight();
-	
+	int getHeight();
+
 	/**
 	 * Copy this ReadableDimension into a destination Dimension
 	 * @param dest The destination
 	 */
-	public void getSize(WritableDimension dest);
+	void getSize(WritableDimension dest);
 
 }
diff --git a/src/java/org/lwjgl/util/ReadablePoint.java b/src/java/org/lwjgl/util/ReadablePoint.java
index 6b8a32d..77743a9 100644
--- a/src/java/org/lwjgl/util/ReadablePoint.java
+++ b/src/java/org/lwjgl/util/ReadablePoint.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -33,25 +33,25 @@ package org.lwjgl.util;
 
 /**
  * Readonly interface for Points
- * @author $Author: matzon $
- * @version $Revision: 2983 $
- * $Id: ReadablePoint.java 2983 2008-04-07 18:36:09Z matzon $
+ * @author $Author: spasi $
+ * @version $Revision: 3418 $
+ * $Id: ReadablePoint.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public interface ReadablePoint {
 
 	/**
 	 * @return int
 	 */
-	public int getX();
-	
+	int getX();
+
 	/**
 	 * @return int
 	 */
-	public int getY();
-	
+	int getY();
+
 	/**
 	 * Copy this ReadablePoint into a destination Point
 	 * @param dest The destination Point, or null, to create a new Point
 	 */
-	public void getLocation(WritablePoint dest);
+	void getLocation(WritablePoint dest);
 }
diff --git a/src/java/org/lwjgl/util/ReadableRectangle.java b/src/java/org/lwjgl/util/ReadableRectangle.java
index 22bad2f..095023a 100644
--- a/src/java/org/lwjgl/util/ReadableRectangle.java
+++ b/src/java/org/lwjgl/util/ReadableRectangle.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -33,16 +33,16 @@ package org.lwjgl.util;
 
 /**
  * Readonly interface for Rectangles
- * @author $Author: matzon $
- * @version $Revision: 2983 $
- * $Id: ReadableRectangle.java 2983 2008-04-07 18:36:09Z matzon $
+ * @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
 	 */
-	public void getBounds(WritableRectangle dest);
+	void getBounds(WritableRectangle dest);
 
 }
diff --git a/src/java/org/lwjgl/util/Renderable.java b/src/java/org/lwjgl/util/Renderable.java
index 9c79586..4a0ce55 100644
--- a/src/java/org/lwjgl/util/Renderable.java
+++ b/src/java/org/lwjgl/util/Renderable.java
@@ -1,49 +1,49 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 package org.lwjgl.util;
 
 /**
- * 
+ *
  * Simple interface to things that can be Rendered.
- * 
- * @author $Author: matzon $
- * @version $Revision: 2983 $
- * $Id: Renderable.java 2983 2008-04-07 18:36:09Z matzon $
+ *
+ * @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.
 	 */
-	public void render();
-	
+	void render();
+
 }
diff --git a/src/java/org/lwjgl/util/Timer.java b/src/java/org/lwjgl/util/Timer.java
index 0b6de48..d6ceaed 100644
--- a/src/java/org/lwjgl/util/Timer.java
+++ b/src/java/org/lwjgl/util/Timer.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -39,36 +39,36 @@ import org.lwjgl.Sys;
  * 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 <cix_foo at users.sourceforge.net>
- * @version $Revision: 2983 $
- * $Id: Timer.java 2983 2008-04-07 18:36:09Z matzon $
+ * @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 = 0;
+	private static int queryCount;
 
-	// Globally keeps track of time for all instances of Timer	
+	// 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.
 	 */
@@ -76,7 +76,7 @@ public class Timer {
 		reset();
 		resume();
 	}
-	
+
 	/**
 	 * @return the time in seconds, as a float
 	 */
@@ -93,17 +93,17 @@ public class Timer {
 	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)
@@ -111,7 +111,7 @@ public class Timer {
 	public void reset() {
 		set(0.0f);
 	}
-	
+
 	/**
 	 * Resume the timer.
 	 * @see #pause()
@@ -120,7 +120,7 @@ public class Timer {
 		paused = false;
 		startTime = currentTime - lastTime;
 	}
-	
+
 	/**
 	 * Set the time of this timer
 	 * @param newTime the new time, in seconds
@@ -130,7 +130,7 @@ public class Timer {
 		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
@@ -138,7 +138,7 @@ public class Timer {
 	 */
 	public static void tick() {
 		currentTime = Sys.getTime();
-		
+
 		// Periodically refresh the timer resolution:
 		queryCount ++;
 		if (queryCount > QUERY_INTERVAL) {
@@ -146,7 +146,7 @@ public class Timer {
 			resolution = Sys.getTimerResolution();
 		}
 	}
-	
+
 	/**
 	 * Debug output.
 	 */
diff --git a/src/java/org/lwjgl/util/WaveData.java b/src/java/org/lwjgl/util/WaveData.java
index d1389aa..18d1743 100644
--- a/src/java/org/lwjgl/util/WaveData.java
+++ b/src/java/org/lwjgl/util/WaveData.java
@@ -46,13 +46,15 @@ import javax.sound.sampled.AudioSystem;
 
 import org.lwjgl.openal.AL10;
 
+import com.sun.media.sound.WaveFileReader;
+
 /**
  *
  * Utitlity class for loading wavefiles.
  *
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 3336 $
- * $Id: WaveData.java 3336 2010-04-26 21:52:59Z matzon $
+ * @version $Revision: 3438 $
+ * $Id: WaveData.java 3438 2010-10-12 15:34:26Z matzon $
  */
 public class WaveData {
 	/** actual wave data */
@@ -92,9 +94,11 @@ public class WaveData {
 	 */
 	public static WaveData create(URL path) {
 		try {
-			return create(
-				AudioSystem.getAudioInputStream(
-					new BufferedInputStream(path.openStream())));
+			// 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;
diff --git a/src/java/org/lwjgl/util/WritableColor.java b/src/java/org/lwjgl/util/WritableColor.java
index 3c29e31..de8c26b 100644
--- a/src/java/org/lwjgl/util/WritableColor.java
+++ b/src/java/org/lwjgl/util/WritableColor.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -35,92 +35,92 @@ import java.nio.ByteBuffer;
 
 /**
  * Write interface for Colors
- * @author $Author: matzon $
- * @version $Revision: 2983 $
- * $Id: WritableColor.java 2983 2008-04-07 18:36:09Z matzon $
+ * @author $Author: spasi $
+ * @version $Revision: 3418 $
+ * $Id: WritableColor.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public interface WritableColor {
 	/**
 	 * Set a color
 	 */
-	public void set(int r, int g, int b, int a);
+	void set(int r, int g, int b, int a);
 	/**
 	 * Set a color
 	 */
-	public void set(byte r, byte g, byte b, byte a);
+	void set(byte r, byte g, byte b, byte a);
 	/**
 	 * Set a color
 	 */
-	public void set(int r, int g, int b);
+	void set(int r, int g, int b);
 	/**
 	 * Set a color
 	 */
-	public void set(byte r, byte g, byte b);
+	void set(byte r, byte g, byte b);
 	/**
 	 * Set the Red component
 	 */
-	public void setRed(int red);
+	void setRed(int red);
 	/**
 	 * Set the Green component
 	 */
-	public void setGreen(int green);
+	void setGreen(int green);
 	/**
 	 * Set the Blue component
 	 */
-	public void setBlue(int blue);
+	void setBlue(int blue);
 	/**
 	 * Set the Alpha component
 	 */
-	public void setAlpha(int alpha);
+	void setAlpha(int alpha);
 	/**
 	 * Set the Red component
 	 */
-	public void setRed(byte red);
+	void setRed(byte red);
 	/**
 	 * Set the Green component
 	 */
-	public void setGreen(byte green);
+	void setGreen(byte green);
 	/**
 	 * Set the Blue component
 	 */
-	public void setBlue(byte blue);
+	void setBlue(byte blue);
 	/**
 	 * Set the Alpha component
 	 */
-	public void setAlpha(byte alpha);
+	void setAlpha(byte alpha);
 	/**
 	 * Read a color from a byte buffer
 	 * @param src The source buffer
 	 */
-	public void readRGBA(ByteBuffer src);
+	void readRGBA(ByteBuffer src);
 	/**
 	 * Read a color from a byte buffer
 	 * @param src The source buffer
 	 */
-	public void readRGB(ByteBuffer src);
+	void readRGB(ByteBuffer src);
 	/**
 	 * Read a color from a byte buffer
 	 * @param src The source buffer
 	 */
-	public void readARGB(ByteBuffer src);
+	void readARGB(ByteBuffer src);
 	/**
 	 * Read a color from a byte buffer
 	 * @param src The source buffer
 	 */
-	public void readBGRA(ByteBuffer src);
+	void readBGRA(ByteBuffer src);
 	/**
 	 * Read a color from a byte buffer
 	 * @param src The source buffer
 	 */
-	public void readBGR(ByteBuffer src);
+	void readBGR(ByteBuffer src);
 	/**
 	 * Read a color from a byte buffer
 	 * @param src The source buffer
 	 */
-	public void readABGR(ByteBuffer src);
+	void readABGR(ByteBuffer src);
 	/**
 	 * Set this color's color by copying another color
 	 * @param src The source color
 	 */
-	public void setColor(ReadableColor src);
+	void setColor(ReadableColor src);
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/WritableDimension.java b/src/java/org/lwjgl/util/WritableDimension.java
index a3ee3dc..15e4f84 100644
--- a/src/java/org/lwjgl/util/WritableDimension.java
+++ b/src/java/org/lwjgl/util/WritableDimension.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -33,22 +33,22 @@ package org.lwjgl.util;
 
 /**
  * Write interface for Dimensions
- * @author $Author: matzon $
- * @version $Revision: 2983 $
- * $Id: WritableDimension.java 2983 2008-04-07 18:36:09Z matzon $
+ * @author $Author: spasi $
+ * @version $Revision: 3418 $
+ * $Id: WritableDimension.java 3418 2010-09-28 21:11:35Z spasi $
 
  */
 public interface WritableDimension {
-	public void setSize(int w, int h);
-	public void setSize(ReadableDimension d);
+	void setSize(int w, int h);
+	void setSize(ReadableDimension d);
 	/**
 	 * Sets the height.
 	 * @param height The height to set
 	 */
-	public void setHeight(int height);
+	void setHeight(int height);
 	/**
 	 * Sets the width.
 	 * @param width The width to set
 	 */
-	public void setWidth(int width);
+	void setWidth(int width);
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/WritablePoint.java b/src/java/org/lwjgl/util/WritablePoint.java
index 705d257..626f675 100644
--- a/src/java/org/lwjgl/util/WritablePoint.java
+++ b/src/java/org/lwjgl/util/WritablePoint.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -33,13 +33,13 @@ package org.lwjgl.util;
 
 /**
  * Write interface for Points
- * @author $Author: matzon $
- * @version $Revision: 2983 $
- * $Id: WritablePoint.java 2983 2008-04-07 18:36:09Z matzon $
+ * @author $Author: spasi $
+ * @version $Revision: 3418 $
+ * $Id: WritablePoint.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public interface WritablePoint {
-	public void setLocation(int x, int y);
-	public void setLocation(ReadablePoint p);
-	public void setX(int x);
-	public void setY(int y);
+	void setLocation(int x, int y);
+	void setLocation(ReadablePoint p);
+	void setX(int x);
+	void setY(int y);
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/WritableRectangle.java b/src/java/org/lwjgl/util/WritableRectangle.java
index 8fb20dc..10822db 100644
--- a/src/java/org/lwjgl/util/WritableRectangle.java
+++ b/src/java/org/lwjgl/util/WritableRectangle.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -33,12 +33,12 @@ package org.lwjgl.util;
 
 /**
  * Write interface for Rectangles
- * @author $Author: matzon $
- * @version $Revision: 2983 $
- * $Id: WritableRectangle.java 2983 2008-04-07 18:36:09Z matzon $
+ * @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
@@ -46,18 +46,18 @@ public interface WritableRectangle extends WritablePoint, WritableDimension {
    * @param width Width of rectangle
    * @param height Height of rectangle
 	 */
-	public void setBounds(int x, int y, int width, int height);
-	
+	void setBounds(int x, int y, int width, int height);
+
 	/**
 	 * Sets the bounds of the rectangle
 	 * @param location
 	 * @param size
 	 */
-	public void setBounds(ReadablePoint location, ReadableDimension size);
-	
+	void setBounds(ReadablePoint location, ReadableDimension size);
+
 	/**
 	 * Sets the bounds of the rectangle
 	 * @param src
 	 */
-	public void setBounds(ReadableRectangle src);
+	void setBounds(ReadableRectangle src);
 }
diff --git a/src/java/org/lwjgl/util/XPMFile.java b/src/java/org/lwjgl/util/XPMFile.java
index 7a598ed..9b71de0 100644
--- a/src/java/org/lwjgl/util/XPMFile.java
+++ b/src/java/org/lwjgl/util/XPMFile.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -46,7 +46,7 @@ import java.util.StringTokenizer;
  * <p>
  * NOTE: This simple XPM reader does not support extensions nor hotspots
  * </p>
- * 
+ *
  * @author Brian Matzon <brian at matzon.dk>
  * @author Jos Hirth
  * @version $Revision$
@@ -56,15 +56,15 @@ import java.util.StringTokenizer;
 public class XPMFile {
 
 	/** Array of bytes (RGBA) */
-	private byte bytes[] = null;
+	private byte bytes[];
 
-	private final static int WIDTH = 0;
+	private static final int WIDTH = 0;
 
-	private final static int HEIGHT = 1;
+	private static final int HEIGHT = 1;
 
-	private final static int NUMBER_OF_COLORS = 2;
+	private static final int NUMBER_OF_COLORS = 2;
 
-	private final static int CHARACTERS_PER_PIXEL = 3;
+	private static final int CHARACTERS_PER_PIXEL = 3;
 
 	private static int[] format = new int[4];
 
@@ -76,7 +76,7 @@ public class XPMFile {
 
 	/**
 	 * Loads the XPM file
-	 * 
+	 *
 	 * @param file
 	 *            path to file
 	 * @return XPMFile loaded, or exception
@@ -89,7 +89,7 @@ public class XPMFile {
 
 	/**
 	 * Loads the XPM file
-	 * 
+	 *
 	 * @param is
 	 *            InputStream to read file from
 	 * @return XPMFile loaded, or exception
@@ -128,14 +128,14 @@ public class XPMFile {
 		try {
 			LineNumberReader reader = new LineNumberReader(
 					new InputStreamReader(is));
-			HashMap colors = new HashMap();
+			HashMap<String, Integer> colors = new HashMap<String, Integer>();
 
 			format = parseFormat(nextLineOfInterest(reader));
 
 			// setup color mapping
 			for (int i = 0; i < format[NUMBER_OF_COLORS]; i++) {
 				Object[] colorDefinition = parseColor(nextLineOfInterest(reader));
-				colors.put(colorDefinition[0], colorDefinition[1]);
+				colors.put((String)colorDefinition[0], (Integer)colorDefinition[1]);
 			}
 
 			// read actual image (convert to RGBA)
@@ -151,14 +151,14 @@ public class XPMFile {
 
 	/**
 	 * 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 String nextLineOfInterest(LineNumberReader reader)
+	private static String nextLineOfInterest(LineNumberReader reader)
 			throws IOException {
 		String ret;
 		do {
@@ -170,12 +170,12 @@ public class XPMFile {
 
 	/**
 	 * 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 int[] parseFormat(String format) {
+	private static int[] parseFormat(String format) {
 		// format should look like this:
 		// 16 16 122 2
 
@@ -192,12 +192,12 @@ public class XPMFile {
 	/**
 	 * 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 Object[] parseColor(String line) {
+	private static Object[] parseColor(String line) {
 		// line should look like this:
 		// # c #0A0A0A
 
@@ -211,12 +211,12 @@ public class XPMFile {
 		String color = line.substring(format[CHARACTERS_PER_PIXEL] + 4);
 
 		// we always assume type is color, and supplied as #<r><g><b>
-		return new Object[] { key, new Integer(Integer.parseInt(color, 16)) };
+		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
@@ -226,7 +226,7 @@ public class XPMFile {
 	 * @param index
 	 *            current index into lines, we've reached
 	 */
-	private void parseImageLine(String line, int[] format, HashMap colors,
+	private void parseImageLine(String line, int[] format, HashMap<String, Integer> colors,
 			int index) {
 		// offset for next line
 		int offset = index * 4 * format[WIDTH];
@@ -238,10 +238,10 @@ public class XPMFile {
 					.substring(
 							i * format[CHARACTERS_PER_PIXEL],
 							(i * format[CHARACTERS_PER_PIXEL] + format[CHARACTERS_PER_PIXEL]));
-			Integer color = (Integer) colors.get(key);
-			bytes[offset + (i * 4)] = (byte) ((color.intValue() & 0x00ff0000) >> 16);
-			bytes[offset + ((i * 4) + 1)] = (byte) ((color.intValue() & 0x0000ff00) >> 8);
-			bytes[offset + ((i * 4) + 2)] = (byte) ((color.intValue() & 0x000000ff) >> 0); // looks
+			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
diff --git a/src/java/org/lwjgl/util/applet/AppletLoader.java b/src/java/org/lwjgl/util/applet/AppletLoader.java
index 88b6b55..4f14057 100644
--- a/src/java/org/lwjgl/util/applet/AppletLoader.java
+++ b/src/java/org/lwjgl/util/applet/AppletLoader.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -35,6 +35,7 @@ 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;
@@ -78,6 +79,7 @@ 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;
 
@@ -88,7 +90,7 @@ import sun.security.util.SecurityConstants;
  * while the relevant jars (generic and native) are downloaded from a specified source.
  * </p>
  * <p>
- * The downloaded jars are extracted to the users temporary directory - and if enabled, cached for 
+ * The downloaded jars are extracted to the users temporary directory - and if enabled, cached for
  * faster loading in future uses.
  * </p>
  * <p>
@@ -108,7 +110,7 @@ import sun.security.util.SecurityConstants;
  * <p>
  * Additionally the following parameters can be supplied to tweak the behaviour of the AppletLoader.
  * <ul>
- * <li>al_version - [int or float] Version of deployment. If this is specified, the jars will be cached and 
+ * <li>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.</li>
  * <li>al_cache - [boolean] Whether to use cache system. <i>Default: true</i>.</li>
  * <li>al_debug - [boolean] Whether to enable debug mode. <i>Default: false</i>.</li>
@@ -129,172 +131,171 @@ import sun.security.util.SecurityConstants;
  * $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; 
+	protected int		currentSizeDownload;
 
 	/** total size of download in bytes */
-	protected int		totalSizeDownload; 
+	protected int		totalSizeDownload;
 
 	/** current size of extracted in bytes */
-	protected int		currentSizeExtract; 
+	protected int		currentSizeExtract;
 
 	/** total size of extracted in bytes */
-	protected int		totalSizeExtract; 
-	
+	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;	
+	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;
-	
-	/** fatal error that occured */
-	protected String	fatalErrorDescription;
-	
+
 	/** 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;
-	
+	protected HashMap<String, Long> 	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 int		state = STATE_INIT;
-	
+	protected volatile int state = STATE_INIT;
+
 	/** whether lzma is supported */
-	protected boolean 	lzmaSupported = false;
-	
+	protected boolean 	lzmaSupported;
+
 	/** whether pack200 is supported */
-	protected boolean 	pack200Supported = false;
-	
+	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.",
 												"<placeholder for error message>"};
-	
+
 	/** 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 */
-	static protected boolean natives_loaded = false;
-	
+	protected static boolean natives_loaded;
+
 	/*
 	 * @see java.applet.Applet#init()
 	 */
 	public void init() {
-		state = STATE_INIT;
+		setState(STATE_INIT);
 		
 		// sanity check
 		String[] requiredArgs = {"al_main", "al_logo", "al_progressbar", "al_jars"};
-		for(int i=0; i<requiredArgs.length; i++) {
-			if(getParameter(requiredArgs[i]) == null) {
-				fatalErrorOccured("missing required applet parameter: " + requiredArgs[i], null);
-				return;				
+		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);	
+		fgColor 		= getColor("boxfgcolor", Color.black);
 
-		// load logos
-		logo 			= getImage(getParameter("al_logo"));
-		progressbar 	= getImage(getParameter("al_progressbar"));
-		
-		//sanity check
-		if(logo == null || progressbar == null) {
-			fatalErrorOccured("Unable to load logo and progressbar images", null);
+		// 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");
@@ -302,14 +303,14 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 		} catch (Throwable e) {
 			/* no lzma support */
 		}
-		
+
 		// check pack200 support
 		try {
 			java.util.jar.Pack200.class.getSimpleName();
 			pack200Supported = true;
 		} catch (Throwable e) {
 			/* no pack200 support */
-		}		
+		}
 	}
 
 	/**
@@ -317,7 +318,7 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 	 * @param exception Exception to make stacktrace of
 	 * @return Stacktrace of exception in the form of a string
 	 */
-	private String generateStacktrace(Exception exception) {
+	private static String generateStacktrace(Exception exception) {
 		Writer result = new StringWriter();
 		PrintWriter printWriter = new PrintWriter(result);
 		exception.printStackTrace(printWriter);
@@ -336,7 +337,7 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 				loaderThread = new Thread(this);
 				loaderThread.setName("AppletLoader.loaderThread");
 				loaderThread.start();
-				
+
 				animationThread = new Thread() {
 					public void run() {
 						while(loaderThread != null) {
@@ -351,7 +352,7 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 			}
 		}
 	}
-	
+
 	/*
 	 * @see java.applet.Applet#stop()
 	 */
@@ -360,7 +361,7 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 			lwjglApplet.stop();
 		}
 	}
-	
+
 	/*
 	 * @see java.applet.Applet#destroy()
 	 */
@@ -368,27 +369,34 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 		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.	 
+	 * 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)
@@ -396,32 +404,37 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 	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
-			logoBuffer = createImage(logo.getWidth(null), logo.getHeight(null));
-			progressbarBuffer = 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);
-			offscreen.getGraphics().drawImage(progressbar, 0, 0, this);
-			
-			// in case image is not animated fill image buffers once
-			imageUpdate(logo, ImageObserver.FRAMEBITS, 0, 0, 0, 0);
-			imageUpdate(progressbar, ImageObserver.FRAMEBITS, 0, 0, 0, 0);
+			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
@@ -432,46 +445,44 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 		og.setColor(bgColor);
 		og.fillRect(0, 0, offscreen.getWidth(null), offscreen.getHeight(null));
 
-		// get logo position so its in the middle of applet
-		int x = 0, y = 0;
-		
-		if(logo != null && !fatalError) {
-			x = (offscreen.getWidth(null) - logo.getWidth(null)) / 2;
-			y = (offscreen.getHeight(null) - logo.getHeight(null)) / 2;
-		}
-
 		og.setColor(fgColor);
 		String message = getDescriptionForState();
 
 		// if we had a failure of some sort, notify the user
 		if (fatalError) {
 			String[] errorMessage = (certificateRefused) ? certificateRefusedMessage : genericErrorMessage;
-			
-			if (!certificateRefused) {
-				errorMessage[errorMessage.length-1] = fatalErrorDescription;
-			}			
-			
+
 			for(int i=0; i<errorMessage.length; i++) {
 				if(errorMessage[i] != null) {
 					int messageX = (offscreen.getWidth(null) - fm.stringWidth(errorMessage[i])) / 2;
 					int messageY = (offscreen.getHeight(null) - (fm.getHeight() * errorMessage.length)) / 2;
-					
+
 					og.drawString(errorMessage[i], messageX, messageY + i*fm.getHeight());
 				}
 			}
 		} else {
 			og.setColor(fgColor);
-			
+
 			painting = true;
-			
+
+			// get position at the middle of the offscreen buffer
+			int x = offscreen.getWidth(null)/2;
+			int y = offscreen.getHeight(null)/2;
+
 			// draw logo
-			og.drawImage(logoBuffer, x, y, this);
-			
+			if (logo != null) {
+				og.drawImage(logoBuffer, x-logo.getWidth(null)/2, y-logo.getHeight(null)/2, this);
+			}
+
 			// draw message
 			int messageX = (offscreen.getWidth(null) - fm.stringWidth(message)) / 2;
-			int messageY = y + logoBuffer.getHeight(null) + 20;
+			int messageY = y + 20;
+
+			if (logo != null) messageY += logo.getHeight(null)/2;
+			else if (progressbar != null) messageY += progressbar.getHeight(null)/2;
+
 			og.drawString(message, messageX, messageY);
-			
+
 			// draw subtaskmessage, if any
 			if(subtaskMessage.length() > 0) {
 				messageX = (offscreen.getWidth(null) - fm.stringWidth(subtaskMessage)) / 2;
@@ -479,51 +490,59 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 			}
 
 			// draw loading bar, clipping it depending on percentage done
-			int barSize = (progressbarBuffer.getWidth(null) * percentage) / 100;
-			og.clipRect(0, 0, x + barSize, offscreen.getHeight(null));
-			og.drawImage(progressbarBuffer, x, y, this);
-			
+			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 
+	 * 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. 
+	 *
+	 * 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) g.drawImage(logoBuffer, 0, 0, null);
-			
+			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;
 	}
 
@@ -556,7 +575,7 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 				return "unknown state";
 		}
 	}
-	
+
 	/**
 	 * Trims the passed file string based on the available capabilities
 	 * @param file string of files to be trimmed
@@ -566,10 +585,10 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 		if (!pack200Supported) {
 			file = file.replaceAll(".pack", "");
 		}
-		
+
 		if (!lzmaSupported) {
 			file = file.replaceAll(".lzma", "");
-		}	
+		}
 		return file;
 	}
 
@@ -579,77 +598,82 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 	 * jar to the urlList
 	 */
 	protected void loadJarURLs() throws Exception {
-		state = STATE_DETERMINING_PACKAGES;
-		
+		setState(STATE_DETERMINING_PACKAGES);
+
 		// jars to load
 		String jarList = getParameter("al_jars");
+		String nativeJarList = null;
 		
-		jarList = trimExtensionByCapabilities(jarList);
-		
-		StringTokenizer jar = new StringTokenizer(jarList, ", ");
-
-		int jarCount = jar.countTokens() + 1;
-		
-		urlList = new URL[jarCount];
-
-		URL path = getCodeBase();
-
-		// set jars urls
-		for (int i = 0; i < jarCount - 1; i++) {
-			urlList[i] = new URL(path, jar.nextToken());
-		}
-
-		// native jar url
-		String osName 		= System.getProperty("os.name");
-		String nativeJar 	= 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")) {
-				nativeJar = getParameter("al_windows64");
+				nativeJarList = getParameter("al_windows64");
 			} else {
-				nativeJar = getParameter("al_windows32");
+				nativeJarList = getParameter("al_windows32");
 			}
-			
-			if (nativeJar == null) {
-				nativeJar = getParameter("al_windows");
+
+			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")) {
-				nativeJar = getParameter("al_linux64");
+				nativeJarList = getParameter("al_linux64");
 			} else {
-				nativeJar = getParameter("al_linux32");
+				nativeJarList = getParameter("al_linux32");
 			}
-			
-			if (nativeJar == null) {
-				nativeJar = getParameter("al_linux");
+
+			if (nativeJarList == null) {
+				nativeJarList = getParameter("al_linux");
 			}
-			
-		} else if (osName.startsWith("Mac")) {
-			nativeJar = getParameter("al_mac");
+
+		} else if (osName.startsWith("Mac") || osName.startsWith("Darwin")) {
+			nativeJarList = getParameter("al_mac");
 		} else if (osName.startsWith("Solaris") || osName.startsWith("SunOS")) {
-			nativeJar = getParameter("al_solaris");
+			nativeJarList = getParameter("al_solaris");
 		} else if (osName.startsWith("FreeBSD")) {
-			nativeJar = getParameter("al_freebsd");
+			nativeJarList = getParameter("al_freebsd");
 		} else {
 			fatalErrorOccured("OS (" + osName + ") not supported", null);
+			return;
 		}
-
-		if (nativeJar == null) {
+		
+		if (nativeJarList == null) {
 			fatalErrorOccured("no lwjgl natives files found", null);
-		} else {
-			nativeJar = trimExtensionByCapabilities(nativeJar);
-			urlList[jarCount - 1] = new URL(path, nativeJar);
+			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
@@ -657,8 +681,8 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 	 * 5) switch applets
 	 */
 	public void run() {
-		state = STATE_CHECKING_CACHE;
-		
+		setState(STATE_CHECKING_CACHE);
+
  		percentage = 5;
 
  		try {
@@ -666,11 +690,11 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 
 			// parse the urls for the jars into the url list
 			loadJarURLs();
-			
+
 			// get path where applet will be stored
-			String path = (String) AccessController.doPrivileged(new PrivilegedExceptionAction() {
-				public Object run() throws Exception {
-					
+			String path = AccessController.doPrivileged(new PrivilegedExceptionAction<String>() {
+				public String run() throws Exception {
+
 					// we append the code base to avoid naming collisions with al_title
 					String codebase = "";
 					if(prependHost) {
@@ -680,26 +704,26 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 						}
 						codebase += File.separator;
 					}
-					return System.getProperty("java.io.tmpdir") + File.separator + codebase + getParameter("al_title") + 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) {
 
@@ -708,10 +732,10 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 				// if version file exists
 				if (versionFile.exists()) {
 					// compare to new version
-					if (latestVersion <= readVersionFile(versionFile)) {
+					if (latestVersion != readVersionFile(versionFile)) {
 						versionAvailable = true;
 						percentage = 90;
-						
+
 						if(debugMode) {
 							System.out.println("Loading Cached Applet Version " + latestVersion);
 						}
@@ -724,10 +748,10 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 			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%
 
@@ -737,33 +761,84 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 				// save version information once jars downloaded successfully
 				if (version != null) {
 					percentage = 90;
-					writeVersionFile(dir, latestVersion);
+					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();
 
-			// switch to LWJGL Applet
-			switchApplet();
-
-			state = STATE_DONE;		
+			// 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(e.getMessage(), 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);
+			}
+		}
+	}
 
 	/**
-	 * read the current version file
+	 * 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
@@ -777,7 +852,7 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 
 	/**
 	 * 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
@@ -787,29 +862,30 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 		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
 	 */
-	protected HashMap readCacheFile(File file) throws Exception {
+	@SuppressWarnings("unchecked")
+	protected HashMap<String, Long> readCacheFile(File file) throws Exception {
 		ObjectInputStream dis = new ObjectInputStream(new FileInputStream(file));
-		HashMap hashMap = (HashMap)dis.readObject();
+		HashMap<String, Long> hashMap = (HashMap<String, Long>)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 {
+	protected void writeCacheFile(File file, HashMap<String, Long> filesLastModified) throws Exception {
 		ObjectOutputStream dos = new ObjectOutputStream(new FileOutputStream(file));
 		dos.writeObject(filesLastModified);
 		dos.close();
@@ -819,105 +895,113 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 	 * 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(String path) throws Exception {
-		
-		state = STATE_UPDATING_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 (codesource.getLocation().getProtocol().equals("file")) {
+			        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 
+	 *
+	 * 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. I order to solve this we simply remove the 
-	 * natives from a previous classloader allowing a new 
+	 * 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);
@@ -934,10 +1018,10 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 	 * using AppletStub and initialise and start it
 	 */
 	protected void switchApplet() throws Exception {
-		
-		state = STATE_SWITCHING_APPLET;
+
+		setState(STATE_SWITCHING_APPLET);
 		percentage = 100;
-		
+
 		debug_sleep(2000);
 
 		Class appletClass = classLoader.loadClass(getParameter("al_main"));
@@ -950,39 +1034,39 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 		add(lwjglApplet);
 		validate();
 
-		state = STATE_INITIALIZE_REAL_APPLET;
+		setState(STATE_INITIALIZE_REAL_APPLET);
 		lwjglApplet.init();
 
-		state = STATE_START_REAL_APPLET;
+		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();
-		
+
+		filesLastModified = new HashMap<String, Long>();
+
 		// 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();
@@ -990,85 +1074,85 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 			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 && 
+
+
+			if (cacheEnabled && lastModified != 0 &&
 					filesLastModified.containsKey(fileName)) {
-				long savedLastModified = ((Long)filesLastModified.get(fileName)).longValue();
-				
+				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, new Long(lastModified));
-			
+			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 {
-		
-		state = STATE_DOWNLOADING;
+
+		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);
@@ -1076,7 +1160,7 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 					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
@@ -1092,13 +1176,13 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 						// 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]) {
@@ -1133,8 +1217,8 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 	 */
 	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. 
+
+		// 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() {
@@ -1148,7 +1232,7 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 			};
 			t.setName("JarInputStreamThread");
 			t.start();
-			
+
 			int iterationCount = 0;
 			while(is[0] == null && iterationCount++ < 5) {
 				try {
@@ -1157,7 +1241,7 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 					/* ignored */
 				}
 			}
-			
+
 			if(is[0] == null) {
 				try {
 					t.interrupt();
@@ -1167,36 +1251,36 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 				}
 			}
 		}
-		
+
 		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
+	 *  @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( new Class[] {InputStream.class} );
-		InputStream inputHandle = (InputStream) constructor.newInstance( new Object[] {fileInputHandle} );
+		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);
@@ -1208,46 +1292,80 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 
 		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
+	 *  @throws Exception if any errors occur
 	 */
-	protected void extractPack(String in, String out) throws Exception {		
+	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/pack files
-	 * 
+	 *  Extract all jars from any lzma/gz/pack files
+	 *
 	 *  @param path output path
-	 *  @throws exception if any errors occur
+	 *  @throws Exception if any errors occur
 	 */
 	protected void extractJars(String path) throws Exception {
-		state = STATE_EXTRACTING_PACKAGES;
-		
+		setState(STATE_EXTRACTING_PACKAGES);
+
 		float increment = (float) 10.0 / urlList.length;
-		// extract all lzma and pack.lzma files
+		// 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]);
 			
@@ -1255,11 +1373,20 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 				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);
@@ -1270,130 +1397,140 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 				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 
-	 * 
+	 * 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 {
-
-		// if no new native jar was downloaded, no extracting needed
-		if (fileSizes[fileSizes.length-1] == -2) {
-			return;
-		}
 		
-		state = STATE_EXTRACTING_PACKAGES;
+		setState(STATE_EXTRACTING_PACKAGES);
 		
-		int initialPercentage = percentage;
-
-		// get name of jar file with natives from urlList, it will be the last url
-		String nativeJar = getJarName(urlList[urlList.length - 1]);
-
-		// get the current certificate to compare against native files 
-		Certificate[] certificate = AppletLoader.class.getProtectionDomain().getCodeSource().getCertificates();
+		float percentageParts = 20f/nativeJarCount; // parts for each native jar from 20%
 		
-		// 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();
-		}
-
 		// create native folder
 		File nativeFolder = new File(path + "natives");
 		if (!nativeFolder.exists()) {
 			nativeFolder.mkdir();
 		}
-
-		// open jar file
-		JarFile jarFile = new JarFile(path + nativeJar, true);
-
-		// get list of files in jar
-		Enumeration entities = jarFile.entries();
 		
-		totalSizeExtract = 0;
+		// get the current certificate to compare against native files
+		Certificate[] certificate = AppletLoader.class.getProtectionDomain().getCodeSource().getCertificates();
 
-		// calculate the size of the files to extract for progress bar
-		while (entities.hasMoreElements()) {
-			JarEntry entry = (JarEntry) entities.nextElement();
+		// workaround for bug where cached applet loader does not have certificates!?
+		if (certificate == null) {
+			URL location = AppletLoader.class.getProtectionDomain().getCodeSource().getLocation();
 
-			// skip directories and anything in directories
-			// conveniently ignores the manifest
-			if (entry.isDirectory() || entry.getName().indexOf('/') != -1) {
-				continue;
-			}
-			totalSizeExtract += entry.getSize();
+			// 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();
 		}
-
-		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();
+		
+		for (int i = urlList.length - nativeJarCount; i < urlList.length; i++) {
 			
-			// skip directories and anything in directories
-			// conveniently ignores the manifest
-			if (entry.isDirectory() || entry.getName().indexOf('/') != -1) {
+			// if a new native jar was not downloaded, no extracting needed
+			if (fileSizes[i] == -2) {
 				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
+			
+			// 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();
 			}
-			
-			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 = initialPercentage + ((currentSizeExtract * 20) / totalSizeExtract);
-				subtaskMessage = "Extracting: " + entry.getName() + " " + ((currentSizeExtract * 100) / totalSizeExtract) + "%";
+	
+			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();
 			}
-
-			// validate if the certificate for native file is correct
-			validateCertificateChain(certificate, entry.getCertificates());
-
-			in.close();
-			out.close();
-		}
-		subtaskMessage = "";
-
-		jarFile.close();
+			subtaskMessage = "";
+	
+			jarFile.close();
+	
+			// delete native jar as it is no longer needed
+			File f = new File(path + nativeJar);
+			f.delete();
 		
-		// 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
 	 */
@@ -1410,40 +1547,67 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 			}
 		}
 	}
-	
+
 	/**
 	 * 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 {
-			URL url = AppletLoader.class.getResource("/"+s);
-			
-			// if image not found in jar, look outside it
-			if (url == null) {
-				url = new URL(getCodeBase(), s);
-			}
-			
 			Image image = super.getImage(url);
-			
+
 			// wait for image to load
 			MediaTracker tracker = new MediaTracker(this);
 	        tracker.addImage(image, 0);
 	        tracker.waitForAll();
-	        
-	        return image;
+
+	        // 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
 	 */
@@ -1452,18 +1616,22 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 
 		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
 	 */
@@ -1471,41 +1639,41 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 		String fileName = url.getFile();
 		return fileName.substring(fileName.lastIndexOf('/') + 1);
 	}
-	
+
 	/**
 	 * Retrieves the color
-	 * 
-	 * @param color Color to load
+	 *
+	 * @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()), 
+            	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);
@@ -1513,7 +1681,7 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
         	return defaultColor;
         }
 	}
-	
+
 	/**
 	 * Retrieves the boolean value for the applet
 	 * @param name Name of parameter
@@ -1527,21 +1695,33 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 		}
 		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;
-		fatalErrorDescription = "This occurred while '" + getDescriptionForState() + "'";
-		System.out.println(fatalErrorDescription);
+		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
@@ -1553,7 +1733,7 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 			sleep(ms);
 		}
 	}
-	
+
 	/**
 	 * Utility method for sleeping
 	 * @param ms milliseconds to sleep
@@ -1564,7 +1744,6 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
 		} catch (Exception e) {
 			/* ignored */
 		}
-	}	
-	
+	}
 
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/Alternate.java b/src/java/org/lwjgl/util/generator/Alternate.java
index 4145bb2..e484c49 100644
--- a/src/java/org/lwjgl/util/generator/Alternate.java
+++ b/src/java/org/lwjgl/util/generator/Alternate.java
@@ -49,6 +49,9 @@ public @interface Alternate {
 	/** 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;
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/AutoSize.java b/src/java/org/lwjgl/util/generator/AutoSize.java
index 726abd2..47ae30b 100644
--- a/src/java/org/lwjgl/util/generator/AutoSize.java
+++ b/src/java/org/lwjgl/util/generator/AutoSize.java
@@ -37,17 +37,18 @@ package org.lwjgl.util.generator;
  * according to the remaining() of a Buffer parameter.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3355 $
- * $Id: AutoSize.java 3355 2010-05-27 22:56:29Z spasi $
+ * @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
- at Target(ElementType.PARAMETER)
+ at 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.
 }
diff --git a/src/java/org/lwjgl/util/generator/Check.java b/src/java/org/lwjgl/util/generator/Check.java
index 45b6eff..cae735e 100644
--- a/src/java/org/lwjgl/util/generator/Check.java
+++ b/src/java/org/lwjgl/util/generator/Check.java
@@ -34,14 +34,14 @@ package org.lwjgl.util.generator;
 /**
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 2983 $
- * $Id: Check.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3412 $
+ * $Id: Check.java 3412 2010-09-26 23:43:24Z spasi $
  */
 
 import java.lang.annotation.Target;
 import java.lang.annotation.ElementType;
 
- at Target(ElementType.PARAMETER)
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
 public @interface Check {
 	String value() default "";
 	boolean canBeNull() default false;
diff --git a/src/java/org/lwjgl/util/generator/Code.java b/src/java/org/lwjgl/util/generator/Code.java
index cbf193a..06b04fa 100644
--- a/src/java/org/lwjgl/util/generator/Code.java
+++ b/src/java/org/lwjgl/util/generator/Code.java
@@ -34,14 +34,26 @@ package org.lwjgl.util.generator;
 /**
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 2983 $
- * $Id: Code.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3412 $
+ * $Id: Code.java 3412 2010-09-26 23:43:24Z spasi $
  */
 
-import java.lang.annotation.Target;
 import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
 
 @Target(ElementType.METHOD)
 public @interface Code {
-	String value();
+
+	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
+
 }
diff --git a/src/java/org/lwjgl/util/generator/Constant.java b/src/java/org/lwjgl/util/generator/Constant.java
index 4d38595..a25c97c 100644
--- a/src/java/org/lwjgl/util/generator/Constant.java
+++ b/src/java/org/lwjgl/util/generator/Constant.java
@@ -34,8 +34,8 @@ package org.lwjgl.util.generator;
 /**
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3287 $
- * $Id: Constant.java 3287 2010-03-14 23:24:40Z spasi $
+ * @version $Revision: 3412 $
+ * $Id: Constant.java 3412 2010-09-26 23:43:24Z spasi $
  */
 
 import java.lang.annotation.Target;
@@ -46,4 +46,6 @@ 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;
 }
diff --git a/src/java/org/lwjgl/util/generator/Extern.java b/src/java/org/lwjgl/util/generator/Extern.java
new file mode 100644
index 0000000..240051a
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/Extern.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR 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 <code>@Extern</code> will not be declared as <code>static</code> in the C implementation.
+ * This allows other source files to call them.
+ *
+ * @author Spasi
+ */
+ at Target(ElementType.METHOD)
+public @interface Extern {
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/GenerateAutos.java b/src/java/org/lwjgl/util/generator/GenerateAutos.java
index 531053b..38798b4 100644
--- a/src/java/org/lwjgl/util/generator/GenerateAutos.java
+++ b/src/java/org/lwjgl/util/generator/GenerateAutos.java
@@ -34,8 +34,8 @@ package org.lwjgl.util.generator;
 /**
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 2983 $
- * $Id: GenerateAutos.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3412 $
+ * $Id: GenerateAutos.java 3412 2010-09-26 23:43:24Z spasi $
  */
 
 import java.lang.annotation.Target;
@@ -43,4 +43,6 @@ import java.lang.annotation.ElementType;
 
 @Target(ElementType.METHOD)
 public @interface GenerateAutos {
+	/** If true, a size variable will be generated. */
+	String[] sizeVariables() default {};
 }
diff --git a/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java b/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java
index 4b129f5..0c96106 100644
--- a/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java
+++ b/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java
@@ -32,29 +32,30 @@
 
 package org.lwjgl.util.generator;
 
-import com.sun.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-
 import java.io.File;
 import java.io.FileFilter;
+import java.util.Arrays;
 import java.util.Collection;
-import java.util.Set;
 import java.util.Map;
-import java.util.Arrays;
+import java.util.Set;
+
+import com.sun.mirror.apt.*;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+import com.sun.mirror.declaration.TypeDeclaration;
 
-import static java.util.Collections.*;
 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 <elias_naur at users.sourceforge.net>
- * @version $Revision: 3289 $
- * $Id: GeneratorProcessorFactory.java 3289 2010-03-16 19:05:19Z spasi $
+ * @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
@@ -78,7 +79,7 @@ public class GeneratorProcessorFactory implements AnnotationProcessorFactory, Ro
 
 	public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds, AnnotationProcessorEnvironment env) {
 		// Only process the initial types, not the generated ones
-		if (first_round) {
+		if ( first_round ) {
 			env.addListener(this);
 			return new GeneratorProcessor(env);
 		} else
@@ -86,6 +87,7 @@ public class GeneratorProcessorFactory implements AnnotationProcessorFactory, Ro
 	}
 
 	private static class GeneratorProcessor implements AnnotationProcessor {
+
 		private final AnnotationProcessorEnvironment env;
 
 		GeneratorProcessor(AnnotationProcessorEnvironment env) {
@@ -97,22 +99,22 @@ public class GeneratorProcessorFactory implements AnnotationProcessorFactory, Ro
 			String typemap_classname = null;
 			boolean generate_error_checks = options.containsKey("-Ageneratechecks");
 			boolean context_specific = options.containsKey("-Acontextspecific");
-			for (String k : options.keySet()) {
+			for ( String k : options.keySet() ) {
 				int delimiter = k.indexOf('=');
-				if (delimiter != -1) {
-					if (k.startsWith("-Atypemap")) {
+				if ( delimiter != -1 ) {
+					if ( k.startsWith("-Atypemap") ) {
 						typemap_classname = k.substring(delimiter + 1);
 					}
 				}
 			}
-			if (typemap_classname == null)
+			if ( typemap_classname == null )
 				throw new RuntimeException("No TypeMap class name specified with -Atypemap=<class-name>");
 
 			TypeDeclaration lastFile = null;
 			try {
 				long generatorLM = getGeneratorLastModified();
 				TypeMap type_map = (TypeMap)(Class.forName(typemap_classname).newInstance());
-				for (TypeDeclaration typedecl : env.getSpecifiedTypeDeclarations()) {
+				for ( TypeDeclaration typedecl : env.getSpecifiedTypeDeclarations() ) {
 					lastFile = typedecl;
 					typedecl.accept(getDeclarationScanner(new GeneratorVisitor(env, type_map, generate_error_checks, context_specific, generatorLM), NO_OP));
 				}
@@ -130,7 +132,16 @@ public class GeneratorProcessorFactory implements AnnotationProcessorFactory, Ro
 		 * @return time of the latest change
 		 */
 		private static long getGeneratorLastModified() {
-			final File pck = new File(System.getProperty("user.dir") + "/bin/org/lwjgl/util/generator");
+			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;
 
diff --git a/src/java/org/lwjgl/util/generator/GeneratorVisitor.java b/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
index 6cdd397..0461753 100644
--- a/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
+++ b/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
@@ -37,12 +37,11 @@ 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.io.PrintWriter;
-import java.io.IOException;
-import java.io.File;
-
 import java.nio.*;
 
 /**
@@ -50,8 +49,8 @@ import java.nio.*;
  * Generator visitor for the generator tool
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3355 $
- * $Id: GeneratorVisitor.java 3355 2010-05-27 22:56:29Z spasi $
+ * @version $Revision: 3430 $
+ * $Id: GeneratorVisitor.java 3430 2010-10-04 17:04:46Z spasi $
  */
 public class GeneratorVisitor extends SimpleDeclarationVisitor {
 	private final AnnotationProcessorEnvironment env;
@@ -68,11 +67,6 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
 		this.generatorLM = generatorLM;
 	}
 
-	private void validateMethods(InterfaceDeclaration d) {
-		for (MethodDeclaration method : d.getMethods())
-			validateMethod(method);
-	}
-
 	private void validateMethod(MethodDeclaration method) {
 		if (method.isVarArgs())
 			throw new RuntimeException("Method " + method.getSimpleName() + " is variadic");
@@ -96,16 +90,16 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
 		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(AutoResultSize.class) == null)
-				throw new RuntimeException(method + " is annotated with CachedResult but misses an AutoResultSize annotation");
+			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) {
+	private void validateType(MethodDeclaration method, Class<?extends Annotation> annotation_type, Class type) {
 		Class[] valid_types = type_map.getValidAnnotationTypes(type);
-		for (int i = 0; i < valid_types.length; i++)
-			if (valid_types[i].equals(annotation_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);
@@ -115,7 +109,7 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
 		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<? extends Annotation> annotation_type = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
 				Class type = Utils.getJavaType(type_mirror);
 				if (Buffer.class.equals(type))
 					continue;
@@ -172,7 +166,9 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
 	}
 
 	private static void generateMethodNativePointers(PrintWriter writer, MethodDeclaration method) {
-		writer.println("static " + Utils.getTypedefName(method) + " " + method.getSimpleName() + ";");
+		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 {
@@ -182,9 +178,15 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
 		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);
-		java_writer.print("public ");
+		if ( d.getAnnotation(Private.class) == null )
+			java_writer.print("public ");
 		boolean is_final = Utils.isFinal(d);
 		if (is_final)
 			java_writer.write("final ");
@@ -247,29 +249,98 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
 	}
 
 	public void visitInterfaceDeclaration(InterfaceDeclaration d) {
-		File input = d.getPosition().file();
-		File output = new File(env.getOptions().get("-s") + '/' + d.getPackage().getQualifiedName().replace('.', '/'), Utils.getSimpleClassName(d) + ".java");
+		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<? extends MethodDeclaration> 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 ( output.exists() && Math.max(input.lastModified(), generatorLM) < output.lastModified() )
+			if ( outputJava.exists() && Math.max(input.lastModified(), generatorLM) < outputJava.lastModified() )
 				return;
 
-			if (d.getMethods().size() > 0 || d.getFields().size() > 0) {
-				validateMethods(d);
-				java_writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, d.getPackage().getQualifiedName(), new File(Utils.getSimpleClassName(d) + ".java"), null);
-				generateJavaSource(d, java_writer);
+			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();
+				}
 			}
-			if (d.getMethods().size() > 0)
-				generateNativeSource(d);
 		} 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 ( output.exists() ) output.delete();
+			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;
+	}
+
 }
diff --git a/src/java/org/lwjgl/util/generator/Helper.java b/src/java/org/lwjgl/util/generator/Helper.java
new file mode 100644
index 0000000..5bf3eee
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/Helper.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR 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 <code>@Helper</code> 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;
+
+ at Target(ElementType.PARAMETER)
+public @interface Helper {
+	boolean passToNative() default false;
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/Imports.java b/src/java/org/lwjgl/util/generator/Imports.java
new file mode 100644
index 0000000..bd6a239
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/Imports.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR 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
+ */
+ at Target(ElementType.TYPE)
+public @interface Imports {
+	String[] value();
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/JNITypeTranslator.java b/src/java/org/lwjgl/util/generator/JNITypeTranslator.java
index 45901c6..05488ec 100644
--- a/src/java/org/lwjgl/util/generator/JNITypeTranslator.java
+++ b/src/java/org/lwjgl/util/generator/JNITypeTranslator.java
@@ -41,8 +41,8 @@ import com.sun.mirror.util.*;
  * type strings.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3281 $
- * $Id: JNITypeTranslator.java 3281 2010-03-12 21:55:13Z spasi $
+ * @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();
@@ -56,8 +56,13 @@ public class JNITypeTranslator implements TypeVisitor {
 	}
 
 	public void visitArrayType(ArrayType t) {
-		if ( "java.lang.CharSequence".equals(t.getComponentType().toString()) )
+		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");
 	}
diff --git a/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java b/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
index 7897978..3295442 100644
--- a/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
+++ b/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
@@ -37,10 +37,13 @@ package org.lwjgl.util.generator;
  * This class generates the methods in the generated java source files.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3355 $
- * $Id: JavaMethodsGenerator.java 3355 2010-05-27 22:56:29Z spasi $
+ * @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.*;
@@ -50,7 +53,7 @@ import java.util.*;
 import java.nio.*;
 
 public class JavaMethodsGenerator {
-	private final static String SAVED_PARAMETER_POSTFIX = "_saved";
+	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())
@@ -71,31 +74,37 @@ public class JavaMethodsGenerator {
 		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() ) {
+		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.");
-			printJavaNativeStub(writer, method, Mode.NORMAL, generate_error_checks, context_specific);
+
+			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);
-				printJavaNativeStub(writer, 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("\tprivate static native ");
+			writer.print("\tstatic native ");
 		} else {
 			Utils.printDocComment(writer, method);
 			writer.print("\tpublic static native ");
 		}
-		printResultType(writer, method, true);
+		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, mode);
+		boolean first_parameter = generateParametersJava(writer, method, TypeInfo.getDefaultTypeInfoMap(method), true, true, mode);
 		if (context_specific) {
 			if (!first_parameter)
 				writer.print(", ");
@@ -104,10 +113,14 @@ public class JavaMethodsGenerator {
 		writer.println(");");
 	}
 
-	private static boolean generateParametersJava(PrintWriter writer, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> typeinfos_instance,
-			boolean native_stub, Mode mode) {
+	private static boolean generateParametersJava(PrintWriter writer, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> 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) {
@@ -119,44 +132,53 @@ public class JavaMethodsGenerator {
 						if (!first_parameter)
 							writer.print(", ");
 						first_parameter = false;
-						writer.print("boolean " + TypeInfo.UNSIGNED_PARAMETER_NAME);
+						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)))
-			            && (getAutoTypeParameter(method, param) == null || mode != Mode.AUTOS)
-				)
-			{
-				TypeInfo type_info = typeinfos_instance.get(param);
-				first_parameter = generateParameterJava(writer, param, type_info, native_stub, first_parameter, mode);
+					    && (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)) {
-			if (cached_result_annotation == null || !cached_result_annotation.isRange()) {
-				if (!first_parameter)
-					writer.print(", ");
-				first_parameter = false;
-				writer.print("long " + Utils.RESULT_SIZE_NAME);
+			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 )
-				writer.print("long " + Utils.CACHED_BUFFER_LENGTH_NAME + ", ");
+			if ( mode == Mode.CACHEDRESULT ) {
+				if ( printTypes )
+					writer.print("long ");
+				writer.print(Utils.CACHED_BUFFER_LENGTH_NAME + ", ");
+			}
 
 			first_parameter = false;
-			printResultType(writer, method, native_stub);
+			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, boolean first_parameter, Mode mode) {
+	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(", ");
@@ -164,18 +186,23 @@ public class JavaMethodsGenerator {
 		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");
-			writer.print("long " + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX);
+			if ( printTypes )
+				writer.print("long ");
+			writer.print(param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX);
 		} else {
-			if ( native_stub && param.getAnnotation(GLpointer.class) != null )
-				writer.print("long");
+			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) )
-					writer.print("ByteBuffer");
-				else
-					writer.print(type_info.getType().getSimpleName());
+				if ( native_stub && (type == CharSequence.class || type == CharSequence[].class || type == PointerBuffer.class) )
+					writer.print("ByteBuffer ");
+				else if ( printTypes )
+					writer.print(type_info.getType().getSimpleName() + " ");
 			}
-			writer.print(" " + param.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);
 		}
@@ -205,8 +232,11 @@ public class JavaMethodsGenerator {
 
 	private static void printMethodWithMultiType(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> typeinfos_instance, Mode mode, boolean generate_error_checks, boolean context_specific) {
 		Utils.printDocComment(writer, method);
-		writer.print("\tpublic static ");
-		printResultType(writer, method, false);
+		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);
@@ -214,32 +244,60 @@ public class JavaMethodsGenerator {
 		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, mode);
-		TypeMirror result_type = Utils.getMethodReturnType(method);
+		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) {
-			writer.println("\t\tContextCapabilities caps = GLContext.getCapabilities();");
-			writer.print("\t\tlong " + Utils.FUNCTION_POINTER_VAR_NAME + " = caps.");
+			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 + ");");
 		}
-		Code code_annotation = method.getAnnotation(Code.class);
-		if (code_annotation != null)
+		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);
+		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");
-		boolean has_result = !result_type.equals(env.getTypeUtils().getVoidType());
+
+		final PointerWrapper pointer_wrapper_annotation = method.getAnnotation(PointerWrapper.class);
 		if (has_result) {
-			printResultType(writer, method, false);
-			writer.print(" " + Utils.RESULT_VAR_NAME + " = ");
+			writer.print(getResultType(method, false) + " " + Utils.RESULT_VAR_NAME);
 
-			if ( method.getAnnotation(GLpointer.class) != null )
-				writer.print("new " + method.getReturnType() + "(");
-		}
-		if ( method.getAnnotation(GLreturn.class) != null ) {
+			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));
 		}
@@ -253,22 +311,36 @@ public class JavaMethodsGenerator {
 				writer.print(", ");
 			writer.print(Utils.FUNCTION_POINTER_VAR_NAME);
 		}
-		if ( has_result && method.getAnnotation(GLpointer.class) != null )
+		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)
-			writer.println("\t\t" + type_map.getErrorCheckMethodName() + ";");
+			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("\t\treturn " + Utils.RESULT_VAR_NAME + ".order(ByteOrder.nativeOrder());"); // safeNewBuffer returns a direct ByteBuffer with BIG_ENDIAN order.
+					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("\t\treturn " + Utils.RESULT_VAR_NAME + ";");
+					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}");
 	}
 
@@ -296,7 +368,7 @@ public class JavaMethodsGenerator {
 				else if (annotation_type.equals(AutoSize.class))
 					parameter_name = param.getAnnotation(AutoSize.class).value();
 				else
-					throw new RuntimeException("Unkown annotation type " + annotation_type);
+					throw new RuntimeException("Unknown annotation type " + annotation_type);
 				if (target_parameter.getSimpleName().equals(parameter_name))
 					return param;
 			}
@@ -368,6 +440,7 @@ public class JavaMethodsGenerator {
 	private static boolean printMethodCallArgument(PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Map<ParameterDeclaration, TypeInfo> 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) {
@@ -375,31 +448,34 @@ public class JavaMethodsGenerator {
 		} else if (auto_annotation != null && mode == Mode.NORMAL) {
 			Class param_type = NativeTypeTranslator.getClassFromType(auto_annotation.getAnnotationType());
 			if (AutoType.class.equals(param_type)) {
-				AutoType auto_type_annotation = param.getAnnotation(AutoType.class);
-				String auto_parameter_name = auto_type_annotation.value();
-				ParameterDeclaration auto_parameter = Utils.findParameter(method, auto_parameter_name);
-				String auto_type = typeinfos_instance.get(auto_parameter).getAutoType();
-				if (auto_type == null)
+				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)) {
-				AutoSize auto_type_annotation = param.getAnnotation(AutoSize.class);
-				String auto_parameter_name = auto_type_annotation.value();
-				ParameterDeclaration auto_target_param = Utils.findParameter(method, auto_parameter_name);
-				TypeInfo auto_target_type_info = typeinfos_instance.get(auto_target_param);
-				if ( auto_type_annotation.canBeNull() )
-					writer.print("((" + auto_parameter_name + " == null ? 0 : " + auto_parameter_name + ".remaining())");
+				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()");
+					writer.print(auto_parameter_name + ".remaining()");
 				// Shift the remaining if the target parameter is multityped and there's no AutoType to track type
-				boolean shift_remaining = !hasAnyParameterAutoTypeAnnotation(method, auto_target_param) && Utils.isParameterMultiTyped(auto_target_param);
-				if (shift_remaining) {
-					int shifting = getBufferElementSizeExponent(auto_target_type_info.getType());
-					if (shifting > 0)
-						writer.print(" << " + shifting);
+				if (shift_remaining && shifting > 0) {
+					writer.print(" << " + shifting);
+					writer.print(")");
 				}
-				writer.print(")");
-				writer.print(auto_type_annotation.expression());
+				writer.print(auto_size_annotation.expression());
 			} else
 				throw new RuntimeException("Unknown auto annotation " + param_type);
 		} else {
@@ -407,14 +483,15 @@ public class JavaMethodsGenerator {
 				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)
+				if (hide_buffer) {
 					writer.print("null");
-				else {
+				} else {
 					if ( type == CharSequence.class || type == CharSequence[].class ) {
 						final String offset = Utils.getStringOffset(method, param);
 
-						writer.print("APIUtils.getBuffer");
+						writer.print("APIUtil.getBuffer");
 						if ( param.getAnnotation(NullTerminated.class) != null )
 							writer.print("NT");
 						writer.print("(" + param.getSimpleName());
@@ -422,24 +499,37 @@ public class JavaMethodsGenerator {
 							writer.print(", " + offset);
 						writer.print(")");
 						hide_buffer = true;
-					} else
+					} 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) {
-						TypeInfo type_info = typeinfos_instance.get(param);
-						Check check_annotation = param.getAnnotation(Check.class);
 						int shifting;
-						if (Utils.getNIOBufferType(param.getType()).equals(Buffer.class))
-							shifting = getBufferElementSizeExponent(type_info.getType());
-						else
+						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());
-						writer.print(".position()");
+						if ( type == PointerBuffer.class )
+							writer.print(".positionByte()");
+						else
+							writer.print(".position()");
 						if (shifting > 0)
 							writer.print(" << " + shifting);
 						if (check_annotation != null && check_annotation.canBeNull())
@@ -449,8 +539,8 @@ public class JavaMethodsGenerator {
 						writer.print(offset == null ? "0" : offset);
 					} else
 						writer.print("0");
-				} else {
-					GLpointer pointer_annotation = param.getAnnotation(GLpointer.class);
+				} 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());
@@ -464,30 +554,35 @@ public class JavaMethodsGenerator {
 
 	private static boolean printMethodCallArguments(PrintWriter writer, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> typeinfos_instance, Mode mode) {
 		boolean first_parameter = true;
-		for (ParameterDeclaration param : method.getParameters())
-			if (param.getAnnotation(Result.class) == null) {
+		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 {
-				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 {
-					AutoResultSize auto_result_size_annotation = method.getAnnotation(AutoResultSize.class);
-					if (auto_result_size_annotation == null)
+				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_result_size_annotation.value();
+						result_size_expression = auto_size_annotation.value();
+
+					Utils.printExtraCallArguments(writer, method, result_size_expression);
 				}
-				Utils.printExtraCallArguments(writer, method, result_size_expression);
 			}
 		}
 		return first_parameter;
@@ -501,7 +596,7 @@ public class JavaMethodsGenerator {
                                         cachedReference != null &&
 					(mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) &&
 					param.getAnnotation(Result.class) == null) {
-				writer.print("\t\tif ( LWJGLUtil.CHECKS ) " + Utils.CHECKS_CLASS_NAME + ".getReferences(caps).");
+				writer.print("\t\tif ( LWJGLUtil.CHECKS ) " + "StateTracker.getReferences(caps).");
                                 if(cachedReference.name().length() > 0) {
                                     writer.print(cachedReference.name());
                                 } else {
@@ -531,14 +626,33 @@ public class JavaMethodsGenerator {
 		}
 	}
 
-	private static void printParameterChecks(PrintWriter writer, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> typeinfos, Mode mode) {
+	private static void printParameterChecks(PrintWriter writer, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> 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 (Utils.isAddressableType(java_type) &&
+			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) ) {
+			        !Utils.isReturnParameter(method, param)) ) {
 				String check_value = null;
 				boolean can_be_null = false;
 				Check check_annotation = param.getAnnotation(Check.class);
@@ -546,59 +660,115 @@ public class JavaMethodsGenerator {
 					check_value = check_annotation.value();
 					can_be_null = check_annotation.canBeNull();
 				}
-				NullTerminated null_terminated = param.getAnnotation(NullTerminated.class);
-				if (Buffer.class.isAssignableFrom(java_type) && param.getAnnotation(Constant.class) == null) {
+				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, param.getSimpleName(), typeinfo.getType().getSimpleName(), check_value, can_be_null, null_terminated, indirect_buffer_allowed, out_parameter);
+					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, Utils.CACHED_BUFFER_NAME, null, null, true, null, false, false);
+			printParameterCheck(writer, method, Utils.CACHED_BUFFER_NAME, null, null, true, null, false, false, generate_error_checks);
 	}
 
-	private static void printParameterCheck(PrintWriter writer, String name, String type, String check_value, boolean can_be_null, NullTerminated null_terminated, boolean indirect_buffer_allowed, boolean out_parameter) {
+	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.println("\t\tif (" + name + " != null)");
-			writer.print("\t");
-		}
+			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("\t\t" + name + " = NondirectBufferWrapper.wrap");
+			writer.print(tabs + name + " = NondirectBufferWrapper.wrap");
 			if (out_parameter)
 				writer.print("NoCopy");
 		} else
-			writer.print("\t\tBufferChecks.check");
-		if (check_value != null && !"".equals(check_value) ) {
-			writer.print("Buffer(" + name + ", " + check_value);
+			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("\t\tBufferChecks.checkNullTerminated(");
+			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 printResultType(PrintWriter writer, MethodDeclaration method, boolean native_stub) {
-		if ( native_stub && method.getAnnotation(GLpointer.class) != null )
-			writer.print("long");
+	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 )
-			writer.print(Utils.getMethodReturnType(method, method.getAnnotation(GLreturn.class), false));
+			return Utils.getMethodReturnType(method, method.getAnnotation(GLreturn.class), false);
 		else
-			writer.print(Utils.getMethodReturnType(method).toString());
+			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";
+		}
+	}
+
 }
diff --git a/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java b/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java
index 13d7d92..49cf9aa 100644
--- a/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java
+++ b/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java
@@ -32,17 +32,20 @@
 
 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 <elias_naur at users.sourceforge.net>
- * @version $Revision: 3287 $
- * $Id: JavaTypeTranslator.java 3287 2010-03-14 23:24:40Z spasi $
+ * @version $Revision: 3430 $
+ * $Id: JavaTypeTranslator.java 3430 2010-10-04 17:04:46Z spasi $
  */
 public class JavaTypeTranslator implements TypeVisitor {
 	private Class type;
@@ -56,10 +59,21 @@ public class JavaTypeTranslator implements TypeVisitor {
 	}
 
 	public void visitArrayType(ArrayType t) {
-		if ( "java.lang.CharSequence".equals(t.getComponentType().toString()) )
-			type = CharSequence[].class;
-		else
-			throw new RuntimeException(t + " is not allowed");
+		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) {
@@ -83,6 +97,27 @@ public class JavaTypeTranslator implements TypeVisitor {
 		}
 	}
 
+	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());
 	}
diff --git a/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java b/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
index 493777d..113195e 100644
--- a/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
+++ b/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
@@ -37,10 +37,12 @@ package org.lwjgl.util.generator;
  * This class generates the functions in the native source files.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3289 $
- * $Id: NativeMethodStubsGenerator.java 3289 2010-03-16 19:05:19Z spasi $
+ * @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.*;
@@ -52,12 +54,13 @@ 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_POSTFIX = "_str";
+	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() )
+			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))
@@ -66,16 +69,20 @@ public class NativeMethodStubsGenerator {
 	}
 
 	private static void generateParameters(PrintWriter writer, Collection<ParameterDeclaration> params, Mode mode) {
-		for (ParameterDeclaration param : params)
-			if (param.getAnnotation(Result.class) == null)
+		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(GLpointer.class) != null ) {
+		} else if ( param.getAnnotation(PointerWrapper.class) != null ) {
 			writer.print("jlong " + param.getSimpleName());
 		} else {
 			JNITypeTranslator translator = new JNITypeTranslator();
@@ -92,9 +99,11 @@ public class NativeMethodStubsGenerator {
 		else
 			writer.print("JNIEXPORT ");
 
-		TypeMirror result_type = Utils.getMethodReturnType(method);
+		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(GLpointer.class) != null ) {
+		if ( method.getAnnotation(PointerWrapper.class) != null ) {
 			writer.print("jlong");
 		} else {
 			JNITypeTranslator translator = new JNITypeTranslator();
@@ -109,8 +118,7 @@ public class NativeMethodStubsGenerator {
 		writer.print("(JNIEnv *env, jclass clazz");
 		generateParameters(writer, method.getParameters(), mode);
 		if (Utils.getNIOBufferType(result_type) != null) {
-			CachedResult cached_result_annotation = method.getAnnotation(CachedResult.class);
-			if (cached_result_annotation == null || !cached_result_annotation.isRange())
+			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);
@@ -119,6 +127,7 @@ public class NativeMethodStubsGenerator {
 			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) {
@@ -127,49 +136,59 @@ public class NativeMethodStubsGenerator {
 			writer.print(" = (" + typedef_name + ")((intptr_t)");
 			writer.println(Utils.FUNCTION_POINTER_VAR_NAME + ");");
 		}
-		generateStringListInits(writer, method.getParameters());
+
+		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 (!result_type.equals(env.getTypeUtils().getVoidType())) {
-			Declaration return_declaration;
-			ParameterDeclaration result_param = Utils.getResultParameter(method);
-			if (result_param != null)
-				return_declaration = result_param;
-			else
-				return_declaration = method;
-			NativeTypeTranslator native_translator = new NativeTypeTranslator(type_map, return_declaration);
-			result_type.accept(native_translator);
-			writer.print(native_translator.getSignature() + " " + Utils.RESULT_VAR_NAME);
-			if (result_param != null) {
-				writer.println(";");
-				writer.print("\t");
-			} else
-				writer.print(" = ");
-		}
+		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 (method.getAnnotation(CachedResult.class) != null)
+				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(GLpointer.class) != null ) {
+			} else if ( method.getAnnotation(PointerWrapper.class) != null ) {
 				writer.print("(intptr_t)");
 			}
 			writer.print(Utils.RESULT_VAR_NAME);
 			if (Buffer.class.isAssignableFrom(java_result_type)) {
-				writer.print(", ");
-				if (method.getAnnotation(CachedResult.class) != null && method.getAnnotation(CachedResult.class).isRange())
-					Utils.printExtraCallArguments(writer, method, method.getAnnotation(AutoResultSize.class).value());
+				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
-					Utils.printExtraCallArguments(writer, method, Utils.RESULT_SIZE_NAME);
+					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))
@@ -180,133 +199,226 @@ public class NativeMethodStubsGenerator {
 		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<ParameterDeclaration> params) {
 		if (params.size() > 0) {
-			Iterator<ParameterDeclaration> it = params.iterator();
-			generateCallParameter(writer, type_map, it.next());
-			while (it.hasNext()) {
-				writer.print(", ");
-				generateCallParameter(writer, type_map, it.next());
+			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(StringList.class) != null) {
+		if (is_indirect || param.getAnnotation(PointerArray.class) != null) {
 			writer.print("(");
-			NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param);
+			final NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param);
 			param.getType().accept(translator);
 			writer.print(translator.getSignature());
 			writer.print("*)");
 		}
-		if ( param.getAnnotation(GLpointer.class) != null )
-			writer.print("(" + param.getAnnotation(GLpointer.class).value() + ")(intptr_t)");
+		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) {
+
+		if ( param.getAnnotation(Result.class) != null ) {
 			writer.print(Utils.RESULT_VAR_NAME);
 		} else {
 			writer.print(param.getSimpleName());
-			if ( param.getAnnotation(StringList.class) != null )
-				writer.print(STRING_LIST_POSTFIX);
-			else if (Utils.isAddressableType(param.getType()))
+			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<ParameterDeclaration> params) {
 		for (ParameterDeclaration param : params) {
-			if (Utils.getJavaType(param.getType()).equals(String.class) &&
-					param.getAnnotation(Result.class) == null)
+			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(StringList.class) != null ) // Free the string array mem
-				writer.println("\tfree(" + param.getSimpleName() + STRING_LIST_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) {
-		boolean loopDeclared = false;
-		for (ParameterDeclaration param : method.getParameters())
-			if (Utils.isAddressableType(param.getType()) && param.getAnnotation(Result.class) == null)
-				loopDeclared = generateBufferParameterAddress(type_map, writer, method,  param, mode, loopDeclared);
+		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 generateBufferParameterAddress(TypeMap type_map, PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Mode mode, boolean loopDeclared) {
-		NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param);
+	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);
-		writer.print("\t" + translator.getSignature() + param.getSimpleName());
-		writer.print(BUFFER_ADDRESS_POSTFIX + " = ((");
-		writer.print(translator.getSignature());
-		Check check_annotation = param.getAnnotation(Check.class);
-		writer.print(")");
-		if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null) {
-			writer.print("offsetToPointer(" + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX + "))");
-		} else {
-			Class java_type = Utils.getJavaType(param.getType());
-			if (Buffer.class.isAssignableFrom(java_type) || java_type.equals(CharSequence.class) || java_type.equals(CharSequence[].class)) {
-				boolean explicitly_byte_sized = java_type.equals(Buffer.class) ||
-					translator.getAnnotationType().equals(type_map.getVoidType());
-				if (explicitly_byte_sized)
-					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)
+		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("))");
-			} else if (java_type.equals(String.class)) {
-				writer.print("GetStringNativeChars(env, " + param.getSimpleName() + "))");
-			} else
-				throw new RuntimeException("Illegal type " + java_type);
+					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(";");
 		}
-		writer.println(";");
 
-		if ( param.getAnnotation(StringList.class) != null ) {
-			if ( Utils.getJavaType(param.getType()) != CharSequence[].class && (
-					param.getAnnotation(GLchar.class) == null ||
-			        param.getAnnotation(NullTerminated.class) == null ||
-			        param.getAnnotation(NullTerminated.class).value().length() == 0
-				)
-			)
-				throw new RuntimeException("StringList annotation can only be applied on null-terminated GLchar buffers.");
-
-			if ( "_str".equals(param.getSimpleName()) )
-				throw new RuntimeException("The name '_str' is not valid for arguments annotated with StringList");
-
-			// Declare loop counters and allocate string array
-			if ( !loopDeclared ) {
-				writer.println("\tunsigned int _str_i;");
-				writer.println("\tGLchar *_str_address;");
-				loopDeclared = true;
+		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.println("\tGLchar **" + param.getSimpleName() + STRING_LIST_POSTFIX + " = (GLchar **) malloc(" + param.getAnnotation(StringList.class).value() + "*sizeof(GLchar*));");
+
+			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<ParameterDeclaration> params) {
+		for ( ParameterDeclaration param : params ) {
+			PointerArray pointerArray_annotation = param.getAnnotation(PointerArray.class);
+			if ( pointerArray_annotation != null )
+				return true;
 		}
-		return loopDeclared;
+		return false;
 	}
 
-	private static void generateStringListInits(PrintWriter writer, Collection<ParameterDeclaration> params) {
+	private static void generatePointerArrayInits(TypeMap type_map, PrintWriter writer, Collection<ParameterDeclaration> params) {
 		for ( ParameterDeclaration param : params ) {
-			StringList stringList_annotation = param.getAnnotation(StringList.class);
-			if ( stringList_annotation != null ) {
-				String lengths = stringList_annotation.lengths();
-
-				// Init vars
-				writer.println("\t_str_i = 0;");
-				writer.println("\t_str_address = (GLchar *)" + param.getSimpleName() + BUFFER_ADDRESS_POSTFIX + ";");
-				// Fill string array with the string pointers
-				writer.println("\twhile ( _str_i < " + stringList_annotation.value() + " ) {");
-				if ( lengths.length() == 0 ) {
-					writer.println("\t\t" + param.getSimpleName() + STRING_LIST_POSTFIX + "[_str_i++] = _str_address;");
-					writer.println("\t\t_str_address += strlen(_str_address) + 1;");
+			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 {
-					writer.println("\t\t" + param.getSimpleName() + STRING_LIST_POSTFIX + "[_str_i] = _str_address;");
-					writer.println("\t\t_str_address += " + lengths + BUFFER_ADDRESS_POSTFIX + "[_str_i++];");
+					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}");
 				}
-				writer.println("\t}");
 			}
 		}
 	}
diff --git a/src/java/org/lwjgl/util/generator/NativeType.java b/src/java/org/lwjgl/util/generator/NativeType.java
index 5713638..613d7ed 100644
--- a/src/java/org/lwjgl/util/generator/NativeType.java
+++ b/src/java/org/lwjgl/util/generator/NativeType.java
@@ -37,13 +37,14 @@ package org.lwjgl.util.generator;
  * a native type.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 2983 $
- * $Id: NativeType.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3412 $
+ * $Id: NativeType.java 3412 2010-09-26 23:43:24Z spasi $
  */
 
 import java.lang.annotation.Target;
 import java.lang.annotation.ElementType;
 
- at Target(ElementType.ANNOTATION_TYPE)
+ at Target({ElementType.ANNOTATION_TYPE, ElementType.PARAMETER})
 public @interface NativeType {
+	String value() default "";
 }
diff --git a/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java b/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java
index 62d3ca0..b7e50a2 100644
--- a/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java
+++ b/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java
@@ -38,33 +38,33 @@ package org.lwjgl.util.generator;
  * annotations) to the native type string.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3281 $
- * $Id: NativeTypeTranslator.java 3281 2010-03-12 21:55:13Z spasi $
+ * @version $Revision: 3412 $
+ * $Id: NativeTypeTranslator.java 3412 2010-09-26 23:43:24Z spasi $
  */
 
-import org.lwjgl.opengl.PointerWrapper;
-
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.ArrayList;
+import org.lwjgl.PointerBuffer;
 
+import java.lang.annotation.Annotation;
 import java.nio.*;
+import java.util.ArrayList;
+import java.util.Collection;
 
-import java.lang.annotation.Annotation;
+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 3281 2010-03-12 21:55:13Z spasi $
- *
+ * $Id: NativeTypeTranslator.java 3412 2010-09-26 23:43:24Z spasi $
+ * <p/>
  * A TypeVisitor that translates (annotated) TypeMirrors to
  * native types
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3281 $
+ * @version $Revision: 3412 $
  */
 public class NativeTypeTranslator implements TypeVisitor {
+
 	private Collection<Class> native_types;
 	private boolean is_indirect;
 	private final Declaration declaration;
@@ -76,26 +76,32 @@ public class NativeTypeTranslator implements TypeVisitor {
 	}
 
 	public String getSignature() {
+		return getSignature(false);
+	}
+
+	public String getSignature(final boolean skipConst) {
 		StringBuilder signature = new StringBuilder();
-		if (declaration.getAnnotation(Const.class) != null)
+		if ( !skipConst && declaration.getAnnotation(Const.class) != null )
 			signature.append("const ");
 
-		if ( declaration.getAnnotation(GLpointer.class) != null ) {
-			signature.append(declaration.getAnnotation(GLpointer.class).value());
+		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)
+		if ( is_indirect )
 			signature.append(" *");
 		return signature.toString();
 	}
 
 	public Class getAnnotationType() {
-		if (native_types.size() != 1)
+		if ( native_types.size() != 1 )
 			throw new RuntimeException("Expected only one native type for declaration " + declaration +
-					", but got " + native_types.size());
+			                           ", but got " + native_types.size());
 		return native_types.iterator().next();
 	}
 
@@ -104,34 +110,43 @@ public class NativeTypeTranslator implements TypeVisitor {
 	}
 
 	public void visitArrayType(ArrayType t) {
-		if ( "java.lang.CharSequence".equals(t.getComponentType().toString()) ) {
+		final Class<?> type = Utils.getJavaType(t).getComponentType();
+
+		if ( CharSequence.class.isAssignableFrom(type) ) {
 			is_indirect = true;
 			native_types = new ArrayList<Class>();
-			native_types.add(GLchar.class);
+			native_types.add(type_map.getStringArrayType());
+		} else if ( Buffer.class.isAssignableFrom(type) ) {
+			is_indirect = true;
+			native_types = new ArrayList<Class>();
+			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))
+		if ( IntBuffer.class.equals(c) )
 			return PrimitiveType.Kind.INT;
-		else if (DoubleBuffer.class.equals(c))
+		else if ( DoubleBuffer.class.equals(c) )
 			return PrimitiveType.Kind.DOUBLE;
-		else if (ShortBuffer.class.equals(c))
+		else if ( ShortBuffer.class.equals(c) )
 			return PrimitiveType.Kind.SHORT;
-		else if (ByteBuffer.class.equals(c))
+		else if ( ByteBuffer.class.equals(c) || PointerBuffer.class.equals(c) )
 			return PrimitiveType.Kind.BYTE;
-		else if (FloatBuffer.class.equals(c))
+		else if ( FloatBuffer.class.equals(c) )
 			return PrimitiveType.Kind.FLOAT;
-		else if (LongBuffer.class.equals(c))
+		else if ( LongBuffer.class.equals(c) )
 			return PrimitiveType.Kind.LONG;
 		else
 			throw new RuntimeException(c + " is not allowed");
 	}
 
-	public static Class<?> getClassFromType(DeclaredType t) {
+	@SuppressWarnings("unchecked")
+	public static Class<? extends Annotation> getClassFromType(DeclaredType t) {
 		try {
-			return Class.forName(t.getDeclaration().getQualifiedName());
+			return (Class<? extends Annotation>)Class.forName(t.getDeclaration().getQualifiedName());
 		} catch (ClassNotFoundException e) {
 			throw new RuntimeException(e);
 		}
@@ -139,7 +154,7 @@ public class NativeTypeTranslator implements TypeVisitor {
 
 	private void getNativeTypeFromAnnotatedPrimitiveType(PrimitiveType.Kind kind) {
 		native_types = translateAnnotations();
-		if (native_types.size() == 0)
+		if ( native_types.size() == 0 )
 			native_types.add(type_map.getNativeTypeFromPrimitiveType(kind));
 	}
 
@@ -147,18 +162,21 @@ public class NativeTypeTranslator implements TypeVisitor {
 		is_indirect = true;
 
 		Class<?> c = getClassFromType(t);
-		if (String.class.equals(c)) {
+		if ( String.class.equals(c) ) {
 			native_types = new ArrayList<Class>();
 			native_types.add(type_map.getStringElementType());
-		} else if (Buffer.class.equals(c)) {
+		} else if ( Buffer.class.equals(c) ) {
 			native_types = new ArrayList<Class>();
 			native_types.add(type_map.getVoidType());
-		} else if (Buffer.class.isAssignableFrom(c)) {
+		} else if ( Buffer.class.isAssignableFrom(c) ) {
 			PrimitiveType.Kind kind = getPrimitiveKindFromBufferClass(c);
 			getNativeTypeFromAnnotatedPrimitiveType(kind);
-		} else if ( PointerWrapper.class.isAssignableFrom(c) ) {
+		} else if ( PointerBuffer.class.isAssignableFrom(c) ) {
 			native_types = new ArrayList<Class>();
-			native_types.add(GLpointer.class);
+			native_types.add(PointerBuffer.class);
+		} else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(c) ) {
+			native_types = new ArrayList<Class>();
+			native_types.add(PointerWrapper.class);
 
 			is_indirect = false;
 		} else
@@ -182,13 +200,14 @@ public class NativeTypeTranslator implements TypeVisitor {
 	}
 
 	// Check if the annotation is itself annotated with a certain annotation type
+
 	public static <T extends Annotation> T getAnnotation(AnnotationMirror annotation, Class<T> type) {
 		return annotation.getAnnotationType().getDeclaration().getAnnotation(type);
 	}
 
 	private static Class translateAnnotation(AnnotationMirror annotation) {
 		NativeType native_type = getAnnotation(annotation, NativeType.class);
-		if (native_type != null) {
+		if ( native_type != null ) {
 			return getClassFromType(annotation.getAnnotationType());
 		} else
 			return null;
@@ -196,9 +215,9 @@ public class NativeTypeTranslator implements TypeVisitor {
 
 	private Collection<Class> translateAnnotations() {
 		Collection<Class> result = new ArrayList<Class>();
-		for (AnnotationMirror annotation : Utils.getSortedAnnotations(declaration.getAnnotationMirrors())) {
+		for ( AnnotationMirror annotation : Utils.getSortedAnnotations(declaration.getAnnotationMirrors()) ) {
 			Class translated_result = translateAnnotation(annotation);
-			if (translated_result != null) {
+			if ( translated_result != null ) {
 				result.add(translated_result);
 			}
 		}
@@ -219,7 +238,7 @@ public class NativeTypeTranslator implements TypeVisitor {
 
 	public void visitVoidType(VoidType t) {
 		native_types = translateAnnotations();
-		if (native_types.size() == 0)
+		if ( native_types.size() == 0 )
 			native_types.add(void.class);
 	}
 
diff --git a/src/java/org/lwjgl/util/generator/PointerArray.java b/src/java/org/lwjgl/util/generator/PointerArray.java
new file mode 100644
index 0000000..49c5de9
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/PointerArray.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator;
+
+/**
+ *
+ * @author spasi <spasi at users.sourceforge.net>
+ */
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+ at 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 "";
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/PointerWrapper.java b/src/java/org/lwjgl/util/generator/PointerWrapper.java
new file mode 100644
index 0000000..1d49279
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/PointerWrapper.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR 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 <spasi at users.sourceforge.net>
+ */
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+ at 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.
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/PostfixTranslator.java b/src/java/org/lwjgl/util/generator/PostfixTranslator.java
index a47faee..66fd0db 100644
--- a/src/java/org/lwjgl/util/generator/PostfixTranslator.java
+++ b/src/java/org/lwjgl/util/generator/PostfixTranslator.java
@@ -38,14 +38,15 @@ package org.lwjgl.util.generator;
  * postfixes.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3287 $
- * $Id: PostfixTranslator.java 3287 2010-03-14 23:24:40Z spasi $
+ * @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 {
@@ -108,7 +109,7 @@ public class PostfixTranslator implements TypeVisitor {
 	private boolean translateAnnotation(AnnotationMirror annotation) {
 		NativeType native_type = NativeTypeTranslator.getAnnotation(annotation, NativeType.class);
 		if (native_type != null) {
-			Class annotation_class = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
+			Class<? extends Annotation> annotation_class = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
 			signature.append(type_map.translateAnnotation(annotation_class));
 			return true;
 		} else
diff --git a/src/java/org/lwjgl/util/generator/Private.java b/src/java/org/lwjgl/util/generator/Private.java
new file mode 100644
index 0000000..7ef50d7
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/Private.java
@@ -0,0 +1,46 @@
+/*
+ * 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 <code>@Private</code> will result in classes without the <code>public</code> keyword.
+ *
+ * @author Spasi
+ */
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+ at Target({ElementType.TYPE, ElementType.METHOD})
+public @interface Private {
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java b/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java
index dc311f6..8b3577b 100644
--- a/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java
+++ b/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java
@@ -37,10 +37,12 @@ package org.lwjgl.util.generator;
  * This class generates the initNatives native function.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3288 $
- * $Id: RegisterStubsGenerator.java 3288 2010-03-16 17:58:48Z spasi $
+ * @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.*;
 
@@ -52,7 +54,8 @@ public class RegisterStubsGenerator {
 		Iterator<? extends MethodDeclaration> it = d.getMethods().iterator();
 		while (it.hasNext()) {
 			MethodDeclaration method = it.next();
-			if ( method.getAnnotation(Alternate.class) != null )
+			Alternate alt_annotation = method.getAnnotation(Alternate.class);
+			if ( (alt_annotation != null && (!alt_annotation.nativeAlt() || alt_annotation.skipNative())) || method.getAnnotation(Reuse.class) != null )
 				continue;
 			EnumSet<Platform> platforms;
 			PlatformDependent platform_annotation = method.getAnnotation(PlatformDependent.class);
@@ -83,20 +86,30 @@ public class RegisterStubsGenerator {
 		Collection<ParameterDeclaration> params = method.getParameters();
 		String signature = "(";
 		for (ParameterDeclaration param : params) {
-			if (param.getAnnotation(Result.class) != null)
+			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) {
+
+			if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null)
 				signature += "I";
-			} else {
+			else
 				signature += getTypeSignature(param.getType(), true);
-			}
 		}
-		TypeMirror result_type = Utils.getMethodReturnType(method);
-		if (Utils.getNIOBufferType(result_type) != null)
-			signature += "I";
+
+		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 (method.getAnnotation(CachedResult.class) != null)
+		if ( cached_result_annotation != null )
 			signature += result_type_signature;
+
 		signature += ")";
 		signature += result_type_signature;
 		return signature;
@@ -110,8 +123,11 @@ public class RegisterStubsGenerator {
 		writer.print(Utils.getQualifiedNativeMethodName(Utils.getQualifiedClassName(d), method, generate_error_checks, context_specific));
 		if (mode == Mode.BUFFEROBJECT)
 			writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX);
-		String opengl_handle_name = method.getSimpleName().replaceFirst("gl", platform.getPrefix());
-		writer.print(", \"" + opengl_handle_name + "\", (void *)&" + method.getSimpleName() + "}");
+
+		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(",");
 	}
diff --git a/src/java/org/lwjgl/util/generator/Reuse.java b/src/java/org/lwjgl/util/generator/Reuse.java
new file mode 100644
index 0000000..4d151ea
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/Reuse.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.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
+ */
+ at Target(ElementType.METHOD)
+public @interface Reuse {
+	/** The extension Class that defines the method. */
+	String value();
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/SignatureTranslator.java b/src/java/org/lwjgl/util/generator/SignatureTranslator.java
index 0d4ba11..4ff5275 100644
--- a/src/java/org/lwjgl/util/generator/SignatureTranslator.java
+++ b/src/java/org/lwjgl/util/generator/SignatureTranslator.java
@@ -37,10 +37,12 @@ package org.lwjgl.util.generator;
  * A TypeVisitor that translates types to JNI signatures.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 2983 $
- * $Id: SignatureTranslator.java 2983 2008-04-07 18:36:09Z matzon $
+ * @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.*;
 
@@ -67,17 +69,33 @@ class SignatureTranslator implements TypeVisitor {
 	}
 
 	public void visitArrayType(ArrayType t) {
-		throw new RuntimeException(t + " is not allowed");
+		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) {
-		String type_name = getNativeNameFromClassName(t.getDeclaration().getQualifiedName());
+		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(type_name);
+		signature.append(getNativeNameFromClassName(type_name));
 		signature.append(";");
-		if (add_position_signature && Buffer.class.isAssignableFrom(NativeTypeTranslator.getClassFromType(t))) {
+		if ( add_position_signature && Utils.isAddressableType(type) && !String.class.equals(type) )
 			signature.append("I");
-		}
 	}
 
 	public void visitDeclaredType(DeclaredType t) {
diff --git a/src/java/org/lwjgl/util/generator/TypeInfo.java b/src/java/org/lwjgl/util/generator/TypeInfo.java
index 9f1b69d..f8eb0e8 100644
--- a/src/java/org/lwjgl/util/generator/TypeInfo.java
+++ b/src/java/org/lwjgl/util/generator/TypeInfo.java
@@ -37,13 +37,16 @@ package org.lwjgl.util.generator;
  * TypeInfos in case of multityped parameters.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3279 $
- * $Id: TypeInfo.java 3279 2010-03-11 21:06:49Z spasi $
+ * @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.*;
 
@@ -95,6 +98,9 @@ public class TypeInfo {
 			case BYTE:
 				type = byte.class;
 				break;
+			case BOOLEAN:
+				type = boolean.class;
+				break;
 			default:
 				throw new RuntimeException(kind + " is not allowed");
 		}
@@ -151,7 +157,7 @@ public class TypeInfo {
 		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<? extends Annotation> 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);
diff --git a/src/java/org/lwjgl/util/generator/TypeMap.java b/src/java/org/lwjgl/util/generator/TypeMap.java
index 2c53086..bbf30b9 100644
--- a/src/java/org/lwjgl/util/generator/TypeMap.java
+++ b/src/java/org/lwjgl/util/generator/TypeMap.java
@@ -37,27 +37,33 @@ package org.lwjgl.util.generator;
  * The interface to the OpenAL/OpenGL specific generator behaviour
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 2983 $
- * $Id: TypeMap.java 2983 2008-04-07 18:36:09Z matzon $
+ * @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 {
-	String getErrorCheckMethodName();
+	void printCapabilitiesInit(PrintWriter writer);
+	String getCapabilities();
+	void printErrorCheckMethod(PrintWriter writer, MethodDeclaration method, String tabs);
 	String getRegisterNativesFunctionName();
-	PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class native_type);
-	String getTypedefPrefix();
+	PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class<? extends Annotation> native_type);
+	String getTypedefPostfix();
+	String getFunctionPrefix();
 	void printNativeIncludes(PrintWriter writer);
-	Class getStringElementType();
+	Class<? extends Annotation> getStringElementType();
+	Class<? extends Annotation> getStringArrayType();
+	Class<? extends Annotation> getByteBufferArrayType();
 	Class[] getValidAnnotationTypes(Class type);
-	Class getVoidType();
-	String translateAnnotation(Class annotation_type);
+	Class<? extends Annotation> getVoidType();
+	String translateAnnotation(Class<? extends Annotation> annotation_type);
 	Class getNativeTypeFromPrimitiveType(PrimitiveType.Kind kind);
 	String getAutoTypeFromAnnotation(AnnotationMirror annotation);
-	Class getInverseType(Class type);
-	Signedness getSignednessFromType(Class type);
+	Class<? extends Annotation> getInverseType(Class<? extends Annotation> type);
+	Signedness getSignednessFromType(Class<? extends Annotation> type);
 }
diff --git a/src/java/org/lwjgl/util/generator/TypedefsGenerator.java b/src/java/org/lwjgl/util/generator/TypedefsGenerator.java
index 4b11d3f..96c7c2d 100644
--- a/src/java/org/lwjgl/util/generator/TypedefsGenerator.java
+++ b/src/java/org/lwjgl/util/generator/TypedefsGenerator.java
@@ -37,8 +37,8 @@ package org.lwjgl.util.generator;
  * A TypeVisitor that generates the native typedefs.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3281 $
- * $Id: TypedefsGenerator.java 3281 2010-03-12 21:55:13Z spasi $
+ * @version $Revision: 3412 $
+ * $Id: TypedefsGenerator.java 3412 2010-09-26 23:43:24Z spasi $
  */
 
 import com.sun.mirror.declaration.*;
@@ -51,11 +51,12 @@ 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.getTypedefPrefix());
+		writer.print(type_map.getFunctionPrefix());
 		writer.print(" *" + Utils.getTypedefName(method) + ") (");
 		generateNativeTypedefsParameters(type_map, writer, method.getParameters());
 		writer.println(");");
@@ -63,11 +64,17 @@ public class TypedefsGenerator {
 
 	private static void generateNativeTypedefsParameters(TypeMap type_map, PrintWriter writer, Collection<ParameterDeclaration> params) {
 		if (params.size() > 0) {
-			Iterator<ParameterDeclaration> it = params.iterator();
-			generateNativeTypedefsParameter(type_map, writer, it.next());
-			while (it.hasNext()) {
-				writer.print(", ");
-				generateNativeTypedefsParameter(type_map, writer, it.next());
+			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);
 			}
 		}
 	}
@@ -76,14 +83,14 @@ public class TypedefsGenerator {
 		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(StringList.class) != null)
+		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<? extends MethodDeclaration> methods) {
 		for (MethodDeclaration method : methods) {
-			if ( method.getAnnotation(Alternate.class) == null )
+			if ( method.getAnnotation(Alternate.class) == null && method.getAnnotation(Reuse.class) == null )
 				generateNativeTypedefs(type_map, writer, method);
 		}
 	}
diff --git a/src/java/org/lwjgl/util/generator/Utils.java b/src/java/org/lwjgl/util/generator/Utils.java
index dd2e2fa..31d89b3 100644
--- a/src/java/org/lwjgl/util/generator/Utils.java
+++ b/src/java/org/lwjgl/util/generator/Utils.java
@@ -36,10 +36,16 @@ package org.lwjgl.util.generator;
  * Various utility methods to the generator.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3339 $
- * $Id: Utils.java 3339 2010-05-07 17:03:36Z spasi $
+ * @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;
@@ -75,11 +81,19 @@ public class Utils {
 	}
 
 	public static String getFunctionAddressName(InterfaceDeclaration interface_decl, MethodDeclaration method, boolean forceAlt) {
-		Alternate alt_annotation = method.getAnnotation(Alternate.class);
+		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 interface_decl.getSimpleName() + "_" + method.getSimpleName() + FUNCTION_POINTER_POSTFIX;
+			return interfaceName + "_" + method.getSimpleName() + FUNCTION_POINTER_POSTFIX;
 		else
-			return interface_decl.getSimpleName() + "_" + alt_annotation.value() + FUNCTION_POINTER_POSTFIX;
+			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) {
@@ -115,7 +129,15 @@ public class Utils {
 	}
 
 	public static boolean isAddressableType(Class type) {
-		return Buffer.class.isAssignableFrom(type) || String.class.equals(type) || CharSequence.class.equals(type) || CharSequence[].class.equals(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) {
@@ -147,16 +169,39 @@ public class Utils {
 	}
 
 	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) {
-			String tab = decl instanceof InterfaceDeclaration ? "" : "\t";
+			final String tab = decl instanceof InterfaceDeclaration ? "" : "\t";
 			writer.println(tab + "/**");
-			StringTokenizer doc_lines = new StringTokenizer(doc_comment, "\n");
-			while (doc_lines.hasMoreTokens())
-				writer.println(tab + " * " + doc_lines.nextToken());
+
+			if ( overloadsComment != null ) {
+				writer.println("\t * " + overloadsComment);
+				writer.println("\t * <p>");
+			}
+
+			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 + " * <p>");
+					lastWasNL = true;
+				} else {
+					writer.println(tab + " * " + t);
+					lastWasNL = false;
+				}
+			}
+
 			writer.println(tab + " */");
-		} else if ( (decl instanceof MethodDeclaration) && decl.getAnnotation(Alternate.class) != null )
-			writer.println("\t/** Overloads " + decl.getAnnotation(Alternate.class).value() + " */");
+		} else if ( overloadsComment != null )
+			writer.println("\t/** " + overloadsComment + " */");
 	}
 
 	public static AnnotationMirror getParameterAutoAnnotation(ParameterDeclaration param) {
@@ -241,7 +286,7 @@ public class Utils {
 	}
 
 	public static boolean needResultSize(MethodDeclaration method) {
-		return getNIOBufferType(getMethodReturnType(method)) != null && method.getAnnotation(AutoResultSize.class) == null;
+		return getNIOBufferType(getMethodReturnType(method)) != null && method.getAnnotation(AutoSize.class) == null;
 	}
 
 	public static void printExtraCallArguments(PrintWriter writer, MethodDeclaration method, String size_parameter_name) {
@@ -289,7 +334,7 @@ public class Utils {
 		Class<?> param_type = getJavaType(t);
 		if (Buffer.class.isAssignableFrom(param_type))
 			return param_type;
-		else if ( param_type == CharSequence.class || param_type == CharSequence[].class )
+		else if ( param_type == CharSequence.class || param_type == CharSequence[].class || param_type == PointerBuffer.class )
 			return ByteBuffer.class;
 		else
 			return null;
@@ -337,9 +382,9 @@ public class Utils {
 
 			} else if ( type.equals(CharSequence[].class) ) {
 				if ( offset == null )
-					offset = "APIUtils.getTotalLength(" + p.getSimpleName() + ")";
+					offset = "APIUtil.getTotalLength(" + p.getSimpleName() + ")";
 				else
-					offset += " + APIUtils.getTotalLength(" + p.getSimpleName() + ")";
+					offset += " + APIUtil.getTotalLength(" + p.getSimpleName() + ")";
 				if ( p.getAnnotation(NullTerminated.class) != null ) offset += " + " + p.getSimpleName() + ".length";
 			}
 
@@ -352,10 +397,10 @@ public class Utils {
 
 		if ( "String".equals(return_type) ) {
 			if ( !return_annotation.forceMaxLength() ) {
-				writer.println("IntBuffer " + return_annotation.value() + "_length = APIUtils.getLengths();");
+				writer.println("IntBuffer " + return_annotation.value() + "_length = APIUtil.getLengths();");
 				writer.print("\t\t");
 			}
-			writer.print("ByteBuffer " + return_annotation.value() + " = APIUtils.getBufferByte(" + return_annotation.maxLength());
+			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
@@ -367,13 +412,18 @@ public class Utils {
 			writer.println(");");
 		} else {
 			final String buffer_type = "Boolean".equals(return_type) ? "Byte" : return_type;
-			writer.print(buffer_type + "Buffer " + return_annotation.value() + " = APIUtils.getBuffer" + buffer_type + "(");
+			writer.print(buffer_type + "Buffer " + return_annotation.value() + " = APIUtil.getBuffer" + buffer_type + "(");
 			if ( "Byte".equals(buffer_type) )
 				writer.print('1');
 			writer.println(");");
 		}
 
-		writer.print("\t\t");
+		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) {
@@ -389,7 +439,7 @@ public class Utils {
 			else
 				writer.print(return_annotation.value() + "_length.get(0)");
 			writer.println(");");
-			writer.println("\t\treturn APIUtils.getString(" + return_annotation.value() + ");");
+			writer.println("\t\treturn APIUtil.getString(" + return_annotation.value() + ");");
 		} else {
 			writer.print("\t\treturn " + return_annotation.value() + ".get(0)");
 			if ( "Boolean".equals(return_type) )
diff --git a/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java b/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java
new file mode 100644
index 0000000..12cbc13
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java
@@ -0,0 +1,242 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR 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 <elias_naur at users.sourceforge.net>
+ * @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<Class, PrimitiveType.Kind> native_types_to_primitive;
+
+	static {
+		native_types_to_primitive = new HashMap<Class, PrimitiveType.Kind>();
+		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<? extends Annotation> getStringElementType()	{
+		return ALubyte.class;
+	}
+
+	public Class<? extends Annotation> getStringArrayType() {
+		return ALubyte.class;
+	}
+
+	public Class<? extends Annotation> 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<? extends Annotation> getVoidType() {
+		return ALvoid.class;
+	}
+
+	public Class<? extends Annotation> 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;
+	}
+}
diff --git a/src/java/org/lwjgl/util/generator/openal/ALboolean.java b/src/java/org/lwjgl/util/generator/openal/ALboolean.java
new file mode 100644
index 0000000..85543f0
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/openal/ALboolean.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.openal;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface ALboolean {
+}
diff --git a/src/java/org/lwjgl/util/generator/openal/ALbyte.java b/src/java/org/lwjgl/util/generator/openal/ALbyte.java
new file mode 100644
index 0000000..dae5a31
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/openal/ALbyte.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.openal;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface ALbyte {
+}
diff --git a/src/java/org/lwjgl/util/generator/openal/ALdouble.java b/src/java/org/lwjgl/util/generator/openal/ALdouble.java
new file mode 100644
index 0000000..f5460d6
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/openal/ALdouble.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.openal;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface ALdouble {
+}
diff --git a/src/java/org/lwjgl/util/generator/openal/ALenum.java b/src/java/org/lwjgl/util/generator/openal/ALenum.java
new file mode 100644
index 0000000..cac5f9e
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/openal/ALenum.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.openal;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface ALenum {
+}
diff --git a/src/java/org/lwjgl/util/generator/openal/ALfloat.java b/src/java/org/lwjgl/util/generator/openal/ALfloat.java
new file mode 100644
index 0000000..fd144f9
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/openal/ALfloat.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.openal;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface ALfloat {
+}
diff --git a/src/java/org/lwjgl/util/generator/openal/ALint.java b/src/java/org/lwjgl/util/generator/openal/ALint.java
new file mode 100644
index 0000000..bb8a1f0
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/openal/ALint.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.openal;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface ALint {
+}
diff --git a/src/java/org/lwjgl/util/generator/openal/ALshort.java b/src/java/org/lwjgl/util/generator/openal/ALshort.java
new file mode 100644
index 0000000..2f08a86
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/openal/ALshort.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.openal;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface ALshort {
+}
diff --git a/src/java/org/lwjgl/util/generator/openal/ALsizei.java b/src/java/org/lwjgl/util/generator/openal/ALsizei.java
new file mode 100644
index 0000000..a72502b
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/openal/ALsizei.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.openal;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface ALsizei {
+}
diff --git a/src/java/org/lwjgl/util/generator/openal/ALubyte.java b/src/java/org/lwjgl/util/generator/openal/ALubyte.java
new file mode 100644
index 0000000..1cdb57c
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/openal/ALubyte.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.openal;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface ALubyte {
+}
diff --git a/src/java/org/lwjgl/util/generator/openal/ALuint.java b/src/java/org/lwjgl/util/generator/openal/ALuint.java
new file mode 100644
index 0000000..fd88cc3
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/openal/ALuint.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.openal;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface ALuint {
+}
diff --git a/src/java/org/lwjgl/util/generator/openal/ALvoid.java b/src/java/org/lwjgl/util/generator/openal/ALvoid.java
new file mode 100644
index 0000000..1346d6e
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/openal/ALvoid.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.openal;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface ALvoid {
+}
diff --git a/src/java/org/lwjgl/util/generator/opencl/CLCapabilitiesGenerator.java b/src/java/org/lwjgl/util/generator/opencl/CLCapabilitiesGenerator.java
new file mode 100644
index 0000000..4937c72
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/CLCapabilitiesGenerator.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR 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<TypeDeclaration> 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<? extends MethodDeclaration> 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");
+
+	}
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/CLDeviceExtension.java b/src/java/org/lwjgl/util/generator/opencl/CLDeviceExtension.java
new file mode 100644
index 0000000..3229244
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/CLDeviceExtension.java
@@ -0,0 +1,41 @@
+/*
+ * 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. */
+ at Target(ElementType.TYPE)
+public @interface CLDeviceExtension {
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessorFactory.java b/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessorFactory.java
new file mode 100644
index 0000000..b05fd57
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessorFactory.java
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR 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<String> supportedAnnotations = unmodifiableCollection(Arrays.asList("*"));
+
+	public Collection<String> supportedAnnotationTypes() {
+		return supportedAnnotations;
+	}
+
+	public Collection<String> supportedOptions() {
+		return unmodifiableCollection(Arrays.asList("-Acontextspecific"));
+	}
+
+	public void roundComplete(RoundCompleteEvent event) {
+		first_round = false;
+	}
+
+	public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> 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<TypeDeclaration> 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<? extends Annotation> capsType, final String capsName, final Class<? extends PointerWrapper> 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<TypeDeclaration> 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();
+		}
+
+	}
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/CLPDCapabilitiesGenerator.java b/src/java/org/lwjgl/util/generator/opencl/CLPDCapabilitiesGenerator.java
new file mode 100644
index 0000000..cbe0941
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/CLPDCapabilitiesGenerator.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR 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<TypeDeclaration> templates,
+	                                final Class<? extends Annotation> capsType, final String capsName,
+	                                final Class<? extends PointerWrapper> 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<String> 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<TypeDeclaration> templates, final Class<? extends Annotation> 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");
+	}
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/CLPlatformExtension.java b/src/java/org/lwjgl/util/generator/opencl/CLPlatformExtension.java
new file mode 100644
index 0000000..c4f7f5d
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/CLPlatformExtension.java
@@ -0,0 +1,41 @@
+/*
+ * 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. */
+ at Target(ElementType.TYPE)
+public @interface CLPlatformExtension {
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java b/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java
new file mode 100644
index 0000000..fb6b201
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java
@@ -0,0 +1,266 @@
+/*
+ * 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<Class, PrimitiveType.Kind> native_types_to_primitive;
+
+	static {
+		native_types_to_primitive = new HashMap<Class, PrimitiveType.Kind>();
+		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<? extends Annotation> getVoidType() {
+		return cl_void.class;
+	}
+
+	public Class<? extends Annotation> getStringElementType() {
+		return cl_char.class;
+	}
+
+	public Class<? extends Annotation> getStringArrayType() {
+		return cl_char.class;
+	}
+
+	public Class<? extends Annotation> 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<? extends Annotation> getInverseType(Class type) {
+		return null;
+	}
+
+	public String getAutoTypeFromAnnotation(AnnotationMirror annotation) {
+		return null;
+	}
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/cl_bitfield.java b/src/java/org/lwjgl/util/generator/opencl/cl_bitfield.java
new file mode 100644
index 0000000..1b84761
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/cl_bitfield.java
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+ at NativeType
+ at Target({ ElementType.PARAMETER })
+public @interface cl_bitfield {
+	String alias() default "";
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/cl_bool.java b/src/java/org/lwjgl/util/generator/opencl/cl_bool.java
new file mode 100644
index 0000000..8f56e84
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/cl_bool.java
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+ at NativeType
+ at Target({ ElementType.PARAMETER })
+public @interface cl_bool {
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/cl_byte.java b/src/java/org/lwjgl/util/generator/opencl/cl_byte.java
new file mode 100644
index 0000000..f6217e8
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/cl_byte.java
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+ at NativeType
+ at Target({ ElementType.PARAMETER, ElementType.METHOD })
+public @interface cl_byte {
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/cl_char.java b/src/java/org/lwjgl/util/generator/opencl/cl_char.java
new file mode 100644
index 0000000..2a2b975
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/cl_char.java
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+ at NativeType
+ at Target({ ElementType.PARAMETER })
+public @interface cl_char {
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/cl_double.java b/src/java/org/lwjgl/util/generator/opencl/cl_double.java
new file mode 100644
index 0000000..84890d7
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/cl_double.java
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+ at NativeType
+ at Target({ ElementType.PARAMETER, ElementType.METHOD })
+public @interface cl_double {
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/cl_float.java b/src/java/org/lwjgl/util/generator/opencl/cl_float.java
new file mode 100644
index 0000000..2b34b5c
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/cl_float.java
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+ at NativeType
+ at Target({ ElementType.PARAMETER, ElementType.METHOD })
+public @interface cl_float {
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/cl_int.java b/src/java/org/lwjgl/util/generator/opencl/cl_int.java
new file mode 100644
index 0000000..13c6fcf
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/cl_int.java
@@ -0,0 +1,42 @@
+/*
+ * 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;
+
+ at NativeType
+ at Target({ ElementType.PARAMETER, ElementType.METHOD })
+public @interface cl_int {
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/cl_long.java b/src/java/org/lwjgl/util/generator/opencl/cl_long.java
new file mode 100644
index 0000000..9c82554
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/cl_long.java
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+ at NativeType
+ at Target({ ElementType.PARAMETER })
+public @interface cl_long {
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/cl_short.java b/src/java/org/lwjgl/util/generator/opencl/cl_short.java
new file mode 100644
index 0000000..f21d5d5
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/cl_short.java
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+ at NativeType
+ at Target({ ElementType.PARAMETER, ElementType.METHOD })
+public @interface cl_short {
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/cl_uchar.java b/src/java/org/lwjgl/util/generator/opencl/cl_uchar.java
new file mode 100644
index 0000000..765454e
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/cl_uchar.java
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+ at NativeType
+ at Target({ ElementType.PARAMETER })
+public @interface cl_uchar {
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/cl_uint.java b/src/java/org/lwjgl/util/generator/opencl/cl_uint.java
new file mode 100644
index 0000000..b6f240d
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/cl_uint.java
@@ -0,0 +1,42 @@
+/*
+ * 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;
+
+ at NativeType
+ at Target({ ElementType.PARAMETER, ElementType.METHOD })
+public @interface cl_uint {
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/cl_void.java b/src/java/org/lwjgl/util/generator/opencl/cl_void.java
new file mode 100644
index 0000000..8b89cbf
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/cl_void.java
@@ -0,0 +1,45 @@
+/*
+ * 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;
+
+ at NativeType
+ at Target({ ElementType.PARAMETER, ElementType.METHOD })
+public @interface cl_void {
+	PrimitiveType.Kind value() default PrimitiveType.Kind.BYTE;
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opencl/size_t.java b/src/java/org/lwjgl/util/generator/opencl/size_t.java
new file mode 100644
index 0000000..6f65b58
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opencl/size_t.java
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+ at NativeType
+ at Target({ ElementType.PARAMETER })
+public @interface size_t {
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java b/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java
new file mode 100644
index 0000000..3281db5
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java
@@ -0,0 +1,328 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR 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 <elias_naur at users.sourceforge.net>
+ * @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<String> " + 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<InterfaceType> 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<InterfaceType> 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<String> " + 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<String> " + CACHED_EXTS_VAR_NAME + " = new HashSet<String>(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<? extends MethodDeclaration> 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<String> 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> platform_set = EnumSet.copyOf(Arrays.asList(platform_dependent.value()));
+				writer.print("GLContext.getPlatformSpecificFunctionAddress(\"");
+				writer.print(Platform.ALL.getPrefix() + "\", ");
+				writer.print("new String[]{");
+				Iterator<Platform> 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()) + ";");
+	}
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessorFactory.java b/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessorFactory.java
new file mode 100644
index 0000000..d3321ad
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessorFactory.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR 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 <elias_naur at users.sourceforge.net>
+ * @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<String> supportedAnnotations =
+		unmodifiableCollection(Arrays.asList("*"));
+
+	public Collection<String> supportedAnnotationTypes() {
+		return supportedAnnotations;
+	}
+
+	public Collection<String> supportedOptions() {
+		return unmodifiableCollection(Arrays.asList("-Acontextspecific", "-Ageneratechecks"));
+	}
+
+	public void roundComplete(RoundCompleteEvent event) {
+		first_round = false;
+	}
+
+	public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> 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<String, String> 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<TypeDeclaration> 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();
+		}
+	}
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessorFactory.java b/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessorFactory.java
new file mode 100644
index 0000000..7c1feb6
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessorFactory.java
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR 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 <elias_naur at users.sourceforge.net>
+ * @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<String> supportedAnnotations =
+		unmodifiableCollection(Arrays.asList("*"));
+
+	public Collection<String> supportedAnnotationTypes() {
+		return supportedAnnotations;
+	}
+
+	public Collection<String> supportedOptions() {
+		return emptyList();
+	}
+
+	public void roundComplete(RoundCompleteEvent event) {
+		first_round = false;
+	}
+
+	public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> 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<TypeDeclaration> 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();
+		}
+	}
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java b/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java
new file mode 100644
index 0000000..2c7455b
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java
@@ -0,0 +1,324 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR 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 <elias_naur at users.sourceforge.net>
+ * @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<Class, PrimitiveType.Kind> native_types_to_primitive;
+
+	static {
+		native_types_to_primitive = new HashMap<Class, PrimitiveType.Kind>();
+		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<? extends Annotation> getVoidType() {
+		return GLvoid.class;
+	}
+
+	public Class<? extends Annotation> getStringElementType() {
+		return GLubyte.class;
+	}
+
+	public Class<? extends Annotation> getStringArrayType() {
+		return GLchar.class;
+	}
+
+	public Class<? extends Annotation> 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<? extends Annotation> 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;
+	}
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLbitfield.java b/src/java/org/lwjgl/util/generator/opengl/GLbitfield.java
new file mode 100644
index 0000000..9da88de
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLbitfield.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLbitfield {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLboolean.java b/src/java/org/lwjgl/util/generator/opengl/GLboolean.java
new file mode 100644
index 0000000..8032c00
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLboolean.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLboolean {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLbyte.java b/src/java/org/lwjgl/util/generator/opengl/GLbyte.java
new file mode 100644
index 0000000..6c6f4e5
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLbyte.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLbyte {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLchar.java b/src/java/org/lwjgl/util/generator/opengl/GLchar.java
new file mode 100644
index 0000000..72000b0
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLchar.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLchar {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLcharARB.java b/src/java/org/lwjgl/util/generator/opengl/GLcharARB.java
new file mode 100644
index 0000000..b90ce28
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLcharARB.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLcharARB {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLclampd.java b/src/java/org/lwjgl/util/generator/opengl/GLclampd.java
new file mode 100644
index 0000000..3b861a0
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLclampd.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLclampd {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLclampf.java b/src/java/org/lwjgl/util/generator/opengl/GLclampf.java
new file mode 100644
index 0000000..53bf354
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLclampf.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLclampf {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLdouble.java b/src/java/org/lwjgl/util/generator/opengl/GLdouble.java
new file mode 100644
index 0000000..b6f977b
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLdouble.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLdouble {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLenum.java b/src/java/org/lwjgl/util/generator/opengl/GLenum.java
new file mode 100644
index 0000000..1e80d48
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLenum.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLenum {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLfloat.java b/src/java/org/lwjgl/util/generator/opengl/GLfloat.java
new file mode 100644
index 0000000..53fba73
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLfloat.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLfloat {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLhalf.java b/src/java/org/lwjgl/util/generator/opengl/GLhalf.java
new file mode 100644
index 0000000..6c2ffac
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLhalf.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLhalf {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLhandleARB.java b/src/java/org/lwjgl/util/generator/opengl/GLhandleARB.java
new file mode 100644
index 0000000..57b0a92
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLhandleARB.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLhandleARB {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLint.java b/src/java/org/lwjgl/util/generator/opengl/GLint.java
new file mode 100644
index 0000000..9354aff
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLint.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLint {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLint64.java b/src/java/org/lwjgl/util/generator/opengl/GLint64.java
new file mode 100644
index 0000000..ac8818e
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLint64.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+import org.lwjgl.util.generator.NativeType;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLint64 {
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLint64EXT.java b/src/java/org/lwjgl/util/generator/opengl/GLint64EXT.java
new file mode 100644
index 0000000..4ee07dc
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLint64EXT.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+import org.lwjgl.util.generator.NativeType;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLint64EXT {
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLintptr.java b/src/java/org/lwjgl/util/generator/opengl/GLintptr.java
new file mode 100644
index 0000000..829917b
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLintptr.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLintptr {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLintptrARB.java b/src/java/org/lwjgl/util/generator/opengl/GLintptrARB.java
new file mode 100644
index 0000000..6478144
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLintptrARB.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLintptrARB {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLreturn.java b/src/java/org/lwjgl/util/generator/opengl/GLreturn.java
new file mode 100644
index 0000000..bae905a
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLreturn.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.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;
+
+ at NativeType
+ at Target({ ElementType.METHOD })
+public @interface GLreturn {
+	/** The Buffer parameter to use as the method result. */
+	String value();
+	/** The argument that specifies the maximum number of bytes that may be read (String results only). */
+	String maxLength() default "";
+	/** If true, the maxLength value is going to be used when creating the String. */
+	boolean forceMaxLength() default false;
+	///** If we use the byte buffer for another parameter, an offset must be used. */
+	//String offset() default "";
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLshort.java b/src/java/org/lwjgl/util/generator/opengl/GLshort.java
new file mode 100644
index 0000000..a1509cc
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLshort.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLshort {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLsizei.java b/src/java/org/lwjgl/util/generator/opengl/GLsizei.java
new file mode 100644
index 0000000..31811af
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLsizei.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLsizei {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLsizeiptr.java b/src/java/org/lwjgl/util/generator/opengl/GLsizeiptr.java
new file mode 100644
index 0000000..f712d87
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLsizeiptr.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLsizeiptr {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLsizeiptrARB.java b/src/java/org/lwjgl/util/generator/opengl/GLsizeiptrARB.java
new file mode 100644
index 0000000..44e6049
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLsizeiptrARB.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLsizeiptrARB {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLtime.java b/src/java/org/lwjgl/util/generator/opengl/GLtime.java
new file mode 100644
index 0000000..557eb45
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLtime.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ * Unsigned binary representing an absolute absolute or relative time interval.
+ * Precision is nanoseconds but accuracy is implementation-dependent.
+ *
+ * @author spasi <spasi at users.sourceforge.net>
+ */
+
+import org.lwjgl.util.generator.NativeType;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLtime {
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLubyte.java b/src/java/org/lwjgl/util/generator/opengl/GLubyte.java
new file mode 100644
index 0000000..d870992
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLubyte.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLubyte {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLuint.java b/src/java/org/lwjgl/util/generator/opengl/GLuint.java
new file mode 100644
index 0000000..6685a8f
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLuint.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLuint {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLuint64.java b/src/java/org/lwjgl/util/generator/opengl/GLuint64.java
new file mode 100644
index 0000000..bb6e1c8
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLuint64.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+import org.lwjgl.util.generator.NativeType;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLuint64 {
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLuint64EXT.java b/src/java/org/lwjgl/util/generator/opengl/GLuint64EXT.java
new file mode 100644
index 0000000..efb62ac
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLuint64EXT.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+import org.lwjgl.util.generator.NativeType;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLuint64EXT {
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLushort.java b/src/java/org/lwjgl/util/generator/opengl/GLushort.java
new file mode 100644
index 0000000..0e11a7c
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLushort.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * @author elias_naur <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLushort {
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLvoid.java b/src/java/org/lwjgl/util/generator/opengl/GLvoid.java
new file mode 100644
index 0000000..978a022
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLvoid.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR 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 <elias_naur at users.sourceforge.net>
+ * @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;
+
+ at NativeType
+ at Target({ElementType.PARAMETER, ElementType.METHOD})
+public @interface GLvoid {
+	PrimitiveType.Kind value() default PrimitiveType.Kind.BYTE;
+}
diff --git a/src/java/org/lwjgl/util/glu/Cylinder.java b/src/java/org/lwjgl/util/glu/Cylinder.java
index f4d8543..f720092 100644
--- a/src/java/org/lwjgl/util/glu/Cylinder.java
+++ b/src/java/org/lwjgl/util/glu/Cylinder.java
@@ -1,42 +1,43 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 package org.lwjgl.util.glu;
 
-import org.lwjgl.opengl.GL11;
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.util.glu.GLU.*;
 
 /**
  * Cylinder.java
- * 
- * 
+ *
+ *
  * Created 23-dec-2003
  * @author Erik Duijs
  */
@@ -80,20 +81,20 @@ public class Cylinder extends Quadric {
 		float x, y, z, nz, nsign;
 		int i, j;
 
-		if (super.orientation == GLU.GLU_INSIDE) {
+		if (super.orientation == GLU_INSIDE) {
 			nsign = -1.0f;
 		} else {
 			nsign = 1.0f;
 		}
 
-		da = 2.0f * GLU.PI / slices;
+		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.GLU_POINT) {
-			GL11.glBegin(GL11.GL_POINTS);
+		if (super.drawStyle == GLU_POINT) {
+			glBegin(GL_POINTS);
 			for (i = 0; i < slices; i++) {
 				x = cos((i * da));
 				y = sin((i * da));
@@ -102,61 +103,61 @@ public class Cylinder extends Quadric {
 				z = 0.0f;
 				r = baseRadius;
 				for (j = 0; j <= stacks; j++) {
-					GL11.glVertex3f((x * r), (y * r), z);
+					glVertex3f((x * r), (y * r), z);
 					z += dz;
 					r += dr;
 				}
 			}
-			GL11.glEnd();
-		} else if (super.drawStyle == GLU.GLU_LINE || super.drawStyle == GLU.GLU_SILHOUETTE) {
+			glEnd();
+		} else if (super.drawStyle == GLU_LINE || super.drawStyle == GLU_SILHOUETTE) {
 			// Draw rings
-			if (super.drawStyle == GLU.GLU_LINE) {
+			if (super.drawStyle == GLU_LINE) {
 				z = 0.0f;
 				r = baseRadius;
 				for (j = 0; j <= stacks; j++) {
-					GL11.glBegin(GL11.GL_LINE_LOOP);
+					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);
-						GL11.glVertex3f((x * r), (y * r), z);
+						glVertex3f((x * r), (y * r), z);
 					}
-					GL11.glEnd();
+					glEnd();
 					z += dz;
 					r += dr;
 				}
 			} else {
 				// draw one ring at each end
 				if (baseRadius != 0.0) {
-					GL11.glBegin(GL11.GL_LINE_LOOP);
+					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);
-						GL11.glVertex3f((x * baseRadius), (y * baseRadius), 0.0f);
+						glVertex3f((x * baseRadius), (y * baseRadius), 0.0f);
 					}
-					GL11.glEnd();
-					GL11.glBegin(GL11.GL_LINE_LOOP);
+					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);
-						GL11.glVertex3f((x * topRadius), (y * topRadius), height);
+						glVertex3f((x * topRadius), (y * topRadius), height);
 					}
-					GL11.glEnd();
+					glEnd();
 				}
 			}
 			// draw length lines
-			GL11.glBegin(GL11.GL_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);
-				GL11.glVertex3f((x * baseRadius), (y * baseRadius), 0.0f);
-				GL11.glVertex3f((x * topRadius), (y * topRadius), (height));
+				glVertex3f((x * baseRadius), (y * baseRadius), 0.0f);
+				glVertex3f((x * topRadius), (y * topRadius), (height));
 			}
-			GL11.glEnd();
-		} else if (super.drawStyle == GLU.GLU_FILL) {
+			glEnd();
+		} else if (super.drawStyle == GLU_FILL) {
 			float ds = 1.0f / slices;
 			float dt = 1.0f / stacks;
 			float t = 0.0f;
@@ -164,7 +165,7 @@ public class Cylinder extends Quadric {
 			r = baseRadius;
 			for (j = 0; j < stacks; j++) {
 				float s = 0.0f;
-				GL11.glBegin(GL11.GL_QUAD_STRIP);
+				glBegin(GL_QUAD_STRIP);
 				for (i = 0; i <= slices; i++) {
 					if (i == slices) {
 						x = sin(0.0f);
@@ -176,21 +177,21 @@ public class Cylinder extends Quadric {
 					if (nsign == 1.0f) {
 						normal3f((x * nsign), (y * nsign), (nz * nsign));
 						TXTR_COORD(s, t);
-						GL11.glVertex3f((x * r), (y * r), z);
+						glVertex3f((x * r), (y * r), z);
 						normal3f((x * nsign), (y * nsign), (nz * nsign));
 						TXTR_COORD(s, t + dt);
-						GL11.glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz));
+						glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz));
 					} else {
 						normal3f(x * nsign, y * nsign, nz * nsign);
 						TXTR_COORD(s, t);
-						GL11.glVertex3f((x * r), (y * r), z);
+						glVertex3f((x * r), (y * r), z);
 						normal3f(x * nsign, y * nsign, nz * nsign);
 						TXTR_COORD(s, t + dt);
-						GL11.glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz));
+						glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz));
 					}
 					s += ds;
 				} // for slices
-				GL11.glEnd();
+				glEnd();
 				r += dr;
 				t += dt;
 				z += dz;
diff --git a/src/java/org/lwjgl/util/glu/Disk.java b/src/java/org/lwjgl/util/glu/Disk.java
index e0a76f9..18a2b9d 100644
--- a/src/java/org/lwjgl/util/glu/Disk.java
+++ b/src/java/org/lwjgl/util/glu/Disk.java
@@ -1,42 +1,43 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 package org.lwjgl.util.glu;
 
-import org.lwjgl.opengl.GL11;
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.util.glu.GLU.*;
 
 /**
  * Disk.java
- * 
- * 
+ *
+ *
  * Created 23-dec-2003
  * @author Erik Duijs
  */
@@ -72,20 +73,20 @@ public class Disk extends Quadric {
 	   float da, dr;
 
 	   /* Normal vectors */
-	   if (super.normals != GLU.GLU_NONE) {
-	      if (super.orientation == GLU.GLU_OUTSIDE) {
-		 GL11.glNormal3f(0.0f, 0.0f, +1.0f);
+	   if (super.normals != GLU_NONE) {
+	      if (super.orientation == GLU_OUTSIDE) {
+		 glNormal3f(0.0f, 0.0f, +1.0f);
 	      }
 	      else {
-		 GL11.glNormal3f(0.0f, 0.0f, -1.0f);
+		 glNormal3f(0.0f, 0.0f, -1.0f);
 	      }
 	   }
-	
-	   da = 2.0f * GLU.PI / slices;
+
+	   da = 2.0f * PI / slices;
 	   dr = (outerRadius - innerRadius) /  loops;
-	
+
 	   switch (super.drawStyle) {
-	   case GLU.GLU_FILL:
+	   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]
@@ -97,9 +98,9 @@ public class Disk extends Quadric {
 		 int l;
 		 for (l = 0; l < loops; l++) {
 		    float r2 = r1 + dr;
-		    if (super.orientation == GLU.GLU_OUTSIDE) {
+		    if (super.orientation == GLU_OUTSIDE) {
 		       int s;
-		       GL11.glBegin(GL11.GL_QUAD_STRIP);
+		       glBegin(GL_QUAD_STRIP);
 		       for (s = 0; s <= slices; s++) {
 			  float a;
 			  if (s == slices)
@@ -109,15 +110,15 @@ public class Disk extends Quadric {
 			  sa = sin(a);
 			  ca = cos(a);
 			  TXTR_COORD(0.5f + sa * r2 / dtc, 0.5f + ca * r2 / dtc);
-			  GL11.glVertex2f(r2 * sa, r2 * ca);
+			  glVertex2f(r2 * sa, r2 * ca);
 			  TXTR_COORD(0.5f + sa * r1 / dtc, 0.5f + ca * r1 / dtc);
-			  GL11.glVertex2f(r1 * sa, r1 * ca);
+			  glVertex2f(r1 * sa, r1 * ca);
 		       }
-		       GL11.glEnd();
+		       glEnd();
 		    }
 		    else {
 		       int s;
-		       GL11.glBegin(GL11.GL_QUAD_STRIP);
+		       glBegin(GL_QUAD_STRIP);
 		       for (s = slices; s >= 0; s--) {
 			  float a;
 			  if (s == slices)
@@ -127,47 +128,47 @@ public class Disk extends Quadric {
 			  sa = sin(a);
 			  ca = cos(a);
 			  TXTR_COORD(0.5f - sa * r2 / dtc, 0.5f + ca * r2 / dtc);
-			  GL11.glVertex2f(r2 * sa, r2 * ca);
+			  glVertex2f(r2 * sa, r2 * ca);
 			  TXTR_COORD(0.5f - sa * r1 / dtc, 0.5f + ca * r1 / dtc);
-			  GL11.glVertex2f(r1 * sa, r1 * ca);
+			  glVertex2f(r1 * sa, r1 * ca);
 		       }
-		       GL11.glEnd();
+		       glEnd();
 		    }
 		    r1 = r2;
 		 }
 		 break;
 	      }
-	   case GLU.GLU_LINE:
+	   case GLU_LINE:
 	      {
 		 int l, s;
 		 /* draw loops */
 		 for (l = 0; l <= loops; l++) {
 		    float r = innerRadius + l * dr;
-		    GL11.glBegin(GL11.GL_LINE_LOOP);
+		    glBegin(GL_LINE_LOOP);
 		    for (s = 0; s < slices; s++) {
 		       float a = s * da;
-		       GL11.glVertex2f(r * sin(a), r * cos(a));
+		       glVertex2f(r * sin(a), r * cos(a));
 		    }
-		    GL11.glEnd();
+		    glEnd();
 		 }
 		 /* draw spokes */
 		 for (s = 0; s < slices; s++) {
 		    float a = s * da;
 		    float x = sin(a);
 		    float y = cos(a);
-		    GL11.glBegin(GL11.GL_LINE_STRIP);
+		    glBegin(GL_LINE_STRIP);
 		    for (l = 0; l <= loops; l++) {
 		       float r = innerRadius + l * dr;
-		       GL11.glVertex2f(r * x, r * y);
+		       glVertex2f(r * x, r * y);
 		    }
-		    GL11.glEnd();
+		    glEnd();
 		 }
 		 break;
 	      }
-	   case GLU.GLU_POINT:
+	   case GLU_POINT:
 	      {
 		 int s;
-		 GL11.glBegin(GL11.GL_POINTS);
+		 glBegin(GL_POINTS);
 		 for (s = 0; s < slices; s++) {
 		    float a = s * da;
 		    float x = sin(a);
@@ -175,33 +176,33 @@ public class Disk extends Quadric {
 		    int l;
 		    for (l = 0; l <= loops; l++) {
 		       float r = innerRadius * l * dr;
-		       GL11.glVertex2f(r * x, r * y);
+		       glVertex2f(r * x, r * y);
 		    }
 		 }
-		 GL11.glEnd();
+		 glEnd();
 		 break;
 	      }
-	   case GLU.GLU_SILHOUETTE:
+	   case GLU_SILHOUETTE:
 	      {
 		 if (innerRadius != 0.0) {
 		    float a;
-		    GL11.glBegin(GL11.GL_LINE_LOOP);
-		    for (a = 0.0f; a < 2.0 * GLU.PI; a += da) {
+		    glBegin(GL_LINE_LOOP);
+		    for (a = 0.0f; a < 2.0 * PI; a += da) {
 		       float x = innerRadius * sin(a);
 		       float y = innerRadius * cos(a);
-		       GL11.glVertex2f(x, y);
+		       glVertex2f(x, y);
 		    }
-		    GL11.glEnd();
+		    glEnd();
 		 }
 		 {
 		    float a;
-		    GL11.glBegin(GL11.GL_LINE_LOOP);
-		    for (a = 0; a < 2.0f * GLU.PI; a += da) {
+		    glBegin(GL_LINE_LOOP);
+		    for (a = 0; a < 2.0f * PI; a += da) {
 		       float x = outerRadius * sin(a);
 		       float y = outerRadius * cos(a);
-		       GL11.glVertex2f(x, y);
+		       glVertex2f(x, y);
 		    }
-		    GL11.glEnd();
+		    glEnd();
 		 }
 		 break;
 	      }
diff --git a/src/java/org/lwjgl/util/glu/GLU.java b/src/java/org/lwjgl/util/glu/GLU.java
index c7e6271..e1b1c13 100644
--- a/src/java/org/lwjgl/util/glu/GLU.java
+++ b/src/java/org/lwjgl/util/glu/GLU.java
@@ -35,10 +35,11 @@ import java.nio.ByteBuffer;
 import java.nio.FloatBuffer;
 import java.nio.IntBuffer;
 
-import org.lwjgl.opengl.GL11;
 import org.lwjgl.opengl.Util;
 import org.lwjgl.util.glu.tessellation.GLUtessellatorImpl;
 
+import static org.lwjgl.opengl.GL11.*;
+
 /**
  * GLU.java
  *
@@ -266,7 +267,7 @@ public class GLU {
 			float bottom,
 			float top) {
 
-		GL11.glOrtho(left, right, bottom, top, -1.0, 1.0);
+		glOrtho(left, right, bottom, top, -1.0, 1.0);
 	}
 
 	/**
@@ -412,17 +413,17 @@ public class GLU {
 
 	public static String gluErrorString(int error_code) {
 		switch (error_code) {
-			case GLU.GLU_INVALID_ENUM:
+			case GLU_INVALID_ENUM:
 				return "Invalid enum (glu)";
-			case GLU.GLU_INVALID_VALUE:
+			case GLU_INVALID_VALUE:
 				return "Invalid value (glu)";
-			case GLU.GLU_OUT_OF_MEMORY:
+			case GLU_OUT_OF_MEMORY:
 				return "Out of memory (glu)";
 			default:
 				return Util.translateGLErrorString(error_code);
 		}
 	}
-	
+
 	public static GLUtessellator gluNewTess() {
 		return new GLUtessellatorImpl();
 	}
diff --git a/src/java/org/lwjgl/util/glu/GLUtessellator.java b/src/java/org/lwjgl/util/glu/GLUtessellator.java
index be6b3c1..60bf2c2 100644
--- a/src/java/org/lwjgl/util/glu/GLUtessellator.java
+++ b/src/java/org/lwjgl/util/glu/GLUtessellator.java
@@ -34,39 +34,39 @@ package org.lwjgl.util.glu;
 
 public interface GLUtessellator {
 
-	public abstract void gluDeleteTess();
+	void gluDeleteTess();
 
-	public abstract void gluTessProperty(int which, double value);
+	void gluTessProperty(int which, double value);
 
 	/* Returns tessellator property */
-	public abstract void gluGetTessProperty(int which, double[] value,
+	void gluGetTessProperty(int which, double[] value,
 			int value_offset); /* gluGetTessProperty() */
 
-	public abstract void gluTessNormal(double x, double y, double z);
+	void gluTessNormal(double x, double y, double z);
 
-	public abstract void gluTessCallback(int which,
+	void gluTessCallback(int which,
 			GLUtessellatorCallback aCallback);
 
-	public abstract void gluTessVertex(double[] coords, int coords_offset,
+	void gluTessVertex(double[] coords, int coords_offset,
 			Object vertexData);
 
-	public abstract void gluTessBeginPolygon(Object data);
+	void gluTessBeginPolygon(Object data);
 
-	public abstract void gluTessBeginContour();
+	void gluTessBeginContour();
 
-	public abstract void gluTessEndContour();
+	void gluTessEndContour();
 
-	public abstract void gluTessEndPolygon();
+	void gluTessEndPolygon();
 
 	/*******************************************************/
 
 	/* Obsolete calls -- for backward compatibility */
 
-	public abstract void gluBeginPolygon();
+	void gluBeginPolygon();
 
 	/*ARGSUSED*/
-	public abstract void gluNextContour(int type);
+	void gluNextContour(int type);
 
-	public abstract void gluEndPolygon();
+	void gluEndPolygon();
 
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/glu/GLUtessellatorCallback.java b/src/java/org/lwjgl/util/glu/GLUtessellatorCallback.java
index 3f3413f..0f913f7 100644
--- a/src/java/org/lwjgl/util/glu/GLUtessellatorCallback.java
+++ b/src/java/org/lwjgl/util/glu/GLUtessellatorCallback.java
@@ -112,7 +112,7 @@ public interface GLUtessellatorCallback {
    * @see #end     end
    * @see #begin   begin
    */
-  public void begin(int type);
+  void begin(int type);
 
   /**
    * The same as the {@link #begin begin} callback method except that
@@ -131,7 +131,7 @@ public interface GLUtessellatorCallback {
    * @see #endData endData
    * @see #begin   begin
    */
-  public void beginData(int type, Object polygonData);
+  void beginData(int type, Object polygonData);
 
 
   /**
@@ -158,7 +158,7 @@ public interface GLUtessellatorCallback {
    * @see GLU#gluTessCallback gluTessCallback
    * @see #edgeFlagData edgeFlagData
    */
-  public void edgeFlag(boolean boundaryEdge);
+  void edgeFlag(boolean boundaryEdge);
 
 
   /**
@@ -175,7 +175,7 @@ public interface GLUtessellatorCallback {
    * @see GLU#gluTessCallback            gluTessCallback
    * @see #edgeFlag edgeFlag
    */
-  public void edgeFlagData(boolean boundaryEdge, Object polygonData);
+  void edgeFlagData(boolean boundaryEdge, Object polygonData);
 
 
   /**
@@ -195,7 +195,7 @@ public interface GLUtessellatorCallback {
    * @see GLU#gluTessCallback              gluTessCallback
    * @see #vertexData vertexData
    */
-  public void vertex(Object vertexData);
+  void vertex(Object vertexData);
 
 
   /**
@@ -213,7 +213,7 @@ public interface GLUtessellatorCallback {
    * @see GLU#gluTessCallback          gluTessCallback
    * @see #vertex vertex
    */
-  public void vertexData(Object vertexData, Object polygonData);
+  void vertexData(Object vertexData, Object polygonData);
 
 
   /**
@@ -225,7 +225,7 @@ public interface GLUtessellatorCallback {
    * @see #begin   begin
    * @see #endData endData
    */
-  public void end();
+  void end();
 
 
   /**
@@ -241,7 +241,7 @@ public interface GLUtessellatorCallback {
    * @see #beginData beginData
    * @see #end       end
    */
-  public void endData(Object polygonData);
+  void endData(Object polygonData);
 
 
   /**
@@ -308,8 +308,8 @@ public interface GLUtessellatorCallback {
    * @see GLU#gluTessCallback               gluTessCallback
    * @see #combineData combineData
    */
-  public void combine(double[] coords, Object[] data,
-                      float[] weight, Object[] outData);
+  void combine(double[] coords, Object[] data,
+               float[] weight, Object[] outData);
 
 
   /**
@@ -332,9 +332,9 @@ public interface GLUtessellatorCallback {
    * @see GLU#gluTessCallback           gluTessCallback
    * @see #combine combine
    */
-  public void combineData(double[] coords, Object[] data,
-                          float[] weight, Object[] outData,
-                          Object polygonData);
+  void combineData(double[] coords, Object[] data,
+                   float[] weight, Object[] outData,
+                   Object polygonData);
 
 
   /**
@@ -365,7 +365,7 @@ public interface GLUtessellatorCallback {
    * @see GLU#gluTessCallback             gluTessCallback
    * @see #errorData errorData
    */
-  public void error(int errnum);
+  void error(int errnum);
 
 
   /**
@@ -382,7 +382,7 @@ public interface GLUtessellatorCallback {
    * @see GLU#gluTessCallback         gluTessCallback
    * @see #error error
    */
-  public void errorData(int errnum, Object polygonData);
+  void errorData(int errnum, Object polygonData);
 
   //void mesh(com.sun.opengl.impl.tessellator.GLUmesh mesh);
 }
diff --git a/src/java/org/lwjgl/util/glu/MipMap.java b/src/java/org/lwjgl/util/glu/MipMap.java
index 698371f..a8a7665 100644
--- a/src/java/org/lwjgl/util/glu/MipMap.java
+++ b/src/java/org/lwjgl/util/glu/MipMap.java
@@ -34,7 +34,9 @@ package org.lwjgl.util.glu;
 import java.nio.ByteBuffer;
 
 import org.lwjgl.BufferUtils;
-import org.lwjgl.opengl.GL11;
+
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.util.glu.GLU.*;
 
 /**
  * MipMap.java
@@ -60,13 +62,13 @@ public class MipMap extends Util {
 	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.GLU_INVALID_VALUE;
+		if ( width < 1 || height < 1 ) return GLU_INVALID_VALUE;
 
 		final int bpp = bytesPerPixel(format, type);
 		if ( bpp == 0 )
-			return GLU.GLU_INVALID_ENUM;
+			return GLU_INVALID_ENUM;
 
-		final int maxSize = glGetIntegerv(GL11.GL_MAX_TEXTURE_SIZE);
+		final int maxSize = glGetIntegerv(GL_MAX_TEXTURE_SIZE);
 
 		int w = nearestPower(width);
 		if ( w > maxSize )
@@ -80,10 +82,10 @@ public class MipMap extends Util {
 		PixelStoreState pss = new PixelStoreState();
 
 		// set pixel packing
-		GL11.glPixelStorei(GL11.GL_PACK_ROW_LENGTH, 0);
-		GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
-		GL11.glPixelStorei(GL11.GL_PACK_SKIP_ROWS, 0);
-		GL11.glPixelStorei(GL11.GL_PACK_SKIP_PIXELS, 0);
+		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;
@@ -99,10 +101,10 @@ public class MipMap extends Util {
 			}
 
 			/* set pixel unpacking */
-			GL11.glPixelStorei(GL11.GL_UNPACK_ROW_LENGTH, 0);
-			GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
-			GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_ROWS, 0);
-			GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_PIXELS, 0);
+			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;
 		}
@@ -114,13 +116,13 @@ public class MipMap extends Util {
 		while ( !done ) {
 			if (image != data) {
 				/* set pixel unpacking */
-				GL11.glPixelStorei(GL11.GL_UNPACK_ROW_LENGTH, 0);
-				GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
-				GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_ROWS, 0);
-				GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_PIXELS, 0);
-			} 			
-			
-			GL11.glTexImage2D(target, level, components, w, h, 0, format, type, image);
+				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;
@@ -177,7 +179,7 @@ public class MipMap extends Util {
 
 		final int components = compPerPix(format);
 		if ( components == -1 )
-			return GLU.GLU_INVALID_ENUM;
+			return GLU_INVALID_ENUM;
 
 		int i, j, k;
 		float[] tempIn, tempOut;
@@ -191,26 +193,26 @@ public class MipMap extends Util {
 
 		// Determine bytes per input type
 		switch ( typein ) {
-			case GL11.GL_UNSIGNED_BYTE:
+			case GL_UNSIGNED_BYTE:
 				sizein = 1;
 				break;
-			case GL11.GL_FLOAT:
+			case GL_FLOAT:
 				sizein = 4;
-				break;				
+				break;
 			default:
-				return GL11.GL_INVALID_ENUM;
+				return GL_INVALID_ENUM;
 		}
 
 		// Determine bytes per output type
 		switch ( typeOut ) {
-			case GL11.GL_UNSIGNED_BYTE:
+			case GL_UNSIGNED_BYTE:
 				sizeout = 1;
 				break;
-			case GL11.GL_FLOAT:
+			case GL_FLOAT:
 				sizeout = 4;
-				break;				
+				break;
 			default:
-				return GL11.GL_INVALID_ENUM;
+				return GL_INVALID_ENUM;
 		}
 
 		// Get glPixelStore state
@@ -228,7 +230,7 @@ public class MipMap extends Util {
 			rowstride = pss.unpackAlignment / sizein * ceil(components * rowlen * sizein, pss.unpackAlignment);
 
 		switch ( typein ) {
-			case GL11.GL_UNSIGNED_BYTE:
+			case GL_UNSIGNED_BYTE:
 				k = 0;
 				dataIn.rewind();
 				for ( i = 0; i < heightIn; i++ ) {
@@ -238,7 +240,7 @@ public class MipMap extends Util {
 					}
 				}
 				break;
-			case GL11.GL_FLOAT:
+			case GL_FLOAT:
 				k = 0;
 				dataIn.rewind();
 				for ( i = 0; i < heightIn; i++ )
@@ -250,9 +252,9 @@ public class MipMap extends Util {
 						fptr += 4;
 					}
 				}
-				break;				
+				break;
 			default:
-				return GLU.GLU_INVALID_ENUM;
+				return GLU_INVALID_ENUM;
 		}
 
 		// Do scaling
@@ -321,7 +323,7 @@ public class MipMap extends Util {
 			rowstride = pss.packAlignment / sizeout * ceil(components * rowlen * sizeout, pss.packAlignment);
 
 		switch ( typeOut ) {
-			case GL11.GL_UNSIGNED_BYTE:
+			case GL_UNSIGNED_BYTE:
 				k = 0;
 				for ( i = 0; i < heightOut; i++ ) {
 					int ubptr = i * rowstride + pss.packSkipRows * rowstride + pss.packSkipPixels * components;
@@ -331,19 +333,19 @@ public class MipMap extends Util {
 					}
 				}
 				break;
-			case GL11.GL_FLOAT:
+			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;				
+				break;
 			default:
-				return GLU.GLU_INVALID_ENUM;
+				return GLU_INVALID_ENUM;
 		}
 
 		return 0;
diff --git a/src/java/org/lwjgl/util/glu/PartialDisk.java b/src/java/org/lwjgl/util/glu/PartialDisk.java
index 0347eca..e811436 100644
--- a/src/java/org/lwjgl/util/glu/PartialDisk.java
+++ b/src/java/org/lwjgl/util/glu/PartialDisk.java
@@ -1,44 +1,45 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 package org.lwjgl.util.glu;
 
-import org.lwjgl.opengl.GL11;
+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 {
@@ -58,18 +59,18 @@ public class PartialDisk extends Quadric {
 	 * 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),
@@ -127,9 +128,9 @@ public class PartialDisk extends Quadric {
 
 		/* Cache is the vertex locations cache */
 
-		angleOffset = startAngle / 180.0f * GLU.PI;
+		angleOffset = startAngle / 180.0f * PI;
 		for (i = 0; i <= slices; i++) {
-			angle = angleOffset + ((GLU.PI * sweepAngle) / 180.0f) * i / slices;
+			angle = angleOffset + ((PI * sweepAngle) / 180.0f) * i / slices;
 			sinCache[i] = sin(angle);
 			cosCache[i] = cos(angle);
 		}
@@ -140,54 +141,54 @@ public class PartialDisk extends Quadric {
 		}
 
 		switch (super.normals) {
-			case GLU.GLU_FLAT :
-			case GLU.GLU_SMOOTH :
-				if (super.orientation == GLU.GLU_OUTSIDE) {
-					GL11.glNormal3f(0.0f, 0.0f, 1.0f);
+			case GLU_FLAT :
+			case GLU_SMOOTH :
+				if (super.orientation == GLU_OUTSIDE) {
+					glNormal3f(0.0f, 0.0f, 1.0f);
 				} else {
-					GL11.glNormal3f(0.0f, 0.0f, -1.0f);
+					glNormal3f(0.0f, 0.0f, -1.0f);
 				}
 				break;
 			default :
-			case GLU.GLU_NONE :
+			case GLU_NONE :
 				break;
 		}
 
 		switch (super.drawStyle) {
-			case GLU.GLU_FILL :
+			case GLU_FILL :
 				if (innerRadius == .0f) {
 					finish = loops - 1;
 					/* Triangle strip for inner polygons */
-					GL11.glBegin(GL11.GL_TRIANGLE_FAN);
+					glBegin(GL_TRIANGLE_FAN);
 					if (super.textureFlag) {
-						GL11.glTexCoord2f(0.5f, 0.5f);
+						glTexCoord2f(0.5f, 0.5f);
 					}
-					GL11.glVertex3f(0.0f, 0.0f, 0.0f);
+					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.GLU_OUTSIDE) {
+					if (super.orientation == GLU_OUTSIDE) {
 						for (i = slices; i >= 0; i--) {
 							if (super.textureFlag) {
-								GL11.glTexCoord2f(
+								glTexCoord2f(
 									texLow * sinCache[i] + 0.5f,
 									texLow * cosCache[i] + 0.5f);
 							}
-							GL11.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f);
+							glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f);
 						}
 					} else {
 						for (i = 0; i <= slices; i++) {
 							if (super.textureFlag) {
-								GL11.glTexCoord2f(
+								glTexCoord2f(
 									texLow * sinCache[i] + 0.5f,
 									texLow * cosCache[i] + 0.5f);
 							}
-							GL11.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f);
+							glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f);
 						}
 					}
-					GL11.glEnd();
+					glEnd();
 				} else {
 					finish = loops;
 				}
@@ -199,49 +200,49 @@ public class PartialDisk extends Quadric {
 						texHigh = radiusHigh / outerRadius / 2;
 					}
 
-					GL11.glBegin(GL11.GL_QUAD_STRIP);
+					glBegin(GL_QUAD_STRIP);
 					for (i = 0; i <= slices; i++) {
-						if (super.orientation == GLU.GLU_OUTSIDE) {
+						if (super.orientation == GLU_OUTSIDE) {
 							if (super.textureFlag) {
-								GL11.glTexCoord2f(
+								glTexCoord2f(
 									texLow * sinCache[i] + 0.5f,
 									texLow * cosCache[i] + 0.5f);
 							}
-							GL11.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f);
+							glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f);
 
 							if (super.textureFlag) {
-								GL11.glTexCoord2f(
+								glTexCoord2f(
 									texHigh * sinCache[i] + 0.5f,
 									texHigh * cosCache[i] + 0.5f);
 							}
-							GL11.glVertex3f(
+							glVertex3f(
 								radiusHigh * sinCache[i],
 								radiusHigh * cosCache[i],
 								0.0f);
 						} else {
 							if (super.textureFlag) {
-								GL11.glTexCoord2f(
+								glTexCoord2f(
 									texHigh * sinCache[i] + 0.5f,
 									texHigh * cosCache[i] + 0.5f);
 							}
-							GL11.glVertex3f(
+							glVertex3f(
 								radiusHigh * sinCache[i],
 								radiusHigh * cosCache[i],
 								0.0f);
 
 							if (super.textureFlag) {
-								GL11.glTexCoord2f(
+								glTexCoord2f(
 									texLow * sinCache[i] + 0.5f,
 									texLow * cosCache[i] + 0.5f);
 							}
-							GL11.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f);
+							glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f);
 						}
 					}
-					GL11.glEnd();
+					glEnd();
 				}
 				break;
-			case GLU.GLU_POINT :
-				GL11.glBegin(GL11.GL_POINTS);
+			case GLU_POINT :
+				glBegin(GL_POINTS);
 				for (i = 0; i < slices2; i++) {
 					sintemp = sinCache[i];
 					costemp = cosCache[i];
@@ -251,26 +252,26 @@ public class PartialDisk extends Quadric {
 						if (super.textureFlag) {
 							texLow = radiusLow / outerRadius / 2;
 
-							GL11.glTexCoord2f(
+							glTexCoord2f(
 								texLow * sinCache[i] + 0.5f,
 								texLow * cosCache[i] + 0.5f);
 						}
-						GL11.glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0f);
+						glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0f);
 					}
 				}
-				GL11.glEnd();
+				glEnd();
 				break;
-			case GLU.GLU_LINE :
+			case GLU_LINE :
 				if (innerRadius == outerRadius) {
-					GL11.glBegin(GL11.GL_LINE_STRIP);
+					glBegin(GL_LINE_STRIP);
 
 					for (i = 0; i <= slices; i++) {
 						if (super.textureFlag) {
-							GL11.glTexCoord2f(sinCache[i] / 2 + 0.5f, cosCache[i] / 2 + 0.5f);
+							glTexCoord2f(sinCache[i] / 2 + 0.5f, cosCache[i] / 2 + 0.5f);
 						}
-						GL11.glVertex3f(innerRadius * sinCache[i], innerRadius * cosCache[i], 0.0f);
+						glVertex3f(innerRadius * sinCache[i], innerRadius * cosCache[i], 0.0f);
 					}
-					GL11.glEnd();
+					glEnd();
 					break;
 				}
 				for (j = 0; j <= loops; j++) {
@@ -279,21 +280,21 @@ public class PartialDisk extends Quadric {
 						texLow = radiusLow / outerRadius / 2;
 					}
 
-					GL11.glBegin(GL11.GL_LINE_STRIP);
+					glBegin(GL_LINE_STRIP);
 					for (i = 0; i <= slices; i++) {
 						if (super.textureFlag) {
-							GL11.glTexCoord2f(
+							glTexCoord2f(
 								texLow * sinCache[i] + 0.5f,
 								texLow * cosCache[i] + 0.5f);
 						}
-						GL11.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f);
+						glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f);
 					}
-					GL11.glEnd();
+					glEnd();
 				}
 				for (i = 0; i < slices2; i++) {
 					sintemp = sinCache[i];
 					costemp = cosCache[i];
-					GL11.glBegin(GL11.GL_LINE_STRIP);
+					glBegin(GL_LINE_STRIP);
 					for (j = 0; j <= loops; j++) {
 						radiusLow = outerRadius - deltaRadius * ((float) j / loops);
 						if (super.textureFlag) {
@@ -301,33 +302,33 @@ public class PartialDisk extends Quadric {
 						}
 
 						if (super.textureFlag) {
-							GL11.glTexCoord2f(
+							glTexCoord2f(
 								texLow * sinCache[i] + 0.5f,
 								texLow * cosCache[i] + 0.5f);
 						}
-						GL11.glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0f);
+						glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0f);
 					}
-					GL11.glEnd();
+					glEnd();
 				}
 				break;
-			case GLU.GLU_SILHOUETTE :
+			case GLU_SILHOUETTE :
 				if (sweepAngle < 360.0f) {
 					for (i = 0; i <= slices; i += slices) {
 						sintemp = sinCache[i];
 						costemp = cosCache[i];
-						GL11.glBegin(GL11.GL_LINE_STRIP);
+						glBegin(GL_LINE_STRIP);
 						for (j = 0; j <= loops; j++) {
 							radiusLow = outerRadius - deltaRadius * ((float) j / loops);
 
 							if (super.textureFlag) {
 								texLow = radiusLow / outerRadius / 2;
-								GL11.glTexCoord2f(
+								glTexCoord2f(
 									texLow * sinCache[i] + 0.5f,
 									texLow * cosCache[i] + 0.5f);
 							}
-							GL11.glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0f);
+							glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0f);
 						}
-						GL11.glEnd();
+						glEnd();
 					}
 				}
 				for (j = 0; j <= loops; j += loops) {
@@ -336,16 +337,16 @@ public class PartialDisk extends Quadric {
 						texLow = radiusLow / outerRadius / 2;
 					}
 
-					GL11.glBegin(GL11.GL_LINE_STRIP);
+					glBegin(GL_LINE_STRIP);
 					for (i = 0; i <= slices; i++) {
 						if (super.textureFlag) {
-							GL11.glTexCoord2f(
+							glTexCoord2f(
 								texLow * sinCache[i] + 0.5f,
 								texLow * cosCache[i] + 0.5f);
 						}
-						GL11.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f);
+						glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f);
 					}
-					GL11.glEnd();
+					glEnd();
 					if (innerRadius == outerRadius)
 						break;
 				}
diff --git a/src/java/org/lwjgl/util/glu/PixelStoreState.java b/src/java/org/lwjgl/util/glu/PixelStoreState.java
index 6efbe50..3e6612a 100644
--- a/src/java/org/lwjgl/util/glu/PixelStoreState.java
+++ b/src/java/org/lwjgl/util/glu/PixelStoreState.java
@@ -1,37 +1,37 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 package org.lwjgl.util.glu;
 
-import org.lwjgl.opengl.GL11;
+import static org.lwjgl.opengl.GL11.*;
 
 /**
  * PixelStoreState.java
@@ -60,25 +60,25 @@ class PixelStoreState extends Util {
 	}
 
 	public void load() {
-		unpackRowLength = glGetIntegerv(GL11.GL_UNPACK_ROW_LENGTH);
-		unpackAlignment = glGetIntegerv(GL11.GL_UNPACK_ALIGNMENT);
-		unpackSkipRows = glGetIntegerv(GL11.GL_UNPACK_SKIP_ROWS);
-		unpackSkipPixels = glGetIntegerv(GL11.GL_UNPACK_SKIP_PIXELS);
-		packRowLength = glGetIntegerv(GL11.GL_PACK_ROW_LENGTH);
-		packAlignment = glGetIntegerv(GL11.GL_PACK_ALIGNMENT);
-		packSkipRows = glGetIntegerv(GL11.GL_PACK_SKIP_ROWS);
-		packSkipPixels = glGetIntegerv(GL11.GL_PACK_SKIP_PIXELS);
+		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() {
-		GL11.glPixelStorei(GL11.GL_UNPACK_ROW_LENGTH, unpackRowLength);
-		GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, unpackAlignment);
-		GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_ROWS, unpackSkipRows);
-		GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_PIXELS, unpackSkipPixels);
-		GL11.glPixelStorei(GL11.GL_PACK_ROW_LENGTH, packRowLength);
-		GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, packAlignment);
-		GL11.glPixelStorei(GL11.GL_PACK_SKIP_ROWS, packSkipRows);
-		GL11.glPixelStorei(GL11.GL_PACK_SKIP_PIXELS, packSkipPixels);
+		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);
 	}
 
 }
diff --git a/src/java/org/lwjgl/util/glu/Project.java b/src/java/org/lwjgl/util/glu/Project.java
index 151dcb8..a3005c6 100644
--- a/src/java/org/lwjgl/util/glu/Project.java
+++ b/src/java/org/lwjgl/util/glu/Project.java
@@ -1,31 +1,31 @@
 /* 
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -37,12 +37,14 @@ import java.nio.IntBuffer;
 import org.lwjgl.BufferUtils;
 import org.lwjgl.opengl.GL11;
 
+import static org.lwjgl.opengl.GL11.*;
+
 /**
  * Project.java
  * <p/>
  * <p/>
  * Created 11-jan-2004
- * 
+ *
  * @author Erik Duijs
  */
 public class Project extends Util {
@@ -76,7 +78,7 @@ public class Project extends Util {
 
 	/**
 	 * Method __gluMultMatrixVecf
-	 * 
+	 *
 	 * @param finalMatrix
 	 * @param in
 	 * @param out
@@ -95,7 +97,7 @@ public class Project extends Util {
 	/**
 	 * @param src
 	 * @param inverse
-	 * 
+	 *
 	 * @return
 	 */
 	private static boolean __gluInvertMatrixf(FloatBuffer src, FloatBuffer inverse) {
@@ -185,7 +187,7 @@ public class Project extends Util {
 
 	/**
 	 * Method gluPerspective.
-	 * 
+	 *
 	 * @param fovy
 	 * @param aspect
 	 * @param zNear
@@ -213,12 +215,12 @@ public class Project extends Util {
 		matrix.put(3 * 4 + 2, -2 * zNear * zFar / deltaZ);
 		matrix.put(3 * 4 + 3, 0);
 
-		GL11.glMultMatrix(matrix);
+		glMultMatrix(matrix);
 	}
 
 	/**
 	 * Method gluLookAt
-	 * 
+	 *
 	 * @param eyex
 	 * @param eyey
 	 * @param eyez
@@ -273,13 +275,13 @@ public class Project extends Util {
 		matrix.put(1 * 4 + 2, -forward[1]);
 		matrix.put(2 * 4 + 2, -forward[2]);
 
-		GL11.glMultMatrix(matrix);
-		GL11.glTranslatef(-eyex, -eyey, -eyez);
+		glMultMatrix(matrix);
+		glTranslatef(-eyex, -eyey, -eyez);
 	}
 
 	/**
 	 * Method gluProject
-	 * 
+	 *
 	 * @param objx
 	 * @param objy
 	 * @param objz
@@ -328,7 +330,7 @@ public class Project extends Util {
 
 	/**
 	 * Method gluUnproject
-	 * 
+	 *
 	 * @param winx
 	 * @param winy
 	 * @param winz
@@ -383,7 +385,7 @@ public class Project extends Util {
 
 	/**
 	 * Method gluPickMatrix
-	 * 
+	 *
 	 * @param x
 	 * @param y
 	 * @param deltaX
@@ -401,10 +403,10 @@ public class Project extends Util {
 		}
 
 		/* Translate and scale the picked region to the entire window */
-		GL11.glTranslatef(
+		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);
-		GL11.glScalef(viewport.get(viewport.position() + 2) / deltaX, viewport.get(viewport.position() + 3) / deltaY, 1.0f);
+		glScalef(viewport.get(viewport.position() + 2) / deltaX, viewport.get(viewport.position() + 3) / deltaY, 1.0f);
 	}
 }
diff --git a/src/java/org/lwjgl/util/glu/Quadric.java b/src/java/org/lwjgl/util/glu/Quadric.java
index 3f4c652..3bbbf6e 100644
--- a/src/java/org/lwjgl/util/glu/Quadric.java
+++ b/src/java/org/lwjgl/util/glu/Quadric.java
@@ -1,62 +1,63 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 package org.lwjgl.util.glu;
 
-import org.lwjgl.opengl.GL11;
+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.GLU_FILL;
-		orientation = GLU.GLU_OUTSIDE;
+
+		drawStyle = GLU_FILL;
+		orientation = GLU_OUTSIDE;
 		textureFlag = false;
-		normals = GLU.GLU_SMOOTH;
+		normals = GLU_SMOOTH;
 	}
 
 	/**
@@ -68,18 +69,18 @@ public class Quadric {
 	 */
 	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;
 	   }
-	   GL11.glNormal3f(x, y, z);
+	   glNormal3f(x, y, z);
 	}
 
 	/**
-     * specifies the draw style for quadrics.  
+     * specifies the draw style for quadrics.
      *
      * The legal values are as follows:
      *
@@ -93,7 +94,7 @@ public class Quadric {
      * 		   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) {
@@ -110,7 +111,7 @@ public class 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) {
@@ -127,7 +128,7 @@ public class Quadric {
      *
      * 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) {
@@ -142,13 +143,13 @@ public class Quadric {
      *
      * 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.
@@ -183,7 +184,7 @@ public class Quadric {
 	}
 
 	protected void TXTR_COORD(float x, float y) {
-		if (textureFlag) GL11.glTexCoord2f(x,y);
+		if (textureFlag) glTexCoord2f(x,y);
 	}
 
 
diff --git a/src/java/org/lwjgl/util/glu/Registry.java b/src/java/org/lwjgl/util/glu/Registry.java
index a472dcc..4150567 100644
--- a/src/java/org/lwjgl/util/glu/Registry.java
+++ b/src/java/org/lwjgl/util/glu/Registry.java
@@ -1,36 +1,38 @@
 /* 
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 package org.lwjgl.util.glu;
 
+import static org.lwjgl.util.glu.GLU.*;
+
 /**
  * Registry.java
  *
@@ -51,9 +53,9 @@ public class Registry extends Util {
 	 */
 	public static String gluGetString(int name) {
 
-		if (name == GLU.GLU_VERSION) {
+		if (name == GLU_VERSION) {
 			return versionString;
-		} else if (name == GLU.GLU_EXTENSIONS) {
+		} else if (name == GLU_EXTENSIONS) {
 			return extensionString;
 		}
 		return null;
diff --git a/src/java/org/lwjgl/util/glu/Sphere.java b/src/java/org/lwjgl/util/glu/Sphere.java
index fcc60ab..4e33516 100644
--- a/src/java/org/lwjgl/util/glu/Sphere.java
+++ b/src/java/org/lwjgl/util/glu/Sphere.java
@@ -1,38 +1,38 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 package org.lwjgl.util.glu;
 
-
-import org.lwjgl.opengl.GL11;
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.util.glu.GLU.*;
 
 /**
  * Sphere.java
@@ -75,34 +75,34 @@ public class Sphere extends Quadric {
 		boolean normals;
 		float nsign;
 
-		normals = super.normals != GLU.GLU_NONE;
+		normals = super.normals != GLU_NONE;
 
-		if (super.orientation == GLU.GLU_INSIDE) {
+		if (super.orientation == GLU_INSIDE) {
 			nsign = -1.0f;
 		} else {
 			nsign = 1.0f;
 		}
 
-		drho = GLU.PI / stacks;
-		dtheta = 2.0f * GLU.PI / slices;
+		drho = PI / stacks;
+		dtheta = 2.0f * PI / slices;
 
-		if (super.drawStyle == GLU.GLU_FILL) {
+		if (super.drawStyle == GLU_FILL) {
 			if (!super.textureFlag) {
 				// draw +Z end as a triangle fan
-				GL11.glBegin(GL11.GL_TRIANGLE_FAN);
-				GL11.glNormal3f(0.0f, 0.0f, 1.0f);
-				GL11.glVertex3f(0.0f, 0.0f, nsign * radius);
+				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) {
-						GL11.glNormal3f(x * nsign, y * nsign, z * nsign);
+						glNormal3f(x * nsign, y * nsign, z * nsign);
 					}
-					GL11.glVertex3f(x * radius, y * radius, z * radius);
+					glVertex3f(x * radius, y * radius, z * radius);
 				}
-				GL11.glEnd();
+				glEnd();
 			}
 
 			ds = 1.0f / slices;
@@ -119,7 +119,7 @@ public class Sphere extends Quadric {
 			// draw intermediate stacks as quad strips
 			for (i = imin; i < imax; i++) {
 				rho = i * drho;
-				GL11.glBegin(GL11.GL_QUAD_STRIP);
+				glBegin(GL_QUAD_STRIP);
 				s = 0.0f;
 				for (j = 0; j <= slices; j++) {
 					theta = (j == slices) ? 0.0f : j * dtheta;
@@ -127,30 +127,30 @@ public class Sphere extends Quadric {
 					y = cos(theta) * sin(rho);
 					z = nsign * cos(rho);
 					if (normals) {
-						GL11.glNormal3f(x * nsign, y * nsign, z * nsign);
+						glNormal3f(x * nsign, y * nsign, z * nsign);
 					}
 					TXTR_COORD(s, t);
-					GL11.glVertex3f(x * radius, y * radius, z * radius);
+					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) {
-						GL11.glNormal3f(x * nsign, y * nsign, z * nsign);
+						glNormal3f(x * nsign, y * nsign, z * nsign);
 					}
 					TXTR_COORD(s, t - dt);
 					s += ds;
-					GL11.glVertex3f(x * radius, y * radius, z * radius);
+					glVertex3f(x * radius, y * radius, z * radius);
 				}
-				GL11.glEnd();
+				glEnd();
 				t -= dt;
 			}
 
 			if (!super.textureFlag) {
 				// draw -Z end as a triangle fan
-				GL11.glBegin(GL11.GL_TRIANGLE_FAN);
-				GL11.glNormal3f(0.0f, 0.0f, -1.0f);
-				GL11.glVertex3f(0.0f, 0.0f, -radius * nsign);
-				rho = GLU.PI - drho;
+				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;
@@ -158,56 +158,56 @@ public class Sphere extends Quadric {
 					y = cos(theta) * sin(rho);
 					z = nsign * cos(rho);
 					if (normals)
-						GL11.glNormal3f(x * nsign, y * nsign, z * nsign);
+						glNormal3f(x * nsign, y * nsign, z * nsign);
 					s -= ds;
-					GL11.glVertex3f(x * radius, y * radius, z * radius);
+					glVertex3f(x * radius, y * radius, z * radius);
 				}
-				GL11.glEnd();
+				glEnd();
 			}
 		} else if (
-			super.drawStyle == GLU.GLU_LINE
-				|| super.drawStyle == GLU.GLU_SILHOUETTE) {
+			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;
-				GL11.glBegin(GL11.GL_LINE_LOOP);
+				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)
-						GL11.glNormal3f(x * nsign, y * nsign, z * nsign);
-					GL11.glVertex3f(x * radius, y * radius, z * radius);
+						glNormal3f(x * nsign, y * nsign, z * nsign);
+					glVertex3f(x * radius, y * radius, z * radius);
 				}
-				GL11.glEnd();
+				glEnd();
 			}
 			// draw slice lines
 			for (j = 0; j < slices; j++) {
 				theta = j * dtheta;
-				GL11.glBegin(GL11.GL_LINE_STRIP);
+				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)
-						GL11.glNormal3f(x * nsign, y * nsign, z * nsign);
-					GL11.glVertex3f(x * radius, y * radius, z * radius);
+						glNormal3f(x * nsign, y * nsign, z * nsign);
+					glVertex3f(x * radius, y * radius, z * radius);
 				}
-				GL11.glEnd();
+				glEnd();
 			}
-		} else if (super.drawStyle == GLU.GLU_POINT) {
+		} else if (super.drawStyle == GLU_POINT) {
 			// top and bottom-most points
-			GL11.glBegin(GL11.GL_POINTS);
+			glBegin(GL_POINTS);
 			if (normals)
-				GL11.glNormal3f(0.0f, 0.0f, nsign);
-			GL11.glVertex3f(0.0f, 0.0f, radius);
+				glNormal3f(0.0f, 0.0f, nsign);
+			glVertex3f(0.0f, 0.0f, radius);
 			if (normals)
-				GL11.glNormal3f(0.0f, 0.0f, -nsign);
-			GL11.glVertex3f(0.0f, 0.0f, -radius);
+				glNormal3f(0.0f, 0.0f, -nsign);
+			glVertex3f(0.0f, 0.0f, -radius);
 
 			// loop over stacks
 			for (i = 1; i < stacks - 1; i++) {
@@ -218,11 +218,11 @@ public class Sphere extends Quadric {
 					y = sin(theta) * sin(rho);
 					z = cos(rho);
 					if (normals)
-						GL11.glNormal3f(x * nsign, y * nsign, z * nsign);
-					GL11.glVertex3f(x * radius, y * radius, z * radius);
+						glNormal3f(x * nsign, y * nsign, z * nsign);
+					glVertex3f(x * radius, y * radius, z * radius);
 				}
 			}
-			GL11.glEnd();
+			glEnd();
 		}
 	}
 
diff --git a/src/java/org/lwjgl/util/glu/Util.java b/src/java/org/lwjgl/util/glu/Util.java
index ea45d12..10cbb3f 100644
--- a/src/java/org/lwjgl/util/glu/Util.java
+++ b/src/java/org/lwjgl/util/glu/Util.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -34,8 +34,9 @@ package org.lwjgl.util.glu;
 import java.nio.IntBuffer;
 
 import org.lwjgl.BufferUtils;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GL12;
+
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.opengl.GL12.*;
 
 /**
  * Util.java
@@ -110,22 +111,22 @@ public class Util {
 	protected static int compPerPix(int format) {
 		/* Determine number of components per pixel */
 		switch ( format ) {
-			case GL11.GL_COLOR_INDEX:
-			case GL11.GL_STENCIL_INDEX:
-			case GL11.GL_DEPTH_COMPONENT:
-			case GL11.GL_RED:
-			case GL11.GL_GREEN:
-			case GL11.GL_BLUE:
-			case GL11.GL_ALPHA:
-			case GL11.GL_LUMINANCE:
+			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 GL11.GL_LUMINANCE_ALPHA:
+			case GL_LUMINANCE_ALPHA:
 				return 2;
-			case GL11.GL_RGB:
-			case GL12.GL_BGR:
+			case GL_RGB:
+			case GL_BGR:
 				return 3;
-			case GL11.GL_RGBA:
-			case GL12.GL_BGRA:
+			case GL_RGBA:
+			case GL_BGRA:
 				return 4;
 			default :
 				return -1;
@@ -173,25 +174,25 @@ public class Util {
 		int n, m;
 
 		switch ( format ) {
-			case GL11.GL_COLOR_INDEX:
-			case GL11.GL_STENCIL_INDEX:
-			case GL11.GL_DEPTH_COMPONENT:
-			case GL11.GL_RED:
-			case GL11.GL_GREEN:
-			case GL11.GL_BLUE:
-			case GL11.GL_ALPHA:
-			case GL11.GL_LUMINANCE:
+			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 GL11.GL_LUMINANCE_ALPHA:
+			case GL_LUMINANCE_ALPHA:
 				n = 2;
 				break;
-			case GL11.GL_RGB:
-			case GL12.GL_BGR:
+			case GL_RGB:
+			case GL_BGR:
 				n = 3;
 				break;
-			case GL11.GL_RGBA:
-			case GL12.GL_BGRA:
+			case GL_RGBA:
+			case GL_BGRA:
 				n = 4;
 				break;
 			default :
@@ -199,28 +200,28 @@ public class Util {
 		}
 
 		switch ( type ) {
-			case GL11.GL_UNSIGNED_BYTE:
+			case GL_UNSIGNED_BYTE:
 				m = 1;
 				break;
-			case GL11.GL_BYTE:
+			case GL_BYTE:
 				m = 1;
 				break;
-			case GL11.GL_BITMAP:
+			case GL_BITMAP:
 				m = 1;
 				break;
-			case GL11.GL_UNSIGNED_SHORT:
+			case GL_UNSIGNED_SHORT:
 				m = 2;
 				break;
-			case GL11.GL_SHORT:
+			case GL_SHORT:
 				m = 2;
 				break;
-			case GL11.GL_UNSIGNED_INT:
+			case GL_UNSIGNED_INT:
 				m = 4;
 				break;
-			case GL11.GL_INT:
+			case GL_INT:
 				m = 4;
 				break;
-			case GL11.GL_FLOAT:
+			case GL_FLOAT:
 				m = 4;
 				break;
 			default :
@@ -239,7 +240,7 @@ public class Util {
 	 */
 	protected static int glGetIntegerv(int what) {
 		scratch.rewind();
-		GL11.glGetInteger(what, scratch);
+		glGetInteger(what, scratch);
 		return scratch.get();
 	}
 
diff --git a/src/java/org/lwjgl/util/glu/tessellation/GLUhalfEdge.java b/src/java/org/lwjgl/util/glu/tessellation/GLUhalfEdge.java
index c329b18..65824c6 100644
--- a/src/java/org/lwjgl/util/glu/tessellation/GLUhalfEdge.java
+++ b/src/java/org/lwjgl/util/glu/tessellation/GLUhalfEdge.java
@@ -99,7 +99,7 @@ class GLUhalfEdge {
     public int winding;	/* change in winding number when crossing */
     public boolean first;
 
-    public GLUhalfEdge(boolean first) {
+    GLUhalfEdge(boolean first) {
         this.first = first;
     }
 }
diff --git a/src/java/org/lwjgl/util/glu/tessellation/GLUtessellatorImpl.java b/src/java/org/lwjgl/util/glu/tessellation/GLUtessellatorImpl.java
index b08b044..dbbad30 100644
--- a/src/java/org/lwjgl/util/glu/tessellation/GLUtessellatorImpl.java
+++ b/src/java/org/lwjgl/util/glu/tessellation/GLUtessellatorImpl.java
@@ -84,11 +84,12 @@
 */
 package org.lwjgl.util.glu.tessellation;
 
-import org.lwjgl.util.glu.GLU;
 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;
 
@@ -163,7 +164,7 @@ public class GLUtessellatorImpl implements GLUtessellator {
         normal[2] = 0;
 
         relTolerance = GLU_TESS_DEFAULT_TOLERANCE;
-        windingRule = GLU.GLU_TESS_WINDING_ODD;
+        windingRule = GLU_TESS_WINDING_ODD;
         flagBoundary = false;
         boundaryOnly = false;
 
@@ -189,7 +190,7 @@ public class GLUtessellatorImpl implements GLUtessellator {
         }
     }
 
-    static public GLUtessellator gluNewTess()
+    public static GLUtessellator gluNewTess()
     {
         return new GLUtessellatorImpl();
     }
@@ -217,18 +218,18 @@ public class GLUtessellatorImpl implements GLUtessellator {
              */
             if (state < newState) {
                 if (state == TessState.T_DORMANT) {
-                    callErrorOrErrorData(GLU.GLU_TESS_MISSING_BEGIN_POLYGON);
+                    callErrorOrErrorData(GLU_TESS_MISSING_BEGIN_POLYGON);
                     gluTessBeginPolygon(null);
                 } else if (state == TessState.T_IN_POLYGON) {
-                    callErrorOrErrorData(GLU.GLU_TESS_MISSING_BEGIN_CONTOUR);
+                    callErrorOrErrorData(GLU_TESS_MISSING_BEGIN_CONTOUR);
                     gluTessBeginContour();
                 }
             } else {
                 if (state == TessState.T_IN_CONTOUR) {
-                    callErrorOrErrorData(GLU.GLU_TESS_MISSING_END_CONTOUR);
+                    callErrorOrErrorData(GLU_TESS_MISSING_END_CONTOUR);
                     gluTessEndContour();
                 } else if (state == TessState.T_IN_POLYGON) {
-                    callErrorOrErrorData(GLU.GLU_TESS_MISSING_END_POLYGON);
+                    callErrorOrErrorData(GLU_TESS_MISSING_END_POLYGON);
                     /* gluTessEndPolygon( tess ) is too much work! */
                     makeDormant();
                 }
@@ -242,61 +243,61 @@ public class GLUtessellatorImpl implements GLUtessellator {
 
     public void gluTessProperty(int which, double value) {
         switch (which) {
-            case GLU.GLU_TESS_TOLERANCE:
+            case GLU_TESS_TOLERANCE:
                 if (value < 0.0 || value > 1.0) break;
                 relTolerance = value;
                 return;
 
-            case GLU.GLU_TESS_WINDING_RULE:
+            case GLU_TESS_WINDING_RULE:
                 int windingRule = (int) value;
                 if (windingRule != value) break;	/* not an integer */
 
                 switch (windingRule) {
-                    case GLU.GLU_TESS_WINDING_ODD:
-                    case GLU.GLU_TESS_WINDING_NONZERO:
-                    case GLU.GLU_TESS_WINDING_POSITIVE:
-                    case GLU.GLU_TESS_WINDING_NEGATIVE:
-                    case GLU.GLU_TESS_WINDING_ABS_GEQ_TWO:
+                    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.GLU_TESS_BOUNDARY_ONLY:
+            case GLU_TESS_BOUNDARY_ONLY:
                 boundaryOnly = (value != 0);
                 return;
 
             default:
-                callErrorOrErrorData(GLU.GLU_INVALID_ENUM);
+                callErrorOrErrorData(GLU_INVALID_ENUM);
                 return;
         }
-        callErrorOrErrorData(GLU.GLU_INVALID_VALUE);
+        callErrorOrErrorData(GLU_INVALID_VALUE);
     }
 
 /* Returns tessellator property */
     public void gluGetTessProperty(int which, double[] value, int value_offset) {
         switch (which) {
-            case GLU.GLU_TESS_TOLERANCE:
+            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.GLU_TESS_WINDING_RULE:
-                assert (windingRule == GLU.GLU_TESS_WINDING_ODD ||
-                        windingRule == GLU.GLU_TESS_WINDING_NONZERO ||
-                        windingRule == GLU.GLU_TESS_WINDING_POSITIVE ||
-                        windingRule == GLU.GLU_TESS_WINDING_NEGATIVE ||
-                        windingRule == GLU.GLU_TESS_WINDING_ABS_GEQ_TWO);
+            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.GLU_TESS_BOUNDARY_ONLY:
+            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.GLU_INVALID_ENUM);
+                callErrorOrErrorData(GLU_INVALID_ENUM);
                 break;
         }
     } /* gluGetTessProperty() */
@@ -309,55 +310,55 @@ public class GLUtessellatorImpl implements GLUtessellator {
 
     public void gluTessCallback(int which, GLUtessellatorCallback aCallback) {
         switch (which) {
-            case GLU.GLU_TESS_BEGIN:
+            case GLU_TESS_BEGIN:
                 callBegin = aCallback == null ? NULL_CB : aCallback;
                 return;
-            case GLU.GLU_TESS_BEGIN_DATA:
+            case GLU_TESS_BEGIN_DATA:
                 callBeginData = aCallback == null ? NULL_CB : aCallback;
                 return;
-            case GLU.GLU_TESS_EDGE_FLAG:
+            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.GLU_TESS_EDGE_FLAG_DATA:
+            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.GLU_TESS_VERTEX:
+            case GLU_TESS_VERTEX:
                 callVertex = aCallback == null ? NULL_CB : aCallback;
                 return;
-            case GLU.GLU_TESS_VERTEX_DATA:
+            case GLU_TESS_VERTEX_DATA:
                 callVertexData = aCallback == null ? NULL_CB : aCallback;
                 return;
-            case GLU.GLU_TESS_END:
+            case GLU_TESS_END:
                 callEnd = aCallback == null ? NULL_CB : aCallback;
                 return;
-            case GLU.GLU_TESS_END_DATA:
+            case GLU_TESS_END_DATA:
                 callEndData = aCallback == null ? NULL_CB : aCallback;
                 return;
-            case GLU.GLU_TESS_ERROR:
+            case GLU_TESS_ERROR:
                 callError = aCallback == null ? NULL_CB : aCallback;
                 return;
-            case GLU.GLU_TESS_ERROR_DATA:
+            case GLU_TESS_ERROR_DATA:
                 callErrorData = aCallback == null ? NULL_CB : aCallback;
                 return;
-            case GLU.GLU_TESS_COMBINE:
+            case GLU_TESS_COMBINE:
                 callCombine = aCallback == null ? NULL_CB : aCallback;
                 return;
-            case GLU.GLU_TESS_COMBINE_DATA:
+            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.GLU_INVALID_ENUM);
+                callErrorOrErrorData(GLU_INVALID_ENUM);
                 return;
         }
     }
@@ -440,25 +441,25 @@ public class GLUtessellatorImpl implements GLUtessellator {
 
         if (flushCacheOnNextVertex) {
             if (!flushCache()) {
-                callErrorOrErrorData(GLU.GLU_OUT_OF_MEMORY);
+                callErrorOrErrorData(GLU_OUT_OF_MEMORY);
                 return;
             }
             lastEdge = null;
         }
         for (i = 0; i < 3; ++i) {
             x = coords[i+coords_offset];
-            if (x < -GLU.GLU_TESS_MAX_COORD) {
-                x = -GLU.GLU_TESS_MAX_COORD;
+            if (x < -GLU_TESS_MAX_COORD) {
+                x = -GLU_TESS_MAX_COORD;
                 tooLarge = true;
             }
-            if (x > GLU.GLU_TESS_MAX_COORD) {
-                x = GLU.GLU_TESS_MAX_COORD;
+            if (x > GLU_TESS_MAX_COORD) {
+                x = GLU_TESS_MAX_COORD;
                 tooLarge = true;
             }
             clamped[i] = x;
         }
         if (tooLarge) {
-            callErrorOrErrorData(GLU.GLU_TESS_COORD_TOO_LARGE);
+            callErrorOrErrorData(GLU_TESS_COORD_TOO_LARGE);
         }
 
         if (mesh == null) {
@@ -467,13 +468,13 @@ public class GLUtessellatorImpl implements GLUtessellator {
                 return;
             }
             if (!flushCache()) {
-                callErrorOrErrorData(GLU.GLU_OUT_OF_MEMORY);
+                callErrorOrErrorData(GLU_OUT_OF_MEMORY);
                 return;
             }
         }
 
         if (!addVertex(clamped, vertexData)) {
-            callErrorOrErrorData(GLU.GLU_OUT_OF_MEMORY);
+            callErrorOrErrorData(GLU_OUT_OF_MEMORY);
         }
     }
 
@@ -597,7 +598,7 @@ public class GLUtessellatorImpl implements GLUtessellator {
             mesh = null;
         } catch (Exception e) {
             e.printStackTrace();
-            callErrorOrErrorData(GLU.GLU_OUT_OF_MEMORY);
+            callErrorOrErrorData(GLU_OUT_OF_MEMORY);
         }
     }
 
diff --git a/src/java/org/lwjgl/util/glu/tessellation/Normal.java b/src/java/org/lwjgl/util/glu/tessellation/Normal.java
index b207fc2..334081a 100644
--- a/src/java/org/lwjgl/util/glu/tessellation/Normal.java
+++ b/src/java/org/lwjgl/util/glu/tessellation/Normal.java
@@ -90,7 +90,7 @@ class Normal {
     private Normal() {
     }
 
-    static boolean SLANTED_SWEEP = false;
+    static boolean SLANTED_SWEEP;
     static double S_UNIT_X;	/* Pre-normalized */
     static double S_UNIT_Y;
     private static final boolean TRUE_PROJECT = false;
diff --git a/src/java/org/lwjgl/util/glu/tessellation/PriorityQ.java b/src/java/org/lwjgl/util/glu/tessellation/PriorityQ.java
index a93f283..92bee82 100644
--- a/src/java/org/lwjgl/util/glu/tessellation/PriorityQ.java
+++ b/src/java/org/lwjgl/util/glu/tessellation/PriorityQ.java
@@ -96,7 +96,7 @@ abstract class PriorityQ {
         int node;
     }
 
-    public static interface Leq {
+    public interface Leq {
         boolean leq(Object key1, Object key2);
     }
 
diff --git a/src/java/org/lwjgl/util/glu/tessellation/PriorityQHeap.java b/src/java/org/lwjgl/util/glu/tessellation/PriorityQHeap.java
index 550e86f..2a177cb 100644
--- a/src/java/org/lwjgl/util/glu/tessellation/PriorityQHeap.java
+++ b/src/java/org/lwjgl/util/glu/tessellation/PriorityQHeap.java
@@ -95,7 +95,7 @@ class PriorityQHeap extends PriorityQ {
     PriorityQ.Leq leq;
 
 /* really __gl_pqHeapNewPriorityQ */
-    public PriorityQHeap(PriorityQ.Leq leq) {
+PriorityQHeap(PriorityQ.Leq leq) {
         size = 0;
         max = PriorityQ.INIT_SIZE;
         nodes = new PriorityQ.PQnode[PriorityQ.INIT_SIZE + 1];
diff --git a/src/java/org/lwjgl/util/glu/tessellation/PriorityQSort.java b/src/java/org/lwjgl/util/glu/tessellation/PriorityQSort.java
index b5f0834..c8c54ed 100644
--- a/src/java/org/lwjgl/util/glu/tessellation/PriorityQSort.java
+++ b/src/java/org/lwjgl/util/glu/tessellation/PriorityQSort.java
@@ -93,7 +93,7 @@ class PriorityQSort extends PriorityQ {
     boolean initialized;
     PriorityQ.Leq leq;
 
-    public PriorityQSort(PriorityQ.Leq leq) {
+    PriorityQSort(PriorityQ.Leq leq) {
         heap = new PriorityQHeap(leq);
 
         keys = new Object[PriorityQ.INIT_SIZE];
diff --git a/src/java/org/lwjgl/util/glu/tessellation/Render.java b/src/java/org/lwjgl/util/glu/tessellation/Render.java
index aa9bec9..efc4c43 100644
--- a/src/java/org/lwjgl/util/glu/tessellation/Render.java
+++ b/src/java/org/lwjgl/util/glu/tessellation/Render.java
@@ -84,8 +84,8 @@
 */
 package org.lwjgl.util.glu.tessellation;
 
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.util.glu.GLU;
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.util.glu.GLU.*;
 
 class Render {
     private static final boolean USE_OPTIMIZED_CODE_PATH = false;
@@ -102,10 +102,10 @@ class Render {
  * primitive is able to use the most triangles.
  */
     private static class FaceCount {
-        public FaceCount() {
+        private FaceCount() {
         }
 
-        public FaceCount(long size, GLUhalfEdge eStart, renderCallBack render) {
+        private FaceCount(long size, GLUhalfEdge eStart, renderCallBack render) {
             this.size = size;
             this.eStart = eStart;
             this.render = render;
@@ -116,7 +116,7 @@ class Render {
         renderCallBack render;
     };
 
-    private static interface renderCallBack {
+    private interface renderCallBack {
         void render(GLUtessellatorImpl tess, GLUhalfEdge e, long size);
     }
 
@@ -166,7 +166,7 @@ class Render {
          */
         GLUhalfEdge e = fOrig.anEdge;
         FaceCount max = new FaceCount();
-        FaceCount newFace = new FaceCount();
+        FaceCount newFace;
 
         max.size = 1;
         max.eStart = e;
@@ -329,7 +329,7 @@ class Render {
         int newState;
         int edgeState = -1;	/* force edge state output for first vertex */
 
-        tess.callBeginOrBeginData(GL11.GL_TRIANGLES);
+        tess.callBeginOrBeginData(GL_TRIANGLES);
 
         for (; f != null; f = f.trail) {
             /* Loop once for each edge (there will always be 3 edges) */
@@ -360,7 +360,7 @@ class Render {
              * edge "e".  The fan *should* contain exactly "size" triangles
              * (otherwise we've goofed up somewhere).
              */
-            tess.callBeginOrBeginData(GL11.GL_TRIANGLE_FAN);
+            tess.callBeginOrBeginData(GL_TRIANGLE_FAN);
             tess.callVertexOrVertexData( e.Org.data);
             tess.callVertexOrVertexData( e.Sym.Org.data);
 
@@ -382,7 +382,7 @@ class Render {
              * edge "e".  The strip *should* contain exactly "size" triangles
              * (otherwise we've goofed up somewhere).
              */
-            tess.callBeginOrBeginData(GL11.GL_TRIANGLE_STRIP);
+            tess.callBeginOrBeginData(GL_TRIANGLE_STRIP);
             tess.callVertexOrVertexData( e.Org.data);
             tess.callVertexOrVertexData( e.Sym.Org.data);
 
@@ -416,7 +416,7 @@ class Render {
 
         for (f = mesh.fHead.next; f != mesh.fHead; f = f.next) {
             if (f.inside) {
-                tess.callBeginOrBeginData(GL11.GL_LINE_LOOP);
+                tess.callBeginOrBeginData(GL_LINE_LOOP);
                 e = f.anEdge;
                 do {
                     tess.callVertexOrVertexData( e.Org.data);
@@ -555,22 +555,22 @@ class Render {
         } else {
             /* Make sure we do the right thing for each winding rule */
             switch (tess.windingRule) {
-                case GLU.GLU_TESS_WINDING_ODD:
-                case GLU.GLU_TESS_WINDING_NONZERO:
+                case GLU_TESS_WINDING_ODD:
+                case GLU_TESS_WINDING_NONZERO:
                     break;
-                case GLU.GLU_TESS_WINDING_POSITIVE:
+                case GLU_TESS_WINDING_POSITIVE:
                     if (sign < 0) return true;
                     break;
-                case GLU.GLU_TESS_WINDING_NEGATIVE:
+                case GLU_TESS_WINDING_NEGATIVE:
                     if (sign > 0) return true;
                     break;
-                case GLU.GLU_TESS_WINDING_ABS_GEQ_TWO:
+                case GLU_TESS_WINDING_ABS_GEQ_TWO:
                     return true;
             }
 
-            tess.callBeginOrBeginData( tess.boundaryOnly ? GL11.GL_LINE_LOOP
-                    : (tess.cacheCount > 3) ? GL11.GL_TRIANGLE_FAN
-                    : GL11.GL_TRIANGLES);
+            tess.callBeginOrBeginData( tess.boundaryOnly ? GL_LINE_LOOP
+                    : (tess.cacheCount > 3) ? GL_TRIANGLE_FAN
+                    : GL_TRIANGLES);
 
             tess.callVertexOrVertexData( v[0].data);
             if (sign > 0) {
diff --git a/src/java/org/lwjgl/util/glu/tessellation/Sweep.java b/src/java/org/lwjgl/util/glu/tessellation/Sweep.java
index 7d35ced..82bb625 100644
--- a/src/java/org/lwjgl/util/glu/tessellation/Sweep.java
+++ b/src/java/org/lwjgl/util/glu/tessellation/Sweep.java
@@ -84,7 +84,7 @@
 */
 package org.lwjgl.util.glu.tessellation;
 
-import org.lwjgl.util.glu.GLU;
+import static org.lwjgl.util.glu.GLU.*;
 
 class Sweep {
     private Sweep() {
@@ -270,15 +270,15 @@ class Sweep {
 
     static boolean IsWindingInside(GLUtessellatorImpl tess, int n) {
         switch (tess.windingRule) {
-            case GLU.GLU_TESS_WINDING_ODD:
+            case GLU_TESS_WINDING_ODD:
                 return (n & 1) != 0;
-            case GLU.GLU_TESS_WINDING_NONZERO:
+            case GLU_TESS_WINDING_NONZERO:
                 return (n != 0);
-            case GLU.GLU_TESS_WINDING_POSITIVE:
+            case GLU_TESS_WINDING_POSITIVE:
                 return (n > 0);
-            case GLU.GLU_TESS_WINDING_NEGATIVE:
+            case GLU_TESS_WINDING_NEGATIVE:
                 return (n < 0);
-            case GLU.GLU_TESS_WINDING_ABS_GEQ_TWO:
+            case GLU_TESS_WINDING_ABS_GEQ_TWO:
                 return (n >= 2) || (n <= -2);
         }
         /*LINTED*/
@@ -457,7 +457,7 @@ class Sweep {
                  * but the user has not provided the callback necessary to handle
                  * generated intersection points.
                  */
-                tess.callErrorOrErrorData(GLU.GLU_TESS_NEED_COMBINE_CALLBACK);
+                tess.callErrorOrErrorData(GLU_TESS_NEED_COMBINE_CALLBACK);
                 tess.fatalError = true;
             }
         }
@@ -1143,7 +1143,7 @@ class Sweep {
  * 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.GLU_TESS_MAX_COORD);
+    private static final double SENTINEL_COORD = (4.0 * GLU_TESS_MAX_COORD);
 
     static void AddSentinel(GLUtessellatorImpl tess, double t)
 /*
diff --git a/src/java/org/lwjgl/util/jinput/KeyMap.java b/src/java/org/lwjgl/util/jinput/KeyMap.java
index eec1675..e619e9d 100644
--- a/src/java/org/lwjgl/util/jinput/KeyMap.java
+++ b/src/java/org/lwjgl/util/jinput/KeyMap.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -38,7 +38,7 @@ import net.java.games.input.Component;
  * @author elias
  */
 final class KeyMap {
-	public final static Component.Identifier.Key map(int lwjgl_key_code) {
+	public static Component.Identifier.Key map(int lwjgl_key_code) {
 		switch (lwjgl_key_code) {
 			case Keyboard.KEY_ESCAPE:
 				return Component.Identifier.Key.ESCAPE;
diff --git a/src/java/org/lwjgl/util/jinput/LWJGLKeyboard.java b/src/java/org/lwjgl/util/jinput/LWJGLKeyboard.java
index f024b52..f1eb0a6 100644
--- a/src/java/org/lwjgl/util/jinput/LWJGLKeyboard.java
+++ b/src/java/org/lwjgl/util/jinput/LWJGLKeyboard.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -49,15 +49,14 @@ import java.lang.reflect.Modifier;
  * @author elias
  */
 final class LWJGLKeyboard extends Keyboard {
-    protected LWJGLKeyboard() {
+    LWJGLKeyboard() {
         super("LWJGLKeyboard", createComponents(), new Controller[]{}, new Rumbler[]{});
 	}
 
-	private final static Component[] createComponents() {
-		List components = new ArrayList();
+	private static Component[] createComponents() {
+		List<Key> components = new ArrayList<Key>();
 		Field[] vkey_fields = org.lwjgl.input.Keyboard.class.getFields();
-		for (int i = 0; i < vkey_fields.length; i++) {
-			Field vkey_field = vkey_fields[i];
+		for ( Field vkey_field : vkey_fields ) {
 			try {
 				if (Modifier.isStatic(vkey_field.getModifiers()) && vkey_field.getType() == int.class &&
 						vkey_field.getName().startsWith("KEY_")) {
@@ -70,21 +69,20 @@ final class LWJGLKeyboard extends Keyboard {
 				throw new RuntimeException(e);
 			}
 		}
-		return (Component[])components.toArray(new Component[]{});
+		return components.toArray(new Component[components.size()]);
 	}
 
-	public final synchronized void pollDevice() throws IOException {
+	public synchronized void pollDevice() throws IOException {
 		if (!org.lwjgl.input.Keyboard.isCreated())
 			return;
 		org.lwjgl.input.Keyboard.poll();
-		Component[] components = getComponents();
-		for (int i = 0; i < components.length; i++) {
-			Key key = (Key)components[i];
+		for ( Component component : getComponents() ) {
+			Key key = (Key)component;
 			key.update();
 		}
 	}
 
-	protected final synchronized boolean getNextDeviceEvent(Event event) throws IOException {
+	protected synchronized boolean getNextDeviceEvent(Event event) throws IOException {
 		if (!org.lwjgl.input.Keyboard.isCreated())
 			return false;
 		if (!org.lwjgl.input.Keyboard.next())
@@ -104,28 +102,28 @@ final class LWJGLKeyboard extends Keyboard {
 	}
 
 
-	private final static class Key extends AbstractComponent {
+	private static final class Key extends AbstractComponent {
 		private final int lwjgl_key;
 		private float value;
-		
-		public Key(Component.Identifier.Key key_id, int lwjgl_key) {
+
+		Key(Component.Identifier.Key key_id, int lwjgl_key) {
 			super(key_id.getName(), key_id);
 			this.lwjgl_key = lwjgl_key;
 		}
 
-		public final void update() {
+		public void update() {
 			this.value = org.lwjgl.input.Keyboard.isKeyDown(lwjgl_key) ? 1 : 0;
 		}
-		
-		protected final float poll() {
+
+		protected float poll() {
 			return value;
 		}
 
-		public final boolean isRelative() {
+		public boolean isRelative() {
 			return false;
 		}
 
-		public final boolean isAnalog() {
+		public boolean isAnalog() {
 			return false;
 		}
 	}
diff --git a/src/java/org/lwjgl/util/jinput/LWJGLMouse.java b/src/java/org/lwjgl/util/jinput/LWJGLMouse.java
index bb9ec9c..31b65aa 100644
--- a/src/java/org/lwjgl/util/jinput/LWJGLMouse.java
+++ b/src/java/org/lwjgl/util/jinput/LWJGLMouse.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -44,19 +44,19 @@ import net.java.games.input.Rumbler;
  * @author elias
  */
 final class LWJGLMouse extends Mouse {
-	private final static int EVENT_X = 1;
-	private final static int EVENT_Y = 2;
-	private final static int EVENT_WHEEL = 3;
-	private final static int EVENT_BUTTON = 4;
-	private final static int EVENT_DONE = 5;
+	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;
-	
-    protected LWJGLMouse() {
+
+    LWJGLMouse() {
         super("LWJGLMouse", createComponents(), new Controller[]{}, new Rumbler[]{});
     }
 
-	private final static Component[] createComponents() {
+	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),
@@ -65,7 +65,7 @@ final class LWJGLMouse extends Mouse {
 			new Button(Component.Identifier.Button.RIGHT)};
 	}
 
-	public final synchronized void pollDevice() throws IOException {
+	public synchronized void pollDevice() throws IOException {
 		if (!org.lwjgl.input.Mouse.isCreated())
 			return;
 		org.lwjgl.input.Mouse.poll();
@@ -73,7 +73,7 @@ final class LWJGLMouse extends Mouse {
 			setButtonState(i);
 	}
 
-	private final Button map(int lwjgl_button) {
+	private Button map(int lwjgl_button) {
 		switch (lwjgl_button) {
 			case 0:
 				return (Button)getLeft();
@@ -86,13 +86,13 @@ final class LWJGLMouse extends Mouse {
 		}
 	}
 
-	private final void setButtonState(int lwjgl_button) {
+	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 final synchronized boolean getNextDeviceEvent(Event event) throws IOException {
+	protected synchronized boolean getNextDeviceEvent(Event event) throws IOException {
 		if (!org.lwjgl.input.Mouse.isCreated())
 			return false;
 		while (true) {
@@ -147,44 +147,44 @@ final class LWJGLMouse extends Mouse {
 		}
 	}
 
-	final static class Axis extends AbstractComponent {
-		public Axis(Component.Identifier.Axis axis_id) {
+	static final class Axis extends AbstractComponent {
+		Axis(Component.Identifier.Axis axis_id) {
 			super(axis_id.getName(), axis_id);
 		}
 
-		public final boolean isRelative() {
+		public boolean isRelative() {
 			return true;
 		}
 
-		protected final float poll() throws IOException {
+		protected float poll() throws IOException {
 			return 0;
 		}
 
-		public final boolean isAnalog() {
+		public boolean isAnalog() {
 			return true;
 		}
 	}
 
-	final static class Button extends AbstractComponent {
+	static final class Button extends AbstractComponent {
 		private float value;
-		
-		public Button(Component.Identifier.Button button_id) {
+
+		Button(Component.Identifier.Button button_id) {
 			super(button_id.getName(), button_id);
 		}
 
-		protected final void setValue(float value) {
+		void setValue(float value) {
 			this.value = value;
 		}
 
-		protected final float poll() throws IOException {
+		protected float poll() throws IOException {
 			return value;
 		}
 
-		public final boolean isRelative() {
+		public boolean isRelative() {
 			return false;
 		}
 
-		public final boolean isAnalog() {
+		public boolean isAnalog() {
 			return false;
 		}
 	}
diff --git a/src/java/org/lwjgl/util/vector/Matrix.java b/src/java/org/lwjgl/util/vector/Matrix.java
index 4f3ee5d..545b1c9 100644
--- a/src/java/org/lwjgl/util/vector/Matrix.java
+++ b/src/java/org/lwjgl/util/vector/Matrix.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -40,15 +40,15 @@ import java.nio.FloatBuffer;
  * matrix unless otherwise stated.
  *
  * @author cix_foo <cix_foo at users.sourceforge.net>
- * @version $Revision: 2983 $
- * $Id: Matrix.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: Matrix.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public abstract class Matrix implements Serializable {
 
 	/**
 	 * Constructor for Matrix.
 	 */
-	public Matrix() {
+	protected Matrix() {
 		super();
 	}
 
@@ -57,41 +57,41 @@ public abstract class Matrix implements Serializable {
 	 * @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
@@ -100,7 +100,7 @@ public abstract class Matrix implements Serializable {
 	 * @return this
 	 */
 	public abstract Matrix store(FloatBuffer buf);
-	
+
 
 	/**
 	 * Store this matrix in a float buffer. The matrix is stored in row
@@ -109,21 +109,21 @@ public abstract class Matrix implements Serializable {
 	 * @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
diff --git a/src/java/org/lwjgl/util/vector/Matrix2f.java b/src/java/org/lwjgl/util/vector/Matrix2f.java
index 40b4590..140acf6 100644
--- a/src/java/org/lwjgl/util/vector/Matrix2f.java
+++ b/src/java/org/lwjgl/util/vector/Matrix2f.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -39,30 +39,30 @@ import java.nio.FloatBuffer;
  * Holds a 2x2 matrix
  *
  * @author cix_foo <cix_foo at users.sourceforge.net>
- * @version $Revision: 2983 $
- * $Id: Matrix2f.java 2983 2008-04-07 18:36:09Z matzon $
+ * @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
@@ -71,7 +71,7 @@ public class Matrix2f extends Matrix implements Serializable {
 	public Matrix2f load(Matrix2f src) {
 		return load(src, this);
 	}
-	
+
 	/**
 	 * Copy the source matrix to the destination matrix.
 	 * @param src The source matrix
@@ -81,49 +81,49 @@ public class Matrix2f extends Matrix implements Serializable {
 	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.
@@ -136,7 +136,7 @@ public class Matrix2f extends Matrix implements Serializable {
 		buf.put(m11);
 		return this;
 	}
-	
+
 	/**
 	 * Store this matrix in a float buffer. The matrix is stored in row
 	 * major (maths) order.
@@ -148,10 +148,10 @@ public class Matrix2f extends Matrix implements Serializable {
 		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
@@ -162,14 +162,14 @@ public class Matrix2f extends Matrix implements Serializable {
 	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;		
-	} 
+
+		return dest;
+	}
 
 	/**
 	 * Subtract the right matrix from the left and place the result in a third matrix.
@@ -181,14 +181,14 @@ public class Matrix2f extends Matrix implements Serializable {
 	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;		
-	} 
+
+		return dest;
+	}
 
 	/**
 	 * Multiply the right matrix by the left and place the result in a third matrix.
@@ -200,23 +200,23 @@ public class Matrix2f extends Matrix implements Serializable {
 	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;		
+
+		return dest;
 	}
-	
+
 	/**
 	 * Transform a Vector by a matrix and return the result in a destination
-	 * vector. 
+	 * 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
@@ -225,16 +225,16 @@ public class Matrix2f extends Matrix implements Serializable {
 	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;		
+		return dest;
 	}
-	
+
 	/**
 	 * Transpose this matrix
 	 * @return this
@@ -242,7 +242,7 @@ public class Matrix2f extends Matrix implements Serializable {
 	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
@@ -250,7 +250,7 @@ public class Matrix2f extends Matrix implements Serializable {
 	 */
 	public Matrix2f transpose(Matrix2f dest) {
 		return transpose(this, dest);
-	}	
+	}
 
 	/**
 	 * Transpose the source matrix and place the result in the destination matrix.
@@ -267,7 +267,7 @@ public class Matrix2f extends Matrix implements Serializable {
 
 		dest.m01 = m01;
 		dest.m10 = m10;
-			
+
 		return dest;
 	}
 
@@ -278,7 +278,7 @@ public class Matrix2f extends Matrix implements Serializable {
 	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
@@ -289,7 +289,7 @@ public class Matrix2f extends Matrix implements Serializable {
 		/*
 		 *inv(A) = 1/det(A) * adj(A);
 		 */
-		
+
 		float determinant = src.determinant();
 		if (determinant != 0) {
 			if (dest == null)
@@ -299,7 +299,7 @@ public class Matrix2f extends Matrix implements Serializable {
 			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;
@@ -313,12 +313,12 @@ public class Matrix2f extends Matrix implements Serializable {
 	 * Returns a string representation of this matrix
 	 */
 	public String toString() {
-		StringBuffer buf = new StringBuffer();
+		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
@@ -326,7 +326,7 @@ public class Matrix2f extends Matrix implements Serializable {
 	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
@@ -335,7 +335,7 @@ public class Matrix2f extends Matrix implements Serializable {
 	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
@@ -345,12 +345,12 @@ public class Matrix2f extends Matrix implements Serializable {
 	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;
 	}
 
@@ -374,7 +374,7 @@ public class Matrix2f extends Matrix implements Serializable {
 		src.m11 = 1.0f;
 		return src;
 	}
-	
+
 	/**
 	 * Set this matrix to 0.
 	 * @return this
@@ -390,7 +390,7 @@ public class Matrix2f extends Matrix implements Serializable {
 		src.m11 = 0.0f;
 		return src;
 	}
-	
+
 	/* (non-Javadoc)
 	 * @see org.lwjgl.vector.Matrix#determinant()
 	 */
diff --git a/src/java/org/lwjgl/util/vector/Matrix3f.java b/src/java/org/lwjgl/util/vector/Matrix3f.java
index ecef36c..2ca58d9 100644
--- a/src/java/org/lwjgl/util/vector/Matrix3f.java
+++ b/src/java/org/lwjgl/util/vector/Matrix3f.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -37,10 +37,10 @@ import java.nio.FloatBuffer;
 /**
  *
  * Holds a 3x3 matrix.
- * 
+ *
  * @author cix_foo <cix_foo at users.sourceforge.net>
- * @version $Revision: 2983 $
- * $Id: Matrix3f.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: Matrix3f.java 3418 2010-09-28 21:11:35Z spasi $
  */
 
 public class Matrix3f extends Matrix implements Serializable {
@@ -64,7 +64,7 @@ public class Matrix3f extends Matrix implements Serializable {
 		super();
 		setIdentity();
 	}
-	
+
 	/**
 	 * Load from another matrix
 	 * @param src The source matrix
@@ -73,7 +73,7 @@ public class Matrix3f extends Matrix implements Serializable {
 	public Matrix3f load(Matrix3f src) {
 		return load(src, this);
 	}
-	
+
 	/**
 	 * Copy source matrix to destination matrix
 	 * @param src The source matrix
@@ -96,16 +96,16 @@ public class Matrix3f extends Matrix implements Serializable {
 
 		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();
@@ -115,19 +115,19 @@ public class Matrix3f extends Matrix implements Serializable {
 		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();
@@ -137,10 +137,10 @@ public class Matrix3f extends Matrix implements Serializable {
 		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.
@@ -158,7 +158,7 @@ public class Matrix3f extends Matrix implements Serializable {
 		buf.put(m22);
 		return this;
 	}
-	
+
 	/**
 	 * Store this matrix in a float buffer. The matrix is stored in row
 	 * major (maths) order.
@@ -175,7 +175,7 @@ public class Matrix3f extends Matrix implements Serializable {
 		buf.put(m12);
 		buf.put(m22);
 		return this;
-	}	
+	}
 
 	/**
 	 * Add two matrices together and place the result in a third matrix.
@@ -270,7 +270,7 @@ public class Matrix3f extends Matrix implements Serializable {
 
 	/**
 	 * Transform a Vector by a matrix and return the result in a destination
-	 * vector. 
+	 * 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
@@ -316,16 +316,16 @@ public class Matrix3f extends Matrix implements Serializable {
 	 */
 	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 = 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;
@@ -336,7 +336,7 @@ public class Matrix3f extends Matrix implements Serializable {
 		dest.m20 = m20;
 		dest.m21 = m21;
 		dest.m22 = m22;
-		return dest; 
+		return dest;
 	}
 
 	/**
@@ -354,7 +354,7 @@ public class Matrix3f extends Matrix implements Serializable {
 	 * Returns a string representation of this matrix
 	 */
 	public String toString() {
-		StringBuffer buf = new StringBuffer();
+		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');
@@ -377,7 +377,7 @@ public class Matrix3f extends Matrix implements Serializable {
 	 */
 	public static Matrix3f invert(Matrix3f src, Matrix3f dest) {
 		float determinant = src.determinant();
-		
+
 		if (determinant != 0) {
 			if (dest == null)
 				dest = new Matrix3f();
@@ -385,12 +385,12 @@ public class Matrix3f extends Matrix implements Serializable {
 			  *
 			  * inv(A) = 1/det(A) * adj(T), where adj(T) = transpose(Conjugate Matrix)
 			  *
-			  * m00 m01 m02 
+			  * m00 m01 m02
 			  * m10 m11 m12
-			  * m20 m21 m22  
+			  * 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;
@@ -463,7 +463,7 @@ public class Matrix3f extends Matrix implements Serializable {
 	public Matrix setIdentity() {
 		return setIdentity(this);
 	}
-	
+
 	/**
 	 * Set the matrix to be the identity matrix.
 	 * @param m The matrix to be set to the identity
diff --git a/src/java/org/lwjgl/util/vector/Matrix4f.java b/src/java/org/lwjgl/util/vector/Matrix4f.java
index e4c4e78..acfa770 100644
--- a/src/java/org/lwjgl/util/vector/Matrix4f.java
+++ b/src/java/org/lwjgl/util/vector/Matrix4f.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -43,7 +43,7 @@ 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.
 	 */
@@ -56,7 +56,7 @@ public class Matrix4f extends Matrix implements Serializable {
 	 * Returns a string representation of this matrix
 	 */
 	public String toString() {
-		StringBuffer buf = new StringBuffer();
+		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');
@@ -71,7 +71,7 @@ public class Matrix4f extends Matrix implements Serializable {
 	public Matrix setIdentity() {
 		return setIdentity(this);
 	}
-	
+
 	/**
 	 * Set the given matrix to be the identity matrix.
 	 * @param m The matrix to set to the identity
@@ -94,7 +94,7 @@ public class Matrix4f extends Matrix implements Serializable {
 		m.m31 = 0.0f;
 		m.m32 = 0.0f;
 		m.m33 = 1.0f;
-		
+
 		return m;
 	}
 
@@ -128,7 +128,7 @@ public class Matrix4f extends Matrix implements Serializable {
 		m.m31 = 0.0f;
 		m.m32 = 0.0f;
 		m.m33 = 0.0f;
-		
+
 		return m;
 	}
 
@@ -140,7 +140,7 @@ public class Matrix4f extends Matrix implements Serializable {
 	public Matrix4f load(Matrix4f src) {
 		return load(src, this);
 	}
-	
+
 	/**
 	 * Copy the source matrix to the destination matrix
 	 * @param src The source matrix
@@ -166,19 +166,19 @@ public class Matrix4f extends Matrix implements Serializable {
 		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();
@@ -195,19 +195,19 @@ public class Matrix4f extends Matrix implements Serializable {
 		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();
@@ -224,10 +224,10 @@ public class Matrix4f extends Matrix implements Serializable {
 		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.
@@ -252,7 +252,7 @@ public class Matrix4f extends Matrix implements Serializable {
 		buf.put(m33);
 		return this;
 	}
-	
+
 	/**
 	 * Store this matrix in a float buffer. The matrix is stored in row
 	 * major (maths) order.
@@ -276,9 +276,9 @@ public class Matrix4f extends Matrix implements Serializable {
 		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
@@ -289,7 +289,7 @@ public class Matrix4f extends Matrix implements Serializable {
 	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;
@@ -307,8 +307,8 @@ public class Matrix4f extends Matrix implements Serializable {
 		dest.m32 = left.m32 + right.m32;
 		dest.m33 = left.m33 + right.m33;
 
-		return dest;		
-	} 
+		return dest;
+	}
 
 	/**
 	 * Subtract the right matrix from the left and place the result in a third matrix.
@@ -320,7 +320,7 @@ public class Matrix4f extends Matrix implements Serializable {
 	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;
@@ -337,9 +337,9 @@ public class Matrix4f extends Matrix implements Serializable {
 		dest.m31 = left.m31 - right.m31;
 		dest.m32 = left.m32 - right.m32;
 		dest.m33 = left.m33 - right.m33;
-		
-		return dest;		
-	} 
+
+		return dest;
+	}
 
 	/**
 	 * Multiply the right matrix by the left and place the result in a third matrix.
@@ -388,10 +388,10 @@ public class Matrix4f extends Matrix implements Serializable {
 
 		return dest;
 	}
-	
+
 	/**
 	 * Transform a Vector by a matrix and return the result in a destination
-	 * vector. 
+	 * 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
@@ -411,9 +411,9 @@ public class Matrix4f extends Matrix implements Serializable {
 		dest.z = z;
 		dest.w = w;
 
-		return dest;		
+		return dest;
 	}
-	
+
 	/**
 	 * Transpose this matrix
 	 * @return this
@@ -421,7 +421,7 @@ public class Matrix4f extends Matrix implements Serializable {
 	public Matrix transpose() {
 		return transpose(this);
 	}
-	
+
 	/**
 	 * Translate this matrix
 	 * @param vec The vector to translate by
@@ -430,7 +430,7 @@ public class Matrix4f extends Matrix implements Serializable {
 	public Matrix4f translate(Vector2f vec) {
 		return translate(vec, this);
 	}
-	
+
 	/**
 	 * Translate this matrix
 	 * @param vec The vector to translate by
@@ -473,7 +473,7 @@ public class Matrix4f extends Matrix implements Serializable {
 		dest.m23 = src.m23 * vec.z;
 		return dest;
 	}
-	
+
 	/**
 	 * Rotates the matrix around the given axis the specified angle
 	 * @param angle the angle, in radians.
@@ -494,7 +494,7 @@ public class Matrix4f extends Matrix implements Serializable {
 	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.
@@ -572,15 +572,15 @@ public class Matrix4f extends Matrix implements Serializable {
 	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
@@ -590,7 +590,7 @@ public class Matrix4f extends Matrix implements Serializable {
 	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
@@ -601,14 +601,14 @@ public class Matrix4f extends Matrix implements Serializable {
 	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
@@ -618,7 +618,7 @@ public class Matrix4f extends Matrix implements Serializable {
 	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
@@ -626,24 +626,24 @@ public class Matrix4f extends Matrix implements Serializable {
 	 * @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; 
+		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;
@@ -692,7 +692,7 @@ public class Matrix4f extends Matrix implements Serializable {
 				- m11 * m20 * m32);
 		return f;
 	}
-		
+
 	/**
 	 * Calculate the determinant of a 3x3 matrix
 	 * @return result
@@ -702,7 +702,7 @@ public class Matrix4f extends Matrix implements Serializable {
 				     float t10, float t11, float t12,
 				     float t20, float t21, float t22)
 	{
-		return   t00 * (t11 * t22 - t12 * t21) 
+		return   t00 * (t11 * t22 - t12 * t21)
 		       + t01 * (t12 * t20 - t10 * t22)
 		       + t02 * (t10 * t21 - t11 * t20);
 	}
@@ -723,7 +723,7 @@ public class Matrix4f extends Matrix implements Serializable {
 	 */
 	public static Matrix4f invert(Matrix4f src, Matrix4f dest) {
 		float determinant = src.determinant();
-		
+
 		if (determinant != 0) {
 			/*
 			 * m00 m01 m02 m03
@@ -734,7 +734,7 @@ public class Matrix4f extends Matrix implements Serializable {
 			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);
@@ -755,7 +755,7 @@ public class Matrix4f extends Matrix implements Serializable {
 			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;
@@ -777,7 +777,7 @@ public class Matrix4f extends Matrix implements Serializable {
 		} else
 			return null;
 	}
-	
+
 	/**
 	 * Negate this matrix
 	 * @return this
@@ -785,7 +785,7 @@ public class Matrix4f extends Matrix implements Serializable {
 	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
@@ -794,7 +794,7 @@ public class Matrix4f extends Matrix implements Serializable {
 	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
diff --git a/src/java/org/lwjgl/util/vector/Quaternion.java b/src/java/org/lwjgl/util/vector/Quaternion.java
index 72a77f6..f47cc0a 100644
--- a/src/java/org/lwjgl/util/vector/Quaternion.java
+++ b/src/java/org/lwjgl/util/vector/Quaternion.java
@@ -1,43 +1,43 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 package org.lwjgl.util.vector;
 
 /**
- * 
+ *
  * Quaternions for LWJGL!
- * 
+ *
  * @author fbi
- * @version $Revision: 2983 $
- * $Id: Quaternion.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: Quaternion.java 3418 2010-09-28 21:11:35Z spasi $
  */
 
 import java.nio.FloatBuffer;
@@ -57,7 +57,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/**
 	 * C'tor
-	 * 
+	 *
 	 * @param src
 	 */
 	public Quaternion(ReadableVector4f src) {
@@ -66,7 +66,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/**
 	 * C'tor
-	 * 
+	 *
 	 */
 	public Quaternion(float x, float y, float z, float w) {
 		set(x, y, z, w);
@@ -74,7 +74,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/*
 	 * (non-Javadoc)
-	 * 
+	 *
 	 * @see org.lwjgl.util.vector.WritableVector2f#set(float, float)
 	 */
 	public void set(float x, float y) {
@@ -84,7 +84,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/*
 	 * (non-Javadoc)
-	 * 
+	 *
 	 * @see org.lwjgl.util.vector.WritableVector3f#set(float, float, float)
 	 */
 	public void set(float x, float y, float z) {
@@ -95,7 +95,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/*
 	 * (non-Javadoc)
-	 * 
+	 *
 	 * @see org.lwjgl.util.vector.WritableVector4f#set(float, float, float,
 	 *      float)
 	 */
@@ -108,7 +108,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/**
 	 * Load from another Vector4f
-	 * 
+	 *
 	 * @param src
 	 *            The source vector
 	 * @return this
@@ -128,7 +128,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 	public Quaternion setIdentity() {
 		return setIdentity(this);
 	}
-	
+
 	/**
 	 * Set the given quaternion to the multiplication identity.
 	 * @param q The quaternion
@@ -151,7 +151,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/**
 	 * Normalise the source quaternion and place the result in another quaternion.
-	 * 
+	 *
 	 * @param src
 	 *            The source quaternion
 	 * @param dest
@@ -172,7 +172,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/**
 	 * 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
@@ -184,7 +184,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/**
 	 * The dot product of two quaternions
-	 * 
+	 *
 	 * @param left
 	 *            The LHS quat
 	 * @param right
@@ -198,7 +198,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/**
 	 * 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
@@ -209,7 +209,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/**
 	 * Calculate the conjugate of this quaternion and put it into the given one
-	 * 
+	 *
 	 * @param src
 	 *            The source quaternion
 	 * @param dest
@@ -248,13 +248,13 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/*
 	 * (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
@@ -300,7 +300,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/**
 	 * Set X
-	 * 
+	 *
 	 * @param x
 	 */
 	public final void setX(float x) {
@@ -309,7 +309,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/**
 	 * Set Y
-	 * 
+	 *
 	 * @param y
 	 */
 	public final void setY(float y) {
@@ -318,7 +318,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/**
 	 * Set Z
-	 * 
+	 *
 	 * @param z
 	 */
 	public void setZ(float z) {
@@ -327,7 +327,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/*
 	 * (Overrides)
-	 * 
+	 *
 	 * @see org.lwjgl.vector.ReadableVector3f#getZ()
 	 */
 	public float getZ() {
@@ -336,7 +336,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/**
 	 * Set W
-	 * 
+	 *
 	 * @param w
 	 */
 	public void setW(float w) {
@@ -345,7 +345,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 
 	/*
 	 * (Overrides)
-	 * 
+	 *
 	 * @see org.lwjgl.vector.ReadableVector3f#getW()
 	 */
 	public float getW() {
@@ -360,7 +360,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 	 * 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
@@ -380,11 +380,11 @@ public class Quaternion extends Vector implements ReadableVector4f {
 	}
 
 	/**
-	 * 
+	 *
 	 * 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
@@ -415,7 +415,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 	/**
 	 * 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
 	 */
@@ -435,7 +435,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 	/**
 	 * Sets the value of this quaternion using the rotational component of the
 	 * passed matrix.
-	 * 
+	 *
 	 * @param m
 	 *            The matrix
 	 * @return this
@@ -447,14 +447,14 @@ public class Quaternion extends Vector implements ReadableVector4f {
 	/**
 	 * 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 final static Quaternion setFromMatrix(Matrix4f m, Quaternion 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);
 	}
@@ -462,7 +462,7 @@ public class Quaternion extends Vector implements ReadableVector4f {
 	/**
 	 * Sets the value of this quaternion using the rotational component of the
 	 * passed matrix.
-	 * 
+	 *
 	 * @param m
 	 *            The source matrix
 	 */
@@ -473,14 +473,14 @@ public class Quaternion extends Vector implements ReadableVector4f {
 	/**
 	 * 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 final Quaternion setFromMatrix(Matrix3f m, Quaternion 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);
 	}
diff --git a/src/java/org/lwjgl/util/vector/ReadableVector.java b/src/java/org/lwjgl/util/vector/ReadableVector.java
index 61abdb6..7690fe7 100644
--- a/src/java/org/lwjgl/util/vector/ReadableVector.java
+++ b/src/java/org/lwjgl/util/vector/ReadableVector.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -40,15 +40,15 @@ public interface ReadableVector {
 	/**
 	 * @return the length of the vector
 	 */
-	public float length();
+	float length();
 	/**
 	 * @return the length squared of the vector
 	 */
-	public float lengthSquared();
+	float lengthSquared();
 	/**
 	 * 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);
+	Vector store(FloatBuffer buf);
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/vector/ReadableVector2f.java b/src/java/org/lwjgl/util/vector/ReadableVector2f.java
index 686ace5..2342bce 100644
--- a/src/java/org/lwjgl/util/vector/ReadableVector2f.java
+++ b/src/java/org/lwjgl/util/vector/ReadableVector2f.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -38,9 +38,9 @@ public interface ReadableVector2f extends ReadableVector {
 	/**
 	 * @return x
 	 */
-	public float getX();
+	float getX();
 	/**
 	 * @return y
 	 */
-	public float getY();
+	float getY();
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/vector/ReadableVector3f.java b/src/java/org/lwjgl/util/vector/ReadableVector3f.java
index 53ae9fe..5f77f5a 100644
--- a/src/java/org/lwjgl/util/vector/ReadableVector3f.java
+++ b/src/java/org/lwjgl/util/vector/ReadableVector3f.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -38,5 +38,5 @@ public interface ReadableVector3f extends ReadableVector2f {
 	/**
 	 * @return z
 	 */
-	public float getZ();
+	float getZ();
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/vector/ReadableVector4f.java b/src/java/org/lwjgl/util/vector/ReadableVector4f.java
index d7adeba..5dee3e3 100644
--- a/src/java/org/lwjgl/util/vector/ReadableVector4f.java
+++ b/src/java/org/lwjgl/util/vector/ReadableVector4f.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -35,10 +35,10 @@ package org.lwjgl.util.vector;
  * @author foo
  */
 public interface ReadableVector4f extends ReadableVector3f {
-	
+
 	/**
 	 * @return w
 	 */
-	public float getW();
+	float getW();
 
 }
diff --git a/src/java/org/lwjgl/util/vector/Vector.java b/src/java/org/lwjgl/util/vector/Vector.java
index 106cc2a..a0b407a 100644
--- a/src/java/org/lwjgl/util/vector/Vector.java
+++ b/src/java/org/lwjgl/util/vector/Vector.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -39,15 +39,15 @@ import java.nio.FloatBuffer;
  * Base class for vectors.
  *
  * @author cix_foo <cix_foo at users.sourceforge.net>
- * @version $Revision: 2983 $
- * $Id: Vector.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: Vector.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public abstract class Vector implements Serializable, ReadableVector {
 
 	/**
 	 * Constructor for Vector.
 	 */
-	public Vector() {
+	protected Vector() {
 		super();
 	}
 
@@ -57,26 +57,26 @@ public abstract class Vector implements Serializable, ReadableVector {
 	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);	
+	public abstract Vector load(FloatBuffer buf);
 
 	/**
 	 * Negate a vector
 	 * @return this
 	 */
 	public abstract Vector negate();
-	
+
 
 	/**
 	 * Normalise this vector
@@ -90,14 +90,14 @@ public abstract class Vector implements Serializable, ReadableVector {
 		} 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);	
+	public abstract Vector store(FloatBuffer buf);
 
 
 	/**
@@ -105,7 +105,7 @@ public abstract class Vector implements Serializable, ReadableVector {
 	 * @param scale The scale factor
 	 * @return this
 	 */
-	public abstract Vector scale(float scale);	
+	public abstract Vector scale(float scale);
 
 
 
diff --git a/src/java/org/lwjgl/util/vector/Vector2f.java b/src/java/org/lwjgl/util/vector/Vector2f.java
index 363f492..d06422e 100644
--- a/src/java/org/lwjgl/util/vector/Vector2f.java
+++ b/src/java/org/lwjgl/util/vector/Vector2f.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -37,10 +37,10 @@ import java.nio.FloatBuffer;
 /**
  *
  * Holds a 2-tuple vector.
- * 
+ *
  * @author cix_foo <cix_foo at users.sourceforge.net>
- * @version $Revision: 2983 $
- * $Id: Vector2f.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: Vector2f.java 3418 2010-09-28 21:11:35Z spasi $
  */
 
 public class Vector2f extends Vector implements Serializable, ReadableVector2f, WritableVector2f {
@@ -247,7 +247,7 @@ public class Vector2f extends Vector implements Serializable, ReadableVector2f,
 	 * @see java.lang.Object#toString()
 	 */
 	public String toString() {
-		StringBuffer sb = new StringBuffer(64);
+		StringBuilder sb = new StringBuilder(64);
 
 		sb.append("Vector2f[");
 		sb.append(x);
diff --git a/src/java/org/lwjgl/util/vector/Vector3f.java b/src/java/org/lwjgl/util/vector/Vector3f.java
index 8a9809e..9adab57 100644
--- a/src/java/org/lwjgl/util/vector/Vector3f.java
+++ b/src/java/org/lwjgl/util/vector/Vector3f.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -37,10 +37,10 @@ import java.nio.FloatBuffer;
 /**
  *
  * Holds a 3-tuple vector.
- * 
+ *
  * @author cix_foo <cix_foo at users.sourceforge.net>
- * @version $Revision: 2983 $
- * $Id: Vector3f.java 2983 2008-04-07 18:36:09Z matzon $
+ * @version $Revision: 3418 $
+ * $Id: Vector3f.java 3418 2010-09-28 21:11:35Z spasi $
  */
 
 public class Vector3f extends Vector implements Serializable, ReadableVector3f, WritableVector3f {
@@ -155,7 +155,7 @@ public class Vector3f extends Vector implements Serializable, ReadableVector3f,
 
 	/**
 	 * 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
@@ -177,7 +177,7 @@ public class Vector3f extends Vector implements Serializable, ReadableVector3f,
 				);
 
 		return dest;
-	}    
+	}
 
 
 
@@ -288,7 +288,7 @@ public class Vector3f extends Vector implements Serializable, ReadableVector3f,
 	 * @see java.lang.Object#toString()
 	 */
 	public String toString() {
-		StringBuffer sb = new StringBuffer(64);
+		StringBuilder sb = new StringBuilder(64);
 
 		sb.append("Vector3f[");
 		sb.append(x);
diff --git a/src/java/org/lwjgl/util/vector/WritableVector2f.java b/src/java/org/lwjgl/util/vector/WritableVector2f.java
index bf9dc52..e46d354 100644
--- a/src/java/org/lwjgl/util/vector/WritableVector2f.java
+++ b/src/java/org/lwjgl/util/vector/WritableVector2f.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -35,7 +35,7 @@ package org.lwjgl.util.vector;
  * Writable interface to Vector2fs
  * @author $author$
  * @version $revision$
- * $Id: WritableVector2f.java 2983 2008-04-07 18:36:09Z matzon $
+ * $Id: WritableVector2f.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public interface WritableVector2f {
 
@@ -43,19 +43,19 @@ public interface WritableVector2f {
 	 * Set the X value
 	 * @param x
 	 */
-	public void setX(float x);
-	
+	void setX(float x);
+
 	/**
 	 * Set the Y value
 	 * @param y
 	 */
-	public void setY(float y);
-	
+	void setY(float y);
+
 	/**
 	 * Set the X,Y values
 	 * @param x
    * @param y
 	 */
-	public void set(float x, float y);
-	
+	void set(float x, float y);
+
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/vector/WritableVector3f.java b/src/java/org/lwjgl/util/vector/WritableVector3f.java
index 63dffb3..df0919b 100644
--- a/src/java/org/lwjgl/util/vector/WritableVector3f.java
+++ b/src/java/org/lwjgl/util/vector/WritableVector3f.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -35,7 +35,7 @@ package org.lwjgl.util.vector;
  * Writable interface to Vector3fs
  * @author $author$
  * @version $revision$
- * $Id: WritableVector3f.java 2983 2008-04-07 18:36:09Z matzon $
+ * $Id: WritableVector3f.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public interface WritableVector3f extends WritableVector2f {
 
@@ -43,14 +43,14 @@ public interface WritableVector3f extends WritableVector2f {
 	 * Set the Z value
 	 * @param z
 	 */
-	public void setZ(float z);
-	
+	void setZ(float z);
+
 	/**
 	 * Set the X,Y,Z values
 	 * @param x
    * @param y
    * @param z
 	 */
-	public void set(float x, float y, float z);
-	
+	void set(float x, float y, float z);
+
 }
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/vector/WritableVector4f.java b/src/java/org/lwjgl/util/vector/WritableVector4f.java
index a784146..87fa53f 100644
--- a/src/java/org/lwjgl/util/vector/WritableVector4f.java
+++ b/src/java/org/lwjgl/util/vector/WritableVector4f.java
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -35,7 +35,7 @@ package org.lwjgl.util.vector;
  * Writable interface to Vector4fs
  * @author $author$
  * @version $revision$
- * $Id: WritableVector4f.java 2983 2008-04-07 18:36:09Z matzon $
+ * $Id: WritableVector4f.java 3418 2010-09-28 21:11:35Z spasi $
  */
 public interface WritableVector4f extends WritableVector3f {
 
@@ -43,8 +43,8 @@ public interface WritableVector4f extends WritableVector3f {
 	 * Set the W value
 	 * @param w
 	 */
-	public void setW(float w);
-	
+	void setW(float w);
+
 	/**
 	 * Set the X,Y,Z,W values
 	 * @param x
@@ -52,6 +52,6 @@ public interface WritableVector4f extends WritableVector3f {
    * @param z
    * @param w
 	 */
-	public void set(float x, float y, float z, float w);
-	
+	void set(float x, float y, float z, float w);
+
 }
\ No newline at end of file
diff --git a/src/native/common/CL/cl.h b/src/native/common/CL/cl.h
new file mode 100644
index 0000000..4f21afe
--- /dev/null
+++ b/src/native/common/CL/cl.h
@@ -0,0 +1,998 @@
+/*******************************************************************************
+ * 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 <OpenCL/cl_platform.h>
+#else
+#include <CL/cl_platform.h>
+#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 */
+
diff --git a/src/native/common/CL/cl_d3d10.h b/src/native/common/CL/cl_d3d10.h
new file mode 100644
index 0000000..ea9ab99
--- /dev/null
+++ b/src/native/common/CL/cl_d3d10.h
@@ -0,0 +1,126 @@
+/**********************************************************************************
+ * 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 <d3d10.h>
+#include <CL/cl.h>
+#include <CL/cl_platform.h>
+
+#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
+
diff --git a/src/native/common/CL/cl_ext.h b/src/native/common/CL/cl_ext.h
new file mode 100644
index 0000000..4e92c7e
--- /dev/null
+++ b/src/native/common/CL/cl_ext.h
@@ -0,0 +1,213 @@
+/*******************************************************************************
+ * 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 <OpenCL/cl.h>
+    #include <AvailabilityMacros.h>
+#else
+	#include <CL/cl.h>
+#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 */
diff --git a/src/native/common/CL/cl_gl.h b/src/native/common/CL/cl_gl.h
new file mode 100644
index 0000000..3b4fe06
--- /dev/null
+++ b/src/native/common/CL/cl_gl.h
@@ -0,0 +1,155 @@
+/**********************************************************************************
+ * 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 <OpenCL/cl.h>
+#include <OpenGL/CGLDevice.h>
+#else
+#include <CL/cl.h>
+#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  */
diff --git a/src/native/common/CL/cl_gl_ext.h b/src/native/common/CL/cl_gl_ext.h
new file mode 100644
index 0000000..26e4782
--- /dev/null
+++ b/src/native/common/CL/cl_gl_ext.h
@@ -0,0 +1,69 @@
+/**********************************************************************************
+ * 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 <OpenCL/cl_gl.h>
+#else
+    #include <CL/cl_gl.h>
+#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  */
diff --git a/src/native/common/CL/cl_platform.h b/src/native/common/CL/cl_platform.h
new file mode 100644
index 0000000..043b048
--- /dev/null
+++ b/src/native/common/CL/cl_platform.h
@@ -0,0 +1,1198 @@
+/**********************************************************************************
+ * 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 <AvailabilityMacros.h>
+#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 <stdint.h>
+
+/* 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 <stddef.h>
+
+/* 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 <altivec.h>   /* 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 <intrin.h>
+    #else
+        #include <xmmintrin.h>
+    #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 <intrin.h>
+    #else
+        #include <emmintrin.h>
+    #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 <mmintrin.h>
+    #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 <intrin.h>
+    #else
+        #include <immintrin.h> 
+    #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 <crtdefs.h>                                                                                             */
+    /* #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  */
diff --git a/src/native/common/OpenCL/cl_platform.h b/src/native/common/OpenCL/cl_platform.h
new file mode 100644
index 0000000..76a1b22
--- /dev/null
+++ b/src/native/common/OpenCL/cl_platform.h
@@ -0,0 +1,296 @@
+/**********************************************************************************
+ * 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 <AvailabilityMacros.h>
+#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 <stdint.h>
+
+/* 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 <stddef.h>
+  
+  
+#ifdef __cplusplus
+}
+#endif
+
+#endif  // __CL_PLATFORM_H
diff --git a/src/native/common/common_tools.c b/src/native/common/common_tools.c
index 86ec126..bf8770e 100644
--- a/src/native/common/common_tools.c
+++ b/src/native/common/common_tools.c
@@ -1,40 +1,40 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
- 
+
 /**
- * $Id: common_tools.c 3167 2008-12-22 16:38:57Z elias_naur $
+ * $Id: common_tools.c 3449 2010-10-14 19:58:32Z matzon $
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3167 $
+ * @version $Revision: 3449 $
  */
 
 #include <jni.h>
@@ -45,6 +45,9 @@
 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;
 }
@@ -58,6 +61,10 @@ void putAttrib(attrib_list_t *list, int 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;
@@ -80,7 +87,7 @@ static int do_vsnprintf(char* buffer, size_t buffer_size, const char *format, va
 }
 
 static jstring sprintfJavaString(JNIEnv *env, const char *format, va_list ap) {
-	int buffer_size = 2;
+	int buffer_size = 2048;
 	char *buffer;
 	jstring str;
 	int str_size;
@@ -175,41 +182,41 @@ void throwException(JNIEnv * env, const char * err) {
 }
 
 // retrieves the locale-specific C string
-char * GetStringNativeChars(JNIEnv *env, jstring jstr) { 
-  jbyteArray bytes = 0; 
-  jthrowable exc; 
-  char *result = 0; 
+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; 
-  } 
+  /* 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"); 
+  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); 
+  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); 
+  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;
 }
 
@@ -224,36 +231,36 @@ jstring NewStringNativeUnsigned(JNIEnv *env, const unsigned char *ustr) {
 }
 
 // creates locale specific string
-jstring NewStringNativeWithLength(JNIEnv *env, const char *str, int length) { 
+jstring NewStringNativeWithLength(JNIEnv *env, const char *str, int length) {
   jclass jcls_str;
   jmethodID jmethod_str;
-  jstring result; 
+  jstring result;
   jbyteArray bytes;
-  if (str==NULL) { 
-    return NULL; 
-  } 
-  
-  jcls_str = (*env)->FindClass(env,"java/lang/String"); 
+  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, "<init>", "([B)V"); 
+  jmethod_str = (*env)->GetMethodID(env,jcls_str, "<init>", "([B)V");
   if (jmethod_str == NULL)
 	  return NULL;
 
-  bytes = 0; 
+  bytes = 0;
 
-  if ((*env)->EnsureLocalCapacity(env,2) < 0) { 
-    return NULL; /* out of memory error */ 
-  } 
+  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; 
+  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) {
@@ -272,6 +279,11 @@ bool ext_InitializeFunctions(ExtGetProcAddressPROC gpa, int num_functions, ExtFu
 	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;");
@@ -327,15 +339,40 @@ bool getBooleanProperty(JNIEnv *env, const char* propertyName) {
   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) {
-  jvm = vm;
-  return JNI_VERSION_1_4;
+    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) {
diff --git a/src/native/common/common_tools.h b/src/native/common/common_tools.h
index df18bfa..ed4906d 100644
--- a/src/native/common/common_tools.h
+++ b/src/native/common/common_tools.h
@@ -1,40 +1,40 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
- 
+
 /**
- * $Id: common_tools.h 2988 2008-04-07 19:31:23Z elias_naur $
+ * $Id: common_tools.h 3412 2010-09-26 23:43:24Z spasi $
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 2988 $
+ * @version $Revision: 3412 $
  */
 
 #ifndef _COMMON_TOOLS_H
@@ -123,6 +123,8 @@ 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);
 
@@ -140,8 +142,10 @@ 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);
diff --git a/src/native/common/extal.c b/src/native/common/extal.c
index a2b98b8..502e070 100644
--- a/src/native/common/extal.c
+++ b/src/native/common/extal.c
@@ -1,35 +1,35 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
- 
+
 #include <jni.h>
 #include "extal.h"
 
@@ -42,13 +42,13 @@ typedef ALvoid* (ALAPIENTRY *alGetProcAddressPROC)(const ALubyte* fname);
  */
 /*void InitializeOpenAL(JNIEnv *env, jstring oalPath) {
 	//load our library
-	if (!tryLoadLibrary(env, oalPath)) {
+	if (!extal_LoadLibrary(env, oalPath)) {
 		throwException(env, "Could not load openal library.");
 		return;
 	}
-	alGetProcAddress = (alGetProcAddressPROC)NativeGetFunctionPointer("alGetProcAddress");
+	alGetProcAddress = (alGetProcAddressPROC)extal_NativeGetFunctionPointer("alGetProcAddress");
 	if (alGetProcAddress == NULL) {
-		UnLoadOpenAL();
+		extal_UnloadLibrary();
 		throwException(env, "Could not load alGetProcAddress function pointer.");
 		return;
 	}
@@ -64,7 +64,7 @@ void* extal_GetProcAddress(const char* function) {
 	void *p;
 /*	p = alGetProcAddress((const ALubyte*)function);
 	if (p == NULL) {*/
-		p = NativeGetFunctionPointer(function);
+		p = extal_NativeGetFunctionPointer(function);
 		if (p == NULL) {
 			printfDebug("Could not locate symbol %s\n", function);
 		}
diff --git a/src/native/common/extal.h b/src/native/common/extal.h
index 1eac883..7f14c18 100644
--- a/src/native/common/extal.h
+++ b/src/native/common/extal.h
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -161,9 +161,9 @@ void* extal_GetProcAddress(const char* function);
 void extal_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions);
 
 /* Platform dependent functions */
-void *NativeGetFunctionPointer(const char *function);
-void tryLoadLibrary(JNIEnv *env, jstring path);
-void UnLoadOpenAL();
+void *extal_NativeGetFunctionPointer(const char *function);
+void extal_LoadLibrary(JNIEnv *env, jstring path);
+void extal_UnloadLibrary();
 
 #ifdef __cplusplus
 }
diff --git a/src/native/common/extcl.c b/src/native/common/extcl.c
new file mode 100644
index 0000000..b68bb1c
--- /dev/null
+++ b/src/native/common/extcl.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <jni.h>
+#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;
+}
diff --git a/src/native/common/extcl.h b/src/native/common/extcl.h
new file mode 100644
index 0000000..8f33373
--- /dev/null
+++ b/src/native/common/extcl.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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 <jni.h>
+
+#ifdef __APPLE__
+    #include <OpenCL/cl_platform.h>
+#else
+    #include <CL/cl_platform.h>
+#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
diff --git a/src/native/common/extcl_types.h b/src/native/common/extcl_types.h
new file mode 100644
index 0000000..2fbc7a3
--- /dev/null
+++ b/src/native/common/extcl_types.h
@@ -0,0 +1,72 @@
+// -----------------[ 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;
diff --git a/src/native/common/extgl.h b/src/native/common/extgl.h
index 4bec56a..c2b242a 100644
--- a/src/native/common/extgl.h
+++ b/src/native/common/extgl.h
@@ -70,73 +70,30 @@ THE POSSIBILITY OF SUCH DAMAGE.
 #include <string.h>
 #include <stddef.h>
 
+#ifdef __APPLE__
+    #include <OpenCL/cl_platform.h>
+#else
+    #include <CL/cl_platform.h>
+#endif
+
 #include "common_tools.h"
 
 #if defined(_WIN32) || defined(_WIN64)
- #include <windows.h>	// fix APIENTRY macro redefinition
- # define int64_t __int64
- # define uint64_t unsigned __int64
+    #include <windows.h>	// fix APIENTRY macro redefinition
 #endif
 
 #ifndef APIENTRY
-#define APIENTRY
-#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] */
+    #define APIENTRY
 #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;
+#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);
 
-/* helper stuff */
+/* 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);
diff --git a/src/native/common/extgl_types.h b/src/native/common/extgl_types.h
new file mode 100644
index 0000000..96c779c
--- /dev/null
+++ b/src/native/common/extgl_types.h
@@ -0,0 +1,55 @@
+#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;
\ No newline at end of file
diff --git a/src/native/common/opencl.h b/src/native/common/opencl.h
new file mode 100644
index 0000000..901088d
--- /dev/null
+++ b/src/native/common/opencl.h
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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 <OpenCL/cl.h>
+#include <OpenCL/cl_gl.h>
+#include <OpenCL/cl_gl_ext.h>
+#include <OpenCL/cl_ext.h>
+
+#else
+
+#include <CL/cl.h>
+#include <CL/cl_gl.h>
+#include <CL/cl_gl_ext.h>
+#include <CL/cl_ext.h>
+
+#endif
+
+#include "common_tools.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __OPENCL_H   */
+
diff --git a/src/native/common/org_lwjgl_BufferUtils.c b/src/native/common/org_lwjgl_BufferUtils.c
new file mode 100644
index 0000000..edbb879
--- /dev/null
+++ b/src/native/common/org_lwjgl_BufferUtils.c
@@ -0,0 +1,5 @@
+#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);
+}
\ No newline at end of file
diff --git a/src/native/common/org_lwjgl_openal_AL.c b/src/native/common/org_lwjgl_openal_AL.c
index 20b3243..24c6520 100644
--- a/src/native/common/org_lwjgl_openal_AL.c
+++ b/src/native/common/org_lwjgl_openal_AL.c
@@ -1,45 +1,45 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
- 
+
 #include <jni.h>
 #include "org_lwjgl_openal_AL.h"
 #include "extal.h"
 
 JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_nCreate(JNIEnv *env, jclass clazz, jstring oalPath) {
-	tryLoadLibrary(env, oalPath);
+	extal_LoadLibrary(env, oalPath);
 }
 
 JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_nDestroy(JNIEnv *env, jclass clazz) {
-	UnLoadOpenAL();
+	extal_UnloadLibrary();
 }
 
 JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_resetNativeStubs(JNIEnv *env, jclass clazz, jclass al_class) {
diff --git a/src/native/common/org_lwjgl_opencl_CL.c b/src/native/common/org_lwjgl_opencl_CL.c
new file mode 100644
index 0000000..e2bdbbf
--- /dev/null
+++ b/src/native/common/org_lwjgl_opencl_CL.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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 <jni.h>
+#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);
+}
diff --git a/src/native/common/org_lwjgl_opencl_CallbackUtil.c b/src/native/common/org_lwjgl_opencl_CallbackUtil.c
new file mode 100644
index 0000000..1ed139f
--- /dev/null
+++ b/src/native/common/org_lwjgl_opencl_CallbackUtil.c
@@ -0,0 +1,229 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * JNI implementation of the AMD_debug_output function callback.
+ *
+ * @author Spasi
+ */
+
+#include <jni.h>
+#include "common_tools.h"
+#include "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");
+}
diff --git a/src/native/common/org_lwjgl_opengl_CallbackUtil.c b/src/native/common/org_lwjgl_opengl_CallbackUtil.c
new file mode 100644
index 0000000..0f09011
--- /dev/null
+++ b/src/native/common/org_lwjgl_opengl_CallbackUtil.c
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * JNI implementation of the AMD_debug_output function callback.
+ *
+ * @author Spasi
+ */
+
+#include <jni.h>
+#include "common_tools.h"
+#include "extgl.h"
+#include "org_lwjgl_opengl_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;
+}
\ No newline at end of file
diff --git a/src/native/linux/linux_al.c b/src/native/linux/linux_al.c
index 1cc932c..129f05e 100644
--- a/src/native/linux/linux_al.c
+++ b/src/native/linux/linux_al.c
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -41,11 +41,11 @@
 
 static void* handleOAL;
 
-void *NativeGetFunctionPointer(const char *function) {
+void *extal_NativeGetFunctionPointer(const char *function) {
 	return dlsym(handleOAL, function);
 }
 
-void tryLoadLibrary(JNIEnv *env, jstring path) {
+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);
@@ -57,7 +57,7 @@ void tryLoadLibrary(JNIEnv *env, jstring path) {
 	free(path_str);
 }
 
-void UnLoadOpenAL() {
+void extal_UnloadLibrary() {
 	if (handleOAL != NULL) {
 		dlclose(handleOAL);
 		handleOAL = NULL;
diff --git a/src/native/linux/linux_cl.c b/src/native/linux/linux_cl.c
new file mode 100644
index 0000000..1a1534a
--- /dev/null
+++ b/src/native/linux/linux_cl.c
@@ -0,0 +1,64 @@
+/*
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "extcl.h"
+#include "common_tools.h"
+
+#include <dlfcn.h>
+
+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;
+	}
+}
diff --git a/src/native/linux/org_lwjgl_opengl_Display.c b/src/native/linux/org_lwjgl_opengl_Display.c
index fee0294..492e55c 100644
--- a/src/native/linux/org_lwjgl_opengl_Display.c
+++ b/src/native/linux/org_lwjgl_opengl_Display.c
@@ -31,12 +31,12 @@
  */
 
 /**
- * $Id: org_lwjgl_opengl_Display.c 3188 2009-03-19 21:50:30Z elias_naur $
+ * $Id: org_lwjgl_opengl_Display.c 3453 2010-10-28 21:39:55Z kappa1 $
  *
  * Linux specific display functions.
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3188 $
+ * @version $Revision: 3453 $
  */
 
 #include <X11/X.h>
@@ -307,7 +307,7 @@ static Window createWindow(JNIEnv* env, Display *disp, int screen, jint window_m
 	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;
+	attribs.event_mask = ExposureMask | FocusChangeMask | VisibilityChangeMask | StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask| EnterWindowMask | LeaveWindowMask;
 	attribmask = CWColormap | CWEventMask | CWBorderPixel;
 	if (isLegacyFullscreen(window_mode)) {
 		attribmask |= CWOverrideRedirect;
diff --git a/src/native/linux/org_lwjgl_opengl_LinuxContextImplementation.c b/src/native/linux/org_lwjgl_opengl_LinuxContextImplementation.c
index df0e2eb..306bc60 100644
--- a/src/native/linux/org_lwjgl_opengl_LinuxContextImplementation.c
+++ b/src/native/linux/org_lwjgl_opengl_LinuxContextImplementation.c
@@ -31,10 +31,10 @@
  */
 
 /**
- * $Id: org_lwjgl_opengl_LinuxContextImplementation.c 3203 2009-04-24 20:35:33Z elias_naur $
+ * $Id: org_lwjgl_opengl_LinuxContextImplementation.c 3412 2010-09-26 23:43:24Z spasi $
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3203 $
+ * @version $Revision: 3412 $
  */
 
 #include <jni.h>
@@ -106,6 +106,16 @@ static void createContextGLX(JNIEnv *env, X11PeerInfo *peer_info, X11Context *co
 	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)
 {
diff --git a/src/native/macosx/macosx_al.c b/src/native/macosx/macosx_al.c
index 14465b7..f57c041 100644
--- a/src/native/macosx/macosx_al.c
+++ b/src/native/macosx/macosx_al.c
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -41,18 +41,18 @@
 #include "common_tools.h"
 
 /**
- * $Id: macosx_al.c 2985 2008-04-07 18:42:36Z matzon $
+ * $Id: macosx_al.c 3416 2010-09-27 00:25:59Z spasi $
  *
  * This file contains the AL extension assigning mechanism
  *
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 2985 $
+ * @version $Revision: 3416 $
  */
 
 static const struct mach_header* handleOAL = NULL;
 static CFBundleRef openal_bundle = NULL;
 
-void *NativeGetFunctionPointer(const char *function) {
+void *extal_NativeGetFunctionPointer(const char *function) {
 	void *address = NULL;
 	if (handleOAL != NULL) {
 		char *mac_symbol_name = (char *)malloc((strlen(function) + 2)*sizeof(char));
@@ -89,7 +89,7 @@ static CFBundleRef tryLoadFramework(JNIEnv *env) {
 	return openal_bundle;
 }
 
-void tryLoadLibrary(JNIEnv *env, jstring path) {
+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);
@@ -104,7 +104,7 @@ void tryLoadLibrary(JNIEnv *env, jstring path) {
 /**
  * Unloads the OpenAL Library
  */
-void UnLoadOpenAL() {
+void extal_UnloadLibrary() {
 	if (openal_bundle != NULL) {
 		CFRelease(openal_bundle);
 		openal_bundle = NULL;
diff --git a/src/native/macosx/macosx_cl.c b/src/native/macosx/macosx_cl.c
new file mode 100644
index 0000000..42954bd
--- /dev/null
+++ b/src/native/macosx/macosx_cl.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <mach-o/dyld.h>
+#include <stdlib.h>
+#include <string.h>
+#include <CoreFoundation/CoreFoundation.h>
+#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");
+}
diff --git a/src/native/windows/org_lwjgl_opengl_WindowsContextImplementation.c b/src/native/windows/org_lwjgl_opengl_WindowsContextImplementation.c
index a0b5b33..5bc225c 100644
--- a/src/native/windows/org_lwjgl_opengl_WindowsContextImplementation.c
+++ b/src/native/windows/org_lwjgl_opengl_WindowsContextImplementation.c
@@ -31,10 +31,10 @@
  */
 
 /**
- * $Id: org_lwjgl_opengl_WindowsContextImplementation.c 3116 2008-08-19 16:46:03Z spasi $
+ * $Id: org_lwjgl_opengl_WindowsContextImplementation.c 3412 2010-09-26 23:43:24Z spasi $
  *
  * @author elias_naur <elias_naur at users.sourceforge.net>
- * @version $Revision: 3116 $
+ * @version $Revision: 3412 $
  */
 
 #include <jni.h>
@@ -54,13 +54,13 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nCr
 	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");
@@ -120,6 +120,16 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nCr
 	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);
diff --git a/src/native/windows/windows_al.c b/src/native/windows/windows_al.c
index b0e4f96..9b505db 100644
--- a/src/native/windows/windows_al.c
+++ b/src/native/windows/windows_al.c
@@ -1,31 +1,31 @@
-/* 
+/*
  * Copyright (c) 2002-2008 LWJGL Project
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are 
+ * modification, are permitted provided that the following conditions are
  * met:
- * 
- * * Redistributions of source code must retain the above copyright 
+ *
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
  *
  * * Redistributions in binary form must reproduce the above copyright
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * * Neither the name of 'LWJGL' nor the names of 
- *   its contributors may be used to endorse or promote products derived 
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
@@ -37,21 +37,21 @@
 #include "common_tools.h"
 
 /**
- * $Id: windows_al.c 2985 2008-04-07 18:42:36Z matzon $
+ * $Id: windows_al.c 3412 2010-09-26 23:43:24Z spasi $
  *
  * This file contains the AL extension assigning mechanism
  *
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 2985 $
+ * @version $Revision: 3412 $
  */
 /* Handle to OpenAL Library */
 static HMODULE handleOAL;
 
-void *NativeGetFunctionPointer(const char *function) {
+void *extal_NativeGetFunctionPointer(const char *function) {
 	return GetProcAddress(handleOAL, function);
 }
 
-void tryLoadLibrary(JNIEnv *env, jstring path) {
+void extal_LoadLibrary(JNIEnv *env, jstring path) {
 	char *path_str = GetStringNativeChars(env, path);
 	printfDebugJava(env, "Testing '%s'", path_str);
 	handleOAL = LoadLibrary(path_str);
@@ -66,6 +66,6 @@ void tryLoadLibrary(JNIEnv *env, jstring path) {
 /**
  * Unloads the OpenAL Library
  */
-void UnLoadOpenAL() {
+void extal_UnloadLibrary() {
 	FreeLibrary(handleOAL);
 }
diff --git a/src/native/windows/windows_cl.c b/src/native/windows/windows_cl.c
new file mode 100644
index 0000000..60b1fb7
--- /dev/null
+++ b/src/native/windows/windows_cl.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <windows.h>
+#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;
+	}
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/openal/AL10.java b/src/templates/org/lwjgl/openal/AL10.java
index 6a221a2..cfced13 100644
--- a/src/templates/org/lwjgl/openal/AL10.java
+++ b/src/templates/org/lwjgl/openal/AL10.java
@@ -37,6 +37,7 @@ import java.nio.FloatBuffer;
 import java.nio.DoubleBuffer;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.openal.*;
 
 /**
  * <br>
@@ -44,8 +45,8 @@ import org.lwjgl.util.generator.*;
  * AL.h version 1.0
  *
  * @author Brian Matzon <brian at matzon.dk>
- * @version $Revision: 3380 $
- * $Id: AL10.java 3380 2010-07-14 13:12:24Z matzon $
+ * @version $Revision: 3412 $
+ * $Id: AL10.java 3412 2010-09-26 23:43:24Z spasi $
  */
 public interface AL10 {
 	/** Bad value */
@@ -492,7 +493,7 @@ public interface AL10 {
 	@StripPostfix("data")
 	@ALvoid
 	void alGetFloatv(@ALenum int pname, @OutParameter @Check("1") FloatBuffer data);
-	
+
 	/**
 	 * Like OpenGL, AL uses a simplified interface for querying global state.
 	 *
diff --git a/src/templates/org/lwjgl/openal/AL11.java b/src/templates/org/lwjgl/openal/AL11.java
index f97ab44..9bba7c9 100644
--- a/src/templates/org/lwjgl/openal/AL11.java
+++ b/src/templates/org/lwjgl/openal/AL11.java
@@ -31,13 +31,13 @@
  */
 package org.lwjgl.openal;
 
-import java.nio.Buffer;
 import java.nio.IntBuffer;
 import java.nio.FloatBuffer;
-import java.nio.DoubleBuffer;
 
-import org.lwjgl.openal.AL10;
 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;
 
 /**
  * <br>
@@ -52,33 +52,33 @@ 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.
 	 *
@@ -89,7 +89,7 @@ public interface AL11 {
 	 */
 	@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.
@@ -101,7 +101,7 @@ public interface AL11 {
 	@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.
@@ -114,7 +114,7 @@ public interface AL11 {
 	 */
 	@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.
@@ -127,7 +127,7 @@ public interface AL11 {
 	@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.
 	 * <i>note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by
@@ -138,8 +138,8 @@ public interface AL11 {
 	 * @param value value of property
 	 */
 	@ALvoid
-	void alBufferf(@ALuint int buffer, @ALenum int pname, float value);	
-	
+	void alBufferf(@ALuint int buffer, @ALenum int pname, float value);
+
 	/**
 	 * This function sets a floating point property of a buffer.
 	 * <i>note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by
@@ -153,7 +153,7 @@ public interface AL11 {
 	 */
 	@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.
 	 * <i>note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by
@@ -167,7 +167,7 @@ public interface AL11 {
 	@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.
 	 * <i>note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by
@@ -178,8 +178,8 @@ public interface AL11 {
 	 * @param value value of property
 	 */
 	@ALvoid
-	void alBufferi(@ALuint int buffer, @ALenum int pname, int value);	
-	
+	void alBufferi(@ALuint int buffer, @ALenum int pname, int value);
+
 	/**
 	 * This function sets an integer property of a buffer.
 	 * <i>note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by
@@ -193,7 +193,7 @@ public interface AL11 {
 	 */
 	@ALvoid
 	void alBuffer3i(@ALuint int buffer, @ALenum int pname, int v1, int v2, int v3);
-	
+
 	/**
 	 * This function sets an integer property of a buffer.
 	 * <i>note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by
@@ -207,22 +207,22 @@ public interface AL11 {
 	@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.
 	 * <i>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.</i>
-	 * 
+	 *
 	 * @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
 	 */
@@ -235,7 +235,7 @@ public interface AL11 {
 	 * This function retrieves a floating point property of a buffer.
 	 * <i>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.</i>
-	 * 
+	 *
 	 * @param buffer Buffer to get property from
 	 * @param pname name of property
 	 * @return floating point property
@@ -247,7 +247,7 @@ public interface AL11 {
 	 * This function retrieves a floating point property of a buffer.
 	 * <i>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.</i>
-	 * 
+	 *
 	 * @param buffer Buffer to get property from
 	 * @param pname name of property
 	 */
@@ -255,7 +255,7 @@ public interface AL11 {
 	@StripPostfix("values")
 	@ALvoid
 	void alGetBufferfv(@ALuint int buffer, @ALenum int pname, @OutParameter @Check("1") FloatBuffer values);
-	
+
 	/**
 	 * <p>
 	 * AL_SPEED_OF_SOUND allows the application to change the reference (propagation)
@@ -274,5 +274,5 @@ public interface AL11 {
 	 * @param value distance model to be set
 	 */
 	@ALvoid
-	void alSpeedOfSound(float value);	
+	void alSpeedOfSound(float value);
 }
diff --git a/src/templates/org/lwjgl/openal/EFX10.java b/src/templates/org/lwjgl/openal/EFX10.java
index 700edf3..34010c3 100644
--- a/src/templates/org/lwjgl/openal/EFX10.java
+++ b/src/templates/org/lwjgl/openal/EFX10.java
@@ -34,19 +34,12 @@ package org.lwjgl.openal;
 import java.nio.FloatBuffer;
 import java.nio.IntBuffer;
 
-import org.lwjgl.util.generator.ALenum;
-import org.lwjgl.util.generator.ALsizei;
-import org.lwjgl.util.generator.ALuint;
-import org.lwjgl.util.generator.ALvoid;
+import org.lwjgl.util.generator.*;
+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;
-import org.lwjgl.util.generator.AutoSize;
-import org.lwjgl.util.generator.Check;
-import org.lwjgl.util.generator.Const;
-import org.lwjgl.util.generator.Constant;
-import org.lwjgl.util.generator.Indirect;
-import org.lwjgl.util.generator.OutParameter;
-import org.lwjgl.util.generator.Result;
-import org.lwjgl.util.generator.StripPostfix;
 
 /**
  * Implementation of the OpenAL extension ALC_EXT_EFX (version 1.0). Contains necessary fields,
diff --git a/src/templates/org/lwjgl/opencl/AMD_device_attribute_query.java b/src/templates/org/lwjgl/opencl/AMD_device_attribute_query.java
new file mode 100644
index 0000000..5c7f5a2
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/AMD_device_attribute_query.java
@@ -0,0 +1,45 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface AMD_device_attribute_query {
+
+	/**
+	 * Accepted as the &lt;param_name&gt; parameter of clGetDeviceInfo. Return the
+	 * offset in nano-seconds between an event timestamp and Epoch.
+	 */
+	int CL_DEVICE_PROFILING_TIMER_OFFSET_AMD = 0x4036;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/AMD_fp64.java b/src/templates/org/lwjgl/opencl/AMD_fp64.java
new file mode 100644
index 0000000..63236b1
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/AMD_fp64.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface AMD_fp64 {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/AMD_media_ops.java b/src/templates/org/lwjgl/opencl/AMD_media_ops.java
new file mode 100644
index 0000000..db8308d
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/AMD_media_ops.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface AMD_media_ops {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/AMD_printf.java b/src/templates/org/lwjgl/opencl/AMD_printf.java
new file mode 100644
index 0000000..3aa67d0
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/AMD_printf.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface AMD_printf {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/APPLE_ContextLoggingFunctions.java b/src/templates/org/lwjgl/opencl/APPLE_ContextLoggingFunctions.java
new file mode 100644
index 0000000..2bef752
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/APPLE_ContextLoggingFunctions.java
@@ -0,0 +1,64 @@
+/*
+ * 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;
+
+ at Private
+ at 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);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/APPLE_SetMemObjectDestructor.java b/src/templates/org/lwjgl/opencl/APPLE_SetMemObjectDestructor.java
new file mode 100644
index 0000000..5a0960e
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/APPLE_SetMemObjectDestructor.java
@@ -0,0 +1,55 @@
+/*
+ * 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;
+
+ at 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);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java b/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java
new file mode 100644
index 0000000..567fec3
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java
@@ -0,0 +1,82 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+ at Extension(postfix = "APPLE", className = "APPLEGLSharing")
+public interface APPLE_gl_sharing {
+
+	/**
+	 * This enumerated value can be specified as part of the &lt;properties&gt; 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);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/CL10.java b/src/templates/org/lwjgl/opencl/CL10.java
new file mode 100644
index 0000000..c331a69
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/CL10.java
@@ -0,0 +1,1163 @@
+/*
+ * 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 <code>CL_PROGRAM_DEVICES</code>) will be written sequentially to
+	 * the <code>param_value</code> buffer. The buffer size must be big enough to hold
+	 * all the binaries, as returned by <code>CL_PROGRAM_BINARY_SIZES</code>.
+	 *
+	 * @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 <code>CL_PROGRAM_DEVICES</code>) will be written to the corresponding
+	 * slot of the <code>param_value</code> array. The size of each buffer must be big enough to
+	 * hold the corresponding binary, as returned by <code>CL_PROGRAM_BINARY_SIZES</code>.
+	 *
+	 * @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 <code>mem_list</code> parameter
+	 * can be used to pass a list of <code>CLMem</code> objects that will be mapped to global memory space and
+	 * exposed as a <code>ByteBuffer</code> array in the <code>CLNativeKernel#execute</code> method. The
+	 * <code>sizes</code> parameter will be used to allocate direct <code>ByteBuffer</code>s 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);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/CL10GL.java b/src/templates/org/lwjgl/opencl/CL10GL.java
new file mode 100644
index 0000000..bdb49cc
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/CL10GL.java
@@ -0,0 +1,138 @@
+/*
+ * 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);
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/CL11.java b/src/templates/org/lwjgl/opencl/CL11.java
new file mode 100644
index 0000000..dfb35a6
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/CL11.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR 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);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/EXT_device_fission.java b/src/templates/org/lwjgl/opencl/EXT_device_fission.java
new file mode 100644
index 0000000..23ecd9b
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/EXT_device_fission.java
@@ -0,0 +1,144 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface EXT_device_fission {
+
+	/**
+	 * Accepted as a property name in the &lt;properties&gt; 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 &lt;properties&gt;
+	 * 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 &lt;param_name&gt; 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 &lt;properties&gt; parameter of
+	 * clCreateSubDeviceEXT:
+	 */
+	int CL_PROPERTIES_LIST_END_EXT = 0x0;
+
+	/**
+	 * Accepted as the partition counts list terminator in the &lt;properties&gt;
+	 * parameter of clCreateSubDeviceEXT:
+	 */
+	int CL_PARTITION_BY_COUNTS_LIST_END_EXT = 0x0;
+
+	/**
+	 * Accepted as the partition names list terminator in the &lt;properties&gt;
+	 * 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);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/EXT_migrate_memobject.java b/src/templates/org/lwjgl/opencl/EXT_migrate_memobject.java
new file mode 100644
index 0000000..ac4b280
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/EXT_migrate_memobject.java
@@ -0,0 +1,77 @@
+/*
+ * 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;
+
+ at 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 &lt;param_value&gt; parameter of the clGetEventInfo when
+	 * &lt;param_name&gt; 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);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/KHR_3d_image_writes.java b/src/templates/org/lwjgl/opencl/KHR_3d_image_writes.java
new file mode 100644
index 0000000..9585071
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/KHR_3d_image_writes.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface KHR_3d_image_writes {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/KHR_byte_addressable_store.java b/src/templates/org/lwjgl/opencl/KHR_byte_addressable_store.java
new file mode 100644
index 0000000..191c3c7
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/KHR_byte_addressable_store.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface KHR_byte_addressable_store {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/KHR_d3d10_sharing.java b/src/templates/org/lwjgl/opencl/KHR_d3d10_sharing.java
new file mode 100644
index 0000000..cc91530
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/KHR_d3d10_sharing.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+ at CLPlatformExtension
+public interface KHR_d3d10_sharing {
+	// Not implemented
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/KHR_fp16.java b/src/templates/org/lwjgl/opencl/KHR_fp16.java
new file mode 100644
index 0000000..1b2afe6
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/KHR_fp16.java
@@ -0,0 +1,42 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface KHR_fp16 {
+
+	/** cl_device_info */
+	int CL_DEVICE_HALF_FP_CONFIG = 0x1033;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/KHR_fp64.java b/src/templates/org/lwjgl/opencl/KHR_fp64.java
new file mode 100644
index 0000000..aed45ed
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/KHR_fp64.java
@@ -0,0 +1,42 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface KHR_fp64 {
+
+	/** cl_device_info */
+	int CL_DEVICE_DOUBLE_FP_CONFIG = 0x1032;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/KHR_gl_event.java b/src/templates/org/lwjgl/opencl/KHR_gl_event.java
new file mode 100644
index 0000000..ddf6bd0
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/KHR_gl_event.java
@@ -0,0 +1,56 @@
+/*
+ * 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;
+
+ at Imports("org.lwjgl.opengl.GLSync")
+ at CLPlatformExtension
+ at CLDeviceExtension
+ at 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);
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/KHR_gl_sharing.java b/src/templates/org/lwjgl/opencl/KHR_gl_sharing.java
new file mode 100644
index 0000000..25921f1
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/KHR_gl_sharing.java
@@ -0,0 +1,77 @@
+/*
+ * 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;
+
+ at CLPlatformExtension
+ at CLDeviceExtension
+ at 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 &lt;properties&gt;:
+	 */
+	int CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR = -1000;
+
+	/** Accepted as the &lt;param_name&gt; 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);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/KHR_global_int32_base_atomics.java b/src/templates/org/lwjgl/opencl/KHR_global_int32_base_atomics.java
new file mode 100644
index 0000000..73ed951
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/KHR_global_int32_base_atomics.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface KHR_global_int32_base_atomics {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/KHR_global_int32_extended_atomics.java b/src/templates/org/lwjgl/opencl/KHR_global_int32_extended_atomics.java
new file mode 100644
index 0000000..022d2e5
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/KHR_global_int32_extended_atomics.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface KHR_global_int32_extended_atomics {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/KHR_icd.java b/src/templates/org/lwjgl/opencl/KHR_icd.java
new file mode 100644
index 0000000..0c33fc9
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/KHR_icd.java
@@ -0,0 +1,58 @@
+/*
+ * 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;
+
+ at CLPlatformExtension
+ at Extension(postfix = "KHR", className = "KHRICD")
+public interface KHR_icd {
+
+	/** Accepted as &lt;param_name&gt; 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);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/KHR_int64_base_atomics.java b/src/templates/org/lwjgl/opencl/KHR_int64_base_atomics.java
new file mode 100644
index 0000000..490d35b
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/KHR_int64_base_atomics.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface KHR_int64_base_atomics {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/KHR_int64_extended_atomics.java b/src/templates/org/lwjgl/opencl/KHR_int64_extended_atomics.java
new file mode 100644
index 0000000..e396a5c
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/KHR_int64_extended_atomics.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface KHR_int64_extended_atomics {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/KHR_local_int32_base_atomics.java b/src/templates/org/lwjgl/opencl/KHR_local_int32_base_atomics.java
new file mode 100644
index 0000000..c18e2a4
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/KHR_local_int32_base_atomics.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface KHR_local_int32_base_atomics {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/KHR_local_int32_extended_atomics.java b/src/templates/org/lwjgl/opencl/KHR_local_int32_extended_atomics.java
new file mode 100644
index 0000000..e72d86f
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/KHR_local_int32_extended_atomics.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface KHR_local_int32_extended_atomics {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/KHR_select_fprounding_mode.java b/src/templates/org/lwjgl/opencl/KHR_select_fprounding_mode.java
new file mode 100644
index 0000000..fe573d3
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/KHR_select_fprounding_mode.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface KHR_select_fprounding_mode {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/NV_compiler_options.java b/src/templates/org/lwjgl/opencl/NV_compiler_options.java
new file mode 100644
index 0000000..26c385c
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/NV_compiler_options.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface NV_compiler_options {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/NV_device_attribute_query.java b/src/templates/org/lwjgl/opencl/NV_device_attribute_query.java
new file mode 100644
index 0000000..6ec14fb
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/NV_device_attribute_query.java
@@ -0,0 +1,48 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface NV_device_attribute_query {
+
+	/** Accepted as the &lt;param_name&gt; 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;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opencl/NV_pragma_unroll.java b/src/templates/org/lwjgl/opencl/NV_pragma_unroll.java
new file mode 100644
index 0000000..a1e4042
--- /dev/null
+++ b/src/templates/org/lwjgl/opencl/NV_pragma_unroll.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+ at CLDeviceExtension
+public interface NV_pragma_unroll {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/AMD_debug_output.java b/src/templates/org/lwjgl/opengl/AMD_debug_output.java
index 662612b..3a73b87 100644
--- a/src/templates/org/lwjgl/opengl/AMD_debug_output.java
+++ b/src/templates/org/lwjgl/opengl/AMD_debug_output.java
@@ -32,6 +32,10 @@
 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;
@@ -77,15 +81,16 @@ public interface AMD_debug_output {
 	 * The {@code AMDDebugOutputCallback.Handler} implementation passed to this method will be used for
 	 * AMD_debug_output messages. If callback is null, any previously registered handler for the current
 	 * thread will be unregistered and stop receiving messages.
-	 * <p/>
-	 * The userParam buffer will be passed to the GL, but the current implementation will ignore it and
-	 * never return it to the handler. Instead, users are encouraged to use a custom callback handler
-	 * implentation to store context-specific data.
 	 *
 	 * @param callback  the callback function to use
-	 * @param userParam the user-specified data
 	 */
-	void glDebugMessageCallbackAMD(@GLpointer(value = "GLDEBUGPROCAMD", canBeNull = true) AMDDebugOutputCallback callback, @Check(canBeNull = true) @GLvoid ByteBuffer userParam);
+	@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,
diff --git a/src/templates/org/lwjgl/opengl/AMD_depth_clamp_separate.java b/src/templates/org/lwjgl/opengl/AMD_depth_clamp_separate.java
new file mode 100644
index 0000000..8d66d1f
--- /dev/null
+++ b/src/templates/org/lwjgl/opengl/AMD_depth_clamp_separate.java
@@ -0,0 +1,44 @@
+/*
+ * 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 &lt;cap&gt; parameter of Enable, Disable, and IsEnabled,
+	 * and by the &lt;pname&gt; parameter of GetBooleanv, GetIntegerv,
+	 * GetFloatv, and GetDoublev:
+	 */
+	int GL_DEPTH_CLAMP_NEAR_AMD = 0x901E,
+		GL_DEPTH_CLAMP_FAR_AMD = 0x901F;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/AMD_draw_buffers_blend.java b/src/templates/org/lwjgl/opengl/AMD_draw_buffers_blend.java
index 9786cfa..a7b1558 100644
--- a/src/templates/org/lwjgl/opengl/AMD_draw_buffers_blend.java
+++ b/src/templates/org/lwjgl/opengl/AMD_draw_buffers_blend.java
@@ -31,8 +31,8 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
-import org.lwjgl.util.generator.GLuint;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLuint;
 
 public interface AMD_draw_buffers_blend {
 
diff --git a/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java b/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java
index 89094ea..73f9c67 100644
--- a/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java
+++ b/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java
@@ -32,6 +32,11 @@
 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;
 
@@ -53,7 +58,7 @@ public interface AMD_name_gen_delete {
 	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 = "APIUtils.getBufferInt().put(0, name), 0", keepParam = true) int name);
+	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);
 
diff --git a/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java b/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java
index cff428e..cee867c 100644
--- a/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java
+++ b/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java
@@ -32,6 +32,8 @@
 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;
@@ -98,12 +100,12 @@ public interface AMD_performance_monitor {
 	void glDeletePerfMonitorsAMD(@AutoSize("monitors") @GLsizei int n, @GLuint IntBuffer monitors);
 
 	@Alternate("glDeletePerfMonitorsAMD")
-	void glDeletePerfMonitorsAMD(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, monitor), 0", keepParam = true) int monitor);
+	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 = "APIUtils.getBufferInt().put(0, counter), 0", keepParam = true) int counter);
+	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);
 
diff --git a/src/templates/org/lwjgl/opengl/AMD_vertex_shader_tessellator.java b/src/templates/org/lwjgl/opengl/AMD_vertex_shader_tessellator.java
index c786973..4f484f6 100644
--- a/src/templates/org/lwjgl/opengl/AMD_vertex_shader_tessellator.java
+++ b/src/templates/org/lwjgl/opengl/AMD_vertex_shader_tessellator.java
@@ -31,7 +31,7 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
+import org.lwjgl.util.generator.opengl.GLenum;
 
 public interface AMD_vertex_shader_tessellator {
 
diff --git a/src/templates/org/lwjgl/opengl/APPLE_element_array.java b/src/templates/org/lwjgl/opengl/APPLE_element_array.java
index 8d09178..29d63d6 100644
--- a/src/templates/org/lwjgl/opengl/APPLE_element_array.java
+++ b/src/templates/org/lwjgl/opengl/APPLE_element_array.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.Buffer;
 import java.nio.IntBuffer;
diff --git a/src/templates/org/lwjgl/opengl/APPLE_fence.java b/src/templates/org/lwjgl/opengl/APPLE_fence.java
index 0bd87be..6b0700a 100644
--- a/src/templates/org/lwjgl/opengl/APPLE_fence.java
+++ b/src/templates/org/lwjgl/opengl/APPLE_fence.java
@@ -32,6 +32,11 @@
 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;
 
@@ -50,7 +55,7 @@ public interface APPLE_fence {
 	void glDeleteFencesAPPLE(@AutoSize("fences") @GLsizei int n, @Const @GLuint IntBuffer fences);
 
 	@Alternate("glDeleteFencesAPPLE")
-	void glDeleteFencesAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtils.getBufferInt().put(0, fence), 0", keepParam = true) int fence);
+	void 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);
 
diff --git a/src/templates/org/lwjgl/opengl/APPLE_flush_buffer_range.java b/src/templates/org/lwjgl/opengl/APPLE_flush_buffer_range.java
index cabf362..15468d3 100644
--- a/src/templates/org/lwjgl/opengl/APPLE_flush_buffer_range.java
+++ b/src/templates/org/lwjgl/opengl/APPLE_flush_buffer_range.java
@@ -31,9 +31,9 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
-import org.lwjgl.util.generator.GLintptr;
-import org.lwjgl.util.generator.GLsizeiptr;
+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 {
 
diff --git a/src/templates/org/lwjgl/opengl/APPLE_object_purgeable.java b/src/templates/org/lwjgl/opengl/APPLE_object_purgeable.java
index df1fba6..10bca01 100644
--- a/src/templates/org/lwjgl/opengl/APPLE_object_purgeable.java
+++ b/src/templates/org/lwjgl/opengl/APPLE_object_purgeable.java
@@ -32,6 +32,10 @@
 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;
 
diff --git a/src/templates/org/lwjgl/opengl/APPLE_texture_range.java b/src/templates/org/lwjgl/opengl/APPLE_texture_range.java
index ba1fbbd..93c5108 100644
--- a/src/templates/org/lwjgl/opengl/APPLE_texture_range.java
+++ b/src/templates/org/lwjgl/opengl/APPLE_texture_range.java
@@ -32,6 +32,9 @@
 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;
diff --git a/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java b/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java
index d34ce2f..ec9fe09 100644
--- a/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java
+++ b/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java
@@ -32,6 +32,10 @@
 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;
 
@@ -48,7 +52,7 @@ public interface APPLE_vertex_array_object {
 	void glDeleteVertexArraysAPPLE(@AutoSize("arrays") @GLsizei int n, @Const @GLuint IntBuffer arrays);
 
 	@Alternate("glDeleteVertexArraysAPPLE")
-	void glDeleteVertexArraysAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtils.getBufferInt().put(0, array), 0", keepParam = true) int array);
+	void 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);
 
diff --git a/src/templates/org/lwjgl/opengl/APPLE_vertex_array_range.java b/src/templates/org/lwjgl/opengl/APPLE_vertex_array_range.java
index c37fc32..29d1538 100644
--- a/src/templates/org/lwjgl/opengl/APPLE_vertex_array_range.java
+++ b/src/templates/org/lwjgl/opengl/APPLE_vertex_array_range.java
@@ -32,9 +32,9 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.AutoSize;
-import org.lwjgl.util.generator.GLenum;
-import org.lwjgl.util.generator.GLsizei;
-import org.lwjgl.util.generator.GLvoid;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLsizei;
+import org.lwjgl.util.generator.opengl.GLvoid;
 
 import java.nio.ByteBuffer;
 
diff --git a/src/templates/org/lwjgl/opengl/APPLE_vertex_program_evaluators.java b/src/templates/org/lwjgl/opengl/APPLE_vertex_program_evaluators.java
index f096a7d..337d06f 100644
--- a/src/templates/org/lwjgl/opengl/APPLE_vertex_program_evaluators.java
+++ b/src/templates/org/lwjgl/opengl/APPLE_vertex_program_evaluators.java
@@ -33,8 +33,8 @@ package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.Check;
 import org.lwjgl.util.generator.Const;
-import org.lwjgl.util.generator.GLenum;
-import org.lwjgl.util.generator.GLuint;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLuint;
 
 import java.nio.DoubleBuffer;
 import java.nio.FloatBuffer;
diff --git a/src/templates/org/lwjgl/opengl/ARB_ES2_compatibility.java b/src/templates/org/lwjgl/opengl/ARB_ES2_compatibility.java
new file mode 100644
index 0000000..e754eea
--- /dev/null
+++ b/src/templates/org/lwjgl/opengl/ARB_ES2_compatibility.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) 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 &lt;value&gt; 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 &lt;type&gt; parameter of VertexAttribPointer: */
+	int GL_FIXED = 0x140C;
+
+	/**
+	 * Accepted by the &lt;precisiontype&gt; 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);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java b/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java
index cc267f4..fdf4af6 100644
--- a/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java
+++ b/src/templates/org/lwjgl/opengl/ARB_blend_func_extended.java
@@ -32,6 +32,9 @@
 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;
 
@@ -53,13 +56,17 @@ public interface ARB_blend_func_extended {
 	 */
 	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);
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_buffer_object.java b/src/templates/org/lwjgl/opengl/ARB_buffer_object.java
index 1c627a9..8106be5 100644
--- a/src/templates/org/lwjgl/opengl/ARB_buffer_object.java
+++ b/src/templates/org/lwjgl/opengl/ARB_buffer_object.java
@@ -32,6 +32,8 @@
 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;
@@ -69,7 +71,7 @@ public interface ARB_buffer_object {
 	void glDeleteBuffersARB(@AutoSize("buffers") @GLsizei int n, @Const @GLuint IntBuffer buffers);
 
 	@Alternate("glDeleteBuffersARB")
-	void glDeleteBuffersARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
+	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);
 
@@ -131,7 +133,7 @@ public interface ARB_buffer_object {
 	 */
 	@CachedResult
 	@GLvoid
-	@AutoResultSize("GLChecks.getBufferObjectSizeARB(caps, target)")
+	@AutoSize("GLChecks.getBufferObjectSizeARB(caps, target)")
 	ByteBuffer glMapBufferARB(@GLenum int target, @GLenum int access);
 
 	boolean glUnmapBufferARB(@GLenum int target);
@@ -145,6 +147,6 @@ public interface ARB_buffer_object {
 	void glGetBufferParameterivARB2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params);
 
 	@StripPostfix("pointer")
-	@AutoResultSize("GLChecks.getBufferObjectSizeARB(caps, target)")
+	@AutoSize("GLChecks.getBufferObjectSizeARB(caps, target)")
 	void glGetBufferPointervARB(@GLenum int target, @GLenum int pname, @Result @GLvoid ByteBuffer pointer);
 }
diff --git a/src/templates/org/lwjgl/opengl/ARB_cl_event.java b/src/templates/org/lwjgl/opengl/ARB_cl_event.java
new file mode 100644
index 0000000..30435fd
--- /dev/null
+++ b/src/templates/org/lwjgl/opengl/ARB_cl_event.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.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;
+
+ at Imports("org.lwjgl.opencl.*")
+ at Extension(postfix = "ARB", className = "ARBCLEvent")
+public interface ARB_cl_event {
+
+	/** Returned in &lt;values&gt; for GetSynciv &lt;pname&gt; OBJECT_TYPE. */
+	int GL_SYNC_CL_EVENT_ARB = 0x8240;
+
+	/** Returned in &lt;values&gt; for GetSynciv &lt;pname&gt; 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);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_color_buffer_float.java b/src/templates/org/lwjgl/opengl/ARB_color_buffer_float.java
index d00de08..6a5bcfd 100644
--- a/src/templates/org/lwjgl/opengl/ARB_color_buffer_float.java
+++ b/src/templates/org/lwjgl/opengl/ARB_color_buffer_float.java
@@ -31,7 +31,7 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
+import org.lwjgl.util.generator.opengl.GLenum;
 
 public interface ARB_color_buffer_float {
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_copy_buffer.java b/src/templates/org/lwjgl/opengl/ARB_copy_buffer.java
index fd8981b..615519f 100644
--- a/src/templates/org/lwjgl/opengl/ARB_copy_buffer.java
+++ b/src/templates/org/lwjgl/opengl/ARB_copy_buffer.java
@@ -31,9 +31,10 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
-import org.lwjgl.util.generator.GLintptr;
-import org.lwjgl.util.generator.GLsizeiptr;
+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 {
 
@@ -47,6 +48,7 @@ public interface ARB_copy_buffer {
 	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);
diff --git a/src/templates/org/lwjgl/opengl/ARB_debug_output.java b/src/templates/org/lwjgl/opengl/ARB_debug_output.java
new file mode 100644
index 0000000..1189f3e
--- /dev/null
+++ b/src/templates/org/lwjgl/opengl/ARB_debug_output.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) 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 &lt;target&gt; parameters of Enable, Disable,
+	 * and IsEnabled:
+	 */
+	int GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB = 0x8242;
+
+	/**
+	 * Tokens accepted by the &lt;value&gt; 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 &lt;pname&gt; parameter of GetPointerv: */
+	int GL_DEBUG_CALLBACK_FUNCTION_ARB = 0x8244,
+		GL_DEBUG_CALLBACK_USER_PARAM_ARB = 0x8245;
+
+	/**
+	 * Tokens accepted or provided by the &lt;source&gt; parameters of
+	 * DebugMessageControlARB, DebugMessageInsertARB and DEBUGPROCARB,
+	 * and the &lt;sources&gt; 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 &lt;type&gt; parameters of
+	 * DebugMessageControlARB, DebugMessageInsertARB and DEBUGPROCARB,
+	 * and the &lt;types&gt; 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 &lt;severity&gt; parameters of
+	 * DebugMessageControlARB, DebugMessageInsertARB and DEBUGPROCARB
+	 * callback functions, and the &lt;severities&gt; 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);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java b/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java
index 8ffbdbb..f657eb4 100644
--- a/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java
+++ b/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java
@@ -32,6 +32,9 @@
 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.*;
 
@@ -62,5 +65,5 @@ public interface ARB_draw_buffers {
 	void glDrawBuffersARB(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers);
 
 	@Alternate("glDrawBuffersARB")
-	void glDrawBuffersARB(@Constant("1") @GLsizei int size, @Constant(value = "APIUtils.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
+	void glDrawBuffersARB(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
 }
diff --git a/src/templates/org/lwjgl/opengl/ARB_draw_buffers_blend.java b/src/templates/org/lwjgl/opengl/ARB_draw_buffers_blend.java
index d45400c..afef9e0 100644
--- a/src/templates/org/lwjgl/opengl/ARB_draw_buffers_blend.java
+++ b/src/templates/org/lwjgl/opengl/ARB_draw_buffers_blend.java
@@ -31,8 +31,8 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
-import org.lwjgl.util.generator.GLuint;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLuint;
 
 public interface ARB_draw_buffers_blend {
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_draw_elements_base_vertex.java b/src/templates/org/lwjgl/opengl/ARB_draw_elements_base_vertex.java
index 0024d95..2e78dc1 100644
--- a/src/templates/org/lwjgl/opengl/ARB_draw_elements_base_vertex.java
+++ b/src/templates/org/lwjgl/opengl/ARB_draw_elements_base_vertex.java
@@ -32,11 +32,13 @@
 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
@@ -44,6 +46,7 @@ public interface ARB_draw_elements_base_vertex {
 	                              @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
@@ -51,6 +54,7 @@ public interface ARB_draw_elements_base_vertex {
 	                                   @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
diff --git a/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java b/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java
index 0e40a93..381426f 100644
--- a/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java
+++ b/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java
@@ -32,6 +32,8 @@
 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;
 
@@ -54,8 +56,10 @@ public interface ARB_draw_indirect {
 	 */
 	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);
 
 }
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_draw_instanced.java b/src/templates/org/lwjgl/opengl/ARB_draw_instanced.java
index 3174191..4a39e0b 100644
--- a/src/templates/org/lwjgl/opengl/ARB_draw_instanced.java
+++ b/src/templates/org/lwjgl/opengl/ARB_draw_instanced.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.Buffer;
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java b/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java
index 4ba3cc2..3670739 100644
--- a/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java
+++ b/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java
@@ -32,6 +32,8 @@
 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;
 
@@ -184,84 +186,110 @@ public interface ARB_framebuffer_object {
 	/** Accepted by the &lt;value&gt; 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 = "APIUtils.getBufferInt().put(0, renderbuffer), 0", keepParam = true) int renderbuffer);
+	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 = "APIUtils.getBufferInt().put(0, framebuffer), 0", keepParam = true) int framebuffer);
+	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);
 
 }
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_geometry_shader4.java b/src/templates/org/lwjgl/opengl/ARB_geometry_shader4.java
index 286439f..e385f53 100644
--- a/src/templates/org/lwjgl/opengl/ARB_geometry_shader4.java
+++ b/src/templates/org/lwjgl/opengl/ARB_geometry_shader4.java
@@ -31,8 +31,8 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
-import org.lwjgl.util.generator.GLuint;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLuint;
 
 public interface ARB_geometry_shader4 {
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_get_program_binary.java b/src/templates/org/lwjgl/opengl/ARB_get_program_binary.java
new file mode 100644
index 0000000..889eaf9
--- /dev/null
+++ b/src/templates/org/lwjgl/opengl/ARB_get_program_binary.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+import org.lwjgl.util.generator.*;
+import 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 &lt;pname&gt; parameter of ProgramParameteri and
+	 * GetProgramiv:
+	 */
+	int GL_PROGRAM_BINARY_RETRIEVABLE_HINT = 0x8257;
+
+	/** Accepted by the &lt;pname&gt; parameter of GetProgramiv: */
+	int GL_PROGRAM_BINARY_LENGTH = 0x8741;
+
+	/**
+	 * Accepted by the &lt;pname&gt; 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);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java b/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java
index 8d6907a..f5fb116 100644
--- a/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java
+++ b/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java
@@ -32,6 +32,8 @@
 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.*;
 
@@ -57,53 +59,71 @@ public interface ARB_gpu_shader_fp64 {
 	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);
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_imaging.java b/src/templates/org/lwjgl/opengl/ARB_imaging.java
index 59f0645..ed4de2d 100644
--- a/src/templates/org/lwjgl/opengl/ARB_imaging.java
+++ b/src/templates/org/lwjgl/opengl/ARB_imaging.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
@@ -40,8 +41,8 @@ import java.nio.*;
  * The GL12 imaging subset extension.
  *
  * @author cix_foo <cix_foo at users.sourceforge.net>
- * @version $Revision: 3116 $
- * $Id: ARB_imaging.java 3116 2008-08-19 16:46:03Z spasi $
+ * @version $Revision: 3412 $
+ * $Id: ARB_imaging.java 3412 2010-09-26 23:43:24Z spasi $
  */
 
 @Extension(postfix = "")
@@ -173,8 +174,10 @@ public interface ARB_imaging {
 	@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
diff --git a/src/templates/org/lwjgl/opengl/ARB_instanced_arrays.java b/src/templates/org/lwjgl/opengl/ARB_instanced_arrays.java
index ffec2bb..6134f2f 100644
--- a/src/templates/org/lwjgl/opengl/ARB_instanced_arrays.java
+++ b/src/templates/org/lwjgl/opengl/ARB_instanced_arrays.java
@@ -31,7 +31,7 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLuint;
+import org.lwjgl.util.generator.opengl.GLuint;
 
 public interface ARB_instanced_arrays {
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_map_buffer_range.java b/src/templates/org/lwjgl/opengl/ARB_map_buffer_range.java
index f99b4be..dc39150 100644
--- a/src/templates/org/lwjgl/opengl/ARB_map_buffer_range.java
+++ b/src/templates/org/lwjgl/opengl/ARB_map_buffer_range.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.ByteBuffer;
 
@@ -59,11 +60,13 @@ public interface ARB_map_buffer_range {
 	 *
 	 * @return A ByteBuffer representing the mapped buffer memory.
 	 */
+	@Reuse("GL30")
 	@CachedResult(isRange = true)
 	@GLvoid
-	@AutoResultSize("length")
+	@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);
 
 }
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_matrix_palette.java b/src/templates/org/lwjgl/opengl/ARB_matrix_palette.java
index 18a7a45..f17c934 100644
--- a/src/templates/org/lwjgl/opengl/ARB_matrix_palette.java
+++ b/src/templates/org/lwjgl/opengl/ARB_matrix_palette.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_multisample.java b/src/templates/org/lwjgl/opengl/ARB_multisample.java
index 540580f..e81f170 100644
--- a/src/templates/org/lwjgl/opengl/ARB_multisample.java
+++ b/src/templates/org/lwjgl/opengl/ARB_multisample.java
@@ -31,7 +31,7 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLclampf;
 
 public interface ARB_multisample {
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_multitexture.java b/src/templates/org/lwjgl/opengl/ARB_multitexture.java
index d34358c..492a9a7 100644
--- a/src/templates/org/lwjgl/opengl/ARB_multitexture.java
+++ b/src/templates/org/lwjgl/opengl/ARB_multitexture.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLenum;
 
 public interface ARB_multitexture {
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java b/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java
index ac6031f..3973f3b 100644
--- a/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java
+++ b/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java
@@ -32,6 +32,11 @@
 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;
 
@@ -63,7 +68,7 @@ public interface ARB_occlusion_query {
 	void glDeleteQueriesARB(@AutoSize("ids") @GLsizei int n, @GLuint IntBuffer ids);
 
 	@Alternate("glDeleteQueriesARB")
-	void glDeleteQueriesARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, id), 0", keepParam = true) int id);
+	void glDeleteQueriesARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, id), 0", keepParam = true) int id);
 
 	boolean glIsQueryARB(@GLuint int id);
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_point_parameters.java b/src/templates/org/lwjgl/opengl/ARB_point_parameters.java
index 5954775..5a6ce3c 100644
--- a/src/templates/org/lwjgl/opengl/ARB_point_parameters.java
+++ b/src/templates/org/lwjgl/opengl/ARB_point_parameters.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLenum;
 
 import java.nio.*;
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_program.java b/src/templates/org/lwjgl/opengl/ARB_program.java
index 4480e46..0616f60 100644
--- a/src/templates/org/lwjgl/opengl/ARB_program.java
+++ b/src/templates/org/lwjgl/opengl/ARB_program.java
@@ -32,6 +32,8 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.Alternate;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
@@ -126,7 +128,7 @@ public interface ARB_program {
 	void glDeleteProgramsARB(@AutoSize("programs") @GLsizei int n, @Const @GLuint IntBuffer programs);
 
 	@Alternate("glDeleteProgramsARB")
-	void glDeleteProgramsARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, program), 0", keepParam = true) int program);
+	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);
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_provoking_vertex.java b/src/templates/org/lwjgl/opengl/ARB_provoking_vertex.java
index 192cfda..6890a4f 100644
--- a/src/templates/org/lwjgl/opengl/ARB_provoking_vertex.java
+++ b/src/templates/org/lwjgl/opengl/ARB_provoking_vertex.java
@@ -31,7 +31,8 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
+import org.lwjgl.util.generator.Reuse;
+import org.lwjgl.util.generator.opengl.GLenum;
 
 public interface ARB_provoking_vertex {
 
@@ -46,6 +47,7 @@ public interface ARB_provoking_vertex {
 	int GL_PROVOKING_VERTEX = 0x8E4F;
 	int GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION = 0x8E4C;
 
+	@Reuse("GL32")
 	void glProvokingVertex(@GLenum int mode);
 
 }
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_robustness.java b/src/templates/org/lwjgl/opengl/ARB_robustness.java
new file mode 100644
index 0000000..d44b438
--- /dev/null
+++ b/src/templates/org/lwjgl/opengl/ARB_robustness.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) 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.*;
+
+ at Dependent
+ at 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 &lt;value&gt; parameter of GetBooleanv, GetIntegerv,
+	 * GetInteger64v, GetFloatv, and GetDoublev:
+	 */
+	int GL_RESET_NOTIFICATION_STRATEGY_ARB = 0x8256;
+
+	/**
+	 * Returned by GetIntegerv and related simple queries when
+	 * &lt;value&gt; is RESET_NOTIFICATION_STRATEGY_ARB:
+	 */
+	int GL_LOSE_CONTEXT_ON_RESET_ARB = 0x8252,
+		GL_NO_RESET_NOTIFICATION_ARB = 0x8261;
+
+	/** Returned by GetIntegerv when &lt;pname&gt; 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);
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_sample_shading.java b/src/templates/org/lwjgl/opengl/ARB_sample_shading.java
index 23e3271..3127f3b 100644
--- a/src/templates/org/lwjgl/opengl/ARB_sample_shading.java
+++ b/src/templates/org/lwjgl/opengl/ARB_sample_shading.java
@@ -31,7 +31,7 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLclampf;
+import org.lwjgl.util.generator.opengl.GLclampf;
 
 public interface ARB_sample_shading {
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java b/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java
index 27e30c2..577ccdd 100644
--- a/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java
+++ b/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java
@@ -32,6 +32,11 @@
 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;
@@ -45,64 +50,84 @@ public interface ARB_sampler_objects {
 	 */
 	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 = "APIUtils.getBufferInt().put(0, sampler), 0", keepParam = true) int sampler);
+	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")
diff --git a/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java b/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java
new file mode 100644
index 0000000..a1853ad
--- /dev/null
+++ b/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java
@@ -0,0 +1,338 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) 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;
+
+ at Extension(postfix = "")
+public interface ARB_separate_shader_objects {
+
+	/** Accepted by &lt;stages&gt; 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 &lt;pname&gt; parameter of ProgramParameteri and
+	 * GetProgramiv:
+	 */
+	int GL_PROGRAM_SEPARABLE = 0x8258;
+
+	/** Accepted by &lt;type&gt; parameter to GetProgramPipelineiv: */
+	int GL_ACTIVE_PROGRAM = 0x8259;
+
+	/**
+	 * Accepted by the &lt;pname&gt; 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);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_shader_objects.java b/src/templates/org/lwjgl/opengl/ARB_shader_objects.java
index c774b03..dd2003b 100644
--- a/src/templates/org/lwjgl/opengl/ARB_shader_objects.java
+++ b/src/templates/org/lwjgl/opengl/ARB_shader_objects.java
@@ -32,6 +32,8 @@
 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;
@@ -107,8 +109,8 @@ public interface ARB_shader_objects {
 
 	@Alternate(value = "glShaderSourceARB", nativeAlt = true)
 	void glShaderSourceARB3(@GLhandleARB int shader, @Constant("strings.length") @GLsizei int count,
-	                        @Const @StringList(value = "count", lengths = "length") CharSequence[] strings,
-	                        @Constant("APIUtils.getLengths(strings), 0") @Const IntBuffer length);
+	                        @Const @PointerArray(value = "count", lengths = "length") CharSequence[] strings,
+	                        @Constant("APIUtil.getLengths(strings), 0") @Const IntBuffer length);
 
 	void glCompileShaderARB(@GLhandleARB int shaderObj);
 
@@ -232,7 +234,7 @@ public interface ARB_shader_objects {
 	@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, APIUtils.getBufferInt(), 0, APIUtils.getBufferInt(), 1") IntBuffer length,
+	                           @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. */
@@ -242,7 +244,7 @@ public interface ARB_shader_objects {
 	                               @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("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+	                               @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
 
 	/** Overloads glGetActiveUniformARB. This version returns only the uniform type. */
 	@Alternate(value = "glGetActiveUniformARB", javaAlt = true)
@@ -251,7 +253,7 @@ public interface ARB_shader_objects {
 	                               @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("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+	                               @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
 
 	@StripPostfix("params")
 	void glGetUniformfvARB(@GLhandleARB int programObj, int location, @OutParameter @Check FloatBuffer params);
diff --git a/src/templates/org/lwjgl/opengl/ARB_shader_precision.java b/src/templates/org/lwjgl/opengl/ARB_shader_precision.java
new file mode 100644
index 0000000..139f950
--- /dev/null
+++ b/src/templates/org/lwjgl/opengl/ARB_shader_precision.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+public interface ARB_shader_precision {
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_shader_stencil_export.java b/src/templates/org/lwjgl/opengl/ARB_shader_stencil_export.java
new file mode 100644
index 0000000..7bd735d
--- /dev/null
+++ b/src/templates/org/lwjgl/opengl/ARB_shader_stencil_export.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+public interface ARB_shader_stencil_export {
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_shader_subroutine.java b/src/templates/org/lwjgl/opengl/ARB_shader_subroutine.java
index 4bfa3c7..b6fa65d 100644
--- a/src/templates/org/lwjgl/opengl/ARB_shader_subroutine.java
+++ b/src/templates/org/lwjgl/opengl/ARB_shader_subroutine.java
@@ -32,6 +32,8 @@
 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;
@@ -59,55 +61,68 @@ public interface ARB_shader_subroutine {
 	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")
diff --git a/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java b/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java
index 35eaadf..a31fa3e 100644
--- a/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java
+++ b/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java
@@ -32,6 +32,8 @@
 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;
@@ -60,13 +62,13 @@ public interface ARB_shading_language_include {
 	void glDeleteNamedStringARB(@Constant("name.length()") int namelen, CharSequence name);
 
 	void glCompileShaderIncludeARB(@GLuint int shader, @GLsizei int count,
-	                               @Const @NullTerminated("count") @StringList("count") @GLchar ByteBuffer path,
+	                               @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 @StringList(value = "count", lengths = "length") CharSequence[] path,
-	                                @Constant("APIUtils.getLengths(path), 0") @Const IntBuffer length);
+	                                @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);
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_sync.java b/src/templates/org/lwjgl/opengl/ARB_sync.java
index 929110c..b76d00e 100644
--- a/src/templates/org/lwjgl/opengl/ARB_sync.java
+++ b/src/templates/org/lwjgl/opengl/ARB_sync.java
@@ -32,6 +32,9 @@
 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;
@@ -70,35 +73,44 @@ public interface ARB_sync {
 	int GL_CONDITION_SATISFIED = 0x911C;
 	int GL_WAIT_FAILED = 0x911D;
 
-	@GLpointer("GLsync")
+	@Reuse("GL32")
+	@PointerWrapper("GLsync")
 	GLSync glFenceSync(@GLenum int condition, @GLbitfield int flags);
 
-	boolean glIsSync(@GLpointer("GLsync") GLSync sync);
+	@Reuse("GL32")
+	boolean glIsSync(@PointerWrapper("GLsync") GLSync sync);
 
-	void glDeleteSync(@GLpointer("GLsync") GLSync sync);
+	@Reuse("GL32")
+	void glDeleteSync(@PointerWrapper("GLsync") GLSync sync);
 
+	@Reuse("GL32")
 	@GLenum
-	int glClientWaitSync(@GLpointer("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
+	int glClientWaitSync(@PointerWrapper("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
 
-	void glWaitSync(@GLpointer("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
+	@Reuse("GL32")
+	void glWaitSync(@PointerWrapper("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
 
-	@StripPostfix(value = "params", postfix = "64")
+	@Reuse("GL32")
+	@StripPostfix("params")
 	void glGetInteger64v(@GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer params);
 
+	@Reuse("GL32")
 	@Alternate("glGetInteger64v")
 	@GLreturn("params")
-	@StripPostfix(value = "params", postfix = "64")
+	@StripPostfix("params")
 	void glGetInteger64v2(@GLenum int pname, @OutParameter @GLint64 LongBuffer params);
 
+	@Reuse("GL32")
 	@StripPostfix("values")
-	void glGetSynciv(@GLpointer("GLsync") GLSync sync, @GLenum int pname, @AutoSize("values") @GLsizei int bufSize,
+	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(@GLpointer("GLsync") GLSync sync, @GLenum int pname, @Constant("1") @GLsizei int bufSize,
+	void glGetSynciv2(@PointerWrapper("GLsync") GLSync sync, @GLenum int pname, @Constant("1") @GLsizei int bufSize,
 	                  @OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
 	                  @OutParameter IntBuffer values);
 }
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_tessellation_shader.java b/src/templates/org/lwjgl/opengl/ARB_tessellation_shader.java
index c9c084e..1c7e347 100644
--- a/src/templates/org/lwjgl/opengl/ARB_tessellation_shader.java
+++ b/src/templates/org/lwjgl/opengl/ARB_tessellation_shader.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLenum;
 
 import java.nio.FloatBuffer;
 
@@ -114,8 +115,10 @@ public interface ARB_tessellation_shader {
 	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);
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_texture_buffer_object.java b/src/templates/org/lwjgl/opengl/ARB_texture_buffer_object.java
index 0c3956e..f68a80a 100644
--- a/src/templates/org/lwjgl/opengl/ARB_texture_buffer_object.java
+++ b/src/templates/org/lwjgl/opengl/ARB_texture_buffer_object.java
@@ -31,8 +31,8 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
-import org.lwjgl.util.generator.GLuint;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLuint;
 
 public interface ARB_texture_buffer_object {
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_texture_compression.java b/src/templates/org/lwjgl/opengl/ARB_texture_compression.java
index 542d4fe..2a555f5 100644
--- a/src/templates/org/lwjgl/opengl/ARB_texture_compression.java
+++ b/src/templates/org/lwjgl/opengl/ARB_texture_compression.java
@@ -32,6 +32,9 @@
 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.*;
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_texture_multisample.java b/src/templates/org/lwjgl/opengl/ARB_texture_multisample.java
index 6ea55d9..dd4b7a9 100644
--- a/src/templates/org/lwjgl/opengl/ARB_texture_multisample.java
+++ b/src/templates/org/lwjgl/opengl/ARB_texture_multisample.java
@@ -32,6 +32,10 @@
 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;
 
@@ -95,17 +99,21 @@ public interface ARB_texture_multisample {
 	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);
 
 }
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_timer_query.java b/src/templates/org/lwjgl/opengl/ARB_timer_query.java
index 59b479f..a566268 100644
--- a/src/templates/org/lwjgl/opengl/ARB_timer_query.java
+++ b/src/templates/org/lwjgl/opengl/ARB_timer_query.java
@@ -32,6 +32,8 @@
 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;
 
@@ -51,19 +53,24 @@ public interface ARB_timer_query {
 	 */
 	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")
diff --git a/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java b/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java
index 49afd6a..2639297 100644
--- a/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java
+++ b/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java
@@ -32,6 +32,11 @@
 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;
 
@@ -48,25 +53,34 @@ public interface ARB_transform_feedback2 {
 	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 = "APIUtils.getBufferInt().put(0, id), 0", keepParam = true) int id);
+	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);
 
 }
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_transform_feedback3.java b/src/templates/org/lwjgl/opengl/ARB_transform_feedback3.java
index da2e9cb..fadc002 100644
--- a/src/templates/org/lwjgl/opengl/ARB_transform_feedback3.java
+++ b/src/templates/org/lwjgl/opengl/ARB_transform_feedback3.java
@@ -32,6 +32,10 @@
 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;
 
@@ -45,15 +49,20 @@ public interface ARB_transform_feedback3 {
 	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")
diff --git a/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java b/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java
index 4810cc4..fe0cbc3 100644
--- a/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java
+++ b/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java
@@ -32,6 +32,8 @@
 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;
@@ -98,21 +100,25 @@ public interface ARB_uniform_buffer_object {
 	/** 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 @StringList("uniformCount") ByteBuffer uniformNames,
+	                         @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 @StringList("uniformCount") CharSequence[] uniformNames,
+	                         @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")
@@ -121,55 +127,68 @@ public interface ARB_uniform_buffer_object {
 	                           @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);
 
 }
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java b/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java
index 0530f53..6ad3981 100644
--- a/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java
+++ b/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java
@@ -32,6 +32,10 @@
 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;
 
@@ -43,19 +47,25 @@ public interface ARB_vertex_array_object {
 	 */
 	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 = "APIUtils.getBufferInt().put(0, array), 0", keepParam = true) int array);
+	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);
 
 }
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_vertex_attrib_64bit.java b/src/templates/org/lwjgl/opengl/ARB_vertex_attrib_64bit.java
new file mode 100644
index 0000000..2f55f34
--- /dev/null
+++ b/src/templates/org/lwjgl/opengl/ARB_vertex_attrib_64bit.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) 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;
+
+ at Dependent
+ at Extension(postfix = "")
+public interface ARB_vertex_attrib_64bit {
+
+	/** Returned in the &lt;type&gt; 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);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ARB_vertex_blend.java b/src/templates/org/lwjgl/opengl/ARB_vertex_blend.java
index 22b0d06..234fb51 100644
--- a/src/templates/org/lwjgl/opengl/ARB_vertex_blend.java
+++ b/src/templates/org/lwjgl/opengl/ARB_vertex_blend.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_vertex_program.java b/src/templates/org/lwjgl/opengl/ARB_vertex_program.java
index 1f63624..d99ac45 100644
--- a/src/templates/org/lwjgl/opengl/ARB_vertex_program.java
+++ b/src/templates/org/lwjgl/opengl/ARB_vertex_program.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
@@ -79,45 +80,59 @@ public interface ARB_vertex_program extends ARB_program {
 	 */
 	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)
@@ -132,19 +147,25 @@ public interface ARB_vertex_program extends ARB_program {
 	                              @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);
 }
diff --git a/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java b/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java
index d5221e8..2b3bdb8 100644
--- a/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java
+++ b/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java
@@ -32,6 +32,8 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.Alternate;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
@@ -168,7 +170,7 @@ public interface ARB_vertex_shader {
 	@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, APIUtils.getBufferInt(), 0, APIUtils.getBufferInt(), 1") IntBuffer length,
+	                          @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. */
@@ -178,7 +180,7 @@ public interface ARB_vertex_shader {
 	                              @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("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+	                              @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
 
 	/** Overloads glGetActiveAttribARB. This version returns only the attrib type. */
 	@Alternate(value = "glGetActiveAttribARB", javaAlt = true)
@@ -187,7 +189,7 @@ public interface ARB_vertex_shader {
 	                              @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("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+	                              @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
 
 	int glGetAttribLocationARB(@GLhandleARB int programObj, @NullTerminated @Const @GLcharARB ByteBuffer name);
 
diff --git a/src/templates/org/lwjgl/opengl/ARB_vertex_type_2_10_10_10_rev.java b/src/templates/org/lwjgl/opengl/ARB_vertex_type_2_10_10_10_rev.java
index ff97ca8..d10a31d 100644
--- a/src/templates/org/lwjgl/opengl/ARB_vertex_type_2_10_10_10_rev.java
+++ b/src/templates/org/lwjgl/opengl/ARB_vertex_type_2_10_10_10_rev.java
@@ -32,6 +32,8 @@
 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;
 
@@ -47,135 +49,173 @@ public interface ARB_vertex_type_2_10_10_10_rev {
 	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);
diff --git a/src/templates/org/lwjgl/opengl/ARB_viewport_array.java b/src/templates/org/lwjgl/opengl/ARB_viewport_array.java
new file mode 100644
index 0000000..f7ef15a
--- /dev/null
+++ b/src/templates/org/lwjgl/opengl/ARB_viewport_array.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) 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;
+
+ at Extension(postfix = "")
+public interface ARB_viewport_array {
+
+	/**
+	 * Accepted by the &lt;pname&gt; 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 &lt;pname&gt; parameter of GetIntegeri_v: */
+	int GL_SCISSOR_BOX = 0x0C10;
+
+	/** Accepted by the &lt;pname&gt; parameter of GetFloati_v: */
+	int GL_VIEWPORT = 0x0BA2;
+
+	/** Accepted by the &lt;pname&gt; parameter of GetDoublei_v: */
+	int GL_DEPTH_RANGE = 0x0B70;
+
+	/** Accepted by the &lt;pname&gt; parameter of Enablei, Disablei, and IsEnabledi: */
+	int GL_SCISSOR_TEST = 0x0C11;
+
+	/**
+	 * Returned in the &lt;data&gt; parameter from a Get query with a &lt;pname&gt; 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);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java b/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java
index 300f99a..77bb68e 100644
--- a/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java
+++ b/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java
@@ -32,6 +32,9 @@
 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.*;
 
@@ -62,5 +65,5 @@ public interface ATI_draw_buffers {
 	void glDrawBuffersATI(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers);
 
 	@Alternate("glDrawBuffersATI")
-	void glDrawBuffersATI(@Constant("1") @GLsizei int size, @Constant(value = "APIUtils.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
+	void glDrawBuffersATI(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
 }
diff --git a/src/templates/org/lwjgl/opengl/ATI_element_array.java b/src/templates/org/lwjgl/opengl/ATI_element_array.java
index b56207e..9bd0400 100644
--- a/src/templates/org/lwjgl/opengl/ATI_element_array.java
+++ b/src/templates/org/lwjgl/opengl/ATI_element_array.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
diff --git a/src/templates/org/lwjgl/opengl/ATI_envmap_bumpmap.java b/src/templates/org/lwjgl/opengl/ATI_envmap_bumpmap.java
index 4e3a381..40eddb6 100644
--- a/src/templates/org/lwjgl/opengl/ATI_envmap_bumpmap.java
+++ b/src/templates/org/lwjgl/opengl/ATI_envmap_bumpmap.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLenum;
 
 import java.nio.*;
 
diff --git a/src/templates/org/lwjgl/opengl/ATI_fragment_shader.java b/src/templates/org/lwjgl/opengl/ATI_fragment_shader.java
index 14d937e..a0b2bed 100644
--- a/src/templates/org/lwjgl/opengl/ATI_fragment_shader.java
+++ b/src/templates/org/lwjgl/opengl/ATI_fragment_shader.java
@@ -32,6 +32,8 @@
 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.*;
 
diff --git a/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java b/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java
index c762c9d..4e66dd4 100644
--- a/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java
+++ b/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java
@@ -32,6 +32,8 @@
 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.*;
 
@@ -62,7 +64,7 @@ public interface ATI_map_object_buffer {
 	 */
 	@CachedResult
 	@GLvoid
-	@AutoResultSize("GLChecks.getBufferObjectSizeATI(caps, buffer)")
+	@AutoSize("GLChecks.getBufferObjectSizeATI(caps, buffer)")
 	ByteBuffer glMapObjectBufferATI(@GLuint int buffer);
 
 	void glUnmapObjectBufferATI(@GLuint int buffer);
diff --git a/src/templates/org/lwjgl/opengl/ATI_pn_triangles.java b/src/templates/org/lwjgl/opengl/ATI_pn_triangles.java
index 8b2cf9f..556b6e1 100644
--- a/src/templates/org/lwjgl/opengl/ATI_pn_triangles.java
+++ b/src/templates/org/lwjgl/opengl/ATI_pn_triangles.java
@@ -31,7 +31,7 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLenum;
 
 public interface ATI_pn_triangles {
 	int GL_PN_TRIANGLES_ATI = 0x87F0;
diff --git a/src/templates/org/lwjgl/opengl/ATI_separate_stencil.java b/src/templates/org/lwjgl/opengl/ATI_separate_stencil.java
index ac5e913..0fe735f 100644
--- a/src/templates/org/lwjgl/opengl/ATI_separate_stencil.java
+++ b/src/templates/org/lwjgl/opengl/ATI_separate_stencil.java
@@ -31,7 +31,8 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.*;
+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;
diff --git a/src/templates/org/lwjgl/opengl/ATI_vertex_array_object.java b/src/templates/org/lwjgl/opengl/ATI_vertex_array_object.java
index d351007..bde828c 100644
--- a/src/templates/org/lwjgl/opengl/ATI_vertex_array_object.java
+++ b/src/templates/org/lwjgl/opengl/ATI_vertex_array_object.java
@@ -32,6 +32,8 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.Alternate;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
diff --git a/src/templates/org/lwjgl/opengl/ATI_vertex_attrib_array_object.java b/src/templates/org/lwjgl/opengl/ATI_vertex_attrib_array_object.java
index a32ecdf..313f6d7 100644
--- a/src/templates/org/lwjgl/opengl/ATI_vertex_attrib_array_object.java
+++ b/src/templates/org/lwjgl/opengl/ATI_vertex_attrib_array_object.java
@@ -32,6 +32,9 @@
 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.*;
 
diff --git a/src/templates/org/lwjgl/opengl/ATI_vertex_streams.java b/src/templates/org/lwjgl/opengl/ATI_vertex_streams.java
index cb585d1..1820f98 100644
--- a/src/templates/org/lwjgl/opengl/ATI_vertex_streams.java
+++ b/src/templates/org/lwjgl/opengl/ATI_vertex_streams.java
@@ -32,6 +32,7 @@
 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;
diff --git a/src/templates/org/lwjgl/opengl/EXT_bindable_uniform.java b/src/templates/org/lwjgl/opengl/EXT_bindable_uniform.java
index 789e290..9cfdede 100644
--- a/src/templates/org/lwjgl/opengl/EXT_bindable_uniform.java
+++ b/src/templates/org/lwjgl/opengl/EXT_bindable_uniform.java
@@ -31,8 +31,8 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLintptr;
-import org.lwjgl.util.generator.GLuint;
+import org.lwjgl.util.generator.opengl.GLintptr;
+import org.lwjgl.util.generator.opengl.GLuint;
 
 public interface EXT_bindable_uniform {
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_blend_color.java b/src/templates/org/lwjgl/opengl/EXT_blend_color.java
index 926245c..9d826cd 100644
--- a/src/templates/org/lwjgl/opengl/EXT_blend_color.java
+++ b/src/templates/org/lwjgl/opengl/EXT_blend_color.java
@@ -31,7 +31,7 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLclampf;
 
 public interface EXT_blend_color {
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_blend_equation_separate.java b/src/templates/org/lwjgl/opengl/EXT_blend_equation_separate.java
index bc5a19b..b3032c3 100644
--- a/src/templates/org/lwjgl/opengl/EXT_blend_equation_separate.java
+++ b/src/templates/org/lwjgl/opengl/EXT_blend_equation_separate.java
@@ -31,7 +31,7 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLenum;
 
 public interface EXT_blend_equation_separate {
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_blend_func_separate.java b/src/templates/org/lwjgl/opengl/EXT_blend_func_separate.java
index 266c955..f745e77 100644
--- a/src/templates/org/lwjgl/opengl/EXT_blend_func_separate.java
+++ b/src/templates/org/lwjgl/opengl/EXT_blend_func_separate.java
@@ -31,7 +31,7 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLenum;
 
 public interface EXT_blend_func_separate {
 	int GL_BLEND_DST_RGB_EXT = 0x80C8;
diff --git a/src/templates/org/lwjgl/opengl/EXT_blend_minmax.java b/src/templates/org/lwjgl/opengl/EXT_blend_minmax.java
index 465eca8..546ba83 100644
--- a/src/templates/org/lwjgl/opengl/EXT_blend_minmax.java
+++ b/src/templates/org/lwjgl/opengl/EXT_blend_minmax.java
@@ -31,7 +31,7 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLenum;
 
 public interface EXT_blend_minmax {
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_compiled_vertex_array.java b/src/templates/org/lwjgl/opengl/EXT_compiled_vertex_array.java
index b9b3aeb..94e7faf 100644
--- a/src/templates/org/lwjgl/opengl/EXT_compiled_vertex_array.java
+++ b/src/templates/org/lwjgl/opengl/EXT_compiled_vertex_array.java
@@ -31,7 +31,7 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLsizei;
 
 public interface EXT_compiled_vertex_array {
 	int GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = 0x81A8;
diff --git a/src/templates/org/lwjgl/opengl/EXT_depth_bounds_test.java b/src/templates/org/lwjgl/opengl/EXT_depth_bounds_test.java
index c35bc31..5a766d9 100644
--- a/src/templates/org/lwjgl/opengl/EXT_depth_bounds_test.java
+++ b/src/templates/org/lwjgl/opengl/EXT_depth_bounds_test.java
@@ -31,7 +31,7 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLclampd;
 
 public interface EXT_depth_bounds_test {
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java b/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java
index 7b9beb0..68b61c8 100644
--- a/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java
+++ b/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
@@ -519,11 +520,11 @@ public interface EXT_direct_state_access {
     value parameters
 	 */
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
+	@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.5)")
+	@Optional(reason = "AMD does not expose this (last driver checked: 10.9)")
 	@Dependent("OpenGL30")
 	void glDisableClientStateiEXT(@GLenum int array, @GLuint int index);
 
@@ -565,7 +566,7 @@ public interface EXT_direct_state_access {
     and before state value parameters
 	 */
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
+	@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);
@@ -576,7 +577,7 @@ public interface EXT_direct_state_access {
 	@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.5)")
+	@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);
@@ -587,7 +588,7 @@ public interface EXT_direct_state_access {
 	@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.5)")
+	@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);
@@ -598,32 +599,39 @@ public interface EXT_direct_state_access {
     TODO: Why 1.2.1 and not EXT_draw_buffers2?
 	 */
 
-	@Dependent("GL_EXT_draw_buffers2")
+	@Reuse("EXTDrawBuffers2")
+	@Dependent("OpenGL13")
 	void glEnableIndexedEXT(@GLenum int cap, @GLuint int index);
 
-	@Dependent("GL_EXT_draw_buffers2")
+	@Reuse("EXTDrawBuffers2")
+	@Dependent("OpenGL13")
 	void glDisableIndexedEXT(@GLenum int cap, @GLuint int index);
 
-	@Dependent("GL_EXT_draw_buffers2")
+	@Reuse("EXTDrawBuffers2")
+	@Dependent("OpenGL13")
 	boolean glIsEnabledIndexedEXT(@GLenum int cap, @GLuint int index);
 
-	@Dependent("GL_EXT_draw_buffers2")
+	@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("GL_EXT_draw_buffers2")
+	@Dependent("OpenGL13")
 	@StripPostfix("params")
 	void glGetIntegerIndexedvEXT2(@GLenum int pname, @GLuint int index, @OutParameter IntBuffer params);
 
-	@Dependent("GL_EXT_draw_buffers2")
+	@Reuse("EXTDrawBuffers2")
+	@Dependent("OpenGL13")
 	@StripPostfix("params")
-	void glGetBooleanIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") @GLboolean ByteBuffer params);
+	void glGetBooleanIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("4") @GLboolean ByteBuffer params);
 
+	@Reuse("EXTDrawBuffers2")
 	@Alternate("glGetBooleanIndexedvEXT")
 	@GLreturn("params")
-	@Dependent("GL_EXT_draw_buffers2")
+	@Dependent("OpenGL13")
 	@StripPostfix("params")
 	void glGetBooleanIndexedvEXT2(@GLenum int pname, @GLuint int index, @OutParameter @GLboolean ByteBuffer params);
 
@@ -809,6 +817,7 @@ public interface EXT_direct_state_access {
 	                                       @GLvoid
 	                                       ByteBuffer data);
 
+
 	@Dependent("OpenGL13")
 	void glGetCompressedMultiTexImageEXT(@GLenum int texunit, @GLenum int target, int level,
 	                                     @OutParameter
@@ -818,15 +827,6 @@ public interface EXT_direct_state_access {
 	                                     @GLshort
 	                                     @GLint Buffer img);
 
-	@Dependent("OpenGL13")
-	void glGetCompressedTexImage(@GLenum int target, int lod,
-	                             @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
@@ -905,7 +905,7 @@ public interface EXT_direct_state_access {
 	@Dependent("OpenGL15")
 	@CachedResult
 	@GLvoid
-	@AutoResultSize("GLChecks.getNamedBufferObjectSize(caps, buffer)")
+	@AutoSize("GLChecks.getNamedBufferObjectSize(caps, buffer)")
 	ByteBuffer glMapNamedBufferEXT(@GLuint int buffer, @GLenum int access);
 
 	@Dependent("OpenGL15")
@@ -923,7 +923,7 @@ public interface EXT_direct_state_access {
 
 	@Dependent("OpenGL15")
 	@StripPostfix("params")
-	@AutoResultSize("GLChecks.getNamedBufferObjectSize(caps, buffer)")
+	@AutoSize("GLChecks.getNamedBufferObjectSize(caps, buffer)")
 	void glGetNamedBufferPointervEXT(@GLuint int buffer, @GLenum int pname, @OutParameter @Result @GLvoid ByteBuffer params);
 
 	@Dependent("OpenGL15")
@@ -1075,7 +1075,7 @@ public interface EXT_direct_state_access {
 	@Alternate("glTextureParameterIivEXT")
 	@Dependent("GL_EXT_texture_integer")
 	@StripPostfix("param")
-	void glTextureParameterIivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtils.getBufferInt().put(0, param), 0", keepParam = true) int 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")
@@ -1084,7 +1084,7 @@ public interface EXT_direct_state_access {
 	@Alternate("glTextureParameterIuivEXT")
 	@Dependent("GL_EXT_texture_integer")
 	@StripPostfix("param")
-	void glTextureParameterIuivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtils.getBufferInt().put(0, param), 0", keepParam = true) @GLuint int 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")
@@ -1119,7 +1119,7 @@ public interface EXT_direct_state_access {
 	@Alternate("glMultiTexParameterIivEXT")
 	@Dependent("GL_EXT_texture_integer")
 	@StripPostfix("param")
-	void glMultiTexParameterIivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtils.getBufferInt().put(0, param), 0", keepParam = true) int 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")
@@ -1128,7 +1128,7 @@ public interface EXT_direct_state_access {
 	@Alternate("glMultiTexParameterIuivEXT")
 	@Dependent("GL_EXT_texture_integer")
 	@StripPostfix("param")
-	void glMultiTexParameterIuivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtils.getBufferInt().put(0, param), 0", keepParam = true) int 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")
@@ -1343,7 +1343,6 @@ public interface EXT_direct_state_access {
 	OpenGL 3.1: New buffer data copy command
 	 */
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL31,GL_ARB_copy_buffer")
 	void glNamedCopyBufferSubDataEXT(@GLuint int readBuffer, @GLuint int writeBuffer, @GLintptr long readoffset, @GLintptr long writeoffset, @GLsizeiptr long size);
 
@@ -1387,55 +1386,44 @@ public interface EXT_direct_state_access {
 	and change the final parameter from "const void *" to "intptr offset"
 	 */
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	@DeprecatedGL
 	void glVertexArrayVertexOffsetEXT(@GLuint int vaobj, @GLuint int buffer, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	@DeprecatedGL
 	void glVertexArrayColorOffsetEXT(@GLuint int vaobj, @GLuint int buffer, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	@DeprecatedGL
 	void glVertexArrayEdgeFlagOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLsizei int stride, @GLintptr long offset);
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	void glVertexArrayIndexOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	@DeprecatedGL
 	void glVertexArrayNormalOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	@DeprecatedGL
 	void glVertexArrayTexCoordOffsetEXT(@GLuint int vaobj, @GLuint int buffer, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@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);
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	@DeprecatedGL
 	void glVertexArrayFogCoordOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	@DeprecatedGL
 	void glVertexArraySecondaryColorOffsetEXT(@GLuint int vaobj, @GLuint int buffer, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@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);
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	void glVertexArrayVertexAttribIOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLuint int index, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
 
@@ -1445,11 +1433,9 @@ public interface EXT_direct_state_access {
 	"uint vaobj" parameter
 	 */
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	void glEnableVertexArrayEXT(@GLuint int vaobj, @GLenum int array);
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	void glDisableVertexArrayEXT(@GLuint int vaobj, @GLenum int array);
 
@@ -1459,11 +1445,9 @@ public interface EXT_direct_state_access {
 	and add an initial "uint vaobj" parameter
 	 */
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	void glEnableVertexArrayAttribEXT(@GLuint int vaobj, @GLuint int index);
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	void glDisableVertexArrayAttribEXT(@GLuint int vaobj, @GLuint int index);
 
@@ -1471,7 +1455,6 @@ public interface EXT_direct_state_access {
 	OpenGL 3.0: New queries for vertex array objects
 	 */
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	@StripPostfix("param")
 	void glGetVertexArrayIntegervEXT(@GLuint int vaobj, @GLenum int pname, @OutParameter @Check("16") IntBuffer param);
@@ -1482,12 +1465,10 @@ public interface EXT_direct_state_access {
 	@StripPostfix("param")
 	void glGetVertexArrayIntegervEXT2(@GLuint int vaobj, @GLenum int pname, @OutParameter IntBuffer param);
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	@StripPostfix("param")
 	void glGetVertexArrayPointervEXT(@GLuint int vaobj, @GLenum int pname, @Result @GLvoid ByteBuffer param);
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	@StripPostfix(value = "param")
 	void glGetVertexArrayIntegeri_vEXT(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @OutParameter @Check("16") IntBuffer param);
@@ -1498,7 +1479,6 @@ public interface EXT_direct_state_access {
 	@StripPostfix(value = "param", postfix = "_v")
 	void glGetVertexArrayIntegeri_vEXT2(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @OutParameter IntBuffer param);
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	@StripPostfix(value = "param")
 	void glGetVertexArrayPointeri_vEXT(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @Result @GLvoid ByteBuffer param);
@@ -1522,14 +1502,12 @@ public interface EXT_direct_state_access {
 	 *
 	 * @return A ByteBuffer representing the mapped buffer memory.
 	 */
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	@CachedResult(isRange = true)
 	@GLvoid
-	@AutoResultSize("length")
+	@AutoSize("length")
 	ByteBuffer glMapNamedBufferRangeEXT(@GLuint int buffer, @GLintptr long offset, @GLsizeiptr long length, @GLbitfield int access);
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.5)")
 	@Dependent("OpenGL30")
 	void glFlushMappedNamedBufferRangeEXT(@GLuint int buffer, @GLintptr long offset, @GLsizeiptr long length);
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_draw_buffers2.java b/src/templates/org/lwjgl/opengl/EXT_draw_buffers2.java
index 8794b91..3b396bb 100644
--- a/src/templates/org/lwjgl/opengl/EXT_draw_buffers2.java
+++ b/src/templates/org/lwjgl/opengl/EXT_draw_buffers2.java
@@ -32,6 +32,11 @@
 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;
diff --git a/src/templates/org/lwjgl/opengl/EXT_draw_instanced.java b/src/templates/org/lwjgl/opengl/EXT_draw_instanced.java
index 5baa846..d114498 100644
--- a/src/templates/org/lwjgl/opengl/EXT_draw_instanced.java
+++ b/src/templates/org/lwjgl/opengl/EXT_draw_instanced.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.Buffer;
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_draw_range_elements.java b/src/templates/org/lwjgl/opengl/EXT_draw_range_elements.java
index f576009..a991427 100644
--- a/src/templates/org/lwjgl/opengl/EXT_draw_range_elements.java
+++ b/src/templates/org/lwjgl/opengl/EXT_draw_range_elements.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_fog_coord.java b/src/templates/org/lwjgl/opengl/EXT_fog_coord.java
index 331a327..0db7d2d 100644
--- a/src/templates/org/lwjgl/opengl/EXT_fog_coord.java
+++ b/src/templates/org/lwjgl/opengl/EXT_fog_coord.java
@@ -32,6 +32,10 @@
 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.*;
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_framebuffer_blit.java b/src/templates/org/lwjgl/opengl/EXT_framebuffer_blit.java
index 203efd8..b13ee0f 100644
--- a/src/templates/org/lwjgl/opengl/EXT_framebuffer_blit.java
+++ b/src/templates/org/lwjgl/opengl/EXT_framebuffer_blit.java
@@ -31,7 +31,9 @@
  */
 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.GLint;
 
 public interface EXT_framebuffer_blit {
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_framebuffer_multisample.java b/src/templates/org/lwjgl/opengl/EXT_framebuffer_multisample.java
index 6271412..9f75aa5 100644
--- a/src/templates/org/lwjgl/opengl/EXT_framebuffer_multisample.java
+++ b/src/templates/org/lwjgl/opengl/EXT_framebuffer_multisample.java
@@ -31,8 +31,8 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
-import org.lwjgl.util.generator.GLsizei;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLsizei;
 
 public interface EXT_framebuffer_multisample {
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java b/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java
index cc9c98c..a7bd122 100644
--- a/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java
+++ b/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java
@@ -32,6 +32,11 @@
 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;
 
@@ -131,7 +136,7 @@ public interface EXT_framebuffer_object {
 	void glDeleteRenderbuffersEXT(@AutoSize("renderbuffers") int n, @Const @GLuint IntBuffer renderbuffers);
 
 	@Alternate("glDeleteRenderbuffersEXT")
-	void glDeleteRenderbuffersEXT(@Constant("1") int n, @Constant(value = "APIUtils.getBufferInt().put(0, renderbuffer), 0", keepParam = true) int renderbuffer);
+	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);
 
@@ -156,7 +161,7 @@ public interface EXT_framebuffer_object {
 	void glDeleteFramebuffersEXT(@AutoSize("framebuffers") int n, @Const @GLuint IntBuffer framebuffers);
 
 	@Alternate("glDeleteFramebuffersEXT")
-	void glDeleteFramebuffersEXT(@Constant("1") int n, @Constant(value = "APIUtils.getBufferInt().put(0, framebuffer), 0", keepParam = true) int framebuffer);
+	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);
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_geometry_shader4.java b/src/templates/org/lwjgl/opengl/EXT_geometry_shader4.java
index 5745ca0..5c9639c 100644
--- a/src/templates/org/lwjgl/opengl/EXT_geometry_shader4.java
+++ b/src/templates/org/lwjgl/opengl/EXT_geometry_shader4.java
@@ -31,8 +31,8 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
-import org.lwjgl.util.generator.GLuint;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLuint;
 
 public interface EXT_geometry_shader4 {
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_gpu_program_parameters.java b/src/templates/org/lwjgl/opengl/EXT_gpu_program_parameters.java
index 3cde1bf..24ff9b5 100644
--- a/src/templates/org/lwjgl/opengl/EXT_gpu_program_parameters.java
+++ b/src/templates/org/lwjgl/opengl/EXT_gpu_program_parameters.java
@@ -32,6 +32,9 @@
 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.*;
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_gpu_shader4.java b/src/templates/org/lwjgl/opengl/EXT_gpu_shader4.java
index 283903f..c4608ed 100644
--- a/src/templates/org/lwjgl/opengl/EXT_gpu_shader4.java
+++ b/src/templates/org/lwjgl/opengl/EXT_gpu_shader4.java
@@ -32,6 +32,8 @@
 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;
diff --git a/src/templates/org/lwjgl/opengl/EXT_multi_draw_arrays.java b/src/templates/org/lwjgl/opengl/EXT_multi_draw_arrays.java
index 1437cf8..3f86993 100644
--- a/src/templates/org/lwjgl/opengl/EXT_multi_draw_arrays.java
+++ b/src/templates/org/lwjgl/opengl/EXT_multi_draw_arrays.java
@@ -32,6 +32,8 @@
 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.*;
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_paletted_texture.java b/src/templates/org/lwjgl/opengl/EXT_paletted_texture.java
index 1997a08..b0c8832 100644
--- a/src/templates/org/lwjgl/opengl/EXT_paletted_texture.java
+++ b/src/templates/org/lwjgl/opengl/EXT_paletted_texture.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_point_parameters.java b/src/templates/org/lwjgl/opengl/EXT_point_parameters.java
index 61c9438..5580987 100644
--- a/src/templates/org/lwjgl/opengl/EXT_point_parameters.java
+++ b/src/templates/org/lwjgl/opengl/EXT_point_parameters.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLenum;
 
 import java.nio.*;
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_provoking_vertex.java b/src/templates/org/lwjgl/opengl/EXT_provoking_vertex.java
index 077ac9f..d13bda3 100644
--- a/src/templates/org/lwjgl/opengl/EXT_provoking_vertex.java
+++ b/src/templates/org/lwjgl/opengl/EXT_provoking_vertex.java
@@ -31,7 +31,7 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
+import org.lwjgl.util.generator.opengl.GLenum;
 
 public interface EXT_provoking_vertex {
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_secondary_color.java b/src/templates/org/lwjgl/opengl/EXT_secondary_color.java
index 10e55e4..63fba71 100644
--- a/src/templates/org/lwjgl/opengl/EXT_secondary_color.java
+++ b/src/templates/org/lwjgl/opengl/EXT_secondary_color.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.Buffer;
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_separate_shader_objects.java b/src/templates/org/lwjgl/opengl/EXT_separate_shader_objects.java
index 7710156..002ca2e 100644
--- a/src/templates/org/lwjgl/opengl/EXT_separate_shader_objects.java
+++ b/src/templates/org/lwjgl/opengl/EXT_separate_shader_objects.java
@@ -32,6 +32,10 @@
 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;
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_shader_image_load_store.java b/src/templates/org/lwjgl/opengl/EXT_shader_image_load_store.java
index 02093bb..b1bfd3b 100644
--- a/src/templates/org/lwjgl/opengl/EXT_shader_image_load_store.java
+++ b/src/templates/org/lwjgl/opengl/EXT_shader_image_load_store.java
@@ -31,9 +31,9 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLbitfield;
-import org.lwjgl.util.generator.GLenum;
-import org.lwjgl.util.generator.GLuint;
+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 {
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_stencil_clear_tag.java b/src/templates/org/lwjgl/opengl/EXT_stencil_clear_tag.java
index 166e985..26bf12f 100644
--- a/src/templates/org/lwjgl/opengl/EXT_stencil_clear_tag.java
+++ b/src/templates/org/lwjgl/opengl/EXT_stencil_clear_tag.java
@@ -31,7 +31,8 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLsizei;
+import org.lwjgl.util.generator.opengl.GLuint;
 
 public interface EXT_stencil_clear_tag {
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_stencil_two_side.java b/src/templates/org/lwjgl/opengl/EXT_stencil_two_side.java
index ec04da2..bb74b73 100644
--- a/src/templates/org/lwjgl/opengl/EXT_stencil_two_side.java
+++ b/src/templates/org/lwjgl/opengl/EXT_stencil_two_side.java
@@ -31,7 +31,7 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLenum;
 
 public interface EXT_stencil_two_side {
 	int GL_STENCIL_TEST_TWO_SIDE_EXT = 0x8910;
diff --git a/src/templates/org/lwjgl/opengl/EXT_texture_array.java b/src/templates/org/lwjgl/opengl/EXT_texture_array.java
index b9eed41..1ba0ae3 100644
--- a/src/templates/org/lwjgl/opengl/EXT_texture_array.java
+++ b/src/templates/org/lwjgl/opengl/EXT_texture_array.java
@@ -31,8 +31,9 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
-import org.lwjgl.util.generator.GLuint;
+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 {
 
@@ -83,6 +84,7 @@ public interface EXT_texture_array {
 	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);
 
 }
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/EXT_texture_buffer_object.java b/src/templates/org/lwjgl/opengl/EXT_texture_buffer_object.java
index 1601fc2..597ddf5 100644
--- a/src/templates/org/lwjgl/opengl/EXT_texture_buffer_object.java
+++ b/src/templates/org/lwjgl/opengl/EXT_texture_buffer_object.java
@@ -31,8 +31,8 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
-import org.lwjgl.util.generator.GLuint;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLuint;
 
 public interface EXT_texture_buffer_object {
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_texture_integer.java b/src/templates/org/lwjgl/opengl/EXT_texture_integer.java
index 46bf003..520b40d 100644
--- a/src/templates/org/lwjgl/opengl/EXT_texture_integer.java
+++ b/src/templates/org/lwjgl/opengl/EXT_texture_integer.java
@@ -32,6 +32,10 @@
 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;
 
@@ -114,14 +118,14 @@ public interface EXT_texture_integer {
 
 	@Alternate("glTexParameterIivEXT")
 	@StripPostfix(value = "param", postfix = "v")
-	void glTexParameterIivEXT(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtils.getBufferInt().put(0, param), 0", keepParam = true) int param);
+	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 = "APIUtils.getBufferInt().put(0, param), 0", keepParam = true) int param);
+	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);
diff --git a/src/templates/org/lwjgl/opengl/EXT_texture_sRGB_decode.java b/src/templates/org/lwjgl/opengl/EXT_texture_sRGB_decode.java
new file mode 100644
index 0000000..a0e3e55
--- /dev/null
+++ b/src/templates/org/lwjgl/opengl/EXT_texture_sRGB_decode.java
@@ -0,0 +1,53 @@
+/*
+ * 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 &lt;pname&gt; 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 &lt;enum&gt; parameter of TexParameterf, TexParameteri,
+	 * SamplerParameteri, SamplerParameterf, SamplerParameteriv, SamplerParameterfv,
+	 * SamplerParameterIiv and SamplerParameterIuiv:
+	 */
+	int GL_DECODE_EXT = 0x8A49,
+		GL_SKIP_DECODE_EXT = 0x8A4A;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/EXT_timer_query.java b/src/templates/org/lwjgl/opengl/EXT_timer_query.java
index 87e9d3d..3f80c1c 100644
--- a/src/templates/org/lwjgl/opengl/EXT_timer_query.java
+++ b/src/templates/org/lwjgl/opengl/EXT_timer_query.java
@@ -32,6 +32,8 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.Alternate;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java b/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java
index 66cdc3f..204adae 100644
--- a/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java
+++ b/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java
@@ -32,6 +32,8 @@
 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;
@@ -102,12 +104,12 @@ public interface EXT_transform_feedback {
 	void glEndTransformFeedbackEXT();
 
 	void glTransformFeedbackVaryingsEXT(@GLuint int program, @GLsizei int count,
-	                                    @Const @NullTerminated("count") @GLchar @StringList("count") ByteBuffer varyings,
+	                                    @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 @StringList("count") CharSequence[] varyings,
+	                                    @Const @NullTerminated @PointerArray("count") CharSequence[] varyings,
 	                                    @GLenum int bufferMode);
 
 	void glGetTransformFeedbackVaryingEXT(@GLuint int program, @GLuint int index, @AutoSize("name") @GLsizei int bufSize,
diff --git a/src/templates/org/lwjgl/opengl/EXT_vertex_attrib_64bit.java b/src/templates/org/lwjgl/opengl/EXT_vertex_attrib_64bit.java
index 2794a93..4275509 100644
--- a/src/templates/org/lwjgl/opengl/EXT_vertex_attrib_64bit.java
+++ b/src/templates/org/lwjgl/opengl/EXT_vertex_attrib_64bit.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.Buffer;
 import java.nio.DoubleBuffer;
@@ -81,6 +82,7 @@ public interface EXT_vertex_attrib_64bit {
 	@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);
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_vertex_shader.java b/src/templates/org/lwjgl/opengl/EXT_vertex_shader.java
index 553df9f..b8a4e53 100644
--- a/src/templates/org/lwjgl/opengl/EXT_vertex_shader.java
+++ b/src/templates/org/lwjgl/opengl/EXT_vertex_shader.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
diff --git a/src/templates/org/lwjgl/opengl/EXT_vertex_weighting.java b/src/templates/org/lwjgl/opengl/EXT_vertex_weighting.java
index 3788e78..321e371 100644
--- a/src/templates/org/lwjgl/opengl/EXT_vertex_weighting.java
+++ b/src/templates/org/lwjgl/opengl/EXT_vertex_weighting.java
@@ -32,6 +32,9 @@
 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.*;
 
diff --git a/src/templates/org/lwjgl/opengl/GL11.java b/src/templates/org/lwjgl/opengl/GL11.java
index f648caa..77eefab 100644
--- a/src/templates/org/lwjgl/opengl/GL11.java
+++ b/src/templates/org/lwjgl/opengl/GL11.java
@@ -32,6 +32,8 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.Alternate;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
@@ -39,8 +41,8 @@ import java.nio.*;
  * The core OpenGL1.1 API.
  *
  * @author cix_foo <cix_foo at users.sourceforge.net>
- * @version $Revision: 3338 $
- *          $Id: GL11.java 3338 2010-05-01 09:19:00Z spasi $
+ * @version $Revision: 3460 $
+ *          $Id: GL11.java 3460 2010-11-29 18:25:28Z spasi $
  */
 @DeprecatedGL
 public interface GL11 {
@@ -782,7 +784,7 @@ public interface GL11 {
 	void glDeleteTextures(@AutoSize("textures") @GLsizei int n, @Const @GLuint IntBuffer textures);
 
 	@Alternate("glDeleteTextures")
-	void glDeleteTextures(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, texture), 0", keepParam = true) int texture);
+	void glDeleteTextures(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, texture), 0", keepParam = true) int texture);
 
 	void glCullFace(@GLenum int mode);
 
@@ -1563,7 +1565,7 @@ public interface GL11 {
 
 	@DeprecatedGL
 	void glTexCoordPointer(int size, @AutoType("pointer") @GLenum int type, @GLsizei int stride,
-	                       @CachedReference(index = "GLChecks.getReferences(caps).glClientActiveTexture", name = "glTexCoordPointer_buffer")
+	                       @CachedReference(index = "StateTracker.getReferences(caps).glClientActiveTexture", name = "glTexCoordPointer_buffer")
 	                       @BufferObject(BufferKind.ArrayVBO)
 	                       @Check
 	                       @Const
diff --git a/src/templates/org/lwjgl/opengl/GL12.java b/src/templates/org/lwjgl/opengl/GL12.java
index 7da3a78..8241d74 100644
--- a/src/templates/org/lwjgl/opengl/GL12.java
+++ b/src/templates/org/lwjgl/opengl/GL12.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.Buffer;
 
@@ -40,8 +41,8 @@ import java.nio.Buffer;
  * The core OpenGL1.2.1 API, with the imaging subset.
  *
  * @author cix_foo <cix_foo at users.sourceforge.net>
- * @version $Revision: 2984 $
- *          $Id: GL12.java 2984 2008-04-07 18:39:53Z matzon $
+ * @version $Revision: 3412 $
+ *          $Id: GL12.java 3412 2010-09-26 23:43:24Z spasi $
  */
 
 public interface GL12 {
diff --git a/src/templates/org/lwjgl/opengl/GL13.java b/src/templates/org/lwjgl/opengl/GL13.java
index 2049c23..ed836d7 100644
--- a/src/templates/org/lwjgl/opengl/GL13.java
+++ b/src/templates/org/lwjgl/opengl/GL13.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
@@ -40,8 +41,8 @@ import java.nio.*;
  * The core OpenGL1.3 API.
  *
  * @author cix_foo <cix_foo at users.sourceforge.net>
- * @version $Revision: 3116 $
- * $Id: GL13.java 3116 2008-08-19 16:46:03Z spasi $
+ * @version $Revision: 3460 $
+ * $Id: GL13.java 3460 2010-11-29 18:25:28Z spasi $
  */
 @DeprecatedGL
 public interface GL13 {
@@ -149,7 +150,7 @@ public interface GL13 {
 
 	void glActiveTexture(@GLenum int texture);
 
-    @Code("\t\tGLChecks.getReferences(caps).glClientActiveTexture = texture - GL_TEXTURE0;")
+    @Code("\t\tStateTracker.getReferences(caps).glClientActiveTexture = texture - GL_TEXTURE0;")
     @DeprecatedGL
 	void glClientActiveTexture(@GLenum int texture);
 
diff --git a/src/templates/org/lwjgl/opengl/GL14.java b/src/templates/org/lwjgl/opengl/GL14.java
index 7681c93..63904df 100644
--- a/src/templates/org/lwjgl/opengl/GL14.java
+++ b/src/templates/org/lwjgl/opengl/GL14.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
@@ -40,8 +41,8 @@ import java.nio.*;
  * The core OpenGL1.4 API.
  *
  * @author cix_foo <cix_foo at users.sourceforge.net>
- * @version $Revision: 3287 $
- * $Id: GL14.java 3287 2010-03-14 23:24:40Z spasi $
+ * @version $Revision: 3460 $
+ * $Id: GL14.java 3460 2010-11-29 18:25:28Z spasi $
  */
 @DeprecatedGL
 public interface GL14 {
diff --git a/src/templates/org/lwjgl/opengl/GL15.java b/src/templates/org/lwjgl/opengl/GL15.java
index bc9adf0..a45f6b3 100644
--- a/src/templates/org/lwjgl/opengl/GL15.java
+++ b/src/templates/org/lwjgl/opengl/GL15.java
@@ -32,6 +32,8 @@
 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;
@@ -95,7 +97,7 @@ public interface GL15 {
 	void glDeleteBuffers(@AutoSize("buffers") @GLsizei int n, @Const @GLuint IntBuffer buffers);
 
 	@Alternate("glDeleteBuffers")
-	void glDeleteBuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
+	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);
 
@@ -156,7 +158,7 @@ public interface GL15 {
 	 */
 	@CachedResult
 	@GLvoid
-	@AutoResultSize("GLChecks.getBufferObjectSize(caps, target)")
+	@AutoSize("GLChecks.getBufferObjectSize(caps, target)")
 	ByteBuffer glMapBuffer(@GLenum int target, @GLenum int access);
 
 	boolean glUnmapBuffer(@GLenum int target);
@@ -170,7 +172,7 @@ public interface GL15 {
 	void glGetBufferParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params);
 
 	@StripPostfix("pointer")
-	@AutoResultSize("GLChecks.getBufferObjectSize(caps, target)")
+	@AutoSize("GLChecks.getBufferObjectSize(caps, target)")
 	void glGetBufferPointerv(@GLenum int target, @GLenum int pname, @OutParameter @Result @GLvoid ByteBuffer pointer);
 
 	// -----------------------------------------------------------------
@@ -203,7 +205,7 @@ public interface GL15 {
 	void glDeleteQueries(@AutoSize("ids") @GLsizei int n, @GLuint IntBuffer ids);
 
 	@Alternate("glDeleteQueries")
-	void glDeleteQueries(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, id), 0", keepParam = true) int id);
+	void glDeleteQueries(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, id), 0", keepParam = true) int id);
 
 	boolean glIsQuery(@GLuint int id);
 
diff --git a/src/templates/org/lwjgl/opengl/GL20.java b/src/templates/org/lwjgl/opengl/GL20.java
index f94129c..67c4815 100644
--- a/src/templates/org/lwjgl/opengl/GL20.java
+++ b/src/templates/org/lwjgl/opengl/GL20.java
@@ -32,6 +32,8 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.Alternate;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
@@ -105,8 +107,8 @@ public interface GL20 {
 
 	@Alternate(value = "glShaderSource", nativeAlt = true)
 	void glShaderSource3(@GLuint int shader, @Constant("strings.length") @GLsizei int count,
-	                     @Const @StringList(value = "count", lengths = "length") CharSequence[] strings,
-	                     @Constant("APIUtils.getLengths(strings), 0") @Const IntBuffer length);
+	                     @Const @PointerArray(value = "count", lengths = "length") CharSequence[] strings,
+	                     @Constant("APIUtil.getLengths(strings), 0") @Const IntBuffer length);
 
 	int glCreateShader(@GLuint int type);
 
@@ -255,7 +257,7 @@ public interface GL20 {
 	@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, APIUtils.getBufferInt(), 0, APIUtils.getBufferInt(), 1") IntBuffer length,
+	                        @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. */
@@ -265,7 +267,7 @@ public interface GL20 {
 	                            @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("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+	                            @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
 
 	/** Overloads glGetActiveUniform. This version returns only the uniform type. */
 	@Alternate(value = "glGetActiveUniform", javaAlt = true)
@@ -274,7 +276,7 @@ public interface GL20 {
 	                            @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("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+	                            @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
 
 	@StripPostfix("params")
 	void glGetUniformfv(@GLuint int program, int location, @OutParameter @Check FloatBuffer params);
@@ -430,7 +432,7 @@ public interface GL20 {
 	@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, APIUtils.getBufferInt(), 0, APIUtils.getBufferInt(), 1") IntBuffer length,
+	                       @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. */
@@ -440,7 +442,7 @@ public interface GL20 {
 	                           @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("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+	                           @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
 
 	/** Overloads glGetActiveAttrib. This version returns only the attrib type. */
 	@Alternate(value = "glGetActiveAttrib", javaAlt = true)
@@ -449,7 +451,7 @@ public interface GL20 {
 	                           @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("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+	                           @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
 
 	int glGetAttribLocation(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name);
 
@@ -507,7 +509,7 @@ public interface GL20 {
 	void glDrawBuffers(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers);
 
 	@Alternate("glDrawBuffers")
-	void glDrawBuffers(@Constant("1") @GLsizei int size, @Constant(value = "APIUtils.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
+	void glDrawBuffers(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
 
 	// ----------------------------------------------------------------
 	// ----------------------[ ARB_point_sprite ]----------------------
diff --git a/src/templates/org/lwjgl/opengl/GL21.java b/src/templates/org/lwjgl/opengl/GL21.java
index aea6179..45666fb 100644
--- a/src/templates/org/lwjgl/opengl/GL21.java
+++ b/src/templates/org/lwjgl/opengl/GL21.java
@@ -32,7 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.AutoSize;
-import org.lwjgl.util.generator.GLsizei;
+import org.lwjgl.util.generator.opengl.GLsizei;
 import org.lwjgl.util.generator.StripPostfix;
 
 import java.nio.FloatBuffer;
diff --git a/src/templates/org/lwjgl/opengl/GL30.java b/src/templates/org/lwjgl/opengl/GL30.java
index f75bd1e..8438dc5 100644
--- a/src/templates/org/lwjgl/opengl/GL30.java
+++ b/src/templates/org/lwjgl/opengl/GL30.java
@@ -32,6 +32,8 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.Alternate;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
@@ -294,7 +296,7 @@ public interface GL30 {
 	 */
 	@CachedResult(isRange = true)
 	@GLvoid
-	@AutoResultSize("length")
+	@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);
@@ -412,15 +414,18 @@ public interface GL30 {
 	int GL_TEXTURE_SHARED_SIZE = 0x8C3F;
 
 	// ----------------------------------------------------------------------
-	// ----------------------[ EXT_framebuffer_object ]----------------------
+	// ----------------------[ ARB_framebuffer_object ]----------------------
 	// ----------------------------------------------------------------------
 
 	/**
 	 * Accepted by the &lt;target&gt; parameter of BindFramebuffer,
-	 * CheckFramebufferStatus, FramebufferTexture{1D|2D|3D}, and
-	 * FramebufferRenderbuffer:
+	 * 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 &lt;target&gt; parameter of BindRenderbuffer,
@@ -457,7 +462,18 @@ public interface GL30 {
 	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_3D_ZOFFSET = 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 &lt;params&gt; by GetFramebufferAttachmentParameteriv: */
+	int GL_FRAMEBUFFER_DEFAULT = 0x8218;
+	int GL_INDEX = 0x8222;
 
 	/**
 	 * Accepted by the &lt;attachment&gt; parameter of
@@ -482,19 +498,22 @@ public interface GL30 {
 	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_DIMENSIONS = 0x8CD9;
-	int GL_FRAMEBUFFER_INCOMPLETE_FORMATS = 0x8CDA;
 	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 GetIntegerv(): */
-	int GL_FRAMEBUFFER_BINDING = 0x8CA6;
+	/**
+	 * Accepted by the &lt;pname&gt; 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;
@@ -509,7 +528,7 @@ public interface GL30 {
 	void glDeleteRenderbuffers(@AutoSize("renderbuffers") int n, @Const @GLuint IntBuffer renderbuffers);
 
 	@Alternate("glDeleteRenderbuffers")
-	void glDeleteRenderbuffers(@Constant("1") int n, @Constant(value = "APIUtils.getBufferInt().put(0, renderbuffer), 0", keepParam = true) int renderbuffer);
+	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);
 
@@ -534,7 +553,7 @@ public interface GL30 {
 	void glDeleteFramebuffers(@AutoSize("framebuffers") int n, @Const @GLuint IntBuffer framebuffers);
 
 	@Alternate("glDeleteFramebuffers")
-	void glDeleteFramebuffers(@Constant("1") int n, @Constant(value = "APIUtils.getBufferInt().put(0, framebuffer), 0", keepParam = true) int framebuffer);
+	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);
 
@@ -610,15 +629,6 @@ public interface GL30 {
 	// ----------------------[ EXT_framebuffer_blit ]----------------------
 	// --------------------------------------------------------------------
 
-	/**
-	 * Accepted by the &lt;target&gt; parameter of BindFramebuffer,
-	 * CheckFramebufferStatus, FramebufferTexture{1D|2D|3D},
-	 * FramebufferRenderbuffer, and
-	 * GetFramebufferAttachmentParameteriv.
-	 */
-	int GL_READ_FRAMEBUFFER = 0x8CA8;
-	int GL_DRAW_FRAMEBUFFER = 0x8CA9;
-
 	/** Accepted by the &lt;pname&gt; parameters of GetIntegerv, GetFloatv, and GetDoublev. */
 	int GL_DRAW_FRAMEBUFFER_BINDING = 0x8CA6; // alias FRAMEBUFFER_BINDING
 	int GL_READ_FRAMEBUFFER_BINDING = 0x8CAA;
@@ -702,14 +712,14 @@ public interface GL30 {
 
 	@Alternate("glTexParameterIiv")
 	@StripPostfix(value = "param", postfix = "v")
-	void glTexParameterIiv(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtils.getBufferInt().put(0, param), 0", keepParam = true) int param);
+	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 = "APIUtils.getBufferInt().put(0, param), 0", keepParam = true) int param);
+	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);
@@ -969,12 +979,12 @@ public interface GL30 {
 	void glEndTransformFeedback();
 
 	void glTransformFeedbackVaryings(@GLuint int program, @GLsizei int count,
-	                                 @Const @NullTerminated("count") @GLchar @StringList("count") ByteBuffer varyings,
+	                                 @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 @StringList("count") CharSequence[] varyings,
+	                                 @Const @NullTerminated @PointerArray("count") CharSequence[] varyings,
 	                                 @GLenum int bufferMode);
 
 	void glGetTransformFeedbackVarying(@GLuint int program, @GLuint int index, @AutoSize("name") @GLsizei int bufSize,
@@ -1001,12 +1011,15 @@ public interface GL30 {
 	 */
 	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")
-	void glDeleteVertexArrays(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, array), 0", keepParam = true) int array);
+	@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);
 
diff --git a/src/templates/org/lwjgl/opengl/GL31.java b/src/templates/org/lwjgl/opengl/GL31.java
index e38cc25..1e45300 100644
--- a/src/templates/org/lwjgl/opengl/GL31.java
+++ b/src/templates/org/lwjgl/opengl/GL31.java
@@ -32,6 +32,8 @@
 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;
@@ -232,12 +234,12 @@ public interface GL31 {
 	int GL_INVALID_INDEX = 0xFFFFFFFF;
 
 	void glGetUniformIndices(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount,
-	                         @Const @NullTerminated("uniformIndices.remaining()") @GLchar @StringList("uniformCount") ByteBuffer uniformNames,
+	                         @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 @StringList("uniformCount") CharSequence[] uniformNames,
+	                         @Const @NullTerminated @PointerArray("uniformCount") CharSequence[] uniformNames,
 	                         @OutParameter @Check("uniformNames.length") @GLuint IntBuffer uniformIndices);
 
 	@StripPostfix("params")
diff --git a/src/templates/org/lwjgl/opengl/GL32.java b/src/templates/org/lwjgl/opengl/GL32.java
index ce2085e..46d999e 100644
--- a/src/templates/org/lwjgl/opengl/GL32.java
+++ b/src/templates/org/lwjgl/opengl/GL32.java
@@ -32,6 +32,9 @@
 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;
@@ -259,8 +262,6 @@ public interface GL32 {
 
 	void glFramebufferTexture(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level);
 
-	void glFramebufferTextureLayer(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, int layer);
-
 	// --------------------------------------------------------
 	// ----------------------[ ARB_sync ]----------------------
 	// --------------------------------------------------------
@@ -296,44 +297,44 @@ public interface GL32 {
 	int GL_CONDITION_SATISFIED = 0x911C;
 	int GL_WAIT_FAILED = 0x911D;
 
-	@GLpointer("GLsync")
+	@PointerWrapper("GLsync")
 	GLSync glFenceSync(@GLenum int condition, @GLbitfield int flags);
 
-	boolean glIsSync(@GLpointer("GLsync") GLSync sync);
+	boolean glIsSync(@PointerWrapper("GLsync") GLSync sync);
 
-	void glDeleteSync(@GLpointer("GLsync") GLSync sync);
+	void glDeleteSync(@PointerWrapper("GLsync") GLSync sync);
 
 	@GLenum
-	int glClientWaitSync(@GLpointer("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
+	int glClientWaitSync(@PointerWrapper("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
 
-	void glWaitSync(@GLpointer("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
+	void glWaitSync(@PointerWrapper("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
 
-	@StripPostfix(value = "data", postfix = "64")
+	@StripPostfix("data")
 	void glGetInteger64v(@GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer data);
 
 	@Alternate("glGetInteger64v")
 	@GLreturn("data")
-	@StripPostfix(value = "data", postfix = "64")
+	@StripPostfix("data")
 	void glGetInteger64v2(@GLenum int pname, @OutParameter @GLint64 LongBuffer data);
 
-	@StripPostfix(value = "data", postfix = "64")
+	@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(value = "data", postfix = "64")
+	@StripPostfix("data")
 	void glGetInteger64i_v2(@GLenum int value, @GLuint int index, @OutParameter @GLint64 LongBuffer data);
 
 	@StripPostfix("values")
-	void glGetSynciv(@GLpointer("GLsync") GLSync sync, @GLenum int pname, @AutoSize("values") @GLsizei int bufSize,
+	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(@GLpointer("GLsync") GLSync sync, @GLenum int pname, @Constant("1") @GLsizei int bufSize,
+	void glGetSynciv2(@PointerWrapper("GLsync") GLSync sync, @GLenum int pname, @Constant("1") @GLsizei int bufSize,
 	                  @OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
 	                  @OutParameter IntBuffer values);
 }
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/GL33.java b/src/templates/org/lwjgl/opengl/GL33.java
index 64d1879..6d80f08 100644
--- a/src/templates/org/lwjgl/opengl/GL33.java
+++ b/src/templates/org/lwjgl/opengl/GL33.java
@@ -32,6 +32,8 @@
 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;
@@ -100,7 +102,7 @@ public interface GL33 {
 	void glDeleteSamplers(@AutoSize("samplers") @GLsizei int count, @Const @GLuint IntBuffer samplers);
 
 	@Alternate("glDeleteSamplers")
-	void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtils.getBufferInt().put(0, sampler), 0", keepParam = true) int sampler);
+	void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtil.getBufferInt().put(0, sampler), 0", keepParam = true) int sampler);
 
 	boolean glIsSampler(@GLuint int sampler);
 
diff --git a/src/templates/org/lwjgl/opengl/GL40.java b/src/templates/org/lwjgl/opengl/GL40.java
index 4c455e1..6c4f304 100644
--- a/src/templates/org/lwjgl/opengl/GL40.java
+++ b/src/templates/org/lwjgl/opengl/GL40.java
@@ -32,6 +32,8 @@
 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;
@@ -46,16 +48,12 @@ public interface GL40 {
 	// ----------------------[ ARB_draw_buffers_blend ]----------------------
 	// ----------------------------------------------------------------------
 
-	@Optional(reason = "AMD's 4.0 implementation does not expose this (last driver checked: 10.3)")
 	void glBlendEquationi(@GLuint int buf, @GLenum int mode);
 
-	@Optional(reason = "AMD's 4.0 implementation does not expose this (last driver checked: 10.3)")
 	void glBlendEquationSeparatei(@GLuint int buf, @GLenum int modeRGB, @GLenum int modeAlpha);
 
-	@Optional(reason = "AMD's 4.0 implementation does not expose this (last driver checked: 10.3)")
 	void glBlendFunci(@GLuint int buf, @GLenum int src, @GLenum int dst);
 
-	@Optional(reason = "AMD's 4.0 implementation does not expose this (last driver checked: 10.3)")
 	void glBlendFuncSeparatei(@GLuint int buf, @GLenum int srcRGB, @GLenum int dstRGB, @GLenum int srcAlpha, @GLenum int dstAlpha);
 
 	// -----------------------------------------------------------------
@@ -186,7 +184,7 @@ public interface GL40 {
 	 */
 	int GL_MIN_SAMPLE_SHADING_VALUE = 0x8C37;
 
-	@Optional(reason = "AMD's 4.0 implementation does not expose this (last driver checked: 10.3)")
+	@Optional(reason = "AMD does not expose this (last driver checked: 10.9)")
 	void glMinSampleShading(@GLclampf float value);
 
 	// ---------------------------------------------------------------------
@@ -406,7 +404,7 @@ public interface GL40 {
 	void glDeleteTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @Const @GLuint IntBuffer ids);
 
 	@Alternate("glDeleteTransformFeedbacks")
-	void glDeleteTransformFeedbacks(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, id), 0", keepParam = true) int id);
+	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);
 
diff --git a/src/templates/org/lwjgl/opengl/GL41.java b/src/templates/org/lwjgl/opengl/GL41.java
new file mode 100644
index 0000000..97e0036
--- /dev/null
+++ b/src/templates/org/lwjgl/opengl/GL41.java
@@ -0,0 +1,473 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) 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 &lt;value&gt; 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 &lt;type&gt; parameter of VertexAttribPointer: */
+	int GL_FIXED = 0x140C;
+
+	/**
+	 * Accepted by the &lt;precisiontype&gt; 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 &lt;pname&gt; parameter of ProgramParameteri and
+	 * GetProgramiv:
+	 */
+	int GL_PROGRAM_BINARY_RETRIEVABLE_HINT = 0x8257;
+
+	/** Accepted by the &lt;pname&gt; parameter of GetProgramiv: */
+	int GL_PROGRAM_BINARY_LENGTH = 0x8741;
+
+	/**
+	 * Accepted by the &lt;pname&gt; 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 &lt;stages&gt; 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 &lt;pname&gt; parameter of ProgramParameteri and
+	 * GetProgramiv:
+	 */
+	int GL_PROGRAM_SEPARABLE = 0x8258;
+
+	/** Accepted by &lt;type&gt; parameter to GetProgramPipelineiv: */
+	int GL_ACTIVE_PROGRAM = 0x8259;
+
+	/**
+	 * Accepted by the &lt;pname&gt; 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 &lt;type&gt; 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 &lt;pname&gt; 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 &lt;pname&gt; parameter of GetIntegeri_v: */
+	int GL_SCISSOR_BOX = 0x0C10;
+
+	/** Accepted by the &lt;pname&gt; parameter of GetFloati_v: */
+	int GL_VIEWPORT = 0x0BA2;
+
+	/** Accepted by the &lt;pname&gt; parameter of GetDoublei_v: */
+	int GL_DEPTH_RANGE = 0x0B70;
+
+	/** Accepted by the &lt;pname&gt; parameter of Enablei, Disablei, and IsEnabledi: */
+	int GL_SCISSOR_TEST = 0x0C11;
+
+	/**
+	 * Returned in the &lt;data&gt; parameter from a Get query with a &lt;pname&gt; 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);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/GREMEDY_string_marker.java b/src/templates/org/lwjgl/opengl/GREMEDY_string_marker.java
index 465ba27..fda1698 100644
--- a/src/templates/org/lwjgl/opengl/GREMEDY_string_marker.java
+++ b/src/templates/org/lwjgl/opengl/GREMEDY_string_marker.java
@@ -32,6 +32,8 @@
 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;
 
diff --git a/src/templates/org/lwjgl/opengl/NV_conditional_render.java b/src/templates/org/lwjgl/opengl/NV_conditional_render.java
index 4dbc6aa..01178f3 100644
--- a/src/templates/org/lwjgl/opengl/NV_conditional_render.java
+++ b/src/templates/org/lwjgl/opengl/NV_conditional_render.java
@@ -31,8 +31,8 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
-import org.lwjgl.util.generator.GLuint;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLuint;
 
 public interface NV_conditional_render {
 
diff --git a/src/templates/org/lwjgl/opengl/NV_copy_image.java b/src/templates/org/lwjgl/opengl/NV_copy_image.java
index 62fad62..2391f88 100644
--- a/src/templates/org/lwjgl/opengl/NV_copy_image.java
+++ b/src/templates/org/lwjgl/opengl/NV_copy_image.java
@@ -31,9 +31,9 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
-import org.lwjgl.util.generator.GLsizei;
-import org.lwjgl.util.generator.GLuint;
+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 {
 
diff --git a/src/templates/org/lwjgl/opengl/NV_evaluators.java b/src/templates/org/lwjgl/opengl/NV_evaluators.java
index 9745500..ec962d7 100644
--- a/src/templates/org/lwjgl/opengl/NV_evaluators.java
+++ b/src/templates/org/lwjgl/opengl/NV_evaluators.java
@@ -32,6 +32,10 @@
 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.*;
 
diff --git a/src/templates/org/lwjgl/opengl/NV_explicit_multisample.java b/src/templates/org/lwjgl/opengl/NV_explicit_multisample.java
index d23dab9..4e30ebf 100644
--- a/src/templates/org/lwjgl/opengl/NV_explicit_multisample.java
+++ b/src/templates/org/lwjgl/opengl/NV_explicit_multisample.java
@@ -32,6 +32,8 @@
 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;
@@ -75,17 +77,21 @@ public interface NV_explicit_multisample {
 	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("16") @GLboolean ByteBuffer data);
+	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")
diff --git a/src/templates/org/lwjgl/opengl/NV_fence.java b/src/templates/org/lwjgl/opengl/NV_fence.java
index a5a5e89..981c268 100644
--- a/src/templates/org/lwjgl/opengl/NV_fence.java
+++ b/src/templates/org/lwjgl/opengl/NV_fence.java
@@ -32,6 +32,11 @@
 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.*;
 
@@ -49,7 +54,7 @@ public interface NV_fence {
 	void glDeleteFencesNV(@AutoSize("piFences") @GLsizei int n, @Const @GLuint IntBuffer piFences);
 
 	@Alternate("glDeleteFencesNV")
-	void glDeleteFencesNV(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtils.getBufferInt().put(0, fence), 0", keepParam = true) int fence);
+	void 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);
 
diff --git a/src/templates/org/lwjgl/opengl/NV_fragment_program.java b/src/templates/org/lwjgl/opengl/NV_fragment_program.java
index 3af3504..9ecba8f 100644
--- a/src/templates/org/lwjgl/opengl/NV_fragment_program.java
+++ b/src/templates/org/lwjgl/opengl/NV_fragment_program.java
@@ -32,6 +32,9 @@
 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.*;
 
diff --git a/src/templates/org/lwjgl/opengl/NV_framebuffer_multisample_coverage.java b/src/templates/org/lwjgl/opengl/NV_framebuffer_multisample_coverage.java
index 7238b5f..d90b9a1 100644
--- a/src/templates/org/lwjgl/opengl/NV_framebuffer_multisample_coverage.java
+++ b/src/templates/org/lwjgl/opengl/NV_framebuffer_multisample_coverage.java
@@ -31,8 +31,8 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
-import org.lwjgl.util.generator.GLsizei;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLsizei;
 
 public interface NV_framebuffer_multisample_coverage {
 
@@ -42,7 +42,7 @@ public interface NV_framebuffer_multisample_coverage {
 
 	/** Accepted by the &lt;pname&gt; parameter of GetIntegerv. */
 	int GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV = 0x8E11;
-	int GL_MULITSAMPLE_COVERAGE_MODES_NV = 0x8E12;
+	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);
diff --git a/src/templates/org/lwjgl/opengl/NV_geometry_program4.java b/src/templates/org/lwjgl/opengl/NV_geometry_program4.java
index 8db5045..2749c2b 100644
--- a/src/templates/org/lwjgl/opengl/NV_geometry_program4.java
+++ b/src/templates/org/lwjgl/opengl/NV_geometry_program4.java
@@ -31,8 +31,9 @@
  */
 package org.lwjgl.opengl;
 
-import org.lwjgl.util.generator.GLenum;
-import org.lwjgl.util.generator.GLuint;
+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 {
 
@@ -49,10 +50,13 @@ public interface NV_geometry_program4 {
 
 	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);
 
 }
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/NV_gpu_program4.java b/src/templates/org/lwjgl/opengl/NV_gpu_program4.java
index 6275ca2..3262718 100644
--- a/src/templates/org/lwjgl/opengl/NV_gpu_program4.java
+++ b/src/templates/org/lwjgl/opengl/NV_gpu_program4.java
@@ -32,6 +32,9 @@
 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;
 
diff --git a/src/templates/org/lwjgl/opengl/NV_gpu_shader5.java b/src/templates/org/lwjgl/opengl/NV_gpu_shader5.java
index ea1a866..978408f 100644
--- a/src/templates/org/lwjgl/opengl/NV_gpu_shader5.java
+++ b/src/templates/org/lwjgl/opengl/NV_gpu_shader5.java
@@ -32,6 +32,10 @@
 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;
 
@@ -84,16 +88,16 @@ public interface NV_gpu_shader5 {
 	void glUniform4i64NV(int location, @GLint64EXT long x, @GLint64EXT long y, @GLint64EXT long z, @GLint64EXT long w);
 
 	@StripPostfix("value")
-	void glUniform1i64vNV(int location, @GLsizei int count, @Const @GLint64EXT @Check("1") LongBuffer value);
+	void glUniform1i64vNV(int location, @AutoSize("value") @GLsizei int count, @Const @GLint64EXT LongBuffer value);
 
 	@StripPostfix("value")
-	void glUniform2i64vNV(int location, @GLsizei int count, @Const @GLint64EXT @Check("2") LongBuffer value);
+	void glUniform2i64vNV(int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const @GLint64EXT LongBuffer value);
 
 	@StripPostfix("value")
-	void glUniform3i64vNV(int location, @GLsizei int count, @Const @GLint64EXT @Check("3") LongBuffer value);
+	void glUniform3i64vNV(int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const @GLint64EXT LongBuffer value);
 
 	@StripPostfix("value")
-	void glUniform4i64vNV(int location, @GLsizei int count, @Const @GLint64EXT @Check("4") LongBuffer value);
+	void glUniform4i64vNV(int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const @GLint64EXT LongBuffer value);
 
 	void glUniform1ui64NV(int location, @GLuint64EXT long x);
 
@@ -104,22 +108,22 @@ public interface NV_gpu_shader5 {
 	void glUniform4ui64NV(int location, @GLuint64EXT long x, @GLuint64EXT long y, @GLuint64EXT long z, @GLuint64EXT long w);
 
 	@StripPostfix("value")
-	void glUniform1ui64vNV(int location, @GLsizei int count, @Const @GLuint64EXT @Check("1") LongBuffer value);
+	void glUniform1ui64vNV(int location, @AutoSize("value") @GLsizei int count, @Const @GLuint64EXT LongBuffer value);
 
 	@StripPostfix("value")
-	void glUniform2ui64vNV(int location, @GLsizei int count, @Const @GLuint64EXT @Check("2") LongBuffer value);
+	void glUniform2ui64vNV(int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const @GLuint64EXT LongBuffer value);
 
 	@StripPostfix("value")
-	void glUniform3ui64vNV(int location, @GLsizei int count, @Const @GLuint64EXT @Check("3") LongBuffer value);
+	void glUniform3ui64vNV(int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const @GLuint64EXT LongBuffer value);
 
 	@StripPostfix("value")
-	void glUniform4ui64vNV(int location, @GLsizei int count, @Const @GLuint64EXT @Check("4") LongBuffer 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, @GLint64EXT @Check LongBuffer params);
+	void glGetUniformi64vNV(@GLuint int program, int location, @OutParameter @Check("1") @GLint64EXT LongBuffer params);
 
 	@StripPostfix("params")
-	void glGetUniformui64vNV(@GLuint int program, int location, @GLuint64EXT @Check LongBuffer params);
+	void glGetUniformui64vNV(@GLuint int program, int location, @OutParameter @Check("1") @GLuint64EXT LongBuffer params);
 
 	// -------------
 
@@ -137,19 +141,19 @@ public interface NV_gpu_shader5 {
 
 	@Dependent("EXT_direct_state_access")
 	@StripPostfix("value")
-	void glProgramUniform1i64vNV(@GLuint int program, int location, @GLsizei int count, @Const @GLint64EXT @Check("1") LongBuffer 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, @GLsizei int count, @Const @GLint64EXT @Check("2") LongBuffer 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, @GLsizei int count, @Const @GLint64EXT @Check("3") LongBuffer 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, @GLsizei int count, @Const @GLint64EXT @Check("4") LongBuffer 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);
@@ -165,18 +169,18 @@ public interface NV_gpu_shader5 {
 
 	@Dependent("EXT_direct_state_access")
 	@StripPostfix("value")
-	void glProgramUniform1ui64vNV(@GLuint int program, int location, @GLsizei int count, @Const @GLuint64EXT @Check("1") LongBuffer 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, @GLsizei int count, @Const @GLuint64EXT @Check("2") LongBuffer 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, @GLsizei int count, @Const @GLuint64EXT @Check("3") LongBuffer 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, @GLsizei int count, @Const @GLuint64EXT @Check("4") LongBuffer value);
+	void glProgramUniform4ui64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const @GLuint64EXT LongBuffer value);
 
 }
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengl/NV_half_float.java b/src/templates/org/lwjgl/opengl/NV_half_float.java
index 134c61b..b0eada4 100644
--- a/src/templates/org/lwjgl/opengl/NV_half_float.java
+++ b/src/templates/org/lwjgl/opengl/NV_half_float.java
@@ -32,6 +32,10 @@
 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.*;
 
@@ -94,42 +98,42 @@ public interface NV_half_float {
 	@NoErrorCheck
 	void glSecondaryColor3hNV(@GLhalf short red, @GLhalf short green, @GLhalf short blue);
 
-	@Optional(reason = "AMD does not expose this (last driver checked: 10.3)")
+	@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.3)")
+	@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.3)")
+	@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.3)")
+	@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.3)")
+	@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.3)")
+	@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.3)")
+	@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.3)")
+	@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.3)")
+	@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);
diff --git a/src/templates/org/lwjgl/opengl/NV_occlusion_query.java b/src/templates/org/lwjgl/opengl/NV_occlusion_query.java
index bfafdb6..5fb3092 100644
--- a/src/templates/org/lwjgl/opengl/NV_occlusion_query.java
+++ b/src/templates/org/lwjgl/opengl/NV_occlusion_query.java
@@ -32,6 +32,11 @@
 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;
 
@@ -54,7 +59,7 @@ public interface NV_occlusion_query {
 	void glDeleteOcclusionQueriesNV(@AutoSize("piIDs") @GLsizei int n, @Const @GLuint IntBuffer piIDs);
 
 	@Alternate("glDeleteOcclusionQueriesNV")
-	void glDeleteOcclusionQueriesNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, piID), 0", keepParam = true) int piID);
+	void glDeleteOcclusionQueriesNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, piID), 0", keepParam = true) int piID);
 
 	boolean glIsOcclusionQueryNV(@GLuint int id);
 
diff --git a/src/templates/org/lwjgl/opengl/NV_parameter_buffer_object.java b/src/templates/org/lwjgl/opengl/NV_parameter_buffer_object.java
index d7c39da..dea16c8 100644
--- a/src/templates/org/lwjgl/opengl/NV_parameter_buffer_object.java
+++ b/src/templates/org/lwjgl/opengl/NV_parameter_buffer_object.java
@@ -32,6 +32,9 @@
 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;
diff --git a/src/templates/org/lwjgl/opengl/NV_pixel_data_range.java b/src/templates/org/lwjgl/opengl/NV_pixel_data_range.java
index 4cadda3..9749210 100644
--- a/src/templates/org/lwjgl/opengl/NV_pixel_data_range.java
+++ b/src/templates/org/lwjgl/opengl/NV_pixel_data_range.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
diff --git a/src/templates/org/lwjgl/opengl/NV_point_sprite.java b/src/templates/org/lwjgl/opengl/NV_point_sprite.java
index 17958db..a5b52f0 100644
--- a/src/templates/org/lwjgl/opengl/NV_point_sprite.java
+++ b/src/templates/org/lwjgl/opengl/NV_point_sprite.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLenum;
 
 import java.nio.*;
 
diff --git a/src/templates/org/lwjgl/opengl/NV_primitive_restart.java b/src/templates/org/lwjgl/opengl/NV_primitive_restart.java
index d521de6..5471cf2 100644
--- a/src/templates/org/lwjgl/opengl/NV_primitive_restart.java
+++ b/src/templates/org/lwjgl/opengl/NV_primitive_restart.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLuint;
 
 @ForceInit
 public interface NV_primitive_restart {
diff --git a/src/templates/org/lwjgl/opengl/NV_program.java b/src/templates/org/lwjgl/opengl/NV_program.java
index 9cb9f87..9709bad 100644
--- a/src/templates/org/lwjgl/opengl/NV_program.java
+++ b/src/templates/org/lwjgl/opengl/NV_program.java
@@ -32,6 +32,8 @@
 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;
@@ -67,7 +69,7 @@ public interface NV_program {
 	void glDeleteProgramsNV(@AutoSize("programs") @GLsizei int n, @Const @GLuint IntBuffer programs);
 
 	@Alternate("glDeleteProgramsNV")
-	void glDeleteProgramsNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, program), 0", keepParam = true) int program);
+	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);
 
@@ -99,6 +101,6 @@ public interface NV_program {
 	void glRequestResidentProgramsNV(@AutoSize("programIDs") @GLsizei int n, @GLuint IntBuffer programIDs);
 
 	@Alternate("glRequestResidentProgramsNV")
-	void glRequestResidentProgramsNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, programID), 0", keepParam = true) int programID);
+	void glRequestResidentProgramsNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, programID), 0", keepParam = true) int programID);
 }
 
diff --git a/src/templates/org/lwjgl/opengl/NV_register_combiners.java b/src/templates/org/lwjgl/opengl/NV_register_combiners.java
index 19e389a..16c2f85 100644
--- a/src/templates/org/lwjgl/opengl/NV_register_combiners.java
+++ b/src/templates/org/lwjgl/opengl/NV_register_combiners.java
@@ -32,6 +32,9 @@
 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.*;
 
diff --git a/src/templates/org/lwjgl/opengl/NV_register_combiners2.java b/src/templates/org/lwjgl/opengl/NV_register_combiners2.java
index fd39f73..237d296 100644
--- a/src/templates/org/lwjgl/opengl/NV_register_combiners2.java
+++ b/src/templates/org/lwjgl/opengl/NV_register_combiners2.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLenum;
 
 import java.nio.*;
 
diff --git a/src/templates/org/lwjgl/opengl/NV_shader_buffer_load.java b/src/templates/org/lwjgl/opengl/NV_shader_buffer_load.java
index d2b6175..cc89197 100644
--- a/src/templates/org/lwjgl/opengl/NV_shader_buffer_load.java
+++ b/src/templates/org/lwjgl/opengl/NV_shader_buffer_load.java
@@ -32,6 +32,8 @@
 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;
 
@@ -90,6 +92,7 @@ public interface NV_shader_buffer_load {
 	@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);
 
diff --git a/src/templates/org/lwjgl/opengl/NV_transform_feedback.java b/src/templates/org/lwjgl/opengl/NV_transform_feedback.java
index b0e72e2..ee8d626 100644
--- a/src/templates/org/lwjgl/opengl/NV_transform_feedback.java
+++ b/src/templates/org/lwjgl/opengl/NV_transform_feedback.java
@@ -32,6 +32,8 @@
 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;
@@ -150,7 +152,7 @@ public interface NV_transform_feedback {
 	@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, APIUtils.getBufferInt(), 0, APIUtils.getBufferInt(), 1") IntBuffer length,
+	                          @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. */
@@ -160,7 +162,7 @@ public interface NV_transform_feedback {
 	                              @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("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+	                              @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
 
 	/** Overloads glGetActiveVaryingNV. This version returns only the varying type. */
 	@Alternate(value = "glGetActiveVaryingNV", javaAlt = true)
@@ -169,7 +171,7 @@ public interface NV_transform_feedback {
 	                              @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("APIUtils.getBufferByte(0), 0") ByteBuffer name);
+	                              @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
 
 	void glActiveVaryingNV(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name);
 
diff --git a/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java b/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java
index 5a55be4..32c7f98 100644
--- a/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java
+++ b/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java
@@ -32,6 +32,11 @@
 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;
 
@@ -54,7 +59,7 @@ public interface NV_transform_feedback2 {
 	void glDeleteTransformFeedbacksNV(@AutoSize("ids") @GLsizei int n, @Const @GLuint IntBuffer ids);
 
 	@Alternate("glDeleteTransformFeedbacksNV")
-	void glDeleteTransformFeedbacksNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, id), 0", keepParam = true) int id);
+	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);
 
diff --git a/src/templates/org/lwjgl/opengl/NV_vertex_array_range.java b/src/templates/org/lwjgl/opengl/NV_vertex_array_range.java
index f4b995b..f8995be 100644
--- a/src/templates/org/lwjgl/opengl/NV_vertex_array_range.java
+++ b/src/templates/org/lwjgl/opengl/NV_vertex_array_range.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
@@ -54,7 +55,7 @@ public interface NV_vertex_array_range {
 
 	@PlatformDependent({Platform.WGL, Platform.GLX})
 	@GLvoid
-	@AutoResultSize("size")
+	@AutoSize("size")
 	ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority);
 
 	@PlatformDependent({Platform.WGL, Platform.GLX})
diff --git a/src/templates/org/lwjgl/opengl/NV_vertex_attrib_integer_64bit.java b/src/templates/org/lwjgl/opengl/NV_vertex_attrib_integer_64bit.java
index 5558afc..7c10430 100644
--- a/src/templates/org/lwjgl/opengl/NV_vertex_attrib_integer_64bit.java
+++ b/src/templates/org/lwjgl/opengl/NV_vertex_attrib_integer_64bit.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.LongBuffer;
 
diff --git a/src/templates/org/lwjgl/opengl/NV_vertex_buffer_unified_memory.java b/src/templates/org/lwjgl/opengl/NV_vertex_buffer_unified_memory.java
index b34d2e6..d60f04a 100644
--- a/src/templates/org/lwjgl/opengl/NV_vertex_buffer_unified_memory.java
+++ b/src/templates/org/lwjgl/opengl/NV_vertex_buffer_unified_memory.java
@@ -32,6 +32,8 @@
 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;
 
diff --git a/src/templates/org/lwjgl/opengl/NV_vertex_program.java b/src/templates/org/lwjgl/opengl/NV_vertex_program.java
index e960685..7a491da 100644
--- a/src/templates/org/lwjgl/opengl/NV_vertex_program.java
+++ b/src/templates/org/lwjgl/opengl/NV_vertex_program.java
@@ -32,6 +32,7 @@
 package org.lwjgl.opengl;
 
 import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
 
 import java.nio.*;
 
@@ -228,7 +229,7 @@ public interface NV_vertex_program extends NV_program {
 	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")
+                                 @CachedReference(index="index",name="glVertexAttribPointer_buffer")
 	                             @BufferObject(BufferKind.ArrayVBO)
 	                             @Check
 	                             @Const


hooks/post-receive
-- 
lwjgl - Lightweight Java Game Library



More information about the pkg-java-commits mailing list