# This .cfg file is used to generate the GL interface and implementing class.
JavaOutputDir gensrc/classes
NativeOutputDir gensrc/native/jogl/es2

ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java
ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java
ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java

Package javax.media.opengl
Style InterfaceAndImpl
JavaClass GLES2
Extends GLES2 GLBase
Extends GLES2 GL
Extends GLES2 GL2ES2
ImplPackage jogamp.opengl.es2
ImplJavaClass GLES2Impl
Implements GLES2Impl GLBase
Implements GLES2Impl GL
Implements GLES2Impl GL2ES2
HierarchicalNativeOutput false
Include gl-common.cfg
Include gl-common-extensions.cfg
Include gl2_es2-common.cfg

RenameExtensionIntoCore GL_OES_texture_3D
RenameExtensionIntoCore GL_OES_get_program_binary

EmitProcAddressTable true
ProcAddressTableClassName GLES2ProcAddressTable
GetProcAddressTableExpr ((GLES2ProcAddressTable)_context.getGLProcAddressTable())

# Inform the glue code generator of the association between #defines
# and functions and the extensions in which they are defined
GLHeader GLES2/gl2.h
GLHeader GLES2/gl2ext.h
GLHeader GL/gl.h
GLHeader GL/glext.h

# Force all of the methods to be emitted using dynamic linking so we
# don't need to link against any emulation library on the desktop or
# depend on the presence of an import library for a particular device
ForceProcAddressGen __ALL__

# Also force the calling conventions of the locally generated function
# pointer typedefs for these routines to GL_APIENTRY
LocalProcAddressCallingConvention __ALL__ GL_APIENTRY

# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums
TagNativeBinding true

# Add PixelStorei StateTracker
#
# Add input validation to glPixelStorei, just to be sure.
CustomJavaCode GLES2Impl private static final int params_offset = 0; // just a helper for JavaPrologue ..

JavaPrologue glPixelStorei if (pname != GL_PACK_ALIGNMENT && pname != GL_UNPACK_ALIGNMENT) {
JavaPrologue glPixelStorei     throw new GLException("Unsupported pixel store parameter name 0x" + Integer.toHexString(pname));
JavaPrologue glPixelStorei }
JavaPrologue glPixelStorei glStateTracker.setInt(pname, param);

JavaPrologue glGetIntegerv if ( glStateTracker.getInt(pname, params, params_offset) ) { return; }

IncludeAs CustomJavaCode GLES2 gl-if-CustomJavaCode-gles2.java

CustomCCode #include <stdio.h> /* android */
CustomCCode /* Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in
CustomCCode    "glext.h" are parsed. */
CustomCCode #define GL_GLEXT_PROTOTYPES

CustomCCode /* Include the OpenGL headers */
CustomCCode /* #define GL_APICALL __declspec(dllimport) */
CustomCCode #include <GLES2/gl2.h>
CustomCCode #include <GLES2/gl2ext.h>
CustomCCode #include <stdlib.h>

IncludeAs CustomJavaCode GLES2Impl gl-impl-CustomJavaCode-common.java
IncludeAs CustomJavaCode GLES2Impl gl-impl-CustomJavaCode-gles2.java
IncludeAs CustomJavaCode GLES2Impl gl-impl-CustomJavaCode-embedded.java
IncludeAs CustomJavaCode GLES2Impl gl-impl-CustomJavaCode-gl2_es2.java
IncludeAs CustomCCode gl-impl-CustomCCode-gles2.c

Import javax.media.opengl.GLES1
Import javax.media.opengl.GLES2
Import javax.media.opengl.GL2
Import javax.media.opengl.GLArrayData
Import javax.media.opengl.GLUniformData
Import com.jogamp.common.nio.Buffers
Import com.jogamp.opengl.util.GLBuffers
Import java.io.PrintStream