我正在查看像this这样的旧OpenGL代码:
glPushMatrix();
glMultMatrixf(Twc.m);
glLineWidth(mCameraLineWidth);
glColor3f(0.0f,1.0f,0.0f);
glBegin(GL_LINES);
glVertex3f(0,0,0);
//... more glVertex3f
glEnd();
glPopMatrix();
使用这个glMultMatrixf api创建一个类似锥体的对象。假设我们想使用add(const Eigen::Vector3f & translation, const Eigen::Quaternionf & rotation)
之类的东西对其进行现代化。如何从glMultMatrixf
获得翻译和轮换?
答案 0 :(得分:0)
您不需要从glMultMatrix
的结果中取回任何内容 - 您已经拥有包含此对象的合成转换的矩阵Twc.m
- 实际上,使用{ {1}}作为单独的矩阵是此代码的唯一部分,当切换到现代OpenGL时,它将保持不变。您现在只需在顶点着色器中应用该矩阵(与视图和投影变换结合使用)。