Skip to content

Commit

Permalink
Add OpenGL 3.3, 4.0 and 4.1 language mapping.
Browse files Browse the repository at this point in the history
- Update header:
    - GL/glext.h to khronos 2010-08-03
    - GL3/gl3.h to khronos 2010-08-03

    - Move platform code to
        GL/glplatform.h
        GL3/glplatform.h

    - Unify 64bit typedefs: gl-64bit-types.h

    - Move GL 3.[123] and 4.[01] complete subsumed extension
      enums and functions into their extension spec and just reference them.
      This ensures proper extension availability
      via lower OpenGL profiles, hence a proper GL2GL3 interface.

- GL3/GL4 cleanup:
  - make-glextension-depignore.sh:
    determine required GL version for extensions
    for proper positioning, ie GL2GL3 or GL3 or GL4
    via gluegen IgnoreExtension commands.

  - use ARB_ES2_compatibility for common GL2ES2 methods,
    if available

  - consolidated gl2-gl4 subsumed extension to gl-common.cfg

- Missing GL3/GL4 Functions:
    glMultiDrawElementsBaseVertex
    glDebugMessageCallbackARB
    glDebugMessageCallbackAMD

- TODO (new feature integration):
    - ARB_ES2_compatibility / ARB_get_program_binary for com/jogamp/opengl/util/glsl, ie
        - store binaries com/jogamp/opengl/util/glsl/sdk/CompileShader*
        - query supported binary formats (enums ?)
        - optional prio binaries
    - ARB_ES2_compatibility, if available GLES2/GL2ES12 would be available
    - ARB_separate_shader_objects for com/jogamp/opengl/util/glsl, ie
        - swizzle vertex/fragment shader in programs
        - ..
  • Loading branch information
sgothel committed Aug 24, 2010
1 parent 8d55c43 commit ca119c9
Show file tree
Hide file tree
Showing 50 changed files with 7,082 additions and 3,166 deletions.
12 changes: 6 additions & 6 deletions make/build-jogl.xml
Expand Up @@ -439,9 +439,9 @@
<target name="java.generate.gl2_gl3_if">
<echo message="Generating GL2_GL3 interface" />
<antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.opengl}/gl3.c"
<gluegen src="${stub.includes.opengl}/gl3-subset.c"
outputRootDir="${build.jogl}"
config="${config.jogl}/gl-gl3-set.cfg"
config="${config.jogl}/gl-if-gl3-subset.cfg"
includeRefid="stub.includes.fileset.all.gldesktop"
emitter="com.sun.gluegen.opengl.GLEmitter">
<classpath refid="gluegen.classpath" />
Expand All @@ -460,7 +460,7 @@
<antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.opengl}/gl2.c"
outputRootDir="${build.jogl}"
config="${config.jogl}/gl-gl2.cfg"
config="${config.jogl}/gl-if-gl2.cfg"
includeRefid="stub.includes.fileset.all.gldesktop"
emitter="com.sun.gluegen.opengl.GLEmitter">
<classpath refid="gluegen.classpath" />
Expand All @@ -472,7 +472,7 @@
<antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.opengl}/gl3.c"
outputRootDir="${build.jogl}"
config="${config.jogl}/gl-gl3.cfg"
config="${config.jogl}/gl-if-gl3.cfg"
includeRefid="stub.includes.fileset.all.gldesktop"
emitter="com.sun.gluegen.opengl.GLEmitter">
<classpath refid="gluegen.classpath" />
Expand All @@ -484,7 +484,7 @@
<antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.opengl}/gl3bc.c"
outputRootDir="${build.jogl}"
config="${config.jogl}/gl-gl3bc.cfg"
config="${config.jogl}/gl-if-gl3bc.cfg"
includeRefid="stub.includes.fileset.all.gldesktop"
emitter="com.sun.gluegen.opengl.GLEmitter">
<classpath refid="gluegen.classpath" />
Expand All @@ -496,7 +496,7 @@
<antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.opengl}/gl4.c"
outputRootDir="${build.jogl}"
config="${config.jogl}/gl-gl4.cfg"
config="${config.jogl}/gl-if-gl4.cfg"
includeRefid="stub.includes.fileset.all.gldesktop"
emitter="com.sun.gluegen.opengl.GLEmitter">
<classpath refid="gluegen.classpath" />
Expand Down
73 changes: 64 additions & 9 deletions make/config/jogl/gl-common.cfg
Expand Up @@ -35,6 +35,9 @@ Ignore glGetVertexAttribPointerv
Ignore glGetVertexAttribPointervARB
Ignore glGetVertexAttribPointervNV
Ignore glTracePointerRangeMESA
Ignore glMultiDrawElementsBaseVertex
Ignore glDebugMessageCallbackARB
Ignore glDebugMessageCallbackAMD

