Skip to content
This repository

Regal for OpenGL

branch: master

Now using glsloptimizer to parse and rewrite shaders.

Major enhancements to the state web server.
Added state-based shader instancing to avoid recompiles.
Fixed issue #113 - Possible bug with REGAL_STATISTICS
Corrected handling of GL_POINT_SIZE_MAX state in RegalState.
Refreshed apitrace, civetweb, libpng, and GLEW from upstream.
latest commit 8dda434953
Scott Nations snations authored
Octocat-spinner-32 build Now using glsloptimizer to parse and rewrite shaders. March 27, 2014
Octocat-spinner-32 config Squeeze the footprint of Loader and Missing dispatch for Regal-wrangl… September 25, 2013
Octocat-spinner-32 doc GL_REGAL_proc_address extension adding glGetProcAddressREGAL January 20, 2014
Octocat-spinner-32 examples Now using glsloptimizer to parse and rewrite shaders. March 27, 2014
Octocat-spinner-32 include Now using glsloptimizer to parse and rewrite shaders. March 27, 2014
Octocat-spinner-32 scripts Now using glsloptimizer to parse and rewrite shaders. March 27, 2014
Octocat-spinner-32 src Now using glsloptimizer to parse and rewrite shaders. March 27, 2014
Octocat-spinner-32 tests Add Emu::Quads emulation layer - work in progress, not enabled yet October 14, 2013
Octocat-spinner-32 .gitignore Reorganize Makefile build into a more modular scheme. August 05, 2013
Octocat-spinner-32 .travis.yml Add .travis.yml file for continuous build and test. April 30, 2013
Octocat-spinner-32 Makefile Now using glsloptimizer to parse and rewrite shaders. March 27, 2014
Octocat-spinner-32 Makefile.alphatorus Now using glsloptimizer to parse and rewrite shaders. March 27, 2014
Octocat-spinner-32 Makefile.apitrace Consolidation of environment variable queries at runtime. August 09, 2013
Octocat-spinner-32 Makefile.dreamtorus Apitrace updates, DSA fixes, NV_bindless_texture, NV_draw_texture, AM… November 22, 2013
Octocat-spinner-32 Makefile.dreamtorus_static Now using glsloptimizer to parse and rewrite shaders. March 27, 2014
Octocat-spinner-32 Makefile.expat OpenGL and OpenGL ES 2.0 API updates. October 06, 2013
Octocat-spinner-32 Makefile.glew Consolidation of environment variable queries at runtime. August 09, 2013
Octocat-spinner-32 Makefile.glewinfo Consolidation of environment variable queries at runtime. August 09, 2013
Octocat-spinner-32 Makefile.glsloptlib Now using glsloptimizer to parse and rewrite shaders. March 27, 2014
Octocat-spinner-32 Makefile.glu GL_REGAL_proc_address extension adding glGetProcAddressREGAL January 20, 2014
Octocat-spinner-32 Makefile.glut GL_REGAL_proc_address extension adding glGetProcAddressREGAL January 20, 2014
Octocat-spinner-32 Makefile.gtest Fix link errors against libgtestlib.a October 14, 2013
Octocat-spinner-32 Makefile.libpng Reorganize Makefile build into a more modular scheme. August 05, 2013
Octocat-spinner-32 Makefile.nacl Reorganize Makefile build into a more modular scheme. August 05, 2013
Octocat-spinner-32 Makefile.pcrelib Now using glsloptimizer to parse and rewrite shaders. March 27, 2014
Octocat-spinner-32 Makefile.regal Now using glsloptimizer to parse and rewrite shaders. March 27, 2014
Octocat-spinner-32 Makefile.regaltest Now using glsloptimizer to parse and rewrite shaders. March 27, 2014
Octocat-spinner-32 Makefile.regalw Apitrace updates, DSA fixes, NV_bindless_texture, NV_draw_texture, AM… November 22, 2013
Octocat-spinner-32 Makefile.snappy Reorganize Makefile build into a more modular scheme. August 05, 2013
Octocat-spinner-32 Makefile.tiger GL_REGAL_proc_address extension adding glGetProcAddressREGAL January 20, 2014
Octocat-spinner-32 Makefile.zlib Reorganize Makefile build into a more modular scheme. August 05, 2013
Octocat-spinner-32 README.rst Now using glsloptimizer to parse and rewrite shaders. March 27, 2014
Octocat-spinner-32 nacl-regal.sh [NaCl] Add glibc support May 17, 2013
README.rst
https://raw.github.com/p3/regal/master/doc/regal.jpg

Regal

Recent News

  • November 2013 - Regal Wrangler support added.
  • October 2013 - Emscripten support added.
  • July 2013 - New binaries available for Windows and Mac.
  • July 2013 - OpenGL 4.4 API support added.
  • July 2013 - apitrace support added.

