();
+
+ /** Handle to the native GL rendering context */
+ private final DrawableGLES drawable;
+ private final EGLContext eglContext;
+
+ private final org.lwjgl.opengles.ContextAttribs contextAttribs;
+
+ /** Whether the context has been destroyed */
+ private boolean destroyed;
+
+ private boolean destroy_requested;
+
+ /** The thread that has this context current, or null. */
+ private Thread thread;
+
+ static {
+ Sys.initialize();
+ }
+
+ public EGLContext getEGLContext() {
+ return eglContext;
+ }
+
+ org.lwjgl.opengles.ContextAttribs getContextAttribs() {
+ return contextAttribs;
+ }
+
+ static ContextGLES getCurrentContext() {
+ return current_context_local.get();
+ }
+
+ /** Create a context with the specified peer info and shared context */
+ ContextGLES(DrawableGLES drawable, org.lwjgl.opengles.ContextAttribs attribs, ContextGLES shared_context) throws LWJGLException {
+ if ( drawable == null )
+ throw new IllegalArgumentException();
+
+ ContextGLES context_lock = shared_context != null ? shared_context : this;
+ // If shared_context is not null, synchronize on it to make sure it is not deleted
+ // while this context is created. Otherwise, simply synchronize on ourself to avoid NPE
+ synchronized ( context_lock ) {
+ if ( shared_context != null && shared_context.destroyed )
+ throw new IllegalArgumentException("Shared context is destroyed");
+
+ this.drawable = drawable;
+ this.contextAttribs = attribs;
+ this.eglContext = drawable.getEGLDisplay().createContext(drawable.getEGLConfig(),
+ shared_context == null ? null : shared_context.eglContext,
+ attribs == null ? new org.lwjgl.opengles.ContextAttribs(2).getAttribList() : attribs.getAttribList());
+ }
+ }
+
+ /** Release the current context (if any). After this call, no context is current. */
+ public void releaseCurrent() throws LWJGLException, PowerManagementEventException {
+ eglReleaseCurrent(drawable.getEGLDisplay());
+ org.lwjgl.opengles.GLContext.useContext(null);
+ current_context_local.set(null);
+
+ synchronized ( this ) {
+ thread = null;
+ checkDestroy();
+ }
+ }
+
+ /** Swap the buffers on the current context. Only valid for double-buffered contexts */
+ public static void swapBuffers() throws LWJGLException, PowerManagementEventException {
+ ContextGLES current_context = getCurrentContext();
+ if ( current_context != null )
+ current_context.drawable.getEGLSurface().swapBuffers();
+ }
+
+ private boolean canAccess() {
+ return thread == null || Thread.currentThread() == thread;
+ }
+
+ private void checkAccess() {
+ if ( !canAccess() )
+ throw new IllegalStateException("From thread " + Thread.currentThread() + ": " + thread + " already has the context current");
+ }
+
+ /** Make the context current */
+ public synchronized void makeCurrent() throws LWJGLException, PowerManagementEventException {
+ checkAccess();
+ if ( destroyed )
+ throw new IllegalStateException("Context is destroyed");
+ thread = Thread.currentThread();
+ current_context_local.set(this);
+ eglContext.makeCurrent(drawable.getEGLSurface());
+ org.lwjgl.opengles.GLContext.useContext(this);
+ }
+
+ /** Query whether the context is current */
+ public synchronized boolean isCurrent() throws LWJGLException {
+ if ( destroyed )
+ throw new IllegalStateException("Context is destroyed");
+ return eglIsCurrentContext(eglContext);
+ }
+
+ private void checkDestroy() {
+ if ( !destroyed && destroy_requested ) {
+ try {
+ eglContext.destroy();
+ destroyed = true;
+ thread = null;
+ } catch (LWJGLException e) {
+ LWJGLUtil.log("Exception occurred while destroying context: " + e);
+ }
+ }
+ }
+
+ /**
+ * Set the buffer swap interval. This call is a best-attempt at changing
+ * the monitor swap interval, which is the minimum periodicity of color buffer swaps,
+ * measured in video frame periods, and is not guaranteed to be successful.
+ *
+ * A video frame period is the time required to display a full frame of video data.
+ */
+ public static void setSwapInterval(int value) {
+ ContextGLES current_context = getCurrentContext();
+ if ( current_context != null ) {
+ try {
+ current_context.drawable.getEGLDisplay().setSwapInterval(value);
+ } catch (LWJGLException e) {
+ LWJGLUtil.log("Failed to set swap interval. Reason: " + e.getMessage());
+ }
+ }
+ }
+
+ /**
+ * Destroy the context. This method behaves the same as destroy() with the extra
+ * requirement that the context must be either current to the current thread or not
+ * current at all.
+ */
+ public synchronized void forceDestroy() throws LWJGLException {
+ checkAccess();
+ destroy();
+ }
+
+ /**
+ * Request destruction of the Context. If the context is current, no context will be current after this call.
+ * The context is destroyed when no thread has it current.
+ */
+ public synchronized void destroy() throws LWJGLException {
+ if ( destroyed )
+ return;
+ destroy_requested = true;
+ boolean was_current = isCurrent();
+ int error = GLES20.GL_NO_ERROR;
+ if ( was_current ) {
+ if ( org.lwjgl.opengles.GLContext.getCapabilities() != null && GLContext.getCapabilities().OpenGLES20 )
+ error = GLES20.glGetError();
+
+ try {
+ releaseCurrent();
+ } catch (PowerManagementEventException e) {
+ // Ignore
+ }
+ }
+ checkDestroy();
+ if ( was_current && error != GLES20.GL_NO_ERROR )
+ throw new OpenGLException(error);
+ }
+
+ public void releaseDrawable() throws LWJGLException {
+ }
+
+}
diff --git a/src/java/org/lwjgl/opengl/Display.java b/src/java/org/lwjgl/opengl/Display.java
index 8ec43a84..0bf06ad2 100644
--- a/src/java/org/lwjgl/opengl/Display.java
+++ b/src/java/org/lwjgl/opengl/Display.java
@@ -43,10 +43,7 @@ package org.lwjgl.opengl;
* @author foo
*/
-import org.lwjgl.BufferUtils;
-import org.lwjgl.LWJGLException;
-import org.lwjgl.LWJGLUtil;
-import org.lwjgl.Sys;
+import org.lwjgl.*;
import org.lwjgl.input.Controllers;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
@@ -62,8 +59,6 @@ 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() {
@@ -109,7 +104,7 @@ public final class Display {
private static int swap_interval;
/** The Drawable instance that tracks the current Display context */
- private static final AbstractDrawable drawable;
+ private static DrawableLWJGL drawable;
private static boolean window_created;
@@ -134,22 +129,6 @@ public final class Display {
LWJGLUtil.log("Initial mode: " + initial_mode);
} catch (LWJGLException e) {
throw new RuntimeException(e);
- }
- drawable = new AbstractDrawable() {
- public void destroy() {
- synchronized ( GlobalLock.lock ) {
- if ( !isCreated() )
- return;
-
- releaseDrawable();
- super.destroy();
- destroyWindow();
- x = y = -1;
- cached_icons = null;
- reset();
- removeShutdownHook();
- }
- }
};
}
@@ -314,7 +293,7 @@ public final class Display {
tmp_parent.addComponentListener(component_listener);
}
DisplayMode mode = getEffectiveMode();
- display_impl.createWindow(mode, tmp_parent, getWindowX(), getWindowY());
+ display_impl.createWindow(drawable, mode, tmp_parent, getWindowX(), getWindowY());
window_created = true;
setTitle(title);
@@ -330,9 +309,9 @@ public final class Display {
private static void releaseDrawable() {
try {
- Context context = drawable.context;
+ Context context = drawable.getContext();
if ( context != null && context.isCurrent() ) {
- Context.releaseCurrentContext();
+ context.releaseCurrent();
context.releaseDrawable();
}
} catch (LWJGLException e) {
@@ -648,8 +627,8 @@ public final class Display {
throw new IllegalStateException("Display not created");
if ( LWJGLUtil.DEBUG )
- Util.checkGLError();
- Context.swapBuffers();
+ drawable.checkGLError();
+ drawable.swapBuffers();
}
}
@@ -851,12 +830,180 @@ public final class Display {
registerShutdownHook();
if ( isFullscreen() )
switchDisplayMode();
+
+ final DrawableGL drawable = new DrawableGL() {
+ public void destroy() {
+ synchronized ( GlobalLock.lock ) {
+ if ( !isCreated() )
+ return;
+
+ releaseDrawable();
+ super.destroy();
+ destroyWindow();
+ x = y = -1;
+ cached_icons = null;
+ reset();
+ removeShutdownHook();
+ }
+ }
+ };
+ Display.drawable = drawable;
+
try {
- drawable.peer_info = display_impl.createPeerInfo(pixel_format);
+ drawable.setPixelFormat(pixel_format);
try {
createWindow();
try {
- drawable.context = new Context(drawable.peer_info, attribs, shared_drawable != null ? ((AbstractDrawable)shared_drawable).getContext() : null);
+ drawable.context = new ContextGL(drawable.peer_info, attribs, shared_drawable != null ? ((DrawableGL)shared_drawable).getContext() : null);
+ try {
+ makeCurrentAndSetSwapInterval();
+ initContext();
+ } catch (LWJGLException e) {
+ drawable.destroy();
+ throw e;
+ }
+ } catch (LWJGLException e) {
+ destroyWindow();
+ throw e;
+ }
+ } catch (LWJGLException e) {
+ drawable.destroy();
+ throw e;
+ }
+ } catch (LWJGLException e) {
+ display_impl.resetDisplayMode();
+ throw e;
+ }
+ }
+ }
+
+ /**
+ * Create the OpenGL ES context. If isFullscreen() is true or if windowed
+ * context are not supported on the platform, the display mode will be switched to the mode returned by
+ * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
+ * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be
+ * created with the given parameters, a LWJGLException will be thrown.
+ *
+ * The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
+ *
+ * @throws LWJGLException
+ */
+ public static void createES() throws LWJGLException {
+ synchronized ( GlobalLock.lock ) {
+ create(new org.lwjgl.opengles.PixelFormat());
+ }
+ }
+
+ /**
+ * Create the OpenGL ES context with the given minimum parameters. If isFullscreen() is true or if windowed
+ * context are not supported on the platform, the display mode will be switched to the mode returned by
+ * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
+ * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be
+ * created with the given parameters, a LWJGLException will be thrown.
+ *
+ * The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
+ *
+ * @param pixel_format Describes the minimum specifications the context must fulfill.
+ *
+ * @throws LWJGLException
+ */
+
+ public static void create(org.lwjgl.opengles.PixelFormat pixel_format) throws LWJGLException {
+ synchronized ( GlobalLock.lock ) {
+ create(pixel_format, null, null);
+ }
+ }
+
+ /**
+ * Create the OpenGL context with the given minimum parameters. If isFullscreen() is true or if windowed
+ * context are not supported on the platform, the display mode will be switched to the mode returned by
+ * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
+ * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be
+ * created with the given parameters, a LWJGLException will be thrown.
+ *
+ * The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
+ *
+ * @param pixel_format Describes the minimum specifications the context must fulfill.
+ * @param shared_drawable The Drawable to share context with. (optional, may be null)
+ *
+ * @throws LWJGLException
+ */
+ public static void create(org.lwjgl.opengles.PixelFormat pixel_format, Drawable shared_drawable) throws LWJGLException {
+ synchronized ( GlobalLock.lock ) {
+ create(pixel_format, shared_drawable, null);
+ }
+ }
+
+ /**
+ * Create the OpenGL context with the given minimum parameters. If isFullscreen() is true or if windowed
+ * context are not supported on the platform, the display mode will be switched to the mode returned by
+ * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
+ * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be
+ * created with the given parameters, a LWJGLException will be thrown.
+ *
+ * The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
+ *
+ * @param pixel_format Describes the minimum specifications the context must fulfill.
+ * @param attribs The ContextAttribs to use when creating the context. (optional, may be null)
+ *
+ * @throws LWJGLException
+ */
+ public static void create(org.lwjgl.opengles.PixelFormat pixel_format, org.lwjgl.opengles.ContextAttribs attribs) throws LWJGLException {
+ synchronized ( GlobalLock.lock ) {
+ create(pixel_format, null, attribs);
+ }
+ }
+
+ /**
+ * Create the OpenGL ES context with the given minimum parameters. If isFullscreen() is true or if windowed
+ * context are not supported on the platform, the display mode will be switched to the mode returned by
+ * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
+ * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be
+ * created with the given parameters, a LWJGLException will be thrown.
+ *
+ * The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
+ *
+ * @param pixel_format Describes the minimum specifications the context must fulfill.
+ * @param shared_drawable The Drawable to share context with. (optional, may be null)
+ * @param attribs The ContextAttribs to use when creating the context. (optional, may be null)
+ *
+ * @throws LWJGLException
+ */
+ public static void create(org.lwjgl.opengles.PixelFormat pixel_format, Drawable shared_drawable, org.lwjgl.opengles.ContextAttribs attribs) throws LWJGLException {
+ synchronized ( GlobalLock.lock ) {
+ if ( isCreated() )
+ throw new IllegalStateException("Only one LWJGL context may be instantiated at any one time.");
+ if ( pixel_format == null )
+ throw new NullPointerException("pixel_format cannot be null");
+ removeShutdownHook();
+ registerShutdownHook();
+ if ( isFullscreen() )
+ switchDisplayMode();
+
+ final DrawableGLES drawable = new DrawableGLES() {
+ public void destroy() {
+ synchronized ( GlobalLock.lock ) {
+ if ( !isCreated() )
+ return;
+
+ releaseDrawable();
+ super.destroy();
+ destroyWindow();
+ x = y = -1;
+ cached_icons = null;
+ reset();
+ removeShutdownHook();
+ }
+ }
+ };
+ Display.drawable = drawable;
+
+ try {
+ drawable.setPixelFormat(pixel_format);
+ try {
+ createWindow();
+ try {
+ drawable.createContext(attribs, shared_drawable);
try {
makeCurrentAndSetSwapInterval();
initContext();
@@ -896,7 +1043,7 @@ public final class Display {
private static void makeCurrentAndSetSwapInterval() throws LWJGLException {
makeCurrent();
try {
- Util.checkGLError();
+ drawable.checkGLError();
} catch (OpenGLException e) {
LWJGLUtil.log("OpenGL error during context creation: " + e.getMessage());
}
@@ -904,10 +1051,7 @@ public final class Display {
}
private static void initContext() {
- // set background clear color
- glClearColor(r, g, b, 0.0f);
- // Clear window to avoid the desktop "showing through"
- glClear(GL_COLOR_BUFFER_BIT);
+ drawable.initContext(r, g, b);
update();
}
@@ -990,7 +1134,8 @@ public final class Display {
synchronized ( GlobalLock.lock ) {
swap_interval = value;
if ( isCreated() )
- Context.setSwapInterval(swap_interval);
+ drawable.setSwapInterval(swap_interval);
+
}
}
diff --git a/src/java/org/lwjgl/opengl/DisplayImplementation.java b/src/java/org/lwjgl/opengl/DisplayImplementation.java
index fb5505ee..031527f1 100644
--- a/src/java/org/lwjgl/opengl/DisplayImplementation.java
+++ b/src/java/org/lwjgl/opengl/DisplayImplementation.java
@@ -47,7 +47,7 @@ import org.lwjgl.LWJGLException;
interface DisplayImplementation extends InputImplementation {
- void createWindow(DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException;
+ void createWindow(DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException;
void destroyWindow();
diff --git a/src/java/org/lwjgl/opengl/AbstractDrawable.java b/src/java/org/lwjgl/opengl/DrawableGL.java
similarity index 56%
rename from src/java/org/lwjgl/opengl/AbstractDrawable.java
rename to src/java/org/lwjgl/opengl/DrawableGL.java
index 88235973..6725dea4 100644
--- a/src/java/org/lwjgl/opengl/AbstractDrawable.java
+++ b/src/java/org/lwjgl/opengl/DrawableGL.java
@@ -4,33 +4,64 @@ import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.PointerBuffer;
-/**
- * @author Spasi
- */
-abstract class AbstractDrawable implements DrawableLWJGL {
+import static org.lwjgl.opengl.GL11.*;
+
+/** @author Spasi */
+abstract class DrawableGL implements DrawableLWJGL {
+
+ /** The PixelFormat used to create the drawable. */
+ protected PixelFormat pixel_format;
/** Handle to the native GL rendering context */
protected PeerInfo peer_info;
/** The OpenGL Context. */
- protected Context context;
+ protected ContextGL context;
- protected AbstractDrawable() {
+ protected DrawableGL() {
}
- public Context getContext() {
+ public void setPixelFormat(final PixelFormatLWJGL pf) throws LWJGLException {
+ this.pixel_format = (PixelFormat)pf;
+ this.peer_info = Display.getImplementation().createPeerInfo(pixel_format);
+ }
+
+ public PixelFormatLWJGL getPixelFormat() {
+ return pixel_format;
+ }
+
+ public ContextGL getContext() {
synchronized ( GlobalLock.lock ) {
return context;
}
}
- public Context createSharedContext() throws LWJGLException {
+ public ContextGL createSharedContext() throws LWJGLException {
synchronized ( GlobalLock.lock ) {
checkDestroyed();
- return new Context(peer_info, context.getContextAttribs(), context);
+ return new ContextGL(peer_info, context.getContextAttribs(), context);
}
}
+ public void checkGLError() {
+ Util.checkGLError();
+ }
+
+ public void setSwapInterval(final int swap_interval) {
+ ContextGL.setSwapInterval(swap_interval);
+ }
+
+ public void swapBuffers() throws LWJGLException {
+ ContextGL.swapBuffers();
+ }
+
+ public void initContext(final float r, final float g, final float b) {
+ // set background clear color
+ glClearColor(r, g, b, 0.0f);
+ // Clear window to avoid the desktop "showing through"
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
+
public boolean isCurrent() throws LWJGLException {
synchronized ( GlobalLock.lock ) {
checkDestroyed();
@@ -49,7 +80,7 @@ abstract class AbstractDrawable implements DrawableLWJGL {
synchronized ( GlobalLock.lock ) {
checkDestroyed();
if ( context.isCurrent() )
- Context.releaseCurrentContext();
+ context.releaseCurrent();
}
}
diff --git a/src/java/org/lwjgl/opengl/DrawableGLES.java b/src/java/org/lwjgl/opengl/DrawableGLES.java
new file mode 100644
index 00000000..ea4852a6
--- /dev/null
+++ b/src/java/org/lwjgl/opengl/DrawableGLES.java
@@ -0,0 +1,211 @@
+package org.lwjgl.opengl;
+
+import org.lwjgl.LWJGLException;
+import org.lwjgl.LWJGLUtil;
+import org.lwjgl.PointerBuffer;
+import org.lwjgl.opengles.ContextAttribs;
+import org.lwjgl.opengles.*;
+import org.lwjgl.opengles.Util;
+
+import static org.lwjgl.opengles.EGL.*;
+import static org.lwjgl.opengles.GLES20.*;
+
+/**
+ * @author Spasi
+ * @since 14/5/2011
+ */
+abstract class DrawableGLES implements DrawableLWJGL {
+
+ /** The PixelFormat used to create the EGLDisplay. */
+ protected org.lwjgl.opengles.PixelFormat pixel_format;
+
+ protected EGLDisplay eglDisplay;
+ protected EGLConfig eglConfig;
+ protected EGLSurface eglSurface;
+
+ /** The OpenGL Context. */
+ protected ContextGLES context;
+
+ /** The Drawable that shares objects with this Drawable. */
+ protected Drawable shared_drawable;
+
+ protected DrawableGLES() {
+ }
+
+ public void setPixelFormat(final PixelFormatLWJGL pf) throws LWJGLException {
+ synchronized ( GlobalLock.lock ) {
+ this.pixel_format = (org.lwjgl.opengles.PixelFormat)pf;
+ }
+ }
+
+ public PixelFormatLWJGL getPixelFormat() {
+ synchronized ( GlobalLock.lock ) {
+ return pixel_format;
+ }
+ }
+
+ public void initialize(final long window, final long display_id, final int eglSurfaceType, final org.lwjgl.opengles.PixelFormat pf) throws LWJGLException {
+ synchronized ( GlobalLock.lock ) {
+ if ( eglSurface != null ) {
+ eglSurface.destroy();
+ eglSurface = null;
+ }
+
+ if ( eglDisplay != null ) {
+ eglDisplay.terminate();
+ eglDisplay = null;
+ }
+
+ final EGLDisplay eglDisplay = eglGetDisplay((int)display_id);
+
+ int[] attribs = {
+ EGL_LEVEL, 0,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+ EGL_NATIVE_RENDERABLE, EGL_FALSE,
+ };
+
+ final EGLConfig[] configs = eglDisplay.chooseConfig(pf.getAttribBuffer(eglDisplay, eglSurfaceType, attribs), null, APIUtil.getBufferInt());
+ if ( configs.length == 0 )
+ throw new LWJGLException("No EGLConfigs found for the specified PixelFormat.");
+
+ final EGLConfig eglConfig = pf.getBestMatch(configs);
+ final EGLSurface eglSurface = eglDisplay.createWindowSurface(eglConfig, (int)window, null);
+ pf.setSurfaceAttribs(eglSurface);
+
+ this.eglDisplay = eglDisplay;
+ this.eglConfig = eglConfig;
+ this.eglSurface = eglSurface;
+
+ // This can happen when switching in and out of full-screen mode.
+ if ( context != null )
+ context.getEGLContext().setDisplay(eglDisplay);
+ }
+ }
+
+ public void createContext(final ContextAttribs attribs, final Drawable shared_drawable) throws LWJGLException {
+ synchronized ( GlobalLock.lock ) {
+ this.context = new ContextGLES(this, attribs, shared_drawable != null ? ((DrawableGLES)shared_drawable).getContext() : null);
+ this.shared_drawable = shared_drawable;
+ }
+ }
+
+ Drawable getSharedDrawable() {
+ synchronized ( GlobalLock.lock ) {
+ return shared_drawable;
+ }
+ }
+
+ public EGLDisplay getEGLDisplay() {
+ synchronized ( GlobalLock.lock ) {
+ return eglDisplay;
+ }
+ }
+
+ public EGLConfig getEGLConfig() {
+ synchronized ( GlobalLock.lock ) {
+ return eglConfig;
+ }
+ }
+
+ public EGLSurface getEGLSurface() {
+ synchronized ( GlobalLock.lock ) {
+ return eglSurface;
+ }
+ }
+
+ public ContextGLES getContext() {
+ synchronized ( GlobalLock.lock ) {
+ return context;
+ }
+ }
+
+ public org.lwjgl.opengl.Context createSharedContext() throws LWJGLException {
+ synchronized ( GlobalLock.lock ) {
+ checkDestroyed();
+ return new ContextGLES(this, context.getContextAttribs(), context);
+ }
+ }
+
+ public void checkGLError() {
+ Util.checkGLError();
+ }
+
+ public void setSwapInterval(final int swap_interval) {
+ ContextGLES.setSwapInterval(swap_interval);
+ }
+
+ public void swapBuffers() throws LWJGLException {
+ ContextGLES.swapBuffers();
+ }
+
+ public void initContext(final float r, final float g, final float b) {
+ // set background clear color
+ glClearColor(r, g, b, 0.0f);
+ // Clear window to avoid the desktop "showing through"
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
+
+ public boolean isCurrent() throws LWJGLException {
+ synchronized ( GlobalLock.lock ) {
+ checkDestroyed();
+ return context.isCurrent();
+ }
+ }
+
+ public void makeCurrent() throws LWJGLException, PowerManagementEventException {
+ synchronized ( GlobalLock.lock ) {
+ checkDestroyed();
+ context.makeCurrent();
+ }
+ }
+
+ public void releaseContext() throws LWJGLException, PowerManagementEventException {
+ synchronized ( GlobalLock.lock ) {
+ checkDestroyed();
+ if ( context.isCurrent() )
+ context.releaseCurrent();
+ }
+ }
+
+ public void destroy() {
+ synchronized ( GlobalLock.lock ) {
+ try {
+ if ( context != null ) {
+ try {
+ releaseContext();
+ } catch (PowerManagementEventException e) {
+ // Ignore
+ }
+
+ context.forceDestroy();
+ context = null;
+ }
+
+ if ( eglSurface != null ) {
+ eglSurface.destroy();
+ eglSurface = null;
+ }
+
+ if ( eglDisplay != null ) {
+ eglDisplay.terminate();
+ eglDisplay = null;
+ }
+
+ pixel_format = null;
+ shared_drawable = null;
+ } catch (LWJGLException e) {
+ LWJGLUtil.log("Exception occurred while destroying Drawable: " + e);
+ }
+ }
+ }
+
+ protected void checkDestroyed() {
+ if ( context == null )
+ throw new IllegalStateException("The Drawable has no context available.");
+ }
+
+ public void setCLSharingProperties(final PointerBuffer properties) throws LWJGLException {
+ throw new UnsupportedOperationException();
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengl/DrawableLWJGL.java b/src/java/org/lwjgl/opengl/DrawableLWJGL.java
index b79c806f..ebd85152 100644
--- a/src/java/org/lwjgl/opengl/DrawableLWJGL.java
+++ b/src/java/org/lwjgl/opengl/DrawableLWJGL.java
@@ -3,10 +3,16 @@ package org.lwjgl.opengl;
import org.lwjgl.LWJGLException;
/**
+ * [INTERNAL USE ONLY]
+ *
* @author Spasi
*/
interface DrawableLWJGL extends Drawable {
+ void setPixelFormat(PixelFormatLWJGL pf) throws LWJGLException;
+
+ PixelFormatLWJGL getPixelFormat();
+
/**
* [INTERNAL USE ONLY] Returns the Drawable's Context.
*
@@ -21,4 +27,12 @@ interface DrawableLWJGL extends Drawable {
*/
Context createSharedContext() throws LWJGLException;
-}
+ void checkGLError();
+
+ void setSwapInterval(int swap_interval);
+
+ void swapBuffers() throws LWJGLException;
+
+ void initContext(final float r, final float g, final float b);
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengl/LinuxContextImplementation.java b/src/java/org/lwjgl/opengl/LinuxContextImplementation.java
index f64c9723..6cd3e0d3 100644
--- a/src/java/org/lwjgl/opengl/LinuxContextImplementation.java
+++ b/src/java/org/lwjgl/opengl/LinuxContextImplementation.java
@@ -67,7 +67,7 @@ final class LinuxContextImplementation implements ContextImplementation {
}
public void swapBuffers() throws LWJGLException {
- Context current_context = Context.getCurrentContext();
+ ContextGL current_context = ContextGL.getCurrentContext();
if ( current_context == null )
throw new IllegalStateException("No context is current");
synchronized ( current_context ) {
@@ -89,7 +89,7 @@ final class LinuxContextImplementation implements ContextImplementation {
private static native void nSwapBuffers(ByteBuffer peer_info_handle) throws LWJGLException;
public void releaseCurrentContext() throws LWJGLException {
- Context current_context = Context.getCurrentContext();
+ ContextGL current_context = ContextGL.getCurrentContext();
if ( current_context == null )
throw new IllegalStateException("No context is current");
synchronized ( current_context ) {
@@ -142,7 +142,7 @@ final class LinuxContextImplementation implements ContextImplementation {
private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException;
public void setSwapInterval(int value) {
- Context current_context = Context.getCurrentContext();
+ ContextGL current_context = ContextGL.getCurrentContext();
if ( current_context == null )
throw new IllegalStateException("No context is current");
synchronized ( current_context ) {
diff --git a/src/java/org/lwjgl/opengl/LinuxDisplay.java b/src/java/org/lwjgl/opengl/LinuxDisplay.java
index 2795538b..534e2b35 100644
--- a/src/java/org/lwjgl/opengl/LinuxDisplay.java
+++ b/src/java/org/lwjgl/opengl/LinuxDisplay.java
@@ -50,6 +50,7 @@ import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.opengl.XRandR.Screen;
+import org.lwjgl.opengles.EGL;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -137,7 +138,7 @@ final class LinuxDisplay implements DisplayImplementation {
private boolean xembedded;
private boolean parent_focus;
private boolean mouseInside = true;
-
+
private LinuxKeyboard keyboard;
private LinuxMouse mouse;
@@ -259,7 +260,12 @@ final class LinuxDisplay implements DisplayImplementation {
*/
static void incDisplay() throws LWJGLException {
if (display_connection_usage_count == 0) {
- GLContext.loadOpenGLLibrary();
+ try {
+ // TODO: Can we know if we're on desktop or ES?
+ GLContext.loadOpenGLLibrary();
+ org.lwjgl.opengles.GLContext.loadOpenGLLibrary();
+ } catch (Throwable t) {
+ }
saved_error_handler = setErrorHandler();
display = openDisplay();
// synchronize(display, true);
@@ -408,11 +414,14 @@ final class LinuxDisplay implements DisplayImplementation {
ungrabKeyboard();
}
- public void createWindow(DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
+ public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
lockAWT();
try {
incDisplay();
try {
+ if ( drawable instanceof DrawableGLES )
+ peer_info = new LinuxDisplayPeerInfo();
+
ByteBuffer handle = peer_info.lockAndGetHandle();
try {
current_window_mode = getWindowMode(Display.isFullscreen());
@@ -440,6 +449,9 @@ final class LinuxDisplay implements DisplayImplementation {
grab = false;
minimized = false;
dirty = true;
+
+ if ( drawable instanceof DrawableGLES )
+ ((DrawableGLES)drawable).initialize(current_window, getDisplay(), EGL.EGL_WINDOW_BIT, (org.lwjgl.opengles.PixelFormat)drawable.getPixelFormat());
} finally {
peer_info.unlock();
}
@@ -1446,4 +1458,4 @@ final class LinuxDisplay implements DisplayImplementation {
}
}
-}
\ No newline at end of file
+}
diff --git a/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java b/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java
index 3dbfd2ed..76af84a4 100644
--- a/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java
+++ b/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java
@@ -42,7 +42,16 @@ import org.lwjgl.LWJGLException;
* $Id$
*/
final class LinuxDisplayPeerInfo extends LinuxPeerInfo {
+
+ final boolean egl;
+
+ LinuxDisplayPeerInfo() throws LWJGLException {
+ egl = true;
+ org.lwjgl.opengles.GLContext.loadOpenGLLibrary();
+ }
+
LinuxDisplayPeerInfo(PixelFormat pixel_format) throws LWJGLException {
+ egl = false;
LinuxDisplay.lockAWT();
try {
GLContext.loadOpenGLLibrary();
@@ -80,9 +89,14 @@ final class LinuxDisplayPeerInfo extends LinuxPeerInfo {
public void destroy() {
super.destroy();
- LinuxDisplay.lockAWT();
- LinuxDisplay.decDisplay();
- GLContext.unloadOpenGLLibrary();
- LinuxDisplay.unlockAWT();
+
+ if ( egl )
+ org.lwjgl.opengles.GLContext.unloadOpenGLLibrary();
+ else {
+ LinuxDisplay.lockAWT();
+ LinuxDisplay.decDisplay();
+ GLContext.unloadOpenGLLibrary();
+ LinuxDisplay.unlockAWT();
+ }
}
}
diff --git a/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java b/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java
index 69317b68..9386266f 100644
--- a/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java
+++ b/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java
@@ -55,7 +55,7 @@ final class MacOSXContextImplementation implements ContextImplementation {
private static native ByteBuffer nCreate(ByteBuffer peer_handle, IntBuffer attribs, ByteBuffer shared_context_handle) throws LWJGLException;
public void swapBuffers() throws LWJGLException {
- Context current_context = Context.getCurrentContext();
+ ContextGL current_context = ContextGL.getCurrentContext();
if ( current_context == null )
throw new IllegalStateException("No context is current");
synchronized ( current_context ) {
@@ -83,7 +83,7 @@ final class MacOSXContextImplementation implements ContextImplementation {
private static native void clearDrawable(ByteBuffer handle) throws LWJGLException;
- static void resetView(PeerInfo peer_info, Context context) throws LWJGLException {
+ static void resetView(PeerInfo peer_info, ContextGL context) throws LWJGLException {
ByteBuffer peer_handle = peer_info.lockAndGetHandle();
try {
synchronized ( context ) {
@@ -117,7 +117,7 @@ final class MacOSXContextImplementation implements ContextImplementation {
private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException;
public void setSwapInterval(int value) {
- Context current_context = Context.getCurrentContext();
+ ContextGL current_context = ContextGL.getCurrentContext();
synchronized ( current_context ) {
nSetSwapInterval(current_context.getHandle(), value);
}
diff --git a/src/java/org/lwjgl/opengl/MacOSXDisplay.java b/src/java/org/lwjgl/opengl/MacOSXDisplay.java
index eaccaee2..dc648552 100644
--- a/src/java/org/lwjgl/opengl/MacOSXDisplay.java
+++ b/src/java/org/lwjgl/opengl/MacOSXDisplay.java
@@ -96,7 +96,7 @@ final class MacOSXDisplay implements DisplayImplementation {
}
}
- public void createWindow(DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
+ public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
boolean fullscreen = Display.isFullscreen();
hideUI(fullscreen);
close_requested = false;
@@ -272,7 +272,7 @@ final class MacOSXDisplay implements DisplayImplementation {
*
* - elias
*/
- AbstractDrawable drawable = (AbstractDrawable)Display.getDrawable();
+ DrawableGL drawable = (DrawableGL)Display.getDrawable();
if (Display.isFullscreen() && (frame != null && frame.getCanvas().syncCanvasPainted() || should_update)) {
try {
MacOSXContextImplementation.resetView(drawable.peer_info, drawable.context);
diff --git a/src/java/org/lwjgl/opengl/Pbuffer.java b/src/java/org/lwjgl/opengl/Pbuffer.java
index 65392f71..75a56542 100644
--- a/src/java/org/lwjgl/opengl/Pbuffer.java
+++ b/src/java/org/lwjgl/opengl/Pbuffer.java
@@ -48,7 +48,7 @@ import org.lwjgl.Sys;
* @version $Revision$
* $Id$
*/
-public final class Pbuffer extends AbstractDrawable {
+public final class Pbuffer extends DrawableGL {
/**
* Indicates that Pbuffers can be created.
*/
@@ -222,7 +222,7 @@ public final class Pbuffer extends AbstractDrawable {
shared_context = ((DrawableLWJGL)shared_drawable).getContext();
else
shared_context = ((DrawableLWJGL)Display.getDrawable()).getContext(); // May be null
- this.context = new Context(peer_info, attribs, shared_context);
+ this.context = new ContextGL(peer_info, attribs, (ContextGL)shared_context);
}
private static PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture) throws LWJGLException {
diff --git a/src/java/org/lwjgl/opengl/PixelFormat.java b/src/java/org/lwjgl/opengl/PixelFormat.java
index c3a8a91e..02f14f73 100644
--- a/src/java/org/lwjgl/opengl/PixelFormat.java
+++ b/src/java/org/lwjgl/opengl/PixelFormat.java
@@ -48,7 +48,7 @@ package org.lwjgl.opengl;
* @version $Revision$
*/
-public final class PixelFormat {
+public final class PixelFormat implements PixelFormatLWJGL {
/**
* The number of bits per pixel, exluding alpha.
diff --git a/src/java/org/lwjgl/opengl/PixelFormatLWJGL.java b/src/java/org/lwjgl/opengl/PixelFormatLWJGL.java
new file mode 100644
index 00000000..e3584d8b
--- /dev/null
+++ b/src/java/org/lwjgl/opengl/PixelFormatLWJGL.java
@@ -0,0 +1,11 @@
+package org.lwjgl.opengl;
+
+/**
+ * [INTERNAL USE ONLY]
+ *
+ * @author Spasi
+ * @since 15/5/2011
+ */
+public interface PixelFormatLWJGL {
+ // Marker interface
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengl/SharedDrawable.java b/src/java/org/lwjgl/opengl/SharedDrawable.java
index f96d0f63..72273297 100644
--- a/src/java/org/lwjgl/opengl/SharedDrawable.java
+++ b/src/java/org/lwjgl/opengl/SharedDrawable.java
@@ -44,13 +44,13 @@ import org.lwjgl.LWJGLException;
*
* @author Spasi
*/
-public final class SharedDrawable extends AbstractDrawable {
+public final class SharedDrawable extends DrawableGL {
public SharedDrawable(final Drawable drawable) throws LWJGLException {
- this.context = ((DrawableLWJGL)drawable).createSharedContext();
+ this.context = (ContextGL)((DrawableLWJGL)drawable).createSharedContext();
}
- public Context createSharedContext() {
+ public ContextGL createSharedContext() {
throw new UnsupportedOperationException();
}
diff --git a/src/java/org/lwjgl/opengl/WindowsContextImplementation.java b/src/java/org/lwjgl/opengl/WindowsContextImplementation.java
index a835506b..b81bc5e1 100644
--- a/src/java/org/lwjgl/opengl/WindowsContextImplementation.java
+++ b/src/java/org/lwjgl/opengl/WindowsContextImplementation.java
@@ -60,7 +60,7 @@ final class WindowsContextImplementation implements ContextImplementation {
native long getHDC(ByteBuffer peer_info_handle);
public void swapBuffers() throws LWJGLException {
- Context current_context = Context.getCurrentContext();
+ ContextGL current_context = ContextGL.getCurrentContext();
if ( current_context == null )
throw new IllegalStateException("No context is current");
synchronized ( current_context ) {
diff --git a/src/java/org/lwjgl/opengl/WindowsDisplay.java b/src/java/org/lwjgl/opengl/WindowsDisplay.java
index 560b2c9c..4cfbfc90 100644
--- a/src/java/org/lwjgl/opengl/WindowsDisplay.java
+++ b/src/java/org/lwjgl/opengl/WindowsDisplay.java
@@ -47,8 +47,8 @@ import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.BufferUtils;
import org.lwjgl.input.Cursor;
-import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
+import org.lwjgl.opengles.EGL;
final class WindowsDisplay implements DisplayImplementation {
private static final int GAMMA_LENGTH = 256;
@@ -124,7 +124,6 @@ final class WindowsDisplay implements DisplayImplementation {
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;
@@ -163,7 +162,7 @@ final class WindowsDisplay implements DisplayImplementation {
current_display = this;
}
- public void createWindow(DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
+ public void createWindow(DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
close_requested = false;
is_dirty = false;
isMinimized = false;
@@ -181,12 +180,18 @@ final class WindowsDisplay implements DisplayImplementation {
nDestroyWindow(hwnd);
throw new LWJGLException("Failed to get dc");
}
+
try {
- int format = WindowsPeerInfo.choosePixelFormat(getHdc(), 0, 0, peer_info.getPixelFormat(), null, true, true, false, true);
- WindowsPeerInfo.setPixelFormat(getHdc(), format);
+ if ( drawable instanceof DrawableGL ) {
+ int format = WindowsPeerInfo.choosePixelFormat(getHdc(), 0, 0, (PixelFormat)drawable.getPixelFormat(), null, true, true, false, true);
+ WindowsPeerInfo.setPixelFormat(getHdc(), format);
+ } else {
+ peer_info = new WindowsDisplayPeerInfo(true);
+ ((DrawableGLES)drawable).initialize(hwnd, hdc, EGL.EGL_WINDOW_BIT, (org.lwjgl.opengles.PixelFormat)drawable.getPixelFormat());
+ }
peer_info.initDC(getHwnd(), getHdc());
showWindow(getHwnd(), SW_SHOWDEFAULT);
- if (parent == null) {
+ if ( parent == null ) {
setForegroundWindow(getHwnd());
setFocus(getHwnd());
}
@@ -420,7 +425,7 @@ final class WindowsDisplay implements DisplayImplementation {
}
public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException {
- peer_info = new WindowsDisplayPeerInfo(pixel_format);
+ peer_info = new WindowsDisplayPeerInfo(false);
return peer_info;
}
@@ -971,4 +976,4 @@ final class WindowsDisplay implements DisplayImplementation {
return "Rect: top = " + top + " bottom = " + bottom + " left = " + left + " right = " + right;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/java/org/lwjgl/opengl/WindowsDisplayPeerInfo.java b/src/java/org/lwjgl/opengl/WindowsDisplayPeerInfo.java
index 8af1822e..db51f951 100644
--- a/src/java/org/lwjgl/opengl/WindowsDisplayPeerInfo.java
+++ b/src/java/org/lwjgl/opengl/WindowsDisplayPeerInfo.java
@@ -42,15 +42,16 @@ import org.lwjgl.LWJGLException;
* $Id$
*/
final class WindowsDisplayPeerInfo extends WindowsPeerInfo {
- private final PixelFormat pixel_format;
- WindowsDisplayPeerInfo(PixelFormat pixel_format) throws LWJGLException {
- this.pixel_format = pixel_format;
- GLContext.loadOpenGLLibrary();
- }
+ final boolean egl;
- PixelFormat getPixelFormat() {
- return pixel_format;
+ WindowsDisplayPeerInfo(boolean egl) throws LWJGLException {
+ this.egl = egl;
+
+ if ( egl)
+ org.lwjgl.opengles.GLContext.loadOpenGLLibrary();
+ else
+ GLContext.loadOpenGLLibrary();
}
void initDC(long hwnd, long hdc) throws LWJGLException {
@@ -68,6 +69,10 @@ final class WindowsDisplayPeerInfo extends WindowsPeerInfo {
public void destroy() {
super.destroy();
- GLContext.unloadOpenGLLibrary();
+
+ if ( egl )
+ org.lwjgl.opengles.GLContext.unloadOpenGLLibrary();
+ else
+ GLContext.unloadOpenGLLibrary();
}
}
diff --git a/src/java/org/lwjgl/opengles/APIUtil.java b/src/java/org/lwjgl/opengles/APIUtil.java
new file mode 100644
index 00000000..25489519
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/APIUtil.java
@@ -0,0 +1,322 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.BufferUtils;
+import org.lwjgl.LWJGLUtil;
+import org.lwjgl.PointerBuffer;
+
+import java.nio.ByteBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.ShortBuffer;
+
+/** @author spasi */
+final class APIUtil {
+
+ private static final int INITIAL_BUFFER_SIZE = 256;
+ private static final int INITIAL_LENGTHS_SIZE = 4;
+
+ private static final int BUFFERS_SIZE = 32;
+
+ private static final ThreadLocal arrayTL = new ThreadLocal() {
+ protected char[] initialValue() { return new char[INITIAL_BUFFER_SIZE]; }
+ };
+
+ private static final ThreadLocal bufferTL = new ThreadLocal() {
+ protected ByteBuffer initialValue() { return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); }
+ };
+
+ private static final ThreadLocal bufferPointerTL = new ThreadLocal() {
+ protected PointerBuffer initialValue() { return BufferUtils.createPointerBuffer(INITIAL_BUFFER_SIZE); }
+ };
+
+ private static final ThreadLocal lengthsTL = new ThreadLocal() {
+ protected IntBuffer initialValue() { return BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE); }
+ };
+
+ private static final ThreadLocal buffersTL = new ThreadLocal() {
+ protected Buffers initialValue() { return new Buffers(); }
+ };
+
+ private APIUtil() {
+ }
+
+ private static char[] getArray(final int size) {
+ char[] array = arrayTL.get();
+
+ if ( array.length < size ) {
+ int sizeNew = array.length << 1;
+ while ( sizeNew < size )
+ sizeNew <<= 1;
+
+ array = new char[size];
+ arrayTL.set(array);
+ }
+
+ return array;
+ }
+
+ static ByteBuffer getBufferByte(final int size) {
+ ByteBuffer buffer = bufferTL.get();
+
+ if ( buffer.capacity() < size ) {
+ int sizeNew = buffer.capacity() << 1;
+ while ( sizeNew < size )
+ sizeNew <<= 1;
+
+ buffer = BufferUtils.createByteBuffer(size);
+ bufferTL.set(buffer);
+ } else
+ buffer.clear();
+
+ return buffer;
+ }
+
+ private static ByteBuffer getBufferByteOffset(final int size) {
+ ByteBuffer buffer = bufferTL.get();
+
+ if ( buffer.capacity() < size ) {
+ int sizeNew = buffer.capacity() << 1;
+ while ( sizeNew < size )
+ sizeNew <<= 1;
+
+ final ByteBuffer bufferNew = BufferUtils.createByteBuffer(size);
+ bufferNew.put(buffer);
+ bufferTL.set(buffer = bufferNew);
+ } else {
+ buffer.position(buffer.limit());
+ buffer.limit(buffer.capacity());
+ }
+
+ return buffer;
+ }
+
+ static 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 FloatBuffer getBufferFloat() { return buffersTL.get().floats; }
+
+ static PointerBuffer getBufferPointer() { return buffersTL.get().pointers; }
+
+ 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 FloatBuffer floats;
+
+ final PointerBuffer pointers;
+
+ Buffers() {
+ shorts = BufferUtils.createShortBuffer(BUFFERS_SIZE);
+ ints = BufferUtils.createIntBuffer(BUFFERS_SIZE);
+ floats = BufferUtils.createFloatBuffer(BUFFERS_SIZE);
+
+ pointers = BufferUtils.createPointerBuffer(BUFFERS_SIZE);
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengles/ContextAttribs.java b/src/java/org/lwjgl/opengles/ContextAttribs.java
new file mode 100644
index 00000000..1aae14eb
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/ContextAttribs.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.BufferUtils;
+
+import java.nio.IntBuffer;
+
+import static org.lwjgl.opengles.EGL.*;
+
+/**
+ * This class represents the context attributes passed to EGL's eglCreateContext.
+ * The only attribute allowed is EGL_CONTEXT_CLIENT_VERSION and it must be 2 (LWJGL does not support GLES 1.x).
+ */
+public final class ContextAttribs {
+
+ private int version;
+
+ public ContextAttribs() {
+ this(2);
+ }
+
+ public ContextAttribs(final int version) {
+ if ( version != 2 )
+ throw new IllegalArgumentException("Invalid OpenGL ES version specified: " + version);
+
+ this.version = version;
+ }
+
+ private ContextAttribs(final ContextAttribs attribs) {
+ this.version = attribs.version;
+ }
+
+ public int getVersion() {
+ return version;
+ }
+
+ public IntBuffer getAttribList() {
+ int attribCount = 1;
+
+ final IntBuffer attribs = BufferUtils.createIntBuffer((attribCount * 2) + 1);
+
+ attribs.put(EGL_CONTEXT_CLIENT_VERSION).put(version);
+
+ attribs.put(EGL_NONE);
+ attribs.rewind();
+ return attribs;
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder(32);
+
+ sb.append("ContextAttribs:");
+ sb.append(" Version=").append(version);
+
+ return sb.toString();
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengles/EGL.java b/src/java/org/lwjgl/opengles/EGL.java
new file mode 100644
index 00000000..86b2348e
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/EGL.java
@@ -0,0 +1,922 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.BufferChecks;
+import org.lwjgl.LWJGLException;
+import org.lwjgl.PointerBuffer;
+
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+/** EGL wrapper class. */
+public final class EGL {
+
+ /** EGL aliases */
+ public static final int
+ EGL_FALSE = 0,
+ EGL_TRUE = 1;
+
+ /** Out-of-band handle values */
+ public static final int
+ EGL_DEFAULT_DISPLAY = 0,
+ EGL_NO_CONTEXT = 0,
+ EGL_NO_DISPLAY = 0,
+ EGL_NO_SURFACE = 0;
+
+ /** Out-of-band attribute value */
+ public static final int EGL_DONT_CARE = -1;
+
+ /** Errors / GetError return values */
+ public static final int
+ EGL_SUCCESS = 0x3000,
+ EGL_NOT_INITIALIZED = 0x3001,
+ EGL_BAD_ACCESS = 0x3002,
+ EGL_BAD_ALLOC = 0x3003,
+ EGL_BAD_ATTRIBUTE = 0x3004,
+ EGL_BAD_CONFIG = 0x3005,
+ EGL_BAD_CONTEXT = 0x3006,
+ EGL_BAD_CURRENT_SURFACE = 0x3007,
+ EGL_BAD_DISPLAY = 0x3008,
+ EGL_BAD_MATCH = 0x3009,
+ EGL_BAD_NATIVE_PIXMAP = 0x300A,
+ EGL_BAD_NATIVE_WINDOW = 0x300B,
+ EGL_BAD_PARAMETER = 0x300C,
+ EGL_BAD_SURFACE = 0x300D,
+ EGL_CONTEXT_LOST = 0x300E; // EGL 1.1 - IMG_power_management
+
+ /** Reserved =0x300F;-=0x301F; for additional errors */
+
+ /** Config attributes */
+ public static final int
+ EGL_BUFFER_SIZE = 0x3020,
+ EGL_ALPHA_SIZE = 0x3021,
+ EGL_BLUE_SIZE = 0x3022,
+ EGL_GREEN_SIZE = 0x3023,
+ EGL_RED_SIZE = 0x3024,
+ EGL_DEPTH_SIZE = 0x3025,
+ EGL_STENCIL_SIZE = 0x3026,
+ EGL_CONFIG_CAVEAT = 0x3027,
+ EGL_CONFIG_ID = 0x3028,
+ EGL_LEVEL = 0x3029,
+ EGL_MAX_PBUFFER_HEIGHT = 0x302A,
+ EGL_MAX_PBUFFER_PIXELS = 0x302B,
+ EGL_MAX_PBUFFER_WIDTH = 0x302C,
+ EGL_NATIVE_RENDERABLE = 0x302D,
+ EGL_NATIVE_VISUAL_ID = 0x302E,
+ EGL_NATIVE_VISUAL_TYPE = 0x302F,
+ EGL_SAMPLES = 0x3031,
+ EGL_SAMPLE_BUFFERS = 0x3032,
+ EGL_SURFACE_TYPE = 0x3033,
+ EGL_TRANSPARENT_TYPE = 0x3034,
+ EGL_TRANSPARENT_BLUE_VALUE = 0x3035,
+ EGL_TRANSPARENT_GREEN_VALUE = 0x3036,
+ EGL_TRANSPARENT_RED_VALUE = 0x3037,
+ EGL_NONE = 0x3038, // Attrib list terminator
+ EGL_BIND_TO_TEXTURE_RGB = 0x3039,
+ EGL_BIND_TO_TEXTURE_RGBA = 0x303A,
+ EGL_MIN_SWAP_INTERVAL = 0x303B,
+ EGL_MAX_SWAP_INTERVAL = 0x303C,
+ EGL_LUMINANCE_SIZE = 0x303D,
+ EGL_ALPHA_MASK_SIZE = 0x303E,
+ EGL_COLOR_BUFFER_TYPE = 0x303F,
+ EGL_RENDERABLE_TYPE = 0x3040,
+ EGL_MATCH_NATIVE_PIXMAP = 0x3041, // Pseudo-attribute (not queryable)
+ EGL_CONFORMANT = 0x3042;
+
+ /** Reserved =0x3041;-=0x304F; for additional config attributes */
+
+ /** Config attribute values */
+ public static final int
+ EGL_SLOW_CONFIG = 0x3050, // EGL_CONFIG_CAVEAT value
+ EGL_NON_CONFORMANT_CONFIG = 0x3051, // EGL_CONFIG_CAVEAT value
+ EGL_TRANSPARENT_RGB = 0x3052, // EGL_TRANSPARENT_TYPE value
+ EGL_RGB_BUFFER = 0x308E, // EGL_COLOR_BUFFER_TYPE value
+ EGL_LUMINANCE_BUFFER = 0x308F; // EGL_COLOR_BUFFER_TYPE value
+
+ /** More config attribute values, for EGL_TEXTURE_FORMAT */
+ public static final int
+ EGL_NO_TEXTURE = 0x305C,
+ EGL_TEXTURE_RGB = 0x305D,
+ EGL_TEXTURE_RGBA = 0x305E,
+ EGL_TEXTURE_2D = 0x305F;
+
+ /** EGL_SURFACE_TYPE mask bits */
+ public static final int
+ EGL_PBUFFER_BIT = 0x0001,
+ EGL_PIXMAP_BIT = 0x0002,
+ EGL_WINDOW_BIT = 0x0004,
+ EGL_VG_COLORSPACE_LINEAR_BIT = 0x0020,
+ EGL_VG_ALPHA_FORMAT_PRE_BIT = 0x0040,
+ EGL_MULTISAMPLE_RESOLVE_BOX_BIT = 0x0200,
+ EGL_SWAP_BEHAVIOR_PRESERVED_BIT = 0x0400;
+
+ /** EGL_RENDERABLE_TYPE mask bits */
+ public static final int
+ EGL_OPENGL_ES_BIT = 0x0001,
+ EGL_OPENVG_BIT = 0x0002,
+ EGL_OPENGL_ES2_BIT = 0x0004,
+ EGL_OPENGL_BIT = 0x0008;
+
+ /** QueryString targets */
+ public static final int
+ EGL_VENDOR = 0x3053,
+ EGL_VERSION = 0x3054,
+ EGL_EXTENSIONS = 0x3055,
+ EGL_CLIENT_APIS = 0x308D;
+
+ /** QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */
+ public static final int
+ EGL_HEIGHT = 0x3056,
+ EGL_WIDTH = 0x3057,
+ EGL_LARGEST_PBUFFER = 0x3058,
+ EGL_TEXTURE_FORMAT = 0x3080,
+ EGL_TEXTURE_TARGET = 0x3081,
+ EGL_MIPMAP_TEXTURE = 0x3082,
+ EGL_MIPMAP_LEVEL = 0x3083,
+ EGL_RENDER_BUFFER = 0x3086,
+ EGL_VG_COLORSPACE = 0x3087,
+ EGL_VG_ALPHA_FORMAT = 0x3088,
+ EGL_HORIZONTAL_RESOLUTION = 0x3090,
+ EGL_VERTICAL_RESOLUTION = 0x3091,
+ EGL_PIXEL_ASPECT_RATIO = 0x3092,
+ EGL_SWAP_BEHAVIOR = 0x3093,
+ EGL_MULTISAMPLE_RESOLVE = 0x3099;
+
+ /** EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */
+ public static final int
+ EGL_BACK_BUFFER = 0x3084,
+ EGL_SINGLE_BUFFER = 0x3085;
+
+ /** OpenVG color spaces */
+ public static final int
+ EGL_VG_COLORSPACE_sRGB = 0x3089, // EGL_VG_COLORSPACE value
+ EGL_VG_COLORSPACE_LINEAR = 0x308A; // EGL_VG_COLORSPACE value
+
+ /** OpenVG alpha formats */
+ public static final int
+ EGL_VG_ALPHA_FORMAT_NONPRE = 0x308B, // EGL_ALPHA_FORMAT value
+ EGL_VG_ALPHA_FORMAT_PRE = 0x308C; // EGL_ALPHA_FORMAT
+
+ /**
+ * Constant scale factor by which fractional display resolutions &
+ * aspect ratio are scaled when queried as integer values.
+ */
+ public static final int EGL_DISPLAY_SCALING = 10000;
+
+ /** Unknown display resolution/aspect ratio */
+ public static final int EGL_UNKNOWN = -1;
+
+ /** Back buffer swap behaviors */
+ public static final int
+ EGL_BUFFER_PRESERVED = 0x3094, // EGL_SWAP_BEHAVIOR value
+ EGL_BUFFER_DESTROYED = 0x3095; // EGL_SWAP_BEHAVIOR value
+
+ /** CreatePbufferFromClientBuffer buffer types */
+ static final int EGL_OPENVG_IMAGE = 0x3096;
+
+ /** QueryContext targets */
+ public static final int EGL_CONTEXT_CLIENT_TYPE = 0x3097;
+
+ /** CreateContext attributes */
+ public static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
+
+ /** Multisample resolution behaviors */
+ public static final int
+ EGL_MULTISAMPLE_RESOLVE_DEFAULT = 0x309A, // EGL_MULTISAMPLE_RESOLVE value
+ EGL_MULTISAMPLE_RESOLVE_BOX = 0x309B; // EGL_MULTISAMPLE_RESOLVE value
+
+ /** BindAPI/QueryAPI targets */
+ public static final int
+ EGL_OPENGL_ES_API = 0x30A0,
+ EGL_OPENVG_API = 0x30A1,
+ EGL_OPENGL_API = 0x30A2;
+
+ /** GetCurrentSurface targets */
+ public static final int
+ EGL_DRAW = 0x3059,
+ EGL_READ = 0x305A;
+
+ /** WaitNative engines */
+ static final int EGL_CORE_NATIVE_ENGINE = 0x305B;
+
+ private EGL() {
+ }
+
+ public static native int eglGetError();
+
+ /**
+ * Obtains an EGL display from the specified native display and initializes it.
+ *
+ * @param display_id the handle to the native display.
+ *
+ * @return the EGL Display
+ *
+ * @throws org.lwjgl.LWJGLException if no display is available or an EGL error occurs
+ */
+ public static EGLDisplay eglGetDisplay(long display_id) throws LWJGLException {
+ //LWJGLUtil.log("eglGetDisplay");
+ final long pointer = neglGetDisplay(display_id);
+
+ if ( pointer == EGL_NO_DISPLAY ) // No error is generated when this happens
+ throw new LWJGLException("Failed to get EGL display from native display handle: " + display_id);
+
+ return new EGLDisplay(pointer);
+ }
+
+ private static native long neglGetDisplay(long display_id);
+
+ /**
+ * Initializes the specified EGL display.
+ *
+ * @param dpy the EGL display to initialize
+ * @param version the EGL major and minor version will be returned in this buffer.
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ static void eglInitialize(EGLDisplay dpy, IntBuffer version) throws LWJGLException {
+ //LWJGLUtil.log("eglInitialize");
+ BufferChecks.checkBuffer(version, 2);
+ if ( !neglInitialize(dpy.getPointer(), version, version.position()) )
+ throwEGLError("Failed to initialize EGL display.");
+ }
+
+ private static native boolean neglInitialize(long dpy_ptr, IntBuffer version, int version_position);
+
+ /**
+ * Release the resources associated with the specified EGL display.
+ *
+ * @param dpy the EGL display to terminate
+ */
+ static void eglTerminate(EGLDisplay dpy) throws LWJGLException {
+ //LWJGLUtil.log("eglTerminate");
+ if ( !neglTerminate(dpy.getPointer()) )
+ throwEGLError("Failed to terminate EGL display.");
+ }
+
+ private static native boolean neglTerminate(long dpy_ptr);
+
+ /**
+ * Returns a string describing some aspect of the EGL implementation running on the specified display.
+ *
+ * @param dpy the EGL display to query
+ * @param name the value to query
+ *
+ * @return the description
+ */
+ public static String eglQueryString(EGLDisplay dpy, int name) {
+ //LWJGLUtil.log("eglQueryString");
+ return neglQueryString(dpy.getPointer(), name);
+ }
+
+ private static native String neglQueryString(long dpy, int name);
+
+ /**
+ * Returns the number of EGLConfigs that are available on the specified display.
+ *
+ * @param dpy the EGLDisplay
+ *
+ * @return the number of EGLConfigs available
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ * @see #eglGetConfigs(EGLDisplay, EGLConfig[], IntBuffer)
+ */
+ static int eglGetConfigsNum(EGLDisplay dpy) throws LWJGLException {
+ //LWJGLUtil.log("eglGetConfigsNum");
+ IntBuffer num_config = APIUtil.getBufferInt();
+
+ if ( !neglGetConfigs(dpy.getPointer(), null, 0, 0, num_config, num_config.position()) )
+ throwEGLError("Failed to get EGL configs.");
+
+ return num_config.get(0);
+ }
+
+ /**
+ * Returns the available EGLConfigs on the speficied display. The number of available EGLConfigs
+ * is returned in the num_config parameter. The configs array may be null. If it is null, a new
+ * array will be allocated, with size equal to the result of {@link #eglGetConfigsNum(EGLDisplay)} eglGetConfigsNum}.
+ * If it is not null, no more than {@code configs.length} EGLConfigs will be returned. If the array is bigger
+ * than the number of available EGLConfigs, the remaining array elements will not be affected.
+ *
+ * @param dpy the EGLDisplay
+ * @param configs the EGLConfigs array
+ * @param num_config the number of available EGLConfigs returned
+ *
+ * @return the available EGLConfigs
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ static EGLConfig[] eglGetConfigs(EGLDisplay dpy, EGLConfig[] configs, IntBuffer num_config) throws LWJGLException {
+ //LWJGLUtil.log("eglGetConfigs");
+ BufferChecks.checkBuffer(num_config, 1);
+
+ if ( configs == null ) {
+ if ( !neglGetConfigs(dpy.getPointer(), null, 0, 0, num_config, num_config.position()) )
+ throwEGLError("Failed to get number of available EGL configs.");
+
+ configs = new EGLConfig[num_config.get(num_config.position())];
+ }
+
+ final PointerBuffer configs_buffer = APIUtil.getBufferPointer(configs.length);
+ if ( !neglGetConfigs(dpy.getPointer(), configs_buffer.getBuffer(), 0, configs.length, num_config, num_config.position()) )
+ throwEGLError("Failed to get EGL configs.");
+
+ final int config_size = num_config.get(num_config.position());
+ for ( int i = 0; i < config_size; i++ )
+ configs[i] = new EGLConfig(dpy, configs_buffer.get(i));
+
+ return configs;
+ }
+
+ private static native boolean neglGetConfigs(long dpy_ptr, ByteBuffer configs, int configs_position, int config_size, IntBuffer num_config, int num_config_position);
+
+ /**
+ * Returns the number of EGLConfigs that are available on the specified display and
+ * match the speficied list of attributes.
+ *
+ * @param dpy the EGLDisplay
+ * @param attrib_list the attribute list (may be null)
+ *
+ * @return the number of EGLConfigs available that satisft the attribute list
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ * @see #eglChooseConfig(EGLDisplay, IntBuffer, EGLConfig[], IntBuffer)
+ */
+ static int eglChooseConfigNum(EGLDisplay dpy, IntBuffer attrib_list) throws LWJGLException {
+ //LWJGLUtil.log("eglChooseConfigNum");
+ checkAttribList(attrib_list);
+ IntBuffer num_config = APIUtil.getBufferInt();
+
+ if ( !neglChooseConfig(dpy.getPointer(), attrib_list, attrib_list == null ? 0 : attrib_list.position(), null, 0, 0, num_config, num_config.position()) )
+ throwEGLError("Failed to get EGL configs.");
+
+ return num_config.get(0);
+ }
+
+ /**
+ * Returns the available EGLConfigs on the speficied display that satisfy the specified list of attributes.
+ * The number of available EGLConfigs is returned in the num_config parameter. The configs array may be null.
+ * If it is null, a new array will be allocated, with size equal to the result of {@link #eglGetConfigsNum(EGLDisplay)} eglGetConfigsNum}.
+ * If it is not null, no more than {@code configs.length} EGLConfigs will be returned. If the array is bigger
+ * than the number of available EGLConfigs, the remaining array elements will not be affected.
+ *
+ * @param dpy the EGLDisplay
+ * @param attrib_list the attribute list (may be null)
+ * @param configs the EGLConfigs array
+ * @param num_config the number of available EGLConfigs returned
+ *
+ * @return the available EGLConfigs that satisfy the attribute list
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ static EGLConfig[] eglChooseConfig(EGLDisplay dpy, IntBuffer attrib_list, EGLConfig[] configs, IntBuffer num_config) throws LWJGLException {
+ //LWJGLUtil.log("eglChooseConfig");
+ checkAttribList(attrib_list);
+ BufferChecks.checkBuffer(num_config, 1);
+
+ int config_size;
+ if ( configs == null ) {
+ if ( !neglChooseConfig(dpy.getPointer(), attrib_list, attrib_list == null ? 0 : attrib_list.position(), null, 0, 0, num_config, num_config.position()) )
+ throwEGLError("Failed to get number of available EGL configs.");
+
+ config_size = num_config.get(num_config.position());
+ } else
+ config_size = configs.length;
+
+ //LWJGLUtil.log("config_size = " + config_size);
+ PointerBuffer configs_buffer = APIUtil.getBufferPointer(config_size);
+ if ( !neglChooseConfig(dpy.getPointer(), attrib_list, attrib_list == null ? 0 : attrib_list.position(), configs_buffer.getBuffer(), 0, config_size, num_config, num_config.position()) )
+ throwEGLError("Failed to choose EGL config.");
+
+ // Get the true number of configurations (the first neglChooseConfig call may return more than the second)
+ config_size = num_config.get(num_config.position());
+ if ( configs == null )
+ configs = new EGLConfig[config_size];
+ for ( int i = 0; i < config_size; i++ )
+ configs[i] = new EGLConfig(dpy, configs_buffer.get(i));
+
+ return configs;
+ }
+
+ private static native boolean neglChooseConfig(long dpy_ptr, IntBuffer attrib_list, int attrib_list_position, ByteBuffer configs, int configs_position, int config_size, IntBuffer num_config, int num_config_position);
+
+ /**
+ * Returns the value of an EGL config attribute.
+ *
+ * @param dpy the EGL display
+ * @param config the EGL config
+ * @param attribute the attribute
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ static int eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, int attribute) throws LWJGLException {
+ //LWJGLUtil.log("eglGetConfigAttrib");
+ final IntBuffer value = APIUtil.getBufferInt();
+
+ if ( !neglGetConfigAttrib(dpy.getPointer(), config.getPointer(), attribute, value, value.position()) )
+ throwEGLError("Failed to get EGL config attribute.");
+
+ return value.get(0);
+ }
+
+ private static native boolean neglGetConfigAttrib(long dpy_ptr, long config_ptr, int attribute, IntBuffer value, int value_position);
+
+ /**
+ * Creates an on-screen rendering surface on the specified EGL display.
+ *
+ * @param dpy the EGL display
+ * @param config the EGL config
+ * @param win the native window handle
+ * @param attrib_list an attribute list (may be null)
+ *
+ * @return the created EGL surface
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ static EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, long win, IntBuffer attrib_list) throws LWJGLException {
+ //LWJGLUtil.log("eglCreateWindowSurface");
+ checkAttribList(attrib_list);
+ final long pointer = neglCreateWindowSurface(dpy.getPointer(), config.getPointer(), win, attrib_list, attrib_list == null ? 0 : attrib_list.position());
+
+ if ( pointer == EGL_NO_SURFACE )
+ throwEGLError("Failed to create EGL window surface.");
+
+ return new EGLSurface(dpy, config, pointer);
+ }
+
+ private static native long neglCreateWindowSurface(long dpy_ptr, long config_ptr, long win, IntBuffer attrib_list, int attrib_list_position);
+
+ /**
+ * Creates an off-screen rendering surface on the specified EGL display.
+ *
+ * @param dpy the EGL display
+ * @param config the EGL config
+ * @param attrib_list an attribute list (may be null)
+ *
+ * @return the created EGL surface
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ static EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, IntBuffer attrib_list) throws LWJGLException {
+ //LWJGLUtil.log("eglCreatePbufferSurface");
+ checkAttribList(attrib_list);
+ final long pointer = neglCreatePbufferSurface(dpy.getPointer(), config.getPointer(), attrib_list, attrib_list == null ? 0 : attrib_list.position());
+
+ if ( pointer == EGL_NO_SURFACE )
+ throwEGLError("Failed to create EGL pbuffer surface.");
+
+ return new EGLSurface(dpy, config, pointer);
+ }
+
+ private static native long neglCreatePbufferSurface(long dpy_ptr, long config_ptr, IntBuffer attrib_list, int attrib_list_position);
+
+ /*
+ EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
+ */
+
+ /**
+ * Sets the specified EGL surface attribute to the specified value.
+ *
+ * @param dpy the EGL display
+ * @param surface the EGL surface
+ * @param attribute the attribute
+ * @param value the attribute value
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ static void eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, int attribute, int value) throws LWJGLException {
+ //LWJGLUtil.log("eglSurfaceAttrib");
+ if ( !neglSurfaceAttrib(dpy.getPointer(), surface.getPointer(), attribute, value) )
+ throwEGLError("Failed to set surface attribute.");
+ }
+
+ private static native boolean neglSurfaceAttrib(long dpy_ptr, long surface_ptr, int attribute, int value);
+
+ /**
+ * Destroys the specified EGL surface.
+ *
+ * @param dpy the EGL display
+ * @param surface the EGL surface to destroy
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ static void eglDestroySurface(EGLDisplay dpy, EGLSurface surface) throws LWJGLException {
+ //LWJGLUtil.log("eglDestroySurface");
+ if ( !neglDestroySurface(dpy.getPointer(), surface.getPointer()) )
+ throwEGLError("Failed to destroy EGL surface.");
+ }
+
+ private static native boolean neglDestroySurface(long dpy_ptr, long surface_ptr);
+
+ /**
+ * Returns the value of the specified EGL surface attribute in the value parameter.
+ *
+ * @param dpy the EGL display
+ * @param surface the EGL surface
+ * @param attribute the surface attribute
+ * @param value the attribute value will be returned here
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ public static void eglQuerySurface(EGLDisplay dpy, EGLSurface surface, int attribute, IntBuffer value) throws LWJGLException {
+ //LWJGLUtil.log("eglQuerySurface");
+ BufferChecks.checkBuffer(value, 1);
+ if ( !neglQuerySurface(dpy.getPointer(), surface.getPointer(), attribute, value, value.position()) )
+ throwEGLError("Failed to query surface attribute.");
+ }
+
+ private static native boolean neglQuerySurface(long dpy_ptr, long surface_ptr, int attribute, IntBuffer value, int value_position);
+
+ /**
+ * Binds the specified rendering API to the current thread.
+ *
+ * @param api the API to bind
+ *
+ * @return true if the bind was successful, false if an EGL error occurs
+ */
+ public static native boolean eglBindAPI(int api);
+
+ /**
+ * Returns the current rendering API.
+ *
+ * @return the rendering API bound to the current thread
+ */
+ public static native int eglQueryAPI();
+
+ /**
+ * Returns EGL to its state at thread initialization. This includes the following:
+ *
+ * For each client API supported by EGL, if there is a currently bound context,
+ * that context is released. This is equivalent to calling eglMakeCurrent
+ * with ctx set to EGL_NO_CONTEXT and both draw and read set to EGL_NO_SURFACE
+ *
+ * The current rendering API is reset to its value at thread initialization
+ * Any additional implementation-dependent per-thread state maintained by EGL
+ * is marked for deletion as soon as possible.
+ *
+ * @return true if thread state was released successfully, false is an EGL error occurs
+ */
+ static native boolean eglReleaseThread();
+
+ /*
+ EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
+ EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+ EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+ */
+
+ /**
+ * Specifies the minimum number of video frame periods per buffer swap for
+ * the window associated with the current context.
+ *
+ * @param dpy the EGL display
+ * @param interval the frame interval
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ static void eglSwapInterval(EGLDisplay dpy, int interval) throws LWJGLException {
+ //LWJGLUtil.log("eglSwapInterval");
+ if ( !neglSwapInterval(dpy.getPointer(), interval) )
+ throwEGLError("Failed to set swap interval.");
+ }
+
+ private static native boolean neglSwapInterval(long dpy_ptr, int interval);
+
+ /**
+ * Creates a new EGL context for the current rendering API.
+ *
+ * @param dpy the EGL display
+ * @param config the EGL config
+ * @param share_context the EGL context to share data with
+ * @param attrib_list the attribute list (may be null)
+ *
+ * @return the created EGL context
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ static EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, IntBuffer attrib_list) throws LWJGLException {
+ //LWJGLUtil.log("eglCreateContext");
+ checkAttribList(attrib_list);
+ final long pointer = neglCreateContext(dpy.getPointer(), config.getPointer(),
+ share_context == null ? EGL_NO_CONTEXT : share_context.getPointer(),
+ attrib_list, attrib_list == null ? 0 : attrib_list.position());
+
+ if ( pointer == EGL_NO_CONTEXT )
+ throwEGLError("Failed to create EGL context.");
+
+ return new EGLContext(dpy, config, pointer);
+ }
+
+ private static native long neglCreateContext(long dpy_ptr, long config_ptr, long share_context_ptr, IntBuffer attrib_list, int attrib_list_position);
+
+ /**
+ * Destroys a rendering context.
+ *
+ * @param dpy the EGL display
+ * @param ctx the EGL context
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ static void eglDestroyContext(EGLDisplay dpy, EGLContext ctx) throws LWJGLException {
+ //LWJGLUtil.log("eglDestroyContext");
+ if ( !neglDestroyContext(dpy.getPointer(), ctx.getPointer()) )
+ throwEGLError("Failed to destroy context.");
+ }
+
+ private static native boolean neglDestroyContext(long dpy_ptr, long ctx_ptr);
+
+ /**
+ * Binds the specified context to the current thread and to the draw and read surfaces.
+ *
+ * @param dpy the EGL display
+ * @param draw the draw EGL surface
+ * @param read the read EGL surface
+ * @param ctx the EGL context to make current
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ * @throws PowerManagementEventException if an EGL power management event occurs
+ */
+ static void eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) throws LWJGLException, PowerManagementEventException {
+ //LWJGLUtil.log("eglMakeCurrent");
+ if ( !neglMakeCurrent(dpy.getPointer(),
+ draw == null ? EGL_NO_SURFACE : draw.getPointer(),
+ read == null ? EGL_NO_SURFACE : read.getPointer(),
+ ctx == null ? EGL_NO_CONTEXT : ctx.getPointer()) ) {
+ final int error = eglGetError();
+ if ( error == EGL_CONTEXT_LOST )
+ throw new PowerManagementEventException();
+ else
+ throwEGLError("Failed to change the current context.", error);
+ }
+ }
+
+ /**
+ * Releases the current context without assigning a new one.
+ *
+ * @param dpy the EGL display
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ * @throws PowerManagementEventException if an EGL power management event occurs
+ * @see #eglMakeCurrent(EGLDisplay, EGLSurface, EGLSurface, EGLContext)
+ */
+ public static void eglReleaseCurrent(EGLDisplay dpy) throws LWJGLException, PowerManagementEventException {
+ //LWJGLUtil.log("eglReleaseCurrent");
+ eglMakeCurrent(dpy, null, null, null);
+ }
+
+ private static native boolean neglMakeCurrent(long dpy_ptr, long draw_ptr, long read_ptr, long ctx_ptr);
+
+ /**
+ * Returns the current EGL context for the current rendering API.
+ * If there is no context current, null is returned.
+ *
+ * @return the current context
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ public static EGLContext eglGetCurrentContext() throws LWJGLException {
+ //LWJGLUtil.log("eglGetCurrentContext");
+ // Get current context
+ final long ctx = neglGetCurrentContext();
+ if ( ctx == EGL_NO_CONTEXT )
+ return null;
+
+ // Get current display
+ final EGLDisplay display = eglGetCurrentDisplay();
+
+ // Query context's CONFIG_ID
+ final IntBuffer attrib_list = APIUtil.getBufferInt();
+ neglQueryContext(display.getPointer(), ctx, EGL_CONFIG_ID, attrib_list, 0);
+
+ final EGLConfig config = getEGLConfig(display, attrib_list);
+
+ // Create the context handle
+ return new EGLContext(display, config, ctx);
+ }
+
+ /**
+ * Returns true if the specified EGL context is the current context.
+ * This method is faster than using {@code #eglGetCurrentContext}
+ * and comparing the two EGLContext objects.
+ *
+ * @param context the EGL context
+ *
+ * @return true if the EGL context is current
+ *
+ * @see #eglGetCurrentContext()
+ */
+ public static boolean eglIsCurrentContext(EGLContext context) {
+ //LWJGLUtil.log("eglIsCurrentContext");
+ return neglGetCurrentContext() == context.getPointer();
+ }
+
+ private static native long neglGetCurrentContext();
+
+ /**
+ * Returns the EGL surfaces used for rendering by the current context.
+ * If there is no context current, null is returned.
+ *
+ * @param readdraw the read or draw surface
+ *
+ * @return the current surface
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ public static EGLSurface eglGetCurrentSurface(int readdraw) throws LWJGLException {
+ //LWJGLUtil.log("eglGetCurrentSurface");
+ final long surface = neglGetCurrentSurface(readdraw);
+ if ( surface == EGL_NO_SURFACE )
+ return null;
+
+ // Get current display
+ EGLDisplay display = eglGetCurrentDisplay();
+
+ // Query context's CONFIG_ID
+ final IntBuffer attrib_list = APIUtil.getBufferInt();
+ if ( !neglQuerySurface(display.getPointer(), surface, EGL_CONFIG_ID, attrib_list, 0) )
+ throwEGLError("Failed to query surface EGL config ID.");
+
+ final EGLConfig config = getEGLConfig(display, attrib_list);
+
+ // Create the surface handle
+ return new EGLSurface(display, config, surface);
+ }
+
+ private static native long neglGetCurrentSurface(int readdraw);
+
+ /**
+ * Returns the EGL display associated with the current context.
+ *
+ * @return the current display
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ public static EGLDisplay eglGetCurrentDisplay() throws LWJGLException {
+ //LWJGLUtil.log("eglGetCurrentDisplay");
+ return new EGLDisplay(neglGetCurrentDisplay());
+ }
+
+ private static native long neglGetCurrentDisplay();
+
+ /**
+ * Returns the value of the specified EGL context attribute in the value parameter.
+ *
+ * @param dpy the EGL display
+ * @param ctx the EGL context
+ * @param attribute the context attribute
+ * @param value the attribute value will be returned here
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ public static void eglQueryContext(EGLDisplay dpy, EGLContext ctx, int attribute, IntBuffer value) throws LWJGLException {
+ //LWJGLUtil.log("eglQueryContext");
+ BufferChecks.checkBuffer(value, 1);
+ if ( !neglQueryContext(dpy.getPointer(), ctx.getPointer(), attribute, value, value.position()) )
+ throwEGLError("Failed to query context attribute.");
+ }
+
+ private static native boolean neglQueryContext(long dpy_ptr, long ctx_ptr, int attribute, IntBuffer value, int value_position);
+
+ /**
+ * Prevents native rendering API functions from executing until any
+ * outstanding client API rendering affecting the same surface is complete.
+ *
+ * @return true if the wait was successful, false is an EGL error occurs
+ */
+ public static native boolean eglWaitClient();
+
+ /**
+ * This method does the equivalent of:
+ *
+ * EGLenum api = eglQueryAPI();
+ * eglBindAPI(EGL_OPENGL_ES_API);
+ * eglWaitClient();
+ * eglBindAPI(api);
+ *
+ *
+ * @return true if the wait was successful, false if an EGL error occurs
+ */
+ public static native boolean eglWaitGL();
+
+ /**
+ * Prevents a client API command sequence from executing until any outstanding
+ * native rendering affecting the same surface is complete.
+ *
+ * @param engine the native rendering engine
+ *
+ * @return true if the wait was successful, false if an EGL error occurs
+ */
+ public static native boolean eglWaitNative(int engine);
+
+ /**
+ * Posts the color buffer to the window.
+ *
+ * @param dpy the EGL display
+ * @param surface the EGL back-buffered window surface
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL occurs
+ * @throws PowerManagementEventException if an EGL power management event occurs
+ */
+ static void eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) throws LWJGLException, PowerManagementEventException {
+ //LWJGLUtil.log("eglSwapBuffers");
+ if ( !neglSwapBuffers(dpy.getPointer(), surface.getPointer()) ) {
+ final int error = eglGetError();
+ if ( error == EGL_CONTEXT_LOST )
+ throw new PowerManagementEventException();
+ else
+ throwEGLError("Failed to swap buffers.", error);
+ }
+ }
+
+ private static native boolean neglSwapBuffers(long dpy_ptr, long surface_ptr);
+
+ //EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
+
+ /* --------------------------------
+ HELPER METHODS
+ -------------------------------- */
+
+ static void checkAttribList(IntBuffer attrib_list) {
+ if ( attrib_list == null )
+ return;
+
+ //BufferChecks.checkDirect(attrib_list);
+ if ( attrib_list.remaining() % 2 != 1 )
+ throw new IllegalArgumentException("Invalid number of values in attribute list.");
+ if ( attrib_list.get(attrib_list.limit() - 1) != EGL_NONE )
+ throw new IllegalArgumentException("The attribute list is not terminated with EGL_NONE.");
+ }
+
+ private static EGLConfig getEGLConfig(final EGLDisplay dpy, final IntBuffer attrib_list) throws LWJGLException {
+ final int configID = attrib_list.get(0);
+
+ // -- This fails on the emulator
+ // Get EGL config used by the context
+ attrib_list.put(0, EGL_CONFIG_ID).put(1, configID).put(2, EGL_NONE);
+
+ final PointerBuffer configs_buffer = APIUtil.getBufferPointer(1);
+ if ( !neglChooseConfig(dpy.getPointer(), attrib_list, attrib_list.position(), configs_buffer.getBuffer(), 0, 1, attrib_list, attrib_list.position() + 3) )
+ throwEGLError("Failed to choose EGL config.");
+
+ return new EGLConfig(dpy, configs_buffer.get(0));
+
+ // -- Emulator workaround
+ /*
+ EGLConfig config = null;
+
+ final EGLConfig[] configs = eglGetConfigs(dpy, null, attrib_list);
+ final int config_size = attrib_list.get(0);
+ for ( int i = 0; i < config_size; i++ ) {
+ if ( configs[i].getConfigID() == configID ) {
+ config = configs[i];
+ break;
+ }
+ }
+
+ if ( config == null )
+ throwEGLError("Failed to retrieve EGL config for current context.");
+
+ return config;
+ //*/
+ }
+
+ static void throwEGLError(final String msg) throws LWJGLException {
+ throwEGLError(msg, eglGetError());
+ }
+
+ static void throwEGLError(String msg, final int error) throws LWJGLException {
+ if ( error != EGL_SUCCESS )
+ msg += " EGL error: " + Util.translateEGLErrorString(error);
+
+ throw new LWJGLException(msg);
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengles/EGLConfig.java b/src/java/org/lwjgl/opengles/EGLConfig.java
new file mode 100644
index 00000000..4e1988fd
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/EGLConfig.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.LWJGLException;
+import org.lwjgl.PointerWrapperAbstract;
+
+import static org.lwjgl.opengles.EGL.*;
+
+/** EGLConfig wrapper class. */
+public final class EGLConfig extends PointerWrapperAbstract {
+
+ private final EGLDisplay display;
+
+ private final int configID;
+
+ EGLConfig(final EGLDisplay display, final long pointer) throws LWJGLException {
+ super(pointer);
+
+ this.display = display;
+ this.configID = getAttribute(EGL_CONFIG_ID);
+ }
+
+ /**
+ * Returns the EGL display from which this EGL config was retrieved.
+ *
+ * @return the EGL display
+ */
+ public EGLDisplay getDisplay() {
+ return display;
+ }
+
+ /**
+ * Returns the EGL_CONFIG_ID attribute of this EGLConfig.
+ *
+ * @return the EGL_CONFIG_ID
+ */
+ public int getConfigID() {
+ return configID;
+ }
+
+ /**
+ * Returns the value of the specified EGL config attribute.
+ *
+ * @param attribute the attribute
+ *
+ * @return the attribute value
+ */
+ public int getAttribute(final int attribute) throws LWJGLException {
+ return eglGetConfigAttrib(display, this, attribute);
+ }
+
+ public boolean equals(final Object obj) {
+ if ( obj == null || !(obj instanceof EGLConfig) )
+ return false;
+
+ return getPointer() == ((EGLConfig)obj).getPointer();
+ }
+
+ public String toString() {
+ final StringBuilder sb = new StringBuilder(512);
+
+ sb.append("EGLConfig (").append(configID).append(")");
+ sb.append("\n------------");
+
+ try {
+ sb.append("\nEGL_LEVEL").append(": ").append(getAttribute(EGL_LEVEL));
+ sb.append("\nEGL_RENDERABLE_TYPE").append(": ").append(Integer.toBinaryString(getAttribute(EGL_RENDERABLE_TYPE)));
+ sb.append("\nEGL_NATIVE_RENDERABLE").append(": ").append(getAttribute(EGL_NATIVE_RENDERABLE) == EGL_TRUE);
+ sb.append("\nEGL_SURFACE_TYPE").append(": ").append(Integer.toBinaryString(getAttribute(EGL_SURFACE_TYPE)));
+ } catch (LWJGLException e) {
+ }
+
+ final PixelFormat.Attrib[] attribEnums = PixelFormat.Attrib.values();
+ for ( PixelFormat.Attrib attribEnum : attribEnums ) {
+ if ( attribEnum.isSurfaceAttrib() )
+ continue;
+
+ try {
+ final int attrib = getAttribute(attribEnum.getEGLAttrib());
+ sb.append("\nEGL_").append(attribEnum.name()).append(": ").append(attrib);
+ } catch (LWJGLException e) {
+ //System.out.println("Failed to retrieve: " + attribEnum.name());
+ // Ignore, can happen when querying unsupported attributes (e.g. extension ones)
+ }
+ }
+
+ return sb.toString();
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengles/EGLContext.java b/src/java/org/lwjgl/opengles/EGLContext.java
new file mode 100644
index 00000000..39ac7a4a
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/EGLContext.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.LWJGLException;
+import org.lwjgl.PointerWrapperAbstract;
+
+import java.nio.IntBuffer;
+
+import static org.lwjgl.opengles.EGL.*;
+
+/** EGLContext wrapper class. */
+public final class EGLContext extends PointerWrapperAbstract {
+
+ private EGLDisplay display;
+ private final EGLConfig config;
+
+ private boolean destroyed;
+
+ EGLContext(final EGLDisplay display, final EGLConfig config, final long pointer) {
+ super(pointer);
+
+ if ( !display.isInitialized() )
+ throw new IllegalStateException("Invalid EGL display specified.");
+
+ if ( config.getDisplay() != display )
+ throw new IllegalStateException("Invalid EGL config specified.");
+
+ this.display = display;
+ this.config = config;
+ }
+
+ public void setDisplay(EGLDisplay display) {
+ this.display = display;
+ }
+
+ EGLDisplay getDisplay() {
+ return display;
+ }
+
+ EGLConfig getConfig() {
+ return config;
+ }
+
+ private void checkDestroyed() {
+ if ( destroyed )
+ throw new IllegalStateException("The EGL surface has been destroyed.");
+ }
+
+ public void destroy() throws LWJGLException {
+ eglDestroyContext(display, this);
+ destroyed = true;
+ }
+
+ /**
+ * Returns the value of the specified EGL context attribute.
+ *
+ * @param attribute the context attribute
+ *
+ * @return the attribute value
+ */
+ int getAttribute(final int attribute) throws LWJGLException {
+ checkDestroyed();
+
+ IntBuffer value = APIUtil.getBufferInt();
+ eglQueryContext(display, this, attribute, value);
+ return value.get(0);
+ }
+
+ public void makeCurrent(final EGLSurface surface) throws LWJGLException, PowerManagementEventException {
+ makeCurrent(surface, surface);
+ }
+
+ public void makeCurrent(final EGLSurface draw, final EGLSurface read) throws LWJGLException, PowerManagementEventException {
+ eglMakeCurrent(display, draw, read, this);
+ }
+
+ public boolean equals(final Object obj) {
+ if ( obj == null || !(obj instanceof EGLContext) )
+ return false;
+
+ return getPointer() == ((EGLContext)obj).getPointer();
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengles/EGLDisplay.java b/src/java/org/lwjgl/opengles/EGLDisplay.java
new file mode 100644
index 00000000..fe49e25d
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/EGLDisplay.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.LWJGLException;
+import org.lwjgl.PointerWrapperAbstract;
+
+import java.nio.IntBuffer;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import static org.lwjgl.opengles.EGL.*;
+
+/** EGLDisplay wrapper class. */
+public final class EGLDisplay extends PointerWrapperAbstract {
+
+ private int majorVersion;
+ private int minorVersion;
+
+ private Set extensions;
+
+ private boolean initialized;
+
+ EGLDisplay(final long pointer) throws LWJGLException {
+ super(pointer);
+
+ initialize();
+
+ /*final EGLConfig[] configs = eglGetConfigs(this, null, APIUtil.getBufferInt());
+ for ( EGLConfig config : configs ) {
+ System.out.println(config);
+ System.out.println("");
+ }*/
+ }
+
+ /**
+ * Returns the major EGL version of this EGL display.
+ *
+ * @return the major EGL version
+ */
+ public int getMajorVersion() {
+ return majorVersion;
+ }
+
+ /**
+ * Returns the minor EGL version of this EGL display.
+ *
+ * @return the minor EGL version
+ */
+ public int getMinorVersion() {
+ return minorVersion;
+ }
+
+ /**
+ * Returns true if the specified EGL extension is supported by this EGL display.
+ *
+ * @param eglExtension the EGL extension
+ *
+ * @return true if the extension is supported
+ */
+ public boolean isExtensionSupported(final String eglExtension) {
+ checkInitialized();
+ if ( extensions == null ) {
+ extensions = new HashSet(16);
+
+ final StringTokenizer tokenizer = new StringTokenizer(eglQueryString(this, EGL_EXTENSIONS));
+ while ( tokenizer.hasMoreTokens() )
+ extensions.add(tokenizer.nextToken());
+ }
+
+ return extensions.contains(eglExtension);
+ }
+
+ boolean isInitialized() {
+ return initialized;
+ }
+
+ private void initialize() throws LWJGLException {
+ IntBuffer version = APIUtil.getBufferInt();
+ eglInitialize(this, version);
+
+ majorVersion = version.get(0);
+ minorVersion = version.get(1);
+
+ initialized = true;
+ }
+
+ private void checkInitialized() {
+ if ( !initialized )
+ throw new IllegalStateException("The EGL display needs to be initialized first.");
+ }
+
+ /** Release the resources associated with this EGL display. */
+ public void terminate() throws LWJGLException {
+ eglTerminate(this);
+
+ majorVersion = 0;
+ minorVersion = 0;
+
+ initialized = false;
+ }
+
+ /**
+ * Returns a string describing some aspect of the EGL implementation running on the specified display.
+ *
+ * @param name the value to query
+ *
+ * @return the description
+ */
+ public String query(int name) {
+ checkInitialized();
+ return eglQueryString(this, name);
+ }
+
+ int getConfigsNum() throws LWJGLException {
+ checkInitialized();
+ return eglGetConfigsNum(this);
+ }
+
+ EGLConfig[] getConfigs(EGLConfig[] configs, IntBuffer num_config) throws LWJGLException {
+ checkInitialized();
+ return eglGetConfigs(this, configs, num_config);
+ }
+
+ int getConfigNum(IntBuffer attrib_list) throws LWJGLException {
+ checkInitialized();
+ return eglChooseConfigNum(this, attrib_list);
+ }
+
+ /** Returns the available EGL configs on this display that satisfy the specified list of attributes. */
+ public EGLConfig[] chooseConfig(IntBuffer attrib_list, EGLConfig[] configs, IntBuffer num_config) throws LWJGLException {
+ checkInitialized();
+ return eglChooseConfig(this, attrib_list, configs, num_config);
+ }
+
+ /**
+ * Creates an on-screen rendering surface on this EGL display.
+ *
+ * @param config the EGL config
+ * @param window the native window handle
+ * @param attrib_list an attribute list (may be null)
+ *
+ * @return the EGL surface
+ */
+ public EGLSurface createWindowSurface(EGLConfig config, int window, IntBuffer attrib_list) throws LWJGLException {
+ checkInitialized();
+
+ if ( config.getDisplay() != this )
+ throw new IllegalArgumentException("Invalid EGL config specified.");
+
+ return eglCreateWindowSurface(this, config, window, attrib_list);
+ }
+
+ EGLSurface createPbufferSurface(EGLConfig config, IntBuffer attrib_list) throws LWJGLException {
+ checkInitialized();
+
+ if ( config.getDisplay() != this )
+ throw new IllegalArgumentException("Invalid EGL config specified.");
+
+ return eglCreatePbufferSurface(this, config, attrib_list);
+ }
+
+ public EGLContext createContext(EGLConfig config, EGLContext shareContext, IntBuffer attrib_list) throws LWJGLException {
+ checkInitialized();
+
+ if ( config.getDisplay() != this )
+ throw new IllegalStateException("Invalid EGL config specified.");
+
+ if ( shareContext != null && shareContext.getDisplay() != this )
+ throw new IllegalStateException("Invalid shared EGL context specified.");
+
+ return eglCreateContext(this, config, shareContext, attrib_list);
+ }
+
+ public void setSwapInterval(final int interval) throws LWJGLException {
+ eglSwapInterval(this, interval);
+ }
+
+ public boolean equals(final Object obj) {
+ if ( obj == null || !(obj instanceof EGLDisplay) )
+ return false;
+
+ return getPointer() == ((EGLDisplay)obj).getPointer();
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengles/EGLImageOES.java b/src/java/org/lwjgl/opengles/EGLImageOES.java
new file mode 100644
index 00000000..6dabe9cb
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/EGLImageOES.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.PointerWrapperAbstract;
+
+/** EGLImageOES wrapper class. */
+public final class EGLImageOES extends PointerWrapperAbstract {
+
+ public EGLImageOES(final long pointer) {
+ super(pointer);
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengles/EGLKHRFenceSync.java b/src/java/org/lwjgl/opengles/EGLKHRFenceSync.java
new file mode 100644
index 00000000..bd74e2ef
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/EGLKHRFenceSync.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.LWJGLException;
+
+import java.nio.IntBuffer;
+
+import static org.lwjgl.opengles.EGL.*;
+
+/** EGL_KHR_fence_sync wrapper class. */
+public final class EGLKHRFenceSync {
+
+ /**
+ * Accepted by the <type> parameter of eglCreateSyncKHR, and returned
+ * in <value> when eglGetSyncAttribKHR is called with <attribute>
+ * EGL_SYNC_TYPE_KHR:
+ */
+ public static final int EGL_SYNC_FENCE_KHR = 0x30F9;
+
+ /** Accepted by the <attribute> parameter of eglGetSyncAttribKHR: */
+ public static final int EGL_SYNC_TYPE_KHR = 0x30F7,
+ EGL_SYNC_STATUS_KHR = 0x30F1,
+ EGL_SYNC_CONDITION_KHR = 0x30F8;
+
+ /**
+ * Returned in <value> when eglGetSyncAttribKHR is called with
+ * <attribute> EGL_SYNC_STATUS_KHR:
+ */
+ public static final int EGL_SIGNALED_KHR = 0x30F2,
+ EGL_UNSIGNALED_KHR = 0x30F3;
+
+ /**
+ * Returned in <value> when eglGetSyncAttribKHR is called with
+ * <attribute> EGL_SYNC_CONDITION_KHR:
+ */
+ public static final int EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR = 0x30F0;
+
+ /** Accepted in the <flags> parameter of eglClientWaitSyncKHR: */
+ public static final int EGL_SYNC_FLUSH_COMMANDS_BIT_KHR = 0x0001;
+
+ /** Accepted in the <timeout> parameter of eglClientWaitSyncKHR: */
+ public static final long EGL_FOREVER_KHR = 0xFFFFFFFFFFFFFFFFl;
+
+ /** Returned by eglClientWaitSyncKHR: */
+ public static final int EGL_TIMEOUT_EXPIRED_KHR = 0x30F5,
+ EGL_CONDITION_SATISFIED_KHR = 0x30F6;
+
+ /** Returned by eglCreateSyncKHR in the event of an error: */
+ public static final long EGL_NO_SYNC_KHR = 0;
+
+ static {
+ initNativeStubs();
+ }
+
+ private EGLKHRFenceSync() {
+ }
+
+ private static native void initNativeStubs();
+
+ /**
+ * Creates a fence sync object for the specified EGL display and returns
+ * a handle to the new object.
+ *
+ * @param dpy the EGL display
+ * @param type the sync type
+ * @param attrib_list an attribute list (may be null)
+ *
+ * @return the created fence sync object
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs.
+ */
+ public static EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, int type, IntBuffer attrib_list) throws LWJGLException {
+ checkAttribList(attrib_list);
+
+ final long pointer = neglCreateSyncKHR(dpy.getPointer(), type, attrib_list, attrib_list == null ? 0 : attrib_list.position());
+
+ if ( pointer == EGL_NO_SYNC_KHR )
+ throwEGLError("Failed to create KHR fence sync object.");
+
+ return new EGLSyncKHR(pointer);
+ }
+
+ private static native long neglCreateSyncKHR(long dpy_ptr, int type, IntBuffer attrib_list, int attrib_list_position);
+
+ /**
+ * Destroys an existing sync object.
+ *
+ * @param sync the sync object
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs.
+ */
+ public static void eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) throws LWJGLException {
+ if ( !neglDestroySyncKHR(dpy.getPointer(), sync.getPointer()) )
+ throwEGLError("Failed to destroy KHR fence sync object.");
+ }
+
+ private static native boolean neglDestroySyncKHR(long dpy_ptr, long sync_ptr);
+
+ /**
+ * Blocks the calling thread until the specified sync object is
+ * signaled, or until a specified timeout value expires.
+ *
+ * @param sync the sync object
+ * @param flags the block flags
+ * @param timeout the block timeout
+ *
+ * @return the sync object status
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs.
+ */
+ public static int eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, int flags, long timeout) throws LWJGLException {
+ final int status = neglClientWaitSyncKHR(dpy.getPointer(), sync.getPointer(), flags, timeout);
+
+ if ( status == EGL_FALSE )
+ throwEGLError("Failed to block on KHR fence sync object.");
+
+ return status;
+ }
+
+ private static native int neglClientWaitSyncKHR(long dpy_ptr, long sync_ptr, int flags, long timeout);
+
+ /**
+ * Returns the value of the sync object attribute.
+ *
+ * @param sync the sync object
+ * @param attribute the attribute to query
+ *
+ * @return the attribute value
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs.
+ */
+ public static int eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, int attribute) throws LWJGLException {
+ final IntBuffer value = APIUtil.getBufferInt();
+
+ if ( !neglGetSyncAttribKHR(dpy.getPointer(), sync.getPointer(), attribute, value, value.position()) )
+ throwEGLError("Failed to get KHR fence sync object attribute.");
+
+ return value.get(0);
+ }
+
+ private static native boolean neglGetSyncAttribKHR(long dpy_ptr, long sync_ptr, int attribute, IntBuffer value, int value_position);
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengles/EGLKHRReusableSync.java b/src/java/org/lwjgl/opengles/EGLKHRReusableSync.java
new file mode 100644
index 00000000..40297b04
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/EGLKHRReusableSync.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.LWJGLException;
+
+import java.nio.IntBuffer;
+
+import static org.lwjgl.opengles.EGL.*;
+
+/** EGL_KHR_reusable_sync wrapper class. */
+public final class EGLKHRReusableSync {
+
+ /**
+ * Accepted by the <type> parameter of eglCreateSyncKHR, and returned
+ * in <value> when eglGetSyncAttribKHR is called with <attribute>
+ * EGL_SYNC_TYPE_KHR:
+ */
+ public static final int EGL_SYNC_REUSABLE_KHR = 0x30FA;
+
+ /** Accepted by the <attribute> parameter of eglGetSyncAttribKHR: */
+ public static final int EGL_SYNC_TYPE_KHR = 0x30F7,
+ EGL_SYNC_STATUS_KHR = 0x30F1;
+
+ /**
+ * Returned in <value> when eglGetSyncAttribKHR is called with
+ * <attribute> EGL_SYNC_STATUS_KHR:
+ */
+ public static final int EGL_SIGNALED_KHR = 0x30F2,
+ EGL_UNSIGNALED_KHR = 0x30F3;
+
+ /** Accepted in the <flags> parameter of eglClientWaitSyncKHR: */
+ public static final int EGL_SYNC_FLUSH_COMMANDS_BIT_KHR = 0x0001;
+
+ /** Accepted in the <timeout> parameter of eglClientWaitSyncKHR: */
+ public static final long EGL_FOREVER_KHR = 0xFFFFFFFFFFFFFFFFl;
+
+ /** Returned by eglClientWaitSyncKHR: */
+ public static final int EGL_TIMEOUT_EXPIRED_KHR = 0x30F5,
+ EGL_CONDITION_SATISFIED_KHR = 0x30F6;
+
+ /** Returned by eglCreateSyncKHR in the event of an error: */
+ public static final long EGL_NO_SYNC_KHR = 0;
+
+ static {
+ initNativeStubs();
+ }
+
+ private EGLKHRReusableSync() {
+ }
+
+ private static native void initNativeStubs();
+
+ /**
+ * Creates a fence sync object for the specified EGL display and returns
+ * a handle to the new object.
+ *
+ * @param dpy the EGL display
+ * @param type the sync type
+ * @param attrib_list an attribute list (may be null)
+ *
+ * @return the created fence sync object
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs.
+ */
+ public static EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, int type, IntBuffer attrib_list) throws LWJGLException {
+ return EGLKHRFenceSync.eglCreateSyncKHR(dpy, type, attrib_list);
+ }
+
+ /**
+ * Destroys an existing sync object.
+ *
+ * @param sync the sync object
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs.
+ */
+ public static void eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) throws LWJGLException {
+ EGLKHRFenceSync.eglDestroySyncKHR(dpy, sync);
+ }
+
+ /**
+ * Blocks the calling thread until the specified sync object is
+ * signaled, or until a specified timeout value expires.
+ *
+ * @param sync the sync object
+ * @param flags the block flags
+ * @param timeout the block timeout
+ *
+ * @return the sync object status
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs.
+ */
+ public static int eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, int flags, long timeout) throws LWJGLException {
+ return EGLKHRFenceSync.eglClientWaitSyncKHR(dpy, sync, flags, timeout);
+ }
+
+ /**
+ * Signals or unsignals the sync object by changing its status to
+ * the specified mode.
+ *
+ * @param sync the sync object
+ * @param mode the mode
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs.
+ */
+ public static void eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, int mode) throws LWJGLException {
+ if ( !neglSignalSyncKHR(dpy.getPointer(), sync.getPointer(), mode) )
+ throwEGLError("Failed to signal the KHR fence sync object.");
+ }
+
+ private static native boolean neglSignalSyncKHR(long dpy_ptr, long sync_ptr, int mode);
+
+ /**
+ * Returns the value of the sync object attribute.
+ *
+ * @param sync the sync object
+ * @param attribute the attribute to query
+ *
+ * @return the attribute value
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs.
+ */
+ public static int eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, int attribute) throws LWJGLException {
+ return EGLKHRFenceSync.eglGetSyncAttribKHR(dpy, sync, attribute);
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengles/EGLNVSync.java b/src/java/org/lwjgl/opengles/EGLNVSync.java
new file mode 100644
index 00000000..78e66b06
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/EGLNVSync.java
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.LWJGLException;
+
+import java.nio.IntBuffer;
+
+import static org.lwjgl.opengles.EGL.*;
+
+/** EGL_NV_sync wrapper class. */
+public final class EGLNVSync {
+
+ /**
+ * Accepted in the <condition> parameter of eglCreateFenceSyncNV, and
+ * returned in <value> when eglGetSyncAttribNV is called with <attribute>
+ * EGL_SYNC_CONDITION_NV:
+ */
+ public static final int EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV = 0x30E6;
+
+ /**
+ * Accepted as an attribute name in the <attrib_list> parameter of
+ * eglCreateFenceSyncNV, and by the <attribute> parameter of
+ * eglGetSyncAttribNV:
+ */
+ public static final int EGL_SYNC_STATUS_NV = 0x30E7;
+
+ /**
+ * Accepted as an attribute value in the <attrib_list> parameter of
+ * eglCreateFenceSyncNV for the EGL_SYNC_STATUS_NV attribute, by
+ * the <mode> parameter of eglSignalSyncNV and returned in <value>
+ * when eglGetSyncAttribNV is called with <attribute>
+ * EGL_SYNC_STATUS_NV:
+ */
+ public static final int EGL_SIGNALED_NV = 0x30E8,
+ EGL_UNSIGNALED_NV = 0x30E9;
+
+ /** Accepted in the <flags> parameter of eglClientWaitSyncNV: */
+ public static final int EGL_SYNC_FLUSH_COMMANDS_BIT_NV = 0x0001;
+
+ /** Accepted in the <timeout> parameter of eglClientWaitSyncNV: */
+ public static final long EGL_FOREVER_NV = 0xFFFFFFFFFFFFFFFFL;
+
+ /** Returned by eglClientWaitSyncNV: */
+ public static final int EGL_ALREADY_SIGNALED_NV = 0x30EA,
+ EGL_TIMEOUT_EXPIRED_NV = 0x30EB,
+ EGL_CONDITION_SATISFIED_NV = 0x30EC;
+
+ /** Accepted in the <attribute> parameter of eglGetSyncAttribNV: */
+ public static final int EGL_SYNC_TYPE_NV = 0x30ED,
+ EGL_SYNC_CONDITION_NV = 0x30EE;
+
+ /**
+ * Returned in <value> when eglGetSyncAttribNV is called with
+ * <attribute> EGL_SYNC_TYPE_NV:
+ */
+ public static final int EGL_SYNC_FENCE_NV = 0x30EF;
+
+ /** Returned by eglCreateFenceSyncNV in the event of an error: */
+ public static final long EGL_NO_SYNC_NV = 0;
+
+ static {
+ initNativeStubs();
+ }
+
+ private EGLNVSync() {
+ }
+
+ private static native void initNativeStubs();
+
+ /**
+ * Creates a fence sync object for the specified EGL display and returns
+ * a handle to the new object.
+ *
+ * @param dpy the EGL display
+ * @param condition the sync condition
+ * @param attrib_list an attribute list (may be null)
+ *
+ * @return the created fence sync object
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs.
+ */
+ public static EGLSyncNV eglCreateFenceSyncNV(EGLDisplay dpy, int condition, IntBuffer attrib_list) throws LWJGLException {
+ checkAttribList(attrib_list);
+
+ final long pointer = neglCreateFenceSyncNV(dpy.getPointer(), condition, attrib_list, attrib_list == null ? 0 : attrib_list.position());
+
+ if ( pointer == EGL_NO_SYNC_NV )
+ throwEGLError("Failed to create NV fence sync object.");
+
+ return new EGLSyncNV(pointer);
+ }
+
+ private static native long neglCreateFenceSyncNV(long dpy_ptr, int condition, IntBuffer attrib_list, int attrib_list_position);
+
+ /**
+ * Destroys an existing sync object.
+ *
+ * @param sync the sync object
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs.
+ */
+ public static void eglDestroySyncNV(EGLSyncNV sync) throws LWJGLException {
+ if ( !neglDestroySyncNV(sync.getPointer()) )
+ throwEGLError("Failed to destroy NV fence sync object.");
+ }
+
+ private static native boolean neglDestroySyncNV(long sync_ptr);
+
+ /**
+ * Inserts a fence command into the command stream of the bound API's current
+ * context and associates it with sync object.
+ *
+ * @param sync the sync object
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs.
+ */
+ public static void eglFenceNV(EGLSyncNV sync) throws LWJGLException {
+ if ( !neglFenceNV(sync.getPointer()) )
+ throwEGLError("Failed to insert NV fence command.");
+ }
+
+ private static native boolean neglFenceNV(long sync_ptr);
+
+ /**
+ * Blocks the calling thread until the specified sync object is
+ * signaled, or until a specified timeout value expires.
+ *
+ * @param sync the sync object
+ * @param flags the block flags
+ * @param timeout the block timeout
+ *
+ * @return the sync object status
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs.
+ */
+ public static int eglClientWaitSyncNV(EGLSyncNV sync, int flags, long timeout) throws LWJGLException {
+ final int status = neglClientWaitSyncNV(sync.getPointer(), flags, timeout);
+
+ if ( status == EGL_FALSE )
+ throwEGLError("Failed to block on NV fence sync object.");
+
+ return status;
+ }
+
+ private static native int neglClientWaitSyncNV(long sync_ptr, int flags, long timeout);
+
+ /**
+ * Signals or unsignals the sync object by changing its status to
+ * the specified mode.
+ *
+ * @param sync the sync object
+ * @param mode the mode
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs.
+ */
+ public static void eglSignalSyncNV(EGLSyncNV sync, int mode) throws LWJGLException {
+ if ( !neglSignalSyncNV(sync.getPointer(), mode) )
+ throwEGLError("Failed to signal the NV fence sync object.");
+ }
+
+ private static native boolean neglSignalSyncNV(long sync_ptr, int mode);
+
+ /**
+ * Returns the value of the sync object attribute.
+ *
+ * @param sync the sync object
+ * @param attribute the attribute to query
+ *
+ * @return the attribute value
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs.
+ */
+ public static int eglGetSyncAttribNV(EGLSyncNV sync, int attribute) throws LWJGLException {
+ final IntBuffer value = APIUtil.getBufferInt();
+
+ if ( !neglGetSyncAttribNV(sync.getPointer(), attribute, value, 0) )
+ throwEGLError("Failed to get NV fence sync object attribute.");
+
+ return value.get(0);
+ }
+
+ private static native boolean neglGetSyncAttribNV(long sync_ptr, int attribute, IntBuffer value, int value_position);
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengles/EGLSurface.java b/src/java/org/lwjgl/opengles/EGLSurface.java
new file mode 100644
index 00000000..a68be83b
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/EGLSurface.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.LWJGLException;
+import org.lwjgl.PointerWrapperAbstract;
+
+import java.nio.IntBuffer;
+
+import static org.lwjgl.opengles.EGL.*;
+
+/** EGLSurface wrapper class. */
+public final class EGLSurface extends PointerWrapperAbstract {
+
+ private final EGLDisplay display;
+ private final EGLConfig config;
+
+ private boolean destroyed;
+
+ EGLSurface(final EGLDisplay display, final EGLConfig config, final long pointer) {
+ super(pointer);
+
+ if ( !display.isInitialized() )
+ throw new IllegalStateException("Invalid EGL display specified.");
+
+ this.display = display;
+ this.config = config;
+ }
+
+ /**
+ * Returns the EGL display from which this EGL surface was created.
+ *
+ * @return the EGL display
+ */
+ public EGLDisplay getDisplay() {
+ return display;
+ }
+
+ /**
+ * Returns the EGL config associated with this EGL surface.
+ *
+ * @return the EGL config
+ */
+ public EGLConfig getConfig() {
+ return config;
+ }
+
+ private void checkDestroyed() {
+ if ( destroyed )
+ throw new IllegalStateException("The EGL surface has been destroyed.");
+ }
+
+ /** Destroys this EGL surface. */
+ public void destroy() throws LWJGLException {
+ eglDestroySurface(display, this);
+ destroyed = true;
+ }
+
+ void setAttribute(int attribute, int value) throws LWJGLException {
+ checkDestroyed();
+ eglSurfaceAttrib(display, this, attribute, value);
+ }
+
+ /**
+ * Returns the value of the specified EGL surface attribute.
+ *
+ * @param attribute the surface attribute
+ *
+ * @return the attribute value
+ */
+ public int getAttribute(int attribute) throws LWJGLException {
+ checkDestroyed();
+
+ IntBuffer value = APIUtil.getBufferInt();
+ eglQuerySurface(display, this, attribute, value);
+ return value.get(0);
+ }
+
+ public void swapBuffers() throws LWJGLException, PowerManagementEventException {
+ checkDestroyed();
+ eglSwapBuffers(display, this);
+ }
+
+ public boolean equals(final Object obj) {
+ if ( obj == null || !(obj instanceof EGLSurface) )
+ return false;
+
+ return getPointer() == ((EGLSurface)obj).getPointer();
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengles/EGLSyncKHR.java b/src/java/org/lwjgl/opengles/EGLSyncKHR.java
new file mode 100644
index 00000000..eb2f5be3
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/EGLSyncKHR.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.PointerWrapperAbstract;
+
+/** EGLSyncKHR wrapper class. */
+public class EGLSyncKHR extends PointerWrapperAbstract {
+
+ public EGLSyncKHR(final long pointer) {
+ super(pointer);
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengles/EGLSyncNV.java b/src/java/org/lwjgl/opengles/EGLSyncNV.java
new file mode 100644
index 00000000..84fb2335
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/EGLSyncNV.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.PointerWrapperAbstract;
+
+/** EGLSyncNV wrapper class. */
+public class EGLSyncNV extends PointerWrapperAbstract {
+
+ public EGLSyncNV(final long pointer) {
+ super(pointer);
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengles/GLChecks.java b/src/java/org/lwjgl/opengles/GLChecks.java
new file mode 100644
index 00000000..64b04cae
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/GLChecks.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.BufferUtils;
+import org.lwjgl.LWJGLUtil;
+import org.lwjgl.opengl.OpenGLException;
+
+import java.nio.Buffer;
+
+import static org.lwjgl.opengles.GLES20.*;
+
+/**
+ * A class to check buffer boundaries in GL methods. Many GL
+ * methods read data from the GL into a native Buffer at its current position. If there is unsufficient space in the buffer when
+ * the call is made then a buffer overflow would otherwise occur and cause unexpected behaviour, a crash, or worse, a security
+ * risk. Therefore in those methods where GL reads data back into a buffer, we will call a bounds check method from this class
+ * to ensure that there is sufficient space in the buffer.
+ *
+ * Thrown by the debug build library of the LWJGL if any OpenGL operation causes an error.
+ *
+ * @author cix_foo
+ * @version $Revision: 3459 $
+ * $Id: GLChecks.java 3459 2010-11-29 17:21:05Z spasi $
+ */
+class GLChecks {
+
+ /** Static methods only! */
+ private GLChecks() {
+ }
+
+ static int getBufferObjectSize(int buffer_enum) {
+ return glGetBufferParameter(buffer_enum, GLES20.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() {
+ if ( LWJGLUtil.CHECKS && StateTracker.getTracker().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() {
+ if ( LWJGLUtil.CHECKS && StateTracker.getTracker().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() {
+ if ( LWJGLUtil.CHECKS && StateTracker.getTracker().elementArrayBuffer != 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() {
+ if ( LWJGLUtil.CHECKS && StateTracker.getTracker().elementArrayBuffer == 0 )
+ throw new OpenGLException("Cannot use offsets when Element Array Buffer Object is disabled");
+ }
+
+ /**
+ * Calculate the storage required for an image in elements
+ *
+ * @param format The format of the image (example: GL_RGBA)
+ * @param type The type of the image elements (example: GL_UNSIGNED_BYTE)
+ * @param width The width of the image
+ * @param height The height of the image (1 for 1D images)
+ * @param depth The depth of the image (1 for 2D images)
+ *
+ * @return the size, in elements, of the image
+ */
+ static int calculateImageStorage(Buffer buffer, int format, int type, int width, int height, int depth) {
+ return LWJGLUtil.CHECKS ? calculateImageStorage(format, type, width, height, depth) >> BufferUtils.getElementSizeExponent(buffer) : 0;
+ }
+
+ static int calculateTexImage1DStorage(Buffer buffer, int format, int type, int width) {
+ return LWJGLUtil.CHECKS ? calculateTexImage1DStorage(format, type, width) >> BufferUtils.getElementSizeExponent(buffer) : 0;
+ }
+
+ static int calculateTexImage2DStorage(Buffer buffer, int format, int type, int width, int height) {
+ return LWJGLUtil.CHECKS ? calculateTexImage2DStorage(format, type, width, height) >> BufferUtils.getElementSizeExponent(buffer) : 0;
+ }
+
+ static int calculateTexImage3DStorage(Buffer buffer, int format, int type, int width, int height, int depth) {
+ return LWJGLUtil.CHECKS ? calculateTexImage3DStorage(format, type, width, height, depth) >> BufferUtils.getElementSizeExponent(buffer) : 0;
+ }
+
+ /**
+ * Calculate the storage required for an image in bytes.
+ *
+ * @param format The format of the image (example: GL_RGBA)
+ * @param type The type of the image elements (example: GL_UNSIGNED_BYTE)
+ * @param width The width of the image
+ * @param height The height of the image (1 for 1D images)
+ * @param depth The depth of the image (1 for 2D images)
+ *
+ * @return the size, in bytes, of the image
+ */
+ private static int calculateImageStorage(int format, int type, int width, int height, int depth) {
+ return calculateBytesPerPixel(format, type) * width * height * depth;
+ }
+
+ private static int calculateTexImage1DStorage(int format, int type, int width) {
+ return calculateBytesPerPixel(format, type) * width;
+ }
+
+ private static int calculateTexImage2DStorage(int format, int type, int width, int height) {
+ return calculateTexImage1DStorage(format, type, width) * height;
+ }
+
+ private static int calculateTexImage3DStorage(int format, int type, int width, int height, int depth) {
+ return calculateTexImage2DStorage(format, type, width, height) * depth;
+ }
+
+ private static int calculateBytesPerPixel(int format, int type) {
+ int bpe;
+ switch ( type ) {
+ case GL_UNSIGNED_BYTE:
+ case GL_BYTE:
+ bpe = 1;
+ break;
+ case GL_UNSIGNED_SHORT:
+ case GL_SHORT:
+ bpe = 2;
+ break;
+ case GL_UNSIGNED_INT:
+ case GL_INT:
+ case GL_FLOAT:
+ bpe = 4;
+ break;
+ default:
+ // TODO: Add more types (like the GL12 types GL_UNSIGNED_INT_8_8_8_8
+ return 0;
+ // throw new IllegalArgumentException("Unknown type " + type);
+ }
+ int epp;
+ switch ( format ) {
+ case GL_LUMINANCE:
+ case GL_ALPHA:
+ epp = 1;
+ break;
+
+ case GL_LUMINANCE_ALPHA:
+ epp = 2;
+ break;
+ case GL_RGB:
+ epp = 3;
+ break;
+ case GL_RGBA:
+ epp = 4;
+ break;
+ default:
+ // TODO: Add more formats. Assuming 4 is too wasteful on buffer sizes where e.g. 1 is enough (like GL_DEPTH_COMPONENT)
+ return 0;
+ }
+
+ return bpe * epp;
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengles/GLContext.java b/src/java/org/lwjgl/opengles/GLContext.java
new file mode 100644
index 00000000..52acb016
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/GLContext.java
@@ -0,0 +1,310 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.LWJGLException;
+import org.lwjgl.LWJGLUtil;
+import org.lwjgl.Sys;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.WeakHashMap;
+
+import static org.lwjgl.opengles.GLES20.*;
+
+/**
+ *
+ * Manages GL contexts. Before any rendering is done by a LWJGL system, a call should be made to GLContext.useContext() with a
+ * context. This will ensure that GLContext has an accurate reflection of the current context's capabilities and function
+ * pointers.
+ *
+ * This class is thread-safe in the sense that multiple threads can safely call all public methods. The class is also
+ * thread-aware in the sense that it tracks a per-thread current context (including capabilities and function pointers).
+ * That way, multiple threads can have multiple contexts current and render to them concurrently.
+ *
+ * @author elias_naur
+ * @version $Revision: 3279 $
+ * $Id: GLContext.java 3279 2010-03-11 21:06:49Z spasi $
+ */
+public final class GLContext {
+
+ /** Maps threads to their current context's ContextCapabilities, if any */
+ private static final ThreadLocal current_capabilities = new ThreadLocal();
+
+ /**
+ * The getCapabilities() method is a potential hot spot in any LWJGL application, since
+ * it is needed for context capability discovery (e.g. is OpenGL 2.0 supported?), and
+ * for the function pointers of gl functions. However, the 'current_capabilities' ThreadLocal
+ * is (relatively) expensive to look up, and since most OpenGL applications use are single threaded
+ * rendering, the following two is an optimization for this case.
+ *
+ * ThreadLocals can be thought of as a mapping between threads and values, so the idea
+ * is to use a lock-less cache of mappings between threads and the current ContextCapabilities. The cache
+ * could be any size, but in our case, we want a single sized cache for optimal performance
+ * in the single threaded case.
+ *
+ * 'fast_path_cache' is the most recent ContextCapabilities (potentially null) and its owner. By
+ * recent I mean the last thread setting the value in setCapabilities(). When getCapabilities()
+ * is called, a check to see if the current is the owner of the ContextCapabilities instance in
+ * fast_path_cache. If so, the instance is returned, if not, some thread has since taken ownership
+ * of the cache entry and the slower current_capabilities ThreadLocal is queried instead.
+ *
+ * No locks are needed in get/setCapabilities, because even though fast_path_cache can be accessed
+ * from multiple threads at once, we are guaranteed by the JVM spec that its value is always valid.
+ * Furthermore, if the ownership test in getCapabilities() succeeds, the cache entry can only contain
+ * the correct ContextCapabilites (that is, the one from getThreadLocalCapabilites()),
+ * since no other thread can set the owner to anyone else than itself.
+ */
+ private static CapabilitiesCacheEntry fast_path_cache = new CapabilitiesCacheEntry();
+
+ /**
+ * Simple lock-free cache of CapabilitesEntryCache to avoid allocating more than one
+ * cache entry per thread
+ */
+ private static final ThreadLocal thread_cache_entries = new ThreadLocal();
+
+ /**
+ * The weak mapping from context Object instances to ContextCapabilities. Used
+ * to avoid recreating a ContextCapabilities every time a context is made current.
+ */
+ private static final Map capability_cache = new WeakHashMap();
+
+ /** Reference count of the native opengl implementation library */
+ private static int gl_ref_count;
+ private static boolean did_auto_load;
+
+ static {
+ Sys.initialize();
+ }
+
+ /**
+ * Get the current capabilities instance. It contains the flags used
+ * to test for support of a particular extension.
+ *
+ * @return The current capabilities instance.
+ */
+ public static ContextCapabilities getCapabilities() {
+ CapabilitiesCacheEntry recent_cache_entry = fast_path_cache;
+ // Check owner of cache entry
+ if ( recent_cache_entry.owner == Thread.currentThread() ) {
+ /* The owner ship test succeeded, so the cache must contain the current ContextCapabilities instance
+ * assert recent_cache_entry.capabilities == getThreadLocalCapabilities();
+ */
+ return recent_cache_entry.capabilities;
+ } else // Some other thread has written to the cache since, and we fall back to the slower path
+ return getThreadLocalCapabilities();
+ }
+
+ private static ContextCapabilities getThreadLocalCapabilities() {
+ return current_capabilities.get();
+ }
+
+ /**
+ * Set the current capabilities instance. It contains the flags used
+ * to test for support of a particular extension.
+ *
+ * @return The current capabilities instance.
+ */
+ static void setCapabilities(ContextCapabilities capabilities) {
+ current_capabilities.set(capabilities);
+
+ CapabilitiesCacheEntry thread_cache_entry = thread_cache_entries.get();
+ if ( thread_cache_entry == null ) {
+ thread_cache_entry = new CapabilitiesCacheEntry();
+ thread_cache_entries.set(thread_cache_entry);
+ }
+ thread_cache_entry.owner = Thread.currentThread();
+ thread_cache_entry.capabilities = capabilities;
+
+ fast_path_cache = thread_cache_entry;
+ }
+
+ /**
+ * Determine which extensions are available and returns the context profile mask. Helper method to ContextCapabilities.
+ *
+ * @param supported_extensions the Set to fill with the available extension names
+ *
+ * @return the context profile mask, will be 0 for any version < 3.2
+ */
+ static void getSupportedExtensions(final Set supported_extensions) {
+ // Detect OpenGL version first
+ final String version = glGetString(GL_VERSION);
+ if ( version == null )
+ throw new IllegalStateException("glGetString(GL_VERSION) returned null - possibly caused by missing current context.");
+
+ final String VERSION_PREFIX = "OpenGL ES ";
+ final StringTokenizer version_tokenizer = new StringTokenizer(version.substring(VERSION_PREFIX.length()), ". ");
+
+ int majorVersion = 0;
+ int minorVersion = 0;
+ try {
+ majorVersion = Integer.parseInt(version_tokenizer.nextToken());
+ minorVersion = Integer.parseInt(version_tokenizer.nextToken());
+ } catch (NumberFormatException e) {
+ LWJGLUtil.log("The major and/or minor OpenGL version is malformed: " + e.getMessage());
+ }
+
+ // ----------------------[ 2.X ]----------------------
+ if ( 2 <= majorVersion )
+ supported_extensions.add("OpenGLES20");
+
+ // Parse EXTENSIONS string
+ final String extensions_string = glGetString(GL_EXTENSIONS);
+ if ( extensions_string == null )
+ throw new IllegalStateException("glGetString(GL_EXTENSIONS) returned null - is there a context current?");
+
+ final StringTokenizer tokenizer = new StringTokenizer(extensions_string);
+ while ( tokenizer.hasMoreTokens() )
+ supported_extensions.add(tokenizer.nextToken());
+ }
+
+ /**
+ * Helper method to ContextCapabilities. It will try to initialize the native stubs,
+ * and remove the given extension name from the extension set if the initialization fails.
+ */
+ static void initNativeStubs(final Class extension_class, Set supported_extensions, String ext_name) {
+ //resetNativeStubs(extension_class);
+ if ( supported_extensions.contains(ext_name) ) {
+ try {
+ doInitNativeStubs(extension_class);
+ } catch (LWJGLException e) {
+ LWJGLUtil.log("Failed to initialize extension " + extension_class + " - exception: " + e);
+ supported_extensions.remove(ext_name);
+ }
+ }
+ }
+
+ static void doInitNativeStubs(final Class> extension_class) throws LWJGLException {
+ try {
+ AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws Exception {
+ Method init_stubs_method = extension_class.getDeclaredMethod("initNativeStubs");
+ init_stubs_method.invoke(null);
+ return null;
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ final Throwable c = e.getCause();
+ if ( c instanceof InvocationTargetException )
+ throw new LWJGLException(c.getCause());
+ else
+ throw new LWJGLException(c);
+ }
+ }
+
+ /**
+ * Makes a GL context the current LWJGL context by loading GL function pointers. The context must be current before a call to
+ * this method! Instead it simply ensures that the current context is reflected accurately by GLContext's extension caps and
+ * function pointers. Use useContext(null) when no context is active. If the context is the same as last time, then this is
+ * a no-op.
If the context has not been encountered before it will be fully initialized from scratch. Otherwise a cached set
+ * of caps and function pointers will be used.
The reference to the context is held in a weak reference; therefore if no
+ * strong reference exists to the GL context it will automatically be forgotten by the VM at an indeterminate point in the
+ * future, freeing up a little RAM.
+ *
+ * @param context The context object, which uniquely identifies a GL context. If context is null, the native stubs are
+ * unloaded.
+ *
+ * @throws org.lwjgl.LWJGLException if context non-null, and the gl library can't be loaded or the basic GL11 functions can't be loaded
+ */
+ public static synchronized void useContext(Object context) throws LWJGLException {
+ if ( context == null ) {
+ // Moved this to the shutdown hook
+ ContextCapabilities.unloadAllStubs();
+ setCapabilities(null);
+ if ( did_auto_load )
+ unloadOpenGLLibrary();
+ return;
+ }
+
+ if ( gl_ref_count == 0 ) {
+ loadOpenGLLibrary();
+ did_auto_load = true;
+ }
+
+ try {
+ ContextCapabilities capabilities = capability_cache.get(context);
+ if ( capabilities == null ) {
+ /*
+ * The capabilities object registers itself as current. This behaviour is caused
+ * by a chicken-and-egg situation where the constructor needs to call GL functions
+ * as part of its capability discovery, but GL functions cannot be called before
+ * a capabilities object has been set.
+ */
+ new ContextCapabilities();
+ capability_cache.put(context, getCapabilities());
+ } else
+ setCapabilities(capabilities);
+ } catch (LWJGLException e) {
+ if ( did_auto_load )
+ unloadOpenGLLibrary();
+ throw e;
+
+ }
+ }
+
+ /** If the OpenGL reference count is 0, the library is loaded. The reference count is then incremented. */
+ public static synchronized void loadOpenGLLibrary() throws LWJGLException {
+ if ( gl_ref_count == 0 )
+ nLoadOpenGLLibrary();
+ gl_ref_count++;
+ }
+
+ private static native void nLoadOpenGLLibrary() throws LWJGLException;
+
+ /** The OpenGL library reference count is decremented, and if it reaches 0, the library is unloaded. */
+ public static synchronized void unloadOpenGLLibrary() {
+ gl_ref_count--;
+ /*
+ * Unload the native OpenGL library unless we're on linux, since
+ * some drivers (NVIDIA proprietary) crash on exit when unloading the library.
+ */
+ if ( gl_ref_count == 0 && LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_LINUX )
+ nUnloadOpenGLLibrary();
+ }
+
+ private static native void nUnloadOpenGLLibrary();
+
+ /** Native method to clear native stub bindings */
+ static native void resetNativeStubs(Class clazz);
+
+ private static final class CapabilitiesCacheEntry {
+
+ Thread owner;
+ ContextCapabilities capabilities;
+ }
+}
diff --git a/src/java/org/lwjgl/opengles/PeerInfo.java b/src/java/org/lwjgl/opengles/PeerInfo.java
new file mode 100644
index 00000000..c6d766ec
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/PeerInfo.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.LWJGLException;
+import org.lwjgl.LWJGLUtil;
+
+import java.nio.ByteBuffer;
+
+/**
+ *
+ * @author elias_naur
+ * @version $Revision: 3418 $
+ * $Id: PeerInfo.java 3418 2010-09-28 21:11:35Z spasi $
+ */
+abstract class PeerInfo {
+ private final ByteBuffer handle;
+ private Thread locking_thread; // Thread that has locked this PeerInfo
+ private int lock_count;
+
+ protected PeerInfo(ByteBuffer handle) {
+ this.handle = handle;
+ }
+
+ private void lockAndInitHandle() throws LWJGLException {
+ doLockAndInitHandle();
+ }
+
+ public final synchronized void unlock() throws LWJGLException {
+ if (lock_count <= 0)
+ throw new IllegalStateException("PeerInfo not locked!");
+ if (Thread.currentThread() != locking_thread)
+ throw new IllegalStateException("PeerInfo already locked by " + locking_thread);
+ lock_count--;
+ if (lock_count == 0) {
+ doUnlock();
+ locking_thread = null;
+ notify();
+ }
+ }
+
+ protected abstract void doLockAndInitHandle() throws LWJGLException;
+ protected abstract void doUnlock() throws LWJGLException;
+
+ public final synchronized ByteBuffer lockAndGetHandle() throws LWJGLException {
+ Thread this_thread = Thread.currentThread();
+ while (locking_thread != null && locking_thread != this_thread) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ LWJGLUtil.log("Interrupted while waiting for PeerInfo lock: " + e);
+ }
+ }
+ if (lock_count == 0) {
+ locking_thread = this_thread;
+ doLockAndInitHandle();
+ }
+ lock_count++;
+ return getHandle();
+ }
+
+ final ByteBuffer getHandle() {
+ return handle;
+ }
+
+ public void destroy() {
+ }
+}
diff --git a/src/java/org/lwjgl/opengles/PixelFormat.java b/src/java/org/lwjgl/opengles/PixelFormat.java
new file mode 100644
index 00000000..04518984
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/PixelFormat.java
@@ -0,0 +1,767 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.BufferUtils;
+import org.lwjgl.LWJGLException;
+import org.lwjgl.LWJGLUtil;
+import org.lwjgl.opengl.PixelFormatLWJGL;
+
+import java.nio.IntBuffer;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import static org.lwjgl.opengles.EGL.*;
+import static org.lwjgl.opengles.NVCoverageSample.*;
+import static org.lwjgl.opengles.NVDepthNonlinear.*;
+import static org.lwjgl.opengles.PixelFormat.Attrib.*;
+
+/**
+ * This class describes the configuration settings for an EGL surface. Instances
+ * of this class are used as arguments to Display.create(). The attributes specified
+ * in this class will be used to get EGLConfigs from an EGLDisplay. PixelFormat
+ * is not the best name for this class, but it matches the corresponding class
+ * in the official desktop LWJGL.
+ *
+ * Instances of this class are immutable. An example of the expected way to set
+ * the PixelFormat property values is the following:
+ * PixelFormat pf = new PixelFormat().withDepth(24).withSamples(4);
+ *
+ * Attributes that correspond to EGL extensions will be silently ignored if those
+ * extensions are not supported by the EGLDisplay.
+ */
+public final class PixelFormat implements PixelFormatLWJGL {
+
+ public static enum Attrib {
+ // CORE ATTRIBUTES
+
+ RED_SIZE(EGL_RED_SIZE, 0),
+ GREEN_SIZE(EGL_GREEN_SIZE, 0),
+ BLUE_SIZE(EGL_BLUE_SIZE, 0),
+ ALPHA_SIZE(EGL_ALPHA_SIZE, 0),
+
+ LUMINANCE_SIZE(EGL_LUMINANCE_SIZE, 0),
+
+ DEPTH_SIZE(EGL_DEPTH_SIZE, 0),
+ STENCIL_SIZE(EGL_STENCIL_SIZE, 0),
+
+ MIN_SWAP_INTERVAL(EGL_MIN_SWAP_INTERVAL, EGL_DONT_CARE),
+ MAX_SWAP_INTERVAL(EGL_MAX_SWAP_INTERVAL, EGL_DONT_CARE),
+
+ SAMPLES(EGL_SAMPLES, 0),
+ SAMPLE_BUFFERS(EGL_SAMPLE_BUFFERS, 0),
+
+ TRANSPARENT_TYPE(EGL_TRANSPARENT_TYPE, EGL_NONE),
+ TRANSPARENT_RED_VALUE(EGL_TRANSPARENT_RED_VALUE, EGL_DONT_CARE),
+ TRANSPARENT_GREEN_VALUE(EGL_TRANSPARENT_GREEN_VALUE, EGL_DONT_CARE),
+ TRANSPARENT_BLUE_VALUE(EGL_TRANSPARENT_BLUE_VALUE, EGL_DONT_CARE),
+
+ // SURFACE ATTRIBUTES
+
+ MULTISAMPLE_RESOLVE(EGL_MULTISAMPLE_RESOLVE, EGL_MULTISAMPLE_RESOLVE_DEFAULT, true),
+ SWAP_BEHAVIOR(EGL_SWAP_BEHAVIOR, EGL_DONT_CARE, true),
+
+ // EXTENSION ATTRIBUTES
+
+ COVERAGE_SAMPLES_NV(EGL_COVERAGE_SAMPLES_NV, 0),
+ COVERAGE_BUFFERS_NV(EGL_COVERAGE_BUFFERS_NV, 0),
+
+ DEPTH_ENCODING_NONLINEAR_NV(EGL_DEPTH_ENCODING_NONLINEAR_NV, EGL_DONT_CARE);
+
+ private final int eglAttrib;
+ private final int defaultValue;
+
+ private final boolean surfaceAttrib;
+
+ Attrib(final int eglAttrib, final int defaultValue) {
+ this(eglAttrib, defaultValue, false);
+ }
+
+ Attrib(final int eglAttrib, final int defaultValue, final boolean surfaceAttrib) {
+ this.eglAttrib = eglAttrib;
+ this.defaultValue = defaultValue;
+
+ this.surfaceAttrib = surfaceAttrib;
+ }
+
+ /**
+ * Returns the EGL token that corresponds to this attribute.
+ *
+ * @return the EGL attribute token
+ */
+ public int getEGLAttrib() {
+ return eglAttrib;
+ }
+
+ /**
+ * Returns the default value of this attribute. Attributes
+ * with default values will be ignored when choosing the EGLConfig.
+ *
+ * @return the default value
+ */
+ public int getDefaultValue() {
+ return defaultValue;
+ }
+
+ public boolean isSurfaceAttrib() {
+ return surfaceAttrib;
+ }
+
+ }
+
+ private final Map config = new HashMap(16);
+
+ /**
+ * Creates a new PixelFormat with rgbSize = 8, alphaSize = 8 and depthSize = 16.
+ *
+ * @see #PixelFormat(int, int, int, int, int, int)
+ */
+ public PixelFormat() {
+ this(8, 16, 0);
+ }
+
+ /**
+ * Creates a new PixelFormat with rgbSize = 8 and the specified
+ * alphaSize, depthSize and stencilSize.
+ *
+ * @param alphaSize the EGL_ALPHA_SIZE value
+ * @param depthSize the EGL_DEPTH_SIZE value
+ * @param stencilSize the EGL_STENCIL_SIZE value
+ *
+ * @see #PixelFormat(int, int, int, int, int, int)
+ */
+ public PixelFormat(int alphaSize, int depthSize, int stencilSize) {
+ this(alphaSize, depthSize, stencilSize, 0);
+ }
+
+ /**
+ * Creates a new PixelFormat with rgbSize = 8 and the specified
+ * alphaSize, depthSize, stencilSize and samples.
+ *
+ * @param alphaSize the EGL_ALPHA_SIZE value
+ * @param depthSize the EGL_DEPTH_SIZE value
+ * @param stencilSize the EGL_STENCIL_SIZE value
+ * @param samples the EGL_SAMPLE_SIZE value
+ *
+ * @see #PixelFormat(int, int, int, int, int, int)
+ */
+ public PixelFormat(int alphaSize, int depthSize, int stencilSize, int samples) {
+ this(8, alphaSize, 0, depthSize, stencilSize, samples);
+ }
+
+ /**
+ * Creates a new PixelFormat with the specified RGB sizes, EGL_ALPHA_SIZE,
+ * EGL_LUMINANCE_SIZE, EGL_DEPTH_SIZE, EGL_STENCIL_SIZE, EGL_SAMPLES.
+ * All values must be greater than or equal to 0. rgbSize and luminanceSize
+ * cannot both be greater than 0. depthSize greater than 24 and stencilSize
+ * greater than 8 are not recommended.
+ * The corresponding EGL_SAMPLE_BUFFERS value will become 0 if samples is 0,
+ * or 1 if samples is greater than 0.
+ *
+ * @param rgbSize the RGB sizes
+ * @param alphaSize the EGL_ALPHA_SIZE value
+ * @param luminanceSize the EGL_LUMINANCE_SIZE value
+ * @param depthSize the EGL_DEPTH_SIZE value
+ * @param stencilSize the EGL_STENCIL_SIZE value
+ * @param samples the EGL_SAMPLE_SIZE value
+ */
+ public PixelFormat(int rgbSize, int alphaSize, int luminanceSize, int depthSize, int stencilSize, int samples) {
+ if ( rgbSize < 0 )
+ throw new IllegalArgumentException("Invalid RGB size specified: " + rgbSize);
+
+ if ( alphaSize < 0 )
+ throw new IllegalArgumentException("Invalid EGL_ALPHA_SIZE specified: " + alphaSize);
+
+ if ( luminanceSize < 0 || (0 < luminanceSize && 0 < rgbSize) )
+ throw new IllegalArgumentException("Invalid EGL_LUMINANCE_SIZE specified: " + luminanceSize);
+
+ if ( depthSize < 0 )
+ throw new IllegalArgumentException("Invalid EGL_DEPTH_SIZE specified: " + depthSize);
+
+ if ( stencilSize < 0 )
+ throw new IllegalArgumentException("Invalid EGL_STENCIL_SIZE specified: " + stencilSize);
+
+ if ( samples < 0 )
+ throw new IllegalArgumentException("Invalid EGL_SAMPLES specified: " + samples);
+
+ if ( 0 < rgbSize ) {
+ setAttrib(RED_SIZE, rgbSize);
+ setAttrib(GREEN_SIZE, rgbSize);
+ setAttrib(BLUE_SIZE, rgbSize);
+ }
+ setAttrib(ALPHA_SIZE, alphaSize);
+
+ setAttrib(LUMINANCE_SIZE, luminanceSize);
+
+ setAttrib(DEPTH_SIZE, depthSize);
+ setAttrib(STENCIL_SIZE, stencilSize);
+
+ setAttrib(SAMPLES, samples);
+ setAttrib(SAMPLE_BUFFERS, samples == 0 ? 0 : 1);
+ }
+
+ /**
+ * Creates a new PixelFormat that is a copy of the specified PixelFormat.
+ *
+ * @param pf the source PixelFormat
+ */
+ private PixelFormat(final PixelFormat pf) {
+ config.clear();
+ config.putAll(pf.config);
+ }
+
+ /**
+ * Sets the value of an attribute to the current configuration.
+ * If the value matches the default attribute value, the
+ * attribute will be removed from the configuration.
+ *
+ * @param attrib the attribute
+ * @param value the new value
+ */
+ private void setAttrib(final Attrib attrib, final int value) {
+ if ( attrib.defaultValue == value )
+ config.remove(attrib);
+ else
+ config.put(attrib, value);
+ }
+
+ /**
+ * Returns an IntBuffer that can be used to get/choose EGLConfigs.
+ * The contents of the IntBuffer will be the sum of the source
+ * LWJGL attributes and the user-defined attributes from this
+ * PixelFormat's configuration.
+ *
+ * The source LWJGL attributes should not contain the EGL_SURFACE_TYPE
+ * attirube, or any attributes that are handled by PixelFormat.
+ *
+ * Attributes that correspond to EGL extensions will be checked
+ * against the extensions supported in the specified EGLDisplay.
+ * Attributes that correspond to unsupported extensions will not
+ * be included in the final EGLConfig query.
+ *
+ * @param display the EGL display from which the EGLConfig is going to be retrieved
+ * @param lwjglAttribs the LWJGL attributes
+ *
+ * @return the IntBuffer
+ */
+ public IntBuffer getAttribBuffer(final EGLDisplay display, int surfaceType, final int[] lwjglAttribs) {
+ // Create a copy of the configuration attributes
+ Set keys = new HashSet(config.keySet());
+
+ // Handle surface type bits
+ if ( keys.contains(MULTISAMPLE_RESOLVE) ) {
+ if ( display.getMajorVersion() == 1 && display.getMinorVersion() < 4 )
+ keys.remove(MULTISAMPLE_RESOLVE);
+ else if ( getAttrib(MULTISAMPLE_RESOLVE) == EGL_MULTISAMPLE_RESOLVE_BOX )
+ surfaceType |= EGL_MULTISAMPLE_RESOLVE_BOX_BIT;
+ }
+
+ if ( keys.contains(SWAP_BEHAVIOR) ) {
+ if ( display.getMajorVersion() == 1 && display.getMinorVersion() < 4 )
+ keys.remove(SWAP_BEHAVIOR);
+ else if ( getAttrib(SWAP_BEHAVIOR) == EGL_BUFFER_PRESERVED )
+ surfaceType |= EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
+ }
+
+ // Check NV_coverage_sample
+ if ( keys.contains(COVERAGE_BUFFERS_NV) && !display.isExtensionSupported("EGL_NV_coverage_sample") ) {
+ keys.remove(COVERAGE_BUFFERS_NV);
+ keys.remove(COVERAGE_SAMPLES_NV);
+ }
+
+ // Check NV_depth_nonlinear
+ if ( keys.contains(DEPTH_ENCODING_NONLINEAR_NV) && !display.isExtensionSupported("EGL_NV_depth_nonlinear") )
+ keys.remove(DEPTH_ENCODING_NONLINEAR_NV);
+
+ // Create IntBuffer and insert the attributes
+ final IntBuffer attribs = BufferUtils.createIntBuffer(
+ 2 // SURFACE_TYPE
+ + lwjglAttribs.length // Source LWJGL attributes
+ + (keys.size() * 2) // PixelFormat attributes
+ + 1 // Termination
+ );
+
+ attribs.put(EGL_SURFACE_TYPE).put(surfaceType);
+ attribs.put(lwjglAttribs);
+
+ for ( Attrib key : keys ) {
+ if ( !key.isSurfaceAttrib() )
+ attribs.put(key.eglAttrib).put(config.get(key));
+ }
+
+ // Finish the attribute list
+ attribs.put(EGL_NONE);
+ attribs.flip();
+
+ return attribs;
+ }
+
+ /**
+ * Returns true if the requested attribute matches the attribute in the specified EGL config.
+ *
+ * @param attrib the requested attribute
+ * @param config the EGL config
+ *
+ * @return true if the two attributes match
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ private boolean matches(final Attrib attrib, final EGLConfig config) throws LWJGLException {
+ return getAttrib(attrib) == config.getAttribute(attrib.getEGLAttrib());
+ }
+
+ /**
+ * Returns true if the requested attribute matches the attribute in the specified EGL config.
+ * If the requested attribute is equal to 1, then it will match with any EGL config attribute
+ * that is greater than 0.
+ *
+ * @param attrib the requested attribute
+ * @param config the EGL config
+ *
+ * @return true if the two attributes match
+ *
+ * @throws org.lwjgl.LWJGLException if an EGL error occurs
+ */
+ private boolean matchesNonZero(final Attrib attrib, final EGLConfig config) throws LWJGLException {
+ final int reqValue = getAttrib(attrib);
+ final int cfgValue = config.getAttribute(attrib.getEGLAttrib());
+
+ return reqValue == cfgValue || (reqValue == 1 && cfgValue > 0);
+ }
+
+ /**
+ * Returns the EGL config from the specified array that best matches this PixelFormat.
+ *
+ * @param configs the EGL configs
+ *
+ * @return the best match
+ */
+ public EGLConfig getBestMatch(final EGLConfig[] configs) throws LWJGLException {
+ if ( configs == null || configs.length == 0 )
+ throw new IllegalArgumentException("No EGLConfigs specified.");
+
+ if ( configs.length == 1 )
+ return configs[0];
+
+ /*System.out.println("\nASKED FOR:");
+ for ( Attrib attrib : config.keySet() ) {
+ System.out.println("EGL_" + attrib.name() + ": " + getAttrib(attrib));
+ }
+
+ for ( EGLConfig config : configs ) {
+ if ( config == null )
+ continue;
+
+ System.out.println("\n----");
+ System.out.println(config);
+ }*/
+
+ for ( EGLConfig config : configs ) {
+ if ( config == null )
+ continue;
+
+ if ( !(matches(ALPHA_SIZE, config) && matchesNonZero(DEPTH_SIZE, config) && matchesNonZero(STENCIL_SIZE, config)) )
+ continue;
+
+ final int luminance = getAttrib(LUMINANCE_SIZE);
+ if ( 0 < luminance && !matches(LUMINANCE_SIZE, config) )
+ continue;
+
+ if ( luminance == 0 && !(matches(RED_SIZE, config) && matches(GREEN_SIZE, config) && matches(BLUE_SIZE, config)) )
+ continue;
+
+ if ( !(matches(SAMPLE_BUFFERS, config) && matches(SAMPLES, config)) )
+ continue;
+
+ // TODO: Add more? NV's Tegra SDK checks a hardcoded 5 value for COVERAGE_SAMPLES_NV (nv_main.c, line: 1823)
+
+ return config;
+ }
+
+ // No match found, use the one recommended by the EGL implementation.
+ LWJGLUtil.log("Could not find an exact EGLConfig match for the PixelFormat requested, using first returned.");
+ return configs[0];
+ }
+
+ /**
+ * Applies this PixelFormat's surface attributes to the specified EGL surface.
+ *
+ * @param surface the EGL surface
+ */
+ public void setSurfaceAttribs(final EGLSurface surface) throws LWJGLException {
+ setSurfaceAttrib(surface, SWAP_BEHAVIOR);
+ setSurfaceAttrib(surface, MULTISAMPLE_RESOLVE);
+ }
+
+ private void setSurfaceAttrib(final EGLSurface surface, final Attrib attrib) throws LWJGLException {
+ final int value = getAttrib(attrib);
+ if ( value != attrib.getDefaultValue() )
+ surface.setAttribute(attrib.getEGLAttrib(), value);
+ }
+
+ /**
+ * Returns the value of the specified attribute.
+ *
+ * @param attrib the attribute to retrieve
+ *
+ * @return the attribute's value
+ */
+ public int getAttrib(final Attrib attrib) {
+ final Integer value = config.get(attrib);
+ if ( value == null )
+ return attrib.defaultValue;
+
+ return value;
+ }
+
+ /* -----------------------------------------
+ CORE ATTRIBUTES
+ ----------------------------------------- */
+
+ /**
+ * Returns a new PixelFormat with the specified RGB sizes.
+ *
+ * @param rgb the new EGL_RED_SIZE, EGL_GREEN_SIZE and EGL_BLUE_SIZE
+ *
+ * @return the new PixelFormat
+ *
+ * @see #withRGBSize(int, int, int)
+ */
+ public PixelFormat withRGBSize(final int rgb) {
+ return withRGBSize(rgb, rgb, rgb);
+ }
+
+ /**
+ * Returns a new PixelFormat with the specified EGL_RED_SIZE, EGL_GREEN_SIZE and EGL_BLUE_SIZE.
+ * All 3 values must be greater than or equal to 0. If any of the 3 values is greater than 0,
+ * the luminanceSize will be set to 0.
+ *
+ * @param r the new EGL_RED_SIZE
+ * @param g the new EGL_GREEN_SIZE
+ * @param b the new EGL_BLUE_SIZE
+ *
+ * @return the new PixelFormat
+ */
+ public PixelFormat withRGBSize(final int r, final int g, final int b) {
+ if ( r < 0 || g < 0 || b < 0 )
+ throw new IllegalArgumentException("Invalid RGB sizes specified: " + r + ", " + g + ", " + b);
+
+ final PixelFormat pf = new PixelFormat(this);
+ pf.setAttrib(RED_SIZE, r);
+ pf.setAttrib(GREEN_SIZE, g);
+ pf.setAttrib(BLUE_SIZE, b);
+ if ( 0 < r || 0 < g || 0 < b )
+ pf.setAttrib(LUMINANCE_SIZE, 0);
+ return pf;
+ }
+
+ /**
+ * Returns a new PixelFormat with the specified EGL_ALPHA_SIZE.
+ * The alphaSize value must be greater than or equal to 0.
+ *
+ * @param alphaSize the new EGL_ALPHA_SIZE
+ *
+ * @return the new PixelFormat
+ */
+ public PixelFormat withAlphaSize(final int alphaSize) {
+ if ( alphaSize < 0 )
+ throw new IllegalArgumentException("Invalid EGL_ALPHA_SIZE specified: " + alphaSize);
+
+ final PixelFormat pf = new PixelFormat(this);
+ pf.setAttrib(ALPHA_SIZE, alphaSize);
+ return pf;
+ }
+
+ /**
+ * Returns a new PixelFormat with the specified EGL_LUMINANCE_SIZE.
+ * The luminanceSize value must be greater than or equal to 0. If
+ * luminanceSize is greater than 0, the RGB sizes will be set to 0.
+ *
+ * @param luminanceSize the new EGL_LUMINANCE_SIZE
+ *
+ * @return the new PixelFormat
+ */
+ public PixelFormat withLuminanceSize(final int luminanceSize) {
+ if ( luminanceSize < 0 )
+ throw new IllegalArgumentException("Invalid EGL_LUMINANCE_SIZE specified: " + luminanceSize);
+
+ final PixelFormat pf = new PixelFormat(this);
+ pf.setAttrib(LUMINANCE_SIZE, luminanceSize);
+ if ( 0 < luminanceSize ) {
+ pf.setAttrib(RED_SIZE, 0);
+ pf.setAttrib(GREEN_SIZE, 0);
+ pf.setAttrib(BLUE_SIZE, 0);
+ }
+ return pf;
+ }
+
+ /**
+ * Returns a new PixelFormat with the specified EGL_DEPTH_SIZE.
+ * The depthSize value must be greater than or equal to 0.
+ * Values greater than 24 are not recommended.
+ *
+ * @param depthSize the new EGL_DEPTH_SIZE
+ *
+ * @return the new PixelFormat
+ */
+ public PixelFormat withDepthSize(final int depthSize) {
+ if ( depthSize < 0 )
+ throw new IllegalArgumentException("Invalid EGL_DEPTH_SIZE specified: " + depthSize);
+
+ final PixelFormat pf = new PixelFormat(this);
+ pf.setAttrib(DEPTH_SIZE, depthSize);
+ return pf;
+ }
+
+ /**
+ * Returns a new PixelFormat with the specified EGL_STENCIL_SIZE.
+ * The stencilSize value must be greater than or equal to 0.
+ * Values greater than 8 are not recommended.
+ *
+ * @param stencilSize the new EGL_STENCIL_SIZE
+ *
+ * @return the new PixelFormat
+ */
+ public PixelFormat withStencilSize(final int stencilSize) {
+ if ( stencilSize < 0 )
+ throw new IllegalArgumentException("Invalid EGL_STENCIL_SIZE specified: " + stencilSize);
+
+ final PixelFormat pf = new PixelFormat(this);
+ pf.setAttrib(STENCIL_SIZE, stencilSize);
+ return pf;
+ }
+
+ /**
+ * Returns a new PixelFormat with the specified EGL_MIN_SWAP_INTERVAL.
+ * The minSwapInterval value must be between 0 and this PixelFormat's EGL_MAX_SWAP_INTERVAL.
+ *
+ * @param minSwapInterval the new EGL_MIN_SWAP_INTERVAL value
+ *
+ * @return the new PixelFormat
+ */
+ public PixelFormat withMinSwapInterval(final int minSwapInterval) {
+ final int maxSwapInterval = getAttrib(MAX_SWAP_INTERVAL);
+ if ( minSwapInterval != EGL_DONT_CARE && (minSwapInterval < 0 || (maxSwapInterval != EGL_DONT_CARE && maxSwapInterval < minSwapInterval)) )
+ throw new IllegalArgumentException("Invalid EGL_MIN_SWAP_INTERVAL specified: " + minSwapInterval);
+
+ final PixelFormat pf = new PixelFormat(this);
+ pf.setAttrib(MIN_SWAP_INTERVAL, minSwapInterval);
+ return pf;
+ }
+
+ /**
+ * Returns a new PixelFormat with the specified EGL_MAX_SWAP_INTERVAL.
+ * The maxSwapInterval value must be greater than or equal to this PixelFormat's EGL_MIN_SWAP_INTERVAL.
+ *
+ * @param maxSwapInterval the new EGL_MAX_SWAP_INTERVAL value
+ *
+ * @return the new PixelFormat
+ */
+ public PixelFormat withMaxSwapInterval(final int maxSwapInterval) {
+ if ( maxSwapInterval < getAttrib(MIN_SWAP_INTERVAL) )
+ throw new IllegalArgumentException("Invalid EGL_MAX_SWAP_INTERVAL specified: " + maxSwapInterval);
+
+ final PixelFormat pf = new PixelFormat(this);
+ pf.setAttrib(MAX_SWAP_INTERVAL, maxSwapInterval);
+ return pf;
+ }
+
+ /**
+ * Returns a new PixelFormat with the specified number of EGL_SAMPLES.
+ * The samples value must be either 0 or greater than or equal to 2. The related
+ * EGL_SAMPLE_BUFFERS value will become 0 if samples is 0, or 1 if samples
+ * is greater than or equal to 2.
+ *
+ * @param samples the new EGL_SAMPLES value
+ *
+ * @return the new PixelFormat
+ */
+ public PixelFormat withSamples(final int samples) {
+ if ( samples != 0 && samples < 2 )
+ throw new IllegalArgumentException("Invalid number of EGL_SAMPLES specified: " + samples);
+
+ final PixelFormat pf = new PixelFormat(this);
+ pf.setAttrib(SAMPLES, samples);
+ pf.setAttrib(SAMPLE_BUFFERS, samples == 0 ? 0 : 1);
+ return pf;
+ }
+
+ private static int maxValue(final int bits) {
+ return (2 << bits) - 1;
+ }
+
+ /**
+ * Returns a new PixelFormat with the specified EGL_TRANSPARENT_TYPE and
+ * the specified transparent RGB values. The transparentType must be
+ * either EGL_NONE or EGL_TRANSPARENT_RGB. When it is EGL_NONE, the RGB
+ * values are set to zero and ignored. When it is EGL_TRANSPARENT_RGB,
+ * the RGB values must be between 0 and 2^rgbSize - 1.
+ *
+ * @param transparentType the new EGL_TRANSPARENT_TYPE value
+ * @param r the new EGL_TRANSPARENT_RED_VALUE
+ * @param g the new EGL_TRANSPARENT_GREEN_VALUE
+ * @param b the new EGL_TRANSPARENT_BLUE_VALUE
+ *
+ * @return the new PixelFormat
+ */
+ public PixelFormat withTransparentType(final int transparentType, int r, int g, int b) {
+ if ( transparentType == EGL_TRANSPARENT_RGB ) {
+ final int redSize = getAttrib(RED_SIZE);
+ final int greenSize = getAttrib(GREEN_SIZE);
+ final int blueSize = getAttrib(BLUE_SIZE);
+ if ( r < 0 || (0 < redSize && maxValue(redSize) < r) )
+ throw new IllegalArgumentException("Invalid EGL_TRANSPARENT_RED_VALUE specified: " + r);
+
+ if ( r < 0 || (0 < greenSize && maxValue(greenSize) < g) )
+ throw new IllegalArgumentException("Invalid EGL_TRANSPARENT_GREEN_VALUE specified: " + g);
+
+ if ( r < 0 || (0 < blueSize && maxValue(blueSize) < b) )
+ throw new IllegalArgumentException("Invalid EGL_TRANSPARENT_BLUE_VALUE specified: " + b);
+ } else if ( transparentType != EGL_NONE )
+ throw new IllegalArgumentException("Invalid EGL_TRANSPARENT_TYPE specified: " + transparentType);
+ else
+ r = g = b = EGL_DONT_CARE;
+
+ final PixelFormat pf = new PixelFormat(this);
+
+ pf.setAttrib(TRANSPARENT_TYPE, transparentType);
+
+ pf.setAttrib(TRANSPARENT_RED_VALUE, r);
+ pf.setAttrib(TRANSPARENT_GREEN_VALUE, g);
+ pf.setAttrib(TRANSPARENT_BLUE_VALUE, b);
+
+ return pf;
+ }
+
+ /* -----------------------------------------
+ SURFACE ATTRIBUTES
+ ----------------------------------------- */
+
+ /**
+ * Returns a new PixelFormat with the specified EGL_MULTISAMPLE_RESOLVE value.
+ * Valid values for multisampleResolve are EGL_MULTISAMPLE_RESOLVE_DEFAULT
+ * and EGL_MULTISAMPLE_RESOLVE_BOX.
+ *
+ * An IllegalStateException will be thrown if EGL_SAMPLES has not been previously defined
+ * to be greater than or equal to 2.
+ *
+ * @param multisampleResolve the new EGL_MULTISAMPLE_RESOLVE value
+ *
+ * @return the new PixelFormat
+ */
+ public PixelFormat withMultisampleResolve(final int multisampleResolve) {
+ if ( multisampleResolve != EGL_MULTISAMPLE_RESOLVE_DEFAULT && multisampleResolve != EGL_MULTISAMPLE_RESOLVE_BOX )
+ throw new IllegalArgumentException("Invalid EGL_MULTISAMPLE_RESOLVE value specified: " + multisampleResolve);
+
+ if ( getAttrib(SAMPLE_BUFFERS) == 0 )
+ throw new IllegalStateException("An EGL_MULTISAMPLE_RESOLVE value cannot be specified unless EGL_SAMPLE_BUFFERS is 1.");
+
+ final PixelFormat pf = new PixelFormat(this);
+ pf.setAttrib(MULTISAMPLE_RESOLVE, multisampleResolve);
+ return pf;
+ }
+
+ /**
+ * Returns a new PixelFormat with the specified EGL_SWAP_BEHAVIOR value.
+ * Valid values for swapBehavior are EGL_DONT_CARE, EGL_BUFFER_PRESERVED
+ * and EGL_BUFFER_DESTROYED.
+ *
+ * @param swapBehavior the new EGL_SWAP_BEHAVIOR value
+ *
+ * @return the new PixelFormat
+ */
+ public PixelFormat withSwapBehavior(final int swapBehavior) {
+ switch ( swapBehavior ) {
+ case EGL_DONT_CARE:
+ case EGL_BUFFER_PRESERVED:
+ case EGL_BUFFER_DESTROYED:
+ break;
+ default:
+ throw new IllegalArgumentException("Invalid EGL_SWAP_BEHAVIOR value specified: " + swapBehavior);
+ }
+
+ final PixelFormat pf = new PixelFormat(this);
+ pf.setAttrib(SWAP_BEHAVIOR, swapBehavior);
+ return pf;
+ }
+
+ /* -----------------------------------------
+ EXTENSION ATTRIBUTES
+ ----------------------------------------- */
+
+ /**
+ * Returns a new PixelFormat with the specified number of EGL_COVERAGE_SAMPLES_NV.
+ * The samples value must be greater than or equal to 0. The related
+ * EGL_COVERAGE_BUFFERS_NV value will become 0 if samples is 0, or 1 if samples
+ * is greater than 0.
+ *
+ * @param samples the new EGL_SAMPLES value
+ *
+ * @return the new PixelFormat
+ */
+ public PixelFormat withCoverageSamplesNV(final int samples) {
+ if ( samples < 0 )
+ throw new IllegalArgumentException("Invalid number of EGL_COVERAGE_SAMPLES_NV specified: " + samples);
+
+ final PixelFormat pf = new PixelFormat(this);
+ pf.setAttrib(COVERAGE_SAMPLES_NV, samples);
+ pf.setAttrib(COVERAGE_BUFFERS_NV, samples == 0 ? 0 : 1);
+ return pf;
+ }
+
+ /**
+ * Returns a new PixelFormat with the specified EGL_DEPTH_ENCODING_NONLINEAR_NV.
+ * Valid values for depthEncoding are EGL_DONT_CARE, EGL_DEPTH_ENCODING_NONE_NV
+ * and EGL_DEPTH_ENCODING_NONLINEAR_NV.
+ *
+ * @param depthEncoding the new EGL_DEPTH_ENCODING_NONLINEAR_NV value
+ *
+ * @return the new PixelFormat
+ */
+ public PixelFormat withDepthEncodingNonlinearNV(final int depthEncoding) {
+ switch ( depthEncoding ) {
+ case EGL_DONT_CARE:
+ case EGL_DEPTH_ENCODING_NONE_NV:
+ case EGL_DEPTH_ENCODING_NONLINEAR_NV:
+ break;
+ default:
+ throw new IllegalArgumentException("Invalid EGL_DEPTH_ENCODING_NONLINEAR_NV value specified: " + depthEncoding);
+ }
+
+ final PixelFormat pf = new PixelFormat(this);
+ pf.setAttrib(DEPTH_ENCODING_NONLINEAR_NV, depthEncoding);
+ return pf;
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengles/PowerManagementEventException.java b/src/java/org/lwjgl/opengles/PowerManagementEventException.java
new file mode 100644
index 00000000..9da6a8f0
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/PowerManagementEventException.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+/**
+ * A PowerManagementEventException exception will be thrown when a call
+ * to eglSwapBuffers, eglCopyBuffers or eglMakeCurrent returns EGL_FALSE
+ * and the EGL_ERROR generated is EGL_CONTEXT_LOST.
+ *
+ * On detection of this error, the application must destroy all contexts.
+ * To continue rendering the application must recreate any contexts it
+ * requires, and subsequently restore any client API state and objects
+ * it wishes to use.
+ *
+ * Note that not all implementations can be made to generate power management
+ * events, and developers should continue to refer to platform-specific
+ * documentation in this area.
+ */
+public class PowerManagementEventException extends RuntimeException {
+
+ static final long serialVersionUID = -1L;
+
+ public PowerManagementEventException() {
+ super();
+ }
+
+ public PowerManagementEventException(final String message) {
+ super(message);
+ }
+
+ public PowerManagementEventException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public PowerManagementEventException(final Throwable cause) {
+ super(cause);
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengles/StateTracker.java b/src/java/org/lwjgl/opengles/StateTracker.java
new file mode 100644
index 00000000..32d4a6c2
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/StateTracker.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import java.nio.Buffer;
+
+import static org.lwjgl.opengles.GLES20.*;
+
+final class StateTracker {
+
+ private static StateTracker tracker = new StateTracker();
+
+ int elementArrayBuffer;
+ int arrayBuffer;
+
+ Buffer[] glVertexAttribPointer_buffer;
+
+ StateTracker() {
+ }
+
+ void init() {
+ glVertexAttribPointer_buffer = new Buffer[glGetInteger(GL_MAX_VERTEX_ATTRIBS)];
+ }
+
+ static StateTracker getTracker() {
+ return tracker;
+ }
+
+ static void bindBuffer(int target, int buffer) {
+ final StateTracker tracker = getTracker();
+
+ switch ( target ) {
+ case GL_ARRAY_BUFFER:
+ tracker.arrayBuffer = buffer;
+ break;
+ case GL_ELEMENT_ARRAY_BUFFER:
+ tracker.elementArrayBuffer = buffer;
+ break;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/opengles/Util.java b/src/java/org/lwjgl/opengles/Util.java
new file mode 100644
index 00000000..98699d82
--- /dev/null
+++ b/src/java/org/lwjgl/opengles/Util.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.LWJGLException;
+import org.lwjgl.opengl.OpenGLException;
+
+import static org.lwjgl.opengles.EGL.*;
+import static org.lwjgl.opengles.GLES20.*;
+
+/**
+ * Simple utility class.
+ *
+ * @author Spasi
+ */
+public final class Util {
+
+ private Util() {
+ }
+
+ /**
+ * Checks for OpenGL ES errors.
+ *
+ * @throws org.lwjgl.opengl.OpenGLException
+ * if GLES20.glGetError() returns anything else than GLES20.GL_NO_ERROR
+ */
+ public static void checkGLError() throws OpenGLException {
+ int err = glGetError();
+ if ( err != GL_NO_ERROR )
+ throw new OpenGLException(err);
+ }
+
+ /**
+ * Translates a GL error code to a String describing the error.
+ *
+ * @param error_code the OpenGL ES error code
+ *
+ * @return the error description
+ */
+ public static String translateGLErrorString(int error_code) {
+ switch ( error_code ) {
+ case GL_NO_ERROR:
+ return "No error";
+ case GL_INVALID_ENUM:
+ return "Invalid enum";
+ case GL_INVALID_VALUE:
+ return "Invalid value";
+ case GL_INVALID_OPERATION:
+ return "Invalid operation";
+ case GL_OUT_OF_MEMORY:
+ return "Out of memory";
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Checks for EGL errors.
+ *
+ * @throws org.lwjgl.LWJGLException if EGL.eglGetError() returns anything else than EGL.EGL_SUCCESS
+ */
+ static void checkEGLError() throws LWJGLException {
+ int err = eglGetError();
+ if ( err != EGL_SUCCESS )
+ throw new LWJGLException(translateEGLErrorString(err));
+ }
+
+ /**
+ * Translates an EGL error code to a String describing the error.
+ *
+ * @param error_code the EGL error code
+ *
+ * @return the error description
+ */
+ static String translateEGLErrorString(int error_code) {
+ switch ( error_code ) {
+ case EGL_NOT_INITIALIZED:
+ return "EGL not initialized";
+ case EGL_BAD_ACCESS:
+ return "Bad access";
+ case EGL_BAD_ALLOC:
+ return "Bad allocation";
+ case EGL_BAD_ATTRIBUTE:
+ return "Bad attribute";
+ case EGL_BAD_CONFIG:
+ return "Bad config";
+ case EGL_BAD_CONTEXT:
+ return "Bad EGL context";
+ case EGL_BAD_CURRENT_SURFACE:
+ return "Bad current EGL surface";
+ case EGL_BAD_DISPLAY:
+ return "Bad EGL display";
+ case EGL_BAD_MATCH:
+ return "Bad match";
+ case EGL_BAD_NATIVE_PIXMAP:
+ return "Bad native pixmap";
+ case EGL_BAD_NATIVE_WINDOW:
+ return "Bad native window";
+ case EGL_BAD_PARAMETER:
+ return "Bad parameter";
+ case EGL_BAD_SURFACE:
+ return "Bad EGL surface";
+ case EGL_CONTEXT_LOST:
+ return "EGL context lost";
+ default:
+ return null;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengles/FullScreenWindowedTest.java b/src/java/org/lwjgl/test/opengles/FullScreenWindowedTest.java
new file mode 100644
index 00000000..59c1bd67
--- /dev/null
+++ b/src/java/org/lwjgl/test/opengles/FullScreenWindowedTest.java
@@ -0,0 +1,327 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR 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.opengles;
+
+import org.lwjgl.BufferUtils;
+import org.lwjgl.LWJGLException;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.opengl.Display;
+import org.lwjgl.opengl.DisplayMode;
+import org.lwjgl.opengles.PixelFormat;
+import org.lwjgl.opengles.PowerManagementEventException;
+import org.lwjgl.util.vector.Vector2f;
+
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+
+import static org.lwjgl.opengles.GLES20.*;
+import static org.lwjgl.test.opengles.util.GLMatrix.*;
+
+/**
+ * Tests switching between windowed and fullscreen
+ *
+ * @author Brian Matzon
+ * @version $Revision: 3172 $
+ * $Id: FullScreenWindowedTest.java 3172 2008-12-28 19:30:43Z elias_naur $
+ */
+public class FullScreenWindowedTest {
+
+ /** Intended deiplay mode */
+ private DisplayMode mode;
+ /** our quad moving around */
+ private Vector2f quadPosition;
+ /** our quadVelocity */
+ private Vector2f quadVelocity;
+ /** angle of quad */
+ private float angle;
+ /** degrees to rotate per frame */
+ private float angleRotation = 1.0f;
+ /** Max speed of all changable attributes */
+ private static final float MAX_SPEED = 20.0f;
+
+ private static int buffer_id;
+ private static int indices_buffer_id;
+
+ private QuadRenderer renderer;
+
+ /** Creates a FullScreenWindowedTest */
+ public FullScreenWindowedTest() {
+ }
+
+ /** Executes the test */
+ public void execute() {
+ initialize();
+ mainLoop();
+ cleanup();
+ Display.destroy();
+ }
+
+ private void switchMode() throws LWJGLException {
+ mode = findDisplayMode(1024, 600, Display.getDisplayMode().getBitsPerPixel());
+ try {
+ Display.setDisplayModeAndFullscreen(mode);
+ } catch (PowerManagementEventException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /** Initializes the test */
+ private void initialize() {
+ try {
+ //find displaymode
+ switchMode();
+ // start of in windowed mode
+ Display.create(new PixelFormat());
+ glInit();
+ quadPosition = new Vector2f(100f, 100f);
+ quadVelocity = new Vector2f(1.0f, 1.0f);
+
+ renderer = new QuadRenderer();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /** Runs the main loop of the "test" */
+ private void mainLoop() {
+ while ( !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) && !Display.isCloseRequested() ) {
+ if ( Display.isVisible() ) {
+ // check keyboard input
+ processKeyboard();
+ // do "game" logic, and render it
+ logic();
+ render();
+ } else {
+ // no need to render/paint if nothing has changed (ie. window
+ // dragged over)
+ if ( Display.isDirty() ) {
+ render();
+ }
+ // don't waste cpu time, sleep more
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException inte) {
+ }
+ }
+ // Update window
+ try {
+ Display.update();
+ Display.sync(60);
+ } catch (PowerManagementEventException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /** Performs the logic */
+ private void logic() {
+ angle += angleRotation;
+ if ( angle > 90.0f ) {
+ angle = 0.0f;
+ }
+ quadPosition.x += quadVelocity.x;
+ quadPosition.y += quadVelocity.y;
+ //check colision with vertical border border
+ if ( quadPosition.x + 50 >= mode.getWidth() || quadPosition.x - 50 <= 0 ) {
+ quadVelocity.x *= -1;
+ }
+ //check collision with horizontal border
+ if ( quadPosition.y + 50 >= mode.getHeight() || quadPosition.y - 50 <= 0 ) {
+ quadVelocity.y *= -1;
+ }
+ }
+
+ private void render() {
+ //clear background
+ glClear(GL_COLOR_BUFFER_BIT);
+ // draw white quad
+ glPushMatrix();
+ {
+ glTranslatef(quadPosition.x, quadPosition.y, 0);
+ glRotatef(angle, 0.0f, 0.0f, 1.0f);
+
+ renderer.setMVPUniform();
+
+ glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT, 0);
+ }
+ glPopMatrix();
+ }
+
+ /** Processes keyboard input */
+ private void processKeyboard() {
+ //check for fullscreen key
+ if ( Keyboard.isKeyDown(Keyboard.KEY_F) ) {
+ try {
+ cleanup();
+
+ switchMode();
+
+ glInit();
+ renderer = new QuadRenderer();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ //check for window key
+ if ( Keyboard.isKeyDown(Keyboard.KEY_W) ) {
+ try {
+ cleanup();
+
+ mode = new DisplayMode(800, 480);
+ Display.setDisplayModeAndFullscreen(mode);
+
+ glInit();
+ renderer = new QuadRenderer();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ //check for speed changes
+ if ( Keyboard.isKeyDown(Keyboard.KEY_UP) ) {
+ quadVelocity.y += 0.1f;
+ }
+ if ( Keyboard.isKeyDown(Keyboard.KEY_DOWN) ) {
+ quadVelocity.y -= 0.1f;
+ }
+ if ( Keyboard.isKeyDown(Keyboard.KEY_RIGHT) ) {
+ quadVelocity.x += 0.1f;
+ }
+ if ( Keyboard.isKeyDown(Keyboard.KEY_LEFT) ) {
+ quadVelocity.x -= 0.1f;
+ }
+ if ( Keyboard.isKeyDown(Keyboard.KEY_ADD) ) {
+ angleRotation += 0.1f;
+ }
+ if ( Keyboard.isKeyDown(Keyboard.KEY_SUBTRACT) ) {
+ angleRotation -= 0.1f;
+ }
+ //throttle
+ if ( quadVelocity.x < -MAX_SPEED ) {
+ quadVelocity.x = -MAX_SPEED;
+ }
+ if ( quadVelocity.x > MAX_SPEED ) {
+ quadVelocity.x = MAX_SPEED;
+ }
+ if ( quadVelocity.y < -MAX_SPEED ) {
+ quadVelocity.y = -MAX_SPEED;
+ }
+ if ( quadVelocity.y > MAX_SPEED ) {
+ quadVelocity.y = MAX_SPEED;
+ }
+ if ( angleRotation < 0.0f ) {
+ angleRotation = 0.0f;
+ }
+ if ( angleRotation > MAX_SPEED ) {
+ angleRotation = MAX_SPEED;
+ }
+ }
+
+ /** Cleans up the test */
+ private void cleanup() {
+ renderer.cleanup();
+
+ IntBuffer int_buffer = BufferUtils.createIntBuffer(2);
+ int_buffer.put(0, buffer_id);
+ int_buffer.put(1, indices_buffer_id);
+
+ glDeleteBuffers(int_buffer);
+ }
+
+ /**
+ * Retrieves a displaymode, if one such is available
+ *
+ * @param width Required width
+ * @param height Required height
+ * @param bpp Minimum required bits per pixel
+ *
+ * @return
+ */
+ private static 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];
+ }
+ }
+ return Display.getDesktopDisplayMode();
+ }
+
+ /** Initializes OGL */
+ private void glInit() {
+ // Go into orthographic projection mode.
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, mode.getWidth(), 0, mode.getHeight(), -1.0f, 1.0f);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+
+ glViewport(0, 0, mode.getWidth(), mode.getHeight());
+ //set clear color to black
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+
+ //sync frame (only works on windows)
+ Display.setVSyncEnabled(true);
+
+ final IntBuffer int_buffer = BufferUtils.createIntBuffer(2);
+ glGenBuffers(int_buffer);
+ buffer_id = int_buffer.get(0);
+ indices_buffer_id = int_buffer.get(1);
+
+ glBindBuffer(GL_ARRAY_BUFFER, buffer_id);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indices_buffer_id);
+
+ final FloatBuffer vertices = BufferUtils.createFloatBuffer(2 * 4);
+ vertices
+ .put(-50).put(-50)
+ .put(50).put(-50)
+ .put(-50).put(50)
+ .put(50).put(50);
+ vertices.rewind();
+
+ final IntBuffer indices = BufferUtils.createIntBuffer(4);
+ indices.put(0).put(1).put(2).put(3);
+ indices.rewind();
+
+ glBufferData(GL_ARRAY_BUFFER, vertices, GL_STATIC_DRAW);
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices, GL_STATIC_DRAW);
+ }
+
+ /** Test entry point */
+ public static void main(String[] args) {
+ System.out.println("Change between fullscreen and windowed mode, by pressing F and W respectively");
+ System.out.println("Move quad using arrowkeys, and change rotation using +/-");
+ FullScreenWindowedTest fswTest = new FullScreenWindowedTest();
+ fswTest.execute();
+ System.exit(0);
+ }
+}
diff --git a/src/java/org/lwjgl/test/opengles/Gears.java b/src/java/org/lwjgl/test/opengles/Gears.java
new file mode 100644
index 00000000..58994ba8
--- /dev/null
+++ b/src/java/org/lwjgl/test/opengles/Gears.java
@@ -0,0 +1,580 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * 3-D gear wheels. Originally by Brian Paul
+ */
+package org.lwjgl.test.opengles;
+
+import org.lwjgl.BufferUtils;
+import org.lwjgl.LWJGLException;
+import org.lwjgl.Sys;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.Display;
+import org.lwjgl.opengl.DisplayMode;
+import org.lwjgl.opengles.*;
+import org.lwjgl.test.opengles.util.Geometry;
+import org.lwjgl.test.opengles.util.ImmediateModeBuffer;
+import org.lwjgl.test.opengles.util.Shader;
+import org.lwjgl.test.opengles.util.ShaderProgram;
+import org.lwjgl.util.vector.Matrix4f;
+import org.lwjgl.util.vector.Vector3f;
+
+import java.lang.reflect.Field;
+import java.nio.FloatBuffer;
+import java.util.StringTokenizer;
+
+import static org.lwjgl.opengles.GLES20.*;
+import static org.lwjgl.test.opengles.util.GLLight.*;
+import static org.lwjgl.test.opengles.util.GLMatrix.*;
+import static org.lwjgl.test.opengles.util.Geometry.*;
+
+/**
+ *
+ * This is the OpenGL "standard" Gears demo, originally by Brian Paul
+ *
+ *
+ * @author Brian Matzon
+ * @version $Revision: 3276 $
+ * $Id: Gears.java 3276 2010-02-21 21:18:17Z matzon $
+ */
+public class Gears {
+
+ private boolean run = true;
+
+ private float view_rotx = 20.0f;
+
+ private float view_roty = 30.0f;
+
+ private float view_rotz = 0.0f;
+
+ private Gear gear1;
+
+ private Gear gear2;
+
+ private Gear gear3;
+
+ private float angle = 0.0f;
+
+ private Shader vsh;
+ private Shader fsh;
+
+ private ShaderProgram program;
+
+ private int LIGHT_POS;
+
+ private int MVP;
+ private int NM;
+
+ private int GEAR_COLOR;
+
+ private int vPosition;
+ private int vNormal;
+
+ private final Matrix4f p = new Matrix4f();
+ private final Matrix4f mv = new Matrix4f();
+ private final Matrix4f mvp = new Matrix4f();
+
+ private final FloatBuffer m4fBuffer = BufferUtils.createFloatBuffer(4 * 4);
+ private final FloatBuffer m3fBuffer = BufferUtils.createFloatBuffer(3 * 3);
+
+ public static void main(String[] args) {
+ new Gears().execute();
+ System.exit(0);
+ }
+
+ /**
+ *
+ */
+ private void execute() {
+ try {
+ init();
+ } catch (LWJGLException e) {
+ e.printStackTrace();
+ System.out.println("Failed to initialize Gears.");
+ return;
+ }
+
+ System.out.println("\nGL RENDERER: " + glGetString(GL_RENDERER));
+ System.out.println("GL VENDOR: " + glGetString(GL_VENDOR));
+ System.out.println("GL VERSION: " + glGetString(GL_VERSION));
+ System.out.println("GL_SHADING_LANGUAGE_VERSION: " + glGetString(GL_SHADING_LANGUAGE_VERSION));
+ System.out.println("GL_EXTENSIONS = " + glGetString(GL_EXTENSIONS));
+
+ ContextCapabilities caps = GLContext.getCapabilities();
+
+ System.out.println();
+
+ // Check extension support
+ Field[] field = ContextCapabilities.class.getFields();
+ for ( Field f : field ) {
+ if ( f.getName().startsWith("GL_") ) {
+ try {
+ System.out.println(f.getName() + " - " + f.getBoolean(caps));
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ System.out.println();
+
+ // Check for extensions that LWJGL does not support
+ final String extensions = glGetString(GL_EXTENSIONS);
+
+ final StringTokenizer tokenizer = new StringTokenizer(extensions);
+ while ( tokenizer.hasMoreTokens() ) {
+ final String ext = tokenizer.nextToken();
+ try {
+ if ( !caps.getClass().getField(ext).getBoolean(caps) )
+ System.out.println("-- Extension exposed but functions are missing: " + ext);
+ } catch (NoSuchFieldException e) {
+ System.out.println("-- No LWJGL support for extension: " + ext);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ loop();
+
+ destroy();
+ }
+
+ /**
+ *
+ */
+ private void destroy() {
+ program.destroy();
+
+ fsh.destroy();
+ vsh.destroy();
+
+ gear3.destroy();
+ gear2.destroy();
+ gear1.destroy();
+
+ Display.destroy();
+ }
+
+ /**
+ *
+ */
+ private void loop() {
+ long lastFrameTime = Sys.getTime();
+ long startTime = System.currentTimeMillis() + 5000;
+ long fps = 0;
+
+ while ( run ) {
+ if ( !Display.isVisible() )
+ Thread.yield();
+ else {
+ // This is the current frame time.
+ long frameStart = Sys.getTime();
+
+ // How many seconds passed since last frame.
+ final float frameTime = (float)((frameStart - lastFrameTime) / (double)Sys.getTimerResolution());
+ lastFrameTime = frameStart;
+
+ angle += frameTime * 120.0f;
+
+ handleInput();
+
+ //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_COVERAGE_BUFFER_BIT_NV);
+ 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);
+ gear1.render();
+ glPopMatrix();
+
+ glPushMatrix();
+ glTranslatef(3.1f, -2.0f, 0.0f);
+ glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f);
+ gear2.render();
+ glPopMatrix();
+
+ glPushMatrix();
+ glTranslatef(-3.1f, 4.2f, 0.0f);
+ glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f);
+ gear3.render();
+ glPopMatrix();
+
+ glPopMatrix();
+
+ try {
+ Display.update();
+ //Display.sync(60);
+ } catch (PowerManagementEventException e) {
+ e.printStackTrace();
+ }
+ if ( startTime > System.currentTimeMillis() ) {
+ fps++;
+ } else {
+ long timeUsed = 5000 + (startTime - System.currentTimeMillis());
+ startTime = System.currentTimeMillis() + 5000;
+ System.out.println(fps + " frames in " + (timeUsed / 1000f) + " seconds = " + (fps / (timeUsed / 1000f)));
+ fps = 0;
+ }
+
+ if ( Display.isCloseRequested() )
+ break;
+ }
+ }
+ }
+
+ private void handleInput() {
+ if ( Keyboard.getNumKeyboardEvents() != 0 ) {
+ while ( Keyboard.next() ) {
+ if ( Keyboard.getEventKeyState() )
+ continue;
+
+ final int key = Keyboard.getEventKey();
+ switch ( key ) {
+ case Keyboard.KEY_ESCAPE:
+ run = false;
+ break;
+ }
+ }
+ }
+
+ while ( Mouse.next() ) ;
+ }
+
+ /**
+ *
+ */
+ private void init() throws LWJGLException {
+ final int WIDTH = 640;
+ final int HEIGHT = 480;
+
+ Display.setLocation((Display.getDisplayMode().getWidth() - WIDTH) / 2,
+ (Display.getDisplayMode().getHeight() - HEIGHT) / 2);
+ try {
+ Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
+ } catch (PowerManagementEventException e) {
+ e.printStackTrace();
+ }
+ Display.setTitle("Gears");
+ Display.create(new PixelFormat());
+
+ //glCoverageMaskNV(true);
+
+ // setup ogl
+ glViewport(0, 0, WIDTH, HEIGHT);
+ glFrontFace(GL_CCW);
+ glCullFace(GL_BACK);
+ glEnable(GL_CULL_FACE);
+ glEnable(GL_DEPTH_TEST);
+
+ final Vector3f lp = new Vector3f(5.0f, 5.0f, 10.0f);
+ lp.normalise();
+ glLight(GL_LIGHT0, GL_POSITION, lp.getX(), lp.getY(), lp.getZ(), 0.0f);
+
+ /* make the gears */
+ gear1 = new Gear(gear(1.0f, 4.0f, 1.0f, 20, 0.7f), new float[] { 0.8f, 0.1f, 0.0f, 1.0f });
+ gear2 = new Gear(gear(0.5f, 2.0f, 2.0f, 10, 0.7f), new float[] { 0.0f, 0.8f, 0.2f, 1.0f });
+ gear3 = new Gear(gear(1.3f, 2.0f, 0.5f, 10, 0.7f), new float[] { 0.2f, 0.2f, 1.0f, 1.0f });
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+
+ final float h = (float)300 / (float)300;
+ glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glTranslatef(0.0f, 0.0f, -40.0f);
+
+ vsh = new Shader(GL_VERTEX_SHADER, "uniform highp vec4 LIGHT_POS;\n" +
+ "uniform highp mat4 MODEL_VIEW_PROJECTION_MATRIX;\n" +
+ "uniform mediump mat3 NORMAL_MATRIX;\n" +
+ "uniform lowp vec3 GEAR_COLOR;\n" +
+ "attribute highp vec3 vPosition;\n" +
+ "attribute mediump vec3 vNormal;\n" +
+ "varying lowp vec3 color;\n" +
+ "void main(void) {\n" +
+ "\tgl_Position = MODEL_VIEW_PROJECTION_MATRIX * vec4(vPosition, 1.0);\n" +
+ "\tvec3 normal = NORMAL_MATRIX * vNormal;\n" +
+ "\tcolor = max(dot(normal, vec3(LIGHT_POS)), 0.0) * GEAR_COLOR + vec3(0.05);\n" +
+ "}");
+
+ fsh = new Shader(GL_FRAGMENT_SHADER, "varying lowp vec3 color;\n" +
+ "void main(void) {\n" +
+ "\tgl_FragColor = vec4(color, 1.0);\n" +
+ "}");
+
+ program = new ShaderProgram(vsh, fsh);
+ program.enable();
+
+ LIGHT_POS = program.getUniformLocation("LIGHT_POS");
+
+ MVP = program.getUniformLocation("MODEL_VIEW_PROJECTION_MATRIX");
+ NM = program.getUniformLocation("NORMAL_MATRIX");
+
+ GEAR_COLOR = program.getUniformLocation("GEAR_COLOR");
+
+ vPosition = program.getAttributeLocation("vPosition");
+ vNormal = program.getAttributeLocation("vNormal");
+
+ glEnableVertexAttribArray(vNormal);
+ glEnableVertexAttribArray(vPosition);
+ }
+
+ /**
+ * Draw a gear wheel. You'll probably want to call this function when
+ * building a display list since we do a lot of trig here.
+ *
+ * @param inner_radius radius of hole at center
+ * @param outer_radius radius at center of teeth
+ * @param width width of gear
+ * @param teeth number of teeth
+ * @param tooth_depth depth of tooth
+ */
+ private static Geometry gear(float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) {
+ int i;
+ float r0, r1, r2;
+ float angle, da;
+ float u, v, len;
+
+ r0 = inner_radius;
+ r1 = outer_radius - tooth_depth / 2.0f;
+ r2 = outer_radius + tooth_depth / 2.0f;
+
+ da = 2.0f * (float)Math.PI / teeth / 4.0f;
+
+ final Geometry gear = new Geometry();
+ final ImmediateModeBuffer imb = new ImmediateModeBuffer(1024);
+ int lastDrawIndex = 0;
+
+ //glShadeModel(GL_FLAT);
+
+ // draw front face
+ lastDrawIndex += gear.addDrawCommand(GL_TRIANGLE_STRIP, lastDrawIndex, teeth * 4 + 2);
+ for ( i = 0; i <= teeth; i++ ) {
+ angle = i * 2.0f * (float)Math.PI / teeth;
+
+ imb.glNormal3f(0.0f, 0.0f, 1.0f);
+ imb.glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5f);
+
+ imb.glNormal3f(0.0f, 0.0f, 1.0f);
+ imb.glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5f);
+
+ if ( i < teeth ) {
+ imb.glNormal3f(0.0f, 0.0f, 1.0f);
+ imb.glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5f);
+
+ imb.glNormal3f(0.0f, 0.0f, 1.0f);
+ imb.glVertex3f(r1 * cos(angle + 3.0f * da), r1 * sin(angle + 3.0f * da), width * 0.5f);
+ }
+ }
+
+ // draw front sides of teeth
+ for ( i = 0; i < teeth; i++ ) {
+ lastDrawIndex += gear.addDrawCommand(GL_TRIANGLE_STRIP, lastDrawIndex, 4);
+
+ angle = i * 2.0f * (float)Math.PI / teeth;
+
+ imb.glNormal3f(0.0f, 0.0f, 1.0f);
+ imb.glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5f);
+
+ imb.glNormal3f(0.0f, 0.0f, 1.0f);
+ imb.glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5f);
+
+ imb.glNormal3f(0.0f, 0.0f, 1.0f);
+ imb.glVertex3f(r1 * cos(angle + 3.0f * da), r1 * sin(angle + 3.0f * da), width * 0.5f);
+
+ imb.glNormal3f(0.0f, 0.0f, 1.0f);
+ imb.glVertex3f(r2 * cos(angle + 2.0f * da), r2 * sin(angle + 2.0f * da), width * 0.5f);
+ }
+
+ // draw back face
+ lastDrawIndex += gear.addDrawCommand(GL_TRIANGLE_STRIP, lastDrawIndex, (teeth + 1) * 4);
+ for ( i = 0; i <= teeth; i++ ) {
+ angle = i * 2.0f * (float)Math.PI / teeth;
+
+ imb.glNormal3f(0.0f, 0.0f, 1.0f);
+ imb.glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5f);
+
+ imb.glNormal3f(0.0f, 0.0f, 1.0f);
+ imb.glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5f);
+
+ imb.glNormal3f(0.0f, 0.0f, 1.0f);
+ imb.glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5f);
+
+ imb.glNormal3f(0.0f, 0.0f, 1.0f);
+ imb.glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5f);
+ }
+
+ // draw back sides of teeth
+ for ( i = 0; i < teeth; i++ ) {
+ lastDrawIndex += gear.addDrawCommand(GL_TRIANGLE_STRIP, lastDrawIndex, 4);
+
+ angle = i * 2.0f * (float)Math.PI / teeth;
+
+ imb.glNormal3f(0.0f, 0.0f, 1.0f);
+ imb.glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5f);
+
+ imb.glNormal3f(0.0f, 0.0f, 1.0f);
+ imb.glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5f);
+
+ imb.glNormal3f(0.0f, 0.0f, 1.0f);
+ imb.glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5f);
+
+ imb.glNormal3f(0.0f, 0.0f, 1.0f);
+ imb.glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5f);
+ }
+
+ // draw outward faces of teeth
+ // OpenGL ES 2.0 note: This needs to be converted to a triangle
+ // list with face normals to get the flat look of the original.
+ lastDrawIndex += gear.addDrawCommand(GL_TRIANGLE_STRIP, lastDrawIndex, teeth * 8 + 2);
+ for ( i = 0; i < teeth; i++ ) {
+ angle = i * 2.0f * (float)Math.PI / teeth;
+
+ imb.glNormal3f(cos(angle), sin(angle), 0.0f);
+ imb.glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5f);
+
+ imb.glNormal3f(cos(angle), sin(angle), 0.0f);
+ imb.glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5f);
+
+ u = r2 * cos(angle + da) - r1 * cos(angle);
+ v = r2 * sin(angle + da) - r1 * sin(angle);
+ len = (float)Math.sqrt(u * u + v * v);
+ u /= len;
+ v /= len;
+
+ imb.glNormal3f(v, -u, 0.0f);
+ imb.glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5f);
+
+ imb.glNormal3f(v, -u, 0.0f);
+ imb.glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5f);
+
+ imb.glNormal3f(cos(angle), sin(angle), 0.0f);
+ imb.glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5f);
+
+ imb.glNormal3f(cos(angle), sin(angle), 0.0f);
+ imb.glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5f);
+
+ u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
+ v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
+
+ imb.glNormal3f(v, -u, 0.0f);
+ imb.glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5f);
+
+ imb.glNormal3f(v, -u, 0.0f);
+ imb.glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5f);
+ }
+ imb.glNormal3f(cos(0), sin(0), 0.0f);
+ imb.glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5f);
+
+ imb.glNormal3f(cos(0), sin(0), 0.0f);
+ imb.glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5f);
+
+ //glShadeModel(GL_SMOOTH);
+
+ // draw inside radius cylinder
+ lastDrawIndex += gear.addDrawCommand(GL_TRIANGLE_STRIP, lastDrawIndex, (teeth + 1) * 2);
+ for ( i = 0; i <= teeth; i++ ) {
+ angle = i * 2.0f * (float)Math.PI / teeth;
+
+ imb.glNormal3f(-cos(angle), -sin(angle), 0.0f);
+ imb.glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5f);
+
+ imb.glNormal3f(-cos(angle), -sin(angle), 0.0f);
+ imb.glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5f);
+ }
+
+ gear.update(imb.getBuffer());
+ return gear;
+ }
+
+ private class Gear {
+
+ private final Geometry geom;
+
+ private final float[] color;
+
+ Gear(final Geometry geom, final float[] color) {
+ this.geom = geom;
+ this.color = color;
+ }
+
+ void render() {
+ // Set gear color
+ glUniform3f(GEAR_COLOR, color[0], color[1], color[2]);
+
+ // Set Light position
+ setUniform4f(LIGHT_POS, GL_LIGHT0, GL_POSITION);
+
+ // Get Projection and Modelview matrices
+ glMatrixMode(GL_PROJECTION);
+ glGetMatrix(p);
+
+ glMatrixMode(GL_MODELVIEW);
+ glGetMatrix(mv);
+
+ // Set MVP uniform
+ Matrix4f.mul(p, mv, mvp);
+ mvp.store(m4fBuffer);
+ m4fBuffer.flip();
+ glUniformMatrix4(MVP, false, m4fBuffer);
+
+ // Set normal matrix (upper-left 3x3 of the inverse transpose MV matrix)
+ mv.invert();
+ mv.transpose();
+ mv.store3f(m3fBuffer);
+ m3fBuffer.flip();
+ glUniformMatrix3(NM, false, m3fBuffer);
+
+ geom.bind();
+
+ final int stride = (3 + 3) * 4;
+ glVertexAttribPointer(vNormal, 3, GL_FLOAT, false, stride, 0);
+ glVertexAttribPointer(vPosition, 3, GL_FLOAT, false, stride, 3 * 4);
+
+ geom.draw();
+ }
+
+ void destroy() {
+ geom.destroy();
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengles/MappedIndexedVBOTest.java b/src/java/org/lwjgl/test/opengles/MappedIndexedVBOTest.java
new file mode 100644
index 00000000..7fdf2f68
--- /dev/null
+++ b/src/java/org/lwjgl/test/opengles/MappedIndexedVBOTest.java
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * $Id: VBOIndexTest.java 2983 2008-04-07 18:36:09Z matzon $
+ *
+ * Simple java test program.
+ *
+ * @author elias_naur
+ * @version $Revision: 2983 $
+ */
+
+package org.lwjgl.test.opengles;
+
+import org.lwjgl.BufferUtils;
+import org.lwjgl.Sys;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.Display;
+import org.lwjgl.opengl.DisplayMode;
+import org.lwjgl.opengles.GLContext;
+
+import java.nio.ByteBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+
+import static org.lwjgl.opengles.GLES20.*;
+import static org.lwjgl.opengles.OESMapbuffer.*;
+import static org.lwjgl.test.opengles.util.GLMatrix.*;
+
+public final class MappedIndexedVBOTest {
+
+ static {
+ try {
+ //find first display mode that allows us 640*480*16
+ int mode = -1;
+ DisplayMode[] modes = Display.getAvailableDisplayModes();
+ for ( int i = 0; i < modes.length; i++ ) {
+ if ( modes[i].getWidth() == 640
+ && modes[i].getHeight() == 480
+ && modes[i].getBitsPerPixel() >= 16 ) {
+ mode = i;
+ break;
+ }
+ }
+ if ( mode != -1 ) {
+ //select above found displaymode
+ System.out.println("Setting display mode to " + modes[mode]);
+ Display.setDisplayMode(modes[mode]);
+ System.out.println("Created display.");
+ }
+ } catch (Exception e) {
+ System.err.println("Failed to create display due to " + e);
+ }
+ }
+
+ static {
+ try {
+ Display.createES();
+ System.out.println("Created OpenGL.");
+
+ if ( !GLContext.getCapabilities().GL_OES_mapbuffer ) {
+ System.out.println("GL_OES_mapbuffer is not supported, quitting!");
+ System.exit(0);
+ }
+ } catch (Exception e) {
+ System.err.println("Failed to create OpenGL due to " + e);
+ System.exit(1);
+ }
+ }
+
+ /** Is the game finished? */
+ private static boolean finished;
+
+ /** A rotating square! */
+ private static float angle;
+ private static int buffer_id;
+ private static int indices_buffer_id;
+ private static FloatBuffer vertices;
+ private static ByteBuffer mapped_buffer;
+ private static FloatBuffer mapped_float_buffer;
+ private static IntBuffer indices;
+ private static ByteBuffer mapped_indices_buffer;
+ private static IntBuffer mapped_indices_int_buffer;
+
+ private static QuadRenderer renderer;
+
+ public static void main(String[] arguments) {
+ try {
+ init();
+ while ( !finished ) {
+ Display.update();
+ Display.sync(30);
+
+ if ( !Display.isVisible() )
+ Thread.sleep(200);
+ else if ( Display.isCloseRequested() )
+ System.exit(0);
+
+ mainLoop();
+ render();
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ } finally {
+ cleanup();
+ }
+ System.exit(0);
+ }
+
+ /** All calculations are done in here */
+ private static void mainLoop() {
+ angle += 1f;
+ if ( angle > 360.0f )
+ angle = 0.0f;
+
+ if ( Mouse.getDX() != 0 || Mouse.getDY() != 0 || Mouse.getDWheel() != 0 )
+ System.out.println("Mouse moved " + Mouse.getDX() + " " + Mouse.getDY() + " " + Mouse.getDWheel());
+ for ( int i = 0; i < Mouse.getButtonCount(); i++ )
+ if ( Mouse.isButtonDown(i) )
+ System.out.println("Button " + i + " down");
+ if ( Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) )
+ finished = true;
+ for ( int i = 0; i < Keyboard.getNumKeyboardEvents(); i++ ) {
+ Keyboard.next();
+ if ( Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState() )
+ finished = true;
+ if ( Keyboard.getEventKey() == Keyboard.KEY_T && Keyboard.getEventKeyState() )
+ System.out.println("Current time: " + Sys.getTime());
+ }
+ }
+
+ /** All rendering is done in here */
+ private static void render() {
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glPushMatrix();
+ glTranslatef(Display.getDisplayMode().getWidth() / 2, Display.getDisplayMode().getHeight() / 2, 0.0f);
+ glRotatef(angle, 0, 0, 1.0f);
+
+ renderer.setMVPUniform();
+
+ ByteBuffer new_mapped_buffer = glMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES, mapped_buffer);
+ if ( new_mapped_buffer != mapped_buffer ) {
+ mapped_buffer = new_mapped_buffer;
+ mapped_float_buffer = new_mapped_buffer.asFloatBuffer();
+ }
+
+ new_mapped_buffer = glMapBufferOES(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY_OES, mapped_indices_buffer);
+ if ( new_mapped_buffer != mapped_indices_buffer ) {
+ mapped_indices_buffer = new_mapped_buffer;
+ mapped_indices_int_buffer = new_mapped_buffer.asIntBuffer();
+ }
+
+ mapped_float_buffer.rewind();
+ vertices.rewind();
+ mapped_float_buffer.put(vertices);
+
+ mapped_indices_int_buffer.rewind();
+ indices.rewind();
+ mapped_indices_int_buffer.put(indices);
+ if ( glUnmapBufferOES(GL_ARRAY_BUFFER) &&
+ glUnmapBufferOES(GL_ELEMENT_ARRAY_BUFFER) ) {
+ glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT, 0);
+ }
+
+ glPopMatrix();
+ }
+
+ /** Initialize */
+ private static void init() throws Exception {
+ System.out.println("Timer resolution: " + Sys.getTimerResolution());
+
+ // Go into orthographic projection mode.
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight(), -1.0f, 1.0f);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
+
+ final IntBuffer int_buffer = BufferUtils.createIntBuffer(2);
+ glGenBuffers(int_buffer);
+ buffer_id = int_buffer.get(0);
+ indices_buffer_id = int_buffer.get(1);
+
+ glBindBuffer(GL_ARRAY_BUFFER, buffer_id);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indices_buffer_id);
+
+ vertices = BufferUtils.createFloatBuffer(2 * 4);
+ vertices
+ .put(-50).put(-50)
+ .put(50).put(-50)
+ .put(-50).put(50)
+ .put(50).put(50);
+ vertices.rewind();
+
+ indices = BufferUtils.createIntBuffer(4);
+ indices.put(0).put(1).put(2).put(3);
+ indices.rewind();
+
+ glBufferData(GL_ARRAY_BUFFER, 2 * 4 * 4, GL_STREAM_DRAW);
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, 4 * 4, GL_STREAM_DRAW);
+
+ renderer = new QuadRenderer();
+ }
+
+ /** Cleanup */
+ private static void cleanup() {
+ renderer.cleanup();
+
+ IntBuffer int_buffer = BufferUtils.createIntBuffer(2);
+ int_buffer.put(0, buffer_id);
+ int_buffer.put(1, indices_buffer_id);
+
+ glDeleteBuffers(int_buffer);
+
+ Display.destroy();
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengles/QuadRenderer.java b/src/java/org/lwjgl/test/opengles/QuadRenderer.java
new file mode 100644
index 00000000..f0e05f25
--- /dev/null
+++ b/src/java/org/lwjgl/test/opengles/QuadRenderer.java
@@ -0,0 +1,70 @@
+package org.lwjgl.test.opengles;
+
+import org.lwjgl.BufferUtils;
+import org.lwjgl.test.opengles.util.Shader;
+import org.lwjgl.test.opengles.util.ShaderProgram;
+import org.lwjgl.util.vector.Matrix4f;
+
+import java.nio.FloatBuffer;
+
+import static org.lwjgl.opengles.GLES20.*;
+import static org.lwjgl.test.opengles.util.GLMatrix.*;
+
+final class QuadRenderer {
+
+ private final Shader vsh;
+ private final Shader fsh;
+ private final ShaderProgram program;
+
+ private final int uniMVP;
+
+ private final Matrix4f p = new Matrix4f();
+ private final Matrix4f mv = new Matrix4f();
+ private final Matrix4f mvp = new Matrix4f();
+
+ private final FloatBuffer m4fBuffer = BufferUtils.createFloatBuffer(4 * 4);
+
+ QuadRenderer() {
+ vsh = new Shader(GL_VERTEX_SHADER, "uniform highp mat4 MODEL_VIEW_PROJECTION_MATRIX;\n" +
+ "attribute highp vec2 vPosition;\n" +
+ "void main(void) {\n" +
+ "\tgl_Position = MODEL_VIEW_PROJECTION_MATRIX * vec4(vPosition, 0.0, 1.0);\n" +
+ "}");
+
+ fsh = new Shader(GL_FRAGMENT_SHADER, "void main(void) {\n" +
+ "\tgl_FragColor = vec4(1.0);\n" +
+ "}");
+
+ program = new ShaderProgram(vsh, fsh);
+ program.enable();
+
+ uniMVP = program.getUniformLocation("MODEL_VIEW_PROJECTION_MATRIX");
+
+ final int vPosition = program.getAttributeLocation("vPosition");
+ glVertexAttribPointer(vPosition, 2, GL_FLOAT, false, 0, 0);
+ glEnableVertexAttribArray(vPosition);
+ }
+
+ void setMVPUniform() {
+ // Get Projection and Modelview matrices
+ glMatrixMode(GL_PROJECTION);
+ glGetMatrix(p);
+
+ glMatrixMode(GL_MODELVIEW);
+ glGetMatrix(mv);
+
+ // Set MVP uniform
+ Matrix4f.mul(p, mv, mvp);
+ mvp.store(m4fBuffer);
+ m4fBuffer.flip();
+ glUniformMatrix4(uniMVP, false, m4fBuffer);
+ }
+
+ void cleanup() {
+ program.destroy();
+
+ fsh.destroy();
+ vsh.destroy();
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengles/util/BufferObject.java b/src/java/org/lwjgl/test/opengles/util/BufferObject.java
new file mode 100644
index 00000000..c698bc97
--- /dev/null
+++ b/src/java/org/lwjgl/test/opengles/util/BufferObject.java
@@ -0,0 +1,99 @@
+package org.lwjgl.test.opengles.util;
+
+import java.nio.*;
+
+import static org.lwjgl.opengles.GLES20.*;
+import static org.lwjgl.opengles.OESMapbuffer.*;
+
+abstract class BufferObject implements GLObject {
+
+ protected final int ID;
+
+ protected int target;
+ protected int usage;
+
+ /** The BufferObject data size in bytes. */
+ private int size;
+
+ protected BufferObject(final int type, final int usage) {
+ this.ID = glGenBuffers();
+ this.target = type;
+ this.usage = usage;
+ }
+
+ protected BufferObject(final int type, final int usage, final Buffer buffer) {
+ this(type, usage);
+ setData(buffer);
+ }
+
+ protected BufferObject(final int type, final int usage, final int dataSize) {
+ this(type, usage);
+ setData(dataSize);
+ }
+
+ public final int getID() {
+ return ID;
+ }
+
+ public void destroy() {
+ glDeleteBuffers(ID);
+ }
+
+ public final int getTarget() {
+ return target;
+ }
+
+ public final int getUsage() {
+ return usage;
+ }
+
+ public final int getSize() {
+ return size;
+ }
+
+ public abstract void enable();
+
+ public abstract void disable();
+
+ public final void setData(final Buffer buffer) {
+ enable();
+
+ if ( buffer instanceof ByteBuffer ) {
+ glBufferData(target, (ByteBuffer)buffer, usage);
+ size = buffer.remaining();
+ } else if ( buffer instanceof ShortBuffer ) {
+ glBufferData(target, (ShortBuffer)buffer, usage);
+ size = buffer.remaining() << 1;
+ } else if ( buffer instanceof IntBuffer ) {
+ glBufferData(target, (IntBuffer)buffer, usage);
+ size = buffer.remaining() << 2;
+ } else if ( buffer instanceof FloatBuffer ) {
+ glBufferData(target, (FloatBuffer)buffer, usage);
+ size = buffer.remaining() << 2;
+ }
+
+ disable();
+ }
+
+ public final void setData(final int dataSize) {
+ enable();
+
+ glBufferData(target, dataSize, usage);
+ size = dataSize;
+
+ disable();
+ }
+
+ public final ByteBuffer map(final int access, final ByteBuffer oldBuffer) {
+ return glMapBufferOES(target, access, oldBuffer);
+ }
+
+ public final ByteBuffer map(final int access, final int length, final ByteBuffer oldBuffer) {
+ return glMapBufferOES(target, access, length, oldBuffer);
+ }
+
+ public final boolean unmap() {
+ return glUnmapBufferOES(target);
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengles/util/BufferObjectArray.java b/src/java/org/lwjgl/test/opengles/util/BufferObjectArray.java
new file mode 100644
index 00000000..f499e5ab
--- /dev/null
+++ b/src/java/org/lwjgl/test/opengles/util/BufferObjectArray.java
@@ -0,0 +1,41 @@
+package org.lwjgl.test.opengles.util;
+
+import java.nio.Buffer;
+
+import static org.lwjgl.opengles.GLES20.*;
+
+public final class BufferObjectArray extends BufferObject {
+
+ private static int boundBOArray;
+
+ public BufferObjectArray(final int usage) {
+ super(GL_ARRAY_BUFFER, usage);
+ }
+
+ public BufferObjectArray(final int usage, final Buffer buffer) {
+ super(GL_ARRAY_BUFFER, usage, buffer);
+ }
+
+ public BufferObjectArray(final int usage, final int dataSize) {
+ super(GL_ARRAY_BUFFER, usage, dataSize);
+ }
+
+ public void enable() {
+ if ( boundBOArray != ID ) {
+ glBindBuffer(GL_ARRAY_BUFFER, ID);
+ boundBOArray = ID;
+ }
+ }
+
+ public void disable() {
+ boArrayDisable();
+ }
+
+ public static void boArrayDisable() {
+ if ( boundBOArray != 0 ) {
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ boundBOArray = 0;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengles/util/BufferObjectElement.java b/src/java/org/lwjgl/test/opengles/util/BufferObjectElement.java
new file mode 100644
index 00000000..4fae8e33
--- /dev/null
+++ b/src/java/org/lwjgl/test/opengles/util/BufferObjectElement.java
@@ -0,0 +1,41 @@
+package org.lwjgl.test.opengles.util;
+
+import java.nio.Buffer;
+
+import static org.lwjgl.opengles.GLES20.*;
+
+public final class BufferObjectElement extends BufferObject {
+
+ private static int boundBOElementArray;
+
+ public BufferObjectElement(final int usage) {
+ super(GL_ELEMENT_ARRAY_BUFFER, usage);
+ }
+
+ public BufferObjectElement(final int usage, final Buffer buffer) {
+ super(GL_ELEMENT_ARRAY_BUFFER, usage, buffer);
+ }
+
+ public BufferObjectElement(final int usage, final int dataSize) {
+ super(GL_ELEMENT_ARRAY_BUFFER, usage, dataSize);
+ }
+
+ public void enable() {
+ if ( boundBOElementArray != ID ) {
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ID);
+ boundBOElementArray = ID;
+ }
+ }
+
+ public void disable() {
+ boElementArrayDisable();
+ }
+
+ public static void boElementArrayDisable() {
+ if ( boundBOElementArray != 0 ) {
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+ boundBOElementArray = 0;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengles/util/GLLight.java b/src/java/org/lwjgl/test/opengles/util/GLLight.java
new file mode 100644
index 00000000..85a35755
--- /dev/null
+++ b/src/java/org/lwjgl/test/opengles/util/GLLight.java
@@ -0,0 +1,165 @@
+package org.lwjgl.test.opengles.util;
+
+import static org.lwjgl.opengles.GLES20.*;
+
+/** Emulates the light state in fixed-function OpenGL. */
+public class GLLight {
+
+ public static final int GL_LIGHT0 = 0x4000;
+ public static final int GL_LIGHT1 = 0x4001;
+ public static final int GL_LIGHT2 = 0x4002;
+ public static final int GL_LIGHT3 = 0x4003;
+ public static final int GL_LIGHT4 = 0x4004;
+ public static final int GL_LIGHT5 = 0x4005;
+ public static final int GL_LIGHT6 = 0x4006;
+ public static final int GL_LIGHT7 = 0x4007;
+
+ public static final int GL_AMBIENT = 0x1200;
+ public static final int GL_DIFFUSE = 0x1201;
+ public static final int GL_SPECULAR = 0x1202;
+ public static final int GL_POSITION = 0x1203;
+ public static final int GL_SPOT_DIRECTION = 0x1204;
+ public static final int GL_SPOT_EXPONENT = 0x1205;
+ public static final int GL_SPOT_CUTOFF = 0x1206;
+ public static final int GL_CONSTANT_ATTENUATION = 0x1207;
+ public static final int GL_LINEAR_ATTENUATION = 0x1208;
+ public static final int GL_QUADRATIC_ATTENUATION = 0x1209;
+
+ private static final Light[] lights = new Light[8];
+
+ static {
+ for ( int i = 0; i < lights.length; i++ )
+ lights[i] = new Light();
+
+ System.arraycopy(new float[] { 1.0f, 1.0f, 1.0f, 1.0f }, 0, lights[0].diffuse, 0, 4);
+ System.arraycopy(new float[] { 1.0f, 1.0f, 1.0f, 1.0f }, 0, lights[0].specular, 0, 4);
+ }
+
+ private GLLight() {
+ }
+
+ public static void glLight(final int light, final int pname, final float v) {
+ if ( light < GL_LIGHT0 || GL_LIGHT7 < light )
+ throw new IllegalArgumentException("Invalid light specified: " + light);
+
+ final Light l = lights[light - GL_LIGHT0];
+
+ switch ( pname ) {
+ case GL_SPOT_EXPONENT:
+ l.s = v;
+ break;
+ case GL_SPOT_CUTOFF:
+ l.c = v;
+ break;
+ case GL_CONSTANT_ATTENUATION:
+ l.k0 = v;
+ break;
+ case GL_LINEAR_ATTENUATION:
+ l.k1 = v;
+ break;
+ case GL_QUADRATIC_ATTENUATION:
+ l.k2 = v;
+ break;
+ default:
+ throw new IllegalArgumentException("Invalid light parameter specified: " + pname);
+ }
+ }
+
+ public static void glLight(final int light, final int pname,
+ final float x, final float y, final float z) {
+ if ( light < GL_LIGHT0 || GL_LIGHT7 < light )
+ throw new IllegalArgumentException("Invalid light specified: " + light);
+
+ if ( pname != GL_SPOT_DIRECTION )
+ throw new IllegalArgumentException("Invalid light parameter specified: " + pname);
+
+ final float[] param = lights[light - GL_LIGHT0].direction;
+
+ param[0] = x;
+ param[1] = y;
+ param[2] = z;
+ }
+
+ private static float[] getParam4f(final int light, final int pname) {
+ if ( light < GL_LIGHT0 || GL_LIGHT7 < light )
+ throw new IllegalArgumentException("Invalid light specified: " + light);
+
+ final Light l = lights[light - GL_LIGHT0];
+ switch ( pname ) {
+ case GL_AMBIENT:
+ return l.ambient;
+ case GL_DIFFUSE:
+ return l.diffuse;
+ case GL_SPECULAR:
+ return l.specular;
+ case GL_POSITION:
+ return l.position;
+ default:
+ throw new IllegalArgumentException("Invalid light parameter specified: " + pname);
+ }
+ }
+
+ public static void glLight(final int light, final int pname,
+ final float x, final float y, final float z, final float w) {
+ final float[] param = getParam4f(light, pname);
+ param[0] = x;
+ param[1] = y;
+ param[2] = z;
+ param[3] = w;
+ }
+
+ public static void setUniform1f(final int location, final int light, final int pname) {
+ if ( light < GL_LIGHT0 || GL_LIGHT7 < light )
+ throw new IllegalArgumentException("Invalid light specified: " + light);
+
+ final Light l = lights[light - GL_LIGHT0];
+
+ switch ( pname ) {
+ case GL_SPOT_EXPONENT:
+ glUniform1f(location, l.s);
+ break;
+ case GL_SPOT_CUTOFF:
+ glUniform1f(location, l.c);
+ break;
+ case GL_CONSTANT_ATTENUATION:
+ glUniform1f(location, l.k0);
+ break;
+ case GL_LINEAR_ATTENUATION:
+ glUniform1f(location, l.k1);
+ break;
+ case GL_QUADRATIC_ATTENUATION:
+ glUniform1f(location, l.k2);
+ break;
+ default:
+ throw new IllegalArgumentException("Invalid light parameter specified: " + pname);
+ }
+ }
+
+ public static void setUniform3f(final int location, final int light, final int pname) {
+ if ( pname != GL_SPOT_DIRECTION )
+ throw new IllegalArgumentException("Invalid light parameter specified: " + pname);
+
+ final float[] param = lights[light - GL_LIGHT0].direction;
+ glUniform3f(location, param[0], param[1], param[2]);
+ }
+
+ public static void setUniform4f(final int location, final int light, final int pname) {
+ final float[] param = getParam4f(light, pname);
+ glUniform4f(location, param[0], param[1], param[2], param[3]);
+ }
+
+ private static class Light {
+
+ float[] ambient = { 0.0f, 0.0f, 0.0f, 1.0f };
+ float[] diffuse = { 0.0f, 0.0f, 0.0f, 1.0f };
+ float[] specular = { 0.0f, 0.0f, 0.0f, 1.0f };
+
+ float[] position = { 0.0f, 0.0f, 1.0f, 0.0f };
+ float[] direction = { 0.0f, 0.0f, -1.0f };
+
+ float s, c = 180.0f;
+ float k0 = 1.0f, k1, k2;
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengles/util/GLMatrix.java b/src/java/org/lwjgl/test/opengles/util/GLMatrix.java
new file mode 100644
index 00000000..bdfc9fed
--- /dev/null
+++ b/src/java/org/lwjgl/test/opengles/util/GLMatrix.java
@@ -0,0 +1,163 @@
+package org.lwjgl.test.opengles.util;
+
+import org.lwjgl.util.vector.Matrix4f;
+import org.lwjgl.util.vector.Vector3f;
+
+import java.util.Stack;
+
+import static java.lang.Math.*;
+
+/** Emulates the matrix stack in fixed-function OpenGL. */
+public final class GLMatrix {
+
+ public static final int GL_MODELVIEW = 0x1700;
+ public static final int GL_PROJECTION = 0x1701;
+
+ private static final float PI = (float)Math.PI;
+
+ /** The model/view matrix stack. */
+ private static final Stack mvMatrixStack = new Stack();
+
+ /** The projection matrix stack. */
+ private static final Stack pMatrixStack = new Stack();
+
+ private static final Matrix4f m4f = new Matrix4f();
+ private static final Vector3f v3f = new Vector3f();
+
+ private static int mode = GL_MODELVIEW;
+
+ static {
+ mvMatrixStack.push(new Matrix4f());
+ pMatrixStack.push(new Matrix4f());
+ }
+
+ private GLMatrix() {
+ }
+
+ private static Stack getCurrentStack() {
+ switch ( mode ) {
+ case GL_MODELVIEW:
+ return mvMatrixStack;
+ case GL_PROJECTION:
+ return pMatrixStack;
+ default:
+ return null; // Cannot happen
+ }
+ }
+
+ private static Matrix4f getCurrentMatrix() {
+ return getCurrentStack().peek();
+ }
+
+ public static void glMatrixMode(final int mode) {
+ if ( mode != GL_MODELVIEW && mode != GL_PROJECTION )
+ throw new IllegalArgumentException("Invalid matrix mode specified: " + mode);
+
+ GLMatrix.mode = mode;
+ }
+
+ public static void glPushMatrix() {
+ final Stack stack = getCurrentStack();
+ stack.push(new Matrix4f(stack.peek()));
+ }
+
+ public static void glPopMatrix() {
+ final Stack stack = getCurrentStack();
+
+ if ( stack.size() == 1 )
+ throw new IllegalStateException("The last matrix in the stack cannot be popped.");
+
+ getCurrentStack().pop();
+ }
+
+ public static void glLoadIdentity() {
+ final Matrix4f m = getCurrentMatrix();
+ m.setIdentity();
+ }
+
+ public static void glLoadMatrix(final Matrix4f s) {
+ getCurrentMatrix().load(s);
+ }
+
+ public static void glMultMatrix(final Matrix4f m) {
+ final Matrix4f c = getCurrentMatrix();
+ Matrix4f.mul(c, m, c);
+ }
+
+ public static void glTranslatef(final float x, final float y, final float z) {
+ final Matrix4f m = getCurrentMatrix();
+ v3f.set(x, y, z);
+ m.translate(v3f);
+ }
+
+ public static void glRotatef(final float angle, final float x, final float y, final float z) {
+ final Matrix4f m = getCurrentMatrix();
+ v3f.set(x, y, z);
+ m.rotate((float)toRadians(angle), v3f);
+ }
+
+ public static void glOrtho(final float l, final float r, final float b, final float t, final float n, final float f) {
+ final Matrix4f m = m4f;
+ m.setIdentity();
+
+ m.m00 = 2.0f / (r - l);
+ m.m30 = -(r + l) / (r - l);
+
+ m.m11 = 2.0f / (t - b);
+ m.m31 = -(t + b) / (t - b);
+
+ m.m22 = -2.0f / (f - n);
+ m.m32 = -(f + n) / (f - n);
+
+ glMultMatrix(m);
+ }
+
+ public static void glFrustum(final float l, final float r, final float b, final float t, final float n, final float f) {
+ final Matrix4f m = m4f;
+ m.setIdentity();
+
+ m.m00 = 2.0f * n / (r - l);
+ m.m20 = (r + l) / (r - l);
+
+ m.m11 = 2.0f * n / (t - b);
+ m.m21 = (t + b) / (t - b);
+
+ m.m22 = -(f + n) / (f - n);
+ m.m32 = -(2.0f * f * n) / (f - n);
+
+ m.m23 = -1.0f;
+ m.m33 = 0.0f;
+
+ glMultMatrix(m);
+ }
+
+ public static void gluPerspective(final float fovy, final float aspect, final float zNear, final float zFar) {
+ final float radians = fovy / 2.0f * PI / 180.0f;
+
+ final float deltaZ = zFar - zNear;
+ final float sine = (float)sin(radians);
+
+ if ( (deltaZ == 0) || (sine == 0) || (aspect == 0) ) {
+ return;
+ }
+
+ final float cotangent = (float)cos(radians) / sine;
+
+ final Matrix4f m = m4f;
+ m.setIdentity();
+
+ m.m00 = cotangent / aspect;
+ m.m11 = cotangent;
+ m.m22 = -(zFar + zNear) / deltaZ;
+ m.m23 = -1.0f;
+ m.m32 = -2 * zNear * zFar / deltaZ;
+ m.m33 = 0.0f;
+
+ glMultMatrix(m);
+ }
+
+ public static void glGetMatrix(final Matrix4f d) {
+ d.load(getCurrentMatrix());
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengles/util/GLObject.java b/src/java/org/lwjgl/test/opengles/util/GLObject.java
new file mode 100644
index 00000000..56463b38
--- /dev/null
+++ b/src/java/org/lwjgl/test/opengles/util/GLObject.java
@@ -0,0 +1,9 @@
+package org.lwjgl.test.opengles.util;
+
+public interface GLObject {
+
+ int getID();
+
+ void destroy();
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengles/util/Geometry.java b/src/java/org/lwjgl/test/opengles/util/Geometry.java
new file mode 100644
index 00000000..8af707b2
--- /dev/null
+++ b/src/java/org/lwjgl/test/opengles/util/Geometry.java
@@ -0,0 +1,78 @@
+package org.lwjgl.test.opengles.util;
+
+import org.lwjgl.test.opengles.util.BufferObjectArray;
+
+import java.nio.FloatBuffer;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.lwjgl.opengles.GLES20.*;
+
+public class Geometry {
+
+ protected BufferObjectArray bo;
+
+ protected final List drawCommands = new ArrayList(4);
+
+ public Geometry() {
+ }
+
+ public Geometry(final FloatBuffer buffer) {
+ update(buffer);
+ }
+
+ public void update(final FloatBuffer buffer) {
+ if ( bo != null )
+ destroy();
+
+ bo = new BufferObjectArray(GL_STATIC_DRAW, buffer);
+ }
+
+ public void bind() {
+ bo.enable();
+ }
+
+ public void draw() {
+ for ( DrawCommand command : drawCommands )
+ command.draw();
+ }
+
+ public void destroy() {
+ bo.destroy();
+ bo = null;
+
+ drawCommands.clear();
+ }
+
+ public int addDrawCommand(final int mode, final int first, final int count) {
+ drawCommands.add(new DrawCommand(mode, first, count));
+ return count;
+ }
+
+ public static float sin(final float r) {
+ return (float)Math.sin(r);
+ }
+
+ public static float cos(final float r) {
+ return (float)Math.cos(r);
+ }
+
+ protected static class DrawCommand {
+
+ private int mode;
+ private int first;
+ private int count;
+
+ private DrawCommand(final int mode, final int first, final int count) {
+ this.mode = mode;
+ this.first = first;
+ this.count = count;
+ }
+
+ void draw() {
+ glDrawArrays(mode, first, count);
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengles/util/ImmediateModeBuffer.java b/src/java/org/lwjgl/test/opengles/util/ImmediateModeBuffer.java
new file mode 100644
index 00000000..24137fad
--- /dev/null
+++ b/src/java/org/lwjgl/test/opengles/util/ImmediateModeBuffer.java
@@ -0,0 +1,58 @@
+package org.lwjgl.test.opengles.util;
+
+import org.lwjgl.BufferUtils;
+
+import java.nio.FloatBuffer;
+
+/**
+ * Utility class that emulates immediate mode vertex data submission.
+ * Can be used to create VBO data.
+ */
+public final class ImmediateModeBuffer {
+
+ private FloatBuffer buffer;
+
+ public ImmediateModeBuffer(final int startSize) {
+ this.buffer = BufferUtils.createFloatBuffer(startSize);
+ }
+
+ private void checkSize(final int count) {
+ while ( buffer.remaining() < count ) {
+ final FloatBuffer newBuffer = BufferUtils.createFloatBuffer(buffer.capacity() << 1);
+ buffer.flip();
+ newBuffer.put(buffer);
+ buffer = newBuffer;
+ }
+ }
+
+ public FloatBuffer getBuffer() {
+ buffer.flip();
+ return buffer;
+ }
+
+ public void glVertex2f(final float x, final float y) {
+ checkSize(2);
+ buffer.put(x).put(y);
+ }
+
+ public void glVertex3f(final float x, final float y, final float z) {
+ checkSize(3);
+ buffer.put(x).put(y).put(z);
+ }
+
+ public void glVertex4f(final float x, final float y, final float z, final float w) {
+ checkSize(4);
+ buffer.put(x).put(y).put(z).put(w);
+ }
+
+ public void glNormal3f(final float x, final float y, final float z) {
+ checkSize(3);
+ buffer.put(x).put(y).put(z);
+ }
+
+ public void glTexCoord2f(final float s, final float t) {
+ checkSize(2);
+ buffer.put(s).put(t);
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengles/util/Shader.java b/src/java/org/lwjgl/test/opengles/util/Shader.java
new file mode 100644
index 00000000..cec9f8d4
--- /dev/null
+++ b/src/java/org/lwjgl/test/opengles/util/Shader.java
@@ -0,0 +1,98 @@
+package org.lwjgl.test.opengles.util;
+
+import org.lwjgl.BufferUtils;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+
+import static org.lwjgl.opengles.GLES20.*;
+
+public class Shader implements GLObject {
+
+ protected static ByteBuffer fileBuffer = BufferUtils.createByteBuffer(1024 * 10);
+
+ private int type;
+ private int ID;
+
+ public Shader() {
+ }
+
+ public Shader(final int type, final CharSequence source) {
+ createFromSource(type, source);
+ }
+
+ public int getID() {
+ return ID;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void destroy() {
+ if ( ID == 0 )
+ throw new IllegalStateException("The shader has not been created");
+
+ glDeleteShader(ID);
+ ID = 0;
+ }
+
+ public void createFromFile(final int type, final ClassLoader loader, final String file) throws IOException {
+ final InputStream inputStream = loader.getResourceAsStream(file);
+
+ if ( inputStream == null )
+ throw new IllegalArgumentException("A shader source file could not be found: " + file);
+
+ final BufferedInputStream stream = new BufferedInputStream(inputStream);
+
+ byte character;
+ while ( (character = (byte)stream.read()) != -1 )
+ fileBuffer.put(character);
+ fileBuffer.flip();
+
+ stream.close();
+
+ final byte[] array = new byte[fileBuffer.remaining()];
+ fileBuffer.get(array);
+
+ final String source = new String(array);
+
+ fileBuffer.clear();
+
+ createFromSource(type, source);
+ }
+
+ public void createFromSource(final int type, final CharSequence source) {
+ if ( ID != 0 )
+ throw new IllegalStateException("The shader has already been created");
+
+ this.type = type;
+ this.ID = glCreateShader(type);
+
+ glShaderSource(ID, source);
+
+ glCompileShader(ID);
+
+ if ( glGetShader(ID, GL_COMPILE_STATUS) == GL_FALSE ) {
+ printInfoLog();
+ destroy();
+ throw new RuntimeException("A compilation error occured in a shader.");
+ }
+ }
+
+ public void printInfoLog() {
+ if ( ID == 0 )
+ throw new IllegalStateException("The shader has not been created");
+
+ final int logLength = glGetShader(ID, GL_INFO_LOG_LENGTH);
+ if ( logLength <= 1 )
+ return;
+
+ System.out.println("\nInfo Log of Shader Object: " + ID);
+ System.out.println("--------------------------");
+ System.out.println(glGetShaderInfoLog(ID, logLength));
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengles/util/ShaderProgram.java b/src/java/org/lwjgl/test/opengles/util/ShaderProgram.java
new file mode 100644
index 00000000..da37c2f8
--- /dev/null
+++ b/src/java/org/lwjgl/test/opengles/util/ShaderProgram.java
@@ -0,0 +1,82 @@
+package org.lwjgl.test.opengles.util;
+
+import static org.lwjgl.opengles.GLES20.*;
+
+public class ShaderProgram implements GLObject {
+
+ private final int ID;
+
+ public ShaderProgram(final Shader... shaders) {
+ this.ID = glCreateProgram();
+
+ for ( Shader shader : shaders )
+ glAttachShader(ID, shader.getID());
+
+ glLinkProgram(ID);
+
+ if ( glGetProgram(ID, GL_LINK_STATUS) == GL_FALSE ) {
+ printInfoLog();
+ destroy();
+ throw new RuntimeException("Failed to link a Shader Program: " + ID);
+ }
+ }
+
+ public void validate() {
+ glValidateProgram(ID);
+
+ final boolean error = glGetProgram(ID, GL_VALIDATE_STATUS) == GL_FALSE;
+
+ if ( error ) {
+ printInfoLog();
+ throw new RuntimeException("Failed to validate a Shader Program.");
+ }
+ }
+
+ public int getID() {
+ return ID;
+ }
+
+ public void destroy() {
+ glDeleteProgram(ID);
+ }
+
+ public void enable() {
+ glUseProgram(ID);
+ }
+
+ public static void disable() {
+ glUseProgram(0);
+ }
+
+ public int getUniformLocation(final String uniform) {
+ final int location = glGetUniformLocation(ID, uniform);
+
+ if ( location == -1 )
+ throw new IllegalArgumentException("Invalid uniform name specified: " + uniform);
+
+ return location;
+ }
+
+ public int getAttributeLocation(final String attrib) {
+ final int location = glGetAttribLocation(ID, attrib);
+
+ if ( location == -1 )
+ throw new IllegalArgumentException("Invalid attribute name specified: " + attrib);
+
+ return location;
+ }
+
+ private void printInfoLog() {
+ final int logLength = glGetProgram(ID, GL_INFO_LOG_LENGTH);
+
+ System.out.println(logLength);
+ if ( logLength <= 1 )
+ return;
+
+ System.out.println("\nInfo Log of Shader Program: " + ID);
+ System.out.println("-------------------");
+ System.out.println(glGetProgramInfoLog(ID, logLength));
+ System.out.println("-------------------");
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/test/opengles/util/Sphere.java b/src/java/org/lwjgl/test/opengles/util/Sphere.java
new file mode 100644
index 00000000..1d0f8f05
--- /dev/null
+++ b/src/java/org/lwjgl/test/opengles/util/Sphere.java
@@ -0,0 +1,414 @@
+package org.lwjgl.test.opengles.util;
+
+import java.nio.FloatBuffer;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.lwjgl.opengles.GLES20.*;
+
+/** VBO implementation of GLU Sphere. */
+public final class Sphere {
+
+ /* QuadricNormal */
+ public static final int GLU_SMOOTH = 100000;
+ public static final int GLU_FLAT = 100001;
+ public static final int GLU_NONE = 100002;
+
+ /* QuadricDrawStyle */
+ public static final int GLU_POINT = 100010;
+ public static final int GLU_LINE = 100011;
+ public static final int GLU_FILL = 100012;
+ public static final int GLU_SILHOUETTE = 100013;
+
+ /* QuadricOrientation */
+ public static final int GLU_OUTSIDE = 100020;
+ public static final int GLU_INSIDE = 100021;
+
+ static final float PI = (float)Math.PI;
+
+ private int drawStyle;
+ private int orientation;
+ private boolean textureFlag;
+ private int normals;
+
+ private BufferObjectArray bo;
+
+ private final List drawCommands = new ArrayList(4);
+
+ public Sphere() {
+ this(GLU_FILL, GLU_OUTSIDE, false, GLU_SMOOTH);
+ }
+
+ public Sphere(final int drawStyle, final int orientation, final boolean textureFlag, final int normals) {
+ setDrawStyle(drawStyle);
+ setOrientation(orientation);
+ setTextureFlag(textureFlag);
+ setNormals(normals);
+ }
+
+ public Sphere(final float radius, final int slices, final int stacks) {
+ this();
+ updateGeometry(radius, slices, stacks);
+ }
+
+ public Sphere(final float radius, final int slices, final int stacks,
+ final int drawStyle, final int orientation, final boolean textureFlag, final int normals) {
+ this(drawStyle, orientation, textureFlag, normals);
+ updateGeometry(radius, slices, stacks);
+ }
+
+ public void updateGeometry(final float radius, final int slices, final int stacks) {
+ if ( bo != null )
+ destroy();
+
+ bo = new BufferObjectArray(GL_STATIC_DRAW, createBuffer(radius, slices, stacks));
+ }
+
+ public void bind() {
+ bo.enable();
+ }
+
+ public void draw() {
+ for ( DrawCommand command : drawCommands )
+ command.draw();
+ }
+
+ public void destroy() {
+ bo.destroy();
+ bo = null;
+
+ drawCommands.clear();
+ }
+
+ /**
+ * specifies the draw style for quadrics.
+ *
+ * The legal values are as follows:
+ *
+ * GLU.FILL: Quadrics are rendered with polygon primitives. The polygons
+ * are drawn in a counterclockwise fashion with respect to
+ * their normals (as defined with glu.quadricOrientation).
+ *
+ * GLU.LINE: Quadrics are rendered as a set of lines.
+ *
+ * GLU.SILHOUETTE: Quadrics are rendered as a set of lines, except that edges
+ * separating coplanar faces will not be drawn.
+ *
+ * GLU.POINT: Quadrics are rendered as a set of points.
+ *
+ * @param drawStyle The drawStyle to set
+ */
+ public void setDrawStyle(int drawStyle) {
+ switch ( drawStyle ) {
+ case GLU_FILL:
+ case GLU_LINE:
+ case GLU_SILHOUETTE:
+ case GLU_POINT:
+ break;
+ default:
+ throw new IllegalArgumentException("Invalid draw style specified: " + drawStyle);
+ }
+
+ this.drawStyle = drawStyle;
+ }
+
+ /**
+ * specifies what kind of normals are desired for quadrics.
+ * The legal values are as follows:
+ *
+ * GLU.NONE: No normals are generated.
+ *
+ * GLU.FLAT: One normal is generated for every facet of a quadric.
+ *
+ * GLU.SMOOTH: One normal is generated for every vertex of a quadric. This
+ * is the default.
+ *
+ * @param normals The normals to set
+ */
+ public void setNormals(int normals) {
+ switch ( normals ) {
+ case GLU_NONE:
+ case GLU_FLAT:
+ case GLU_SMOOTH:
+ break;
+ default:
+ throw new IllegalArgumentException("Invalid normal kind specified: " + normals);
+ }
+
+ this.normals = normals;
+ }
+
+ /**
+ * specifies what kind of orientation is desired for.
+ * The orientation values are as follows:
+ *
+ * GLU.OUTSIDE: Quadrics are drawn with normals pointing outward.
+ *
+ * GLU.INSIDE: Normals point inward. The default is GLU.OUTSIDE.
+ *
+ * Note that the interpretation of outward and inward depends on the quadric
+ * being drawn.
+ *
+ * @param orientation The orientation to set
+ */
+ public void setOrientation(int orientation) {
+ if ( orientation != GLU_OUTSIDE && orientation != GLU_INSIDE )
+ throw new IllegalArgumentException("Invalid orientation specified: " + orientation);
+
+ this.orientation = orientation;
+ }
+
+ /**
+ * specifies if texture coordinates should be generated for
+ * quadrics rendered with qobj. If the value of textureCoords is true,
+ * then texture coordinates are generated, and if textureCoords is false,
+ * they are not.. The default is false.
+ *
+ * The manner in which texture coordinates are generated depends upon the
+ * specific quadric rendered.
+ *
+ * @param textureFlag The textureFlag to set
+ */
+ public void setTextureFlag(boolean textureFlag) {
+ this.textureFlag = textureFlag;
+ }
+
+ /**
+ * Returns the drawStyle.
+ *
+ * @return int
+ */
+ public int getDrawStyle() {
+ return drawStyle;
+ }
+
+ /**
+ * Returns the normals.
+ *
+ * @return int
+ */
+ public int getNormals() {
+ return normals;
+ }
+
+ /**
+ * Returns the orientation.
+ *
+ * @return int
+ */
+ public int getOrientation() {
+ return orientation;
+ }
+
+ /**
+ * Returns the textureFlag.
+ *
+ * @return boolean
+ */
+ public boolean getTextureFlag() {
+ return textureFlag;
+ }
+
+ private static float sin(final float r) {
+ return (float)Math.sin(r);
+ }
+
+ private static float cos(final float r) {
+ return (float)Math.cos(r);
+ }
+
+ private int addDrawCommand(final int mode, final int first, final int count) {
+ drawCommands.add(new DrawCommand(mode, first, count));
+ return count;
+ }
+
+ /**
+ * draws a sphere of the given radius centered around the origin.
+ * The sphere is subdivided around the z axis into slices and along the z axis
+ * into stacks (similar to lines of longitude and latitude).
+ *
+ * If the orientation is set to GLU.OUTSIDE (with glu.quadricOrientation), then
+ * any normals generated point away from the center of the sphere. Otherwise,
+ * they point toward the center of the sphere.
+ *
+ * If texturing is turned on (with glu.quadricTexture), then texture
+ * coordinates are generated so that t ranges from 0.0 at z=-radius to 1.0 at
+ * z=radius (t increases linearly along longitudinal lines), and s ranges from
+ * 0.0 at the +y axis, to 0.25 at the +x axis, to 0.5 at the -y axis, to 0.75
+ * at the -x axis, and back to 1.0 at the +y axis.
+ */
+ public FloatBuffer createBuffer(float radius, int slices, int stacks) {
+ float rho, theta;
+ float x, y, z;
+ float s, t, ds, dt;
+ int i, j;
+
+ final boolean normals = this.normals != GLU_NONE;
+ final float nsign = this.orientation == GLU_INSIDE ? -1.0f : 1.0f;
+
+ final float drho = PI / stacks;
+ final float dtheta = 2.0f * PI / slices;
+
+ final ImmediateModeBuffer imb = new ImmediateModeBuffer(16 * 1024); // TODO: We can calculate this to avoid re-allocs
+ int lastDrawIndex = 0;
+
+ if ( this.drawStyle == GLU_FILL ) {
+ if ( !this.textureFlag ) {
+ lastDrawIndex += addDrawCommand(GL_TRIANGLE_FAN, lastDrawIndex, slices + 2);
+
+ // draw +Z end as a triangle fan
+ imb.glNormal3f(0.0f, 0.0f, 1.0f);
+ imb.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 )
+ imb.glNormal3f(x * nsign, y * nsign, z * nsign);
+ imb.glVertex3f(x * radius, y * radius, z * radius);
+ }
+ }
+
+ ds = 1.0f / slices;
+ dt = 1.0f / stacks;
+ t = 1.0f; // because loop now runs from 0
+
+ final int imin, imax;
+ if ( this.textureFlag ) {
+ imin = 0;
+ imax = stacks;
+ } else {
+ imin = 1;
+ imax = stacks - 1;
+ }
+
+ // draw intermediate stacks as quad strips
+ for ( i = imin; i < imax; i++ ) {
+ lastDrawIndex += addDrawCommand(GL_TRIANGLE_STRIP, lastDrawIndex, (slices + 1) * 2);
+
+ rho = i * drho;
+ s = 0.0f;
+ for ( j = 0; j <= slices; j++ ) {
+ theta = (j == slices) ? 0.0f : j * dtheta;
+
+ x = -sin(theta) * sin(rho);
+ y = cos(theta) * sin(rho);
+ z = nsign * cos(rho);
+ if ( normals )
+ imb.glNormal3f(x * nsign, y * nsign, z * nsign);
+ if ( textureFlag )
+ imb.glTexCoord2f(s, t);
+ imb.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 )
+ imb.glNormal3f(x * nsign, y * nsign, z * nsign);
+ if ( textureFlag )
+ imb.glTexCoord2f(s, t - dt);
+ s += ds;
+ imb.glVertex3f(x * radius, y * radius, z * radius);
+ }
+ t -= dt;
+ }
+
+ if ( !this.textureFlag ) {
+ lastDrawIndex += addDrawCommand(GL_TRIANGLE_FAN, lastDrawIndex, slices + 2);
+
+ // draw -Z end as a triangle fan
+ imb.glNormal3f(0.0f, 0.0f, -1.0f);
+ imb.glVertex3f(0.0f, 0.0f, -radius * nsign);
+ rho = PI - drho;
+ s = 1.0f;
+ for ( j = slices; j >= 0; j-- ) {
+ theta = (j == slices) ? 0.0f : j * dtheta;
+ x = -sin(theta) * sin(rho);
+ y = cos(theta) * sin(rho);
+ z = nsign * cos(rho);
+ if ( normals )
+ imb.glNormal3f(x * nsign, y * nsign, z * nsign);
+ s -= ds;
+ imb.glVertex3f(x * radius, y * radius, z * radius);
+ }
+ }
+ } else if ( this.drawStyle == GLU_LINE || this.drawStyle == GLU_SILHOUETTE ) {
+ // draw stack lines
+ for ( i = 1; i < stacks; i++ ) { // stack line at i==stacks-1 was missing here
+ lastDrawIndex += addDrawCommand(GL_LINE_LOOP, lastDrawIndex, slices);
+
+ rho = i * drho;
+ for ( j = 0; j < slices; j++ ) {
+ theta = j * dtheta;
+ x = cos(theta) * sin(rho);
+ y = sin(theta) * sin(rho);
+ z = cos(rho);
+ if ( normals )
+ imb.glNormal3f(x * nsign, y * nsign, z * nsign);
+ imb.glVertex3f(x * radius, y * radius, z * radius);
+ }
+ }
+ // draw slice lines
+ for ( j = 0; j < slices; j++ ) {
+ lastDrawIndex += addDrawCommand(GL_LINE_STRIP, lastDrawIndex, stacks + 1);
+
+ theta = j * dtheta;
+ for ( i = 0; i <= stacks; i++ ) {
+ rho = i * drho;
+ x = cos(theta) * sin(rho);
+ y = sin(theta) * sin(rho);
+ z = cos(rho);
+ if ( normals )
+ imb.glNormal3f(x * nsign, y * nsign, z * nsign);
+ imb.glVertex3f(x * radius, y * radius, z * radius);
+ }
+ }
+ } else if ( this.drawStyle == GLU_POINT ) {
+ lastDrawIndex += addDrawCommand(GL_POINTS, lastDrawIndex, 2 + (stacks - 2) * slices);
+
+ // top and bottom-most points
+ if ( normals )
+ imb.glNormal3f(0.0f, 0.0f, nsign);
+ imb.glVertex3f(0.0f, 0.0f, radius);
+ if ( normals )
+ imb.glNormal3f(0.0f, 0.0f, -nsign);
+ imb.glVertex3f(0.0f, 0.0f, -radius);
+
+ // loop over stacks
+ for ( i = 1; i < stacks - 1; i++ ) {
+ rho = i * drho;
+ for ( j = 0; j < slices; j++ ) {
+ theta = j * dtheta;
+ x = cos(theta) * sin(rho);
+ y = sin(theta) * sin(rho);
+ z = cos(rho);
+ if ( normals )
+ imb.glNormal3f(x * nsign, y * nsign, z * nsign);
+ imb.glVertex3f(x * radius, y * radius, z * radius);
+ }
+ }
+ }
+
+ return imb.getBuffer();
+ }
+
+ private static class DrawCommand {
+
+ private int mode;
+ private int first;
+ private int count;
+
+ private DrawCommand(final int mode, final int first, final int count) {
+ this.mode = mode;
+ this.first = first;
+ this.count = count;
+ }
+
+ void draw() {
+ glDrawArrays(mode, first, count);
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/FieldsGenerator.java b/src/java/org/lwjgl/util/generator/FieldsGenerator.java
index a8a6d4b0..a9d8f394 100644
--- a/src/java/org/lwjgl/util/generator/FieldsGenerator.java
+++ b/src/java/org/lwjgl/util/generator/FieldsGenerator.java
@@ -59,7 +59,8 @@ public class FieldsGenerator {
PrimitiveType.Kind field_kind = field_type_prim.getKind();
if ( field_kind != PrimitiveType.Kind.INT
&& field_kind != PrimitiveType.Kind.LONG
- && field_kind != PrimitiveType.Kind.FLOAT ) {
+ && field_kind != PrimitiveType.Kind.FLOAT
+ && field_kind != PrimitiveType.Kind.BYTE ) {
throw new RuntimeException("Field " + field.getSimpleName() + " is not of type 'int', 'long' or 'float'");
}
} else if ( "java.lang.String".equals(field_type.toString()) ) {
@@ -85,6 +86,8 @@ public class FieldsGenerator {
field_value_string = "0x" + Long.toHexString((Long)field.getConstantValue()).toUpperCase() + 'L';
} else if ( field_value_class.equals(Float.class) ) {
field_value_string = field.getConstantValue() + "f";
+ } else if ( value.getClass().equals(Byte.class) ) {
+ field_value_string = "0x" + Integer.toHexString((Byte)field.getConstantValue()).toUpperCase();
} else if ( field_value_class.equals(String.class) ) {
field_value_string = "\"" + field.getConstantValue() + "\"";
} else {
diff --git a/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java b/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
index bd343502..303289d1 100644
--- a/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
+++ b/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
@@ -209,17 +209,21 @@ public class JavaMethodsGenerator {
return false;
}
- private static void printBufferObjectCheck(PrintWriter writer, BufferKind kind, Mode mode) {
+ private static void printBufferObjectCheck(PrintWriter writer, BufferKind kind, Mode mode, boolean context_specific) {
String bo_check_method_name = kind.toString();
writer.print("\t\t" + Utils.CHECKS_CLASS_NAME + ".ensure" + bo_check_method_name);
if (mode == Mode.BUFFEROBJECT)
writer.print("enabled");
else
writer.print("disabled");
- writer.println("(caps);");
+
+ if ( context_specific )
+ writer.println("(caps);");
+ else
+ writer.println("();");
}
- private static void printBufferObjectChecks(PrintWriter writer, MethodDeclaration method, Mode mode) {
+ private static void printBufferObjectChecks(PrintWriter writer, MethodDeclaration method, Mode mode, boolean context_specific) {
EnumSet check_set = EnumSet.noneOf(BufferKind.class);
for (ParameterDeclaration param : method.getParameters()) {
BufferObject bo_annotation = param.getAnnotation(BufferObject.class);
@@ -227,7 +231,7 @@ public class JavaMethodsGenerator {
check_set.add(bo_annotation.value());
}
for (BufferKind kind : check_set)
- printBufferObjectCheck(writer, kind, mode);
+ printBufferObjectCheck(writer, kind, mode, context_specific);
}
private static void printMethodWithMultiType(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method, Map typeinfos_instance, Mode mode, boolean generate_error_checks, boolean context_specific) {
@@ -272,9 +276,9 @@ public class JavaMethodsGenerator {
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);
+ printBufferObjectChecks(writer, method, mode, context_specific);
printParameterChecks(writer, method, typeinfos_instance, mode, generate_error_checks);
- printParameterCaching(writer, interface_decl, method, mode);
+ printParameterCaching(writer, interface_decl, method, mode, context_specific);
if ( code_annotation != null && code_annotation.javaBeforeNative().length() > 0 )
writer.println(code_annotation.javaBeforeNative());
@@ -526,7 +530,7 @@ public class JavaMethodsGenerator {
writer.print(param.getSimpleName());
if (check_annotation != null && check_annotation.canBeNull())
writer.print(" != null ? " + param.getSimpleName());
- if ( type == PointerBuffer.class )
+ if ( type == PointerBuffer.class && param.getAnnotation(NativeType.class).value().endsWith("void") )
writer.print(".positionByte()");
else
writer.print(".position()");
@@ -588,7 +592,7 @@ public class JavaMethodsGenerator {
return first_parameter;
}
- private static void printParameterCaching(PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method, Mode mode) {
+ private static void printParameterCaching(PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method, Mode mode, boolean context_specific) {
for (ParameterDeclaration param : method.getParameters()) {
Class java_type = Utils.getJavaType(param.getType());
CachedReference cachedReference = param.getAnnotation(CachedReference.class);
@@ -596,7 +600,11 @@ public class JavaMethodsGenerator {
cachedReference != null &&
(mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) &&
param.getAnnotation(Result.class) == null) {
- writer.print("\t\tif ( LWJGLUtil.CHECKS ) " + "StateTracker.getReferences(caps).");
+ writer.print("\t\tif ( LWJGLUtil.CHECKS ) StateTracker.");
+ if ( context_specific )
+ writer.print("getReferences(caps).");
+ else
+ writer.print("getTracker().");
if(cachedReference.name().length() > 0) {
writer.print(cachedReference.name());
} else {
diff --git a/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java b/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
index d06cb1f4..43c4c4d5 100644
--- a/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
+++ b/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
@@ -308,7 +308,7 @@ public class NativeMethodStubsGenerator {
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;
+ (param.getAnnotation(NativeType.class) != null && param.getAnnotation(NativeType.class).value().endsWith("void"));
if (explicitly_byte_sized)
writer.print("(((char *)");
if (method.getAnnotation(GenerateAutos.class) != null || (check_annotation != null && check_annotation.canBeNull())) {
diff --git a/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java b/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java
index 5733b7dc..6ac67bd1 100644
--- a/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java
+++ b/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java
@@ -94,7 +94,7 @@ public class RegisterStubsGenerator {
continue;
if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null)
- signature += "I";
+ signature += "J";
else
signature += getTypeSignature(param.getType(), true);
}
diff --git a/src/java/org/lwjgl/util/generator/opengl/EGLint64NV.java b/src/java/org/lwjgl/util/generator/opengl/EGLint64NV.java
new file mode 100644
index 00000000..99a6e684
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/EGLint64NV.java
@@ -0,0 +1,12 @@
+package org.lwjgl.util.generator.opengl;
+
+import org.lwjgl.util.generator.NativeType;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@NativeType
+@Target({ ElementType.PARAMETER, ElementType.METHOD })
+public @interface EGLint64NV {
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opengl/EGLuint64NV.java b/src/java/org/lwjgl/util/generator/opengl/EGLuint64NV.java
new file mode 100644
index 00000000..e633d57a
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/EGLuint64NV.java
@@ -0,0 +1,12 @@
+package org.lwjgl.util.generator.opengl;
+
+import org.lwjgl.util.generator.NativeType;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@NativeType
+@Target({ ElementType.PARAMETER, ElementType.METHOD })
+public @interface EGLuint64NV {
+
+}
\ No newline at end of file
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLESCapabilitiesGenerator.java b/src/java/org/lwjgl/util/generator/opengl/GLESCapabilitiesGenerator.java
new file mode 100644
index 00000000..06d5e9a3
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLESCapabilitiesGenerator.java
@@ -0,0 +1,308 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.lwjgl.util.generator.opengl;
+
+import org.lwjgl.util.generator.*;
+
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.Iterator;
+
+import com.sun.mirror.declaration.InterfaceDeclaration;
+import com.sun.mirror.declaration.MethodDeclaration;
+import com.sun.mirror.type.InterfaceType;
+
+/**
+ * Generator visitor for the context capabilities generator tool
+ *
+ * @author elias_naur
+ * @version $Revision: 3334 $
+ * $Id: ContextCapabilitiesGenerator.java 3334 2010-04-22 23:21:48Z spasi $
+ */
+public class GLESCapabilitiesGenerator {
+
+ 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 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();
+ if ( !context_specific ) {
+ writer.println("\tprivate static boolean " + STUBS_LOADED_NAME + ";");
+ }
+ }
+
+ public static void generateInitializerPrologue(PrintWriter writer) {
+ writer.println("\t" + Utils.CONTEXT_CAPS_CLASS_NAME + "() throws LWJGLException {");
+ writer.println("\t\tSet " + CACHED_EXTS_VAR_NAME + " = " + ALL_INIT_METHOD_NAME + "();");
+ }
+
+ private static String translateFieldName(String interface_name) {
+ if ( interface_name.startsWith("GL") )
+ return CORE_PREFIX + interface_name;
+ else
+ return EXTENSION_PREFIX + interface_name;
+ }
+
+ public static void generateSuperClassAdds(PrintWriter writer, InterfaceDeclaration d) {
+ Collection super_interfaces = d.getSuperinterfaces();
+ if ( super_interfaces.size() > 1 )
+ throw new RuntimeException(d + " extends more than one other interface");
+ if ( super_interfaces.size() == 1 ) {
+ InterfaceType super_interface = super_interfaces.iterator().next();
+ writer.print("\t\tif (" + CACHED_EXTS_VAR_NAME + ".contains(\"");
+ writer.println(translateFieldName(d.getSimpleName()) + "\"))");
+ writer.print("\t\t\t");
+ generateAddExtension(writer, super_interface.getDeclaration());
+ }
+ }
+
+ public static void generateInitializer(PrintWriter writer, InterfaceDeclaration d) {
+ String translated_field_name = translateFieldName(d.getSimpleName());
+ writer.print("\t\tthis." + translated_field_name + " = ");
+ writer.print(CACHED_EXTS_VAR_NAME + ".contains(\"");
+ writer.print(translated_field_name + "\")");
+ Collection super_interfaces = d.getSuperinterfaces();
+ if ( super_interfaces.size() > 1 )
+ throw new RuntimeException(d + " extends more than one other interface");
+ if ( super_interfaces.size() == 1 ) {
+ InterfaceType super_interface = super_interfaces.iterator().next();
+ writer.println();
+ writer.print("\t\t\t&& " + CACHED_EXTS_VAR_NAME + ".contains(\"");
+ writer.print(translateFieldName(super_interface.getDeclaration().getSimpleName()) + "\")");
+ }
+ Alias alias_annotation = d.getAnnotation(Alias.class);
+ if ( alias_annotation != null ) {
+ writer.println();
+ writer.print("\t\t\t|| " + CACHED_EXTS_VAR_NAME + ".contains(\"");
+ writer.print(translateFieldName(alias_annotation.value()) + "\")");
+ }
+ writer.println(";");
+ }
+
+ private static String getAddressesInitializerName(String class_name) {
+ return class_name + POINTER_INITIALIZER_POSTFIX;
+ }
+
+ public static void generateInitStubsPrologue(PrintWriter writer, boolean context_specific) {
+ writer.println("\tprivate Set " + ALL_INIT_METHOD_NAME + "() throws LWJGLException {");
+
+ if ( context_specific ) {
+ // 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\");");
+ }
+
+ // Get the supported extensions set.
+ writer.println("\t\tGLContext.setCapabilities(this);");
+ writer.println("\t\tSet " + CACHED_EXTS_VAR_NAME + " = new HashSet(256);");
+ if ( !context_specific )
+ writer.println("\t\tGLContext.doInitNativeStubs(GLES20.class);");
+ writer.println("\t\tGLContext.getSupportedExtensions(" + CACHED_EXTS_VAR_NAME + ");");
+
+ if ( !context_specific ) {
+ writer.println("\t\tif (" + STUBS_LOADED_NAME + ")");
+ writer.println("\t\t\treturn " + CACHED_EXTS_VAR_NAME + ";");
+ } else {
+ writer.println("\t\tif (!" + getAddressesInitializerName("GLES20") + "())");
+ writer.println("\t\t\tthrow new LWJGLException(\"GL ES 2.0 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) {
+ // TODO: Remove GLES
+ if ( d.getMethods().size() > 0 && !d.getSimpleName().startsWith("GLES") ) {
+ 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(Dependent.class) != null )
+ 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;
+ Dependent dependent = d.getAnnotation(Dependent.class);
+ if ( dependent != null ) {
+ writer.print("Set supported_extensions");
+ }
+
+ Alias alias_annotation = d.getAnnotation(Alias.class);
+ boolean aliased = alias_annotation != null && alias_annotation.postfix().length() > 0;
+
+ writer.println(") {");
+ writer.println("\t\treturn ");
+
+ boolean first = true;
+ while ( methods.hasNext() ) {
+ MethodDeclaration method = methods.next();
+ if ( method.getAnnotation(Alternate.class) != null )
+ continue;
+
+ if ( !first )
+ writer.println(" &");
+ else
+ first = false;
+
+ optional = method.getAnnotation(Optional.class) != null;
+ dependent = method.getAnnotation(Dependent.class);
+
+ writer.print("\t\t\t(");
+ if ( optional )
+ writer.print('(');
+ 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 ( dependent != null )
+ writer.print('(');
+ writer.print(Utils.getFunctionAddressName(d, method) + " = ");
+ PlatformDependent platform_dependent = method.getAnnotation(PlatformDependent.class);
+ if ( platform_dependent != null ) {
+ EnumSet platform_set = EnumSet.copyOf(Arrays.asList(platform_dependent.value()));
+ writer.print("GLContext.getPlatformSpecificFunctionAddress(\"");
+ writer.print(Platform.ALL.getPrefix() + "\", ");
+ writer.print("new String[]{");
+ Iterator platforms = platform_set.iterator();
+ while ( platforms.hasNext() ) {
+ writer.print("\"" + platforms.next().getOSPrefix() + "\"");
+ if ( platforms.hasNext() )
+ writer.print(", ");
+ }
+ writer.print("}, new String[]{");
+ platforms = platform_set.iterator();
+ while ( platforms.hasNext() ) {
+ writer.print("\"" + platforms.next().getPrefix() + "\"");
+ if ( platforms.hasNext() )
+ writer.print(", ");
+ }
+ writer.print("}, ");
+ } else if ( aliased ) {
+ writer.print("GLContext.getFunctionAddress(new String[] {\"" + method.getSimpleName() + "\",\"" + method.getSimpleName() + alias_annotation.postfix() + "\"})) != 0");
+ } else
+ writer.print("GLContext.getFunctionAddress(");
+ if ( !aliased )
+ writer.print("\"" + method.getSimpleName() + "\")) != 0");
+ if ( 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("\tint " + 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/GLESGeneratorProcessorFactory.java b/src/java/org/lwjgl/util/generator/opengl/GLESGeneratorProcessorFactory.java
new file mode 100644
index 00000000..97fff4aa
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLESGeneratorProcessorFactory.java
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR 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 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.*;
+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 ContexCapabilities class
+ *
+ * @author elias_naur
+ * @version $Revision: 3316 $
+ * $Id: ContextGeneratorProcessorFactory.java 3316 2010-04-09 23:57:40Z spasi $
+ */
+public class GLESGeneratorProcessorFactory implements AnnotationProcessorFactory, RoundCompleteListener {
+
+ private static boolean first_round = true;
+
+ // Process any set of annotations
+ private static final Collection supportedAnnotations =
+ unmodifiableCollection(Arrays.asList("*"));
+
+ public Collection supportedAnnotationTypes() {
+ return supportedAnnotations;
+ }
+
+ public Collection supportedOptions() {
+ return unmodifiableCollection(Arrays.asList("-Acontextspecific", "-Ageneratechecks"));
+ }
+
+ public void roundComplete(RoundCompleteEvent event) {
+ first_round = false;
+ }
+
+ public AnnotationProcessor getProcessorFor(Set atds, AnnotationProcessorEnvironment env) {
+ // Only process the initial types, not the generated ones
+ if ( first_round ) {
+ env.addListener(this);
+ return new GeneratorProcessor(env);
+ } else
+ return AnnotationProcessors.NO_OP;
+ }
+
+ private static class GeneratorProcessor implements AnnotationProcessor {
+
+ private final AnnotationProcessorEnvironment env;
+
+ GeneratorProcessor(AnnotationProcessorEnvironment env) {
+ this.env = env;
+ }
+
+ public void process() {
+ Map options = env.getOptions();
+ boolean generate_error_checks = options.containsKey("-Ageneratechecks");
+ boolean context_specific = options.containsKey("-Acontextspecific");
+ try {
+ generateContextCapabilitiesSource(context_specific, generate_error_checks);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void generateContextCapabilitiesSource(boolean context_specific, boolean generate_error_checks) throws IOException {
+ PrintWriter writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, "org.lwjgl.opengles", new File(Utils.CONTEXT_CAPS_CLASS_NAME + ".java"), null);
+ writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */");
+ writer.println();
+ writer.println("package org.lwjgl.opengles;");
+ 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();
+ GLESCapabilitiesGenerator.generateClassPrologue(writer, context_specific, generate_error_checks);
+ DeclarationFilter filter = DeclarationFilter.getFilter(InterfaceDeclaration.class);
+ Collection interface_decls = filter.filter(env.getSpecifiedTypeDeclarations());
+ for ( TypeDeclaration typedecl : interface_decls ) {
+ InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl;
+ if ( Utils.isFinal(interface_decl) )
+ GLESCapabilitiesGenerator.generateField(writer, interface_decl);
+ }
+ writer.println();
+ if ( context_specific ) {
+ for ( TypeDeclaration typedecl : interface_decls ) {
+ InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl;
+ GLESCapabilitiesGenerator.generateSymbolAddresses(writer, interface_decl);
+ }
+ writer.println();
+ for ( TypeDeclaration typedecl : interface_decls ) {
+ InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl;
+ GLESCapabilitiesGenerator.generateAddressesInitializers(writer, interface_decl);
+ }
+ writer.println();
+ }
+
+ if ( context_specific ) {
+ 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");
+ }
+
+ GLESCapabilitiesGenerator.generateInitStubsPrologue(writer, context_specific);
+ for ( TypeDeclaration typedecl : interface_decls ) {
+ InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl;
+ GLESCapabilitiesGenerator.generateSuperClassAdds(writer, interface_decl);
+ }
+ for ( TypeDeclaration typedecl : interface_decls ) {
+ InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl;
+ if ( interface_decl.getSimpleName().startsWith("GLES") )
+ continue;
+ GLESCapabilitiesGenerator.generateInitStubs(writer, interface_decl, context_specific);
+ }
+ GLESCapabilitiesGenerator.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;
+ GLESCapabilitiesGenerator.generateUnloadStubs(writer, interface_decl);
+ }
+ writer.println("\t\tloaded_stubs = false;");
+ }
+ writer.println("\t}");
+ writer.println();
+ GLESCapabilitiesGenerator.generateInitializerPrologue(writer);
+ for ( TypeDeclaration typedecl : interface_decls ) {
+ InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl;
+ if ( Utils.isFinal(interface_decl) )
+ GLESCapabilitiesGenerator.generateInitializer(writer, interface_decl);
+ }
+ writer.println("\t}");
+ writer.println("}");
+ writer.close();
+ }
+ }
+}
diff --git a/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java b/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java
new file mode 100644
index 00000000..b9c91d7b
--- /dev/null
+++ b/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 2002-2008 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.lwjgl.util.generator.opengl;
+
+/**
+ *
+ * OpenGL sepcific generator behaviour
+ *
+ * @author elias_naur
+ * @version $Revision: 3287 $
+ * $Id: GLTypeMap.java 3287 2010-03-14 23:24:40Z spasi $
+ */
+
+import org.lwjgl.util.generator.NativeTypeTranslator;
+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 GLESTypeMap implements TypeMap {
+
+ private static final Map, PrimitiveType.Kind> native_types_to_primitive;
+
+ static {
+ native_types_to_primitive = new HashMap, PrimitiveType.Kind>();
+ native_types_to_primitive.put(GLbitfield.class, PrimitiveType.Kind.INT);
+ 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(GLhalf.class, PrimitiveType.Kind.SHORT);
+ 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(GLenum.class, PrimitiveType.Kind.INT);
+ native_types_to_primitive.put(GLintptr.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(EGLint64NV.class, PrimitiveType.Kind.LONG);
+ native_types_to_primitive.put(EGLuint64NV.class, PrimitiveType.Kind.LONG);
+ }
+
+ public PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class extends Annotation> 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 extends Annotation> 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 ( EGLuint64NV.class.equals(type) )
+ return Signedness.UNSIGNED;
+ else if ( EGLint64NV.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) )
+ return "f";
+ else if ( annotation_type.equals(GLhalf.class) )
+ return "h";
+ else if ( annotation_type.equals(GLboolean.class) || annotation_type.equals(GLvoid.class) )
+ return "";
+ else if ( annotation_type.equals(EGLuint64NV.class) || annotation_type.equals(EGLint64NV.class) )
+ return "l";
+ else
+ throw new RuntimeException(annotation_type + " is not allowed");
+ }
+
+ public Class extends Annotation> getNativeTypeFromPrimitiveType(PrimitiveType.Kind kind) {
+ Class extends Annotation> type;
+ switch ( kind ) {
+ case INT:
+ type = GLint.class;
+ break;
+ case FLOAT:
+ type = GLfloat.class;
+ break;
+ case SHORT:
+ type = GLshort.class;
+ break;
+ case BYTE:
+ type = GLbyte.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 GLubyte.class;
+ }
+
+ private static Class[] getValidBufferTypes(Class type) {
+ if ( type.equals(IntBuffer.class) )
+ return new Class[] { GLbitfield.class, GLenum.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, 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(LongBuffer.class) )
+ return new Class[] { EGLint64NV.class, EGLuint64NV.class };
+ else
+ return new Class[] { };
+ }
+
+ private static Class[] getValidPrimitiveTypes(Class type) {
+ if ( type.equals(long.class) )
+ return new Class[] { GLintptr.class, GLsizeiptr.class, EGLuint64NV.class, EGLint64NV.class };
+ else if ( type.equals(int.class) )
+ return new Class[] { GLbitfield.class, GLenum.class, GLint.class, GLuint.class, GLsizei.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, 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 "GL_APICALL ";
+ }
+
+ public String getFunctionPrefix() {
+ return "GL_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[] { org.lwjgl.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 extends Annotation> 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
+ return null;
+ }
+
+ public String getAutoTypeFromAnnotation(AnnotationMirror annotation) {
+ Class annotation_class = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
+ if ( annotation_class.equals(GLint.class) )
+ return "GLES20.GL_INT";
+ else if ( annotation_class.equals(GLbyte.class) )
+ return "GLES20.GL_BYTE";
+ else if ( annotation_class.equals(GLshort.class) )
+ return "GLES20.GL_SHORT";
+ if ( annotation_class.equals(GLuint.class) )
+ return "GLES20.GL_UNSIGNED_INT";
+ else if ( annotation_class.equals(GLubyte.class) )
+ return "GLES20.GL_UNSIGNED_BYTE";
+ else if ( annotation_class.equals(GLushort.class) )
+ return "GLES20.GL_UNSIGNED_SHORT";
+ else if ( annotation_class.equals(GLfloat.class) )
+ return "GLES20.GL_FLOAT";
+ else
+ return null;
+ }
+}
diff --git a/src/java/org/lwjgl/util/vector/Matrix4f.java b/src/java/org/lwjgl/util/vector/Matrix4f.java
index acfa7700..96645b02 100644
--- a/src/java/org/lwjgl/util/vector/Matrix4f.java
+++ b/src/java/org/lwjgl/util/vector/Matrix4f.java
@@ -52,6 +52,11 @@ public class Matrix4f extends Matrix implements Serializable {
setIdentity();
}
+ public Matrix4f(final Matrix4f src) {
+ super();
+ load(src);
+ }
+
/**
* Returns a string representation of this matrix
*/
@@ -278,6 +283,23 @@ public class Matrix4f extends Matrix implements Serializable {
return this;
}
+ /**
+ * Store the rotation portion of this matrix in a float buffer. The matrix is stored in column
+ * major (openGL) order.
+ * @param buf The buffer to store this matrix in
+ */
+ public Matrix store3f(FloatBuffer buf) {
+ buf.put(m00);
+ buf.put(m01);
+ buf.put(m02);
+ buf.put(m10);
+ buf.put(m11);
+ buf.put(m12);
+ buf.put(m20);
+ buf.put(m21);
+ buf.put(m22);
+ return this;
+ }
/**
* Add two matrices together and place the result in a third matrix.
diff --git a/src/native/common/EGL/egl.h b/src/native/common/EGL/egl.h
new file mode 100644
index 00000000..99ea342a
--- /dev/null
+++ b/src/native/common/EGL/egl.h
@@ -0,0 +1,329 @@
+/* -*- mode: c; tab-width: 8; -*- */
+/* vi: set sw=4 ts=8: */
+/* Reference version of egl.h for EGL 1.4.
+ * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
+ */
+
+/*
+** Copyright (c) 2007-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 __egl_h_
+#define __egl_h_
+
+/* All platform-dependent types and macro boilerplate (such as EGLAPI
+ * and EGLAPIENTRY) should go in eglplatform.h.
+ */
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* EGL Types */
+/* EGLint is defined in eglplatform.h */
+typedef unsigned int EGLBoolean;
+typedef unsigned int EGLenum;
+typedef void *EGLConfig;
+typedef void *EGLContext;
+typedef void *EGLDisplay;
+typedef void *EGLSurface;
+typedef void *EGLClientBuffer;
+
+/* EGL Versioning */
+#define EGL_VERSION_1_0 1
+#define EGL_VERSION_1_1 1
+#define EGL_VERSION_1_2 1
+#define EGL_VERSION_1_3 1
+#define EGL_VERSION_1_4 1
+
+/* EGL Enumerants. Bitmasks and other exceptional cases aside, most
+ * enums are assigned unique values starting at 0x3000.
+ */
+
+/* EGL aliases */
+#define EGL_FALSE 0
+#define EGL_TRUE 1
+
+/* Out-of-band handle values */
+#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
+#define EGL_NO_CONTEXT ((EGLContext)0)
+#define EGL_NO_DISPLAY ((EGLDisplay)0)
+#define EGL_NO_SURFACE ((EGLSurface)0)
+
+/* Out-of-band attribute value */
+#define EGL_DONT_CARE ((EGLint)-1)
+
+/* Errors / GetError return values */
+#define EGL_SUCCESS 0x3000
+#define EGL_NOT_INITIALIZED 0x3001
+#define EGL_BAD_ACCESS 0x3002
+#define EGL_BAD_ALLOC 0x3003
+#define EGL_BAD_ATTRIBUTE 0x3004
+#define EGL_BAD_CONFIG 0x3005
+#define EGL_BAD_CONTEXT 0x3006
+#define EGL_BAD_CURRENT_SURFACE 0x3007
+#define EGL_BAD_DISPLAY 0x3008
+#define EGL_BAD_MATCH 0x3009
+#define EGL_BAD_NATIVE_PIXMAP 0x300A
+#define EGL_BAD_NATIVE_WINDOW 0x300B
+#define EGL_BAD_PARAMETER 0x300C
+#define EGL_BAD_SURFACE 0x300D
+#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */
+
+/* Reserved 0x300F-0x301F for additional errors */
+
+/* Config attributes */
+#define EGL_BUFFER_SIZE 0x3020
+#define EGL_ALPHA_SIZE 0x3021
+#define EGL_BLUE_SIZE 0x3022
+#define EGL_GREEN_SIZE 0x3023
+#define EGL_RED_SIZE 0x3024
+#define EGL_DEPTH_SIZE 0x3025
+#define EGL_STENCIL_SIZE 0x3026
+#define EGL_CONFIG_CAVEAT 0x3027
+#define EGL_CONFIG_ID 0x3028
+#define EGL_LEVEL 0x3029
+#define EGL_MAX_PBUFFER_HEIGHT 0x302A
+#define EGL_MAX_PBUFFER_PIXELS 0x302B
+#define EGL_MAX_PBUFFER_WIDTH 0x302C
+#define EGL_NATIVE_RENDERABLE 0x302D
+#define EGL_NATIVE_VISUAL_ID 0x302E
+#define EGL_NATIVE_VISUAL_TYPE 0x302F
+#define EGL_SAMPLES 0x3031
+#define EGL_SAMPLE_BUFFERS 0x3032
+#define EGL_SURFACE_TYPE 0x3033
+#define EGL_TRANSPARENT_TYPE 0x3034
+#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
+#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
+#define EGL_TRANSPARENT_RED_VALUE 0x3037
+#define EGL_NONE 0x3038 /* Attrib list terminator */
+#define EGL_BIND_TO_TEXTURE_RGB 0x3039
+#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
+#define EGL_MIN_SWAP_INTERVAL 0x303B
+#define EGL_MAX_SWAP_INTERVAL 0x303C
+#define EGL_LUMINANCE_SIZE 0x303D
+#define EGL_ALPHA_MASK_SIZE 0x303E
+#define EGL_COLOR_BUFFER_TYPE 0x303F
+#define EGL_RENDERABLE_TYPE 0x3040
+#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */
+#define EGL_CONFORMANT 0x3042
+
+/* Reserved 0x3041-0x304F for additional config attributes */
+
+/* Config attribute values */
+#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */
+#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */
+#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */
+#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */
+#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */
+
+/* More config attribute values, for EGL_TEXTURE_FORMAT */
+#define EGL_NO_TEXTURE 0x305C
+#define EGL_TEXTURE_RGB 0x305D
+#define EGL_TEXTURE_RGBA 0x305E
+#define EGL_TEXTURE_2D 0x305F
+
+/* Config attribute mask bits */
+#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */
+
+#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */
+#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */
+#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */
+#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */
+
+/* QueryString targets */
+#define EGL_VENDOR 0x3053
+#define EGL_VERSION 0x3054
+#define EGL_EXTENSIONS 0x3055
+#define EGL_CLIENT_APIS 0x308D
+
+/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */
+#define EGL_HEIGHT 0x3056
+#define EGL_WIDTH 0x3057
+#define EGL_LARGEST_PBUFFER 0x3058
+#define EGL_TEXTURE_FORMAT 0x3080
+#define EGL_TEXTURE_TARGET 0x3081
+#define EGL_MIPMAP_TEXTURE 0x3082
+#define EGL_MIPMAP_LEVEL 0x3083
+#define EGL_RENDER_BUFFER 0x3086
+#define EGL_VG_COLORSPACE 0x3087
+#define EGL_VG_ALPHA_FORMAT 0x3088
+#define EGL_HORIZONTAL_RESOLUTION 0x3090
+#define EGL_VERTICAL_RESOLUTION 0x3091
+#define EGL_PIXEL_ASPECT_RATIO 0x3092
+#define EGL_SWAP_BEHAVIOR 0x3093
+#define EGL_MULTISAMPLE_RESOLVE 0x3099
+
+/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */
+#define EGL_BACK_BUFFER 0x3084
+#define EGL_SINGLE_BUFFER 0x3085
+
+/* OpenVG color spaces */
+#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */
+#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */
+
+/* OpenVG alpha formats */
+#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */
+#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */
+
+/* Constant scale factor by which fractional display resolutions &
+ * aspect ratio are scaled when queried as integer values.
+ */
+#define EGL_DISPLAY_SCALING 10000
+
+/* Unknown display resolution/aspect ratio */
+#define EGL_UNKNOWN ((EGLint)-1)
+
+/* Back buffer swap behaviors */
+#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */
+#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */
+
+/* CreatePbufferFromClientBuffer buffer types */
+#define EGL_OPENVG_IMAGE 0x3096
+
+/* QueryContext targets */
+#define EGL_CONTEXT_CLIENT_TYPE 0x3097
+
+/* CreateContext attributes */
+#define EGL_CONTEXT_CLIENT_VERSION 0x3098
+
+/* Multisample resolution behaviors */
+#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */
+#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */
+
+/* BindAPI/QueryAPI targets */
+#define EGL_OPENGL_ES_API 0x30A0
+#define EGL_OPENVG_API 0x30A1
+#define EGL_OPENGL_API 0x30A2
+
+/* GetCurrentSurface targets */
+#define EGL_DRAW 0x3059
+#define EGL_READ 0x305A
+
+/* WaitNative engines */
+#define EGL_CORE_NATIVE_ENGINE 0x305B
+
+/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */
+#define EGL_COLORSPACE EGL_VG_COLORSPACE
+#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT
+#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB
+#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR
+#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE
+#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE
+
+/* EGL extensions must request enum blocks from the Khronos
+ * API Registrar, who maintains the enumerant registry. Submit
+ * a bug in Khronos Bugzilla against task "Registry".
+ */
+
+
+
+/* EGL Functions */
+
+EGLAPI EGLint EGLAPIENTRY eglGetError(void);
+
+EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id);
+EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
+EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy);
+
+EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
+ EGLint config_size, EGLint *num_config);
+EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
+ EGLConfig *configs, EGLint config_size,
+ EGLint *num_config);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
+ EGLint attribute, EGLint *value);
+
+EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
+ EGLNativeWindowType win,
+ const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
+ const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
+ EGLNativePixmapType pixmap,
+ const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
+ EGLint attribute, EGLint *value);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api);
+EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void);
+
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(
+ EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
+ EGLConfig config, const EGLint *attrib_list);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
+ EGLint attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+
+
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
+
+
+EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config,
+ EGLContext share_context,
+ const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
+EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
+ EGLSurface read, EGLContext ctx);
+
+EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void);
+EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx,
+ EGLint attribute, EGLint *value);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine);
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
+ EGLNativePixmapType target);
+
+/* This is a generic function pointer type, whose name indicates it must
+ * be cast to the proper type *and calling convention* before use.
+ */
+typedef void (*__eglMustCastToProperFunctionPointerType)(void);
+
+/* Now, define eglGetProcAddress using the generic function ptr. type */
+EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
+ eglGetProcAddress(const char *procname);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __egl_h_ */
diff --git a/src/native/common/EGL/eglext.h b/src/native/common/EGL/eglext.h
new file mode 100644
index 00000000..70051cf1
--- /dev/null
+++ b/src/native/common/EGL/eglext.h
@@ -0,0 +1,230 @@
+#ifndef __eglext_h_
+#define __eglext_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2007-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.
+*/
+
+#include
+
+/*************************************************************/
+
+/* Header file version number */
+/* Current version at http://www.khronos.org/registry/egl/ */
+/* $Revision: 11249 $ on $Date: 2010-05-05 09:54:28 -0700 (Wed, 05 May 2010) $ */
+#define EGL_EGLEXT_VERSION 5
+
+#ifndef EGL_KHR_config_attribs
+#define EGL_KHR_config_attribs 1
+#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */
+#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */
+#endif
+
+#ifndef EGL_KHR_lock_surface
+#define EGL_KHR_lock_surface 1
+#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
+#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
+#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */
+#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */
+#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */
+#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */
+#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */
+#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */
+#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */
+#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */
+#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */
+#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */
+#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */
+#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */
+#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */
+#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
+#endif
+
+#ifndef EGL_KHR_image
+#define EGL_KHR_image 1
+#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */
+typedef void *EGLImageKHR;
+#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
+#endif
+
+#ifndef EGL_KHR_vg_parent_image
+#define EGL_KHR_vg_parent_image 1
+#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */
+#endif
+
+#ifndef EGL_KHR_gl_texture_2D_image
+#define EGL_KHR_gl_texture_2D_image 1
+#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */
+#endif
+
+#ifndef EGL_KHR_gl_texture_cubemap_image
+#define EGL_KHR_gl_texture_cubemap_image 1
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */
+#endif
+
+#ifndef EGL_KHR_gl_texture_3D_image
+#define EGL_KHR_gl_texture_3D_image 1
+#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */
+#endif
+
+#ifndef EGL_KHR_gl_renderbuffer_image
+#define EGL_KHR_gl_renderbuffer_image 1
+#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */
+#endif
+
+#ifndef EGL_KHR_reusable_sync
+#define EGL_KHR_reusable_sync 1
+
+typedef void* EGLSyncKHR;
+typedef khronos_utime_nanoseconds_t EGLTimeKHR;
+
+#define EGL_SYNC_STATUS_KHR 0x30F1
+#define EGL_SIGNALED_KHR 0x30F2
+#define EGL_UNSIGNALED_KHR 0x30F3
+#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
+#define EGL_CONDITION_SATISFIED_KHR 0x30F6
+#define EGL_SYNC_TYPE_KHR 0x30F7
+#define EGL_SYNC_REUSABLE_KHR 0x30FA
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR bitfield */
+#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
+#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#endif
+
+#ifndef EGL_KHR_image_base
+#define EGL_KHR_image_base 1
+/* Most interfaces defined by EGL_KHR_image_pixmap above */
+#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */
+#endif
+
+#ifndef EGL_KHR_image_pixmap
+#define EGL_KHR_image_pixmap 1
+/* Interfaces defined by EGL_KHR_image above */
+#endif
+
+#ifndef EGL_IMG_context_priority
+#define EGL_IMG_context_priority 1
+#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
+#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
+#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
+#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
+#endif
+
+#ifndef EGL_NV_coverage_sample
+#define EGL_NV_coverage_sample 1
+#define EGL_COVERAGE_BUFFERS_NV 0x30E0
+#define EGL_COVERAGE_SAMPLES_NV 0x30E1
+#endif
+
+#ifndef EGL_NV_depth_nonlinear
+#define EGL_NV_depth_nonlinear 1
+#define EGL_DEPTH_ENCODING_NV 0x30E2
+#define EGL_DEPTH_ENCODING_NONE_NV 0
+#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
+#endif
+
+#ifndef EGL_NV_sync
+#define EGL_NV_sync 1
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
+#define EGL_SYNC_STATUS_NV 0x30E7
+#define EGL_SIGNALED_NV 0x30E8
+#define EGL_UNSIGNALED_NV 0x30E9
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
+#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
+#define EGL_ALREADY_SIGNALED_NV 0x30EA
+#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
+#define EGL_CONDITION_SATISFIED_NV 0x30EC
+#define EGL_SYNC_TYPE_NV 0x30ED
+#define EGL_SYNC_CONDITION_NV 0x30EE
+#define EGL_SYNC_FENCE_NV 0x30EF
+#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
+typedef void* EGLSyncNV;
+typedef unsigned long long EGLTimeNV;
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLSyncNV eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+EGLBoolean eglDestroySyncNV (EGLSyncNV sync);
+EGLBoolean eglFenceNV (EGLSyncNV sync);
+EGLint eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+EGLBoolean eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
+EGLBoolean eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#endif
+
+#ifndef EGL_KHR_fence_sync
+#define EGL_KHR_fence_sync 1
+/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
+#define EGL_SYNC_CONDITION_KHR 0x30F8
+#define EGL_SYNC_FENCE_KHR 0x30F9
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/native/common/EGL/eglplatform.h b/src/native/common/EGL/eglplatform.h
new file mode 100644
index 00000000..22e855f5
--- /dev/null
+++ b/src/native/common/EGL/eglplatform.h
@@ -0,0 +1,110 @@
+#ifndef __eglplatform_h_
+#define __eglplatform_h_
+
+/*
+** Copyright (c) 2007-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.
+*/
+
+/* Platform-specific types and definitions for egl.h
+ * $Revision: 9724 $ on $Date: 2009-12-02 02:05:33 -0800 (Wed, 02 Dec 2009) $
+ *
+ * Adopters may modify khrplatform.h and this file to suit their platform.
+ * You are encouraged to submit all modifications to the Khronos group so that
+ * they can be included in future versions of this file. Please submit changes
+ * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+ * by filing a bug against product "EGL" component "Registry".
+ */
+
+#include
+
+/* Macros used in EGL function prototype declarations.
+ *
+ * EGL functions should be prototyped as:
+ *
+ * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
+ * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
+ *
+ * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
+ */
+
+#ifndef EGLAPI
+#define EGLAPI KHRONOS_APICALL
+#endif
+
+#ifndef EGLAPIENTRY
+#define EGLAPIENTRY KHRONOS_APIENTRY
+#endif
+#define EGLAPIENTRYP EGLAPIENTRY*
+
+/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
+ * are aliases of window-system-dependent types, such as X Display * or
+ * Windows Device Context. They must be defined in platform-specific
+ * code below. The EGL-prefixed versions of Native*Type are the same
+ * types, renamed in EGL 1.3 so all types in the API start with "EGL".
+ */
+
+#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN 1
+#endif
+#include
+
+typedef HDC EGLNativeDisplayType;
+typedef HBITMAP EGLNativePixmapType;
+typedef HWND EGLNativeWindowType;
+
+#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
+
+typedef int EGLNativeDisplayType;
+typedef void *EGLNativeWindowType;
+typedef void *EGLNativePixmapType;
+
+#elif defined(__unix__)
+
+/* X11 (tentative) */
+#include
+#include
+
+typedef Display *EGLNativeDisplayType;
+typedef Pixmap EGLNativePixmapType;
+typedef Window EGLNativeWindowType;
+
+#else
+#error "Platform not recognized"
+#endif
+
+/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
+typedef EGLNativeDisplayType NativeDisplayType;
+typedef EGLNativePixmapType NativePixmapType;
+typedef EGLNativeWindowType NativeWindowType;
+
+
+/* Define EGLint. This must be a signed integral type large enough to contain
+ * all legal attribute names and values passed into and out of EGL, whether
+ * their type is boolean, bitmask, enumerant (symbolic constant), integer,
+ * handle, or other. While in general a 32-bit integer will suffice, if
+ * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
+ * integer type.
+ */
+typedef khronos_int32_t EGLint;
+
+#endif /* __eglplatform_h */
diff --git a/src/native/common/GLES2/gl2.h b/src/native/common/GLES2/gl2.h
new file mode 100644
index 00000000..e1d3b87c
--- /dev/null
+++ b/src/native/common/GLES2/gl2.h
@@ -0,0 +1,621 @@
+#ifndef __gl2_h_
+#define __gl2_h_
+
+/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+/*-------------------------------------------------------------------------
+ * Data type definitions
+ *-----------------------------------------------------------------------*/
+
+typedef void GLvoid;
+typedef char GLchar;
+typedef unsigned int GLenum;
+typedef unsigned char GLboolean;
+typedef unsigned int GLbitfield;
+typedef khronos_int8_t GLbyte;
+typedef short GLshort;
+typedef int GLint;
+typedef int GLsizei;
+typedef khronos_uint8_t GLubyte;
+typedef unsigned short GLushort;
+typedef unsigned int GLuint;
+typedef khronos_float_t GLfloat;
+typedef khronos_float_t GLclampf;
+typedef khronos_int32_t GLfixed;
+
+/* GL types for handling large vertex buffer objects */
+typedef khronos_intptr_t GLintptr;
+typedef khronos_ssize_t GLsizeiptr;
+
+/* OpenGL ES core versions */
+#define GL_ES_VERSION_2_0 1
+
+/* ClearBufferMask */
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_COLOR_BUFFER_BIT 0x00004000
+
+/* Boolean */
+#define GL_FALSE 0
+#define GL_TRUE 1
+
+/* BeginMode */
+#define GL_POINTS 0x0000
+#define GL_LINES 0x0001
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_STRIP 0x0003
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRIANGLE_FAN 0x0006
+
+/* AlphaFunction (not supported in ES20) */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+/* BlendingFactorDest */
+#define GL_ZERO 0
+#define GL_ONE 1
+#define GL_SRC_COLOR 0x0300
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_SRC_ALPHA 0x0302
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_DST_ALPHA 0x0304
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+
+/* BlendingFactorSrc */
+/* GL_ZERO */
+/* GL_ONE */
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+/* GL_SRC_ALPHA */
+/* GL_ONE_MINUS_SRC_ALPHA */
+/* GL_DST_ALPHA */
+/* GL_ONE_MINUS_DST_ALPHA */
+
+/* BlendEquationSeparate */
+#define GL_FUNC_ADD 0x8006
+#define GL_BLEND_EQUATION 0x8009
+#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+
+/* BlendSubtract */
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+
+/* Separate Blend Functions */
+#define GL_BLEND_DST_RGB 0x80C8
+#define GL_BLEND_SRC_RGB 0x80C9
+#define GL_BLEND_DST_ALPHA 0x80CA
+#define GL_BLEND_SRC_ALPHA 0x80CB
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#define GL_BLEND_COLOR 0x8005
+
+/* Buffer Objects */
+#define GL_ARRAY_BUFFER 0x8892
+#define GL_ELEMENT_ARRAY_BUFFER 0x8893
+#define GL_ARRAY_BUFFER_BINDING 0x8894
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
+
+#define GL_STREAM_DRAW 0x88E0
+#define GL_STATIC_DRAW 0x88E4
+#define GL_DYNAMIC_DRAW 0x88E8
+
+#define GL_BUFFER_SIZE 0x8764
+#define GL_BUFFER_USAGE 0x8765
+
+#define GL_CURRENT_VERTEX_ATTRIB 0x8626
+
+/* CullFaceMode */
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_FRONT_AND_BACK 0x0408
+
+/* DepthFunction */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+/* EnableCap */
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_CULL_FACE 0x0B44
+#define GL_BLEND 0x0BE2
+#define GL_DITHER 0x0BD0
+#define GL_STENCIL_TEST 0x0B90
+#define GL_DEPTH_TEST 0x0B71
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_COVERAGE 0x80A0
+
+/* ErrorCode */
+#define GL_NO_ERROR 0
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVALID_OPERATION 0x0502
+#define GL_OUT_OF_MEMORY 0x0505
+
+/* FrontFaceDirection */
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+
+/* GetPName */
+#define GL_LINE_WIDTH 0x0B21
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_FRONT_FACE 0x0B46
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_WRITEMASK 0x0B98
+#define GL_STENCIL_BACK_FUNC 0x8800
+#define GL_STENCIL_BACK_FAIL 0x8801
+#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
+#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
+#define GL_STENCIL_BACK_REF 0x8CA3
+#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
+#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
+#define GL_VIEWPORT 0x0BA2
+#define GL_SCISSOR_BOX 0x0C10
+/* GL_SCISSOR_TEST */
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_RED_BITS 0x0D52
+#define GL_GREEN_BITS 0x0D53
+#define GL_BLUE_BITS 0x0D54
+#define GL_ALPHA_BITS 0x0D55
+#define GL_DEPTH_BITS 0x0D56
+#define GL_STENCIL_BITS 0x0D57
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+/* GL_POLYGON_OFFSET_FILL */
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+
+/* GetTextureParameter */
+/* GL_TEXTURE_MAG_FILTER */
+/* GL_TEXTURE_MIN_FILTER */
+/* GL_TEXTURE_WRAP_S */
+/* GL_TEXTURE_WRAP_T */
+
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+
+/* HintMode */
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+
+/* HintTarget */
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+
+/* DataType */
+#define GL_BYTE 0x1400
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_SHORT 0x1402
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_INT 0x1404
+#define GL_UNSIGNED_INT 0x1405
+#define GL_FLOAT 0x1406
+#define GL_FIXED 0x140C
+
+/* PixelFormat */
+#define GL_DEPTH_COMPONENT 0x1902
+#define GL_ALPHA 0x1906
+#define GL_RGB 0x1907
+#define GL_RGBA 0x1908
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+
+/* PixelType */
+/* GL_UNSIGNED_BYTE */
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+
+/* Shaders */
+#define GL_FRAGMENT_SHADER 0x8B30
+#define GL_VERTEX_SHADER 0x8B31
+#define GL_MAX_VERTEX_ATTRIBS 0x8869
+#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+#define GL_MAX_VARYING_VECTORS 0x8DFC
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
+#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+#define GL_SHADER_TYPE 0x8B4F
+#define GL_DELETE_STATUS 0x8B80
+#define GL_LINK_STATUS 0x8B82
+#define GL_VALIDATE_STATUS 0x8B83
+#define GL_ATTACHED_SHADERS 0x8B85
+#define GL_ACTIVE_UNIFORMS 0x8B86
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
+#define GL_ACTIVE_ATTRIBUTES 0x8B89
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
+#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
+#define GL_CURRENT_PROGRAM 0x8B8D
+
+/* StencilFunction */
+#define GL_NEVER 0x0200
+#define GL_LESS 0x0201
+#define GL_EQUAL 0x0202
+#define GL_LEQUAL 0x0203
+#define GL_GREATER 0x0204
+#define GL_NOTEQUAL 0x0205
+#define GL_GEQUAL 0x0206
+#define GL_ALWAYS 0x0207
+
+/* StencilOp */
+/* GL_ZERO */
+#define GL_KEEP 0x1E00
+#define GL_REPLACE 0x1E01
+#define GL_INCR 0x1E02
+#define GL_DECR 0x1E03
+#define GL_INVERT 0x150A
+#define GL_INCR_WRAP 0x8507
+#define GL_DECR_WRAP 0x8508
+
+/* StringName */
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+
+/* TextureMagFilter */
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+
+/* TextureMinFilter */
+/* GL_NEAREST */
+/* GL_LINEAR */
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+
+/* TextureParameterName */
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+
+/* TextureTarget */
+/* GL_TEXTURE_2D */
+#define GL_TEXTURE 0x1702
+
+#define GL_TEXTURE_CUBE_MAP 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+
+/* TextureUnit */
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE3 0x84C3
+#define GL_TEXTURE4 0x84C4
+#define GL_TEXTURE5 0x84C5
+#define GL_TEXTURE6 0x84C6
+#define GL_TEXTURE7 0x84C7
+#define GL_TEXTURE8 0x84C8
+#define GL_TEXTURE9 0x84C9
+#define GL_TEXTURE10 0x84CA
+#define GL_TEXTURE11 0x84CB
+#define GL_TEXTURE12 0x84CC
+#define GL_TEXTURE13 0x84CD
+#define GL_TEXTURE14 0x84CE
+#define GL_TEXTURE15 0x84CF
+#define GL_TEXTURE16 0x84D0
+#define GL_TEXTURE17 0x84D1
+#define GL_TEXTURE18 0x84D2
+#define GL_TEXTURE19 0x84D3
+#define GL_TEXTURE20 0x84D4
+#define GL_TEXTURE21 0x84D5
+#define GL_TEXTURE22 0x84D6
+#define GL_TEXTURE23 0x84D7
+#define GL_TEXTURE24 0x84D8
+#define GL_TEXTURE25 0x84D9
+#define GL_TEXTURE26 0x84DA
+#define GL_TEXTURE27 0x84DB
+#define GL_TEXTURE28 0x84DC
+#define GL_TEXTURE29 0x84DD
+#define GL_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_ACTIVE_TEXTURE 0x84E0
+
+/* TextureWrapMode */
+#define GL_REPEAT 0x2901
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MIRRORED_REPEAT 0x8370
+
+/* Uniform Types */
+#define GL_FLOAT_VEC2 0x8B50
+#define GL_FLOAT_VEC3 0x8B51
+#define GL_FLOAT_VEC4 0x8B52
+#define GL_INT_VEC2 0x8B53
+#define GL_INT_VEC3 0x8B54
+#define GL_INT_VEC4 0x8B55
+#define GL_BOOL 0x8B56
+#define GL_BOOL_VEC2 0x8B57
+#define GL_BOOL_VEC3 0x8B58
+#define GL_BOOL_VEC4 0x8B59
+#define GL_FLOAT_MAT2 0x8B5A
+#define GL_FLOAT_MAT3 0x8B5B
+#define GL_FLOAT_MAT4 0x8B5C
+#define GL_SAMPLER_2D 0x8B5E
+#define GL_SAMPLER_CUBE 0x8B60
+
+/* Vertex Arrays */
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
+
+/* Read Format */
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+
+/* Shader Source */
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_SHADER_COMPILER 0x8DFA
+
+/* Shader Binary */
+#define GL_SHADER_BINARY_FORMATS 0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+
+/* Shader Precision-Specified Types */
+#define GL_LOW_FLOAT 0x8DF0
+#define GL_MEDIUM_FLOAT 0x8DF1
+#define GL_HIGH_FLOAT 0x8DF2
+#define GL_LOW_INT 0x8DF3
+#define GL_MEDIUM_INT 0x8DF4
+#define GL_HIGH_INT 0x8DF5
+
+/* Framebuffer Object. */
+#define GL_FRAMEBUFFER 0x8D40
+#define GL_RENDERBUFFER 0x8D41
+
+#define GL_RGBA4 0x8056
+#define GL_RGB5_A1 0x8057
+#define GL_RGB565 0x8D62
+#define GL_DEPTH_COMPONENT16 0x81A5
+#define GL_STENCIL_INDEX 0x1901
+#define GL_STENCIL_INDEX8 0x8D48
+
+#define GL_RENDERBUFFER_WIDTH 0x8D42
+#define GL_RENDERBUFFER_HEIGHT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+#define GL_RENDERBUFFER_RED_SIZE 0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+
+#define GL_COLOR_ATTACHMENT0 0x8CE0
+#define GL_DEPTH_ATTACHMENT 0x8D00
+#define GL_STENCIL_ATTACHMENT 0x8D20
+
+#define GL_NONE 0
+
+#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
+#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
+
+#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+
+/*-------------------------------------------------------------------------
+ * GL core functions.
+ *-----------------------------------------------------------------------*/
+
+GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
+GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name);
+GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
+GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
+GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode );
+GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
+GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
+GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
+GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
+GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth);
+GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
+GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
+GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
+GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
+GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
+GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
+GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
+GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
+GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
+GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
+GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
+GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
+GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
+GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
+GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glFinish (void);
+GL_APICALL void GL_APIENTRY glFlush (void);
+GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
+GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
+GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
+GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
+GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
+GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
+GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
+GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
+GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
+GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
+GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL GLenum GL_APIENTRY glGetError (void);
+GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
+GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
+GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
+GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
+GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
+GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
+GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
+GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
+GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
+GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
+GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
+GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
+GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
+GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
+GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
+GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
+GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
+GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length);
+GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
+GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
+GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
+GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
+GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
+GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
+GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
+GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gl2_h_ */
diff --git a/src/native/common/GLES2/gl2ext.h b/src/native/common/GLES2/gl2ext.h
new file mode 100644
index 00000000..334e9cef
--- /dev/null
+++ b/src/native/common/GLES2/gl2ext.h
@@ -0,0 +1,803 @@
+#ifndef __gl2ext_h_
+#define __gl2ext_h_
+
+/* $Revision: 10969 $ on $Date:: 2010-04-09 02:27:15 -0700 #$ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+#ifndef GL_APIENTRYP
+# define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+/*------------------------------------------------------------------------*
+ * OES extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_OES_compressed_ETC1_RGB8_texture */
+#ifndef GL_OES_compressed_ETC1_RGB8_texture
+#define GL_ETC1_RGB8_OES 0x8D64
+#endif
+
+/* GL_OES_compressed_paletted_texture */
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_PALETTE4_RGB8_OES 0x8B90
+#define GL_PALETTE4_RGBA8_OES 0x8B91
+#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
+#define GL_PALETTE4_RGBA4_OES 0x8B93
+#define GL_PALETTE4_RGB5_A1_OES 0x8B94
+#define GL_PALETTE8_RGB8_OES 0x8B95
+#define GL_PALETTE8_RGBA8_OES 0x8B96
+#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
+#define GL_PALETTE8_RGBA4_OES 0x8B98
+#define GL_PALETTE8_RGB5_A1_OES 0x8B99
+#endif
+
+/* GL_OES_depth24 */
+#ifndef GL_OES_depth24
+#define GL_DEPTH_COMPONENT24_OES 0x81A6
+#endif
+
+/* GL_OES_depth32 */
+#ifndef GL_OES_depth32
+#define GL_DEPTH_COMPONENT32_OES 0x81A7
+#endif
+
+/* GL_OES_depth_texture */
+/* No new tokens introduced by this extension. */
+
+/* GL_OES_EGL_image */
+#ifndef GL_OES_EGL_image
+typedef void* GLeglImageOES;
+#endif
+
+/* GL_OES_element_index_uint */
+#ifndef GL_OES_element_index_uint
+#define GL_UNSIGNED_INT 0x1405
+#endif
+
+/* GL_OES_get_program_binary */
+#ifndef GL_OES_get_program_binary
+#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
+#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
+#endif
+
+/* GL_OES_mapbuffer */
+#ifndef GL_OES_mapbuffer
+#define GL_WRITE_ONLY_OES 0x88B9
+#define GL_BUFFER_ACCESS_OES 0x88BB
+#define GL_BUFFER_MAPPED_OES 0x88BC
+#define GL_BUFFER_MAP_POINTER_OES 0x88BD
+#endif
+
+/* GL_OES_packed_depth_stencil */
+#ifndef GL_OES_packed_depth_stencil
+#define GL_DEPTH_STENCIL_OES 0x84F9
+#define GL_UNSIGNED_INT_24_8_OES 0x84FA
+#define GL_DEPTH24_STENCIL8_OES 0x88F0
+#endif
+
+/* GL_OES_rgb8_rgba8 */
+#ifndef GL_OES_rgb8_rgba8
+#define GL_RGB8_OES 0x8051
+#define GL_RGBA8_OES 0x8058
+#endif
+
+/* GL_OES_standard_derivatives */
+#ifndef GL_OES_standard_derivatives
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
+#endif
+
+/* GL_OES_stencil1 */
+#ifndef GL_OES_stencil1
+#define GL_STENCIL_INDEX1_OES 0x8D46
+#endif
+
+/* GL_OES_stencil4 */
+#ifndef GL_OES_stencil4
+#define GL_STENCIL_INDEX4_OES 0x8D47
+#endif
+
+/* GL_OES_texture_3D */
+#ifndef GL_OES_texture_3D
+#define GL_TEXTURE_WRAP_R_OES 0x8072
+#define GL_TEXTURE_3D_OES 0x806F
+#define GL_TEXTURE_BINDING_3D_OES 0x806A
+#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073
+#define GL_SAMPLER_3D_OES 0x8B5F
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4
+#endif
+
+/* GL_OES_texture_float */
+/* No new tokens introduced by this extension. */
+
+/* GL_OES_texture_float_linear */
+/* No new tokens introduced by this extension. */
+
+/* GL_OES_texture_half_float */
+#ifndef GL_OES_texture_half_float
+#define GL_HALF_FLOAT_OES 0x8D61
+#endif
+
+/* GL_OES_texture_half_float_linear */
+/* No new tokens introduced by this extension. */
+
+/* GL_OES_texture_npot */
+/* No new tokens introduced by this extension. */
+
+/* GL_OES_vertex_array_object */
+#ifndef GL_OES_vertex_array_object
+#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
+#endif
+
+/* GL_OES_vertex_half_float */
+/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */
+
+/* GL_OES_vertex_type_10_10_10_2 */
+#ifndef GL_OES_vertex_type_10_10_10_2
+#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6
+#define GL_INT_10_10_10_2_OES 0x8DF7
+#endif
+
+/*------------------------------------------------------------------------*
+ * AMD extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_AMD_compressed_3DC_texture */
+#ifndef GL_AMD_compressed_3DC_texture
+#define GL_3DC_X_AMD 0x87F9
+#define GL_3DC_XY_AMD 0x87FA
+#endif
+
+/* GL_AMD_compressed_ATC_texture */
+#ifndef GL_AMD_compressed_ATC_texture
+#define GL_ATC_RGB_AMD 0x8C92
+#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
+#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
+#endif
+
+/* GL_AMD_performance_monitor */
+#ifndef GL_AMD_performance_monitor
+#define GL_COUNTER_TYPE_AMD 0x8BC0
+#define GL_COUNTER_RANGE_AMD 0x8BC1
+#define GL_UNSIGNED_INT64_AMD 0x8BC2
+#define GL_PERCENTAGE_AMD 0x8BC3
+#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4
+#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5
+#define GL_PERFMON_RESULT_AMD 0x8BC6
+#endif
+
+/* GL_AMD_program_binary_Z400 */
+#ifndef GL_AMD_program_binary_Z400
+#define GL_Z400_BINARY_AMD 0x8740
+#endif
+
+/*------------------------------------------------------------------------*
+ * EXT extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_EXT_blend_minmax */
+#ifndef GL_EXT_blend_minmax
+#define GL_MIN_EXT 0x8007
+#define GL_MAX_EXT 0x8008
+#endif
+
+/* GL_EXT_discard_framebuffer */
+#ifndef GL_EXT_discard_framebuffer
+#define GL_COLOR_EXT 0x1800
+#define GL_DEPTH_EXT 0x1801
+#define GL_STENCIL_EXT 0x1802
+#endif
+
+/* GL_EXT_multi_draw_arrays */
+/* No new tokens introduced by this extension. */
+
+/* GL_EXT_read_format_bgra */
+#ifndef GL_EXT_read_format_bgra
+#define GL_BGRA_EXT 0x80E1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
+#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
+#endif
+
+/* GL_EXT_texture_filter_anisotropic */
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
+#endif
+
+/* GL_EXT_texture_format_BGRA8888 */
+#ifndef GL_EXT_texture_format_BGRA8888
+#define GL_BGRA_EXT 0x80E1
+#endif
+
+/* GL_EXT_texture_type_2_10_10_10_REV */
+#ifndef GL_EXT_texture_type_2_10_10_10_REV
+#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
+#endif
+
+/* GL_EXT_texture_compression_dxt1 */
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
+#endif
+
+/*------------------------------------------------------------------------*
+ * IMG extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_IMG_program_binary */
+#ifndef GL_IMG_program_binary
+#define GL_SGX_PROGRAM_BINARY_IMG 0x9130
+#endif
+
+/* GL_IMG_read_format */
+#ifndef GL_IMG_read_format
+#define GL_BGRA_IMG 0x80E1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
+#endif
+
+/* GL_IMG_shader_binary */
+#ifndef GL_IMG_shader_binary
+#define GL_SGX_BINARY_IMG 0x8C0A
+#endif
+
+/* GL_IMG_texture_compression_pvrtc */
+#ifndef GL_IMG_texture_compression_pvrtc
+#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
+#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
+#endif
+
+/* GL_IMG_multisampled_render_to_texture */
+#ifndef GL_IMG_multisampled_render_to_texture
+#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
+#define GL_MAX_SAMPLES_IMG 0x9135
+#define GL_TEXTURE_SAMPLES_IMG 0x9136
+#endif
+
+/*------------------------------------------------------------------------*
+ * NV extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_NV_fence */
+#ifndef GL_NV_fence
+#define GL_ALL_COMPLETED_NV 0x84F2
+#define GL_FENCE_STATUS_NV 0x84F3
+#define GL_FENCE_CONDITION_NV 0x84F4
+#endif
+
+/* GL_NV_coverage_sample */
+#ifndef GL_NV_coverage_sample
+#define GL_COVERAGE_COMPONENT_NV 0x8ED0
+#define GL_COVERAGE_COMPONENT4_NV 0x8ED1
+#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2
+#define GL_COVERAGE_BUFFERS_NV 0x8ED3
+#define GL_COVERAGE_SAMPLES_NV 0x8ED4
+#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5
+#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6
+#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7
+#define GL_COVERAGE_BUFFER_BIT_NV 0x8000
+#endif
+
+/* GL_NV_depth_nonlinear */
+#ifndef GL_NV_depth_nonlinear
+#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C
+#endif
+
+/*------------------------------------------------------------------------*
+ * QCOM extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_QCOM_driver_control */
+/* No new tokens introduced by this extension. */
+
+/* GL_QCOM_extended_get */
+#ifndef GL_QCOM_extended_get
+#define GL_TEXTURE_WIDTH_QCOM 0x8BD2
+#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3
+#define GL_TEXTURE_DEPTH_QCOM 0x8BD4
+#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5
+#define GL_TEXTURE_FORMAT_QCOM 0x8BD6
+#define GL_TEXTURE_TYPE_QCOM 0x8BD7
+#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8
+#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9
+#define GL_TEXTURE_TARGET_QCOM 0x8BDA
+#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB
+#define GL_STATE_RESTORE 0x8BDC
+#endif
+
+/* GL_QCOM_extended_get2 */
+/* No new tokens introduced by this extension. */
+
+/* GL_QCOM_perfmon_global_mode */
+#ifndef GL_QCOM_perfmon_global_mode
+#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
+#endif
+
+/* GL_QCOM_writeonly_rendering */
+#ifndef GL_QCOM_writeonly_rendering
+#define GL_WRITEONLY_RENDERING_QCOM 0x8823
+#endif
+
+/* GL_QCOM_tiled_rendering */
+#ifndef GL_QCOM_tiled_rendering
+#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001
+#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002
+#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004
+#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008
+#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010
+#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020
+#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040
+#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080
+#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100
+#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200
+#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400
+#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800
+#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000
+#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000
+#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000
+#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000
+#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000
+#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000
+#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000
+#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000
+#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000
+#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000
+#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000
+#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000
+#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000
+#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000
+#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000
+#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000
+#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000
+#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000
+#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000
+#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000
+#endif
+
+/*------------------------------------------------------------------------*
+ * End of extension tokens, start of corresponding extension functions
+ *------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------*
+ * OES extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_OES_compressed_ETC1_RGB8_texture */
+#ifndef GL_OES_compressed_ETC1_RGB8_texture
+#define GL_OES_compressed_ETC1_RGB8_texture 1
+#endif
+
+/* GL_OES_compressed_paletted_texture */
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_OES_compressed_paletted_texture 1
+#endif
+
+/* GL_OES_depth24 */
+#ifndef GL_OES_depth24
+#define GL_OES_depth24 1
+#endif
+
+/* GL_OES_depth32 */
+#ifndef GL_OES_depth32
+#define GL_OES_depth32 1
+#endif
+
+/* GL_OES_depth_texture */
+#ifndef GL_OES_depth_texture
+#define GL_OES_depth_texture 1
+#endif
+
+/* GL_OES_EGL_image */
+#ifndef GL_OES_EGL_image
+#define GL_OES_EGL_image 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
+GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
+#endif
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
+#endif
+
+/* GL_OES_element_index_uint */
+#ifndef GL_OES_element_index_uint
+#define GL_OES_element_index_uint 1
+#endif
+
+/* GL_OES_fbo_render_mipmap */
+#ifndef GL_OES_fbo_render_mipmap
+#define GL_OES_fbo_render_mipmap 1
+#endif
+
+/* GL_OES_fragment_precision_high */
+#ifndef GL_OES_fragment_precision_high
+#define GL_OES_fragment_precision_high 1
+#endif
+
+/* GL_OES_get_program_binary */
+#ifndef GL_OES_get_program_binary
+#define GL_OES_get_program_binary 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
+GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
+#endif
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
+typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
+#endif
+
+/* GL_OES_mapbuffer */
+#ifndef GL_OES_mapbuffer
+#define GL_OES_mapbuffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
+GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
+GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid** params);
+#endif
+typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
+typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid** params);
+#endif
+
+/* GL_OES_packed_depth_stencil */
+#ifndef GL_OES_packed_depth_stencil
+#define GL_OES_packed_depth_stencil 1
+#endif
+
+/* GL_OES_rgb8_rgba8 */
+#ifndef GL_OES_rgb8_rgba8
+#define GL_OES_rgb8_rgba8 1
+#endif
+
+/* GL_OES_standard_derivatives */
+#ifndef GL_OES_standard_derivatives
+#define GL_OES_standard_derivatives 1
+#endif
+
+/* GL_OES_stencil1 */
+#ifndef GL_OES_stencil1
+#define GL_OES_stencil1 1
+#endif
+
+/* GL_OES_stencil4 */
+#ifndef GL_OES_stencil4
+#define GL_OES_stencil4 1
+#endif
+
+/* GL_OES_texture_3D */
+#ifndef GL_OES_texture_3D
+#define GL_OES_texture_3D 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+#endif
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+#endif
+
+/* GL_OES_texture_float */
+#ifndef GL_OES_texture_float
+#define GL_OES_texture_float 1
+#endif
+
+/* GL_OES_texture_float_linear */
+#ifndef GL_OES_texture_float_linear
+#define GL_OES_texture_float_linear 1
+#endif
+
+/* GL_OES_texture_half_float */
+#ifndef GL_OES_texture_half_float
+#define GL_OES_texture_half_float 1
+#endif
+
+/* GL_OES_texture_half_float_linear */
+#ifndef GL_OES_texture_half_float_linear
+#define GL_OES_texture_half_float_linear 1
+#endif
+
+/* GL_OES_texture_npot */
+#ifndef GL_OES_texture_npot
+#define GL_OES_texture_npot 1
+#endif
+
+/* GL_OES_vertex_array_object */
+#ifndef GL_OES_vertex_array_object
+#define GL_OES_vertex_array_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array);
+GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
+GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
+GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
+#endif
+typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array);
+typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
+typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
+typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array);
+#endif
+
+/* GL_OES_vertex_half_float */
+#ifndef GL_OES_vertex_half_float
+#define GL_OES_vertex_half_float 1
+#endif
+
+/* GL_OES_vertex_type_10_10_10_2 */
+#ifndef GL_OES_vertex_type_10_10_10_2
+#define GL_OES_vertex_type_10_10_10_2 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * AMD extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_AMD_compressed_3DC_texture */
+#ifndef GL_AMD_compressed_3DC_texture
+#define GL_AMD_compressed_3DC_texture 1
+#endif
+
+/* GL_AMD_compressed_ATC_texture */
+#ifndef GL_AMD_compressed_ATC_texture
+#define GL_AMD_compressed_ATC_texture 1
+#endif
+
+/* AMD_performance_monitor */
+#ifndef GL_AMD_performance_monitor
+#define GL_AMD_performance_monitor 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
+GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList);
+GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
+GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#endif
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
+typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList);
+typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#endif
+
+/* GL_AMD_program_binary_Z400 */
+#ifndef GL_AMD_program_binary_Z400
+#define GL_AMD_program_binary_Z400 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * EXT extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_EXT_blend_minmax */
+#ifndef GL_EXT_blend_minmax
+#define GL_EXT_blend_minmax 1
+#endif
+
+/* GL_EXT_discard_framebuffer */
+#ifndef GL_EXT_discard_framebuffer
+#define GL_EXT_discard_framebuffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+#endif
+typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+#endif
+
+#ifndef GL_EXT_multi_draw_arrays
+#define GL_EXT_multi_draw_arrays 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei);
+GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
+#endif
+
+/* GL_EXT_read_format_bgra */
+#ifndef GL_EXT_read_format_bgra
+#define GL_EXT_read_format_bgra 1
+#endif
+
+/* GL_EXT_texture_filter_anisotropic */
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_EXT_texture_filter_anisotropic 1
+#endif
+
+/* GL_EXT_texture_format_BGRA8888 */
+#ifndef GL_EXT_texture_format_BGRA8888
+#define GL_EXT_texture_format_BGRA8888 1
+#endif
+
+/* GL_EXT_texture_type_2_10_10_10_REV */
+#ifndef GL_EXT_texture_type_2_10_10_10_REV
+#define GL_EXT_texture_type_2_10_10_10_REV 1
+#endif
+
+/* GL_EXT_texture_compression_dxt1 */
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_EXT_texture_compression_dxt1 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * IMG extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_IMG_program_binary */
+#ifndef GL_IMG_program_binary
+#define GL_IMG_program_binary 1
+#endif
+
+/* GL_IMG_read_format */
+#ifndef GL_IMG_read_format
+#define GL_IMG_read_format 1
+#endif
+
+/* GL_IMG_shader_binary */
+#ifndef GL_IMG_shader_binary
+#define GL_IMG_shader_binary 1
+#endif
+
+/* GL_IMG_texture_compression_pvrtc */
+#ifndef GL_IMG_texture_compression_pvrtc
+#define GL_IMG_texture_compression_pvrtc 1
+#endif
+
+/* GL_IMG_multisampled_render_to_texture */
+#ifndef GL_IMG_multisampled_render_to_texture
+#define GL_IMG_multisampled_render_to_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
+#endif
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLCLIPPLANEXIMG) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#endif
+
+/*------------------------------------------------------------------------*
+ * NV extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_NV_fence */
+#ifndef GL_NV_fence
+#define GL_NV_fence 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei, const GLuint *);
+GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei, GLuint *);
+GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint);
+GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint);
+GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *);
+GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint);
+GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint, GLenum);
+#endif
+typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
+typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
+typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
+typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
+typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
+typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
+#endif
+
+/* GL_NV_coverage_sample */
+#ifndef GL_NV_coverage_sample
+#define GL_NV_coverage_sample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask);
+GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation);
+#endif
+typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask);
+typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation);
+#endif
+
+/* GL_NV_depth_nonlinear */
+#ifndef GL_NV_depth_nonlinear
+#define GL_NV_depth_nonlinear 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * QCOM extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_QCOM_driver_control */
+#ifndef GL_QCOM_driver_control
+#define GL_QCOM_driver_control 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
+GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
+GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
+GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
+#endif
+typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls);
+typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
+typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+#endif
+
+/* GL_QCOM_extended_get */
+#ifndef GL_QCOM_extended_get
+#define GL_QCOM_extended_get 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures);
+GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
+GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
+GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
+GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels);
+GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params);
+#endif
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures);
+typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels);
+typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params);
+#endif
+
+/* GL_QCOM_extended_get2 */
+#ifndef GL_QCOM_extended_get2
+#define GL_QCOM_extended_get2 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
+GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
+GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
+GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
+#endif
+typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders);
+typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
+typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
+#endif
+
+/* GL_QCOM_perfmon_global_mode */
+#ifndef GL_QCOM_perfmon_global_mode
+#define GL_QCOM_perfmon_global_mode 1
+#endif
+
+/* GL_QCOM_writeonly_rendering */
+#ifndef GL_QCOM_writeonly_rendering
+#define GL_QCOM_writeonly_rendering 1
+#endif
+
+/* GL_QCOM_tiled_rendering */
+#ifndef GL_QCOM_tiled_rendering
+#define GL_QCOM_tiled_rendering 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
+#endif
+typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gl2ext_h_ */
diff --git a/src/native/common/GLES2/gl2extimg.h b/src/native/common/GLES2/gl2extimg.h
new file mode 100644
index 00000000..d9c76dab
--- /dev/null
+++ b/src/native/common/GLES2/gl2extimg.h
@@ -0,0 +1,51 @@
+#ifndef __gl2extimg_h_
+#define __gl2extimg_h_
+
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*------------------------------------------------------------------------*
+ * IMG extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_IMG_binary_shader */
+#ifndef GL_IMG_binary_shader
+#define GL_SGX_BINARY_IMG 0x8C0A
+#endif
+
+/* GL_IMG_texture_compression_pvrtc */
+#ifndef GL_IMG_texture_compression_pvrtc
+#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
+#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
+#endif
+
+
+/* GL_IMG_texture_format_BGRA8888 */
+#define GL_BGRA 0x80E1
+
+
+/*------------------------------------------------------------------------*
+ * IMG extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_IMG_binary_shader */
+#ifndef GL_IMG_binary_shader
+#define GL_IMG_binary_shader 1
+#endif
+
+/* GL_IMG_texture_compression_pvrtc */
+#ifndef GL_IMG_texture_compression_pvrtc
+#define GL_IMG_texture_compression_pvrtc 1
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gl2extimg_h_ */
diff --git a/src/native/common/GLES2/gl2platform.h b/src/native/common/GLES2/gl2platform.h
new file mode 100644
index 00000000..c9fa3c4d
--- /dev/null
+++ b/src/native/common/GLES2/gl2platform.h
@@ -0,0 +1,30 @@
+#ifndef __gl2platform_h_
+#define __gl2platform_h_
+
+/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
+ *
+ * Adopters may modify khrplatform.h and this file to suit their platform.
+ * You are encouraged to submit all modifications to the Khronos group so that
+ * they can be included in future versions of this file. Please submit changes
+ * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+ * by filing a bug against product "OpenGL-ES" component "Registry".
+ */
+
+#include
+
+#ifndef GL_APICALL
+#define GL_APICALL KHRONOS_APICALL
+#endif
+
+#ifndef GL_APIENTRY
+#define GL_APIENTRY KHRONOS_APIENTRY
+#endif
+
+#endif /* __gl2platform_h_ */
diff --git a/src/native/common/KHR/khrplatform.h b/src/native/common/KHR/khrplatform.h
new file mode 100644
index 00000000..8ec0d199
--- /dev/null
+++ b/src/native/common/KHR/khrplatform.h
@@ -0,0 +1,269 @@
+#ifndef __khrplatform_h_
+#define __khrplatform_h_
+
+/*
+** 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.
+*/
+
+/* Khronos platform-specific types and definitions.
+ *
+ * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
+ *
+ * Adopters may modify this file to suit their platform. Adopters are
+ * encouraged to submit platform specific modifications to the Khronos
+ * group so that they can be included in future versions of this file.
+ * Please submit changes by sending them to the public Khronos Bugzilla
+ * (http://khronos.org/bugzilla) by filing a bug against product
+ * "Khronos (general)" component "Registry".
+ *
+ * A predefined template which fills in some of the bug fields can be
+ * reached using http://tinyurl.com/khrplatform-h-bugreport, but you
+ * must create a Bugzilla login first.
+ *
+ *
+ * See the Implementer's Guidelines for information about where this file
+ * should be located on your system and for more details of its use:
+ * http://www.khronos.org/registry/implementers_guide.pdf
+ *
+ * This file should be included as
+ * #include
+ * by Khronos client API header files that use its types and defines.
+ *
+ * The types in khrplatform.h should only be used to define API-specific types.
+ *
+ * Types defined in khrplatform.h:
+ * khronos_int8_t signed 8 bit
+ * khronos_uint8_t unsigned 8 bit
+ * khronos_int16_t signed 16 bit
+ * khronos_uint16_t unsigned 16 bit
+ * khronos_int32_t signed 32 bit
+ * khronos_uint32_t unsigned 32 bit
+ * khronos_int64_t signed 64 bit
+ * khronos_uint64_t unsigned 64 bit
+ * khronos_intptr_t signed same number of bits as a pointer
+ * khronos_uintptr_t unsigned same number of bits as a pointer
+ * khronos_ssize_t signed size
+ * khronos_usize_t unsigned size
+ * khronos_float_t signed 32 bit floating point
+ * khronos_time_ns_t unsigned 64 bit time in nanoseconds
+ * khronos_utime_nanoseconds_t unsigned time interval or absolute time in
+ * nanoseconds
+ * khronos_stime_nanoseconds_t signed time interval in nanoseconds
+ * khronos_boolean_enum_t enumerated boolean type. This should
+ * only be used as a base type when a client API's boolean type is
+ * an enum. Client APIs which use an integer or other type for
+ * booleans cannot use this as the base type for their boolean.
+ *
+ * Tokens defined in khrplatform.h:
+ *
+ * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
+ *
+ * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
+ * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
+ *
+ * Calling convention macros defined in this file:
+ * KHRONOS_APICALL
+ * KHRONOS_APIENTRY
+ * KHRONOS_APIATTRIBUTES
+ *
+ * These may be used in function prototypes as:
+ *
+ * KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
+ * int arg1,
+ * int arg2) KHRONOS_APIATTRIBUTES;
+ */
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APICALL
+ *-------------------------------------------------------------------------
+ * This precedes the return type of the function in the function prototype.
+ */
+#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
+# define KHRONOS_APICALL __declspec(dllimport)
+#elif defined (__SYMBIAN32__)
+# define KHRONOS_APICALL IMPORT_C
+#else
+# define KHRONOS_APICALL
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APIENTRY
+ *-------------------------------------------------------------------------
+ * This follows the return type of the function and precedes the function
+ * name in the function prototype.
+ */
+#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
+ /* Win32 but not WinCE */
+# define KHRONOS_APIENTRY __stdcall
+#else
+# define KHRONOS_APIENTRY
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APIATTRIBUTES
+ *-------------------------------------------------------------------------
+ * This follows the closing parenthesis of the function prototype arguments.
+ */
+#if defined (__ARMCC_2__)
+#define KHRONOS_APIATTRIBUTES __softfp
+#else
+#define KHRONOS_APIATTRIBUTES
+#endif
+
+/*-------------------------------------------------------------------------
+ * basic type definitions
+ *-----------------------------------------------------------------------*/
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
+
+
+/*
+ * Using
+ */
+#include
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(__VMS ) || defined(__sgi)
+
+/*
+ * Using
+ */
+#include
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
+
+/*
+ * Win32
+ */
+typedef __int32 khronos_int32_t;
+typedef unsigned __int32 khronos_uint32_t;
+typedef __int64 khronos_int64_t;
+typedef unsigned __int64 khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(__sun__) || defined(__digital__)
+
+/*
+ * Sun or Digital
+ */
+typedef int khronos_int32_t;
+typedef unsigned int khronos_uint32_t;
+#if defined(__arch64__) || defined(_LP64)
+typedef long int khronos_int64_t;
+typedef unsigned long int khronos_uint64_t;
+#else
+typedef long long int khronos_int64_t;
+typedef unsigned long long int khronos_uint64_t;
+#endif /* __arch64__ */
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif 0
+
+/*
+ * Hypothetical platform with no float or int64 support
+ */
+typedef int khronos_int32_t;
+typedef unsigned int khronos_uint32_t;
+#define KHRONOS_SUPPORT_INT64 0
+#define KHRONOS_SUPPORT_FLOAT 0
+
+#else
+
+/*
+ * Generic fallback
+ */
+#include
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#endif
+
+
+/*
+ * Types that are (so far) the same on all platforms
+ */
+typedef signed char khronos_int8_t;
+typedef unsigned char khronos_uint8_t;
+typedef signed short int khronos_int16_t;
+typedef unsigned short int khronos_uint16_t;
+typedef signed long int khronos_intptr_t;
+typedef unsigned long int khronos_uintptr_t;
+typedef signed long int khronos_ssize_t;
+typedef unsigned long int khronos_usize_t;
+
+#if KHRONOS_SUPPORT_FLOAT
+/*
+ * Float type
+ */
+typedef float khronos_float_t;
+#endif
+
+#if KHRONOS_SUPPORT_INT64
+/* Time types
+ *
+ * These types can be used to represent a time interval in nanoseconds or
+ * an absolute Unadjusted System Time. Unadjusted System Time is the number
+ * of nanoseconds since some arbitrary system event (e.g. since the last
+ * time the system booted). The Unadjusted System Time is an unsigned
+ * 64 bit value that wraps back to 0 every 584 years. Time intervals
+ * may be either signed or unsigned.
+ */
+typedef khronos_uint64_t khronos_utime_nanoseconds_t;
+typedef khronos_int64_t khronos_stime_nanoseconds_t;
+#endif
+
+/*
+ * Dummy value used to pad enum types to 32 bits.
+ */
+#ifndef KHRONOS_MAX_ENUM
+#define KHRONOS_MAX_ENUM 0x7FFFFFFF
+#endif
+
+/*
+ * Enumerated boolean type
+ *
+ * Values other than zero should be considered to be true. Therefore
+ * comparisons should not be made against KHRONOS_TRUE.
+ */
+typedef enum {
+ KHRONOS_FALSE = 0,
+ KHRONOS_TRUE = 1,
+ KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
+} khronos_boolean_enum_t;
+
+#endif /* __khrplatform_h_ */
diff --git a/src/native/common/extgl.c b/src/native/common/opengl/extgl.c
similarity index 100%
rename from src/native/common/extgl.c
rename to src/native/common/opengl/extgl.c
diff --git a/src/native/common/extgl.h b/src/native/common/opengl/extgl.h
similarity index 100%
rename from src/native/common/extgl.h
rename to src/native/common/opengl/extgl.h
diff --git a/src/native/common/extgl_types.h b/src/native/common/opengl/extgl_types.h
similarity index 100%
rename from src/native/common/extgl_types.h
rename to src/native/common/opengl/extgl_types.h
diff --git a/src/native/common/org_lwjgl_opengl_CallbackUtil.c b/src/native/common/opengl/org_lwjgl_opengl_CallbackUtil.c
similarity index 100%
rename from src/native/common/org_lwjgl_opengl_CallbackUtil.c
rename to src/native/common/opengl/org_lwjgl_opengl_CallbackUtil.c
diff --git a/src/native/common/org_lwjgl_opengl_GLContext.c b/src/native/common/opengl/org_lwjgl_opengl_GLContext.c
similarity index 100%
rename from src/native/common/org_lwjgl_opengl_GLContext.c
rename to src/native/common/opengl/org_lwjgl_opengl_GLContext.c
diff --git a/src/native/common/opengles/extgl.c b/src/native/common/opengles/extgl.c
new file mode 100644
index 00000000..3da9bd2e
--- /dev/null
+++ b/src/native/common/opengles/extgl.c
@@ -0,0 +1,83 @@
+/* ----------------------------------------------------------------------------
+Copyright (c) 2001-2002, Lev Povalahev
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * The name of the author may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
+------------------------------------------------------------------------------*/
+/*
+ Lev Povalahev
+
+ levp@gmx.net
+
+ http://www.uni-karlsruhe.de/~uli2/
+
+*/
+
+#include
+#include
+#include "extgl.h"
+#include "common_tools.h"
+
+void extgl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions) {
+ ext_InitializeClass(env, clazz, &extgl_GetProcAddress, num_functions, functions);
+}
+
+bool extgl_InitializeFunctions(int num_functions, ExtFunction *functions) {
+ return ext_InitializeFunctions(&extgl_GetProcAddress, num_functions, functions);
+}
+
+bool extgl_QueryExtension(const char *extensions, const char *name)
+{
+ const char *start;
+ char *where, *terminator;
+
+ if (extensions == NULL) {
+ printfDebug("NULL extension string\n");
+ return false;
+ }
+
+ /* Extension names should not have spaces. */
+ where = (char *) strchr(name, ' ');
+ if (where || *name == '\0')
+ return false;
+
+ /* It takes a bit of care to be fool-proof about parsing the
+ OpenGL extensions string. Don't be fooled by sub-strings,
+ etc. */
+ start = extensions;
+ for (;;)
+ {
+ where = (char *) strstr((const char *) start, name);
+ if (!where)
+ break;
+ terminator = where + strlen(name);
+ if (where == start || *(where - 1) == ' ')
+ if (*terminator == ' ' || *terminator == '\0') {
+ return true;
+ }
+ start = terminator;
+ }
+ return false;
+
+}
+
diff --git a/src/native/common/opengles/extgl.h b/src/native/common/opengles/extgl.h
new file mode 100644
index 00000000..e9a7f880
--- /dev/null
+++ b/src/native/common/opengles/extgl.h
@@ -0,0 +1,89 @@
+/* Small parts were taken from Mesa's glext.h and gl.h, here's the license: */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5.1
+ *
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/* Some parts derived from files copyright (c) 2001-2002 Lev Povalahev under this license: */
+
+/* ----------------------------------------------------------------------------
+Copyright (c) 2002, Lev Povalahev
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * The name of the author may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
+------------------------------------------------------------------------------*/
+/*
+ GL_draw_range_elements support added by Benjamin Karaban
+
+ Lev Povalahev contact information:
+
+ levp@gmx.net
+
+ http://www.uni-karlsruhe.de/~uli2/
+*/
+
+#ifndef __EXTGL_H__
+#define __EXTGL_H__
+
+#include
+
+#include
+#include
+
+#include "common_tools.h"
+
+#include
+//#include
+#include
+
+#include "extgl_types.h"
+
+/* initializes everything, call this right after the rc is created. the function returns true if successful */
+extern bool extgl_Open(JNIEnv *env);
+extern void extgl_Close(void);
+extern void extgl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions);
+extern bool extgl_InitializeFunctions(int num_functions, ExtFunction *functions);
+extern bool extgl_QueryExtension(const char *extensions, const char *name);
+extern void *extgl_GetProcAddress(const char *name);
+
+#endif /* __EXTGL_H__ */
diff --git a/src/native/common/opengles/extgl_egl.c b/src/native/common/opengles/extgl_egl.c
new file mode 100644
index 00000000..f2c782be
--- /dev/null
+++ b/src/native/common/opengles/extgl_egl.c
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2002-2011 LWJGL Project
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+*
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+*
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+*
+* * Neither the name of 'LWJGL' nor the names of
+* its contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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 "extgl_egl.h"
+
+static void extgl_InitEGLKHRLockSurface(EGLExtensions *extensions) {
+ ExtFunction functions[] = {
+ { "eglLockSurfaceKHR", (void *)&extensions->eglLockSurfaceKHR },
+ { "eglUnlockSurfaceKHR", (void *)&extensions->eglUnlockSurfaceKHR }
+ };
+ if ( extensions->EGLKHRLockSurface )
+ extensions->EGLKHRLockSurface = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions);
+}
+
+static void extgl_InitEGLKHRImageBase(EGLExtensions *extensions) {
+ ExtFunction functions[] = {
+ { "eglCreateImageKHR", (void *)&extensions->eglCreateImageKHR },
+ { "eglDestroyImageKHR", (void *)&extensions->eglDestroyImageKHR }
+ };
+ if ( extensions->EGLKHRImageBase )
+ extensions->EGLKHRImageBase = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions);
+}
+
+static void extgl_InitEGLKHRFenceSync(EGLExtensions *extensions) {
+ ExtFunction functions[] = {
+ { "eglCreateSyncKHR", (void *)&extensions->eglCreateSyncKHR },
+ { "eglDestroySyncKHR", (void *)&extensions->eglDestroySyncKHR },
+ { "eglClientWaitSyncKHR", (void *)&extensions->eglClientWaitSyncKHR },
+ { "eglSignalSyncKHR", (void *)&extensions->eglSignalSyncKHR },
+ { "eglGetSyncAttribKHR", (void *)&extensions->eglGetSyncAttribKHR }
+ };
+ if (extensions->EGLKHRFenceSync)
+ extensions->EGLKHRFenceSync = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions);
+}
+
+static void extgl_InitEGLNVSync(EGLExtensions *extensions) {
+ ExtFunction functions[] = {
+ { "eglCreateFenceSyncNV", (void *)&extensions->eglCreateFenceSyncNV },
+ { "eglDestroySyncNV", (void *)&extensions->eglDestroySyncNV },
+ { "eglFenceNV", (void *)&extensions->eglFenceNV },
+ { "eglClientWaitSyncNV", (void *)&extensions->eglClientWaitSyncNV },
+ { "eglSignalSyncNV", (void *)&extensions->eglSignalSyncNV },
+ { "eglGetSyncAttribNV", (void *)&extensions->eglGetSyncAttribNV }
+
+ };
+ if (extensions->EGLNVSync)
+ extensions->EGLNVSync = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions);
+}
+
+static void extgl_InitSupportedEGLExtensions(EGLDisplay dpy, EGLExtensions *extensions) {
+ const char *extension_string = eglQueryString(dpy, EGL_EXTENSIONS);
+
+ extensions->EGLKHRConfigAttribs = extgl_QueryExtension(extension_string, "EGL_KHR_config_attribs");
+ extensions->EGLKHRLockSurface = extgl_QueryExtension(extension_string, "EGL_KHR_lock_surface");
+ extensions->EGLKHRImage = extgl_QueryExtension(extension_string, "EGL_KHR_image");
+ extensions->EGLKHRVGParentImage = extgl_QueryExtension(extension_string, "EGL_KHR_vg_parent_image");
+ extensions->EGLKHRGLTexture2DImage = extgl_QueryExtension(extension_string, "EGL_KHR_gl_texture_2D_image");
+ extensions->EGLKHRGLTextureCubemapImage = extgl_QueryExtension(extension_string, "EGL_KHR_gl_texture_cubemap_image");
+ extensions->EGLKHRGLTexture3DImage = extgl_QueryExtension(extension_string, "EGL_KHR_gl_texture_3D_image");
+ extensions->EGLKHRGLRenderbufferImage = extgl_QueryExtension(extension_string, "EGL_KHR_gl_renderbuffer_image");
+ extensions->EGLKHRReusableSync = extgl_QueryExtension(extension_string, "EGL_KHR_reusable_sync");
+ extensions->EGLKHRImageBase = extgl_QueryExtension(extension_string, "EGL_KHR_image_base");
+ extensions->EGLKHRImagePixmap = extgl_QueryExtension(extension_string, "EGL_KHR_image_pixmap");
+ extensions->EGLIMGContextPriority = extgl_QueryExtension(extension_string, "EGL_IMG_context_priority");
+ extensions->EGLNVCoverageSample = extgl_QueryExtension(extension_string, "EGL_NV_coverage_sample");
+ extensions->EGLNVDepthNonlinear = extgl_QueryExtension(extension_string, "EGL_NV_depth_nonlinear");
+ extensions->EGLNVSync = extgl_QueryExtension(extension_string, "EGL_NV_sync");
+ extensions->EGLKHRFenceSync = extgl_QueryExtension(extension_string, "EGL_KHR_fence_sync");
+}
+
+void extgl_InitEGL(EGLDisplay dpy, EGLExtensions *extensions) {
+ extgl_InitSupportedEGLExtensions(dpy, extensions);
+
+ extgl_InitEGLKHRLockSurface(extensions);
+ extgl_InitEGLKHRImageBase(extensions);
+ extgl_InitEGLKHRFenceSync(extensions);
+ extgl_InitEGLNVSync(extensions);
+}
\ No newline at end of file
diff --git a/src/native/common/opengles/extgl_egl.h b/src/native/common/opengles/extgl_egl.h
new file mode 100644
index 00000000..e8711d49
--- /dev/null
+++ b/src/native/common/opengles/extgl_egl.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _EXTGL_EGL_H
+#define _EXTGL_EGL_H
+
+#include "extgl.h"
+#include "common_tools.h"
+
+#include
+
+typedef struct {
+ bool EGLKHRConfigAttribs;
+ bool EGLKHRLockSurface;
+ bool EGLKHRImage;
+ bool EGLKHRVGParentImage;
+ bool EGLKHRGLTexture2DImage;
+ bool EGLKHRGLTextureCubemapImage;
+ bool EGLKHRGLTexture3DImage;
+ bool EGLKHRGLRenderbufferImage;
+ bool EGLKHRFenceSync;
+ bool EGLKHRReusableSync;
+ bool EGLKHRImageBase;
+ bool EGLKHRImagePixmap;
+ bool EGLIMGContextPriority;
+ bool EGLNVCoverageSample;
+ bool EGLNVDepthNonlinear;
+ bool EGLNVSync;
+
+ PFNEGLLOCKSURFACEKHRPROC eglLockSurfaceKHR;
+ PFNEGLUNLOCKSURFACEKHRPROC eglUnlockSurfaceKHR;
+
+ PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
+ PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
+
+ PFNEGLCREATESYNCKHRPROC eglCreateSyncKHR;
+ PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR;
+ PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR;
+ PFNEGLSIGNALSYNCKHRPROC eglSignalSyncKHR;
+ PFNEGLGETSYNCATTRIBKHRPROC eglGetSyncAttribKHR;
+
+ PFNEGLCREATEFENCESYNCNVPROC eglCreateFenceSyncNV;
+ PFNEGLDESTROYSYNCNVPROC eglDestroySyncNV;
+ PFNEGLFENCENVPROC eglFenceNV;
+ PFNEGLCLIENTWAITSYNCNVPROC eglClientWaitSyncNV;
+ PFNEGLSIGNALSYNCNVPROC eglSignalSyncNV;
+ PFNEGLGETSYNCATTRIBNVPROC eglGetSyncAttribNV;
+} EGLExtensions;
+
+extern void extgl_InitEGL(EGLDisplay dpy, EGLExtensions *extensions);
+
+#endif
diff --git a/src/native/common/opengles/extgl_types.h b/src/native/common/opengles/extgl_types.h
new file mode 100644
index 00000000..ec99795a
--- /dev/null
+++ b/src/native/common/opengles/extgl_types.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _EXTGL_TYPES_H
+#define _EXTGL_TYPES_H
+
+#include
+
+/*-------------------------------------------------------------------------
+ * Data type definitions
+ *-----------------------------------------------------------------------*/
+
+typedef void GLvoid;
+typedef char GLchar;
+typedef unsigned int GLenum;
+typedef unsigned char GLboolean;
+typedef unsigned int GLbitfield;
+typedef khronos_int8_t GLbyte;
+typedef short GLshort;
+typedef int GLint;
+typedef int GLsizei;
+typedef khronos_uint8_t GLubyte;
+typedef unsigned short GLushort;
+typedef unsigned int GLuint;
+typedef khronos_float_t GLfloat;
+typedef khronos_float_t GLclampf;
+typedef khronos_int32_t GLfixed;
+
+/* GL types for handling large vertex buffer objects */
+typedef khronos_intptr_t GLintptr;
+typedef khronos_ssize_t GLsizeiptr;
+
+typedef khronos_int64_t EGLint64NV;
+typedef khronos_uint64_t EGLuint64NV;
+
+// EGL_image_OES
+typedef void* GLeglImageOES;
+
+// We need this to compile OpenCL
+typedef struct __GLsync * GLsync;
+
+#endif
\ No newline at end of file
diff --git a/src/native/common/opengles/org_lwjgl_opengles_EGL.c b/src/native/common/opengles/org_lwjgl_opengles_EGL.c
new file mode 100644
index 00000000..151894c2
--- /dev/null
+++ b/src/native/common/opengles/org_lwjgl_opengles_EGL.c
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include "common_tools.h"
+#include "org_lwjgl_opengles_EGL.h"
+#include "extgl_egl.h"
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengles_EGL_eglGetError(JNIEnv *env, jclass clazz) {
+ return eglGetError();
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglGetDisplay(JNIEnv *env, jclass clazz, jlong display_id) {
+ return (intptr_t)eglGetDisplay((EGLNativeDisplayType)(intptr_t)display_id);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglInitialize(JNIEnv *env, jclass clazz, jlong dpy_ptr, jobject version, jint version_position) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ EGLint *version_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, version)) + version_position;
+
+ return eglInitialize(dpy, version_address, version_address + 1);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglTerminate(JNIEnv *env, jclass clazz, jlong dpy_ptr) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+
+ return eglTerminate(dpy);
+}
+
+JNIEXPORT jstring JNICALL Java_org_lwjgl_opengles_EGL_neglQueryString(JNIEnv *env, jclass clazz, jlong dpy_ptr, jint name) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ const char * __result = eglQueryString(dpy, name);
+ if ( __result == NULL )
+ return NULL;
+
+ return NewStringNativeWithLength(env, __result, strlen(__result));
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglGetConfigs(JNIEnv *env, jclass clazz, jlong dpy_ptr, jobject configs, jint configs_position, jint config_size, jobject num_config, jint num_config_position) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ EGLConfig *configs_address = ((EGLConfig *)safeGetBufferAddress(env, configs)) + configs_position;
+ EGLint *num_config_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, num_config)) + num_config_position;
+
+ return eglGetConfigs(dpy, configs_address, config_size, num_config_address);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglChooseConfig(JNIEnv *env, jclass clazz, jlong dpy_ptr, jobject attrib_list, jint attrib_list_position, jobject configs, jint configs_position, jint config_size, jobject num_config, jint num_config_position) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ const EGLint *attrib_list_address = ((EGLint *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
+ EGLConfig *configs_address = ((EGLConfig *)safeGetBufferAddress(env, configs)) + configs_position;
+ EGLint *num_config_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, num_config)) + num_config_position;
+
+ return eglChooseConfig(dpy, attrib_list_address, configs_address, config_size, num_config_address);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglGetConfigAttrib(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong config_ptr, jint attribute, jobject value, jint value_position) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ EGLConfig config = (EGLConfig)(intptr_t)config_ptr;
+ EGLint *value_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, value)) + value_position;
+
+ return eglGetConfigAttrib(dpy, config, attribute, value_address);
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglCreateWindowSurface(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong config_ptr, jlong win, jobject attrib_list, jint attrib_list_position) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ EGLConfig config = (EGLConfig)(intptr_t)config_ptr;
+ const EGLint *attrib_list_address = ((EGLint *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
+
+ return (intptr_t)eglCreateWindowSurface(dpy, config, (EGLNativeWindowType)(intptr_t)win, attrib_list_address);
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglCreatePbufferSurface(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong config_ptr, jobject attrib_list, jint attrib_list_position) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ EGLConfig config = (EGLConfig)(intptr_t)config_ptr;
+ const EGLint *attrib_list_address = ((EGLint *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
+
+ return (intptr_t)eglCreatePbufferSurface(dpy, config, attrib_list_address);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglDestroySurface(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong surface_ptr) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ EGLSurface surface = (EGLSurface)(intptr_t)surface_ptr;
+
+ return eglDestroySurface(dpy, surface);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglSurfaceAttrib(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong surface_ptr, jint attribute, jint value) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ EGLSurface surface = (EGLSurface)(intptr_t)surface_ptr;
+
+ return eglSurfaceAttrib(dpy, surface, attribute, value);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglQuerySurface(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong surface_ptr, jint attribute, jobject value, jint value_position) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ EGLSurface surface = (EGLSurface)(intptr_t)surface_ptr;
+ EGLint *value_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, value)) + value_position;
+
+ return eglQuerySurface(dpy, surface, attribute, value_address);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_eglBindAPI(JNIEnv *env, jclass clazz, jint api) {
+ return eglBindAPI(api);
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengles_EGL_eglQueryAPI(JNIEnv *env, jclass clazz) {
+ return eglQueryAPI();
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_eglReleaseThread(JNIEnv *env, jclass clazz) {
+ return eglReleaseThread();
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglSwapInterval(JNIEnv *env, jclass clazz, jlong dpy_ptr, jint interval) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ return eglSwapInterval(dpy, interval);
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglCreateContext(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong config_ptr, jlong share_context_ptr, jobject attrib_list, jint attrib_list_position) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ EGLConfig config = (EGLConfig)(intptr_t)config_ptr;
+ EGLContext share_context = (EGLContext)(intptr_t)share_context_ptr;
+ const EGLint *attrib_list_address = ((EGLint *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
+
+ return (intptr_t)eglCreateContext(dpy, config, share_context, attrib_list_address);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglDestroyContext(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong ctx_ptr) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ EGLContext ctx = (EGLContext)(intptr_t)ctx_ptr;
+
+ return eglDestroyContext(dpy, ctx);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglMakeCurrent(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong draw_ptr, jlong read_ptr, jlong ctx_ptr) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ EGLSurface draw = (EGLSurface)(intptr_t)draw_ptr;
+ EGLSurface read = (EGLSurface)(intptr_t)read_ptr;
+ EGLContext ctx = (EGLContext)(intptr_t)ctx_ptr;
+
+ return eglMakeCurrent(dpy, draw, read, ctx);
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglGetCurrentContext(JNIEnv *env, jclass clazz) {
+ return (intptr_t)eglGetCurrentContext();
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglGetCurrentSurface(JNIEnv *env, jclass clazz, jint readdraw) {
+ return (intptr_t)eglGetCurrentSurface(readdraw);
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglGetCurrentDisplay(JNIEnv *env, jclass clazz) {
+ return (intptr_t)eglGetCurrentDisplay();
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglQueryContext(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong ctx_ptr, jint attribute, jobject value, jint value_position) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ EGLContext ctx = (EGLContext)(intptr_t)ctx_ptr;
+ EGLint *value_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, value)) + value_position;
+
+ return eglQueryContext(dpy, ctx, attribute, value_address);
+
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_eglWaitClient(JNIEnv *env, jclass clazz) {
+ return eglWaitClient();
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_eglWaitGL(JNIEnv *env, jclass clazz) {
+ return eglWaitGL();
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_eglWaitNative(JNIEnv *env, jclass clazz, jint engine) {
+ return eglWaitNative(engine);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglSwapBuffers(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong surface_ptr) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ EGLSurface surface = (EGLSurface)(intptr_t)surface_ptr;
+
+ return eglSwapBuffers(dpy, surface);
+}
\ No newline at end of file
diff --git a/src/native/common/opengles/org_lwjgl_opengles_EGLKHRFenceSync.c b/src/native/common/opengles/org_lwjgl_opengles_EGLKHRFenceSync.c
new file mode 100644
index 00000000..bf02c436
--- /dev/null
+++ b/src/native/common/opengles/org_lwjgl_opengles_EGLKHRFenceSync.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include "common_tools.h"
+#include "org_lwjgl_opengles_EGLKHRFenceSync.h"
+#include "extgl_egl.h"
+
+static PFNEGLCREATESYNCKHRPROC eglCreateSyncKHR;
+static PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR;
+static PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR;
+static PFNEGLGETSYNCATTRIBKHRPROC eglGetSyncAttribKHR;
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglCreateSyncKHR(JNIEnv *env, jclass clazz, jlong dpy_ptr, jint type, jobject attrib_list, jint attrib_list_position) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ const EGLint *attrib_list_address = ((EGLint *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
+
+ return (intptr_t)eglCreateSyncKHR(dpy, type, attrib_list_address);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglDestroySyncKHR(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong sync_ptr) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ EGLSyncKHR sync = (EGLSyncKHR)(intptr_t)sync_ptr;
+
+ return eglDestroySyncKHR(dpy, sync);
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglClientWaitSyncKHR(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong sync_ptr, jint flags, jlong timeout) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ EGLSyncKHR sync = (EGLSyncKHR)(intptr_t)sync_ptr;
+
+ return eglClientWaitSyncKHR(dpy, sync, flags, timeout);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglGetSyncAttribKHR(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong sync_ptr, jint attribute, jobject value, jint value_position) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ EGLSyncKHR sync = (EGLSyncKHR)(intptr_t)sync_ptr;
+ EGLint *value_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, value)) + value_position;
+
+ return eglGetSyncAttribKHR(dpy, sync, attribute, value_address);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_initNativeStubs(JNIEnv *env, jclass clazz) {
+ JavaMethodAndExtFunction functions[] = {
+ {"neglCreateSyncKHR", "(JILjava/nio/IntBuffer;I)J", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglCreateSyncKHR, "eglCreateSyncKHR", (void *)&eglCreateSyncKHR},
+ {"neglDestroySyncKHR", "(JJ)Z", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglDestroySyncKHR, "eglDestroySyncKHR", (void *)&eglDestroySyncKHR},
+ {"neglClientWaitSyncKHR", "(JJIJ)I", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglClientWaitSyncKHR, "eglClientWaitSyncKHR", (void *)&eglClientWaitSyncKHR},
+ {"neglGetSyncAttribKHR", "(JJILjava/nio/IntBuffer;I)Z", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglGetSyncAttribKHR, "eglGetSyncAttribKHR", (void *)&eglGetSyncAttribKHR}
+ };
+ int num_functions = NUMFUNCTIONS(functions);
+ extgl_InitializeClass(env, clazz, num_functions, functions);
+}
\ No newline at end of file
diff --git a/src/native/common/opengles/org_lwjgl_opengles_EGLKHRReusableSync.c b/src/native/common/opengles/org_lwjgl_opengles_EGLKHRReusableSync.c
new file mode 100644
index 00000000..d8d6b18e
--- /dev/null
+++ b/src/native/common/opengles/org_lwjgl_opengles_EGLKHRReusableSync.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include "common_tools.h"
+#include "org_lwjgl_opengles_EGLKHRReusableSync.h"
+#include "extgl_egl.h"
+
+static PFNEGLSIGNALSYNCKHRPROC eglSignalSyncKHR;
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLKHRReusableSync_neglSignalSyncKHR(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong sync_ptr, jint mode) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ EGLSyncKHR sync = (EGLSyncKHR)(intptr_t)sync_ptr;
+ return eglSignalSyncKHR(dpy, sync, mode);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengles_EGLKHRReusableSync_initNativeStubs(JNIEnv *env, jclass clazz) {
+ JavaMethodAndExtFunction functions[] = {
+ {"neglSignalSyncKHR", "(JJI)Z", (void *)&Java_org_lwjgl_opengles_EGLKHRReusableSync_neglSignalSyncKHR, "eglSignalSyncKHR", (void *)&eglSignalSyncKHR}
+ };
+ int num_functions = NUMFUNCTIONS(functions);
+ extgl_InitializeClass(env, clazz, num_functions, functions);
+}
diff --git a/src/native/common/opengles/org_lwjgl_opengles_EGLNVSync.c b/src/native/common/opengles/org_lwjgl_opengles_EGLNVSync.c
new file mode 100644
index 00000000..87fb81ee
--- /dev/null
+++ b/src/native/common/opengles/org_lwjgl_opengles_EGLNVSync.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include "common_tools.h"
+#include "org_lwjgl_opengles_EGLNVSync.h"
+#include "extgl_egl.h"
+
+static PFNEGLCREATEFENCESYNCNVPROC eglCreateFenceSyncNV;
+static PFNEGLDESTROYSYNCNVPROC eglDestroySyncNV;
+static PFNEGLFENCENVPROC eglFenceNV;
+static PFNEGLCLIENTWAITSYNCNVPROC eglClientWaitSyncNV;
+static PFNEGLSIGNALSYNCNVPROC eglSignalSyncNV;
+static PFNEGLGETSYNCATTRIBNVPROC eglGetSyncAttribNV;
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglCreateFenceSyncNV(JNIEnv *env, jclass clazz, jlong dpy_ptr, jint condition, jobject attrib_list, jint attrib_list_position) {
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr;
+ const EGLint *attrib_list_address = ((EGLint *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
+
+ return (intptr_t)eglCreateFenceSyncNV(dpy, condition, attrib_list_address);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglDestroySyncNV(JNIEnv *env, jclass clazz, jlong sync_ptr) {
+ EGLSyncNV sync = (EGLSyncNV)(intptr_t)sync_ptr;
+
+ return eglDestroySyncNV(sync);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglFenceNV(JNIEnv *env, jclass clazz, jlong sync_ptr) {
+ EGLSyncNV sync = (EGLSyncNV)(intptr_t)sync_ptr;
+
+ return eglFenceNV(sync);
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglClientWaitSyncNV(JNIEnv *env, jclass clazz, jlong sync_ptr, jint flags, jlong timeout) {
+ EGLSyncNV sync = (EGLSyncNV)(intptr_t)sync_ptr;
+
+ return eglClientWaitSyncNV(sync, flags, timeout);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglSignalSyncNV(JNIEnv *env, jclass clazz, jlong sync_ptr, jint mode) {
+ EGLSyncNV sync = (EGLSyncNV)(intptr_t)sync_ptr;
+
+ return eglSignalSyncNV(sync, mode);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglGetSyncAttribNV(JNIEnv *env, jclass clazz, jlong sync_ptr, jint attribute, jobject value, jint value_position) {
+ EGLSyncNV sync = (EGLSyncNV)(intptr_t)sync_ptr;
+ EGLint *value_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, value)) + value_position;
+
+ return eglGetSyncAttribNV(sync, attribute, value_address);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengles_EGLNVSync_initNativeStubs(JNIEnv *env, jclass clazz) {
+ JavaMethodAndExtFunction functions[] = {
+ {"neglCreateFenceSyncNV", "(JILjava/nio/IntBuffer;I)J", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglCreateFenceSyncNV, "eglCreateFenceSyncNV", (void *)&eglCreateFenceSyncNV},
+ {"neglDestroySyncNV", "(J)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglDestroySyncNV, "eglDestroySyncNV", (void *)&eglDestroySyncNV},
+ {"neglFenceNV", "(J)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglFenceNV, "eglFenceNV", (void *)&eglFenceNV},
+ {"neglClientWaitSyncNV", "(JIJ)I", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglClientWaitSyncNV, "eglClientWaitSyncNV", (void *)&eglClientWaitSyncNV},
+ {"neglSignalSyncNV", "(JI)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglSignalSyncNV, "eglSignalSyncNV", (void *)&eglSignalSyncNV},
+ {"neglGetSyncAttribNV", "(JILjava/nio/IntBuffer;I)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglGetSyncAttribNV, "eglGetSyncAttribNV", (void *)&eglGetSyncAttribNV}
+ };
+ int num_functions = NUMFUNCTIONS(functions);
+ extgl_InitializeClass(env, clazz, num_functions, functions);
+}
diff --git a/src/native/common/opengles/org_lwjgl_opengles_GLContext.c b/src/native/common/opengles/org_lwjgl_opengles_GLContext.c
new file mode 100644
index 00000000..f7273f30
--- /dev/null
+++ b/src/native/common/opengles/org_lwjgl_opengles_GLContext.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include "common_tools.h"
+#include "org_lwjgl_opengles_GLContext.h"
+#include "extgl.h"
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengles_GLContext_nLoadOpenGLLibrary(JNIEnv * env, jclass clazz) {
+ extgl_Open(env);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengles_GLContext_nUnloadOpenGLLibrary(JNIEnv * env, jclass clazz) {
+ extgl_Close();
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengles_GLContext_resetNativeStubs(JNIEnv *env, jclass clazz, jclass gl_class) {
+ //(*env)->UnregisterNatives(env, gl_class);
+}
diff --git a/src/native/linux/context.c b/src/native/linux/opengl/context.c
similarity index 100%
rename from src/native/linux/context.c
rename to src/native/linux/opengl/context.c
diff --git a/src/native/linux/context.h b/src/native/linux/opengl/context.h
similarity index 100%
rename from src/native/linux/context.h
rename to src/native/linux/opengl/context.h
diff --git a/src/native/linux/display.c b/src/native/linux/opengl/display.c
similarity index 100%
rename from src/native/linux/display.c
rename to src/native/linux/opengl/display.c
diff --git a/src/native/linux/extgl_glx.c b/src/native/linux/opengl/extgl_glx.c
similarity index 100%
rename from src/native/linux/extgl_glx.c
rename to src/native/linux/opengl/extgl_glx.c
diff --git a/src/native/linux/extgl_glx.h b/src/native/linux/opengl/extgl_glx.h
similarity index 100%
rename from src/native/linux/extgl_glx.h
rename to src/native/linux/opengl/extgl_glx.h
diff --git a/src/native/linux/org_lwjgl_opengl_Display.c b/src/native/linux/opengl/org_lwjgl_opengl_Display.c
similarity index 100%
rename from src/native/linux/org_lwjgl_opengl_Display.c
rename to src/native/linux/opengl/org_lwjgl_opengl_Display.c
diff --git a/src/native/linux/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c b/src/native/linux/opengl/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c
similarity index 100%
rename from src/native/linux/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c
rename to src/native/linux/opengl/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c
diff --git a/src/native/linux/org_lwjgl_opengl_LinuxCanvasImplementation.c b/src/native/linux/opengl/org_lwjgl_opengl_LinuxCanvasImplementation.c
similarity index 100%
rename from src/native/linux/org_lwjgl_opengl_LinuxCanvasImplementation.c
rename to src/native/linux/opengl/org_lwjgl_opengl_LinuxCanvasImplementation.c
diff --git a/src/native/linux/org_lwjgl_opengl_LinuxContextImplementation.c b/src/native/linux/opengl/org_lwjgl_opengl_LinuxContextImplementation.c
similarity index 100%
rename from src/native/linux/org_lwjgl_opengl_LinuxContextImplementation.c
rename to src/native/linux/opengl/org_lwjgl_opengl_LinuxContextImplementation.c
diff --git a/src/native/linux/org_lwjgl_opengl_Pbuffer.c b/src/native/linux/opengl/org_lwjgl_opengl_Pbuffer.c
similarity index 100%
rename from src/native/linux/org_lwjgl_opengl_Pbuffer.c
rename to src/native/linux/opengl/org_lwjgl_opengl_Pbuffer.c
diff --git a/src/native/linux/opengles/context.c b/src/native/linux/opengles/context.c
new file mode 100644
index 00000000..17d519c3
--- /dev/null
+++ b/src/native/linux/opengles/context.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * $Id: context.c 3116 2008-08-19 16:46:03Z spasi $
+ *
+ * Include file to access public window features
+ *
+ * @author elias_naur
+ * @version $Revision: 3116 $
+ */
+
+#include "context.h"
+
+bool initPeerInfo(JNIEnv *env, jobject peer_info_handle, Display *display, int screen) {
+ /*
+ if ((*env)->GetDirectBufferCapacity(env, peer_info_handle) < sizeof(X11PeerInfo)) {
+ throwException(env, "Handle too small");
+ return false;
+ }
+ */
+ X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle);
+
+ peer_info->display = display;
+ peer_info->screen = screen;
+ return true;
+}
diff --git a/src/native/linux/opengles/context.h b/src/native/linux/opengles/context.h
new file mode 100644
index 00000000..ea5129de
--- /dev/null
+++ b/src/native/linux/opengles/context.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * $Id: context.h 2985 2008-04-07 18:42:36Z matzon $
+ *
+ * Include file to access public window features
+ *
+ * @author elias_naur
+ * @version $Revision: 2985 $
+ */
+
+#ifndef _LWJGL_CONTEXT_H_INCLUDED_
+#define _LWJGL_CONTEXT_H_INCLUDED_
+
+#include
+#include
+#include "extgl.h"
+
+typedef struct {
+ Display *display;
+ int screen;
+ jlong drawable;
+} X11PeerInfo;
+
+extern bool initPeerInfo(JNIEnv *env, jobject peer_info_handle, Display *display, int screen);
+
+#endif /* _LWJGL_CONTEXT_H_INCLUDED_ */
diff --git a/src/native/linux/opengles/display.c b/src/native/linux/opengles/display.c
new file mode 100644
index 00000000..89eda41d
--- /dev/null
+++ b/src/native/linux/opengles/display.c
@@ -0,0 +1,409 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * $Id: display.c 2985 2008-04-07 18:42:36Z matzon $
+ *
+ * Linux specific library for display handling.
+ *
+ * @author elias_naur
+ * @version $Revision: 2985 $
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "common_tools.h"
+#include "org_lwjgl_opengl_LinuxDisplay.h"
+
+#define NUM_XRANDR_RETRIES 5
+
+typedef struct {
+ int width;
+ int height;
+ int freq;
+ union {
+ int size_index; // Data for Xrandr extension
+ XF86VidModeModeInfo xf86vm_modeinfo; // Data for XF86VidMode extension
+ } mode_data;
+} mode_info;
+
+static bool getXF86VidModeVersion(JNIEnv *env, Display *disp, int *major, int *minor) {
+ int event_base, error_base;
+
+ if (!XF86VidModeQueryExtension(disp, &event_base, &error_base)) {
+ printfDebugJava(env, "XF86VidMode extension not available");
+ return false;
+ }
+ if (!XF86VidModeQueryVersion(disp, major, minor)) {
+ throwException(env, "Could not query XF86VidMode version");
+ return false;
+ }
+ printfDebugJava(env, "XF86VidMode extension version %i.%i", *major, *minor);
+ return true;
+}
+
+static bool getXrandrVersion(JNIEnv *env, Display *disp, int *major, int *minor) {
+ int event_base, error_base;
+
+ if (!XRRQueryExtension(disp, &event_base, &error_base)) {
+ printfDebugJava(env, "Xrandr extension not available");
+ return false;
+ }
+ if (!XRRQueryVersion(disp, major, minor)) {
+ throwException(env, "Could not query Xrandr version");
+ return false;
+ }
+ printfDebugJava(env, "Xrandr extension version %i.%i", *major, *minor);
+ return true;
+}
+
+static bool isXrandrSupported(JNIEnv *env, Display *disp) {
+ int major, minor;
+ if (!getXrandrVersion(env, disp, &major, &minor))
+ return false;
+ return major >= 1;
+}
+
+static bool isXF86VidModeSupported(JNIEnv *env, Display *disp) {
+ int minor_ver, major_ver;
+ if (!getXF86VidModeVersion(env, disp, &major_ver, &minor_ver))
+ return false;
+ return major_ver >= 2;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXrandrSupported(JNIEnv *env, jclass unused, jlong display) {
+ Display *disp = (Display *)(intptr_t)display;
+ jboolean result = isXrandrSupported(env, disp) ? JNI_TRUE : JNI_FALSE;
+ return result;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXF86VidModeSupported(JNIEnv *env, jclass unused, jlong display) {
+ Display *disp = (Display *)(intptr_t)display;
+ jboolean result = isXF86VidModeSupported(env, disp) ? JNI_TRUE : JNI_FALSE;
+ return result;
+}
+
+static mode_info *getXrandrDisplayModes(Display *disp, int screen, int *num_modes) {
+ int num_randr_sizes;
+ XRRScreenSize *sizes = XRRSizes(disp, screen, &num_randr_sizes);
+ mode_info *avail_modes = NULL;
+ int list_size = 0;
+ /* Count number of modes */
+ int i;
+ int mode_index = 0;
+ for (i = 0; i < num_randr_sizes; i++) {
+ int num_randr_rates;
+ short *freqs = XRRRates(disp, screen, i, &num_randr_rates);
+ int j;
+ for (j = 0; j < num_randr_rates; j++) {
+ if (list_size <= mode_index) {
+ list_size += 1;
+ avail_modes = (mode_info *)realloc(avail_modes, sizeof(mode_info)*list_size);
+ if (avail_modes == NULL)
+ return NULL;
+ }
+ avail_modes[mode_index].width = sizes[i].width;
+ avail_modes[mode_index].height = sizes[i].height;
+ avail_modes[mode_index].freq = freqs[j];
+ avail_modes[mode_index].mode_data.size_index = i;
+ mode_index++;
+ }
+ }
+ *num_modes = mode_index;
+ return avail_modes;
+}
+
+static mode_info *getXF86VidModeDisplayModes(Display *disp, int screen, int *num_modes) {
+ int num_xf86vm_modes;
+ XF86VidModeModeInfo **avail_xf86vm_modes;
+ XF86VidModeGetAllModeLines(disp, screen, &num_xf86vm_modes, &avail_xf86vm_modes);
+ mode_info *avail_modes = (mode_info *)malloc(sizeof(mode_info)*num_xf86vm_modes);
+ if (avail_modes == NULL) {
+ XFree(avail_xf86vm_modes);
+ return NULL;
+ }
+ int i;
+ for (i = 0; i < num_xf86vm_modes; i++) {
+ avail_modes[i].width = avail_xf86vm_modes[i]->hdisplay;
+ avail_modes[i].height = avail_xf86vm_modes[i]->vdisplay;
+ avail_modes[i].freq = 0; // No frequency support in XF86VidMode
+ avail_modes[i].mode_data.xf86vm_modeinfo = *avail_xf86vm_modes[i];
+ }
+ XFree(avail_xf86vm_modes);
+ *num_modes = num_xf86vm_modes;
+ return avail_modes;
+}
+
+static mode_info *getDisplayModes(Display *disp, int screen, jint extension, int *num_modes) {
+ switch (extension) {
+ case org_lwjgl_opengl_LinuxDisplay_XF86VIDMODE:
+ return getXF86VidModeDisplayModes(disp, screen, num_modes);
+ case org_lwjgl_opengl_LinuxDisplay_XRANDR:
+ return getXrandrDisplayModes(disp, screen, num_modes);
+ case org_lwjgl_opengl_LinuxDisplay_NONE:
+ // fall through
+ default:
+ return NULL;
+ }
+}
+
+static bool setXF86VidModeMode(Display *disp, int screen, mode_info *mode) {
+ return True == XF86VidModeSwitchToMode(disp, screen, &mode->mode_data.xf86vm_modeinfo);
+}
+
+/* Try to set the mode specified through XRandR.
+ * Return value is the Status code of the mode switch
+ * The timestamp parameter is filled with the latest timestamp returned from XRRConfigTimes
+ */
+static Status trySetXrandrMode(Display *disp, int screen, mode_info *mode, Time *timestamp) {
+ Status status;
+ Drawable root_window = RootWindow(disp, screen);
+ XRRScreenConfiguration *screen_configuration = XRRGetScreenInfo(disp, root_window);
+ Time config_time;
+ *timestamp = XRRConfigTimes(screen_configuration, &config_time);
+ Rotation current_rotation;
+ XRRConfigCurrentConfiguration(screen_configuration, ¤t_rotation);
+ status = XRRSetScreenConfigAndRate(disp, screen_configuration, root_window, mode->mode_data.size_index, current_rotation, mode->freq, *timestamp);
+ XRRFreeScreenConfigInfo(screen_configuration);
+ return status;
+}
+
+static bool setXrandrMode(Display *disp, int screen, mode_info *mode) {
+ int iteration;
+ Time timestamp;
+ Status status = trySetXrandrMode(disp, screen, mode, ×tamp);
+ if (status == 0)
+ return true; // Success
+ Time new_timestamp;
+ for (iteration = 0; iteration < NUM_XRANDR_RETRIES; iteration++) {
+ status = trySetXrandrMode(disp, screen, mode, &new_timestamp);
+ if (status == 0)
+ return true; // Success
+ if (new_timestamp == timestamp) {
+ return false; // Failure, and the stamps are equal meaning that the failure is not merely transient
+ }
+ timestamp = new_timestamp;
+ }
+ return false;
+}
+
+static bool setMode(JNIEnv *env, Display *disp, int screen, jint extension, int width, int height, int freq) {
+ int num_modes, i;
+ mode_info *avail_modes = getDisplayModes(disp, screen, extension, &num_modes);
+ if (avail_modes == NULL) {
+ printfDebugJava(env, "Could not get display modes");
+ return false;
+ }
+ bool result = false;
+ for (i = 0; i < num_modes; ++i) {
+ printfDebugJava(env, "Mode %d: %dx%d @%d", i, avail_modes[i].width, avail_modes[i].height, avail_modes[i].freq);
+ if (avail_modes[i].width == width && avail_modes[i].height == height && avail_modes[i].freq == freq) {
+ switch (extension) {
+ case org_lwjgl_opengl_LinuxDisplay_XF86VIDMODE:
+ if (!setXF86VidModeMode(disp, screen, &avail_modes[i])) {
+ printfDebugJava(env, "Could not switch mode");
+ continue;
+ }
+ break;
+ case org_lwjgl_opengl_LinuxDisplay_XRANDR:
+ if (!setXrandrMode(disp, screen, &avail_modes[i])) {
+ printfDebugJava(env, "Could not switch mode");
+ continue;
+ }
+ break;
+ case org_lwjgl_opengl_LinuxDisplay_NONE: // Should never happen, since NONE imply no available display modes
+ default: // Should never happen
+ continue;
+ }
+ result = true;
+ break;
+ }
+ }
+ free(avail_modes);
+ XFlush(disp);
+ return result;
+}
+
+static int getGammaRampLengthOfDisplay(JNIEnv *env, Display *disp, int screen) {
+ int ramp_size;
+ if (XF86VidModeGetGammaRampSize(disp, screen, &ramp_size) == False) {
+ throwException(env, "XF86VidModeGetGammaRampSize call failed");
+ return 0;
+ }
+ return ramp_size;
+}
+
+JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nConvertToNativeRamp(JNIEnv *env, jclass unused, jobject ramp_buffer, jint buffer_offset, jint length) {
+ const jfloat *ramp_ptr = (const jfloat *)(*env)->GetDirectBufferAddress(env, ramp_buffer) + buffer_offset;
+ jobject native_ramp = newJavaManagedByteBuffer(env, length*3*sizeof(unsigned short));
+ if (native_ramp == NULL) {
+ throwException(env, "Failed to allocate gamma ramp buffer");
+ return NULL;
+ }
+ unsigned short *native_ramp_ptr = (unsigned short *)(*env)->GetDirectBufferAddress(env, native_ramp);
+ int i;
+ for (i = 0; i < length; i++) {
+ float scaled_gamma = ramp_ptr[i]*0xffff;
+ short scaled_gamma_short = (unsigned short)roundf(scaled_gamma);
+ native_ramp_ptr[i] = scaled_gamma_short;
+ native_ramp_ptr[i + length] = scaled_gamma_short;
+ native_ramp_ptr[i + length*2] = scaled_gamma_short;
+ }
+ return native_ramp;
+}
+
+JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentGammaRamp(JNIEnv *env, jclass unused, jlong display, jint screen) {
+ Display *disp = (Display *)(intptr_t)display;
+ int ramp_size = getGammaRampLengthOfDisplay(env, disp, screen);
+ jobject ramp_buffer = newJavaManagedByteBuffer(env, sizeof(unsigned short)*3*ramp_size);
+ if (ramp_buffer == NULL) {
+ throwException(env, "Could not allocate gamma ramp buffer");
+ return NULL;
+ }
+ unsigned short *ramp = (unsigned short *)(*env)->GetDirectBufferAddress(env, ramp_buffer);
+ if (!XF86VidModeGetGammaRamp(disp, screen, ramp_size, ramp, ramp + ramp_size, ramp + ramp_size*2)) {
+ throwException(env, "Could not get the current gamma ramp");
+ return NULL;
+ }
+ return ramp_buffer;
+}
+
+static void setGamma(JNIEnv *env, Display *disp, int screen, jobject ramp_buffer) {
+ if (ramp_buffer == NULL)
+ return;
+ unsigned short *ramp_ptr = (unsigned short *)(*env)->GetDirectBufferAddress(env, ramp_buffer);
+ jlong capacity = (*env)->GetDirectBufferCapacity(env, ramp_buffer);
+ int size = capacity/(sizeof(unsigned short)*3);
+ if (size == 0)
+ return;
+ if (XF86VidModeSetGammaRamp(disp, screen, size, ramp_ptr, ramp_ptr + size, ramp_ptr + size*2) == False) {
+ throwException(env, "Could not set gamma ramp.");
+ }
+}
+
+static bool switchDisplayMode(JNIEnv * env, Display *disp, int screen, jint extension, jobject mode) {
+ if (mode == NULL) {
+ throwException(env, "mode must be non-null");
+ return false;
+ }
+ jclass cls_displayMode = (*env)->GetObjectClass(env, mode);
+ jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I");
+ jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I");
+ jfieldID fid_freq = (*env)->GetFieldID(env, cls_displayMode, "freq", "I");
+ int width = (*env)->GetIntField(env, mode, fid_width);
+ int height = (*env)->GetIntField(env, mode, fid_height);
+ int freq = (*env)->GetIntField(env, mode, fid_freq);
+ if (!setMode(env, disp, screen, extension, width, height, freq)) {
+ throwException(env, "Could not switch mode.");
+ return false;
+ }
+ return true;
+}
+
+static jobjectArray getAvailableDisplayModes(JNIEnv * env, Display *disp, int screen, jint extension) {
+ int num_modes, i;
+ mode_info *avail_modes;
+ int bpp = XDefaultDepth(disp, screen);
+ avail_modes = getDisplayModes(disp, screen, extension, &num_modes);
+ if (avail_modes == NULL) {
+ printfDebugJava(env, "Could not get display modes");
+ return NULL;
+ }
+ // Allocate an array of DisplayModes big enough
+ jclass displayModeClass = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode");
+ jobjectArray ret = (*env)->NewObjectArray(env, num_modes, displayModeClass, NULL);
+ jmethodID displayModeConstructor = (*env)->GetMethodID(env, displayModeClass, "", "(IIII)V");
+
+ for (i = 0; i < num_modes; i++) {
+ jobject displayMode = (*env)->NewObject(env, displayModeClass, displayModeConstructor, avail_modes[i].width, avail_modes[i].height, bpp, avail_modes[i].freq);
+ (*env)->SetObjectArrayElement(env, ret, i, displayMode);
+ }
+ free(avail_modes);
+ return ret;
+}
+
+static jobject getCurrentXRandrMode(JNIEnv * env, Display *disp, int screen) {
+ Drawable root_window = RootWindow(disp, screen);
+ XRRScreenConfiguration *config = XRRGetScreenInfo(disp, root_window);
+ if (config == NULL) {
+ throwException(env, "Could not get current screen configuration.");
+ return NULL;
+ }
+ short rate = XRRConfigCurrentRate(config);
+ Rotation current_rotation;
+ SizeID size_index = XRRConfigCurrentConfiguration(config, ¤t_rotation);
+ int n_sizes;
+ XRRScreenSize *sizes = XRRConfigSizes(config, &n_sizes);
+ if (size_index >= n_sizes) {
+ throwFormattedException(env, "Xrandr current index (%d) is larger than or equals to the number of sizes (%d).", size_index, n_sizes);
+ XRRFreeScreenConfigInfo(config);
+ return NULL;
+ }
+ XRRScreenSize current_size = sizes[size_index];
+ XRRFreeScreenConfigInfo(config);
+ int bpp = XDefaultDepth(disp, screen);
+ jclass displayModeClass = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode");
+ jmethodID displayModeConstructor = (*env)->GetMethodID(env, displayModeClass, "", "(IIII)V");
+ jobject displayMode = (*env)->NewObject(env, displayModeClass, displayModeConstructor, current_size.width, current_size.height, bpp, rate);
+ return displayMode;
+}
+
+JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentXRandrMode(JNIEnv *env, jclass unused, jlong display, jint screen) {
+ Display *disp = (Display *)(intptr_t)display;
+ return getCurrentXRandrMode(env, disp, screen);
+}
+
+JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetAvailableDisplayModes(JNIEnv *env, jclass clazz, jlong display, jint screen, jint extension) {
+ Display *disp = (Display *)(intptr_t)display;
+ return getAvailableDisplayModes(env, disp, screen, extension);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSwitchDisplayMode(JNIEnv *env, jclass clazz, jlong display, jint screen, jint extension, jobject mode) {
+ Display *disp = (Display *)(intptr_t)display;
+ switchDisplayMode(env, disp, screen, extension, mode);
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetGammaRampLength(JNIEnv *env, jclass clazz, jlong display_ptr, jint screen) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ return (jint)getGammaRampLengthOfDisplay(env, disp, screen);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetGammaRamp(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject gamma_buffer) {
+ Display *disp = (Display *)(intptr_t)display;
+ setGamma(env, disp, screen, gamma_buffer);
+}
diff --git a/src/native/linux/opengles/extgl_glx.c b/src/native/linux/opengles/extgl_glx.c
new file mode 100644
index 00000000..32b2ff7f
--- /dev/null
+++ b/src/native/linux/opengles/extgl_glx.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include
+#include
+#include
+#include "extgl.h"
+
+static void * lib_gl_handle = NULL;
+
+bool extgl_Open(JNIEnv *env) {
+ if ( lib_gl_handle != NULL )
+ return true;
+
+ lib_gl_handle = dlopen("libGLESv2.so", RTLD_LAZY | RTLD_GLOBAL);
+ if (lib_gl_handle == NULL) {
+ throwFormattedException(env, "Error loading libGLESv2.so: %s", dlerror());
+ return false;
+ }
+ return true;
+}
+
+void extgl_Close(void) {
+ dlclose(lib_gl_handle);
+ lib_gl_handle = NULL;
+}
+
+void *extgl_GetProcAddress(const char *name) {
+ void *t = eglGetProcAddress(name);
+
+ if ( t == NULL ) {
+ t = dlsym(lib_gl_handle, name);
+ if ( t == NULL )
+ printfDebug("Could not locate symbol %s\n", name);
+ }
+
+ //if ( t != NULL )
+ //printfDebug("Located symbol %s\n", name);
+
+ return t;
+}
\ No newline at end of file
diff --git a/src/native/linux/opengles/org_lwjgl_opengl_Display.c b/src/native/linux/opengles/org_lwjgl_opengl_Display.c
new file mode 100644
index 00000000..35d73dbc
--- /dev/null
+++ b/src/native/linux/opengles/org_lwjgl_opengl_Display.c
@@ -0,0 +1,576 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * $Id: org_lwjgl_opengl_Display.c 3188 2009-03-19 21:50:30Z elias_naur $
+ *
+ * Linux specific display functions.
+ *
+ * @author elias_naur
+ * @version $Revision: 3188 $
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "common_tools.h"
+#include "extgl.h"
+#include "context.h"
+#include "org_lwjgl_opengl_LinuxDisplay.h"
+//#include "org_lwjgl_opengl_LinuxDisplayPeerInfo.h"
+#include "org_lwjgl_LinuxSysImplementation.h"
+
+#define ERR_MSG_SIZE 1024
+
+typedef struct {
+ unsigned long flags;
+ unsigned long functions;
+ unsigned long decorations;
+ long input_mode;
+ unsigned long status;
+} MotifWmHints;
+
+#define MWM_HINTS_DECORATIONS (1L << 1)
+
+static Colormap cmap;
+static int current_depth;
+static Pixmap current_icon_pixmap;
+static Pixmap current_icon_mask_pixmap;
+
+static Visual *current_visual;
+
+static bool checkXError(JNIEnv *env, Display *disp) {
+ XSync(disp, False);
+ return (*env)->ExceptionCheck(env) == JNI_FALSE;
+}
+
+static int global_error_handler(Display *disp, XErrorEvent *error) {
+ JNIEnv *env = getThreadEnv();
+ if (env != NULL) {
+ jclass org_lwjgl_LinuxDisplay_class = (*env)->FindClass(env, "org/lwjgl/opengl/LinuxDisplay");
+ if (org_lwjgl_LinuxDisplay_class == NULL) {
+ // Don't propagate error
+ (*env)->ExceptionClear(env);
+ return 0;
+ }
+ jmethodID handler_method = (*env)->GetStaticMethodID(env, org_lwjgl_LinuxDisplay_class, "globalErrorHandler", "(JJJJJJJ)I");
+ if (handler_method == NULL)
+ return 0;
+ return (*env)->CallStaticIntMethod(env, org_lwjgl_LinuxDisplay_class, handler_method, (jlong)(intptr_t)disp, (jlong)(intptr_t)error,
+ (jlong)(intptr_t)error->display, (jlong)error->serial, (jlong)error->error_code, (jlong)error->request_code, (jlong)error->minor_code);
+ } else
+ return 0;
+}
+
+static jlong openDisplay(JNIEnv *env) {
+ Display *display_connection = XOpenDisplay(NULL);
+ if (display_connection == NULL) {
+ throwException(env, "Could not open X display connection");
+ return (intptr_t)NULL;
+ }
+ return (intptr_t)display_connection;
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion
+ (JNIEnv *env, jobject ignored) {
+ return org_lwjgl_LinuxSysImplementation_JNI_VERSION;
+}
+
+JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getErrorText(JNIEnv *env, jclass unused, jlong display_ptr, jlong error_code) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ char err_msg_buffer[ERR_MSG_SIZE];
+ XGetErrorText(disp, error_code, err_msg_buffer, ERR_MSG_SIZE);
+ err_msg_buffer[ERR_MSG_SIZE - 1] = '\0';
+ return NewStringNativeWithLength(env, err_msg_buffer, strlen(err_msg_buffer));
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_callErrorHandler(JNIEnv *env, jclass unused, jlong handler_ptr, jlong display_ptr, jlong event_ptr) {
+ XErrorHandler handler = (XErrorHandler)(intptr_t)handler_ptr;
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ XErrorEvent *event = (XErrorEvent *)(intptr_t)event_ptr;
+ return (jint)handler(disp, event);
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setErrorHandler(JNIEnv *env, jclass unused) {
+ return (intptr_t)XSetErrorHandler(global_error_handler);
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_resetErrorHandler(JNIEnv *env, jclass unused, jlong handler_ptr) {
+ XErrorHandler handler = (XErrorHandler)(intptr_t)handler_ptr;
+ return (intptr_t)XSetErrorHandler(handler);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_sync(JNIEnv *env, jclass unused, jlong display_ptr, jboolean throw_away_events) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ XSync(disp, throw_away_events ? True : False);
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetDefaultScreen(JNIEnv *env, jclass unused, jlong display_ptr) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ return XDefaultScreen(disp);
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nInternAtom(JNIEnv *env, jclass unused, jlong display_ptr, jstring atom_name_obj, jboolean only_if_exists) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ char *atom_name = GetStringNativeChars(env, atom_name_obj);
+ if (atom_name == NULL)
+ return 0;
+ Atom atom = XInternAtom(disp, atom_name, only_if_exists ? True : False);
+ free(atom_name);
+ return atom;
+}
+
+static void setDecorations(Display *disp, Window window, int dec) {
+ Atom motif_hints_atom = XInternAtom(disp, "_MOTIF_WM_HINTS", False);
+ MotifWmHints motif_hints;
+ motif_hints.flags = MWM_HINTS_DECORATIONS;
+ motif_hints.decorations = dec;
+ XChangeProperty(disp, window, motif_hints_atom, motif_hints_atom, 32, PropModeReplace, (unsigned char *)&motif_hints, sizeof(MotifWmHints)/sizeof(long));
+}
+
+static bool isLegacyFullscreen(jint window_mode) {
+ return window_mode == org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_LEGACY;
+}
+
+static void setWindowTitle(Display *disp, Window window, const char *title) {
+ XStoreName(disp, window, title);
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_openDisplay(JNIEnv *env, jclass clazz) {
+ return openDisplay(env);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_closeDisplay(JNIEnv *env, jclass clazz, jlong display) {
+ Display *disp = (Display *)(intptr_t)display;
+ XCloseDisplay(disp);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDrawable(JNIEnv *env, jclass clazz, jlong window, jobject peer_info_handle) {
+ X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle);
+ peer_info->drawable = window;
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDefaultPeerInfo(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject peer_info_handle) {
+ //Display *disp = (Display *)(intptr_t)display;
+ //initPeerInfo(env, peer_info_handle, disp, screen);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetTitle(JNIEnv * env, jclass clazz, jlong display, jlong window_ptr, jstring title_obj) {
+ Display *disp = (Display *)(intptr_t)display;
+ Window window = (Window)window_ptr;
+ char * title = GetStringNativeChars(env, title_obj);
+ setWindowTitle(disp, window, title);
+ free(title);
+}
+
+static void freeIconPixmap(Display *disp) {
+ if (current_icon_mask_pixmap != 0) {
+ XFreePixmap(disp, current_icon_mask_pixmap);
+ current_icon_mask_pixmap = 0;
+ }
+ if (current_icon_pixmap != 0) {
+ XFreePixmap(disp, current_icon_pixmap);
+ current_icon_pixmap = 0;
+ }
+}
+
+static void destroyWindow(JNIEnv *env, Display *disp, Window window) {
+ XDestroyWindow(disp, window);
+ XFreeColormap(disp, cmap);
+ freeIconPixmap(disp);
+}
+
+static bool isNetWMFullscreenSupported(JNIEnv *env, Display *disp, int screen) {
+ unsigned long nitems;
+ Atom actual_type;
+ int actual_format;
+ unsigned long bytes_after;
+ Atom *supported_list;
+ Atom netwm_supported_atom = XInternAtom(disp, "_NET_SUPPORTED", False);
+ int result = XGetWindowProperty(disp, RootWindow(disp, screen), netwm_supported_atom, 0, 10000, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, (void *)&supported_list);
+ if (result != Success) {
+ throwException(env, "Unable to query _NET_SUPPORTED window property");
+ return false;
+ }
+ Atom fullscreen_atom = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False);
+ bool supported = false;
+ unsigned long i;
+ for (i = 0; i < nitems; i++) {
+ if (fullscreen_atom == supported_list[i]) {
+ supported = true;
+ break;
+ }
+ }
+ XFree(supported_list);
+ return supported;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsNetWMFullscreenSupported(JNIEnv *env, jclass unused, jlong display, jint screen) {
+ Display *disp = (Display *)(intptr_t)display;
+ return isNetWMFullscreenSupported(env, disp, screen) ? JNI_TRUE : JNI_FALSE;
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReshape(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jint x, jint y, jint width, jint height) {
+ Display *disp = (Display *)(intptr_t)display;
+ Window window = (Window)window_ptr;
+ XMoveWindow(disp, window, x, y);
+ XResizeWindow(disp, window, width, height);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_synchronize(JNIEnv *env, jclass clazz, jlong display, jboolean synchronize) {
+ Display *disp = (Display *)(intptr_t)display;
+ XSynchronize(disp, synchronize ? True : False);
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getRootWindow(JNIEnv *env, jclass clazz, jlong display, jint screen) {
+ Display *disp = (Display *)(intptr_t)display;
+ return RootWindow(disp, screen);
+}
+
+static void updateWindowHints(JNIEnv *env, Display *disp, Window window) {
+ XWMHints* win_hints = XAllocWMHints();
+ if (win_hints == NULL) {
+ throwException(env, "XAllocWMHints failed");
+ return;
+ }
+
+ win_hints->flags = InputHint;
+ win_hints->input = True;
+ if (current_icon_pixmap != 0) {
+ win_hints->flags |= IconPixmapHint;
+ win_hints->icon_pixmap = current_icon_pixmap;
+ }
+ if (current_icon_mask_pixmap != 0) {
+ win_hints->flags |= IconMaskHint;
+ win_hints->icon_mask = current_icon_mask_pixmap;
+ }
+
+ XSetWMHints(disp, window, win_hints);
+ XFree(win_hints);
+ XFlush(disp);
+}
+
+static Window createWindow(JNIEnv* env, Display *disp, int screen, jint window_mode, X11PeerInfo *peer_info, int x, int y, int width, int height, jboolean undecorated, long parent_handle) {
+ Window parent = (Window)parent_handle;
+ Window win;
+ XSetWindowAttributes attribs;
+ unsigned int attribmask;
+
+ XVisualInfo vis_info;
+ if ( !XMatchVisualInfo(disp, screen, DefaultDepth(disp, screen), TrueColor, &vis_info) ) {
+ throwException(env, "Failed to acquire X visual.");
+ return false;
+ }
+
+ cmap = XCreateColormap(disp, parent, vis_info.visual, AllocNone);
+ if (!checkXError(env, disp)) {
+ return false;
+ }
+ attribs.colormap = cmap;
+ attribs.border_pixel = 0;
+ attribs.event_mask = ExposureMask | FocusChangeMask | VisibilityChangeMask | StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask;
+ attribmask = CWColormap | CWEventMask | CWBorderPixel | CWBackPixel;
+ if (isLegacyFullscreen(window_mode)) {
+ attribmask |= CWOverrideRedirect;
+ attribs.override_redirect = True;
+ }
+ win = XCreateWindow(disp, parent, x, y, width, height, 0, vis_info.depth, InputOutput, vis_info.visual, attribmask, &attribs);
+
+ current_depth = vis_info.depth;
+ current_visual = vis_info.visual;
+
+ if (!checkXError(env, disp)) {
+ XFreeColormap(disp, cmap);
+ return false;
+ }
+ if (undecorated) {
+ // Use Motif decoration hint property and hope the window manager respects them
+ setDecorations(disp, win, 0);
+ }
+ XSizeHints * size_hints = XAllocSizeHints();
+ size_hints->flags = PMinSize | PMaxSize;
+ size_hints->min_width = width;
+ size_hints->max_width = width;
+ size_hints->min_height = height;
+ size_hints->max_height = height;
+ XSetWMNormalHints(disp, win, size_hints);
+ updateWindowHints(env, disp, win);
+ XFree(size_hints);
+#define NUM_ATOMS 1
+ Atom protocol_atoms[NUM_ATOMS] = {XInternAtom(disp, "WM_DELETE_WINDOW", False)/*, XInternAtom(disp, "WM_TAKE_FOCUS", False)*/};
+ XSetWMProtocols(disp, win, protocol_atoms, NUM_ATOMS);
+ if (window_mode == org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_NETWM) {
+ Atom fullscreen_atom = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False);
+ XChangeProperty(disp, win, XInternAtom(disp, "_NET_WM_STATE", False),
+ XInternAtom(disp, "ATOM", False), 32, PropModeReplace, (const unsigned char*)&fullscreen_atom, 1);
+ }
+ if (!checkXError(env, disp)) {
+ destroyWindow(env, disp, win);
+ return 0;
+ }
+ return win;
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_reparentWindow(JNIEnv *env, jclass unused, jlong display, jlong window_ptr, jlong parent_ptr, jint x, jint y) {
+ Display *disp = (Display *)(intptr_t)display;
+ Window window = (Window)window_ptr;
+ Window parent = (Window)parent_ptr;
+ XReparentWindow(disp, window, parent, x, y);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_mapRaised(JNIEnv *env, jclass unused, jlong display, jlong window_ptr) {
+ Display *disp = (Display *)(intptr_t)display;
+ Window window = (Window)window_ptr;
+ XMapRaised(disp, window);
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getParentWindow(JNIEnv *env, jclass unused, jlong display, jlong window_ptr) {
+ Display *disp = (Display *)(intptr_t)display;
+ Window window = (Window)window_ptr;
+ Window root, parent;
+ Window *children;
+ unsigned int nchildren;
+ if (XQueryTree(disp, window, &root, &parent, &children, &nchildren) == 0) {
+ throwException(env, "XQueryTree failed");
+ return None;
+ }
+ if (children != NULL)
+ XFree(children);
+ return parent;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_hasProperty(JNIEnv *env, jclass unusued, jlong display, jlong window_ptr, jlong property_ptr) {
+ Display *disp = (Display *)(intptr_t)display;
+ Window window = (Window)window_ptr;
+ Atom property = (Atom)property_ptr;
+ int num_props;
+ Atom *properties = XListProperties(disp, window, &num_props);
+ if (properties == NULL)
+ return JNI_FALSE;
+ jboolean result = JNI_FALSE;
+ for (int i = 0; i < num_props; i++) {
+ if (properties[i] == property) {
+ result = JNI_TRUE;
+ break;
+ }
+ }
+ XFree(properties);
+ return result;
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setInputFocus(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jlong time) {
+ Display *disp = (Display *)(intptr_t)display;
+ Window window = (Window)window_ptr;
+ XSetInputFocus(disp, window, RevertToParent, time);
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateWindow(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject peer_info_handle, jobject mode, jint window_mode, jint x, jint y, jboolean undecorated, jlong parent_handle) {
+ Display *disp = (Display *)(intptr_t)display;
+ X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle);
+
+ jclass cls_displayMode = (*env)->GetObjectClass(env, mode);
+
+ jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I");
+ jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I");
+
+ int width = (*env)->GetIntField(env, mode, fid_width);
+ int height = (*env)->GetIntField(env, mode, fid_height);
+
+ Window win = createWindow(env, disp, screen, window_mode, peer_info, x, y, width, height, undecorated, parent_handle);
+
+ if ((*env)->ExceptionOccurred(env))
+ return 0;
+
+ if (!checkXError(env, disp))
+ destroyWindow(env, disp, win);
+
+ return win;
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyWindow(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr) {
+ Display *disp = (Display *)(intptr_t)display;
+ Window window = (Window)window_ptr;
+ destroyWindow(env, disp, window);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nLockAWT(JNIEnv *env, jclass clazz) {
+ JAWT jawt;
+ jawt.version = JAWT_VERSION_1_4;
+ if (JAWT_GetAWT(env, &jawt) != JNI_TRUE) {
+ throwException(env, "GetAWT failed");
+ return;
+ }
+ jawt.Lock(env);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUnlockAWT(JNIEnv *env, jclass clazz) {
+ JAWT jawt;
+ jawt.version = JAWT_VERSION_1_4;
+ if (JAWT_GetAWT(env, &jawt) != JNI_TRUE) {
+ throwException(env, "GetAWT failed");
+ return;
+ }
+ jawt.Unlock(env);
+}
+
+static Pixmap createPixmapFromBuffer(JNIEnv *env, Display *disp, Window window, char *data, int data_size, int width, int height, int format, int depth) {
+ Pixmap pixmap = XCreatePixmap(disp, window, width, height, depth);
+ // We need to copy the image data since XDestroyImage will also free its data buffer, which can't be allowed
+ // since the data buffer is managed by the jvm (it's the storage for the direct ByteBuffer)
+ char *icon_copy = (char *)malloc(sizeof(*icon_copy)*data_size);
+
+ if (icon_copy == NULL) {
+ XFreePixmap(disp, pixmap);
+ throwException(env, "malloc failed");
+ return None;
+ }
+ memcpy(icon_copy, data, data_size);
+ XImage *image = XCreateImage(disp, current_visual, depth, format, 0, icon_copy, width, height, 32, 0);
+ if (image == NULL) {
+ XFreePixmap(disp, pixmap);
+ free(icon_copy);
+ throwException(env, "XCreateImage failed");
+ return None;
+ }
+
+ GC gc = XCreateGC(disp, pixmap, 0, NULL);
+ XPutImage(disp, pixmap, gc, image, 0, 0, 0, 0, width, height);
+ XFreeGC(disp, gc);
+ XDestroyImage(image);
+ // We won't free icon_copy because it is freed by XDestroyImage
+ return pixmap;
+}
+
+static void setIcon(JNIEnv *env, Display *disp, Window window, char *rgb_data, int rgb_size, char *mask_data, int mask_size, int width, int height) {
+ freeIconPixmap(disp);
+ current_icon_pixmap = createPixmapFromBuffer(env, disp, window, rgb_data, rgb_size, width, height, ZPixmap, current_depth);
+ if ((*env)->ExceptionCheck(env))
+ return;
+ current_icon_mask_pixmap = createPixmapFromBuffer(env, disp, window, mask_data, mask_size, width, height, XYPixmap, 1);
+ if ((*env)->ExceptionCheck(env)) {
+ freeIconPixmap(disp);
+ return;
+ }
+
+ updateWindowHints(env, disp, window);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetWindowIcon
+ (JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jobject icon_rgb_buffer, jint rgb_size, jobject icon_mask_buffer, jint mask_size, jint width, jint height)
+{
+ Display *disp = (Display *)(intptr_t)display;
+ Window window = (Window)window_ptr;
+ char *rgb_data= (char *)(*env)->GetDirectBufferAddress(env, icon_rgb_buffer);
+ char *mask_data= (char *)(*env)->GetDirectBufferAddress(env, icon_mask_buffer);
+
+ setIcon(env, disp, window, rgb_data, rgb_size, mask_data, mask_size, width, height);
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUngrabKeyboard(JNIEnv *env, jclass unused, jlong display_ptr) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ return XUngrabKeyboard(disp, CurrentTime);
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabKeyboard(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ Window win = (Window)window_ptr;
+ return XGrabKeyboard(disp, win, False, GrabModeAsync, GrabModeAsync, CurrentTime);
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabPointer(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jlong cursor_ptr) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ Window win = (Window)window_ptr;
+ Cursor cursor = (Cursor)cursor_ptr;
+ int grab_mask = PointerMotionMask | ButtonPressMask | ButtonReleaseMask;
+ return XGrabPointer(disp, win, False, grab_mask, GrabModeAsync, GrabModeAsync, win, cursor, CurrentTime);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetViewPort(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jint screen) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ Window win = (Window)window_ptr;
+ XWindowAttributes win_attribs;
+
+ XGetWindowAttributes(disp, win, &win_attribs);
+ XF86VidModeSetViewPort(disp, screen, win_attribs.x, win_attribs.y);
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUngrabPointer(JNIEnv *env, jclass unused, jlong display_ptr) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ return XUngrabPointer(disp, CurrentTime);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDefineCursor(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jlong cursor_ptr) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ Window win = (Window)window_ptr;
+ Cursor cursor = (Cursor)cursor_ptr;
+ XDefineCursor(disp, win, cursor);
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateBlankCursor(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ Window win = (Window)window_ptr;
+ unsigned int best_width, best_height;
+ if (XQueryBestCursor(disp, win, 1, 1, &best_width, &best_height) == 0) {
+ throwException(env, "Could not query best cursor size");
+ return false;
+ }
+ Pixmap mask = XCreatePixmap(disp, win, best_width, best_height, 1);
+ XGCValues gc_values;
+ gc_values.foreground = 0;
+ GC gc = XCreateGC(disp, mask, GCForeground, &gc_values);
+ XFillRectangle(disp, mask, gc, 0, 0, best_width, best_height);
+ XFreeGC(disp, gc);
+ XColor dummy_color;
+ Cursor cursor = XCreatePixmapCursor(disp, mask, mask, &dummy_color, &dummy_color, 0, 0);
+ XFreePixmap(disp, mask);
+ return cursor;
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetInputFocus(JNIEnv *env, jclass unused, jlong display_ptr) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ int revert_mode;
+ Window win;
+ XGetInputFocus(disp, &win, &revert_mode);
+ return win;
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIconifyWindow(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jint screen) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ Window win = (Window)window_ptr;
+ XIconifyWindow(disp, win, screen);
+}
diff --git a/src/native/windows/context.c b/src/native/windows/opengl/context.c
similarity index 100%
rename from src/native/windows/context.c
rename to src/native/windows/opengl/context.c
diff --git a/src/native/windows/context.h b/src/native/windows/opengl/context.h
similarity index 100%
rename from src/native/windows/context.h
rename to src/native/windows/opengl/context.h
diff --git a/src/native/windows/extgl_wgl.c b/src/native/windows/opengl/extgl_wgl.c
similarity index 100%
rename from src/native/windows/extgl_wgl.c
rename to src/native/windows/opengl/extgl_wgl.c
diff --git a/src/native/windows/extgl_wgl.h b/src/native/windows/opengl/extgl_wgl.h
similarity index 100%
rename from src/native/windows/extgl_wgl.h
rename to src/native/windows/opengl/extgl_wgl.h
diff --git a/src/native/windows/org_lwjgl_opengl_Pbuffer.c b/src/native/windows/opengl/org_lwjgl_opengl_Pbuffer.c
similarity index 100%
rename from src/native/windows/org_lwjgl_opengl_Pbuffer.c
rename to src/native/windows/opengl/org_lwjgl_opengl_Pbuffer.c
diff --git a/src/native/windows/org_lwjgl_opengl_WindowsContextImplementation.c b/src/native/windows/opengl/org_lwjgl_opengl_WindowsContextImplementation.c
similarity index 100%
rename from src/native/windows/org_lwjgl_opengl_WindowsContextImplementation.c
rename to src/native/windows/opengl/org_lwjgl_opengl_WindowsContextImplementation.c
diff --git a/src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c b/src/native/windows/opengl/org_lwjgl_opengl_WindowsPeerInfo.c
similarity index 100%
rename from src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c
rename to src/native/windows/opengl/org_lwjgl_opengl_WindowsPeerInfo.c
diff --git a/src/native/windows/opengles/context.c b/src/native/windows/opengles/context.c
new file mode 100644
index 00000000..9d1ca150
--- /dev/null
+++ b/src/native/windows/opengles/context.c
@@ -0,0 +1,508 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * $Id: context.c -1 $
+ *
+ * @author elias_naue
+ * @version $Revision: -1 $
+ */
+
+#include
+#include
+#include "common_tools.h"
+#include "extgl.h"
+/*#include "extgl_wgl.h"*/
+#include "context.h"
+
+extern HINSTANCE dll_handle; // Handle to the LWJGL dll
+
+#define _CONTEXT_PRIVATE_CLASS_NAME "__lwjgl_context_class_name"
+
+/*
+ * Register the LWJGL window class.
+ * Returns true for success, or false for failure
+ */
+bool registerWindow(WNDPROC win_proc, LPCTSTR class_name)
+{
+ WNDCLASS windowClass;
+ memset(&windowClass, 0, sizeof(windowClass));
+ windowClass.style = CS_OWNDC;
+ windowClass.lpfnWndProc = win_proc;
+ windowClass.cbClsExtra = 0;
+ windowClass.cbWndExtra = 0;
+ windowClass.hInstance = dll_handle;
+ windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ windowClass.hbrBackground = NULL;
+ windowClass.lpszMenuName = NULL;
+ windowClass.lpszClassName = class_name;
+
+ if (RegisterClass(&windowClass) == 0) {
+ printfDebug("Failed to register window class\n");
+ return false;
+ }
+ return true;
+}
+
+static LRESULT CALLBACK dummyWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
+ return DefWindowProc(hwnd, msg, wParam, lParam);
+}
+
+/*
+bool applyPixelFormat(JNIEnv *env, HDC hdc, int iPixelFormat) {
+ PIXELFORMATDESCRIPTOR desc;
+ if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) {
+ throwFormattedException(env, "DescribePixelFormat failed (%d)", GetLastError());
+ return false;
+ }
+
+ // make that the pixel format of the device context
+ if (SetPixelFormat(hdc, iPixelFormat, &desc) == FALSE) {
+ throwFormattedException(env, "SetPixelFormat failed (%d)", GetLastError());
+ return false;
+ }
+ return true;
+}
+*/
+
+/*
+ * Close the window
+ */
+void closeWindow(HWND *hwnd, HDC *hdc)
+{
+ // Release device context
+ if (*hdc != NULL && *hwnd != NULL) {
+ ReleaseDC(*hwnd, *hdc);
+ *hdc = NULL;
+ }
+
+ // Close the window
+ if (*hwnd != NULL) {
+ ShowWindow(*hwnd, SW_HIDE);
+ DestroyWindow(*hwnd);
+ *hwnd = NULL;
+ }
+}
+
+void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool undecorated, bool child_window) {
+ DWORD exstyle, windowflags;
+ if (undecorated) {
+ exstyle = WS_EX_APPWINDOW;
+ windowflags = WS_POPUP;
+ } else if (child_window) {
+ exstyle = 0;
+ windowflags = WS_CHILDWINDOW;
+ } else {
+ exstyle = WS_EX_APPWINDOW;
+ windowflags = WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU;
+ }
+ windowflags = windowflags | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
+ *windowflags_return = windowflags;
+ *exstyle_return = exstyle;
+}
+
+HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool undecorated, bool child_window, HWND parent)
+{
+ RECT clientSize;
+ DWORD exstyle, windowflags;
+ HWND new_hwnd;
+
+ getWindowFlags(&windowflags, &exstyle, undecorated, child_window);
+
+ clientSize.bottom = height;
+ clientSize.left = 0;
+ clientSize.right = width;
+ clientSize.top = 0;
+
+ AdjustWindowRectEx(
+ &clientSize, // client-rectangle structure
+ windowflags, // window styles
+ FALSE, // menu-present option
+ exstyle // extended window style
+ );
+ // Create the window now, using that class:
+ new_hwnd = CreateWindowEx (
+ exstyle,
+ window_class_name,
+ "",
+ windowflags,
+ x, y, clientSize.right - clientSize.left, clientSize.bottom - clientSize.top,
+ parent,
+ NULL,
+ dll_handle,
+ NULL);
+
+ return new_hwnd;
+}
+
+/*
+static int convertToBPE(int bpp) {
+ int bpe;
+ switch (bpp) {
+ case 0:
+ bpe = 0;
+ break;
+ case 32:
+ case 24:
+ bpe = 8;
+ break;
+ case 16: // Fall through
+ default:
+ bpe = 4;
+ break;
+ }
+ return bpe;
+}
+*/
+
+/*
+static int findPixelFormatARBFromBPP(JNIEnv *env, HDC hdc, WGLExtensions *extensions, jobject pixel_format, jobject pixelFormatCaps, int bpp, bool window, bool pbuffer, bool double_buffer) {
+ jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
+ int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I"));
+ int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I"));
+ int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I"));
+ int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I"));
+ int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I"));
+ int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I"));
+ int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I"));
+ int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I"));
+
+ jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z"));
+ jboolean floating_point = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z"));
+ jboolean floating_point_packed = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z"));
+ jboolean sRGB = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z"));
+
+ int pixel_type;
+ int iPixelFormat;
+ unsigned int num_formats_returned;
+ attrib_list_t attrib_list;
+ GLuint *pixelFormatCaps_ptr;
+ jlong pixelFormatCapsSize;
+ BOOL result;
+ jlong i;
+ int bpe = convertToBPE(bpp);
+
+ if ( floating_point )
+ pixel_type = WGL_TYPE_RGBA_FLOAT_ARB;
+ else if ( floating_point_packed )
+ pixel_type = WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT;
+ else
+ pixel_type = WGL_TYPE_RGBA_ARB;
+
+ initAttribList(&attrib_list);
+ if (window) {
+ putAttrib(&attrib_list, WGL_DRAW_TO_WINDOW_ARB); putAttrib(&attrib_list, TRUE);
+ }
+ if (pbuffer) {
+ putAttrib(&attrib_list, WGL_DRAW_TO_PBUFFER_ARB); putAttrib(&attrib_list, TRUE);
+ }
+ if (!getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL")) {
+ putAttrib(&attrib_list, WGL_ACCELERATION_ARB); putAttrib(&attrib_list, WGL_FULL_ACCELERATION_ARB);
+ }
+ putAttrib(&attrib_list, WGL_PIXEL_TYPE_ARB); putAttrib(&attrib_list, pixel_type);
+ putAttrib(&attrib_list, WGL_DOUBLE_BUFFER_ARB); putAttrib(&attrib_list, double_buffer ? TRUE : FALSE);
+ putAttrib(&attrib_list, WGL_SUPPORT_OPENGL_ARB); putAttrib(&attrib_list, TRUE);
+ putAttrib(&attrib_list, WGL_RED_BITS_ARB); putAttrib(&attrib_list, bpe);
+ putAttrib(&attrib_list, WGL_GREEN_BITS_ARB); putAttrib(&attrib_list, bpe);
+ putAttrib(&attrib_list, WGL_BLUE_BITS_ARB); putAttrib(&attrib_list, bpe);
+ putAttrib(&attrib_list, WGL_ALPHA_BITS_ARB); putAttrib(&attrib_list, alpha);
+ putAttrib(&attrib_list, WGL_DEPTH_BITS_ARB); putAttrib(&attrib_list, depth);
+ putAttrib(&attrib_list, WGL_STENCIL_BITS_ARB); putAttrib(&attrib_list, stencil);
+ // Assume caller checked extension availability
+ if (samples > 0) {
+ putAttrib(&attrib_list, WGL_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1);
+ putAttrib(&attrib_list, WGL_SAMPLES_ARB); putAttrib(&attrib_list, samples); // WGL_COVERAGE_SAMPLES_NV if colorSamples > 0
+ if ( colorSamples > 0 ) {
+ putAttrib(&attrib_list, WGL_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples);
+ }
+ }
+ putAttrib(&attrib_list, WGL_ACCUM_BITS_ARB); putAttrib(&attrib_list, accum_bpp);
+ putAttrib(&attrib_list, WGL_ACCUM_ALPHA_BITS_ARB); putAttrib(&attrib_list, accum_alpha);
+ putAttrib(&attrib_list, WGL_STEREO_ARB); putAttrib(&attrib_list, stereo ? TRUE : FALSE);
+ putAttrib(&attrib_list, WGL_AUX_BUFFERS_ARB); putAttrib(&attrib_list, num_aux_buffers);
+ if (sRGB) {
+ putAttrib(&attrib_list, WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB); putAttrib(&attrib_list, TRUE);
+ }
+
+ // Assume caller checked extension availability
+ if (pixelFormatCaps != NULL) {
+ pixelFormatCaps_ptr = (GLuint *)(*env)->GetDirectBufferAddress(env, pixelFormatCaps);
+ pixelFormatCapsSize = (*env)->GetDirectBufferCapacity(env, pixelFormatCaps);
+
+ for (i = 0; i < pixelFormatCapsSize; i++)
+ putAttrib(&attrib_list, pixelFormatCaps_ptr[i]);
+ }
+ putAttrib(&attrib_list, 0); putAttrib(&attrib_list, 0);
+ result = extensions->wglChoosePixelFormatARB(hdc, attrib_list.attribs, NULL, 1, &iPixelFormat, &num_formats_returned);
+
+ if (result == FALSE || num_formats_returned < 1) {
+ throwFormattedException(env, "Failed to find ARB pixel format %d %d\n", result, num_formats_returned);
+ return -1;
+ }
+ return iPixelFormat;
+}
+
+static int findPixelFormatARB(JNIEnv *env, HDC hdc, WGLExtensions *extensions, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer) {
+ int bpp;
+ int iPixelFormat;
+ int fallback_bpp = 16;
+ jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
+ if (use_hdc_bpp) {
+ bpp = GetDeviceCaps(hdc, BITSPIXEL);
+ iPixelFormat = findPixelFormatARBFromBPP(env, hdc, extensions, pixel_format, pixelFormatCaps, bpp, window, pbuffer, double_buffer);
+ if ((*env)->ExceptionOccurred(env)) {
+ (*env)->ExceptionClear(env);
+ printfDebugJava(env, "Failed to find ARB pixel format with HDC depth %d, falling back to %d\n", bpp, fallback_bpp);
+ bpp = fallback_bpp;
+ } else
+ return iPixelFormat;
+ } else
+ bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I"));
+ return findPixelFormatARBFromBPP(env, hdc, extensions, pixel_format, pixelFormatCaps, bpp, window, pbuffer, double_buffer);
+}
+*/
+
+/*
+ * Find an appropriate pixel format
+ */
+ /*
+static int findPixelFormatFromBPP(JNIEnv *env, HDC hdc, jobject pixel_format, int bpp, bool double_buffer)
+{
+ jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
+ int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I"));
+ int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I"));
+ int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I"));
+ int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I"));
+ int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I"));
+ int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I"));
+ jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z"));
+ unsigned int flags = PFD_DRAW_TO_WINDOW | // support window
+ PFD_SUPPORT_OPENGL |
+ (double_buffer ? PFD_DOUBLEBUFFER : 0) |
+ (stereo ? PFD_STEREO : 0);
+ PIXELFORMATDESCRIPTOR desc;
+ int iPixelFormat;
+ PIXELFORMATDESCRIPTOR pfd = {
+ sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
+ 1, // version number
+ flags, // RGBA type
+ PFD_TYPE_RGBA,
+ (BYTE)bpp,
+ 0, 0, 0, 0, 0, 0, // color bits ignored
+ (BYTE)alpha,
+ 0, // shift bit ignored
+ accum_bpp + accum_alpha, // no accumulation buffer
+ 0, 0, 0, 0, // accum bits ignored
+ (BYTE)depth,
+ (BYTE)stencil,
+ num_aux_buffers,
+ PFD_MAIN_PLANE, // main layer
+ 0, // reserved
+ 0, 0, 0 // layer masks ignored
+ };
+ // get the best available match of pixel format for the device context
+ iPixelFormat = ChoosePixelFormat(hdc, &pfd);
+ if (iPixelFormat == 0) {
+ throwException(env, "Failed to choose pixel format");
+ return -1;
+ }
+
+ if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) {
+ throwException(env, "Could not describe pixel format");
+ return -1;
+ }
+
+ if (desc.cColorBits < bpp) {
+ throwException(env, "Insufficient color precision");
+ return -1;
+ }
+
+ if (desc.cAlphaBits < alpha) {
+ throwException(env, "Insufficient alpha precision");
+ return -1;
+ }
+
+ if (desc.cStencilBits < stencil) {
+ throwException(env, "Insufficient stencil precision");
+ return -1;
+ }
+
+ if (desc.cDepthBits < depth) {
+ throwException(env, "Insufficient depth buffer precision");
+ return -1;
+ }
+
+ if ((desc.dwFlags & PFD_GENERIC_FORMAT) != 0) {
+ jboolean allowSoftwareOpenGL = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL");
+ // secondary check for software override
+ if(!allowSoftwareOpenGL) {
+ throwException(env, "Pixel format not accelerated");
+ return -1;
+ }
+ }
+
+ if ((desc.dwFlags & flags) != flags) {
+ throwException(env, "Capabilities not supported");
+ return -1;
+ }
+ return iPixelFormat;
+}
+
+static int findPixelFormatDefault(JNIEnv *env, HDC hdc, jobject pixel_format, bool use_hdc_bpp, bool double_buffer) {
+ int bpp;
+ int iPixelFormat;
+ int fallback_bpp = 16;
+ jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
+ if (use_hdc_bpp) {
+ bpp = GetDeviceCaps(hdc, BITSPIXEL);
+ iPixelFormat = findPixelFormatFromBPP(env, hdc, pixel_format, bpp, double_buffer);
+ if ((*env)->ExceptionOccurred(env)) {
+ (*env)->ExceptionClear(env);
+ printfDebugJava(env, "Failed to find pixel format with HDC depth %d, falling back to %d\n", bpp, fallback_bpp);
+ bpp = fallback_bpp;
+ } else
+ return iPixelFormat;
+ } else
+ bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I"));
+ return findPixelFormatFromBPP(env, hdc, pixel_format, bpp, double_buffer);
+}
+*/
+
+/*
+static bool validateAndGetExtensions(JNIEnv *env, WGLExtensions *extensions, HDC dummy_hdc, HGLRC dummy_hglrc, int samples, int colorSamples, bool floating_point, bool floating_point_packed, bool sRGB, jobject pixelFormatCaps) {
+ if (!wglMakeCurrent(dummy_hdc, dummy_hglrc)) {
+ throwException(env, "Could not bind context to dummy window");
+ return false;
+ }
+ extgl_InitWGL(extensions);
+
+ if (!extensions->WGL_ARB_pixel_format) {
+ throwException(env, "No support for WGL_ARB_pixel_format");
+ return false;
+ }
+ if (samples > 0 && !extensions->WGL_ARB_multisample) {
+ throwException(env, "No support for WGL_ARB_multisample");
+ return false;
+ }
+ if (colorSamples > 0 && !extensions->WGL_NV_multisample_coverage) {
+ throwException(env, "No support for WGL_NV_multisample_coverage");
+ return false;
+ }
+
+ // Apparently, some drivers don't report WGL_ARB_pixel_format_float
+ // even though GL_ARB_color_buffer_float and WGL_ATI_color_format_float
+ // is supported.
+ if (floating_point && !(extensions->WGL_ARB_pixel_format_float || extensions->WGL_ATI_pixel_format_float)) {
+ throwException(env, "No support for WGL_ARB_pixel_format_float nor WGL_ATI_pixel_format_float");
+ return false;
+ }
+ if (floating_point_packed && !(extensions->WGL_EXT_pixel_format_packed_float)) {
+ throwException(env, "No support for WGL_EXT_pixel_format_packed_float");
+ return false;
+ }
+ if (sRGB && !(extensions->WGL_ARB_framebuffer_sRGB)) {
+ throwException(env, "No support for WGL_ARB_framebuffer_sRGB");
+ return false;
+ }
+ if (pixelFormatCaps != NULL && !extensions->WGL_ARB_render_texture) {
+ throwException(env, "No support for WGL_ARB_render_texture");
+ return false;
+ }
+ return true;
+}
+
+int findPixelFormatOnDC(JNIEnv *env, HDC hdc, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer) {
+ HGLRC dummy_hglrc;
+ HDC saved_current_hdc;
+ HGLRC saved_current_hglrc;
+ WGLExtensions extensions;
+ HWND dummy_hwnd;
+ HDC dummy_hdc;
+ int pixel_format_id;
+ jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
+
+ int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I"));
+ int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I"));
+ bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z"));
+ bool floating_point_packed = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z"));
+ bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z"));
+ bool use_arb_selection = samples > 0 || floating_point || floating_point_packed || sRGB || pbuffer || pixelFormatCaps != NULL;
+
+ pixel_format_id = findPixelFormatDefault(env, hdc, pixel_format, use_hdc_bpp, double_buffer);
+ if (!(*env)->ExceptionOccurred(env) && use_arb_selection) {
+ dummy_hwnd = createDummyWindow(origin_x, origin_y);
+ if (dummy_hwnd == NULL) {
+ throwException(env, "Could not create dummy window");
+ return -1;
+ }
+ dummy_hdc = GetDC(dummy_hwnd);
+ if (!applyPixelFormat(env, dummy_hdc, pixel_format_id)) {
+ closeWindow(&dummy_hwnd, &dummy_hdc);
+ return -1;
+ }
+ dummy_hglrc = wglCreateContext(dummy_hdc);
+ if (dummy_hglrc == NULL) {
+ closeWindow(&dummy_hwnd, &dummy_hdc);
+ throwException(env, "Failed to create OpenGL rendering context");
+ return -1;
+ }
+ // Save the current HDC and HGLRC to avoid disruption
+ saved_current_hdc = wglGetCurrentDC();
+ saved_current_hglrc = wglGetCurrentContext();
+ if (validateAndGetExtensions(env, &extensions, dummy_hdc, dummy_hglrc, samples, colorSamples, floating_point, floating_point_packed, sRGB, pixelFormatCaps)) {
+ pixel_format_id = findPixelFormatARB(env, hdc, &extensions, pixel_format, pixelFormatCaps, use_hdc_bpp, window, pbuffer, double_buffer);
+ }
+ wglMakeCurrent(saved_current_hdc, saved_current_hglrc);
+ wglDeleteContext(dummy_hglrc);
+ closeWindow(&dummy_hwnd, &dummy_hdc);
+ }
+ return pixel_format_id;
+}
+*/
+
+static bool registerDummyWindow() {
+ static bool window_registered = false;
+ if (!window_registered) {
+ if (!registerWindow(dummyWindowProc, _CONTEXT_PRIVATE_CLASS_NAME)) {
+ return false;
+ }
+ window_registered = true;
+ }
+ return true;
+}
+
+HWND createDummyWindow(int origin_x, int origin_y) {
+ if (!registerDummyWindow())
+ return NULL;
+ return createWindow(_CONTEXT_PRIVATE_CLASS_NAME, origin_x, origin_y, 1, 1, false, false, NULL);
+}
diff --git a/src/native/windows/opengles/context.h b/src/native/windows/opengles/context.h
new file mode 100644
index 00000000..5370bbdf
--- /dev/null
+++ b/src/native/windows/opengles/context.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * $Id: context.h -1 $
+ *
+ * @author elias_naur
+ * @version $Revision: -1 $
+ */
+
+#ifndef __LWJGL_CONTEXT_H
+#define __LWJGL_CONTEXT_H
+
+#include
+#include
+#include "common_tools.h"
+#include "extgl.h"
+/*#include "extgl_wgl.h"*/
+
+typedef struct {
+ union {
+ HWND hwnd;
+ /*
+ struct {
+ HPBUFFERARB pbuffer;
+ // Contains the function pointers that
+ // created the pbuffer
+ WGLExtensions extensions;
+ } pbuffer;
+ */
+ } u;
+ HDC drawable_hdc;
+} WindowsPeerInfo;
+
+/*
+ * Register the LWJGL window class.
+ * Returns true for success, or false for failure
+ */
+extern bool registerWindow();
+
+//extern bool applyPixelFormat(JNIEnv *env, HDC hdc, int iPixelFormat);
+
+/*
+ * Close the window
+ */
+extern void closeWindow(HWND *hwnd, HDC *hdc);
+
+/**
+ * Create a dummy window suitable to create contexts from
+ */
+extern HWND createDummyWindow(int x, int y);
+
+/**
+ * Return appropriate window and extended style flags from the given fullscreen and undecorated property
+ */
+extern void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool undecorated, bool child_window);
+
+/*
+ * Create a window with the specified position, size, and
+ * fullscreen attribute. The window will have DirectInput associated
+ * with it.
+ *
+ * Returns true for success, or false for failure
+ */
+extern HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool undecorated, bool child_window, HWND parent);
+
+//extern int findPixelFormatOnDC(JNIEnv *env, HDC hdc, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer);
+
+#endif
diff --git a/src/native/windows/opengles/extgl_wgl.c b/src/native/windows/opengles/extgl_wgl.c
new file mode 100644
index 00000000..d1c57e3b
--- /dev/null
+++ b/src/native/windows/opengles/extgl_wgl.c
@@ -0,0 +1,70 @@
+/* ----------------------------------------------------------------------------
+Copyright (c) 2001-2002, Lev Povalahev
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * The name of the author may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
+------------------------------------------------------------------------------*/
+/*
+ Lev Povalahev
+
+ levp@gmx.net
+
+ http://www.uni-karlsruhe.de/~uli2/
+
+*/
+
+#include
+#include
+#include "extgl.h"
+
+static HMODULE lib_gl_handle = NULL;
+
+void *extgl_GetProcAddress(const char *name) {
+ void *t = eglGetProcAddress(name);
+ if (t == NULL)
+ {
+ t = GetProcAddress(lib_gl_handle, name);
+ if (t == NULL)
+ {
+ printfDebug("Could not locate symbol %s\n", name);
+ }
+ }
+ return t;
+}
+
+bool extgl_Open(JNIEnv *env) {
+ if (lib_gl_handle != NULL)
+ return true;
+ // load the dynamic libraries for OpenGL
+ lib_gl_handle = LoadLibrary("libGLESv2.dll");
+ if (lib_gl_handle == NULL) {
+ throwException(env, "Could not load OpenGL ES library");
+ return false;
+ }
+ return true;
+}
+
+void extgl_Close(void) {
+ FreeLibrary(lib_gl_handle);
+ lib_gl_handle = NULL;
+}
diff --git a/src/native/windows/opengles/org_lwjgl_opengl_WindowsPeerInfo.c b/src/native/windows/opengles/org_lwjgl_opengl_WindowsPeerInfo.c
new file mode 100644
index 00000000..353cb4fc
--- /dev/null
+++ b/src/native/windows/opengles/org_lwjgl_opengl_WindowsPeerInfo.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * $Id: org_lwjgl_opengl_WindowsPeerInfo.c -1 $
+ *
+ * @author elias_naur
+ * @version $Revision: -1 $
+ */
+
+#include
+#include "org_lwjgl_opengl_WindowsPeerInfo.h"
+#include "context.h"
+#include "common_tools.h"
+
+JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_createHandle(JNIEnv *env, jclass clazz) {
+ return newJavaManagedByteBuffer(env, sizeof(WindowsPeerInfo));
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHdc(JNIEnv *env, jclass unused, jobject peer_info_handle) {
+ WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
+ return (intptr_t)peer_info->drawable_hdc;
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHwnd(JNIEnv *env, jclass unused, jobject peer_info_handle) {
+ WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
+ return (intptr_t)peer_info->u.hwnd;
+}
diff --git a/src/native/windows/org_lwjgl_opengl_Display.c b/src/native/windows/org_lwjgl_opengl_Display.c
index 1d0e0237..9352774b 100644
--- a/src/native/windows/org_lwjgl_opengl_Display.c
+++ b/src/native/windows/org_lwjgl_opengl_Display.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.
*/
-
+
/**
* $Id$
*
@@ -43,7 +43,7 @@
#include
#include
#include "Window.h"
-#include "extgl_wgl.h"
+/*#include "extgl_wgl.h"*/
#include "common_tools.h"
#include "display.h"
#include "org_lwjgl_opengl_WindowsDisplay.h"
@@ -121,8 +121,8 @@ static void handleMessages(JNIEnv *env) {
PM_REMOVE // removal options
))
{
- if (msg.message == WM_QUIT)
- break;
+ if (msg.message == WM_QUIT)
+ break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@@ -303,14 +303,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nReshape(JNIEnv *env
RECT clientSize;
getWindowFlags(&windowflags, &exstyle, undecorated, child);
-
+
// If we're not a fullscreen window, adjust the height to account for the
// height of the title bar:
clientSize.bottom = height;
clientSize.left = 0;
clientSize.right = width;
clientSize.top = 0;
-
+
AdjustWindowRectEx(
&clientSize, // client-rectangle structure
windowflags, // window styles
@@ -339,7 +339,7 @@ static HICON createWindowIcon(JNIEnv *env, jint *pixels, jint width, jint height
int maskPixelsOff;
int scanlineWidth;
HBITMAP colorDIB;
-
+
memset(&bitmapInfo, 0, sizeof(BITMAPV5HEADER));
bitmapInfo.bV5Size = sizeof(BITMAPV5HEADER);
bitmapInfo.bV5Width = width;
@@ -380,7 +380,7 @@ static HICON createWindowIcon(JNIEnv *env, jint *pixels, jint width, jint height
DeleteObject(colorDIB);
// Convert alpha map to pixel packed mask
-
+
// number of bytes it takes to fit a bit packed scan line.
widthInBytes = (width & 0x7) != 0 ? (width >> 3) + 1 : (width >> 3);
@@ -392,9 +392,9 @@ static HICON createWindowIcon(JNIEnv *env, jint *pixels, jint width, jint height
imageSize = scanlineWidth*height;
maskPixels = (unsigned char*)malloc(sizeof(unsigned char)*imageSize);
memset(maskPixels, 0xFF, sizeof(unsigned char)*imageSize);
-
+
cursorMask = CreateBitmap(width, height, 1, 1, maskPixels);
-
+
memset(&iconInfo, 0, sizeof(ICONINFO));
iconInfo.hbmMask = cursorMask;
iconInfo.hbmColor = colorBitmap;
diff --git a/src/templates/org/lwjgl/opengl/EXT_texture_lod_bias.java b/src/templates/org/lwjgl/opengl/EXT_texture_lod_bias.java
index 0b5a0b33..e6087f10 100644
--- a/src/templates/org/lwjgl/opengl/EXT_texture_lod_bias.java
+++ b/src/templates/org/lwjgl/opengl/EXT_texture_lod_bias.java
@@ -31,11 +31,28 @@
*/
package org.lwjgl.opengl;
-import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.Extension;
@Extension(postfix = "EXT", className = "EXTTextureLODBias")
public interface EXT_texture_lod_bias {
+
+ /**
+ * Accepted by the <target> parameters of GetTexEnvfv, GetTexEnviv,
+ * TexEnvi, TexEnvf, Texenviv, and TexEnvfv:
+ */
int GL_TEXTURE_FILTER_CONTROL_EXT = 0x8500;
+
+ /**
+ * When the <target> parameter of GetTexEnvfv, GetTexEnviv, TexEnvi,
+ * TexEnvf, TexEnviv, and TexEnvfv is TEXTURE_FILTER_CONTROL_EXT, then
+ * the value of <pname> may be:
+ */
int GL_TEXTURE_LOD_BIAS_EXT = 0x8501;
+
+ /**
+ * Accepted by the <pname> parameters of GetBooleanv, GetIntegerv,
+ * GetFloatv, and GetDoublev:
+ */
int GL_MAX_TEXTURE_LOD_BIAS_EXT = 0x84FD;
-}
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/AMD_compressed_3DC_texture.java b/src/templates/org/lwjgl/opengles/AMD_compressed_3DC_texture.java
new file mode 100644
index 00000000..7de9d731
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/AMD_compressed_3DC_texture.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface AMD_compressed_3DC_texture {
+
+ /**
+ * Accepted by the <internalFormat> parameter of CompressedTexImage2D and
+ * CompressedTexImage3DOES:
+ */
+ int GL_3DC_X_AMD = 0x87F9,
+ GL_3DC_XY_AMD = 0x87FA;
+
+}
diff --git a/src/templates/org/lwjgl/opengles/AMD_compressed_ATC_texture.java b/src/templates/org/lwjgl/opengles/AMD_compressed_ATC_texture.java
new file mode 100644
index 00000000..2b2d41ed
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/AMD_compressed_ATC_texture.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface AMD_compressed_ATC_texture {
+
+ /**
+ * Accepted by the <internalformat> parameter of CompressedTexImage2D and
+ * CompressedTexImage3DOES.
+ */
+ int GL_ATC_RGB_AMD = 0x8C92,
+ GL_ATC_RGBA_EXPLICIT_ALPHA_AMD = 0x8C93,
+ GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD = 0x87EE;
+
+}
diff --git a/src/templates/org/lwjgl/opengles/AMD_performance_monitor.java b/src/templates/org/lwjgl/opengles/AMD_performance_monitor.java
new file mode 100644
index 00000000..91629c7c
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/AMD_performance_monitor.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
+
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+public interface AMD_performance_monitor {
+
+ /** Accepted by the <pame> parameter of GetPerfMonitorCounterInfoAMD */
+ int GL_COUNTER_TYPE_AMD = 0x8BC0;
+ int GL_COUNTER_RANGE_AMD = 0x8BC1;
+
+ /**
+ * Returned as a valid value in <data> parameter of
+ * GetPerfMonitorCounterInfoAMD if <pname> = COUNTER_TYPE_AMD
+ */
+ int GL_UNSIGNED_INT = 0x1405;
+ int GL_FLOAT = 0x1406;
+ int GL_UNSIGNED_INT64_AMD = 0x8BC2;
+ int GL_PERCENTAGE_AMD = 0x8BC3;
+
+ /** Accepted by the <pname> parameter of GetPerfMonitorCounterDataAMD */
+
+ int GL_PERFMON_RESULT_AVAILABLE_AMD = 0x8BC4;
+ int GL_PERFMON_RESULT_SIZE_AMD = 0x8BC5;
+ int GL_PERFMON_RESULT_AMD = 0x8BC6;
+
+ void glGetPerfMonitorGroupsAMD(@OutParameter @Check(value = "1", canBeNull = true) @GLint IntBuffer numGroups,
+ @AutoSize("groups") @GLsizei int groupsSize, @GLuint IntBuffer groups);
+
+ void glGetPerfMonitorCountersAMD(@GLuint int group,
+ @OutParameter @Check(value = "1") @GLint IntBuffer numCounters,
+ @OutParameter @Check(value = "1") @GLint IntBuffer maxActiveCounters,
+ @AutoSize("counters") @GLsizei int countersSize,
+ @GLuint IntBuffer counters);
+
+ void glGetPerfMonitorGroupStringAMD(@GLuint int group,
+ @AutoSize("groupString") @GLsizei int bufSize,
+ @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length,
+ @OutParameter @GLchar ByteBuffer groupString);
+
+ @Alternate("glGetPerfMonitorGroupStringAMD")
+ @GLreturn(value = "groupString", maxLength = "bufSize")
+ void glGetPerfMonitorGroupStringAMD2(@GLuint int group, @GLsizei int bufSize,
+ @OutParameter @GLsizei @Constant("groupString_length, 0") IntBuffer length,
+ @OutParameter @GLchar ByteBuffer groupString);
+
+ void glGetPerfMonitorCounterStringAMD(@GLuint int group, @GLuint int counter, @AutoSize("counterString") @GLsizei int bufSize,
+ @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length,
+ @OutParameter @GLchar ByteBuffer counterString);
+
+ @Alternate("glGetPerfMonitorCounterStringAMD")
+ @GLreturn(value = "counterString", maxLength = "bufSize")
+ void glGetPerfMonitorCounterStringAMD2(@GLuint int group, @GLuint int counter, @GLsizei int bufSize,
+ @OutParameter @GLsizei @Constant("counterString_length, 0") IntBuffer length,
+ @OutParameter @GLchar ByteBuffer counterString);
+
+ void glGetPerfMonitorCounterInfoAMD(@GLuint int group, @GLuint int counter, @GLenum int pname, @Check(value = "16") @GLvoid ByteBuffer data);
+
+ void glGenPerfMonitorsAMD(@AutoSize("monitors") @GLsizei int n, @OutParameter @GLuint IntBuffer monitors);
+
+ @Alternate("glGenPerfMonitorsAMD")
+ @GLreturn("monitors")
+ void glGenPerfMonitorsAMD2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer monitors);
+
+ void glDeletePerfMonitorsAMD(@AutoSize("monitors") @GLsizei int n, @GLuint IntBuffer monitors);
+
+ @Alternate("glDeletePerfMonitorsAMD")
+ void glDeletePerfMonitorsAMD(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, monitor), 0", keepParam = true) int monitor);
+
+ void glSelectPerfMonitorCountersAMD(@GLuint int monitor, boolean enable, @GLuint int group, @AutoSize("counterList") int numCounters, @GLuint IntBuffer counterList);
+
+ @Alternate("glSelectPerfMonitorCountersAMD")
+ void glSelectPerfMonitorCountersAMD(@GLuint int monitor, boolean enable, @GLuint int group, @Constant("1") int numCounters, @Constant(value = "APIUtil.getBufferInt().put(0, counter), 0", keepParam = true) int counter);
+
+ void glBeginPerfMonitorAMD(@GLuint int monitor);
+
+ void glEndPerfMonitorAMD(@GLuint int monitor);
+
+ void glGetPerfMonitorCounterDataAMD(@GLuint int monitor, @GLenum int pname, @AutoSize("data") @GLsizei int dataSize,
+ @OutParameter @GLuint IntBuffer data,
+ @OutParameter @GLint @Check(value = "1", canBeNull = true) IntBuffer bytesWritten);
+
+ @Alternate("glGetPerfMonitorCounterDataAMD")
+ @GLreturn("data")
+ void glGetPerfMonitorCounterDataAMD2(@GLuint int monitor, @GLenum int pname, @Constant("4") @GLsizei int dataSize,
+ @OutParameter @GLuint IntBuffer data,
+ @OutParameter @GLint @Constant("null, 0") IntBuffer bytesWritten);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/AMD_program_binary_Z400.java b/src/templates/org/lwjgl/opengles/AMD_program_binary_Z400.java
new file mode 100644
index 00000000..07522996
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/AMD_program_binary_Z400.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface AMD_program_binary_Z400 {
+
+ /** Accepted by the <binaryFormat> parameter of ProgramBinaryOES: */
+ int GL_Z400_BINARY_AMD = 0x8740;
+
+}
diff --git a/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_blit.java b/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_blit.java
new file mode 100644
index 00000000..ac6e9bb2
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_blit.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.opengl.GLbitfield;
+import org.lwjgl.util.generator.opengl.GLenum;
+
+public interface ANGLE_framebuffer_blit {
+
+ /**
+ * Accepted by the <target> parameter of BindFramebuffer,
+ * CheckFramebufferStatus, FramebufferTexture2D, FramebufferTexture3DOES,
+ * FramebufferRenderbuffer, and
+ * GetFramebufferAttachmentParameteriv:
+ */
+ int GL_READ_FRAMEBUFFER_ANGLE = 0x8CA8,
+ GL_DRAW_FRAMEBUFFER_ANGLE = 0x8CA9;
+
+ /** Accepted by the <pname> parameters of GetIntegerv and GetFloatv: */
+ int GL_DRAW_FRAMEBUFFER_BINDING_ANGLE = 0x8CA6, // alias FRAMEBUFFER_BINDING
+ GL_READ_FRAMEBUFFER_BINDING_ANGLE = 0x8CAA;
+
+ void glBlitFramebufferANGLE(int srcX0, int srcY0, int srcX1, int srcY1,
+ int dstX0, int dstY0, int dstX1, int dstY1,
+ @GLbitfield int mask, @GLenum int filter);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_multisample.java b/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_multisample.java
new file mode 100644
index 00000000..3f52fbf0
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_multisample.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLsizei;
+
+public interface ANGLE_framebuffer_multisample {
+
+ /** Accepted by the <pname> parameter of GetRenderbufferParameteriv: */
+ int GL_RENDERBUFFER_SAMPLES_ANGLE = 0x8CAB;
+
+ /** Returned by CheckFramebufferStatus: */
+ int GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE = 0x8D56;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
+ * and GetFloatv:
+ */
+ int GL_MAX_SAMPLES_ANGLE = 0x8D57;
+
+ void glRenderbufferStorageMultisampleANGLE(
+ @GLenum int target, @GLsizei int samples,
+ @GLenum int internalformat,
+ @GLsizei int width, @GLsizei int height);
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/APPLE_framebuffer_multisample.java b/src/templates/org/lwjgl/opengles/APPLE_framebuffer_multisample.java
new file mode 100644
index 00000000..87c53889
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/APPLE_framebuffer_multisample.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLsizei;
+
+public interface APPLE_framebuffer_multisample {
+
+ /** Accepted by the <pname> parameter of GetRenderbufferParameteriv: */
+ int GL_RENDERBUFFER_SAMPLES_APPLE = 0x8CAB;
+
+ /** Returned by CheckFramebufferStatus: */
+ int GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE = 0x8D56;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, and
+ * GetFloatv:
+ */
+ int GL_MAX_SAMPLES_APPLE = 0x8D57;
+
+ /**
+ * Accepted by the <target> parameter of BindFramebuffer,
+ * CheckFramebufferStatus, FramebufferTexture2D, FramebufferRenderbuffer, and
+ * GetFramebufferAttachmentParameteriv:
+ */
+ int GL_READ_FRAMEBUFFER_APPLE = 0x8CA8,
+ GL_DRAW_FRAMEBUFFER_APPLE = 0x8CA9;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, and
+ * GetFloatv:
+ */
+ int GL_DRAW_FRAMEBUFFER_BINDING_APPLE = 0x8CA6, // FRAMEBUFFER_BINDING
+ GL_READ_FRAMEBUFFER_BINDING_APPLE = 0x8CAA;
+
+ void glRenderbufferStorageMultisampleAPPLE(
+ @GLenum int target, @GLsizei int samples,
+ @GLenum int internalformat,
+ @GLsizei int width, @GLsizei int height);
+
+ void glResolveMultisampleFramebufferAPPLE();
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/APPLE_rgb_422.java b/src/templates/org/lwjgl/opengles/APPLE_rgb_422.java
new file mode 100644
index 00000000..ccb0a8e5
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/APPLE_rgb_422.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface APPLE_rgb_422 {
+
+ /**
+ * Accepted by the <format> parameter of DrawPixels, ReadPixels, TexImage1D,
+ * TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, TexSubImage2D,
+ * TexSubImage3D, GetHistogram, GetMinmax, ConvolutionFilter1D,
+ * ConvolutionFilter2D, GetConvolutionFilter, SeparableFilter2D,
+ * GetSeparableFilter, ColorTable, GetColorTable:
+ */
+ int GL_RGB_422_APPLE = 0x8A1F;
+
+ /**
+ * Accepted by the <type> parameter of DrawPixels, ReadPixels, TexImage1D,
+ * TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, TexSubImage2D,
+ * TexSubImage3D, GetHistogram, GetMinmax, ConvolutionFilter1D,
+ * ConvolutionFilter2D, GetConvolutionFilter, SeparableFilter2D,
+ * GetSeparableFilter, ColorTable, GetColorTable:
+ */
+ int GL_UNSIGNED_SHORT_8_8_APPLE = 0x85BA;
+ int GL_UNSIGNED_SHORT_8_8_REV_APPLE = 0x85BB;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/APPLE_texture_format_BGRA8888.java b/src/templates/org/lwjgl/opengles/APPLE_texture_format_BGRA8888.java
new file mode 100644
index 00000000..74c143bb
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/APPLE_texture_format_BGRA8888.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface APPLE_texture_format_BGRA8888 {
+
+ /** Accepted by the <format> parameters of TexImage2D and TexSubImage2D: */
+ int GL_BGRA_EXT = 0x80E1;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/APPLE_texture_max_level.java b/src/templates/org/lwjgl/opengles/APPLE_texture_max_level.java
new file mode 100644
index 00000000..e99098af
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/APPLE_texture_max_level.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface APPLE_texture_max_level {
+
+ /**
+ * Accepted by the <pname> parameter of TexParameteri, TexParameterf,
+ * TexParameteriv, TexParameterfv, GetTexParameteriv, and GetTexParameterfv:
+ */
+ int GL_TEXTURE_MAX_LEVEL_APPLE = 0x813D;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/ARB_draw_buffers.java b/src/templates/org/lwjgl/opengles/ARB_draw_buffers.java
new file mode 100644
index 00000000..1e3c864b
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/ARB_draw_buffers.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.Alternate;
+import org.lwjgl.util.generator.AutoSize;
+import org.lwjgl.util.generator.Const;
+import org.lwjgl.util.generator.Constant;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLsizei;
+
+import java.nio.IntBuffer;
+
+public interface ARB_draw_buffers {
+
+ /** Accepted by the <pname> parameters of GetIntegerv, GetFloatv: */
+ int GL_MAX_DRAW_BUFFERS_ARB = 0x8824,
+ GL_DRAW_BUFFER0_ARB = 0x8825,
+ GL_DRAW_BUFFER1_ARB = 0x8826,
+ GL_DRAW_BUFFER2_ARB = 0x8827,
+ GL_DRAW_BUFFER3_ARB = 0x8828,
+ GL_DRAW_BUFFER4_ARB = 0x8829,
+ GL_DRAW_BUFFER5_ARB = 0x882A,
+ GL_DRAW_BUFFER6_ARB = 0x882B,
+ GL_DRAW_BUFFER7_ARB = 0x882C,
+ GL_DRAW_BUFFER8_ARB = 0x882D,
+ GL_DRAW_BUFFER9_ARB = 0x882E,
+ GL_DRAW_BUFFER10_ARB = 0x882F,
+ GL_DRAW_BUFFER11_ARB = 0x8830,
+ GL_DRAW_BUFFER12_ARB = 0x8831,
+ GL_DRAW_BUFFER13_ARB = 0x8832,
+ GL_DRAW_BUFFER14_ARB = 0x8833,
+ GL_DRAW_BUFFER15_ARB = 0x8834;
+
+ void glDrawBuffersARB(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers);
+
+ @Alternate("glDrawBuffersARB")
+ void glDrawBuffersARB(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/ARB_half_float_pixel.java b/src/templates/org/lwjgl/opengles/ARB_half_float_pixel.java
new file mode 100644
index 00000000..3ec788d8
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/ARB_half_float_pixel.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface ARB_half_float_pixel {
+
+ /**
+ * Accepted by the <type> parameter of DrawPixels, ReadPixels,
+ * TexImage1D, TexImage2D, TexImage3D, GetTexImage, TexSubImage1D,
+ * TexSubImage2D, TexSubImage3D:
+ */
+ int GL_HALF_FLOAT_ARB = 0x140B;
+
+}
diff --git a/src/templates/org/lwjgl/opengles/ARB_texture_rectangle.java b/src/templates/org/lwjgl/opengles/ARB_texture_rectangle.java
new file mode 100644
index 00000000..7140d736
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/ARB_texture_rectangle.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface ARB_texture_rectangle {
+
+ /**
+ * Accepted by the <cap> parameter of Enable, Disable and IsEnabled;
+ * by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv
+ * and GetDoublev; and by the <target> parameter of BindTexture,
+ * GetTexParameterfv, GetTexParameteriv, TexParameterf, TexParameteri,
+ * TexParameterfv and TexParameteriv:
+ * Accepted by the <target> parameter of GetTexImage,
+ * GetTexLevelParameteriv, GetTexLevelParameterfv, TexImage2D,
+ * CopyTexImage2D, TexSubImage2D and CopySubTexImage2D:
+ */
+ int GL_TEXTURE_RECTANGLE_ARB = 0x84F5;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
+ * GetFloatv and GetDoublev:
+ */
+ int GL_TEXTURE_BINDING_RECTANGLE_ARB = 0x84F6;
+
+ /**
+ * Accepted by the <target> parameter of GetTexLevelParameteriv,
+ * GetTexLevelParameterfv, GetTexParameteriv and TexImage2D:
+ */
+ int GL_PROXY_TEXTURE_RECTANGLE_ARB = 0x84F7;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetDoublev,
+ * GetIntegerv and GetFloatv:
+ */
+ int GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB = 0x84F8;
+
+ /**
+ * Returned by <type> parameter of GetActiveUniform when the location
+ * <index> for program object <program> is of type sampler2DRect:
+ */
+ int GL_SAMPLER_2D_RECT_ARB = 0x8B63;
+
+ /**
+ * Returned by <type> parameter of GetActiveUniform when the location
+ * <index> for program object <program> is of type sampler2DRectShadow:
+ */
+ int GL_SAMPLER_2D_RECT_SHADOW_ARB = 0x8B64;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/ARM_mali_shader_binary.java b/src/templates/org/lwjgl/opengles/ARM_mali_shader_binary.java
new file mode 100644
index 00000000..323524bc
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/ARM_mali_shader_binary.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface ARM_mali_shader_binary {
+
+ /** Accepted by the <binaryFormat> parameter of ShaderBinary: */
+ int GL_MALI_SHADER_BINARY_ARM = 0x8F60;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/ARM_rgba8.java b/src/templates/org/lwjgl/opengles/ARM_rgba8.java
new file mode 100644
index 00000000..8b2ab4cb
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/ARM_rgba8.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface ARM_rgba8 {
+
+ /** Accepted by the <internalformat> parameter of RenderbufferStorage: */
+ int GL_RGBA8_OES = 0x8058;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/DMP_shader_binary.java b/src/templates/org/lwjgl/opengles/DMP_shader_binary.java
new file mode 100644
index 00000000..4e887ad3
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/DMP_shader_binary.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface DMP_shader_binary {
+
+ /** Accepted by the <binaryformat> parameter of ShaderBinary: */
+ int GL_SHADER_BINARY_DMP = 0x9250;
+
+}
diff --git a/src/templates/org/lwjgl/opengles/EXT_Cg_shader.java b/src/templates/org/lwjgl/opengles/EXT_Cg_shader.java
new file mode 100644
index 00000000..bb272296
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/EXT_Cg_shader.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface EXT_Cg_shader {
+
+ /**
+ * You can pass GL_CG_VERTEX_SHADER_EXT to glCreateShader instead of GL_VERTEX_SHADER to create a vertex shader
+ * that will parse and compile its shader source with the Cg compiler front-end rather than the GLSL front-end. Likewise, you
+ * can pass GL_CG_FRAGMENT_SHADER_EXT to glCreateShader instead of GL_FRAGMENT_SHADER to create a fragment shader object
+ * that will parse and compile its shader source with the Cg front-end rather than the GLSL front-end.
+ */
+ int GL_CG_VERTEX_SHADER_EXT = 0x890E,
+ GL_CG_FRAGMENT_SHADER_EXT = 0x890F;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/EXT_bgra.java b/src/templates/org/lwjgl/opengles/EXT_bgra.java
new file mode 100644
index 00000000..89d35c6e
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/EXT_bgra.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface EXT_bgra {
+
+ /**
+ * Accepted by the <format> parameter of DrawPixels, GetTexImage,
+ * ReadPixels, TexImage1D, and TexImage2D:
+ */
+ int GL_BGR_EXT = 0x80E0,
+ GL_BGRA_EXT = 0x80E1;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/EXT_blend_minmax.java b/src/templates/org/lwjgl/opengles/EXT_blend_minmax.java
new file mode 100644
index 00000000..6f6b77c7
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/EXT_blend_minmax.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.opengl.GLenum;
+
+public interface EXT_blend_minmax {
+
+ /** Accepted by the <mode> parameter of BlendEquationEXT: */
+ int GL_FUNC_ADD_EXT = 0x8006,
+ GL_MIN_EXT = 0x8007,
+ GL_MAX_EXT = 0x8008;
+
+ void glBlendEquationEXT(@GLenum int mode);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/EXT_discard_framebuffer.java b/src/templates/org/lwjgl/opengles/EXT_discard_framebuffer.java
new file mode 100644
index 00000000..a7aa2d4c
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/EXT_discard_framebuffer.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.AutoSize;
+import org.lwjgl.util.generator.Const;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLsizei;
+
+import java.nio.IntBuffer;
+
+public interface EXT_discard_framebuffer {
+
+ /**
+ * Accepted in the <attachments> parameter of DiscardFramebufferEXT when the
+ * default framebuffer is bound to <target>:
+ */
+ int GL_COLOR_EXT = 0x1800,
+ GL_DEPTH_EXT = 0x1801,
+ GL_STENCIL_EXT = 0x1802;
+
+ void glDiscardFramebufferEXT(@GLenum int target, @AutoSize("attachments") @GLsizei int numAttachments, @Const @GLenum IntBuffer attachments);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/EXT_frag_depth.java b/src/templates/org/lwjgl/opengles/EXT_frag_depth.java
new file mode 100644
index 00000000..940aee6f
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/EXT_frag_depth.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface EXT_frag_depth {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/EXT_multi_draw_arrays.java b/src/templates/org/lwjgl/opengles/EXT_multi_draw_arrays.java
new file mode 100644
index 00000000..4ebc6cbc
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/EXT_multi_draw_arrays.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.AutoSize;
+import org.lwjgl.util.generator.Check;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLint;
+import org.lwjgl.util.generator.opengl.GLsizei;
+
+import java.nio.IntBuffer;
+
+public interface EXT_multi_draw_arrays {
+
+ void glMultiDrawArraysEXT(@GLenum int mode, @GLint IntBuffer first, @Check("first.remaining()") @GLsizei IntBuffer count, @AutoSize("first") @GLsizei int primcount);
+
+ //void glMultiDrawElementsEXT(GLenum mode, GLsizei*count, GLenum type, const GLvoid**indices, GLsizei primcount)
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/EXT_packed_float.java b/src/templates/org/lwjgl/opengles/EXT_packed_float.java
new file mode 100644
index 00000000..afd6a7a5
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/EXT_packed_float.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface EXT_packed_float {
+
+ /**
+ * Accepted by the <internalformat> parameter of TexImage1D,
+ * TexImage2D, TexImage3D, CopyTexImage1D, CopyTexImage2D, and
+ * RenderbufferStorage:
+ */
+ int GL_R11F_G11F_B10F_EXT = 0x8C3A;
+
+ /**
+ * Accepted by the <type> parameter of DrawPixels, ReadPixels,
+ * TexImage1D, TexImage2D, GetTexImage, TexImage3D, TexSubImage1D,
+ * TexSubImage2D, TexSubImage3D:
+ */
+ int GL_UNSIGNED_INT_10F_11F_11F_REV_EXT = 0x8C3B;
+
+ /** Accepted by the <pname> parameters of GetIntegerv and GetFloatv: */
+ int GL_RGBA_SIGNED_COMPONENTS_EXT = 0x8C3C;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/EXT_read_format_bgra.java b/src/templates/org/lwjgl/opengles/EXT_read_format_bgra.java
new file mode 100644
index 00000000..bde3f98a
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/EXT_read_format_bgra.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface EXT_read_format_bgra {
+
+ /** Accepted by the <format> parameter of ReadPixels: */
+ int GL_BGRA_EXT = 0x80E1;
+
+ /** Accepted by the <type> parameter of ReadPixels: */
+ int GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT = 0x8365,
+ GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT = 0x8366;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/EXT_shader_texture_lod.java b/src/templates/org/lwjgl/opengles/EXT_shader_texture_lod.java
new file mode 100644
index 00000000..d67dfe1f
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/EXT_shader_texture_lod.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface EXT_shader_texture_lod {
+
+}
diff --git a/src/templates/org/lwjgl/opengles/EXT_texture_array.java b/src/templates/org/lwjgl/opengles/EXT_texture_array.java
new file mode 100644
index 00000000..9ade6e6d
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/EXT_texture_array.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLuint;
+
+public interface EXT_texture_array {
+
+ /**
+ * Accepted by the <target> parameter of TexParameteri, TexParameteriv,
+ * TexParameterf, TexParameterfv, and BindTexture:
+ */
+ int GL_TEXTURE_1D_ARRAY_EXT = 0x8C18,
+ GL_TEXTURE_2D_ARRAY_EXT = 0x8C1A;
+
+ /**
+ * Accepted by the <target> parameter of TexImage3D, TexSubImage3D,
+ * CopyTexSubImage3D, CompressedTexImage3D, and CompressedTexSubImage3D:
+ */
+ int GL_PROXY_TEXTURE_2D_ARRAY_EXT = 0x8C1B;
+
+ /**
+ * Accepted by the <target> parameter of TexImage2D, TexSubImage2D,
+ * CopyTexImage2D, CopyTexSubImage2D, CompressedTexImage2D, and
+ * CompressedTexSubImage2D:
+ */
+ int GL_PROXY_TEXTURE_1D_ARRAY_EXT = 0x8C19;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv
+ * and GetFloatv:
+ */
+ int GL_TEXTURE_BINDING_1D_ARRAY_EXT = 0x8C1C,
+ GL_TEXTURE_BINDING_2D_ARRAY_EXT = 0x8C1D,
+ GL_MAX_ARRAY_TEXTURE_LAYERS_EXT = 0x88FF;
+
+ /**
+ * Accepted by the <pname> parameter of
+ * GetFramebufferAttachmentParameterivEXT:
+ */
+ int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT = 0x8CD4;
+
+ /** Returned by the <type> parameter of GetActiveUniform: */
+ int GL_SAMPLER_1D_ARRAY_EXT = 0x8DC0,
+ GL_SAMPLER_2D_ARRAY_EXT = 0x8DC1;
+
+ 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/opengles/EXT_texture_compression_dxt1.java b/src/templates/org/lwjgl/opengles/EXT_texture_compression_dxt1.java
new file mode 100644
index 00000000..28ba3025
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/EXT_texture_compression_dxt1.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.Extension;
+
+@Extension(postfix = "EXT", className = "EXTTextureCompressionDXT1")
+public interface EXT_texture_compression_dxt1 {
+
+ /**
+ * Accepted by the <internalformat> parameter of CompressedTexImage2D
+ * and the <format> parameter of CompressedTexSubImage2D:
+ */
+ int GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0,
+ GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/EXT_texture_compression_latc.java b/src/templates/org/lwjgl/opengles/EXT_texture_compression_latc.java
new file mode 100644
index 00000000..53d8d8d1
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/EXT_texture_compression_latc.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.Extension;
+
+@Extension(postfix = "EXT", className = "EXTTextureCompressionLATC")
+public interface EXT_texture_compression_latc {
+
+ /**
+ * Accepted by the <internalformat> parameter of TexImage2D,
+ * CopyTexImage2D, and CompressedTexImage2D and the <format> parameter
+ * of CompressedTexSubImage2D:
+ */
+ int GL_COMPRESSED_LUMINANCE_LATC1_EXT = 0x8C70,
+ GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT = 0x8C71,
+ GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT = 0x8C72,
+ GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT = 0x8C73;
+
+}
diff --git a/src/templates/org/lwjgl/opengles/EXT_texture_compression_s3tc.java b/src/templates/org/lwjgl/opengles/EXT_texture_compression_s3tc.java
new file mode 100644
index 00000000..1d8e6922
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/EXT_texture_compression_s3tc.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.Extension;
+
+@Extension(postfix = "EXT", className = "EXTTextureCompressionS3TC")
+public interface EXT_texture_compression_s3tc {
+
+ /**
+ * Accepted by the <internalformat> parameter of TexImage2D, CopyTexImage2D,
+ * and CompressedTexImage2D and the <format> parameter of
+ * CompressedTexSubImage2D:
+ */
+ int GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0,
+ GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1,
+ GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2,
+ GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/EXT_texture_filter_anisotropic.java b/src/templates/org/lwjgl/opengles/EXT_texture_filter_anisotropic.java
new file mode 100644
index 00000000..86f84ce8
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/EXT_texture_filter_anisotropic.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface EXT_texture_filter_anisotropic {
+
+ /**
+ * Accepted by the <pname> parameters of GetTexParameterfv,
+ * GetTexParameteriv, TexParameterf, TexParameterfv, TexParameteri,
+ * and TexParameteriv:
+ */
+ int GL_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE;
+
+ /**
+ * Accepted by the <pname> parameters of GetBooleanv,
+ * GetFloatv, and GetIntegerv:
+ */
+ int GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/EXT_texture_format_BGRA8888.java b/src/templates/org/lwjgl/opengles/EXT_texture_format_BGRA8888.java
new file mode 100644
index 00000000..1bebe846
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/EXT_texture_format_BGRA8888.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface EXT_texture_format_BGRA8888 {
+
+ /**
+ * Accepted by the <format> and <internalformat> parameters of TexImage2D
+ * and the <format> parameter of TexSubImage2D:
+ */
+ int GL_BGRA_EXT = 0x80E1;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/EXT_texture_lod_bias.java b/src/templates/org/lwjgl/opengles/EXT_texture_lod_bias.java
new file mode 100644
index 00000000..55734842
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/EXT_texture_lod_bias.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.Extension;
+
+@Extension(postfix = "EXT", className = "EXTTextureLODBias")
+public interface EXT_texture_lod_bias {
+
+ /**
+ * Accepted by the <target> parameters of GetTexEnvfv, GetTexEnviv,
+ * TexEnvi, TexEnvf, Texenviv, and TexEnvfv:
+ */
+ int GL_TEXTURE_FILTER_CONTROL_EXT = 0x8500;
+
+ /**
+ * When the <target> parameter of GetTexEnvfv, GetTexEnviv, TexEnvi,
+ * TexEnvf, TexEnviv, and TexEnvfv is TEXTURE_FILTER_CONTROL_EXT, then
+ * the value of <pname> may be:
+ */
+ int GL_TEXTURE_LOD_BIAS_EXT = 0x8501;
+
+ /**
+ * Accepted by the <pname> parameters of GetBooleanv, GetIntegerv,
+ * GetFloatv, and GetDoublev:
+ */
+ int GL_MAX_TEXTURE_LOD_BIAS_EXT = 0x84FD;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/EXT_texture_type_2_10_10_10_REV.java b/src/templates/org/lwjgl/opengles/EXT_texture_type_2_10_10_10_REV.java
new file mode 100644
index 00000000..fa384245
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/EXT_texture_type_2_10_10_10_REV.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface EXT_texture_type_2_10_10_10_REV {
+
+ /** Accepted by the <type> parameter of TexImage2D and TexImage3D: */
+ int GL_UNSIGNED_INT_2_10_10_10_REV_EXT = 0x8368;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/GLES20.java b/src/templates/org/lwjgl/opengles/GLES20.java
new file mode 100644
index 00000000..ae705d2d
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/GLES20.java
@@ -0,0 +1,1010 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.*;
+
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+
+public interface GLES20 {
+
+ /** ClearBufferMask */
+ int GL_DEPTH_BUFFER_BIT = 0x00000100,
+ GL_STENCIL_BUFFER_BIT = 0x00000400,
+ GL_COLOR_BUFFER_BIT = 0x00004000;
+
+ /** Boolean */
+ int GL_FALSE = 0,
+ GL_TRUE = 1;
+
+ /** BeginMode */
+ int GL_POINTS = 0x0000,
+ GL_LINES = 0x0001,
+ GL_LINE_LOOP = 0x0002,
+ GL_LINE_STRIP = 0x0003,
+ GL_TRIANGLES = 0x0004,
+ GL_TRIANGLE_STRIP = 0x0005,
+ GL_TRIANGLE_FAN = 0x0006;
+
+ /** BlendingFactorDest */
+ int GL_ZERO = 0,
+ GL_ONE = 1,
+ GL_SRC_COLOR = 0x0300,
+ GL_ONE_MINUS_SRC_COLOR = 0x0301,
+ GL_SRC_ALPHA = 0x0302,
+ GL_ONE_MINUS_SRC_ALPHA = 0x0303,
+ GL_DST_ALPHA = 0x0304,
+ GL_ONE_MINUS_DST_ALPHA = 0x0305;
+
+ /** BlendingFactorSrc */
+ int
+/* GL_ZERO */
+/* GL_ONE */
+ GL_DST_COLOR = 0x0306,
+ GL_ONE_MINUS_DST_COLOR = 0x0307,
+ GL_SRC_ALPHA_SATURATE = 0x0308;
+/* GL_SRC_ALPHA */
+/* GL_ONE_MINUS_SRC_ALPHA */
+/* GL_DST_ALPHA */
+/* GL_ONE_MINUS_DST_ALPHA */
+
+ /** BlendEquationSeparate */
+ int GL_FUNC_ADD = 0x8006,
+ GL_BLEND_EQUATION = 0x8009,
+ GL_BLEND_EQUATION_RGB = 0x8009, /* same as BLEND_EQUATION */
+ GL_BLEND_EQUATION_ALPHA = 0x883D;
+
+ /** BlendSubtract */
+ int GL_FUNC_SUBTRACT = 0x800A,
+ GL_FUNC_REVERSE_SUBTRACT = 0x800B;
+
+ /** Separate Blend Functions */
+ int GL_BLEND_DST_RGB = 0x80C8,
+ GL_BLEND_SRC_RGB = 0x80C9,
+ GL_BLEND_DST_ALPHA = 0x80CA,
+ GL_BLEND_SRC_ALPHA = 0x80CB,
+ GL_CONSTANT_COLOR = 0x8001,
+ GL_ONE_MINUS_CONSTANT_COLOR = 0x8002,
+ GL_CONSTANT_ALPHA = 0x8003,
+ GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004,
+ GL_BLEND_COLOR = 0x8005;
+
+ /** Buffer Objects */
+ int GL_ARRAY_BUFFER = 0x8892,
+ GL_ELEMENT_ARRAY_BUFFER = 0x8893,
+ GL_ARRAY_BUFFER_BINDING = 0x8894,
+ GL_ELEMENT_ARRAY_BUFFER_BINDING = 0x8895,
+ GL_STREAM_DRAW = 0x88E0,
+ GL_STATIC_DRAW = 0x88E4,
+ GL_DYNAMIC_DRAW = 0x88E8,
+ GL_BUFFER_SIZE = 0x8764,
+ GL_BUFFER_USAGE = 0x8765,
+ GL_CURRENT_VERTEX_ATTRIB = 0x8626;
+
+ /** CullFaceMode */
+ int GL_FRONT = 0x0404,
+ GL_BACK = 0x0405,
+ GL_FRONT_AND_BACK = 0x0408;
+
+/** DepthFunction */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+ /** EnableCap */
+ int GL_TEXTURE_2D = 0x0DE1,
+ GL_CULL_FACE = 0x0B44,
+ GL_BLEND = 0x0BE2,
+ GL_DITHER = 0x0BD0,
+ GL_STENCIL_TEST = 0x0B90,
+ GL_DEPTH_TEST = 0x0B71,
+ GL_SCISSOR_TEST = 0x0C11,
+ GL_POLYGON_OFFSET_FILL = 0x8037,
+ GL_SAMPLE_ALPHA_TO_COVERAGE = 0x809E,
+ GL_SAMPLE_COVERAGE = 0x80A0;
+
+ /** ErrorCode */
+ int GL_NO_ERROR = 0,
+ GL_INVALID_ENUM = 0x0500,
+ GL_INVALID_VALUE = 0x0501,
+ GL_INVALID_OPERATION = 0x0502,
+ GL_OUT_OF_MEMORY = 0x0505;
+
+ /** FrontFaceDirection */
+ int GL_CW = 0x0900,
+ GL_CCW = 0x0901;
+
+ /** GetPName */
+ int GL_LINE_WIDTH = 0x0B21,
+ GL_ALIASED_POINT_SIZE_RANGE = 0x846D,
+ GL_ALIASED_LINE_WIDTH_RANGE = 0x846E,
+ GL_CULL_FACE_MODE = 0x0B45,
+ GL_FRONT_FACE = 0x0B46,
+ GL_DEPTH_RANGE = 0x0B70,
+ GL_DEPTH_WRITEMASK = 0x0B72,
+ GL_DEPTH_CLEAR_VALUE = 0x0B73,
+ GL_DEPTH_FUNC = 0x0B74,
+ GL_STENCIL_CLEAR_VALUE = 0x0B91,
+ GL_STENCIL_FUNC = 0x0B92,
+ GL_STENCIL_FAIL = 0x0B94,
+ GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95,
+ GL_STENCIL_PASS_DEPTH_PASS = 0x0B96,
+ GL_STENCIL_REF = 0x0B97,
+ GL_STENCIL_VALUE_MASK = 0x0B93,
+ GL_STENCIL_WRITEMASK = 0x0B98,
+ GL_STENCIL_BACK_FUNC = 0x8800,
+ GL_STENCIL_BACK_FAIL = 0x8801,
+ GL_STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802,
+ GL_STENCIL_BACK_PASS_DEPTH_PASS = 0x8803,
+ GL_STENCIL_BACK_REF = 0x8CA3,
+ GL_STENCIL_BACK_VALUE_MASK = 0x8CA4,
+ GL_STENCIL_BACK_WRITEMASK = 0x8CA5,
+ GL_VIEWPORT = 0x0BA2,
+ GL_SCISSOR_BOX = 0x0C10,
+ /* GL_SCISSOR_TEST */
+ GL_COLOR_CLEAR_VALUE = 0x0C22,
+ GL_COLOR_WRITEMASK = 0x0C23,
+ GL_UNPACK_ALIGNMENT = 0x0CF5,
+ GL_PACK_ALIGNMENT = 0x0D05,
+ GL_MAX_TEXTURE_SIZE = 0x0D33,
+ GL_MAX_VIEWPORT_DIMS = 0x0D3A,
+ GL_SUBPIXEL_BITS = 0x0D50,
+ GL_RED_BITS = 0x0D52,
+ GL_GREEN_BITS = 0x0D53,
+ GL_BLUE_BITS = 0x0D54,
+ GL_ALPHA_BITS = 0x0D55,
+ GL_DEPTH_BITS = 0x0D56,
+ GL_STENCIL_BITS = 0x0D57,
+ GL_POLYGON_OFFSET_UNITS = 0x2A00,
+ /* GL_POLYGON_OFFSET_FILL */
+ GL_POLYGON_OFFSET_FACTOR = 0x8038,
+ GL_TEXTURE_BINDING_2D = 0x8069,
+ GL_SAMPLE_BUFFERS = 0x80A8,
+ GL_SAMPLES = 0x80A9,
+ GL_SAMPLE_COVERAGE_VALUE = 0x80AA,
+ GL_SAMPLE_COVERAGE_INVERT = 0x80AB;
+
+ /** GetTextureParameter */
+ int
+/* GL_TEXTURE_MAG_FILTER */
+/* GL_TEXTURE_MIN_FILTER */
+/* GL_TEXTURE_WRAP_S */
+/* GL_TEXTURE_WRAP_T */
+ GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2,
+ GL_COMPRESSED_TEXTURE_FORMATS = 0x86A3;
+
+ /** HintMode */
+ int GL_DONT_CARE = 0x1100,
+ GL_FASTEST = 0x1101,
+ GL_NICEST = 0x1102;
+
+ /** HintTarget */
+ int GL_GENERATE_MIPMAP_HINT = 0x8192;
+
+ /** DataType */
+ int GL_BYTE = 0x1400,
+ GL_UNSIGNED_BYTE = 0x1401,
+ GL_SHORT = 0x1402,
+ GL_UNSIGNED_SHORT = 0x1403,
+ GL_INT = 0x1404,
+ GL_UNSIGNED_INT = 0x1405,
+ GL_FLOAT = 0x1406,
+ GL_FIXED = 0x140C;
+
+ /** PixelFormat */
+ int GL_DEPTH_COMPONENT = 0x1902,
+ GL_ALPHA = 0x1906,
+ GL_RGB = 0x1907,
+ GL_RGBA = 0x1908,
+ GL_LUMINANCE = 0x1909,
+ GL_LUMINANCE_ALPHA = 0x190A;
+
+ /** PixelType */
+ int
+/* GL_UNSIGNED_BYTE */
+ GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033,
+ GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034,
+ GL_UNSIGNED_SHORT_5_6_5 = 0x8363;
+
+ /** Shaders */
+ int GL_FRAGMENT_SHADER = 0x8B30,
+ GL_VERTEX_SHADER = 0x8B31,
+ GL_MAX_VERTEX_ATTRIBS = 0x8869,
+ GL_MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB,
+ GL_MAX_VARYING_VECTORS = 0x8DFC,
+ GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D,
+ GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C,
+ GL_MAX_TEXTURE_IMAGE_UNITS = 0x8872,
+ GL_MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD,
+ GL_SHADER_TYPE = 0x8B4F,
+ GL_DELETE_STATUS = 0x8B80,
+ GL_LINK_STATUS = 0x8B82,
+ GL_VALIDATE_STATUS = 0x8B83,
+ GL_ATTACHED_SHADERS = 0x8B85,
+ GL_ACTIVE_UNIFORMS = 0x8B86,
+ GL_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87,
+ GL_ACTIVE_ATTRIBUTES = 0x8B89,
+ GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A,
+ GL_SHADING_LANGUAGE_VERSION = 0x8B8C,
+ GL_CURRENT_PROGRAM = 0x8B8D;
+
+ /** StencilFunction */
+ int GL_NEVER = 0x0200,
+ GL_LESS = 0x0201,
+ GL_EQUAL = 0x0202,
+ GL_LEQUAL = 0x0203,
+ GL_GREATER = 0x0204,
+ GL_NOTEQUAL = 0x0205,
+ GL_GEQUAL = 0x0206,
+ GL_ALWAYS = 0x0207;
+
+ /** StencilOp */
+ int
+/* GL_ZERO */
+ GL_KEEP = 0x1E00,
+ GL_REPLACE = 0x1E01,
+ GL_INCR = 0x1E02,
+ GL_DECR = 0x1E03,
+ GL_INVERT = 0x150A,
+ GL_INCR_WRAP = 0x8507,
+ GL_DECR_WRAP = 0x8508;
+
+ /** StringName */
+ int GL_VENDOR = 0x1F00,
+ GL_RENDERER = 0x1F01,
+ GL_VERSION = 0x1F02,
+ GL_EXTENSIONS = 0x1F03;
+
+ /** TextureMagFilter */
+ int GL_NEAREST = 0x2600,
+ GL_LINEAR = 0x2601;
+
+ /** TextureMinFilter */
+ int
+/* GL_NEAREST */
+/* GL_LINEAR */
+ GL_NEAREST_MIPMAP_NEAREST = 0x2700,
+ GL_LINEAR_MIPMAP_NEAREST = 0x2701,
+ GL_NEAREST_MIPMAP_LINEAR = 0x2702,
+ GL_LINEAR_MIPMAP_LINEAR = 0x2703;
+
+ /** TextureParameterName */
+ int GL_TEXTURE_MAG_FILTER = 0x2800,
+ GL_TEXTURE_MIN_FILTER = 0x2801,
+ GL_TEXTURE_WRAP_S = 0x2802,
+ GL_TEXTURE_WRAP_T = 0x2803;
+
+ /** TextureTarget */
+ int
+/* GL_TEXTURE_2D */
+ GL_TEXTURE = 0x1702,
+ GL_TEXTURE_CUBE_MAP = 0x8513,
+ GL_TEXTURE_BINDING_CUBE_MAP = 0x8514,
+ GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515,
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516,
+ GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517,
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518,
+ GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519,
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A,
+ GL_MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C;
+
+ /** TextureUnit */
+ int GL_TEXTURE0 = 0x84C0,
+ GL_TEXTURE1 = 0x84C1,
+ GL_TEXTURE2 = 0x84C2,
+ GL_TEXTURE3 = 0x84C3,
+ GL_TEXTURE4 = 0x84C4,
+ GL_TEXTURE5 = 0x84C5,
+ GL_TEXTURE6 = 0x84C6,
+ GL_TEXTURE7 = 0x84C7,
+ GL_TEXTURE8 = 0x84C8,
+ GL_TEXTURE9 = 0x84C9,
+ GL_TEXTURE10 = 0x84CA,
+ GL_TEXTURE11 = 0x84CB,
+ GL_TEXTURE12 = 0x84CC,
+ GL_TEXTURE13 = 0x84CD,
+ GL_TEXTURE14 = 0x84CE,
+ GL_TEXTURE15 = 0x84CF,
+ GL_TEXTURE16 = 0x84D0,
+ GL_TEXTURE17 = 0x84D1,
+ GL_TEXTURE18 = 0x84D2,
+ GL_TEXTURE19 = 0x84D3,
+ GL_TEXTURE20 = 0x84D4,
+ GL_TEXTURE21 = 0x84D5,
+ GL_TEXTURE22 = 0x84D6,
+ GL_TEXTURE23 = 0x84D7,
+ GL_TEXTURE24 = 0x84D8,
+ GL_TEXTURE25 = 0x84D9,
+ GL_TEXTURE26 = 0x84DA,
+ GL_TEXTURE27 = 0x84DB,
+ GL_TEXTURE28 = 0x84DC,
+ GL_TEXTURE29 = 0x84DD,
+ GL_TEXTURE30 = 0x84DE,
+ GL_TEXTURE31 = 0x84DF,
+ GL_ACTIVE_TEXTURE = 0x84E0;
+
+ /** TextureWrapMode */
+ int GL_REPEAT = 0x2901,
+ GL_CLAMP_TO_EDGE = 0x812F,
+ GL_MIRRORED_REPEAT = 0x8370;
+
+ /** Uniform Types */
+ int GL_FLOAT_VEC2 = 0x8B50,
+ GL_FLOAT_VEC3 = 0x8B51,
+ GL_FLOAT_VEC4 = 0x8B52,
+ GL_INT_VEC2 = 0x8B53,
+ GL_INT_VEC3 = 0x8B54,
+ GL_INT_VEC4 = 0x8B55,
+ GL_BOOL = 0x8B56,
+ GL_BOOL_VEC2 = 0x8B57,
+ GL_BOOL_VEC3 = 0x8B58,
+ GL_BOOL_VEC4 = 0x8B59,
+ GL_FLOAT_MAT2 = 0x8B5A,
+ GL_FLOAT_MAT3 = 0x8B5B,
+ GL_FLOAT_MAT4 = 0x8B5C,
+ GL_SAMPLER_2D = 0x8B5E,
+ GL_SAMPLER_CUBE = 0x8B60;
+
+ /** Vertex Arrays */
+ int GL_VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622,
+ GL_VERTEX_ATTRIB_ARRAY_SIZE = 0x8623,
+ GL_VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624,
+ GL_VERTEX_ATTRIB_ARRAY_TYPE = 0x8625,
+ GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A,
+ GL_VERTEX_ATTRIB_ARRAY_POINTER = 0x8645,
+ GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;
+
+ /** Read Format */
+ int GL_IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A,
+ GL_IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B;
+
+ /** Shader Source */
+ int GL_COMPILE_STATUS = 0x8B81,
+ GL_INFO_LOG_LENGTH = 0x8B84,
+ GL_SHADER_SOURCE_LENGTH = 0x8B88,
+ GL_SHADER_COMPILER = 0x8DFA;
+
+ /** Shader Binary */
+ int GL_SHADER_BINARY_FORMATS = 0x8DF8,
+ GL_NUM_SHADER_BINARY_FORMATS = 0x8DF9;
+
+ /** Shader Precision-Specified Types */
+ 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;
+
+ /** Framebuffer Object. */
+ int GL_FRAMEBUFFER = 0x8D40,
+ GL_RENDERBUFFER = 0x8D41,
+ GL_RGBA4 = 0x8056,
+ GL_RGB5_A1 = 0x8057,
+ GL_RGB565 = 0x8D62,
+ GL_DEPTH_COMPONENT16 = 0x81A5,
+ GL_STENCIL_INDEX = 0x1901,
+ GL_STENCIL_INDEX8 = 0x8D48,
+ GL_RENDERBUFFER_WIDTH = 0x8D42,
+ GL_RENDERBUFFER_HEIGHT = 0x8D43,
+ GL_RENDERBUFFER_INTERNAL_FORMAT = 0x8D44,
+ GL_RENDERBUFFER_RED_SIZE = 0x8D50,
+ GL_RENDERBUFFER_GREEN_SIZE = 0x8D51,
+ GL_RENDERBUFFER_BLUE_SIZE = 0x8D52,
+ GL_RENDERBUFFER_ALPHA_SIZE = 0x8D53,
+ GL_RENDERBUFFER_DEPTH_SIZE = 0x8D54,
+ GL_RENDERBUFFER_STENCIL_SIZE = 0x8D55,
+ GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0,
+ GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1,
+ GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2,
+ GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3,
+ GL_COLOR_ATTACHMENT0 = 0x8CE0,
+ GL_DEPTH_ATTACHMENT = 0x8D00,
+ GL_STENCIL_ATTACHMENT = 0x8D20,
+ GL_NONE = 0,
+ GL_FRAMEBUFFER_COMPLETE = 0x8CD5,
+ GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6,
+ GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7,
+ GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9,
+ GL_FRAMEBUFFER_UNSUPPORTED = 0x8CDD,
+ GL_FRAMEBUFFER_BINDING = 0x8CA6,
+ GL_RENDERBUFFER_BINDING = 0x8CA7,
+ GL_MAX_RENDERBUFFER_SIZE = 0x84E8,
+ GL_INVALID_FRAMEBUFFER_OPERATION = 0x0506;
+
+ void glActiveTexture(@GLenum int texture);
+
+ void glAttachShader(@GLuint int program, @GLuint int shader);
+
+ void glBindAttribLocation(@GLuint int program, @GLuint int index, @NullTerminated @Const @GLchar ByteBuffer name);
+
+ @Alternate("glBindAttribLocation")
+ void glBindAttribLocation(@GLuint int program, @GLuint int index, @NullTerminated CharSequence name);
+
+ @Code(" StateTracker.bindBuffer(target, buffer);")
+ void glBindBuffer(@GLenum int target, @GLuint int buffer);
+
+ void glBindFramebuffer(@GLenum int target, @GLuint int framebuffer);
+
+ void glBindRenderbuffer(@GLenum int target, @GLuint int renderbuffer);
+
+ void glBindTexture(@GLenum int target, @GLuint int texture);
+
+ void glBlendColor(@GLclampf float red, @GLclampf float green, @GLclampf float blue, @GLclampf float alpha);
+
+ void glBlendEquation(@GLenum int mode);
+
+ void glBlendEquationSeparate(@GLenum int modeRGB, @GLenum int modeAlpha);
+
+ void glBlendFunc(@GLenum int sfactor, @GLenum int dfactor);
+
+ void glBlendFuncSeparate(@GLenum int srcRGB, @GLenum int dstRGB, @GLenum int srcAlpha, @GLenum int dstAlpha);
+
+ @GenerateAutos
+ void glBufferData(@GLenum int target, @AutoSize("data") @GLsizeiptr long size,
+ @Const @GLbyte @GLshort @GLint @GLfloat Buffer data, @GLenum int usage);
+
+ void glBufferSubData(@GLenum int target, @GLintptr long offset, @AutoSize("data") @GLsizeiptr long size,
+ @Check @Const @GLbyte @GLshort @GLint @GLfloat Buffer data);
+
+ @GLenum
+ int glCheckFramebufferStatus(@GLenum int target);
+
+ void glClear(@GLbitfield int mask);
+
+ void glClearColor(@GLclampf float red, @GLclampf float green, @GLclampf float blue, @GLclampf float alpha);
+
+ void glClearDepthf(@GLclampf float depth);
+
+ void glClearStencil(@GLint int s);
+
+ void glColorMask(@GLboolean boolean red, @GLboolean boolean green, @GLboolean boolean blue, @GLboolean boolean alpha);
+
+ void glCompileShader(@GLuint int shader);
+
+ void glCompressedTexImage2D(@GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, int border, @AutoSize("data") @GLsizei int imageSize,
+ @Check @Const @GLvoid ByteBuffer data);
+
+ void glCompressedTexSubImage2D(@GLenum int target, int level, int xoffset, int yoffset, @GLsizei int width, @GLsizei int height, @GLenum int format, @AutoSize("data") @GLsizei int imageSize,
+ @Check @Const @GLvoid ByteBuffer data);
+
+ void glCopyTexImage2D(@GLenum int target, @GLint int level, @GLenum int internalformat, @GLint int x, @GLint int y, @GLsizei int width, @GLsizei int height, @GLint int border);
+
+ void glCopyTexSubImage2D(@GLenum int target, @GLint int level, @GLint int xoffset, @GLint int yoffset, @GLint int x, @GLint int y, @GLsizei int width, @GLsizei int height);
+
+ @GLuint
+ int glCreateProgram();
+
+ @GLuint
+ int glCreateShader(@GLenum int type);
+
+ void glCullFace(@GLenum int mode);
+
+ void glDeleteBuffers(@AutoSize("buffers") @GLsizei int n, @Const @GLuint IntBuffer buffers);
+
+ @Alternate("glDeleteBuffers")
+ void glDeleteBuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
+
+ void glDeleteFramebuffers(@AutoSize("framebuffers") int n, @Const @GLuint IntBuffer framebuffers);
+
+ @Alternate("glDeleteFramebuffers")
+ void glDeleteFramebuffers(@Constant("1") int n, @Constant(value = "APIUtil.getBufferInt().put(0, framebuffer), 0", keepParam = true) int framebuffer);
+
+ void glDeleteProgram(@GLuint int program);
+
+ void glDeleteRenderbuffers(@AutoSize("renderbuffers") int n, @Const @GLuint IntBuffer renderbuffers);
+
+ @Alternate("glDeleteRenderbuffers")
+ void glDeleteRenderbuffers(@Constant("1") int n, @Constant(value = "APIUtil.getBufferInt().put(0, renderbuffer), 0", keepParam = true) int renderbuffer);
+
+ void glDeleteShader(@GLuint int shader);
+
+ void glDeleteTextures(@AutoSize("textures") @GLsizei int n, @Const @GLuint IntBuffer textures);
+
+ @Alternate("glDeleteTextures")
+ void glDeleteTextures(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, texture), 0", keepParam = true) int texture);
+
+ void glDepthFunc(@GLenum int func);
+
+ void glDepthMask(@GLboolean boolean flag);
+
+ void glDepthRangef(@GLclampf float zNear, @GLclampf float zFar);
+
+ void glDetachShader(@GLuint int program, @GLuint int shader);
+
+ void glDisable(@GLenum int cap);
+
+ void glDisableVertexAttribArray(@GLuint int index);
+
+ void glDrawArrays(@GLenum int mode, @GLint int first, @GLsizei int count);
+
+ void glDrawElements(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type,
+ @BufferObject(BufferKind.ElementVBO) @Const @GLubyte @GLushort @GLuint Buffer indices);
+
+ void glEnable(@GLenum int cap);
+
+ void glEnableVertexAttribArray(@GLuint int index);
+
+ void glFinish();
+
+ void glFlush();
+
+ void glFramebufferRenderbuffer(@GLenum int target, @GLenum int attachment, @GLenum int renderbuffertarget, @GLuint int renderbuffer);
+
+ void glFramebufferTexture2D(@GLenum int target, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, @GLint int level);
+
+ void glFrontFace(@GLenum int mode);
+
+ void glGenBuffers(@AutoSize("buffers") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers);
+
+ @Alternate("glGenBuffers")
+ @GLreturn("buffers")
+ void glGenBuffers2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers);
+
+ void glGenerateMipmap(@GLenum int target);
+
+ void glGenFramebuffers(@AutoSize("framebuffers") int n, @OutParameter @GLuint IntBuffer framebuffers);
+
+ @Alternate("glGenFramebuffers")
+ @GLreturn("framebuffers")
+ void glGenFramebuffers2(@Constant("1") int n, @OutParameter @GLuint IntBuffer framebuffers);
+
+ void glGenRenderbuffers(@AutoSize("renderbuffers") int n, @OutParameter @GLuint IntBuffer renderbuffers);
+
+ @Alternate("glGenRenderbuffers")
+ @GLreturn("renderbuffers")
+ void glGenRenderbuffers2(@Constant("1") int n, @OutParameter @GLuint IntBuffer renderbuffers);
+
+ void glGenTextures(@AutoSize("textures") @GLsizei int n, @OutParameter @GLuint IntBuffer textures);
+
+ @Alternate("glGenTextures")
+ @GLreturn("textures")
+ void glGenTextures2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer textures);
+
+ void glGetActiveAttrib(@GLuint int program, @GLuint int index, @AutoSize("name") @GLsizei int bufsize,
+ @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length,
+ @OutParameter @Check("1") IntBuffer size,
+ @OutParameter @Check("1") @GLenum IntBuffer type,
+ @OutParameter @GLchar ByteBuffer name);
+
+ /** Overloads glGetActiveAttrib. This version returns both size and type in the sizeType buffer (at .position() and .position() + 1). */
+ @Alternate("glGetActiveAttrib")
+ @GLreturn(value = "name", maxLength = "bufsize")
+ void glGetActiveAttrib2(@GLuint int program, @GLuint int index, @GLsizei int bufsize,
+ @OutParameter @Constant("name_length, 0") @GLsizei IntBuffer length,
+ @OutParameter @Check("2") IntBuffer sizeType,
+ @OutParameter @Constant("sizeType, sizeType.position() + 1") @GLenum IntBuffer type,
+ @OutParameter @GLchar ByteBuffer name);
+
+ /** Overloads glGetActiveAttrib. This version returns only the attrib name. */
+ @Alternate(value = "glGetActiveAttrib", javaAlt = true)
+ @GLreturn(value = "name", maxLength = "bufsize")
+ void glGetActiveAttrib(@GLuint int program, @GLuint int index, @GLsizei int bufsize,
+ @OutParameter @GLsizei @Constant("name_length, 0, APIUtil.getBufferInt(), 0, APIUtil.getBufferInt(), 1") IntBuffer length,
+ @OutParameter @GLchar ByteBuffer name);
+
+ /** Overloads glGetActiveAttrib. This version returns only the attrib size. */
+ @Alternate(value = "glGetActiveAttrib", javaAlt = true)
+ @GLreturn(value = "size")
+ void glGetActiveAttribSize(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int bufsize,
+ @OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
+ @OutParameter IntBuffer size,
+ @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore
+ @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
+
+ /** Overloads glGetActiveAttrib. This version returns only the attrib type. */
+ @Alternate(value = "glGetActiveAttrib", javaAlt = true)
+ @GLreturn(value = "type")
+ void glGetActiveAttribType(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int bufsize,
+ @OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
+ @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore
+ @OutParameter @GLenum IntBuffer type,
+ @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
+
+ void glGetActiveUniform(@GLuint int program, @GLuint int index, @AutoSize("name") @GLsizei int bufsize,
+ @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length,
+ @OutParameter @Check("1") @GLsizei IntBuffer size,
+ @OutParameter @Check("1") @GLenum IntBuffer type,
+ @OutParameter @GLchar ByteBuffer name);
+
+ /** Overloads glGetActiveUniform. This version returns both size and type in the sizeType buffer (at .position() and .position() + 1). */
+ @Alternate("glGetActiveUniform")
+ @GLreturn(value = "name", maxLength = "bufsize")
+ void glGetActiveUniform2(@GLuint int program, @GLuint int index, @GLsizei int bufsize,
+ @OutParameter @Constant("name_length, 0") @GLsizei IntBuffer length,
+ @OutParameter @Check("2") IntBuffer sizeType,
+ @OutParameter @Constant("sizeType, sizeType.position() + 1") @GLenum IntBuffer type,
+ @OutParameter @GLchar ByteBuffer name);
+
+ /** Overloads glGetActiveUniformARB. This version returns only the uniform name. */
+ @Alternate(value = "glGetActiveUniform", javaAlt = true)
+ @GLreturn(value = "name", maxLength = "bufsize")
+ void glGetActiveUniform(@GLuint int program, @GLuint int index, @GLsizei int bufsize,
+ @OutParameter @GLsizei @Constant("name_length, 0, APIUtil.getBufferInt(), 0, APIUtil.getBufferInt(), 1") IntBuffer length,
+ @OutParameter @GLchar ByteBuffer name);
+
+ /** Overloads glGetActiveUniform. This version returns only the uniform size. */
+ @Alternate(value = "glGetActiveUniform", javaAlt = true)
+ @GLreturn(value = "size")
+ void glGetActiveUniformSize(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int bufsize,
+ @OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
+ @OutParameter IntBuffer size,
+ @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore
+ @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
+
+ /** Overloads glGetActiveUniform. This version returns only the uniform type. */
+ @Alternate(value = "glGetActiveUniform", javaAlt = true)
+ @GLreturn(value = "type")
+ void glGetActiveUniformType(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int bufsize,
+ @OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
+ @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore
+ @OutParameter @GLenum IntBuffer type,
+ @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
+
+ void glGetAttachedShaders(@GLuint int program, @AutoSize("shaders") @GLsizei int maxCount,
+ @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer count,
+ @OutParameter @GLuint IntBuffer shaders);
+
+ int glGetAttribLocation(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name);
+
+ @Alternate("glGetAttribLocation")
+ int glGetAttribLocation(@GLuint int program, @NullTerminated CharSequence name);
+
+ @StripPostfix("params")
+ void glGetBooleanv(@GLenum int pname, @OutParameter @Check("1") @GLboolean ByteBuffer params);
+
+ @Alternate("glGetBooleanv")
+ @GLreturn("params")
+ @StripPostfix("params")
+ void glGetBooleanv2(@GLenum int pname, @OutParameter @GLboolean ByteBuffer params);
+
+ @StripPostfix("params")
+ void glGetBufferParameteriv(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") IntBuffer params);
+
+ @Alternate("glGetBufferParameteriv")
+ @GLreturn("params")
+ @StripPostfix("params")
+ void glGetBufferParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params);
+
+ @NoErrorCheck
+ @GLenum
+ int glGetError();
+
+ @StripPostfix("params")
+ void glGetFloatv(@GLenum int pname, @OutParameter @Check("1") FloatBuffer params);
+
+ @Alternate("glGetFloatv")
+ @GLreturn("params")
+ @StripPostfix("params")
+ void glGetFloatv2(@GLenum int pname, @OutParameter FloatBuffer params);
+
+ @StripPostfix("params")
+ void glGetFramebufferAttachmentParameteriv(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter @Check("1") IntBuffer params);
+
+ @Alternate("glGetFramebufferAttachmentParameteriv")
+ @GLreturn("params")
+ @StripPostfix("params")
+ void glGetFramebufferAttachmentParameteriv2(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter IntBuffer params);
+
+ @StripPostfix("params")
+ void glGetIntegerv(@GLenum int pname, @OutParameter @Check("1") IntBuffer params);
+
+ @Alternate("glGetIntegerv")
+ @GLreturn("params")
+ @StripPostfix("params")
+ void glGetIntegerv2(@GLenum int pname, @OutParameter IntBuffer params);
+
+ @StripPostfix("params")
+ void glGetProgramiv(@GLuint int program, @GLenum int pname, @OutParameter @Check("1") IntBuffer params);
+
+ @Alternate("glGetProgramiv")
+ @GLreturn("params")
+ @StripPostfix("params")
+ void glGetProgramiv2(@GLuint int program, @GLenum int pname, @OutParameter IntBuffer params);
+
+ void glGetProgramInfoLog(@GLuint int program, @AutoSize("infoLog") @GLsizei int bufsize,
+ @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length,
+ @OutParameter @GLchar ByteBuffer infoLog);
+
+ @Alternate("glGetProgramInfoLog")
+ @GLreturn(value = "infoLog", maxLength = "bufsize")
+ void glGetProgramInfoLog2(@GLuint int program, @GLsizei int bufsize,
+ @OutParameter @GLsizei @Constant("infoLog_length, 0") IntBuffer length,
+ @OutParameter @GLchar ByteBuffer infoLog);
+
+ @StripPostfix("params")
+ void glGetRenderbufferParameteriv(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") IntBuffer params);
+
+ @Alternate("glGetRenderbufferParameteriv")
+ @GLreturn("params")
+ @StripPostfix("params")
+ void glGetRenderbufferParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params);
+
+ @StripPostfix("params")
+ void glGetShaderiv(@GLuint int shader, @GLenum int pname, @OutParameter @Check("1") IntBuffer params);
+
+ @Alternate("glGetShaderiv")
+ @GLreturn("params")
+ @StripPostfix("params")
+ void glGetShaderiv2(@GLuint int shader, @GLenum int pname, @OutParameter IntBuffer params);
+
+ void glGetShaderInfoLog(@GLuint int shader, @AutoSize("infoLog") @GLsizei int bufsize,
+ @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length,
+ @OutParameter @GLchar ByteBuffer infoLog);
+
+ @Alternate("glGetShaderInfoLog")
+ @GLreturn(value = "infoLog", maxLength = "bufsize")
+ void glGetShaderInfoLog2(@GLuint int shader, @GLsizei int bufsize,
+ @OutParameter @GLsizei @Constant("infoLog_length, 0") IntBuffer length,
+ @OutParameter @GLchar ByteBuffer infoLog);
+
+ void glGetShaderPrecisionFormat(@GLenum int shadertype, @GLenum int precisiontype, @OutParameter @GLint @Check("2") IntBuffer range, @OutParameter @Check("1") @GLint IntBuffer precision);
+
+ void glGetShaderSource(@GLuint int shader, @AutoSize("source") @GLsizei int bufsize,
+ @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length,
+ @OutParameter @GLchar ByteBuffer source);
+
+ @Alternate("glGetShaderSource")
+ @GLreturn(value = "source", maxLength = "bufsize")
+ void glGetShaderSource2(@GLuint int shader, @GLsizei int bufsize,
+ @OutParameter @GLsizei @Constant("source_length, 0") IntBuffer length,
+ @OutParameter @GLchar ByteBuffer source);
+
+ @Const
+ String glGetString(@GLenum int name);
+
+ @StripPostfix("params")
+ void glGetTexParameterfv(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") FloatBuffer params);
+
+ @Alternate("glGetTexParameterfv")
+ @GLreturn("params")
+ @StripPostfix(value = "params", postfix = "v")
+ void glGetTexParameterfv2(@GLenum int target, @GLenum int pname, @OutParameter FloatBuffer params);
+
+ @StripPostfix("params")
+ void glGetTexParameteriv(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") IntBuffer params);
+
+ @Alternate("glGetTexParameteriv")
+ @GLreturn("params")
+ @StripPostfix(value = "params", postfix = "v")
+ void glGetTexParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params);
+
+ @StripPostfix("params")
+ void glGetUniformfv(@GLuint int program, int location, @OutParameter @Check("1") FloatBuffer params);
+
+ @StripPostfix("params")
+ void glGetUniformiv(@GLuint int program, int location, @OutParameter @Check("1") IntBuffer params);
+
+ /**
+ * Returns the location of the uniform with the specified name. The ByteBuffer should contain the uniform name as a
+ * null-terminated string.
+ *
+ * @param program
+ * @param name
+ */
+ int glGetUniformLocation(@GLuint int program, @NullTerminated @Check("1") @Const @GLchar ByteBuffer name);
+
+ @Alternate("glGetUniformLocation")
+ int glGetUniformLocation(@GLuint int program, @NullTerminated CharSequence name);
+
+ @StripPostfix("params")
+ void glGetVertexAttribfv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params);
+
+ @StripPostfix("params")
+ void glGetVertexAttribiv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") IntBuffer params);
+
+ @StripPostfix("pointer")
+ void glGetVertexAttribPointerv(@GLuint int index, @GLenum int pname, @Result @GLvoid ByteBuffer pointer);
+
+ void glHint(@GLenum int target, @GLenum int mode);
+
+ @GLboolean
+ boolean glIsBuffer(@GLuint int buffer);
+
+ @GLboolean
+ boolean glIsEnabled(@GLenum int cap);
+
+ @GLboolean
+ boolean glIsFramebuffer(@GLuint int framebuffer);
+
+ @GLboolean
+ boolean glIsProgram(@GLuint int program);
+
+ @GLboolean
+ boolean glIsRenderbuffer(@GLuint int renderbuffer);
+
+ @GLboolean
+ boolean glIsShader(@GLuint int shader);
+
+ @GLboolean
+ boolean glIsTexture(@GLuint int texture);
+
+ void glLineWidth(@GLfloat float width);
+
+ void glLinkProgram(@GLuint int program);
+
+ void glPixelStorei(@GLenum int pname, @GLint int param);
+
+ void glPolygonOffset(@GLfloat float factor, @GLfloat float units);
+
+ void glReadPixels(int x, int y, @GLsizei int width, @GLsizei int height, @GLenum int format, @GLenum int type,
+ @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, 1)")
+ @OutParameter @GLbyte @GLshort @GLint @GLfloat Buffer pixels);
+
+ void glReleaseShaderCompiler();
+
+ void glRenderbufferStorage(@GLenum int target, @GLenum int internalformat, @GLsizei int width, @GLsizei int height);
+
+ void glSampleCoverage(@GLclampf float value, @GLboolean boolean invert);
+
+ void glScissor(@GLint int x, @GLint int y, @GLsizei int width, @GLsizei int height);
+
+ void glShaderBinary(@AutoSize("shaders") @GLsizei int n, @Const @GLuint IntBuffer shaders, @GLenum int binaryformat, @Const @GLvoid ByteBuffer binary, @AutoSize("binary") @GLsizei int length);
+
+ /**
+ * glShaderSource allows multiple, optionally null-terminated, source strings to define a shader program.
+ *
+ * This method uses just a single string, that should NOT be null-terminated.
+ *
+ * @param shader
+ * @param string
+ */
+ void glShaderSource(@GLuint int shader, @Constant("1") @GLsizei int count,
+ @Indirect @Const @Check @GLchar ByteBuffer string,
+ @AutoSize("string") @Indirect @Const @GLint int length);
+
+ @Alternate("glShaderSource")
+ void glShaderSource2(@GLuint int shader, @Constant("1") @GLsizei int count, CharSequence string, @Constant("string.length()") @Indirect @Const int length);
+
+ @Alternate(value = "glShaderSource", nativeAlt = true)
+ void glShaderSource3(@GLuint int shader, @Constant("strings.length") @GLsizei int count,
+ @Const @PointerArray(value = "count", lengths = "length") CharSequence[] strings,
+ @Constant("APIUtil.getLengths(strings), 0") @Const IntBuffer length);
+
+ void glStencilFunc(@GLenum int func, @GLint int ref, @GLuint int mask);
+
+ void glStencilFuncSeparate(@GLenum int face, @GLenum int func, @GLint int ref, @GLuint int mask);
+
+ void glStencilMask(@GLuint int mask);
+
+ void glStencilMaskSeparate(@GLenum int face, @GLuint int mask);
+
+ void glStencilOp(@GLenum int fail, @GLenum int zfail, @GLenum int zpass);
+
+ void glStencilOpSeparate(@GLenum int face, @GLenum int fail, @GLenum int zfail, @GLenum int zpass);
+
+ void glTexImage2D(@GLenum int target, int level, int internalformat, int width, int height, int border, @GLenum int format, @GLenum int type,
+ @Check(value = "GLChecks.calculateTexImage2DStorage(pixels, format, type, width, height)", canBeNull = true)
+ @Const @GLbyte @GLshort @GLint @GLfloat Buffer pixels);
+
+ void glTexParameterf(@GLenum int target, @GLenum int pname, @GLfloat float param);
+
+ @StripPostfix("param")
+ void glTexParameterfv(@GLenum int target, @GLenum int pname, @Check("4") @Const FloatBuffer param);
+
+ void glTexParameteri(@GLenum int target, @GLenum int pname, @GLint int param);
+
+ @StripPostfix("param")
+ void glTexParameteriv(@GLenum int target, @GLenum int pname, @Check("4") @Const IntBuffer param);
+
+ void glTexSubImage2D(@GLenum int target, int level, int xoffset, int yoffset, @GLsizei int width, @GLsizei int height, @GLenum int format, @GLenum int type,
+ @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, 1)")
+ @Const @GLbyte @GLshort @GLint @GLfloat Buffer pixels);
+
+ void glUniform1f(@GLint int location, @GLfloat float x);
+
+ @StripPostfix("v")
+ void glUniform1fv(int location, @AutoSize("v") @GLsizei int count, @Const FloatBuffer v);
+
+ void glUniform1i(@GLint int location, @GLint int x);
+
+ @StripPostfix("v")
+ void glUniform1iv(int location, @AutoSize("v") @GLsizei int count, @Const IntBuffer v);
+
+ void glUniform2f(@GLint int location, @GLfloat float x, @GLfloat float y);
+
+ @StripPostfix("v")
+ void glUniform2fv(int location, @AutoSize(value = "v", expression = " >> 1") @GLsizei int count, @Const FloatBuffer v);
+
+ void glUniform2i(@GLint int location, @GLint int x, @GLint int y);
+
+ @StripPostfix("v")
+ void glUniform2iv(int location, @AutoSize(value = "v", expression = " >> 1") @GLsizei int count, @Const IntBuffer v);
+
+ void glUniform3f(@GLint int location, @GLfloat float x, @GLfloat float y, @GLfloat float z);
+
+ @StripPostfix("v")
+ void glUniform3fv(int location, @AutoSize(value = "v", expression = " / 3") @GLsizei int count, @Const FloatBuffer v);
+
+ void glUniform3i(@GLint int location, @GLint int x, @GLint int y, @GLint int z);
+
+ @StripPostfix("v")
+ void glUniform3iv(int location, @AutoSize(value = "v", expression = " / 3") @GLsizei int count, @Const IntBuffer v);
+
+ void glUniform4f(@GLint int location, @GLfloat float x, @GLfloat float y, @GLfloat float z, @GLfloat float w);
+
+ @StripPostfix("v")
+ void glUniform4fv(int location, @AutoSize(value = "v", expression = " >> 2") @GLsizei int count, @Const FloatBuffer v);
+
+ void glUniform4i(@GLint int location, @GLint int x, @GLint int y, @GLint int z, @GLint int w);
+
+ @StripPostfix("v")
+ void glUniform4iv(int location, @AutoSize(value = "v", expression = " >> 2") @GLsizei int count, @Const IntBuffer v);
+
+ @StripPostfix("matrices")
+ void glUniformMatrix2fv(int location, @AutoSize(value = "matrices", expression = " >> 2") @GLsizei int count, @GLboolean boolean transpose, @Const FloatBuffer matrices);
+
+ @StripPostfix("matrices")
+ void glUniformMatrix3fv(int location, @AutoSize(value = "matrices", expression = " / (3 * 3)") @GLsizei int count, @GLboolean boolean transpose, @Const FloatBuffer matrices);
+
+ @StripPostfix("matrices")
+ void glUniformMatrix4fv(int location, @AutoSize(value = "matrices", expression = " >> 4") @GLsizei int count, @GLboolean boolean transpose, @Const FloatBuffer matrices);
+
+ void glUseProgram(@GLuint int program);
+
+ void glValidateProgram(@GLuint int program);
+
+ void glVertexAttrib1f(@GLuint int indx, @GLfloat float x);
+
+ @StripPostfix("values")
+ void glVertexAttrib1fv(@GLuint int indx, @Const @Check("1") FloatBuffer values);
+
+ void glVertexAttrib2f(@GLuint int indx, @GLfloat float x, @GLfloat float y);
+
+ @StripPostfix("values")
+ void glVertexAttrib2fv(@GLuint int indx, @Const @Check("2") FloatBuffer values);
+
+ void glVertexAttrib3f(@GLuint int indx, @GLfloat float x, @GLfloat float y, @GLfloat float z);
+
+ @StripPostfix("values")
+ void glVertexAttrib3fv(@GLuint int indx, @Const @Check("3") FloatBuffer values);
+
+ void glVertexAttrib4f(@GLuint int indx, @GLfloat float x, @GLfloat float y, @GLfloat float z, @GLfloat float w);
+
+ @StripPostfix("values")
+ void glVertexAttrib4fv(@GLuint int indx, @Const @Check("4") FloatBuffer values);
+
+ void glVertexAttribPointer(@GLuint int index, int size, @AutoType("buffer") @GLenum int type, @GLboolean boolean normalized, @GLsizei int stride,
+ @CachedReference(index = "index", name = "glVertexAttribPointer_buffer")
+ @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLubyte @GLbyte @GLshort @GLushort @GLint @GLuint @GLfloat Buffer buffer);
+
+ void glViewport(@GLint int x, @GLint int y, @GLsizei int width, @GLsizei int height);
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/IMG_multisamples_render_to_texture.java b/src/templates/org/lwjgl/opengles/IMG_multisamples_render_to_texture.java
new file mode 100644
index 00000000..bf9c2594
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/IMG_multisamples_render_to_texture.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLsizei;
+import org.lwjgl.util.generator.opengl.GLuint;
+
+public interface IMG_multisamples_render_to_texture {
+
+ /** Accepted by the <pname> parameter of GetRenderbufferParameteriv: */
+ int GL_RENDERBUFFER_SAMPLES_IMG = 0x9133;
+
+ /** Returned by CheckFramebufferStatus: */
+ int GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG = 0x9134;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
+ * GetFloatv, and GetDoublev:
+ */
+ int GL_MAX_SAMPLES_IMG = 0x9135;
+
+ /** Accepted by the <pname> parameter of GetFramebufferAttachmentParameteriv: */
+ int GL_TEXTURE_SAMPLES_IMG = 0x9136;
+
+ void glRenderbufferStorageMultisampleIMG(
+ @GLenum int target, @GLsizei int samples,
+ @GLenum int internalformat,
+ @GLsizei int width, @GLsizei int height);
+
+ void glFramebufferTexture2DMultisampleIMG(
+ @GLenum int target, @GLenum int attachment,
+ @GLenum int textarget, @GLuint int texture,
+ int level, @GLsizei int samples);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/IMG_program_binary.java b/src/templates/org/lwjgl/opengles/IMG_program_binary.java
new file mode 100644
index 00000000..390f69aa
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/IMG_program_binary.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface IMG_program_binary {
+
+ /** Accepted by the <binaryFormat> parameter of ProgramBinaryOES: */
+ int GL_SGX_PROGRAM_BINARY_IMG = 0x9130;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/IMG_shader_binary.java b/src/templates/org/lwjgl/opengles/IMG_shader_binary.java
new file mode 100644
index 00000000..5b87bc36
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/IMG_shader_binary.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface IMG_shader_binary {
+
+ /** Accepted by the <binaryformat> parameter of ShaderBinary: */
+ int GL_SGX_BINARY_IMG = 0x8C0A;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/IMG_texture_compression_pvrtc.java b/src/templates/org/lwjgl/opengles/IMG_texture_compression_pvrtc.java
new file mode 100644
index 00000000..b40c5237
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/IMG_texture_compression_pvrtc.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface IMG_texture_compression_pvrtc {
+
+ /**
+ * Accepted by the <internalformat> parameter of CompressedTexImage2DARB
+ * and the <format> parameter of CompressedTexSubImage2DARB:
+ */
+ int GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00,
+ GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01,
+ GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02,
+ GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/NV_coverage_sample.java b/src/templates/org/lwjgl/opengles/NV_coverage_sample.java
new file mode 100644
index 00000000..ab177412
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/NV_coverage_sample.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.opengl.GLenum;
+
+public interface NV_coverage_sample {
+
+ /**
+ * Accepted by the <attrib_list> parameter of eglChooseConfig
+ * and eglCreatePbufferSurface, and by the <attribute>
+ * parameter of eglGetConfigAttrib:
+ */
+ int EGL_COVERAGE_BUFFERS_NV = 0x30E0,
+ EGL_COVERAGE_SAMPLES_NV = 0x30E1;
+
+ /**
+ * Accepted by the <internalformat> parameter of
+ * RenderbufferStorageEXT and the <format> parameter of ReadPixels:
+ */
+ int GL_COVERAGE_COMPONENT_NV = 0x8522;
+
+ /**
+ * Accepted by the <internalformat> parameter of
+ * RenderbufferStorageEXT:
+ */
+ int GL_COVERAGE_COMPONENT4_NV = 0x8523;
+
+ /** Accepted by the <operation> parameter of CoverageOperationNV: */
+ int GL_COVERAGE_ALL_FRAGMENTS_NV = 0x8524,
+ GL_COVERAGE_EDGE_FRAGMENTS_NV = 0x8525,
+ GL_COVERAGE_AUTOMATIC_NV = 0x8526;
+
+ /**
+ * Accepted by the <attachment> parameter of
+ * FramebufferRenderbuffer, and GetFramebufferAttachmentParameteriv:
+ */
+ int GL_COVERAGE_ATTACHMENT_NV = 0x8527;
+
+ /** Accepted by the <buf> parameter of Clear: */
+ int GL_COVERAGE_BUFFER_BIT_NV = 0x8000;
+
+ /** Accepted by the <pname> parameter of GetIntegerv: */
+ int GL_COVERAGE_BUFFERS_NV = 0x8528,
+ GL_COVERAGE_SAMPLES_NV = 0x8529;
+
+ void glCoverageMaskNV(boolean mask);
+
+ void glCoverageOperationNV(@GLenum int operation);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/NV_depth_nonlinear.java b/src/templates/org/lwjgl/opengles/NV_depth_nonlinear.java
new file mode 100644
index 00000000..8acfa21e
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/NV_depth_nonlinear.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface NV_depth_nonlinear {
+
+ /**
+ * Accepted as a valid sized internal format by all functions accepting
+ * sized internal formats with a base format of DEPTH_COMPONENT:
+ */
+ int GL_DEPTH_COMPONENT16_NONLINEAR_NV = 0x8553;
+
+ /**
+ * Accepted by the <attrib_list> parameter of eglChooseConfig,
+ * and by the <attribute> parameter of eglGetConfigAttrib:
+ */
+ int EGL_DEPTH_ENCODING_NV = 0x30E2;
+
+ /**
+ * Accepted as a value in the <attrib_list> parameter of eglChooseConfig
+ * and eglCreatePbufferSurface, and returned in the <value> parameter
+ * of eglGetConfigAttrib:
+ */
+ int EGL_DEPTH_ENCODING_NONE_NV = 0,
+ EGL_DEPTH_ENCODING_NONLINEAR_NV = 0x30E3;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/NV_draw_path.java b/src/templates/org/lwjgl/opengles/NV_draw_path.java
new file mode 100644
index 00000000..369af7c4
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/NV_draw_path.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.AutoSize;
+import org.lwjgl.util.generator.Check;
+import org.lwjgl.util.generator.Const;
+import org.lwjgl.util.generator.opengl.*;
+
+import java.nio.ByteBuffer;
+import java.nio.FloatBuffer;
+
+public interface NV_draw_path {
+
+ /** Accepted as the <paramType> parameter of PathParameterNV: */
+ int GL_PATH_QUALITY_NV = 0x8ED8,
+ GL_FILL_RULE_NV = 0x8ED9,
+ GL_STROKE_CAP0_STYLE_NV = 0x8EE0,
+ GL_STROKE_CAP1_STYLE_NV = 0x8EE1,
+ GL_STROKE_CAP2_STYLE_NV = 0x8EE2,
+ GL_STROKE_CAP3_STYLE_NV = 0x8EE3,
+ GL_STROKE_JOIN_STYLE_NV = 0x8EE8,
+ GL_STROKE_MITER_LIMIT_NV = 0x8EE9;
+
+ /** Values for the ILL_RULE_NV path parameter: */
+ int GL_EVEN_ODD_NV = 0x8EF0,
+ GL_NON_ZERO_NV = 0x8EF1;
+
+ /** Values for the CAP[0-3]_STYLE_NV path parameter: */
+ int GL_CAP_BUTT_NV = 0x8EF4,
+ GL_CAP_ROUND_NV = 0x8EF5,
+ GL_CAP_SQUARE_NV = 0x8EF6,
+ GL_CAP_TRIANGLE_NV = 0x8EF7;
+
+ /** Values for the JOIN_STYLE_NV path parameter: */
+ int GL_JOIN_MITER_NV = 0x8EFC,
+ GL_JOIN_ROUND_NV = 0x8EFD,
+ GL_JOIN_BEVEL_NV = 0x8EFE,
+ GL_JOIN_CLIPPED_MITER_NV = 0x8EFF;
+
+ /** Accepted as the <target> parameter of PathMatrixNV: */
+ int GL_MATRIX_PATH_TO_CLIP_NV = 0x8F04,
+ GL_MATRIX_STROKE_TO_PATH_NV = 0x8F05,
+ GL_MATRIX_PATH_COORD0_NV = 0x8F08,
+ GL_MATRIX_PATH_COORD1_NV = 0x8F09,
+ GL_MATRIX_PATH_COORD2_NV = 0x8F0A,
+ GL_MATRIX_PATH_COORD3_NV = 0x8F0B;
+
+ /** Accepted as the <mode> parameter of DrawPathbufferNV: */
+ int GL_FILL_PATH_NV = 0x8F18,
+ GL_STROKE_PATH_NV = 0x8F19;
+
+ /** Accepted as path commands by CreatePathNV: */
+ byte GL_MOVE_TO_NV = 0x00,
+ GL_LINE_TO_NV = 0x01,
+ GL_QUADRATIC_BEZIER_TO_NV = 0x02,
+ GL_CUBIC_BEZIER_TO_NV = 0x03,
+ GL_START_MARKER_NV = 0x20,
+ GL_CLOSE_NV = 0x21,
+ GL_STROKE_CAP0_NV = 0x40,
+ GL_STROKE_CAP1_NV = 0x41,
+ GL_STROKE_CAP2_NV = 0x42,
+ GL_STROKE_CAP3_NV = 0x43;
+
+ @GLuint
+ int glCreatePathNV(@GLenum int datatype, @AutoSize("commands") @GLsizei int numCommands, @Const @GLubyte ByteBuffer commands);
+
+ void glDeletePathNV(@GLuint int path);
+
+ void glPathVerticesNV(@GLuint int path, @Const @Check @GLvoid ByteBuffer vertices);
+
+ void glPathParameterfNV(@GLuint int path, @GLenum int paramType, float param);
+
+ void glPathParameteriNV(@GLuint int path, @GLenum int paramType, int param);
+
+ @GLuint
+ int glCreatePathProgramNV();
+
+ void glPathMatrixNV(@GLenum int target, @Const @Check("16") FloatBuffer value);
+
+ void glDrawPathNV(@GLuint int path, @GLenum int mode);
+
+ @GLuint
+ int glCreatePathbufferNV(@GLsizei int capacity);
+
+ void glDeletePathbufferNV(@GLuint int buffer);
+
+ void glPathbufferPathNV(@GLuint int buffer, int index, @GLuint int path);
+
+ void glPathbufferPositionNV(@GLuint int buffer, int index, float x, float y);
+
+ void glDrawPathbufferNV(@GLuint int buffer, @GLenum int mode);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/NV_fbo_color_attachments.java b/src/templates/org/lwjgl/opengles/NV_fbo_color_attachments.java
new file mode 100644
index 00000000..7e216d25
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/NV_fbo_color_attachments.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface NV_fbo_color_attachments {
+
+ int GL_MAX_COLOR_ATTACHMENTS_NV = 0x8CDF,
+ GL_COLOR_ATTACHMENT0_NV = 0x8CE0,
+ GL_COLOR_ATTACHMENT1_NV = 0x8CE1,
+ GL_COLOR_ATTACHMENT2_NV = 0x8CE2,
+ GL_COLOR_ATTACHMENT3_NV = 0x8CE3,
+ GL_COLOR_ATTACHMENT4_NV = 0x8CE4,
+ GL_COLOR_ATTACHMENT5_NV = 0x8CE5,
+ GL_COLOR_ATTACHMENT6_NV = 0x8CE6,
+ GL_COLOR_ATTACHMENT7_NV = 0x8CE7,
+ GL_COLOR_ATTACHMENT8_NV = 0x8CE8,
+ GL_COLOR_ATTACHMENT9_NV = 0x8CE9,
+ GL_COLOR_ATTACHMENT10_NV = 0x8CEA,
+ GL_COLOR_ATTACHMENT11_NV = 0x8CEB,
+ GL_COLOR_ATTACHMENT12_NV = 0x8CEC,
+ GL_COLOR_ATTACHMENT13_NV = 0x8CED,
+ GL_COLOR_ATTACHMENT14_NV = 0x8CEE,
+ GL_COLOR_ATTACHMENT15_NV = 0x8CEF;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/NV_fence.java b/src/templates/org/lwjgl/opengles/NV_fence.java
new file mode 100644
index 00000000..f7f2ad8d
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/NV_fence.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLreturn;
+import org.lwjgl.util.generator.opengl.GLsizei;
+import org.lwjgl.util.generator.opengl.GLuint;
+
+import java.nio.IntBuffer;
+
+public interface NV_fence {
+
+ /** Accepted by the <condition> parameter of SetFenceNV: */
+ int GL_ALL_COMPLETED_NV = 0x84F2;
+
+ /** Accepted by the <pname> parameter of GetFenceivNV: */
+ int GL_FENCE_STATUS_NV = 0x84F3,
+ GL_FENCE_CONDITION_NV = 0x84F4;
+
+ void glGenFencesNV(@AutoSize("fences") @GLsizei int n, @OutParameter @GLuint IntBuffer fences);
+
+ @Alternate("glGenFencesNV")
+ @GLreturn("fences")
+ void glGenFencesNV2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer fences);
+
+ void glDeleteFencesNV(@AutoSize("fences") @GLsizei int n, @Const @GLuint IntBuffer fences);
+
+ @Alternate("glDeleteFencesNV")
+ void glDeleteFencesNV(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getBufferInt().put(0, fence), 0", keepParam = true) int fence);
+
+ void glSetFenceNV(@GLuint int fence, @GLenum int condition);
+
+ boolean glTestFenceNV(@GLuint int fence);
+
+ void glFinishFenceNV(@GLuint int fence);
+
+ boolean glIsFenceNV(@GLuint int fence);
+
+ void glGetFenceivNV(@GLuint int fence, @GLenum int pname, @OutParameter @Check("1") IntBuffer params);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/NV_framebuffer_vertex_attrib_array.java b/src/templates/org/lwjgl/opengles/NV_framebuffer_vertex_attrib_array.java
new file mode 100644
index 00000000..7046eda2
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/NV_framebuffer_vertex_attrib_array.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.opengl.*;
+
+public interface NV_framebuffer_vertex_attrib_array {
+
+ int GL_FRAMEBUFFER_ATTACHABLE_NV = 0x852A,
+ GL_VERTEX_ATTRIB_ARRAY_NV = 0x852B,
+ GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_SIZE_NV = 0x852C,
+ GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_TYPE_NV = 0x852D,
+ GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_NORMALIZED_NV = 0x852E,
+ GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_OFFSET_NV = 0x852F,
+ GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_WIDTH_NV = 0x8530,
+ GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_STRIDE_NV = 0x8531,
+ GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_HEIGHT_NV = 0x8532;
+
+ void glFramebufferVertexAttribArrayNV(@GLenum int target, @GLenum int attachment,
+ @GLenum int buffertarget, @GLuint int bufferobject,
+ @GLint int size, @GLenum int type, @GLboolean boolean normalized, @GLintptr long offset,
+ @GLsizeiptr long width, @GLsizeiptr long height, @GLsizei int stride);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/NV_get_tex_image.java b/src/templates/org/lwjgl/opengles/NV_get_tex_image.java
new file mode 100644
index 00000000..60fea0e6
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/NV_get_tex_image.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.Alternate;
+import org.lwjgl.util.generator.Check;
+import org.lwjgl.util.generator.OutParameter;
+import org.lwjgl.util.generator.StripPostfix;
+import org.lwjgl.util.generator.opengl.*;
+
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+
+public interface NV_get_tex_image {
+
+ int GL_TEXTURE_WIDTH_NV = 0x1000,
+ GL_TEXTURE_HEIGHT_NV = 0x1001,
+ GL_TEXTURE_INTERNAL_FORMAT_NV = 0x1003,
+ GL_TEXTURE_COMPONENTS_NV = GL_TEXTURE_INTERNAL_FORMAT_NV,
+ GL_TEXTURE_BORDER_NV = 0x1005,
+ GL_TEXTURE_RED_SIZE_NV = 0x805C,
+ GL_TEXTURE_GREEN_SIZE_NV = 0x805D,
+ GL_TEXTURE_BLUE_SIZE_NV = 0x805E,
+ GL_TEXTURE_ALPHA_SIZE_NV = 0x805F,
+ GL_TEXTURE_LUMINANCE_SIZE_NV = 0x8060,
+ GL_TEXTURE_INTENSITY_SIZE_NV = 0x8061,
+ GL_TEXTURE_DEPTH_NV = 0x8071,
+ GL_TEXTURE_COMPRESSED_IMAGE_SIZE_NV = 0x86A0,
+ GL_TEXTURE_COMPRESSED_NV = 0x86A1,
+ GL_TEXTURE_DEPTH_SIZE_NV = 0x884A;
+
+ void glGetTexImageNV(@GLenum int target, @GLint int level, @GLenum int format, @GLenum int type,
+ @OutParameter
+ @Check("GLChecks.calculateImageStorage(img, format, type, 1, 1, 1)")
+ @GLbyte
+ @GLshort
+ @GLint
+ @GLfloat Buffer img);
+
+ void glGetCompressedTexImageNV(@GLenum int target, @GLint int level, @OutParameter @Check @GLvoid ByteBuffer img);
+
+ @StripPostfix("params")
+ void glGetTexLevelParameterfvNV(@GLenum int target, @GLint int level, @GLenum int pname, @OutParameter @Check("1") @GLfloat FloatBuffer params);
+
+ @Alternate("glGetTexLevelParameterfvNV")
+ @GLreturn("params")
+ @StripPostfix(value = "params", postfix = "v")
+ void glGetTexLevelParameterfvNV2(@GLenum int target, @GLint int level, @GLenum int pname, @OutParameter @GLfloat FloatBuffer params);
+
+ @StripPostfix("params")
+ void glGetTexLevelParameterivNV(@GLenum int target, @GLint int level, @GLenum int pname, @OutParameter @Check("1") @GLint IntBuffer params);
+
+ @Alternate("glGetTexLevelParameterivNV")
+ @GLreturn("params")
+ @StripPostfix(value = "params", postfix = "v")
+ void glGetTexLevelParameterivNV2(@GLenum int target, @GLint int level, @GLenum int pname, @OutParameter @GLint IntBuffer params);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/NV_read_buffer.java b/src/templates/org/lwjgl/opengles/NV_read_buffer.java
new file mode 100644
index 00000000..68cdabfc
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/NV_read_buffer.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.opengl.GLenum;
+
+public interface NV_read_buffer {
+
+ int GL_READ_BUFFER_NV = 0x0C02,
+ GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_NV = 0x8CDC;
+
+ void glReadBufferNV(@GLenum int mode);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/NV_shader_framebuffer_fetch.java b/src/templates/org/lwjgl/opengles/NV_shader_framebuffer_fetch.java
new file mode 100644
index 00000000..962dd46b
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/NV_shader_framebuffer_fetch.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface NV_shader_framebuffer_fetch {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/NV_system_time.java b/src/templates/org/lwjgl/opengles/NV_system_time.java
new file mode 100644
index 00000000..e0503343
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/NV_system_time.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.opengl.EGLuint64NV;
+
+public interface NV_system_time {
+
+ @EGLuint64NV
+ long glGetSystemTimeFrequencyNV();
+
+ @EGLuint64NV
+ long glGetSystemTimeNV();
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_EGL_image.java b/src/templates/org/lwjgl/opengles/OES_EGL_image.java
new file mode 100644
index 00000000..57c9bf1d
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_EGL_image.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.PointerWrapper;
+import org.lwjgl.util.generator.opengl.GLenum;
+
+public interface OES_EGL_image {
+
+ void glEGLImageTargetTexture2DOES(@GLenum int target, @PointerWrapper("GLeglImageOES") EGLImageOES image);
+
+ void glEGLImageTargetRenderbufferStorageOES(@GLenum int target, @PointerWrapper("GLeglImageOES") EGLImageOES image);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_EGL_image_external.java b/src/templates/org/lwjgl/opengles/OES_EGL_image_external.java
new file mode 100644
index 00000000..cfd00284
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_EGL_image_external.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.PointerWrapper;
+import org.lwjgl.util.generator.opengl.GLenum;
+
+public interface OES_EGL_image_external {
+
+ /**
+ * Accepted as a target in the <target> parameter of BindTexture and
+ * EGLImageTargetTexture2DOES:
+ */
+ int GL_TEXTURE_EXTERNAL_OES = 0x8D65;
+
+ /** Returned in the <type> parameter of GetActiveUniform: */
+ int GL_SAMPLER_EXTERNAL_OES = 0x8D66;
+
+ /** Accepted as <value> in GetIntegerv() and GetFloatv() queries: */
+ int GL_TEXTURE_BINDING_EXTERNAL_OES = 0x8D67;
+
+ /** Accepted as <value> in GetTexParameter*() queries: */
+ int GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES = 0x8D68;
+
+ void glEGLImageTargetTexture2DOES(@GLenum int target, @PointerWrapper("GLeglImageOES") EGLImageOES image);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_EGL_sync.java b/src/templates/org/lwjgl/opengles/OES_EGL_sync.java
new file mode 100644
index 00000000..040d65ed
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_EGL_sync.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_EGL_sync {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_blend_equation_separate.java b/src/templates/org/lwjgl/opengles/OES_blend_equation_separate.java
new file mode 100644
index 00000000..b69d7817
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_blend_equation_separate.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.opengl.GLenum;
+
+public interface OES_blend_equation_separate {
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, and
+ * GetFloatv:
+ */
+ int GL_BLEND_EQUATION_RGB_OES = 0x8009,
+ GL_BLEND_EQUATION_ALPHA_OES = 0x883D;
+
+ void glBlendEquationSeparateOES(@GLenum int modeRGB, @GLenum int modeAlpha);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_blend_func_separate.java b/src/templates/org/lwjgl/opengles/OES_blend_func_separate.java
new file mode 100644
index 00000000..cd18b3f0
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_blend_func_separate.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.opengl.GLenum;
+
+public interface OES_blend_func_separate {
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, and
+ * GetFloatv:
+ */
+ int GL_BLEND_DST_RGB_OES = 0x80C8,
+ BLEND_SRC_RGB_OES = 0x80C9,
+ BLEND_DST_ALPHA_OES = 0x80CA,
+ BLEND_SRC_ALPHA_OES = 0x80CB;
+
+ void glBlendFuncSeparateOES(@GLenum int sfactorRGB,
+ @GLenum int dfactorRGB,
+ @GLenum int sfactorAlpha,
+ @GLenum int dfactorAlpha);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_blend_subtract.java b/src/templates/org/lwjgl/opengles/OES_blend_subtract.java
new file mode 100644
index 00000000..ff54675c
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_blend_subtract.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.opengl.GLenum;
+
+public interface OES_blend_subtract {
+
+ /** Accepted by the <mode> parameter of BlendEquationOES: */
+ int GL_FUNC_ADD_OES = 0x8006,
+ GL_FUNC_SUBTRACT_OES = 0x800A,
+ GL_FUNC_REVERSE_SUBTRACT_OES = 0x800B;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
+ * and GetFloatv:
+ */
+ int GL_BLEND_EQUATION_OES = 0x8009;
+
+ void glBlendEquationOES(@GLenum int mode);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_compressed_ETC1_RGB8_texture.java b/src/templates/org/lwjgl/opengles/OES_compressed_ETC1_RGB8_texture.java
new file mode 100644
index 00000000..b965a47d
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_compressed_ETC1_RGB8_texture.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_compressed_ETC1_RGB8_texture {
+
+ /** Accepted by the <internalformat> parameter of CompressedTexImage2D: */
+ int GL_ETC1_RGB8_OES = 0x8D64;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_compressed_paletted_texture.java b/src/templates/org/lwjgl/opengles/OES_compressed_paletted_texture.java
new file mode 100644
index 00000000..44bc8bf9
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_compressed_paletted_texture.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_compressed_paletted_texture {
+
+ /** Accepted by the <internalformat> paramter of CompressedTexImage2D */
+ int GL_PALETTE4_RGB8_OES = 0x8B90,
+ GL_PALETTE4_RGBA8_OES = 0x8B91,
+ GL_PALETTE4_R5_G6_B5_OES = 0x8B92,
+ GL_PALETTE4_RGBA4_OES = 0x8B93,
+ GL_PALETTE4_RGB5_A1_OES = 0x8B94,
+ GL_PALETTE8_RGB8_OES = 0x8B95,
+ GL_PALETTE8_RGBA8_OES = 0x8B96,
+ GL_PALETTE8_R5_G6_B5_OES = 0x8B97,
+ GL_PALETTE8_RGBA4_OES = 0x8B98,
+ GL_PALETTE8_RGB5_A1_OES = 0x8B99;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_depth24.java b/src/templates/org/lwjgl/opengles/OES_depth24.java
new file mode 100644
index 00000000..e3c9c98b
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_depth24.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_depth24 {
+
+ /** Accepted by the <internalformat> parameter of RenderbufferStorageOES: */
+ int GL_DEPTH_COMPONENT24_OES = 0x81A6;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_depth32.java b/src/templates/org/lwjgl/opengles/OES_depth32.java
new file mode 100644
index 00000000..04a8ab0d
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_depth32.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_depth32 {
+
+ /** Accepted by the <internalformat> parameter of RenderbufferStorageOES: */
+ int GL_DEPTH_COMPONENT32_OES = 0x81A7;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_depth_texture.java b/src/templates/org/lwjgl/opengles/OES_depth_texture.java
new file mode 100644
index 00000000..384f2f4e
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_depth_texture.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_depth_texture {
+
+ /**
+ * Accepted by the <format> parameter of TexImage2D and TexSubImage2D and
+ * <internalFormat> parameter of TexImage2D:
+ */
+ int GL_DEPTH_COMPONENT = 0x1902;
+
+ /** Accepted by the <type> parameter of TexImage2D, TexSubImage2D: */
+ int GL_UNSIGNED_SHORT = 0x1403,
+ GL_UNSIGNED_INT = 0x1405;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_element_index_uint.java b/src/templates/org/lwjgl/opengles/OES_element_index_uint.java
new file mode 100644
index 00000000..5fc81c7e
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_element_index_uint.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_element_index_uint {
+
+ /** Accepted by the <type> parameter of DrawElements: */
+ int GL_UNSIGNED_INT = 0x1405;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_fbo_render_mipmap.java b/src/templates/org/lwjgl/opengles/OES_fbo_render_mipmap.java
new file mode 100644
index 00000000..61c0ab9e
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_fbo_render_mipmap.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_fbo_render_mipmap {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_framebuffer_object.java b/src/templates/org/lwjgl/opengles/OES_framebuffer_object.java
new file mode 100644
index 00000000..21aaa5ec
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_framebuffer_object.java
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLreturn;
+import org.lwjgl.util.generator.opengl.GLsizei;
+import org.lwjgl.util.generator.opengl.GLuint;
+
+import java.nio.IntBuffer;
+
+public interface OES_framebuffer_object {
+
+ /**
+ * Accepted by the <target> parameter of BindFramebufferOES,
+ * CheckFramebufferStatusOES, FramebufferTexture{2D|3D}OES,
+ * FramebufferRenderbufferOES, and
+ * GetFramebufferAttachmentParameterivOES:
+ */
+ int GL_FRAMEBUFFER_OES = 0x8D40;
+
+ /**
+ * Accepted by the <target> parameter of BindRenderbufferOES,
+ * RenderbufferStorageOES, and GetRenderbufferParameterivOES, and
+ * returned by GetFramebufferAttachmentParameterivOES:
+ */
+ int GL_RENDERBUFFER_OES = 0x8D41;
+
+ /**
+ * Accepted by the <internalformat> parameter of
+ * RenderbufferStorageOES:
+ */
+ int GL_DEPTH_COMPONENT16_OES = 0x81A5,
+ GL_RGBA4_OES = 0x8056,
+ GL_RGB5_A1_OES = 0x8057,
+ GL_RGB565_OES = 0x8D62,
+ GL_STENCIL_INDEX1_OES = 0x8D46,
+ GL_STENCIL_INDEX4_OES = 0x8D47,
+ GL_STENCIL_INDEX8_OES = 0x8D48;
+
+ /** Accepted by the <pname> parameter of GetRenderbufferParameterivOES: */
+ int GL_RENDERBUFFER_WIDTH_OES = 0x8D42,
+ GL_RENDERBUFFER_HEIGHT_OES = 0x8D43,
+ GL_RENDERBUFFER_INTERNAL_FORMAT_OES = 0x8D44,
+ GL_RENDERBUFFER_RED_SIZE_OES = 0x8D50,
+ GL_RENDERBUFFER_GREEN_SIZE_OES = 0x8D51,
+ GL_RENDERBUFFER_BLUE_SIZE_OES = 0x8D52,
+ GL_RENDERBUFFER_ALPHA_SIZE_OES = 0x8D53,
+ GL_RENDERBUFFER_DEPTH_SIZE_OES = 0x8D54,
+ GL_RENDERBUFFER_STENCIL_SIZE_OES = 0x8D55;
+
+ /**
+ * Accepted by the <pname> parameter of
+ * GetFramebufferAttachmentParameterivOES:
+ */
+ int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES = 0x8CD0,
+ GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES = 0x8CD1,
+ GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES = 0x8CD2,
+ GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES = 0x8CD3,
+ GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES = 0x8CD4;
+
+ /**
+ * Accepted by the <attachment> parameter of
+ * FramebufferTexture{2D|3D}OES, FramebufferRenderbufferOES, and
+ * GetFramebufferAttachmentParameterivOES
+ */
+ int GL_COLOR_ATTACHMENT0_OES = 0x8CE0,
+ GL_DEPTH_ATTACHMENT_OES = 0x8D00,
+ GL_STENCIL_ATTACHMENT_OES = 0x8D20;
+
+ /**
+ * Returned by GetFramebufferAttachmentParameterivOES when the
+ * <pname> parameter is FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES:
+ */
+ int GL_NONE_OES = 0;
+
+ /** Returned by CheckFramebufferStatusOES(): */
+ int GL_FRAMEBUFFER_COMPLETE_OES = 0x8CD5,
+ GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES = 0x8CD6,
+ GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES = 0x8CD7,
+ GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES = 0x8CD9,
+ GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES = 0x8CDA,
+ GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES = 0x8CDB,
+ GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES = 0x8CDC,
+ GL_FRAMEBUFFER_UNSUPPORTED_OES = 0x8CDD;
+
+ /** Accepted by GetIntegerv(): */
+ int GL_FRAMEBUFFER_BINDING_OES = 0x8CA6,
+ GL_RENDERBUFFER_BINDING_OES = 0x8CA7,
+ GL_MAX_RENDERBUFFER_SIZE_OES = 0x84E8;
+
+ /** Returned by GetError(): */
+ int GL_INVALID_FRAMEBUFFER_OPERATION_OES = 0x0506;
+
+ boolean glIsRenderbufferOES(@GLuint int renderbuffer);
+
+ void glBindRenderbufferOES(@GLenum int target, @GLuint int renderbuffer);
+
+ void glDeleteRenderbuffersOES(@AutoSize("renderbuffers") int n, @Const @GLuint IntBuffer renderbuffers);
+
+ @Alternate("glDeleteRenderbuffersOES")
+ void glDeleteRenderbuffersOES(@Constant("1") int n, @Constant(value = "APIUtil.getBufferInt().put(0, renderbuffer), 0", keepParam = true) int renderbuffer);
+
+ void glGenRenderbuffersOES(@AutoSize("renderbuffers") int n, @OutParameter @GLuint IntBuffer renderbuffers);
+
+ @Alternate("glGenRenderbuffersOES")
+ @GLreturn("renderbuffers")
+ void glGenRenderbuffersOES2(@Constant("1") int n, @OutParameter @GLuint IntBuffer renderbuffers);
+
+ void glRenderbufferStorageOES(@GLenum int target, @GLenum int internalformat, @GLsizei int width, @GLsizei int height);
+
+ @StripPostfix("params")
+ void glGetRenderbufferParameterivOES(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") IntBuffer params);
+
+ @Alternate("glGetRenderbufferParameterivOES")
+ @GLreturn("params")
+ @StripPostfix("params")
+ void glGetRenderbufferParameterivOES2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params);
+
+ boolean glIsFramebufferOES(@GLuint int framebuffer);
+
+ void glBindFramebufferOES(@GLenum int target, @GLuint int framebuffer);
+
+ void glDeleteFramebuffersOES(@AutoSize("framebuffers") int n, @Const @GLuint IntBuffer framebuffers);
+
+ @Alternate("glDeleteFramebuffersOES")
+ void glDeleteFramebuffersOES(@Constant("1") int n, @Constant(value = "APIUtil.getBufferInt().put(0, framebuffer), 0", keepParam = true) int framebuffer);
+
+ void glGenFramebuffersOES(@AutoSize("framebuffers") int n, @OutParameter @GLuint IntBuffer framebuffers);
+
+ @Alternate("glGenFramebuffersOES")
+ @GLreturn("framebuffers")
+ void glGenFramebuffersOES2(@Constant("1") int n, @OutParameter @GLuint IntBuffer framebuffers);
+
+ @GLenum
+ int glCheckFramebufferStatusOES(@GLenum int target);
+
+ void glFramebufferTexture2DOES(@GLenum int target, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level);
+
+ void glFramebufferRenderbufferOES(@GLenum int target, @GLenum int attachment, @GLenum int renderbuffertarget, @GLuint int renderbuffer);
+
+ @StripPostfix("params")
+ void glGetFramebufferAttachmentParameterivOES(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter @Check("1") IntBuffer params);
+
+ @Alternate("glGetFramebufferAttachmentParameterivOES")
+ @GLreturn("params")
+ @StripPostfix("params")
+ void glGetFramebufferAttachmentParameterivOES2(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter IntBuffer params);
+
+ void glGenerateMipmapOES(@GLenum int target);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_get_program_binary.java b/src/templates/org/lwjgl/opengles/OES_get_program_binary.java
new file mode 100644
index 00000000..ffb6193b
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_get_program_binary.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.AutoSize;
+import org.lwjgl.util.generator.Check;
+import org.lwjgl.util.generator.Const;
+import org.lwjgl.util.generator.OutParameter;
+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 OES_get_program_binary {
+
+ /** Accepted by the <pname> parameter of GetProgramiv: */
+ int GL_PROGRAM_BINARY_LENGTH_OES = 0x8741;
+
+ /**
+ * Accepted by the <pname< parameter of GetBooleanv, GetIntegerv, and
+ * GetFloatv:
+ */
+ int GL_NUM_PROGRAM_BINARY_FORMATS_OES = 0x87FE,
+ GL_PROGRAM_BINARY_FORMATS_OES = 0x87FF;
+
+ void glGetProgramBinaryOES(@GLuint int program, @AutoSize("binary") @GLsizei int bufSize,
+ @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length,
+ @OutParameter @Check("1") @GLenum IntBuffer binaryFormat,
+ @OutParameter @GLvoid ByteBuffer binary);
+
+ void glProgramBinaryOES(@GLuint int program, @GLenum int binaryFormat, @Const @GLvoid ByteBuffer binary, @AutoSize("binary") int length);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_mapbuffer.java b/src/templates/org/lwjgl/opengles/OES_mapbuffer.java
new file mode 100644
index 00000000..f25a3428
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_mapbuffer.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLvoid;
+
+import java.nio.ByteBuffer;
+
+public interface OES_mapbuffer {
+
+ /** Accepted by the <access> parameter of MapBufferOES: */
+ int GL_WRITE_ONLY_OES = 0x88B9;
+
+ /** Accepted by the <value> parameter of GetBufferParameteriv: */
+ int GL_BUFFER_ACCESS_OES = 0x88BB,
+ GL_BUFFER_MAPPED_OES = 0x88BC;
+
+ /** Accepted by the <pname> parameter of GetBufferPointervOES: */
+ int GL_BUFFER_MAP_POINTER_OES = 0x88BD;
+
+ @StripPostfix("pointer")
+ @CachedResult
+ @AutoSize("GLChecks.getBufferObjectSize(target)")
+ void glGetBufferPointervOES(@GLenum int target, @GLenum int pname, @OutParameter @Result @GLvoid ByteBuffer pointer);
+
+ /**
+ * glMapBufferOES maps a GL buffer object to a ByteBuffer. The old_buffer argument can be null,
+ * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null,
+ * it will be returned if it points to the same mapped memory and has the same capacity as the buffer object,
+ * otherwise a new ByteBuffer is created. That way, an application will normally use glMapBuffer like this:
+ *
+ * ByteBuffer mapped_buffer; mapped_buffer = glMapBufferOES(..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapBufferOES(..., ..., mapped_buffer);
+ *
+ * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused.
+ *
+ * The version of this method without an explicit length argument calls glGetBufferParameter internally to
+ * retrieve the current buffer object size, which may cause a pipeline flush and reduce application performance.
+ *
+ * The version of this method with an explicit length argument is a fast alternative to the one without. No GL call
+ * is made to retrieve the buffer object size, so the user is responsible for tracking and using the appropriate length.
+ * Security warning: The length argument should match the buffer object size. Reading from or writing to outside
+ * the memory region that corresponds to the mapped buffer object will cause native crashes.
+ *
+ * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created.
+ *
+ * @return A ByteBuffer representing the mapped buffer memory.
+ */
+ @CachedResult
+ @GLvoid
+ @AutoSize("GLChecks.getBufferObjectSize(target)")
+ ByteBuffer glMapBufferOES(@GLenum int target, @GLenum int access);
+
+ boolean glUnmapBufferOES(@GLenum int target);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_packed_depth_stencil.java b/src/templates/org/lwjgl/opengles/OES_packed_depth_stencil.java
new file mode 100644
index 00000000..f13006c8
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_packed_depth_stencil.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_packed_depth_stencil {
+
+ /**
+ * Accepted by the <format> parameter of TexImage2D and TexSubImage2D and by the
+ * <internalformat> parameter of TexImage2D:
+ */
+ int GL_DEPTH_STENCIL_OES = 0x84F9;
+
+ /** Accepted by the <type> parameter of TexImage2D and TexSubImage2D: */
+ int GL_UNSIGNED_INT_24_8_OES = 0x84FA;
+
+ /**
+ * Accepted by the <internalformat> parameter of RenderbufferStorage, and
+ * returned in the <params> parameter of GetRenderbufferParameteriv when
+ * <pname> is RENDERBUFFER_INTERNAL_FORMAT:
+ */
+ int GL_DEPTH24_STENCIL8_OES = 0x88F0;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_rgb8_rgba8.java b/src/templates/org/lwjgl/opengles/OES_rgb8_rgba8.java
new file mode 100644
index 00000000..5bc3f755
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_rgb8_rgba8.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.Extension;
+
+@Extension(postfix = "OES", className = "OESRGB8RGBA8")
+public interface OES_rgb8_rgba8 {
+
+ /** Accepted by the <internalformat> parameter of RenderbufferStorageOES: */
+ int GL_RGB8_OES = 0x8051,
+ GL_RGBA8_OES = 0x8058;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_standard_derivatives.java b/src/templates/org/lwjgl/opengles/OES_standard_derivatives.java
new file mode 100644
index 00000000..4ff4eed2
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_standard_derivatives.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_standard_derivatives {
+
+ /**
+ * Accepted by the <target> parameter of Hint and by the <pname> parameter of
+ * GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev:
+ */
+ int GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_stencil1.java b/src/templates/org/lwjgl/opengles/OES_stencil1.java
new file mode 100644
index 00000000..cdc455d7
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_stencil1.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_stencil1 {
+
+ /** Accepted by the <internalformat> parameter of RenderbufferStorageOES: */
+ int GL_STENCIL_INDEX1_OES = 0x8D46;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_stencil4.java b/src/templates/org/lwjgl/opengles/OES_stencil4.java
new file mode 100644
index 00000000..5a49d29f
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_stencil4.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_stencil4 {
+
+ /** Accepted by the <internalformat> parameter of RenderbufferStorageOES: */
+ int GL_STENCIL_INDEX4_OES = 0x8D47;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_stencil8.java b/src/templates/org/lwjgl/opengles/OES_stencil8.java
new file mode 100644
index 00000000..4dc33ee2
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_stencil8.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_stencil8 {
+
+ /** Accepted by the <internalformat> parameter of RenderbufferStorageOES: */
+ int GL_STENCIL_INDEX8_OES = 0x8D48;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_texture_3D.java b/src/templates/org/lwjgl/opengles/OES_texture_3D.java
new file mode 100644
index 00000000..1419bb2f
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_texture_3D.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.Check;
+import org.lwjgl.util.generator.Const;
+import org.lwjgl.util.generator.opengl.*;
+
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+
+public interface OES_texture_3D {
+
+ /**
+ * Accepted by the <target> parameter of TexImage3DOES, TexSubImage3DOES,
+ * CopyTexSubImage3DOES, CompressedTexImage3DOES and
+ * CompressedTexSubImage3DOES, GetTexParameteriv, and GetTexParameterfv:
+ */
+ int GL_TEXTURE_3D_OES = 0x806F;
+
+ /**
+ * Accepted by the <pname> parameter of TexParameteriv, TexParameterfv,
+ * GetTexParameteriv, and GetTexParameterfv:
+ */
+ int GL_TEXTURE_WRAP_R_OES = 0x8072;
+
+ /**
+ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, and
+ * GetFloatv:
+ */
+ int GL_MAX_3D_TEXTURE_SIZE_OES = 0x8073,
+ GL_TEXTURE_BINDING_3D_OES = 0x806A;
+
+ void glTexImage3DOES(@GLenum int target, int level,
+ @GLenum int internalFormat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, int border,
+ @GLenum int format, @GLenum int type,
+ @Check(value = "GLChecks.calculateTexImage3DStorage(pixels, format, type, width, height, depth)", canBeNull = true)
+ @Const @GLbyte @GLshort @GLint @GLfloat Buffer pixels);
+
+ void glTexSubImage3DOES(@GLenum int target, int level,
+ int xoffset, int yoffset, int zoffset,
+ @GLsizei int width, @GLsizei int height, @GLsizei int depth,
+ @GLenum int format, @GLenum int type,
+ @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, depth)")
+ @Const @GLbyte @GLshort @GLint @GLfloat Buffer pixels);
+
+ void glCopyTexSubImage3DOES(@GLenum int target, int level, int xoffset, int yoffset, int zoffset, int x, int y, @GLsizei int width, @GLsizei int height);
+
+ void glCompressedTexImage3DOES(@GLenum int target, int level, @GLenum int internalformat,
+ @GLsizei int width, @GLsizei int height, @GLsizei int depth,
+ int border, @GLsizei int imageSize,
+ @Check @Const @GLvoid ByteBuffer data);
+
+ void glCompressedTexSubImage3DOES(@GLenum int target, int level,
+ int xoffset, int yoffset, int zoffset,
+ @GLsizei int width, @GLsizei int height, @GLsizei int depth,
+ @GLenum int format, @GLsizei int imageSize,
+ @Check @Const @GLvoid ByteBuffer data);
+
+ void glFramebufferTexture3DOES(@GLenum int target, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level, int zoffset);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_texture_float.java b/src/templates/org/lwjgl/opengles/OES_texture_float.java
new file mode 100644
index 00000000..268f120c
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_texture_float.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_texture_float {
+
+ /**
+ * Accepted by the <type> parameter of TexImage2D, TexSubImage2D,
+ * TexImage3D, and TexSubImage3D:
+ */
+ int GL_FLOAT = 0x1406;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_texture_float_linear.java b/src/templates/org/lwjgl/opengles/OES_texture_float_linear.java
new file mode 100644
index 00000000..0ff106d7
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_texture_float_linear.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_texture_float_linear {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_texture_half_float.java b/src/templates/org/lwjgl/opengles/OES_texture_half_float.java
new file mode 100644
index 00000000..756b0fd1
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_texture_half_float.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_texture_half_float {
+
+ /**
+ * Accepted by the <type> parameter of TexImage2D, TexSubImage2D,
+ * TexImage3D, and TexSubImage3D:
+ */
+ int GL_HALF_FLOAT_OES = 0x8D61;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_texture_half_float_linear.java b/src/templates/org/lwjgl/opengles/OES_texture_half_float_linear.java
new file mode 100644
index 00000000..a616514c
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_texture_half_float_linear.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_texture_half_float_linear {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_texture_npot.java b/src/templates/org/lwjgl/opengles/OES_texture_npot.java
new file mode 100644
index 00000000..2bc88d03
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_texture_npot.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_texture_npot {
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_vertex_array_object.java b/src/templates/org/lwjgl/opengles/OES_vertex_array_object.java
new file mode 100644
index 00000000..ec95a456
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_vertex_array_object.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLreturn;
+import org.lwjgl.util.generator.opengl.GLsizei;
+import org.lwjgl.util.generator.opengl.GLuint;
+
+import java.nio.IntBuffer;
+
+public interface OES_vertex_array_object {
+
+ /** Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv: */
+ int GL_VERTEX_ARRAY_BINDING_OES = 0x85B5;
+
+ void glBindVertexArrayOES(@GLuint int array);
+
+ void glDeleteVertexArraysOES(@AutoSize("arrays") @GLsizei int n, @Const @GLuint IntBuffer arrays);
+
+ @Alternate("glDeleteVertexArraysOES")
+ void glDeleteVertexArraysOES(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, array), 0", keepParam = true) int array);
+
+ void glGenVertexArraysOES(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays);
+
+ @Alternate("glGenVertexArraysOES")
+ @GLreturn("arrays")
+ void glGenVertexArraysOES2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays);
+
+ boolean glIsVertexArrayOES(@GLuint int array);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_vertex_half_float.java b/src/templates/org/lwjgl/opengles/OES_vertex_half_float.java
new file mode 100644
index 00000000..1fe881a6
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_vertex_half_float.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_vertex_half_float {
+
+ /** Accepted by the <type> parameter of VertexAttribPointer: */
+ int GL_HALF_FLOAT_OES = 0x8D61;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/OES_vertex_type_10_10_10_2.java b/src/templates/org/lwjgl/opengles/OES_vertex_type_10_10_10_2.java
new file mode 100644
index 00000000..e24e822a
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/OES_vertex_type_10_10_10_2.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface OES_vertex_type_10_10_10_2 {
+
+ /** Accepted by the <type> parameter of VertexAttribPointer */
+ int GL_UNSIGNED_INT_10_10_10_2_OES = 0x8DF6,
+ GL_INT_10_10_10_2_OES = 0x8DF7;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/QCOM_driver_control.java b/src/templates/org/lwjgl/opengles/QCOM_driver_control.java
new file mode 100644
index 00000000..a44ddbec
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/QCOM_driver_control.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.*;
+import org.lwjgl.util.generator.opengl.GLchar;
+import org.lwjgl.util.generator.opengl.GLreturn;
+import org.lwjgl.util.generator.opengl.GLsizei;
+import org.lwjgl.util.generator.opengl.GLuint;
+
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+public interface QCOM_driver_control {
+
+ void glGetDriverControlsQCOM(@OutParameter @Check(value = "1", canBeNull = true) IntBuffer num,
+ @AutoSize(value = "driverControls", canBeNull = true) @GLsizei int size,
+ @OutParameter @Check(canBeNull = true) @GLuint IntBuffer driverControls);
+
+ void glGetDriverControlStringQCOM(@GLuint int driverControl,
+ @AutoSize(value = "driverControlString", canBeNull = true) @GLsizei int bufSize,
+ @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length,
+ @OutParameter @Check(canBeNull = true) @GLchar ByteBuffer driverControlString);
+
+ @Alternate("glGetDriverControlStringQCOM")
+ @GLreturn(value = "driverControlString", maxLength = "bufSize")
+ void glGetDriverControlStringQCOM2(@GLuint int driverControl,
+ @GLsizei int bufSize,
+ @OutParameter @GLsizei @Constant("driverControlString_length, 0") IntBuffer length,
+ @OutParameter @GLchar ByteBuffer driverControlString);
+
+ void glEnableDriverControlQCOM(@GLuint int driverControl);
+
+ void glDisableDriverControlQCOM(@GLuint int driverControl);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/QCOM_extended_get.java b/src/templates/org/lwjgl/opengles/QCOM_extended_get.java
new file mode 100644
index 00000000..8b5cad0f
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/QCOM_extended_get.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.AutoSize;
+import org.lwjgl.util.generator.Check;
+import org.lwjgl.util.generator.OutParameter;
+import org.lwjgl.util.generator.Result;
+import org.lwjgl.util.generator.opengl.*;
+
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+public interface QCOM_extended_get {
+
+ /** Accepted by the <pname> parameter of ExtGetTexLevelParameterivQCOM */
+ int GL_TEXTURE_WIDTH_QCOM = 0x8BD2,
+ GL_TEXTURE_HEIGHT_QCOM = 0x8BD3,
+ GL_TEXTURE_DEPTH_QCOM = 0x8BD4,
+ GL_TEXTURE_INTERNAL_FORMAT_QCOM = 0x8BD5,
+ GL_TEXTURE_FORMAT_QCOM = 0x8BD6,
+ GL_TEXTURE_TYPE_QCOM = 0x8BD7,
+ GL_TEXTURE_IMAGE_VALID_QCOM = 0x8BD8,
+ GL_TEXTURE_NUM_LEVELS_QCOM = 0x8BD9,
+ GL_TEXTURE_TARGET_QCOM = 0x8BDA,
+ GL_TEXTURE_OBJECT_VALID_QCOM = 0x8BDB;
+
+ /** Accepted by the <pname> parameter of ExtTexObjectStateOverrideiQCOM */
+ int GL_STATE_RESTORE = 0x8BDC;
+
+ void glExtGetTexturesQCOM(@OutParameter @Check("1") @GLuint IntBuffer textures,
+ @AutoSize("textures") int maxTextures,
+ @OutParameter @Check("1") IntBuffer numTextures);
+
+ void glExtGetBuffersQCOM(@OutParameter @Check("1") @GLuint IntBuffer buffers,
+ @AutoSize("buffers") int maxBuffers,
+ @OutParameter @Check("1") IntBuffer numBuffers);
+
+ void glExtGetRenderbuffersQCOM(@OutParameter @Check("1") @GLuint IntBuffer renderbuffers,
+ @AutoSize("renderbuffers") int maxRenderbuffers,
+ @OutParameter @Check("1") IntBuffer numRenderbuffers);
+
+ void glExtGetFramebuffersQCOM(@OutParameter @Check("1") @GLuint IntBuffer framebuffers,
+ @AutoSize("framebuffers") int maxFramebuffers,
+ @OutParameter @Check("1") IntBuffer numFramebuffers);
+
+ void glExtGetTexLevelParameterivQCOM(@GLuint int texture, @GLenum int face, int level,
+ @GLenum int pname, @OutParameter @Check("1") IntBuffer params);
+
+ void glExtTexObjectStateOverrideiQCOM(@GLenum int target, @GLenum int pname, int param);
+
+ void glExtGetTexSubImageQCOM(@GLenum int target, int level,
+ int xoffset, int yoffset, int zoffset,
+ @GLsizei int width, @GLsizei int height, @GLsizei int depth,
+ @GLenum int format, @GLenum int type,
+ @OutParameter
+ @Check("GLChecks.calculateImageStorage(texels, format, type, width, height, depth)")
+ @GLbyte
+ @GLshort
+ @GLint
+ @GLfloat Buffer texels);
+
+ void glExtGetBufferPointervQCOM(@GLenum int target, @Result @GLvoid ByteBuffer params);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/QCOM_extended_get2.java b/src/templates/org/lwjgl/opengles/QCOM_extended_get2.java
new file mode 100644
index 00000000..63de0fbe
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/QCOM_extended_get2.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.AutoSize;
+import org.lwjgl.util.generator.Check;
+import org.lwjgl.util.generator.OutParameter;
+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;
+import java.nio.IntBuffer;
+
+public interface QCOM_extended_get2 {
+
+ void glExtGetShadersQCOM(@OutParameter @Check("1") @GLuint IntBuffer shaders,
+ @AutoSize("shaders") int maxShaders,
+ @OutParameter @Check("1") IntBuffer numShaders);
+
+ void glExtGetProgramsQCOM(@OutParameter @Check("1") @GLuint IntBuffer programs,
+ @AutoSize("programs") int maxPrograms,
+ @OutParameter @Check("1") IntBuffer numPrograms);
+
+ boolean glExtIsProgramBinaryQCOM(@GLuint int program);
+
+ void glExtGetProgramBinarySourceQCOM(@GLuint int program, @GLenum int shadertype,
+ @OutParameter @Check @GLchar ByteBuffer source, @OutParameter @Check("1") IntBuffer length);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/QCOM_performance_monitor_global_mode.java b/src/templates/org/lwjgl/opengles/QCOM_performance_monitor_global_mode.java
new file mode 100644
index 00000000..d3b868bf
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/QCOM_performance_monitor_global_mode.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface QCOM_performance_monitor_global_mode {
+
+ /**
+ * Accepted by the <cap> parameter of Enable and Disable, and
+ * IsEnabled, and by the <pname> parameter of GetBooleanv, GetIntegerv,
+ * and GetFloatv:
+ */
+ int GL_PERFMON_GLOBAL_MODE_QCOM = 0x8FA0;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/QCOM_tiled_rendering.java b/src/templates/org/lwjgl/opengles/QCOM_tiled_rendering.java
new file mode 100644
index 00000000..6b107274
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/QCOM_tiled_rendering.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+import org.lwjgl.util.generator.opengl.GLbitfield;
+import org.lwjgl.util.generator.opengl.GLuint;
+
+public interface QCOM_tiled_rendering {
+
+ /**
+ * Accepted by the <preserveMask> parameter of StartTilingQCOM and
+ * EndTilingQCOM
+ */
+ int GL_COLOR_BUFFER_BIT0_QCOM = 0x00000001,
+ GL_COLOR_BUFFER_BIT1_QCOM = 0x00000002,
+ GL_COLOR_BUFFER_BIT2_QCOM = 0x00000004,
+ GL_COLOR_BUFFER_BIT3_QCOM = 0x00000008,
+ GL_COLOR_BUFFER_BIT4_QCOM = 0x00000010,
+ GL_COLOR_BUFFER_BIT5_QCOM = 0x00000020,
+ GL_COLOR_BUFFER_BIT6_QCOM = 0x00000040,
+ GL_COLOR_BUFFER_BIT7_QCOM = 0x00000080,
+ GL_DEPTH_BUFFER_BIT0_QCOM = 0x00000100,
+ GL_DEPTH_BUFFER_BIT1_QCOM = 0x00000200,
+ GL_DEPTH_BUFFER_BIT2_QCOM = 0x00000400,
+ GL_DEPTH_BUFFER_BIT3_QCOM = 0x00000800,
+ GL_DEPTH_BUFFER_BIT4_QCOM = 0x00001000,
+ GL_DEPTH_BUFFER_BIT5_QCOM = 0x00002000,
+ GL_DEPTH_BUFFER_BIT6_QCOM = 0x00004000,
+ GL_DEPTH_BUFFER_BIT7_QCOM = 0x00008000,
+ GL_STENCIL_BUFFER_BIT0_QCOM = 0x00010000,
+ GL_STENCIL_BUFFER_BIT1_QCOM = 0x00020000,
+ GL_STENCIL_BUFFER_BIT2_QCOM = 0x00040000,
+ GL_STENCIL_BUFFER_BIT3_QCOM = 0x00080000,
+ GL_STENCIL_BUFFER_BIT4_QCOM = 0x00100000,
+ GL_STENCIL_BUFFER_BIT5_QCOM = 0x00200000,
+ GL_STENCIL_BUFFER_BIT6_QCOM = 0x00400000,
+ GL_STENCIL_BUFFER_BIT7_QCOM = 0x00800000,
+ GL_MULTISAMPLE_BUFFER_BIT0_QCOM = 0x01000000,
+ GL_MULTISAMPLE_BUFFER_BIT1_QCOM = 0x02000000,
+ GL_MULTISAMPLE_BUFFER_BIT2_QCOM = 0x04000000,
+ GL_MULTISAMPLE_BUFFER_BIT3_QCOM = 0x08000000,
+ GL_MULTISAMPLE_BUFFER_BIT4_QCOM = 0x10000000,
+ GL_MULTISAMPLE_BUFFER_BIT5_QCOM = 0x20000000,
+ GL_MULTISAMPLE_BUFFER_BIT6_QCOM = 0x40000000,
+ GL_MULTISAMPLE_BUFFER_BIT7_QCOM = 0x80000000;
+
+ void glStartTilingQCOM(@GLuint int x, @GLuint int y, @GLuint int width, @GLuint int height,
+ @GLbitfield int preserveMask);
+
+ void glEndTilingQCOM(@GLbitfield int preserveMask);
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/QCOM_writeonly_rendering.java b/src/templates/org/lwjgl/opengles/QCOM_writeonly_rendering.java
new file mode 100644
index 00000000..d1fb684e
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/QCOM_writeonly_rendering.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface QCOM_writeonly_rendering {
+
+ /** Accepted by the <cap> parameter of Enable, Disable. */
+ int GL_WRITEONLY_RENDERING_QCOM = 0x8823;
+
+}
\ No newline at end of file
diff --git a/src/templates/org/lwjgl/opengles/VIV_shader_binary.java b/src/templates/org/lwjgl/opengles/VIV_shader_binary.java
new file mode 100644
index 00000000..249cd1ee
--- /dev/null
+++ b/src/templates/org/lwjgl/opengles/VIV_shader_binary.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengles;
+
+public interface VIV_shader_binary {
+
+ /** Accepted by the <binaryformat> parameter of ShaderBinary: */
+ int GL_SHADER_BINARY_VIV = 0x8FC4;
+
+}