# Manually implement glMapBuffer as the size of the returned buffer
# can only be computed by calling another routine
Expand Down Expand Up @@ -221,13 +224,8 @@ RenameExtensionIntoCore GL_EXT_packed_float
RenameExtensionIntoCore GL_EXT_texture_shared_exponent

# gl.h uses GL_ARB_framebuffer_object
# GL_*_geometry_shader4 is included here, due to a naming collision otherwise.
# glFramebufferTextureLayerARB is ignored due to it's existence in GL_ARB_framebuffer_object and GL_ARB_geometry_shader4
RenameExtensionIntoCore GL_ARB_framebuffer_object
IgnoreExtension GL_EXT_framebuffer_object
RenameExtensionIntoCore GL_ARB_geometry_shader4
IgnoreExtension GL_EXT_geometry_shader4
Ignore glFramebufferTextureLayerARB

RenameExtensionIntoCore GL_NV_half_float
RenameExtensionIntoCore GL_ARB_half_float_pixel
Expand Down Expand Up @@ -269,27 +267,83 @@ RenameExtensionIntoCore GL_ARB_map_buffer_range
RenameExtensionIntoCore GL_ARB_draw_instanced
IgnoreExtension GL_EXT_draw_instanced
RenameExtensionIntoCore GL_ARB_copy_buffer
RenameExtensionIntoCore GL_NV_primitive_restart
# Does not match the common namespace GL_NV_primitive_restart
RenameExtensionIntoCore GL_ARB_texture_buffer_object
IgnoreExtension GL_EXT_texture_buffer_object
# Actually GL_ARB_texture_rectangle, but let's be convenient
# We rename EXT_texture_rectangle into core, so ARB_texture_rectangle will stay for convenience
RenameExtensionIntoCore GL_EXT_texture_rectangle
IgnoreExtension GL_NV_texture_rectangle
RenameExtensionIntoCore GL_ARB_uniform_buffer_object
# <<< OpenGL 3.1


# >>> OpenGL 3.2
# Rename extension suffices (if exist) subsumed in OpenGL 3.2 (from OpenGL 3.2 spec, Appendix H.1)
RenameExtensionIntoCore GL_ARB_vertex_array_bgra
RenameExtensionIntoCore GL_ARB_draw_elements_base_vertex
RenameExtensionIntoCore GL_ARB_fragment_coord_conventions
RenameExtensionIntoCore GL_ARB_provoking_vertex
RenameExtensionIntoCore GL_ARB_seamless_cube_map
RenameExtensionIntoCore GL_ARB_texture_multisample
RenameExtensionIntoCore GL_ARB_depth_clamp
# GL_ARB_geometry_shader4 is subsumed but values/namespace is orthogonal
IgnoreExtension GL_EXT_geometry_shader4
RenameExtensionIntoCore GL_ARB_sync
# <<< OpenGL 3.2

# >>> OpenGL 3.3
# Rename extension suffices (if exist) subsumed in OpenGL 3.3 (from OpenGL 3.3 spec, Appendix I.1)
RenameExtensionIntoCore GL_ARB_shader_bit_encoding
RenameExtensionIntoCore GL_ARB_blend_func_extended
RenameExtensionIntoCore GL_ARB_explicit_attrib_location
RenameExtensionIntoCore GL_ARB_occlusion_query2
RenameExtensionIntoCore GL_ARB_sampler_objects
RenameExtensionIntoCore GL_ARB_texture_rgb10_a2ui
RenameExtensionIntoCore GL_ARB_texture_swizzle
RenameExtensionIntoCore GL_ARB_timer_query
RenameExtensionIntoCore GL_ARB_instanced_arrays
RenameExtensionIntoCore GL_ARB_vertex_type_2_10_10_10_rev
# <<< OpenGL 3.3