Summary

Regal is a user-space OpenGL layer for OpenGL 2.x, 3.x, 4.x, Core contexts and ES 2.0. Regal implements OpenGL loading, emulation for ES and Core contexts and tools for debugging.

Status

Regal has been in active development on github since May of 2012 --- it is in deployment for internal projects, and has received significant external contributions.

Features such as emulation might not be complete or bug-free enough for every situation, milage may vary, contributions welcome.

Goals

Regal is a portable OpenGL layer on top of existing OpenGL implementations. Compile and link an app against Regal and deploy on various OpenGL implementations including compatibility, core and ES 2.0 OpenGL contexts.

  • Portability

    Consistent OpenGL API that runs on all major platforms: Windows, Linux, Mac, iOS, and Android

  • Compatible

    Immediate mode, fixed function, GL_QUADS work everywhere, emulated as necessary.

  • Modern OpenGL API

    Direct State Access (DSA) and Vertex Array Object (VAO), emulated as necessary.

  • Open Source

    There is nothing behind the curtain. You can see what Regal is doing and change it if needed.

  • Ease of Use

    Set breakpoints on OpenGL functions. Step into the code. Inspect state.

  • Efficiency

    If it cannot be implemented efficiently in Regal, it is not universally supported. For example, tessellation support requires tessellation hardware.

Deployment

  • Most code remains unchanged.
  • Optionally #include <GL/Regal.h>
  • Link with regal32.dll, libRegal.so or libRegal.dylib

From an application developer's perspective, Regal just looks like an OpenGL implementation. You link with it instead of your platform's OpenGL library or framework, and that's really all you have to do to use Regal. The rest of your code can remain unchanged.

Downloads

July 30th 2013

Archives

Features

Emulation

  • Fixed function texturing, lighting and fog.

  • Direct State Access extension

    http://www.opengl.org/registry/specs/EXT/direct_state_access.txt

  • GL_EXT_debug_marker extension

    http://www.khronos.org/registry/gles/extensions/EXT/EXT_debug_marker.txt

  • Fixed function and DSA emulation enabled by default, except when compatibility context with DSA extension detected.

  • Build-time configuration:

    • REGAL_EMULATION -- Enable/disable the use of emulation
    • REGAL_FORCE_EMULATION -- Force the use of emulation, even for compatibility contexts with DSA
  • Environment variable configuration:

    • REGAL_EMULATION -- Enable/disable the use of emulation
    • REGAL_FORCE_EMULATION -- Force the use of emulation, even for compatibility contexts with DSA
  • Runime configuration via GL_REGAL_enable:

    • GL_EMULATION_REGAL -- glEnable/glDisable emulation

Note

Emulation is not supported in REGAL_WRANGLER=1 mode.

OpenGL error checking

  • Disabled by default.
  • Build-time configuration: REGAL_ERROR
  • Environment variable configuration: REGAL_ERROR
  • Runtime configuration via GL_REGAL_enable: GL_ERROR_REGAL

Note

OpenGL error checking is not supported in REGAL_WRANGLER=1 mode.

Logging

Regal supports detailed logging for development purposes.

  • Error -- Fatal and non-fatal Regal runtime errors.
  • Warning -- Non-fatal Regal warnings.
  • Info -- Informational messages.
  • App -- Application calls into Regal.
  • Driver -- Regal calls into OpenGL.
  • Internal -- Internal Regal calls.
  • Http -- HTTP traffic logging.

Build-time configuration:

  • REGAL_LOG_ERROR
  • REGAL_LOG_WARNING
  • REGAL_LOG_INFO
  • REGAL_LOG_APP
  • REGAL_LOG_DRIVER
  • REGAL_LOG_INTERNAL
  • REGAL_LOG_HTTP
  • Debug mode: All logging supported with error, warning, info and http logging enabled.
  • Release mode: Support for application, driver and internal logging disabled by default.

Environment variable configuration:

  • REGAL_LOG_ERROR
  • REGAL_LOG_WARNING
  • REGAL_LOG_INFO
  • REGAL_LOG_APP
  • REGAL_LOG_DRIVER
  • REGAL_LOG_INTERNAL
  • REGAL_LOG_HTTP
  • REGAL_LOG_API --- Application + Driver OpenGL logging
  • REGAL_LOG_NONE --- enable or disable all logging

Environment variable lookup is globally disabled by defining REGAL_NO_GETENV at compile-time.

Runtime configuration via GL_REGAL_log extension: (glEnable/glDisable/glIsEnabled)

  • GL_LOG_ERROR_REGAL
  • GL_LOG_WARNING_REGAL
  • GL_LOG_INFO_REGAL
  • GL_LOG_APP_REGAL
  • GL_LOG_DRIVER_REGAL
  • GL_LOG_INTERNAL_REGAL
  • GL_LOG_HTTP_REGAL

Other compile-time or runtime configuration of logging:

  • REGAL_LOG --- enable or disable logging
  • REGAL_LOG_FILE --- log to specified filename
  • REGAL_LOG_MAX_LINES --- limit the number of lines of multi-line messages (shaders, etc)
  • REGAL_LOG_JSON --- log in JSON mode
  • REGAL_LOG_JSON_FILE --- JSON log to specified filename

Note

API logging is not supported in REGAL_WRANGLER=1 mode.

Multi-threading support

  • Locking and per-thread contexts enabled by default.
  • Per-thread context build-time configuration: REGAL_NO_TLS
  • Locking build-time configuration: REGAL_THREAD_LOCKING
  • Locking environment variable configuration: REGAL_THREAD_LOCKING

Spoofing OpenGL vendor, renderer, version and extension strings

Build-time configuration

  • REGAL_GL_VENDOR
  • REGAL_GL_RENDERER
  • REGAL_GL_VERSION
  • REGAL_GL_EXTENSIONS

Environment variable configuration:

  • REGAL_GL_VENDOR
  • REGAL_GL_RENDERER
  • REGAL_GL_VERSION
  • REGAL_GL_EXTENSIONS

Environment variable lookup is globally disabled by defining REGAL_NO_GETENV at compile-time.

Browser-based interface

Note

Browser interface is not supported in REGAL_WRANGLER=1 mode.

Regal OpenGL extensions

Regal API

  • RegalSetErrorCallback --- Optionally set the per-context error callback function.
  • RegalShareContext --- OpenGL contexts are shared.
  • RegalMakeCurrent --- Set an OpenGL context as current for the thread.
  • RegalDestroyContext --- Cleanup Regal context resources.

In Progress

  • Light-weight loader-only "wrangler" mode along the lines of GLEW.
  • Context sharing support
  • glPushAttrib emulation

Planned Features

  • NV_path_rendering emulation.
  • GLSL to GLSL translation.
  • ES 3.0 support
  • Debug label.
  • Debug output.
  • Display list emulation.
  • Web browser-based debugging tools.

Limitations

  • Shared OpenGL contexts supported for single-threaded only.
  • Limited GLSL language support.
  • GL_QUADS only works in immediate mode or with DrawArrays for ES and core profiles.

Contact Information

  • Discussion of Regal is primarily via the Issue Tracker currently.

Other Information

Platform Notes

Windows

Linux

  • RedHat/Fedora recommended packages:
  • 32-bit:
$ sudo yum install gcc-c++ zlib-devel libpng-devel libXmu-devel libXi-devel
  • 64-bit

$ sudo yum install gcc-c++

$ sudo yum install zlib-devel.i686   libpng-devel.i686

$ sudo yum install zlib-devel.x86_64 libpng-devel.x86_64

$ sudo yum install libXmu-devel libXi-devel

  • Ubuntu/Debian/Mint recommended packages:
$ apt-get install libxmu-dev libxi-dev
  • Use GNU make with Makefile
$ make -f Makefile CCACHE=ccache STRIP=
  • Set LD_LIBRARY_PATH
$ export LD_LIBRARY_PATH=`pwd`/lib/linux
  • Run the dreamtorus example

$ REGAL_FORCE_EMULATION=1; bin/linux/dreamtorus

$ REGAL_FORCE_EMULATION=0; bin/linux/dreamtorus

$ REGAL_LOG_DRIVER=1; bin/linux/dreamtorus

OS X

Android

iOS

PPAPI and NaCl

  • NACL_SDK_ROOT needs to be set
  • NACL_LIBC=newlib is the default, specify NACL_LIBC=glibc as an alternative
  • regaltest requires pepper_26 or newer

Questions and Answers

STL, Standard C++ Library, Boost

Alternatives for OpenGL Loading

Related Efforts

License and Credits

Regal code, API database and generators are BSD licensed.

Copyright (c) 2011-2012 NVIDIA Corporation
Copyright (c) 2011-2012 Cass Everitt
Copyright (c) 2012 Scott Nations
Copyright (c) 2012 Mathias Schott
Copyright (c) 2012 Nigel Stewart
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

  Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.

  Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.

Boost is licensed under Boost Software License.

zlib by Jean-loup Gailly and Mark Adler is licensed under zLib License.

libpng by Glenn Randers-Pehrson et. al. is licensed under libpng license.

lookup3 by Bob Jenkins is public domain.

GLEW is licensed under BSD and MIT License.

GLU is licensed under SGI FREE SOFTWARE LICENSE B.

GLUT license:

/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */

/* This program is freely distributable without licensing fees  and is
   provided without guarantee or warrantee expressed or  implied. This
   program is -not- in the public domain. */

Dreamtorus example program is public domain.

Something went wrong with that request. Please try again.