Funto

01-25-2010, 05:34 AM

Hi,

I am starting to use GLM, and I have 2 questions :

- is memory alignment always guaranteed ? (I suppose yes, according to some quick tests I did).

What I mean is, are we always sure sizeof(fvec3) == 3*sizeof(float) ? Same for matrices, and any dimension.

- if this is the case (I hope so ^^), how can we convert the

objects to the corresponding pointer ?

In other words : how can I write a clean version of this :

float* p = static_cast<float*>((void*)(&my_matrix));

- is the alignment the same as in OpenGL (i.e., when using a pointer as in my previous question, is p[0] p[1] p[2] p[3] the first column of a mat4 matrix ?)

Sorry for asking basic questions ^^

I am starting to use GLM, and I have 2 questions :

- is memory alignment always guaranteed ? (I suppose yes, according to some quick tests I did).

What I mean is, are we always sure sizeof(fvec3) == 3*sizeof(float) ? Same for matrices, and any dimension.

- if this is the case (I hope so ^^), how can we convert the

objects to the corresponding pointer ?

In other words : how can I write a clean version of this :

float* p = static_cast<float*>((void*)(&my_matrix));

- is the alignment the same as in OpenGL (i.e., when using a pointer as in my previous question, is p[0] p[1] p[2] p[3] the first column of a mat4 matrix ?)

Sorry for asking basic questions ^^