PDA

View Full Version : GLM question: transpose a vector?



metsfan
03-25-2012, 02:30 PM
Hey all,

I am having a bit of trouble doing certain operations in GLM because it seems it's not possible to take the transpose of a vector. Is there a type I'm missing here? I see there is no mat3x1 or mat1x3 types, and the glm::transpose function doesn't allow vectors as an argument. Anyone know a way around this that I'm missing?

thokra
03-28-2012, 12:51 AM
What do you want to compute?

Groovounet
03-28-2012, 06:16 PM
If you are working with a matrix then:

mat4 m;
vec4 v;
...

v * m is the transposed version of m * v and this is following the GLSL specification.

Furthermore, this code is properly optimized so that v * m is faster to compute than transpose(m) * v;