OpenGL Extension Handler

Home of the best OpenGL headers in the world.

This is a really simple script-driven tool for importing OpenGL and extension functions. It is focused on OpenGL core profile, a setup with no deprecated functions. But it isn't limited to it. We used it to generate headers for our OpenGL ES 2.0 emulator. In fact, it is similar to GLEW, but it has some neat advantages.

GLEH documentation

Headers generated using GLEH contain OpenGL function documentation, which is very helpful at times.

MSVC intellisense screenshot

Also, it does support intellisense (see the image above), which is quite cool if you're so forgetful and lazy like me.

It has quite an unique feature called GLACH (GL AutoCheck), which transparently inserts OpenGL error checking after each OpenGL command. It may seem like a terrible overhead, and in fact, debug code gets slower on high CPU load (because of CPU-GPU synchronization), but it enables you to write code without any error checking in release, which makes it faster (error reporting on target machine is disabled in driver settings by default anyway - so why bother). In case an OpenGL error occurs, it throws an exception (several other options such as user breakpoint are also available) with error code (such as GL_INVALID_OPERATION), file and line where the error occured in the source code, and the name of OpenGL function where the error occured. Enabling GL_TEXTURE_2D_ARRAY (which is illegal) may look like this:

GL_AUTOCHECK: file 'e:\my-job-today\gl4demo\main.cpp', line 75, function glEnable(): GL_INVALID_ENUM
Press any key to continue . . .

Autocheck can be enabled or disabled using a macro, by default it is present in debug and stripped in release, but any behavior is possible.

And last, but not least, GLEH does have a snappy name.

The headers are generated automatically from extensions from OpenGL extension registry, so it is very easy to add new extensions. The documentation is downloaded and parsed from OpenGL man pages. The only downside with this is there are sometimes errors in the documentation files, or sometimes the specification and documentation doesn't agree on function parameter names so it may be necessary to edit the downloaded files here and there. But the parser reports all the errors and oddities so it is rather easy to avoid (most of the) mistakes.

status: functional, under development
language: C++
os: os independent

version history

versionchanges from previous version
v10

Have the following extensions:

  • OpenGL 1.0
  • OpenGL 1.1
  • OpenGL 1.2
  • OpenGL 1.3
  • OpenGL 1.4
  • OpenGL 1.5
  • OpenGL 2.0
  • OpenGL 2.1
  • OpenGL 3.0
    • GL_ARB_depth_buffer_float
    • GL_ARB_framebuffer_object
    • GL_ARB_framebuffer_srgb
    • GL_ARB_half_float_vertex
    • GL_ARB_map_buffer_range
    • GL_ARB_texture_compression_rgtc
    • GL_ARB_texture_rg
    • GL_ARB_vertex_array_object
  • OpenGL 3.1
    • GL_ARB_uniform_buffer_object
    • GL_ARB_draw_instanced
    • GL_ARB_copy_buffer
  • OpenGL 3.2
    • GL_ARB_depth_clamp
    • GL_ARB_draw_elements_base_vertex
    • GL_ARB_fragment_coord_conventions
    • GL_ARB_provoking_vertex
    • GL_ARB_seamless_cube_map
    • GL_ARB_sync
    • GL_ARB_texture_multisample
    • GL_ARB_vertex_array_bgra
  • OpenGL 3.3
    • GL_ARB_shader_bit_encoding
    • GL_ARB_blend_func_extended
    • GL_ARB_explicit_attrib_location
    • GL_ARB_occlusion_query2
    • GL_ARB_sampler_objects
    • GL_ARB_texture_rgb10_a2ui
    • GL_ARB_texture_swizzle
    • GL_ARB_timer_query
    • GL_ARB_instanced_arrays
    • GL_ARB_vertex_type_2_10_10_10_rev
  • OpenGL 4.0
    • GL_ARB_texture_query_lod
    • GL_ARB_draw_buffers_blend
    • GL_ARB_draw_indirect
    • GL_ARB_gpu_shader5
    • GL_ARB_gpu_shader_fp64
    • GL_ARB_sample_shading
    • GL_ARB_shader_subroutine
    • GL_ARB_tessellation_shader
    • GL_ARB_texture_buffer_object_rgb32
    • GL_ARB_texture_gather
    • GL_ARB_texture_cube_map_array
    • GL_ARB_transform_feedback2
    • GL_ARB_transform_feedback3
  • OpenGL 4.1
    • GL_ARB_ES2_compatibility
    • GL_ARB_get_program_binary
    • GL_ARB_separate_shader_objects
    • GL_ARB_shader_precision
    • GL_ARB_vertex_attrib_64bit
    • GL_ARB_viewport_array
  • GL_EXT_draw_buffers2
  • GL_EXT_timer_query
  • GL_EXT_gpu_program_parameters
  • GL_EXT_bindable_uniform
  • GL_ARB_shader_texture_lod
  • GL_ARB_texture_buffer_object
  • GL_S3_S3tc
  • GL_EXT_texture_compression_latc
  • GL_EXT_texture_compression_s3tc
  • GL_ARB_texture_compression_bptc
  • GL_EXT_texture_filter_anisotropic
  • GL_EXT_abgr
  • GL_ARB_shading_language_include
  • GL_ARB_cl_event
  • GL_ARB_debug_output
  • GL_ARB_robustness
  • GL_ARB_shader_stencil_export
