Passing Boost uBLAS matrices to OpenGL shader

Posted by AJM on Stack Overflow See other posts from Stack Overflow or by AJM
Published on 2010-06-09T02:13:00Z Indexed on 2010/06/09 2:22 UTC
Read the original article Hit count: 355

Filed under:
|
|
|
|

I'm writing an OpenGL program where I compute my own matrices and pass them to shaders. I want to use Boost's uBLAS library for the matrices, but I have little idea how to get a uBLAS matrix into OpenGL's shader uniform functions.

matrix<GLfloat, column_major> projection(4, 4);
// Fill matrix
...

GLuint projectionU = glGetUniformLocation(shaderProgram, "projection");
glUniformMatrix4fv(projectionU, 1, 0, (GLfloat *)... Um ...);

Trying to cast the matrix to a GLfloat pointer causes an invalid cast error on compile.

© Stack Overflow or respective owner

Related posts about opengl

Related posts about boost