The code looks as follows:
void RenderingView::VisitTransformationNode(TransformationNode* node) {
Matrix<4,> transformationMatrix = node->GetTransformationMatrix();
float realTransformationMatrix[16];
transformationMatrix.ToArray(realTransformationMatrix);
glMultTransposeMatrixfARB(realTransformationMatrix);
node->VisitSubNodes(*this);
}
The real trick was the magic ARB letters which is used to specify a function in the extension lib of OpenGL.
The code actually just fetches the transformation matrix from the scene graph structure and uses the boost .ToArray(*float) function to populate an array which in turn is given to the gl function. The gl function is the transposed version of the normal one as the boost matrix returned is in row major and OpenGL treats its pointer as a 4x4 column major matrix.
No comments:
Post a Comment