# >>> OpenGL 4.0
# Rename extension suffices (if exist) subsumed in OpenGL 4.0 (from OpenGL 4.0 spec, Appendix J.1)
RenameExtensionIntoCore GL_ARB_texture_query_lod
RenameExtensionIntoCore GL_ARB_draw_buffers_blend
RenameExtensionIntoCore GL_ARB_draw_indirect
RenameExtensionIntoCore GL_ARB_gpu_shader5
RenameExtensionIntoCore GL_ARB_gpu_shader_fp64
RenameExtensionIntoCore GL_ARB_sample_shading
RenameExtensionIntoCore GL_ARB_shader_subroutine
RenameExtensionIntoCore GL_ARB_tessellation_shader
RenameExtensionIntoCore GL_ARB_texture_buffer_object_rgb32
RenameExtensionIntoCore GL_ARB_texture_cube_map_array
RenameExtensionIntoCore GL_ARB_texture_gather
RenameExtensionIntoCore GL_ARB_transform_feedback2
RenameExtensionIntoCore GL_ARB_transform_feedback3
# <<< OpenGL 4.0

# >>> OpenGL 4.1
# Rename extension suffices (if exist) subsumed in OpenGL 4.1 (from OpenGL 4.1 spec, Appendix K.1)
RenameExtensionIntoCore GL_ARB_ES2_compatibility
RenameExtensionIntoCore GL_ARB_get_program_binary
RenameExtensionIntoCore GL_ARB_separate_shader_objects
RenameExtensionIntoCore GL_ARB_shader_precision
RenameExtensionIntoCore GL_ARB_vertex_attrib_64bit
IgnoreExtension GL_EXT_vertex_attrib_64bit
RenameExtensionIntoCore GL_ARB_viewport_array
# <<< OpenGL 4.1

# Ignore a few obsolete versions of extensions that have been subsumed into the core or ARB extensions
IgnoreExtension GL_EXT_multisample
IgnoreExtension GL_EXT_point_parameters
IgnoreExtension GL_EXT_texture_rectangle
IgnoreExtension GL_EXT_separate_shader_objects


#
# Opaques and other directives for platform-independent routines
#

Opaque boolean GLboolean
Opaque long GLsync
ReturnsString glGetString
ReturnsString glGetStringi

Expand Down Expand Up @@ -349,6 +403,7 @@ ReturnValueCapacity wglAllocateMemoryNV {0}
ReturnValueCapacity glXAllocateMemoryNV {0}

ReturnValueCapacity glMapBufferRange {2}
ReturnValueCapacity glMapNamedBufferRangeEXT {2}

# Pass arguments to ARB_vertex_program, ARB_fragment_program,
# ARB_shader_objects, NV_vertex_program, NV_fragment_program, and
Expand Down
1 change: 1 addition & 0 deletions make/config/jogl/gl-es2.cfg
Expand Up @@ -20,6 +20,7 @@ Implements GLES2Impl GL2ES2
HierarchicalNativeOutput false
Include gl-common.cfg
Include gl-common-extensions.cfg
Include gl2_es2-common.cfg

EmitProcAddressTable true
ProcAddressTableClassName GLES2ProcAddressTable
Expand Down
7 changes: 1 addition & 6 deletions make/config/jogl/gl-gl2es12.cfg
Expand Up @@ -21,6 +21,7 @@ Implements GL2ES12Impl GL2ES2
Include gl-common.cfg
Include gl-common-extensions.cfg
Include gl-desktop.cfg
Include gl2_es2-common.cfg

# 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
Expand Down Expand Up @@ -64,12 +65,6 @@ CustomJavaCode GL2ES12Impl glFrustum((double)left, (double)right, (double)bott
CustomJavaCode GL2ES12Impl public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar) {
CustomJavaCode GL2ES12Impl glOrtho((double)left, (double)right, (double)bottom, (double)top, (double)zNear, (double)zFar); }

CustomJavaCode GL2ES12Impl public void glClearDepthf(float depth) {
CustomJavaCode GL2ES12Impl glClearDepth((double)depth); }

CustomJavaCode GL2ES12Impl public void glDepthRangef(float zNear, float zFar) {
CustomJavaCode GL2ES12Impl glDepthRange((double)zNear, (double)zFar); }

Include gl-headers.cfg
Include ../intptr.cfg

Expand Down
9 changes: 1 addition & 8 deletions make/config/jogl/gl-gl4bc.cfg
Expand Up @@ -42,9 +42,8 @@ Implements GL4bcImpl GL4
Include gl-common.cfg
Include gl-common-extensions.cfg
Include gl-desktop.cfg
Include gl3-common.cfg
Include gl4-common.cfg
Include gl3-desktop.cfg
Include gl2_es2-common.cfg

