Example how to do GL2 rendering with open-source vc4 OpenGL driver by using libdrm and mesa.
Check the readme files for gles2_drm demo in parent folder for setting up required libraries and development header files.
Main differences from setting up GLES2 context:
- use
EGL_OPENGL_API
when callingeglBindAPI
- use
EGL_OPENGL_BIT
forEGL_RENDERABLE_TYPE
when choosing config - load GL functions with
eglGetProcAddress
because mesa does not have libGL.so for non-X11 builds, more info - GLSL shader differences - no precision qualifiers in non-ES GLSL language (for GL 2.1 version)
Execute make
to build.
You can execute make run
to build & upload & run executable on Raspberry Pi. By default it will
try to connect to [email protected] host. You can override it by setting PI
variable:
make run [email protected]
You should see colorful triangle spinning. By default vsync is enabled, but you can disable it by changing
ENABLE_VSYNC
variable in source code.
Error handling is done using assert
, feel free to change it when porting to your code.