本文介绍了OpenGL获取投影矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在OpenGL中使用gluUnProject,首先我需要获取projectoin,model_view和viewort矩阵.根据我在网上找到的示例,我使用
I am trying to use gluUnProject in OpenGL, first I need to get the projectoin, model_view, and viewort matrices. According to examples that I have found online I used
glGetFloatv(GL_PROJECTION_MATRIX, projection)
glGetFloatv(GL_MODELVIEW_MATRIX, model_view)
glGetInteger(GL_VIEWPORT, viewport)
但是我收到错误消息"ValueError:glGetFloatv需要1个参数(pname),收到2:(GL_PROJECTION_MATRIX,[])"
But I get the error "ValueError: glGetFloatv requires 1 arguments (pname), received 2: (GL_PROJECTION_MATRIX, [])"
那么,我应该用什么来获取这些矩阵?
So, what should I be using to get these matrices?
推荐答案
也许:
projection = glGetFloatv(GL_PROJECTION_MATRIX)
# and so on ...
之后,在projection
变量中应为投影矩阵
after that in projection
variable should be PROJECTION matrix
这篇关于OpenGL获取投影矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!