# Manually implement glMapNamedBufferEXT as the size of the returned buffer
# can only be computed by calling another routine
Expand Down Expand Up @@ -84,12 +83,6 @@ CustomJavaCode GL4bcImpl glFrustum((double)left, (double)right, (double)bottom
CustomJavaCode GL4bcImpl public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar) {
CustomJavaCode GL4bcImpl glOrtho((double)left, (double)right, (double)bottom, (double)top, (double)zNear, (double)zFar); }

CustomJavaCode GL4bcImpl public void glClearDepthf(float depth) {
CustomJavaCode GL4bcImpl glClearDepth((double)depth); }

CustomJavaCode GL4bcImpl public void glDepthRangef(float zNear, float zFar) {
CustomJavaCode GL4bcImpl glDepthRange((double)zNear, (double)zFar); }

Include gl-headers.cfg
Include gl3ext-headers.cfg
Include ../intptr.cfg
Expand Down
19 changes: 0 additions & 19 deletions make/config/jogl/gl-if-CustomJavaCode-gl2.java

This file was deleted.

46 changes: 46 additions & 0 deletions make/config/jogl/gl-if-CustomJavaCode-gl2_es2.java
@@ -0,0 +1,46 @@

/** Start: GL_ARB_ES2_compatibility functions, which are part of ES2 core as well */

/** Entry point to C language function:
* <code> void {@native glReleaseShaderCompiler}(void); </code>
* <br>Part of <code>GL_ES_VERSION_2_0</code> and <code>GL_ARB_ES2_compatibility</code>.
* <br> Nop if no native implementation is available. */
public void glReleaseShaderCompiler();

/** Entry point to C language function:
* <code> void {@native glShaderBinary}(GLint n, const GLuint * shaders, GLenum binaryformat, const void * binary, GLint length); </code>
* <br>Part of <code>GL_ES_VERSION_2_0</code> and <code>GL_ARB_ES2_compatibility</code>.
* <br> Throws GLException if no native implementation is available. */
public void glShaderBinary(int n, IntBuffer shaders, int binaryformat, Buffer binary, int length);

/** Entry point to C language function:
* <code> void {@native glShaderBinary}(GLint n, const GLuint * shaders, GLenum binaryformat, const void * binary, GLint length); </code>
* <br>Part of <code>GL_ES_VERSION_2_0</code> and <code>GL_ARB_ES2_compatibility</code>.
* <br> Throws GLException if no native implementation is available. */
public void glShaderBinary(int n, int[] shaders, int shaders_offset, int binaryformat, Buffer binary, int length);

/** Entry point to C language function:
* <code> void {@native glGetShaderPrecisionFormat}(GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision); </code>
* <br>Part of <code>GL_ES_VERSION_2_0</code> and <code>GL_ARB_ES2_compatibility</code>.
* <br> Throws GLException if no native implementation is available. */
public void glGetShaderPrecisionFormat(int shadertype, int precisiontype, IntBuffer range, IntBuffer precision);

/** Entry point to C language function:
* <code> void {@native glGetShaderPrecisionFormat}(GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision); </code>
* <br>Part of <code>GL_ES_VERSION_2_0</code> and <code>GL_ARB_ES2_compatibility</code>.
* <br> Throws GLException if no native implementation is available. */
public void glGetShaderPrecisionFormat(int shadertype, int precisiontype, int[] range, int range_offset, int[] precision, int precision_offset);

/** Entry point to C language function:
* <code> void {@native glDepthRangef}(GLclampf zNear, GLclampf zFar); </code>
* <br>Part of <code>GL_ES_VERSION_2_0</code> and <code>GL_ARB_ES2_compatibility</code>.
* <br> Calls <code> void {@native glDepthRange}(GLclampd zNear, GLclampd zFar); </code> if no native implementation is available. */
public void glDepthRangef(float zNear, float zFar);

/** Entry point to C language function:
* <code> void {@native glClearDepthf}(GLclampf depth); </code>
* <br>Part of <code>GL_ES_VERSION_2_0</code> and <code>GL_ARB_ES2_compatibility</code>.
* <br> Calls <code> void {@native glClearDepth}(GLclampd depth); </code> if no native implementation is available. */
public void glClearDepthf(float depth);

/** End: GL_ARB_ES2_compatibility functions, which are part of ES2 core as well */
2 changes: 2 additions & 0 deletions make/config/jogl/gl-if-gl.cfg
Expand Up @@ -10,6 +10,8 @@ HierarchicalNativeOutput false
Include gl-common.cfg
Include gl-common-extensions.cfg
Include gl-if-gl-ignores.cfg
Include gl-if-gl3-ignores.cfg
Include gl-if-gl4-ignores.cfg

JavaOutputDir gensrc/classes
NativeOutputDir gensrc/native/jogl
Expand Down
Expand Up @@ -22,6 +22,8 @@ Extends GL2 GL2GL3
Include gl-common.cfg
Include gl-common-extensions.cfg
Include gl-desktop.cfg
Include gl-if-gl3-ignores.cfg
Include gl-if-gl4-ignores.cfg

# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums
TagNativeBinding true
Expand All @@ -32,8 +34,6 @@ IgnoreExtension GL_EXT_point_parameters
CustomJavaCode GL2 public boolean glIsPBOPackEnabled();
CustomJavaCode GL2 public boolean glIsPBOUnpackEnabled();

IncludeAs CustomJavaCode GL2 gl-if-CustomJavaCode-gl2.java

Include gl-headers.cfg
Include ../intptr.cfg

Expand Down
13 changes: 12 additions & 1 deletion make/config/jogl/gl-if-gl2_es2.cfg
Expand Up @@ -10,21 +10,32 @@ ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.jav
HierarchicalNativeOutput false
Include gl-common.cfg
Include gl-common-extensions.cfg
Include gl-if-gl3-ignores.cfg
Include gl-if-gl4-ignores.cfg

JavaOutputDir gensrc/classes
NativeOutputDir gensrc/native/jogl

# Ignore all ES 2.X only stuff ..
# Ignore ^gl.*x(v)?(OES)?
Ignore glGetShaderPrecisionFormat
Ignore glEGL.*
#Ignore glFramebufferVertexAttribArrayNV
#Ignore glCoverageOperationNV
#Ignore glCoverageMaskNV

# Ignore GL_ARB_ES2_compatibility functions for interface code generation
# since we need our own javadoc header for a detailed description
Ignore glReleaseShaderCompiler
Ignore glShaderBinary
Ignore glGetShaderPrecisionFormat
Ignore glDepthRangef
Ignore glClearDepthf

CustomJavaCode GL2ES2 public void glClearDepth( double depth );
CustomJavaCode GL2ES2 public void glDepthRange(double zNear, double zFar);

IncludeAs CustomJavaCode GL2ES2 gl-if-CustomJavaCode-gl2_es2.java

EmitProcAddressTable false
ProcAddressTableClassName DontGenerateProcAddressTableStuff
GetProcAddressTableExpr DontGenerateProcAddressTableStuff
Expand Down
5 changes: 4 additions & 1 deletion make/config/jogl/gl-if-gl2_gl3.cfg
Expand Up @@ -10,12 +10,15 @@ ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/G
ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java
ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java

ExtendedInterfaceSymbolsOnly ../build-temp/gluegen-set/javax/media/opengl/GL3Set.java
ExtendedInterfaceSymbolsOnly ../build-temp/gluegen-set/javax/media/opengl/GL3Subset.java

HierarchicalNativeOutput false
Include gl-common.cfg
Include gl-common-extensions.cfg
Include gl-desktop.cfg
Include gl-if-gl4-ignores.cfg

IncludeAs CustomJavaCode GL2GL3 gl-if-CustomJavaCode-gl2_gl3.java

JavaOutputDir gensrc/classes
NativeOutputDir gensrc/native/jogl
Expand Down
21 changes: 21 additions & 0 deletions make/config/jogl/gl-if-gl3-ignores.cfg
@@ -0,0 +1,21 @@
#
# Generated Configuration File
# Use make-glextension-depignore.sh to update!
#

#
# OpenGL 3.x dependencies
#
# We allow GL_VERSION_3_0 within GL2
IgnoreExtension GL_VERSION_3_1
IgnoreExtension GL_VERSION_3_2
IgnoreExtension GL_VERSION_3_3
IgnoreExtension GL_VERSION_3_4
IgnoreExtension GL_ARB_sync
IgnoreExtension GL_ARB_texture_compression_bptc
IgnoreExtension GL_ARB_draw_indirect
IgnoreExtension GL_ARB_gpu_shader5
IgnoreExtension GL_ARB_gpu_shader_fp64
IgnoreExtension GL_ARB_tessellation_shader
IgnoreExtension GL_NV_gpu_shader5

0 comments on commit ca119c9

Please sign in to comment.