So you want to call glClear()
?
This step is only required if updating or modifying BlueGL. These artifacts should already be checked into the Filament repository.
From the libs/bluegl
folder, run:
./bluegl-gen.py
The bluegl-gen.py
script generates a set of files:
- assembly (proxy) files:
BlueGLCore*.S
- header files:
include/BlueGLDefines.h
andinclude/bluegl/BlueGL.h
- a private header:
include/private_BlueGL.h
#include <bluegl/BlueGLDefines.h>
This headers adds a bunch of defines:
...
#define glClear bluegl_glClear
...
#include <bluegl/BlueGLDefines.h>
#include <bluegl/BlueGL.h>
This also includes the GL headers, like <GL/glcorearb.h>
for you.
Internally, the BlueGL library maintains a list of function pointers:
void* __blue_glCore_glClear;
During bluegl::bind()
, each function gets assigned to the appropriate symbol loaded from the OS-specific GL shared library via dlopen
, dlsym
, and equivalents.
Because of the prior #define
, you'll actually be calling bluegl_glClear()
. This is a trampoline function, defined in the BlueGLCore*.S
assembly file (the exact implementation varies slightly on each platform):
.private_extern _bluegl_glClear
_bluegl_glClear:
mov ___blue_glCore_glClear@GOTPCREL(%rip), %r11
jmp *(%r11)
The invokes the __blue_glCore_glClear
function, which was previously assigned to the actual GL function.