c++ - 获取当前的 ModelView 矩阵

标签 c++ opengl matrix translation

在 OpenGL 中,如何读取模型 View 矩阵中的当前 x/y 转换?我知道您必须将当前矩阵加载到数组中并从那里读取 float ,但我不知 Prop 体该怎么做。

最佳答案

为了检索当前的模型 View 矩阵,您必须调用 glGetFloatv带有 GL_MODELVIEW_MATRIX 参数的函数。

GLfloat matrix[16]; 
glGetFloatv (GL_MODELVIEW_MATRIX, matrix); 

来自文档:

GL_MODELVIEW_MATRIX

params returns sixteen values: the modelview matrix on the top of the modelview matrix stack. Initially this matrix is the identity matrix.

关于c++ - 获取当前的 ModelView 矩阵,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/766127/

相关文章:

c++ - opengl 模板缓冲区未初始化为零?

c++ - 使用 glCreateBuffers 时出现访问冲突错误

python - Numpy 高级索引 : same index used multiple times in +=

C++ |矩阵添加奇怪的值

C++ - 访问可执行文件上的 "dropped"文件

c++ - 如何在 Visual Studio 中自动将预处理器和注释 block 插入到新的 C++ 头文件中?

c++ - vector 迭代器转换

c++ - 接受一个参数并返回它的函数

c - opengl 的镜面光太多

C 将矩阵读入动态数组