raylib is organized into 7 clean modules plus a thin OpenGL abstraction layer. Zero dependencies beyond the platform's graphics API.
raylib follows a modular, layered architecture. At the bottom sits rlgl, a thin OpenGL abstraction that supports OpenGL 1.1, 2.1, 3.3, 4.3, and ES 2.0/3.0. Above it, each module handles a specific domain — shapes, textures, text, 3D models, or audio. They're all independent and can be used separately.
Window management, input handling (keyboard, mouse, gamepad, touch), timing, random number generation, and file I/O. This is the foundation everything else builds on. Supports GLFW, SDL, RGFW, or native platform backends.
Drawing 2D primitives: lines, circles, rectangles, triangles, polygons, Bezier curves, and more. Includes filled and outlined variants, plus collision detection between 2D shapes.
Image loading/saving (PNG, BMP, TGA, JPG, GIF, QOI, PSD, HDR, DDS, KTX, ASTC, PKM), GPU texture management, render textures (framebuffers), image manipulation (resize, crop, rotate, color tint, dithering), and mipmapping.
Font loading (TTF, OTF, bitmap fonts), SDF font rendering for smooth scaling, text measurement, formatting, and Unicode support. Includes a default embedded font so you can draw text immediately without loading anything.
3D model loading (OBJ, IQM, GLTF, VOX, M3D), mesh generation (cube, sphere, cylinder, torus, heightmap), skeletal animation, materials, camera system with multiple modes (free, orbital, first-person, third-person), collision detection (ray-mesh, ray-box, ray-sphere), and billboard rendering.
Audio device management, sound loading (WAV, OGG, MP3, FLAC), music streaming (OGG, MP3, FLAC, XM, MOD, WAV), multi-channel mixing, audio processing callbacks for real-time effects, and spatial audio support. Powered by miniaudio.
A thin abstraction layer over OpenGL. Provides an OpenGL 1.1-style immediate-mode API that batches internally into modern OpenGL 3.3+/ES 2.0 draw calls. Handles vertex buffers, shader management, framebuffers, and render states. You almost never need to call rlgl directly — the higher modules use it internally.
raylib ships several standalone single-header libraries that can be used independently:
Vector2, Vector3, Vector4, Matrix, and Quaternion math. All inline functions, zero allocations.
Immediate-mode GUI: buttons, sliders, dropdowns, text boxes, list views, color pickers, and 15+ more controls.
Resource packaging file format for bundling assets (images, fonts, sounds) into a single archive.
PNG chunk manager for embedding custom data (metadata, scripts) inside PNG files.
raylib compiles natively on all major platforms, plus embedded and web targets: