Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

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

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. mathgl

mathgl

BSD-3-ClauseGov1.2.0

A pure Go 3D math library specialized for OpenGL graphics, with 32-bit and 64-bit float support.

GitHubGitHub
607 stars63 forks0 contributors

What is mathgl?

MathGL is a pure Go 3D mathematics library specialized for OpenGL graphics programming. It provides vector, matrix, and quaternion operations essential for 3D transformations, rendering, and simulations, with support for both 32-bit and 64-bit floating-point precision.

Target Audience

Go developers working on 3D graphics, game engines, simulations, or any project requiring OpenGL integration and linear algebra computations.

Value Proposition

Developers choose MathGL for its native Go implementation, OpenGL-specific optimizations like Column Major Order, and dual precision support, offering a reliable and performant alternative to C++ math libraries in the Go ecosystem.

Overview

A pure Go 3D math library.

Use Cases

Best For

  • Building 3D game engines in Go
  • Developing OpenGL-based graphics applications
  • Performing linear algebra computations for simulations
  • Implementing camera and projection systems
  • Handling quaternion rotations for 3D animations
  • Creating educational tools for 3D math and graphics

Not Ideal For

  • Projects using non-OpenGL graphics APIs like Vulkan or DirectX, which may have different memory layout requirements
  • Teams needing a full game engine with physics, rendering pipelines, and asset management out of the box
  • Developers requiring extensive tutorials or hand-holding for basic 3D math concepts, as examples are in a separate repo
  • Applications where row-major matrix order is standard, such as in some scientific computing or machine learning contexts

Pros & Cons

Pros

OpenGL-Optimized Design

Uses Column Major Order for matrices and vectors to match OpenGL's memory layout, reducing integration overhead and avoiding transposition errors in graphics code.

Dual Precision Flexibility

Provides separate mgl32 and mgl64 subpackages for 32-bit and 64-bit floats, allowing developers to choose based on performance or accuracy needs for OpenGL or general math.

Code-Generated Consistency

Core vector and matrix operations are generated from templates, ensuring uniformity across types and minimizing manual errors, as noted in the contribution guidelines.

Comprehensive 3D Functions

Includes essential operations for graphics programming, such as transformations, projections, and quaternion handling, covering key needs for 3D rendering and simulations.

Cons

API Stability Risks

The README admits to API-breaking changes between Go version releases and deprecated function removals, which can disrupt long-term project maintenance and updates.

Complex Contribution Workflow

Contributors must edit template files and run go generate instead of modifying core files directly, adding a layer of complexity for those extending the library.

Sparse Learning Resources

Examples are housed in a separate repository, and the README includes troubleshooting for version mismatches, indicating a lack of integrated documentation for beginners.

OpenGL-Locked Specialization

While excellent for OpenGL, the library's design choices (like Column Major Order) make it less suitable for other graphics APIs or general-purpose linear algebra without adaptation.

Frequently Asked Questions

Quick Stats

Stars607
Forks63
Contributors0
Open Issues9
Last commit1 year ago
CreatedSince 2013

Tags

#quaternions#opengl#3d-graphics#game-development#matrix-operations#linear-algebra#graphics-programming#go#vector-math

Built With

G
Go

Included in

Go169.1k
Auto-fetched 7 hours ago

Related Projects

glfwglfw

Go bindings for GLFW 3

Stars1,685
Forks193
Last commit4 days ago
glgl

Go bindings for OpenGL (generated via glow)

Stars1,198
Forks73
Last commit3 months ago
glgl

Go cross-platform OpenGL bindings.

Stars174
Forks28
Last commit3 years ago
glfwglfw

Go cross-platform glfw library for creating an OpenGL context and receiving events.

Stars83
Forks30
Last commit3 years 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