A highly optimized, header-only 2D/3D graphics math library for C, providing fast and ergonomic functions for graphics programming.
cglm is a highly optimized, header-only 2D and 3D graphics mathematics library written in C. It provides fast, ergonomic functions for vector, matrix, quaternion, and transformation operations, solving the need for a performant and portable math foundation in C-based graphics and game development projects.
C developers working on graphics applications, game engines, simulations, or any project requiring efficient 3D math operations, especially those targeting performance-sensitive or embedded environments.
Developers choose cglm for its exceptional performance through SIMD optimizations, its header-only and allocation-free design for easy integration, and its comprehensive, API-agnostic feature set that mirrors the convenience of C++'s GLM library within the C ecosystem.
📽 Highly Optimized 2D / 3D Graphics Math (glm) for C
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Leverages SSE, AVX, and NEON instructions to accelerate vector and matrix operations, essential for real-time graphics performance as highlighted in the README's optimization focus.
Can be integrated by including headers without dynamic allocation, reducing build complexity and external dependencies, making it easy to drop into projects.
Provides a clean API with structs and value semantics via glms_ functions, improving code clarity and reducing pointer errors, as demonstrated in the struct usage examples.
Designed to work with any graphics API like OpenGL, Vulkan, or Metal, with configurable clipspace options such as CGLM_FORCE_DEPTH_ZERO_TO_ONE for flexibility.
Has undergone major changes like quaternion storage order shifts and namespace updates, requiring careful code migration during upgrades, as noted in the migration section.
Requires careful memory alignment for SIMD to prevent crashes, and the struct API depends on C11 or compiler extensions, adding portability complexity.
Focuses on core math operations; lacks built-in support for advanced graphics concepts like scene graphs or rendering pipelines, which must be implemented separately.