GL4ES - The OpenGL driver for GLES Hardware

GL4ES is a OpenGL 2.1/1.5 to GL ES 2.0/1.1 translation library, with support for Pandora, ODroid, OrangePI, CHIP, Raspberry PI, Android, Emscripten and AmigaOS4.

View on GitHub

Usage

There are many environment variables to control gl4es behavior. All are numeric, except LIBGL_VERSION that take a string, LIBGL_FBO that takes a 2d size (WxH), and both LIBGL_EGL and LIBGL_GLES that take path/filename. You can also change many of this variable at runtime using the glHint(...) function. See gl4eshint.h for the list of #define to use in this function.

LIBGL_FB

Controls the Framebuffer output

LIBGL_FBONOALPHA

In case of LIBGL_FB=2, control if FBO is RGBA or RGB

LIBGL_ES

Controls the version of GLES to use

LIBGL_GL

Controls the version of OpenGL exposed

LIBGL_XREFRESH

Debug helper in specific cases

LIBGL_STACKTRACE

Automatic Backtrace log

LIBGL_FPS

Print current FPS to the console

LIBGL_VSYNC

VSync control

LIBGL_RECYCLEFBO

Recycling FBO special case (don’t delete a created FBO, but recycle it if needed)

LIBGL_MIPMAP

Handling of Manual and Automatic MIPMAP

LIBGL_FORCENPOT

Forcing NPOT (Non-Power of Two) Texture size.

LIBGL_TEXCOPY

Make a local copy of every texture for easy glGetTexImage2D

LIBGL_SHRINK

Texture shrinking control

LIBGL_TEXDUMP

Texture dump

LIBGL_ALPHAHACK

Experimental: enable Alpha test only when using texture that contains an alpha channel

LIBGL_NODOWNSAMPLING

Texture downsampling control (deprecated, use LIBGL_AVOID16BITS instead)

LIBGL_STREAM

PANDORA only: enable Texture Streaming (works only on RGB textures)

LIBGL_COPY

Removed (Controlled the glCopyTex(Sub)Image2D hack, it’s now automatic, depending on how compatible is the read framebuffer)

LIBGL_NOLUMALPHA

Control the availability of the LUMINANCE_ALPHA format (can be buggy on Pandora model CC)

LIBGL_BLENDHACK

Experimental: Change Blend GL_SRC_ALPHA, GL_ONE to GL_ONE, GL_ONE

LIBGL_BLENDCOLOR

Hack: Export a (faked) glBlendColor

LIBGL_VERSION

Hack: Control the glGetString version. Override version string (should be in the form of “1.x”)

LIBGL_BATCH

This has been changed with v1.0.5. Now BATCH simply try to merge subsequent glDrawXXXXX (glDrawArrays, glDrawElements…). It only try to merge if arrays is between MINBATCH and MAXBATCH (inclusive) The Batching stop when there is a change of GL State, but also if an Array of more then 100*N is encountered.

LIBGL_NOERROR

Hack: glGetError() always return GL_NOERROR

LIBGL_GAMMA

Pandora Hack: Set a Gamma value (in decimal formal, 1.0 means no gamma boost)

LIBGL_SRGB

ODROID Hack: Enable sRGB Surface (so Gamma corrected), if Hardware support it

LIBGL_FASTMATH

Hack: Activate some Fast Math in processor/co-processor

LIBGL_SILENTSTUB

Debug: Hide or Show the Sub / Not found message

LIBGL_NOBANNER

Show/Hide initial text

LIBGL_NPOT

Expose NPOT (Non Power of Two) Support

LIBGL_GLQUERIES

Expose glQueries functions

LIBGL_NOTEXMAT

Handling of Texture Matrix

LIBGL_NOTEST

Initial Hardware test

LIBGL_NOVAOCACHE

VAO Caching

LIBGL_VABGRA

Vertex Array BGRA extension

LIBGL_BEGINEND

Merge of subsequent glBegin/glEnd blocks (will be non-effective if BATCH mode is used)

LIBGL_AVOID16BITS

Try to avoid 16bits textures

LIBGL_AVOID24BITS

Try to avoid 24bits textures (i.e. GL_RGB)

LIBGL_FORCE16BITS

Try to use 16bits textures

LIBGL_POTFRAMEBUFFER

Use only Power Of Two dimension for Framebuffer

LIBGL_NOBGRA

Ignore BGRA Texture hardware extension

LIBGL_NOTEXRECT

Don’t expose Texture rectangle extension (GL_ARB_texture_rectangle)

LIBGL_NOHIGHP

Usage of highp precision in fragment shader (ES2 backend only)

LIBGL_COMMENTS

Comments in shaders are kept (also for generated shaders by fpe_shaders)

LIBGL_DEFAULTWRAP

Hack to define default WRAP mode for texture

LIBGL_FBOUNBIND

Workaround on FBO where a bond texture is used for drawing

LIBGL_FBOFORCETEX

For the Color Attachment 0 to be a Texture2D (even if program attachs a Renderbuffer) => may speedup glBlitFramebuffer if used

LIBGL_BLITFULLSCREEN

Hack to trigger a SwapBuffers when a Full Framebuffer Blit on default FBO is done

LIBGL_NOARBPROGRAM

Don’t expose ARB Program extensions (GL_ARB_vertex_program, GL_ARB_fragment_program and GL_EXT_program_parameters)

LIBGL_FBO

Hack: define custom dimension for FBO (only used with LIBGL_FBO=2)

LIBGL_NOTEXARRAY

Hack to force using discrete Texture instead of Array in all shader

LIBGL_LOGSHADERERROR

Log to the console Shader Compile error, with initial and ShaderConv’d source of the shader

LIBGL_SHADERNOGLES

Don’t use GL_ES part in shaders

LIBGL_NODEPTHTEX

Disable the use of Depth texture

LIBGL_FLOAT

Expose support for FLOAT and HALF_FLOAT Texture support (and has attachment to FBO)

LIBGL_GLXRECYCLE

Recycle EGLSurface per Drawable, instead of destroying them

LIBGL_NOCLEAN

Debug: don’t clean GLContext when they are destroy

LIBGL_EGL

Define EGL lib to use. Default folder are the standard one for dynamic library loading (LD_LIBRARY_PATH and friend) plus “/opt/vc/lib/”, /usr/local/lib/” and “/usr/lib/”.

LIBGL_GLES

Define GLES(2) lib to use. Default folder are the standard one for dynamic library loading (LD_LIBRARY_PATH and friend) plus “/opt/vc/lib/”, /usr/local/lib/” and “/usr/lib/”. Be sure to point to correct GLES library depending on wich GLES backend you are using.

LIBGL_DBGSHADERCONV

Log to the console all shaders before and after conversion

LIBGL_NOPSA

Disable the use of the Precompiled Shader Archive

LIBGL_PSA_FOLDER

Set a custom path for Precompile Shader Archive

LIBGL_USEVBO

Usage of VBO in certain cases. Only for GLES2+. The 2 and 3 mode are experimental and will probably be slower anyway.

LIBGL_NOES2COMPAT

Don’t expose GLX_EXT_create_context_es2_profile extension

LIBGL_NOINTOVLHACK

Disable the hack in shader converter to define overloaded function with int

LIBGL_GLXNATIVE

Disable the filtering of GLXConfig by NATIVE_TYPE

LIBGL_NOSHADERLOD

Disable GL_EXT_shader_texture_lod

LIBGL_NORMALIZE

Force normals to be normliazed in FPE

LIBGL_BLITFB0

Blit to FB 0 force a SwapBuffer

LIBGL_DEEPBIND

Use RTLD_DEEPBIND when loading EGL and GLES library