|
SBgl 0.1.0
A graphics framework in C99
|
The examples/ directory contains several applications demonstrating various features of the library.
Examples are integrated into the main CMake build system. From the project root:
After building, binaries are located in the build/examples/ directory. For example:
window/hello_window.c: Demonstrates the basic initialization of the SBgl context, window creation, and the main event loop.triangle/triangle_main.c: Shows how to load shaders, create vertex buffers, and draw a basic static or interactive triangle.camera/camera_main.c: A complete 3D example demonstrating the perspective camera, 3D transformations, depth buffering, and batch ray-casting collision math.input/input_keyboard.c: Showcases the Data-Oriented input system, polling for key presses and held states.input/input_mouse.c: Demonstrates mouse coordinate tracking and color mapping.batching/batch_main.c: Demonstrates high-performance batching by rendering 10,000 instances using Multi-Draw Indirect (MDI) and Buffer Device Address (BDA).voxels/voxel_main.c: Showcases "Pure Procedural" rendering. Generates an infinite 2.5D voxel world entirely on the GPU using gl_VertexIndex, achieving zero-bandwidth geometry submission.Most SBgl applications follow this standard initialization and main loop pattern:
To pass dynamic data to shaders without the overhead of uniform buffers, SBgl utilizes Push Constants.
C Code:
GLSL Vertex Shader: