glcube is OpenGL cube demo in C11 using programmable shaders. The demo uses the linmath.h and gl2_util.h headers which contain a simple vertex and index buffer abstraction, functions for loading and compiling shaders plus basic mouse navigation.
glcube is an app skeleton using gl2_util.h, a nano framework for
creating apps using the modern OpenGL and GLSL shader pipeline. The
CMakeLists.txt
is intended to be used as a template for tiny demos.
The shader uses a noise function derived from SHA-2, combined with UVs to create deterministic surface noise.
src/gl2_cube.c
- OpenGL 2.1 cube using thegl2_util.h
shader loader.src/gl3_cube.c
- OpenGL 3.2 cube using thegl2_util.h
shader loader.src/gl4_cube.c
- OpenGL 4.5 cube using thegl2_util.h
shader loader.src/gl2_util.h
- header functions for OpenGL buffers and shaders.src/linmath.h
- public domain linear algebra header functions.
sudo apt-get install -y cmake ninja-build
cmake -G Ninja -B build .
cmake --build build
The project includes several versions of glcube ported to multiple APIs.
gl2_cube is a 3D cube renderer using OpenGL 2.x and GLSL shaders.
gl3_cube is mostly the same as gl2_cube with the addition of vertex array objects which were added in OpenGL 3.x.
gl4_cube is mostly the same as gl3_cube with the addition of uniform buffer objects which were added in OpenGL 4.x.