Iva*_*van 4 c++ opengl glsl matrix eigen
如何将"特征矩阵"发送给GLSL?例如:
// Set up the model and projection matrix
Eigen::Matrix<GLfloat,4,4> projection_matrix;
projection_matrix = frustum(-1.0f, 1.0f, -aspect, aspect, 1.0f, 500.0f);
glUniformMatrix4fv(render_projection_matrix_loc, 1, GL_FALSE, &projection_matrix.data()[0]);
Run Code Online (Sandbox Code Playgroud)
我way(matrix.date()[0])为uBLAS 看了这个,但是Eigen不是uBLAS.我怎么能这样做?
gga*_*ael 10
只需调用.data()函数:
glUniformMatrix4fv(render_projection_matrix_loc, 1, GL_FALSE, projection_matrix.data());
Run Code Online (Sandbox Code Playgroud)
您可能也会对<unsupported/Eigen/OpenGLSupport>允许您编写的模块感兴趣:
glUniform(render_projection_matrix_loc, projection_matrix);
Run Code Online (Sandbox Code Playgroud)
同时处理尺寸,标量类型,存储布局等.例如,它也适用于表达式:
glUniform(render_projection_matrix_loc, 2*projection_matrix.tranpose());
Run Code Online (Sandbox Code Playgroud)