uBLAS compatible to OpenGL?
Hi, is the uBLAS library memory compatible to OpenGL vector and matrix operations? I'd like to use a single representation for both internal maths and the rendering interface of my application. OpenGL expects a pointer to a float or double C-array. For example 4x4 matrices are stored linearly as 16 values. When using std::vector<T> or bounded_array<T> as storage, is there a guarantee that m(0,0) is a reference to the first element of an array of (at least) 16 values that equal the linearized matrix elements? Or is there another way to get access to the low-level storage if it has a compatible memory layout? If there isn't, is it possible customize the uBLAS library by an additional "storage organization" or "adapted array" class? best regards, Malte
On Wed, 2005-04-13 at 19:47 +0200, Malte Clasen wrote:
Hi,
is the uBLAS library memory compatible to OpenGL vector and matrix operations? I'd like to use a single representation for both internal maths and the rendering interface of my application. OpenGL expects a pointer to a float or double C-array. For example 4x4 matrices are stored linearly as 16 values.
OpenGL expects column-major ordering for 4x4 matrices, whereas uBLAS is
row-major by default. Try something like
typedef ublas::matrix
participants (2)
-
Jonathan Brandmeyer
-
Malte Clasen