v11

Improved autocheck so the debugger points to a line in user's source code where the error occured, not in gl4.h (see the image below).

Output files do not contain any tabs now (only spaces), so there should be no problem displaying the files in editors that do not set 4 spaces per tab. Added support for automatic space-to-tab conversion (can set number of spaces per tab, or disable the conversion).

Fixed OpenGL 4.1 / GL_ARB_viewport_array (the *Indexed() functions are not supported by NVidia driver, but they can be replaced by the *i() functions). See GL_ARB_viewport_array, look for issue 5 ("Why glViewportIndex rather than glEnablei, and so on?").

Optimized the code (gl4.cpp / .h) to reduce compilation time.

v12

Added the following extensions:

  • OpenGL 4.2
    • GL_ARB_texture_compression_bptc
    • GL_ARB_compressed_texture_pixel_storage
    • GL_ARB_shader_atomic_counters
    • GL_ARB_texture_storage
    • GL_ARB_transform_feedback_instanced
    • GL_ARB_base_instance
    • GL_ARB_shader_image_load_store
    • GL_ARB_conservative_depth
    • GL_ARB_shading_language_420pack
    • GL_ARB_internalformat_query
    • GL_ARB_map_buffer_alignment
    • GL_ARB_shading_language_packing
  • GL_EXT_direct_state_access
v13

Added support for OpenGL ES 2.0 (a different header compilation target).

v15

Added OpenGL 4.3 core extensions:

  • GL_ARB_arrays_of_arrays (OpenGL Shading Language only)
  • GL_ARB_ES3_compatibility
  • GL_ARB_clear_buffer_object
  • GL_ARB_compute_shader
  • GL_ARB_copy_image
  • GL_ARB_debug_group
  • GL_ARB_debug_label
  • GL_ARB_debug_output2
  • GL_ARB_debug_output
  • GL_ARB_explicit_uniform_location
  • GL_ARB_fragment_layer_viewport (OpenGL Shading Language only)
  • GL_ARB_framebuffer_no_attachments
  • GL_ARB_internalformat_query2
  • GL_ARB_invalidate_subdata
  • GL_ARB_multi_draw_indirect
  • GL_ARB_program_interface_query
  • GL_ARB_robust_buffer_access_behavior
  • GL_ARB_shader_image_size (OpenGL Shading Language only)
  • GL_ARB_shader_storage_buffer_object
  • GL_ARB_stencil_texturing
  • GL_ARB_texture_buffer_range
  • GL_ARB_texture_query_levels
  • GL_ARB_texture_storage_multisample
  • GL_ARB_texture_view
  • GL_ARB_vertex_attrib_binding
  • GL_KHR_texture_compression_astc_ldr
  • GL_KHR_texture_compression_astc_hdr
  • GL_ARB_robustness_isolation

Changed features with respect to the deprecation model:

  • added GL_VERTEX_ATTRIB_ARRAY_LONG query token
  • removed deprecated GL_UNPACK_LSB_FIRST and GL_PACK_LSB_FIRST
  • GetPointerv() was previously deprecated and now it was added again
  • added previously deprecated GL_STACK_OVERFLOW and GL_STACK_UNDERFLOW
  • GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS was renamed to GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES

Added support for OpenGL 4.4, specifically added:

  • GL_ARB_buffer_storage
  • GL_ARB_clear_texture
  • GL_ARB_enhanced_layouts
  • GL_ARB_multi_bind
  • GL_ARB_query_buffer_object
  • GL_ARB_texture_mirror_clamp_to_edge
  • GL_ARB_texture_stencil8
  • GL_ARB_vertex_type_10f_11f_11f_rev
  • added the GL_MAX_VERTEX_ATTRIB_STRIDE token

Added non-core extensions:

  • GL_ARB_bindless_texture
  • GL_ARB_sparse_texture
  • GL_ARB_compute_variable_group_size
  • GL_ARB_indirect_parameters
  • GL_ARB_seamless_cubemap_per_texture
  • GL_ARB_shader_draw_parameters
  • GL_ARB_shader_group_vote

Fixed some minor commenting issues, added documentation for more functions.


Improved GLACH shows bugs in user's source and not in gl4.h now

Improved GLACH shows bugs in user's source and not in gl4.h now.

downloads

versionrelease datefilerelease notes
v102011-07-18OpenGL40_nolame_2011-07-18_.zipheaders for OpenGL 4.1 core and extensions above
v102011-07-18OpenGL_ExtensionCompiler_v10_2011-07-18_.zipextension compiler tool
v112011-07-20OpenGL40_nolame_2011-07-20_.zipheaders for OpenGL 4.1 core and extensions above
v112011-07-20OpenGL_ExtensionCompiler_v11_2011-07-20_.zipextension compiler tool
v122011-08-09OpenGL40_nolame_2011-08-09_.zipheaders for OpenGL 4.2 core and extensions above
v122011-08-09OpenGL_ExtensionCompiler_v12_2011-08-09_.zipextension compiler tool
v132011-10-26OpenGL_ExtensionCompiler_v13_2011-10-26_gles-support_.zipextension compiler tool
v152014-05-07OpenGL40_nolame_2014-05-07_.zipheaders for OpenGL 4.4 core and extensions above
v152014-05-07OpenGL_ExtensionCompiler_v15_2014-05-07_added-gl44_.zipextension compiler tool