![glm](/doc/manual/logo-mini.png)
[OpenGL Mathematics](http://glm.g-truc.net/) (*GLM*) is a header only C++ mathematics library for graphics software based on the [OpenGL Shading Language (GLSL) specifications](https://www.opengl.org/registry/doc/GLSLangSpec.4.50.diff.pdf).
*GLM* provides classes and functions designed and implemented with the same naming conventions and functionality than *GLSL* so that anyone who knows *GLSL*, can use *GLM* as well in C++.
This project isn't limited to *GLSL* features. An extension system, based on the *GLSL* extension conventions, provides extended capabilities: matrix transformations, quaternions, data packing, random numbers, noise, etc...
This library works perfectly with *[OpenGL](https://www.opengl.org)* but it also ensures interoperability with other third party libraries and SDK. It is a good candidate for software rendering (raytracing / rasterisation), image processing, physic simulations and any development context that requires a simple and convenient mathematics library.
*GLM* is written in C++98 but can take advantage of C++11 when supported by the compiler. It is a platform independent library with no dependence and it officially supports the following compilers:
- [Apple Clang 6.0](https://developer.apple.com/library/mac/documentation/CompilerTools/Conceptual/LLVMCompilerOverview/index.html) and higher
- [GCC](http://gcc.gnu.org/) 4.7 and higher
- [Intel C++ Composer](https://software.intel.com/en-us/intel-compilers) XE 2013 and higher
- [LLVM](http://llvm.org/) 3.4 and higher
- [Visual C++](http://www.visualstudio.com/) 2013 and higher
- [CUDA](https://developer.nvidia.com/about-cuda) 9.0 and higher (experimental)
- [SYCL](https://www.khronos.org/sycl/) (experimental: only [ComputeCpp](https://codeplay.com/products/computesuite/computecpp) implementation has been tested).
- Any C++11 compiler
For more information about *GLM*, please have a look at the [manual](manual.md) and the [API reference documentation](http://glm.g-truc.net/0.9.8/api/index.html).
The source code and the documentation are licensed under either the [Happy Bunny License (Modified MIT) or the MIT License](manual.md#section0).
Thanks for contributing to the project by [submitting issues](https://github.com/g-truc/glm/issues) for bug reports and feature requests. Any feedback is welcome at [glm@g-truc.net](mailto://glm@g-truc.net).
```cpp
#include <glm/vec3.hpp> // glm::vec3
#include <glm/vec4.hpp> // glm::vec4
#include <glm/mat4x4.hpp> // glm::mat4
#include <glm/ext/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale
#include <glm/ext/matrix_clip_space.hpp> // glm::perspective
#include <glm/ext/constants.hpp> // glm::pi
glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
{
glm::mat4 Projection = glm::perspective(glm::pi<float>() * 0.25f, 4.0f / 3.0f, 0.1f, 100.f);
glm::mat4 View = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Translate));
View = glm::rotate(View, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f));
View = glm::rotate(View, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f));
glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.5f));
return Projection * View * Model;
}
```
## [Lastest release](https://github.com/g-truc/glm/releases/latest)
## Project Health
| Service | System | Compiler | Status |
| ------- | ------ | -------- | ------ |
| [Travis CI](https://travis-ci.org/g-truc/glm)| MacOSX, Linux 64 bits | Clang 3.6, Clang 5.0, GCC 4.9, GCC 7.3 | [![Travis CI](https://travis-ci.org/g-truc/glm.svg?branch=master)](https://travis-ci.org/g-truc/glm)
| [AppVeyor](https://ci.appveyor.com/project/Groovounet/glm)| Windows 32 and 64 | Visual Studio 2013, Visual Studio 2015, Visual Studio 2017 | [![AppVeyor](https://ci.appveyor.com/api/projects/status/32r7s2skrgm9ubva?svg=true)](https://ci.appveyor.com/project/Groovounet/glm)
## Release notes
### [GLM 0.9.9.8](https://github.com/g-truc/glm/releases/tag/0.9.9.8) - 2020-04-13
#### Features:
- Added GLM_EXT_vector_intX* and GLM_EXT_vector_uintX* extensions
- Added GLM_EXT_matrix_intX* and GLM_EXT_matrix_uintX* extensions
#### Improvements:
- Added clamp, repeat, mirrorClamp and mirrorRepeat function to GLM_EXT_scalar_commond and GLM_EXT_vector_commond extensions with tests
#### Fixes:
- Fixed unnecessary warnings from matrix_projection.inl #995
- Fixed quaternion slerp overload which interpolates with extra spins #996
- Fixed for glm::length using arch64 #992
- Fixed singularity check for quatLookAt #770
### [GLM 0.9.9.7](https://github.com/g-truc/glm/releases/tag/0.9.9.7) - 2020-01-05
#### Improvements:
- Improved Neon support with more functions optimized #950
- Added CMake GLM interface #963
- Added fma implementation based on std::fma #969
- Added missing quat constexpr #955
- Added GLM_FORCE_QUAT_DATA_WXYZ to store quat data as w,x,y,z instead of x,y,z,w #983
#### Fixes:
- Fixed equal ULP variation when using negative sign #965
- Fixed for intersection ray/plane and added related tests #953
- Fixed ARM 64bit detection #949
- Fixed GLM_EXT_matrix_clip_space warnings #980
- Fixed Wimplicit-int-float-conversion warnings with clang 10+ #986
- Fixed EXT_matrix_clip_space perspectiveFov
### [GLM 0.9.9.6](https://github.com/g-truc/glm/releases/tag/0.9.9.6) - 2019-09-08
#### Features:
- Added Neon support #945
- Added SYCL support #914
- Added EXT_scalar_integer extension with power of two and multiple scalar functions
- Added EXT_vector_integer extension with power of two and multiple vector functions
#### Improvements:
- Added Visual C++ 2019 detection
- Added Visual C++ 2017 15.8 and 15.9 detection
- Added missing genType check for bitCount and bitfieldReverse #893
#### Fixes:
- Fixed for g++6 where -std=c++1z sets __cplusplus to 201500 instead of 201402 #921
- Fixed hash hashes qua instead of tquat #919
- Fixed .natvis as structs renamed #915
- Fixed ldexp and frexp declaration #895
- Fixed missing const to quaternion conversion operators #890
- Fixed EXT_scalar_ulp and EXT_vector_ulp API coding style
- Fixed quaternion componant order: w, {x, y, z} #916
- Fixed GLM_HAS_CXX11_STL broken on Clang with Linux #926
- Fixed Clang or GCC build due to wrong GLM_HAS_IF_CONSTEXPR definition #907
- Fixed CUDA 9 build #910
#### Deprecation:
- Removed CMake install and uninstall scripts
### [GLM 0.9.9.5](https://github.com/g-truc/glm/releases/tag/0.9.9.5) - 2019-04-01
#### Fixes:
- Fixed build errors when defining GLM_ENABLE_EXPERIMENTAL #884 #883
- Fixed 'if constexpr' warning #887
- Fixed missing declarations for frexp and ldexp #886
### [GLM 0.9.9.4](https://github.com/g-truc/glm/releases/tag/0.9.9.4) - 2019-03-19
#### Features:
- Added mix implementation for matrices in EXT_matrix_common #842
- Added BUILD_SHARED_LIBS and BUILD_STATIC_LIBS build options #871
#### Improvements:
- Added GLM_FORCE_INTRINSICS to enable SIMD instruction code path. By default, it's disabled allowing constexpr support by default. #865
- Optimized inverseTransform #867
#### Fixes:
- Fixed in mat4x3 conversion #829
- Fixed constexpr issue on GCC #832 #865
- Fixed mix implementation to improve GLSL conformance #866
- Fixed int8 being defined as unsigned char with some compiler #839
- Fixed vec1 include #856
- Ignore .vscode #848
### [GLM 0.9.9.3](https://github.com/g-truc/glm/releases/tag/0.9.9.3) - 2018-10-31
#### Features:
- Added equal and notEqual overload with max ULPs parameters for scalar numbers #121
- Added GLM_FORCE_SILENT_WARNINGS to silent GLM warnings when using language extensions but using W4 or Wpedantic warnings #814 #775
- Added adjugate functions to GTX_matrix_operation #151
- Added GLM_FORCE_ALIGNED_GENTYPES to enable aligned types and SIMD instruction are not enabled. This disable constexpr #816
#### Improvements:
- Added constant time ULP distance between float #121
- Added GLM_FORCE_SILENT_WARNINGS to suppress GLM warnings #822
#### Fixes:
- Fixed simplex noise build with double #734
- Fixed bitfieldInsert according to GLSL spec #818
- Fixe
没有合适的资源?快使用搜索试试~ 我知道了~
OpenGL图形变换时的矩阵和向量计算数学库GLM
共1517个文件
html:696个
hpp:272个
cpp:204个
需积分: 5 2 下载量 138 浏览量
2022-03-31
21:32:18
上传
评论 1
收藏 5.53MB ZIP 举报
温馨提示
在使用OpenGL做图形加载后,根据实际需求往往需要进行平移、旋转、缩放等操作,在三维坐标中,通过矩阵和向量之间的各种数学运算完成以上过程。glm包含了丰富的矩阵、向量计算数学库。在用此数学库之前,需要有一定的图形变换基础知识。同时,需要具备一定的编程基础。
资源详情
资源评论
资源推荐
收起资源包目录
OpenGL图形变换时的矩阵和向量计算数学库GLM (1517个子文件)
glmConfig.cmake 662B
glmConfig-version.cmake 325B
core_func_integer.cpp 39KB
gtc_type_precision.cpp 36KB
core_func_common.cpp 36KB
gtc_bitfield.cpp 27KB
gtx_euler_angle.cpp 22KB
core_type_vec4.cpp 21KB
core_cpp_constexpr.cpp 19KB
gtc_packing.cpp 18KB
core_type_vec3.cpp 18KB
gtx_fast_trigonometry.cpp 17KB
ext_scalar_integer.cpp 15KB
core_func_integer_find_msb.cpp 13KB
ext_vector_integer.cpp 12KB
ext_vector_common.cpp 12KB
gtc_matrix_access.cpp 11KB
core_func_integer_find_lsb.cpp 11KB
gtc_quaternion.cpp 10KB
core_force_pure.cpp 10KB
ext_scalar_common.cpp 10KB
gtc_random.cpp 10KB
core_func_matrix.cpp 9KB
core_type_vec2.cpp 9KB
gtc_round.cpp 9KB
gtx_simd_mat4.cpp 9KB
glm.cpp 8KB
core_func_integer_bit_count.cpp 8KB
gtc_type_ptr.cpp 7KB
gtx_io.cpp 7KB
ext_vector_relational.cpp 7KB
core_type_ctor.cpp 6KB
gtx_dual_quaternion.cpp 6KB
core_type_mat4x4.cpp 5KB
gtc_integer.cpp 5KB
core_func_geometric.cpp 5KB
gtx_wrap.cpp 5KB
ext_matrix_relational.cpp 5KB
core_func_exponential.cpp 5KB
ext_vector_integer_sized.cpp 5KB
perf_vector_mul_matrix.cpp 5KB
perf_matrix_mul_vector.cpp 5KB
gtx_scalar_relational.cpp 5KB
core_setup_message.cpp 5KB
perf_matrix_mul.cpp 4KB
perf_matrix_div.cpp 4KB
ext_vector_iec559.cpp 4KB
gtc_type_aligned.cpp 4KB
core_type_mat3x3.cpp 4KB
perf_matrix_transpose.cpp 4KB
perf_matrix_inverse.cpp 4KB
gtx_string_cast.cpp 4KB
gtx_common.cpp 4KB
core_type_mat2x2.cpp 3KB
core_func_vector_relational.cpp 3KB
core_func_packing.cpp 3KB
core_type_vec1.cpp 3KB
core_type_cast.cpp 3KB
core_force_ctor_init.cpp 3KB
ext_vec1.cpp 3KB
gtx_matrix_factorisation.cpp 3KB
ext_quaternion_type.cpp 3KB
core_cpp_defaulted_ctor.cpp 3KB
gtx_component_wise.cpp 3KB
core_func_swizzle.cpp 3KB
core_type_mat3x4.cpp 3KB
core_type_mat4x3.cpp 3KB
core_type_mat2x4.cpp 3KB
gtx_random.cpp 3KB
core_type_mat4x2.cpp 3KB
gtc_noise.cpp 3KB
core_type_mat3x2.cpp 3KB
core_type_mat2x3.cpp 3KB
gtx_extended_min_max.cpp 3KB
gtx_intersect.cpp 3KB
gtx_load.cpp 2KB
core_type_aligned.cpp 2KB
gtx_simd_vec4.cpp 2KB
ext_scalar_relational.cpp 2KB
ext_quaternion_exponential.cpp 2KB
gtx_quaternion.cpp 2KB
gtc_color_space.cpp 2KB
ext_vector_ulp.cpp 2KB
gtx_type_aligned.cpp 2KB
ext_vector_bool1.cpp 2KB
gtx_spline.cpp 2KB
core_type_length.cpp 2KB
gtx_vector_angle.cpp 2KB
gtx_integer.cpp 2KB
gtx_rotate_vector.cpp 2KB
gtx_norm.cpp 2KB
gtc_epsilon.cpp 2KB
gtc_ulp.cpp 2KB
ext_scalar_ulp.cpp 2KB
ext_quaternion_geometric.cpp 2KB
ext_quaternion_transform.cpp 2KB
gtx_extented_min_max.cpp 2KB
core_setup_precision.cpp 2KB
ext_quaternion_common.cpp 1KB
gtx_fast_square_root.cpp 1KB
共 1517 条
- 1
- 2
- 3
- 4
- 5
- 6
- 16
龋龋独行的菜鸟
- 粉丝: 6
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0