How amritxyz/libgfx works
Libgfx is a small C graphics library for creating an OpenGL-backed window, drawing basic shapes, presenting frames, and handling keyboard input. An application uses the public API to initialize a context, issue drawing and input calls, and terminate it. The implementation combines window/context setup, shader and geometry setup, drawing, and input handling in one source file; the separate renderer header exposes shader and mesh declarations, but its implementation is not shown. Relationships below are limited to the README, header declarations, and source excerpts/index references provided.
Main entry points: libgfx.h Libgfx API · libgfx.c Context Lifecycle · gl.c GLAD Loader · renderer.h Renderer API
Components 11
Public API
- Libgfx API
include/libgfx.h - Renderer API
include/renderer.h
Graphics Runtime
- Context Lifecycle
src/libgfx.c - Keyboard Input
src/libgfx.c
Rendering Support
- Shape Drawing
src/libgfx.c - Shader Setup
src/libgfx.c
Graphics Dependencies
- GLAD Loader
glad/src/gl.c - GLAD Declarations
glad/include/glad/gl.h - GLFW
- OpenGL
Other components
- Application
Connections 12
- Application → Libgfx API: uses
include/libgfx.h - Libgfx API → Context Lifecycle: initializes
src/libgfx.c - Libgfx API → Shape Drawing: draws shapes
src/libgfx.c - Libgfx API → Keyboard Input: queries input
src/libgfx.c - Renderer API → Libgfx API: includes
include/renderer.h - Context Lifecycle → GLFW: creates window
src/libgfx.c - Context Lifecycle → GLAD Loader: loads functions
src/libgfx.c - Context Lifecycle → Shader Setup: configures shaders
src/libgfx.c - Shader Setup → OpenGL: compiles shaders
src/libgfx.c - Shape Drawing → OpenGL: issues draw calls
src/libgfx.c - Keyboard Input → GLFW: polls keys
src/libgfx.c - GLAD Loader → GLAD Declarations: implements