[英]OpenGL - GLM and GLSL, how are they different?
I am starting to learn about OpenGL and GLM and GLSL and I am getting a little confused. 我开始学习OpenGL,GLM和GLSL,我有点困惑。 I will say in here what I have understood so far and my questions, so please feel free to correct me anytime. 我会在这里说到目前为止我所理解的和我的问题,所以请随时随地纠正我。
So far I see that GLM extends the GLSL documentation providing more math functions, but since GLM is C++ based it will run on the CPU, on the other hand, GLSL runs directly in the GPU so I guess matrix math is a lot faster in GLSL since it can use the GPU's power to do all the math in parallel. 到目前为止,我看到GLM扩展了GLSL文档,提供了更多的数学函数,但由于GLM是基于C ++的,它将在CPU上运行,另一方面,GLSL直接在GPU中运行,所以我猜GLSL中的矩阵数学运算要快很多因为它可以使用GPU的功能并行完成所有数学运算。 So why to use GLM? 那么为什么要使用GLM呢?
They're completely different things: 他们是完全不同的东西:
GLM isn't meant as a substitute or alternative to GLSL. GLM不是GLSL的替代品或替代品。 It's meant to help with calculations that wouldn't make sense to do on the GPU — things like building a projection matrix to be used by your vertex shaders, or computing distances between points in 3D space. 它旨在帮助进行在GPU上没有意义的计算 - 例如构建顶点着色器使用的投影矩阵,或计算3D空间中点之间的距离。
They're two completely different things: 他们是两个完全不同的东西:
The reason GLM has OpenGL in its name is because it was built with graphics programming in their minds (in other words, made for OpenGL). GLM在其名称中使用OpenGL的原因是因为它是在他们的脑海中使用图形编程构建的(换句话说,是为OpenGL制作的)。
Short version: GLM is for your program, GLSL's math capabilities are for your shader. 简短版本:GLM适用于您的程序,GLSL的数学功能适用于您的着色器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.