GLM
C++ Format
Our great sponsors
GLM | C++ Format | |
---|---|---|
36 | 161 | |
8,572 | 19,147 | |
2.1% | 1.5% | |
9.0 | 9.8 | |
6 days ago | 4 days ago | |
C++ | C++ | |
GNU General Public License v3.0 or later | GNU General Public License v3.0 or later |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
GLM
- C++23: The Next C++ Standard
- Which is the best way to work with matrices and linear algebra using c++?
-
Best C++ Game Framework
I would also recommend GLM
- PocketPy: A Lightweight(~5000 LOC) Python Implementation in C++17
-
Learning DirectX 12 in 2023
Alongside MiniEngine, you’ll want to look into the DirectX Toolkit. This is a set of utilities by Microsoft that simplify graphics and game development. It contains libraries like DirectXMesh for parsing and optimizing meshes for DX12, or DirectXMath which handles 3D math operations like the OpenGL library glm. It also has utilities for gamepad input or sprite fonts. You can see a list of the headers here to get an idea of the features. You’ll definitely want to include this in your project if you don’t want to think about a lot of these solved problems (and don’t have to worry about cross-platform support).
-
Viking Math! A Vulkan-Focused 3D Math Library In Pure Go
You may recall vkngwrapper, which I posted several months ago, a Vulkan wrapper for go. Well, here is the second step in my plan to take over the world: a vulkan-friendly 3d math library for go. It's the only right-handed 3d math library I'm aware of in Go, and it is faster than the alternatives, by a lot in some cases. It's mostly a straight go port of key elements of GLM (https://github.com/g-truc/glm) and there's a lot more I could probably put in, but I'll keep it how it is for a bit while I work on other stuff.
-
What are some cool modern libraries you enjoy using?
even though it's fairly old and buggy, I haven't found anything as easy to use or complete as glm
-
I've decided to learn Godot and it feels like I have "lost"
math library because you should never implement a math library yourself, and you probably want somethign more focused on performance than STL. GLM may work if you just need basic vector support. Eigen may help for a more physics heavy game. But I'd probably find something in-between those two
-
Eigen: A C++ template library for linear algebra
glm is also good for 3d math. It mimics the API of OpenGL shaders, so it's a good option if you already know (or are interested in learning) how to write shaders.
-
Is there a reference of C/C++ implementations of basic vector/matrix routines used by common MATLAB functions?
If you want 3D maths only (so up to 4x4) GLM https://github.com/g-truc/glm is perfect.
C++ Format
-
C++ Game Utility Libraries: for Game Dev Rustaceans
GitHub repo: fmtlib/fmt
-
Creating k-NN with C++ (from Scratch)
cmake_minimum_required(VERSION 3.5) project(knn_cpp CXX) # Set up C++ version and properties include(CheckIncludeFileCXX) check_include_file_cxx(any HAS_ANY) check_include_file_cxx(string_view HAS_STRING_VIEW) check_include_file_cxx(coroutine HAS_COROUTINE) set(CMAKE_CXX_STANDARD 20) set(CMAKE_BUILD_TYPE Debug) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) # Copy data file to build directory file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/iris.data DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) # Download library usinng FetchContent include(FetchContent) FetchContent_Declare(matplotplusplus GIT_REPOSITORY https://github.com/alandefreitas/matplotplusplus GIT_TAG origin/master) FetchContent_GetProperties(matplotplusplus) if(NOT matplotplusplus_POPULATED) FetchContent_Populate(matplotplusplus) add_subdirectory(${matplotplusplus_SOURCE_DIR} ${matplotplusplus_BINARY_DIR} EXCLUDE_FROM_ALL) endif() FetchContent_Declare( fmt GIT_REPOSITORY https://github.com/fmtlib/fmt.git GIT_TAG 7.1.3 # Adjust the version as needed ) FetchContent_MakeAvailable(fmt) # Add executable and link project libraries and folders add_executable(${PROJECT_NAME} main.cc) target_link_libraries(${PROJECT_NAME} PUBLIC matplot fmt::fmt) aux_source_directory(lib LIB_SRC) target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_sources(${PROJECT_NAME} PRIVATE ${LIB_SRC}) add_subdirectory(tests)
-
Learn Modern C++
> This is from C++23, right?
std::println is, yes.
> I wonder how available this is within compilers
https://en.cppreference.com/w/cpp/compiler_support says clang, gcc, and msvc all support it, though I don't know how recent those versions are off the top of my head.
In my understanding, with this specific feature, if you want a polyfill for older compilers, or to use some more cutting-edge features that haven't been standardized yet, https://github.com/fmtlib/fmt is available to you.
-
The C++20 Naughty and Nice List for Game Devs
fmt/core.h has been heavily optimized for build speed and is usually faster to compile than equivalent iostream code: https://github.com/fmtlib/fmt?tab=readme-ov-file#compile-tim.... Once modularized std is available we might be able to be compete with printf.
-
For processing strings, streams in C++ can be slow
{fmt} has internal buffering but it's not yet exposed to users. There is a feature request for it: https://github.com/fmtlib/fmt/issues/2354. FILE buffering is not too bad but it can be easily optimized: https://www.zverovich.net/2020/08/04/optimal-file-buffer-siz....
If performance matters, write your own specialized string processing code which works on "raw" data in memory buffers. If convenience matters look at https://github.com/fmtlib/fmt (or std::format which AFAIK is less feature rich) and https://github.com/imageworks/pystring.
I like C much more than C++, but even I must say that https://github.com/fmtlib/fmt is pretty nice (which is the base for std::format). Together with pystring (https://github.com/imageworks/pystring) it makes string processing in C++ somewhat bearable (still slow though because pystring is based on std::string and excessively allocates, but at least convenient).
are currently a good example of pure product of the 9Xs/2000s when the hype about Object Oriented was ongoing.
Almost everything related to it has this OO code smell:
- Usage of virtual runtime dispatch with virtual calls when it is not necessary. Causing a negative impact on performance: a shame for C++.
- Heavy usage of function overloading with the "<<" operator. Leading to pages long compilation errors when an overload fails.
- Hidden states everywhere with the usage of state formatters and globals in the background.
- Unnecessary complexity with std::locale which is almost entirely useless for proper internationalisation.
- Useless encapsulation with error reports done as abstracted bit flags. Which is absolutely horrendous when dealing with file I/O: It hides away the underlying error with no proper way to access it.
- Deep class hierarchy making the entire thing looks like spaghetti.
- Useless abstraction with stringstream that hides the underlying buffer away, making it close to unusable on safety critical systems.
All of that made aged pretty badly, and for good reasons.
Fortunately there is an incoming way out of that with work of Viktor Zverovich on std::format and libfmt [1].
-
Codebases to read
Additionally, if you like low level stuff, check out libfmt (https://github.com/fmtlib/fmt) - not a big project, not difficult to understand. Or something like simdjson (https://github.com/simdjson/simdjson).
What are some alternatives?
Eigen
DirectXMath - DirectXMath is an all inline SIMD C++ linear algebra library for use in games and graphics apps
linmath.h - a lean linear math library, aimed at graphics programming. Supports vec3, vec4, mat4x4 and quaternions
cglm - 📽 Highly Optimized 2D / 3D Graphics Math (glm) for C
spdlog - Fast C++ logging library.
OpenBLAS - OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
blaze
Better Enums - C++ compile-time enum to string, iteration, in a single header file
CGal - The public CGAL repository, see the README below
ZXing - ZXing ("Zebra Crossing") barcode scanning library for Java, Android
FastFormat - The fastest, most robust C++ formatting library
GMTL - Generic Math Template Library (forked from http://ggt.sourceforge.net/)