GLM:函数取度数作为参数已弃用(WHEN使用RADIANS) [英] GLM: function taking degrees as a parameter is deprecated (WHEN USING RADIANS)
问题描述
目前使用VC ++ 11与SDL2,GLM和GLEW。这个问题源于GLM,当我试图做两件事情:创建一个旋转矩阵,创建透视相机矩阵(3D)。
Currently using VC++ 11 with SDL2, GLM, and GLEW. The issue is stemming from GLM when I attempt to do two things: Create a rotation matrix, create a perspective camera matrix (3D).
错误是:GLM:透视函数以度为参数已弃用
弧度(作为浮点)。它说我应该定义类似#define GLM_FORCE_RADIANS。这是真的有必要吗?
The error is: "GLM: perspective function taking degrees as a parameter is deprecated" despite the fact that I am passing radians (as floats) to both functions. It says I should define something like "#define GLM_FORCE_RADIANS." Is that really necessary?
我个人使用度数为一切,但OpenGL,所以必须转换来回(AI运动和什么不是)是一个痛苦,实际上导致CPU尖峰当我有很多NPC移动。
Personally I use degrees for everything, but OpenGL, so having to convert back and forth (for AI movement and what not) is a pain and actually causes a spike in CPU when I have many NPCs moving.
推荐答案
#define degreesToRadians(x) x*(3.141592f/180.0f)
静态部分应在编译时由编译器解析,任何程度的glm东西与那个宏,你做完了。也添加
the static part should be resolved at compile time by the compiler, just surround any degrees to glm stuff with that macro and you are done. Also add
#define GLM_FORCE_RADIANS
包含和glm标题之前,所以它将默认使用弧度而不是度
before including and glm headers, so that it will by default use radians instead of degrees
这篇关于GLM:函数取度数作为参数已弃用(WHEN使用RADIANS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!