Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Game Engine Development
  3. Cglm

Cglm

MITCv0.9.6

A highly optimized, header-only 2D/3D graphics math library for C, providing fast and ergonomic functions for graphics programming.

GitHubGitHub
3.0k stars286 forks0 contributors

What is Cglm?

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.

Target Audience

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.

Value Proposition

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.

Overview

📽 Highly Optimized 2D / 3D Graphics Math (glm) for C

Use Cases

Best For

  • Building high-performance game engines in C
  • Developing graphics applications for embedded systems
  • Creating simulations requiring fast 3D math operations
  • Porting or writing graphics code that needs SIMD optimizations
  • Implementing camera and projection systems for Vulkan or Metal
  • Writing educational graphics programming code in C

Not Ideal For

  • Projects already using C++ where GLM or similar libraries offer more idiomatic C++ integration
  • Teams requiring row-major matrix layout as the default, as cglm uses column-major and needs explicit transposition
  • Environments with limited compiler support for C11 features or MSVC extensions needed for the ergonomic struct API

Pros & Cons

Pros

SIMD-Optimized Speed

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.

Header-Only Simplicity

Can be integrated by including headers without dynamic allocation, reducing build complexity and external dependencies, making it easy to drop into projects.

Ergonomic Struct API

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.

API-Agnostic Portability

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.

Cons

Breaking Changes History

Has undergone major changes like quaternion storage order shifts and namespace updates, requiring careful code migration during upgrades, as noted in the migration section.

Alignment and Compiler Dependencies

Requires careful memory alignment for SIMD to prevent crashes, and the struct API depends on C11 or compiler extensions, adding portability complexity.

Limited High-Level Features

Focuses on core math operations; lacks built-in support for advanced graphics concepts like scene graphs or rendering pipelines, which must be implemented separately.

Frequently Asked Questions

Quick Stats

Stars2,977
Forks286
Contributors0
Open Issues71
Last commit6 days ago
CreatedSince 2016

Tags

#c-library#vector#opengl#simd#graphics-math#matrix#math#c#3d-graphics#sse#game-development#matrix-operations#simd-optimization#linear-algebra#graphics-programming#vector-math#header-only

Built With

C
C++

Included in

Game Engine Development1.3k
Auto-fetched 14 hours ago

Related Projects

imguiimgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies

Stars74,986
Forks11,931
Last commit1 day ago
C/C++C/C++

A curated list of awesome C++ (or C) frameworks, libraries, resources, and shiny things. Inspired by awesome-... stuff.

Stars72,398
Forks8,320
Last commit5 days ago
ProtoBufProtoBuf

Protocol Buffers - Google's data interchange format

Stars71,621
Forks16,200
Last commit13 hours ago
JSON for Modern C++JSON for Modern C++

JSON for Modern C++

Stars50,198
Forks7,437
Last commit22 hours ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub