Question regarding Molehill and Matrices

Hello.

I’ve been struggling to write a Phong shader for my Molehill project. The problem is that the light seems to shift or move when the camera rotates.

So I’ve been investigating what could possibly be wrong, by basically comparing my shader with the Phong shader written in GLSL.

There’s one thing I found that is kind of weird. In GLSL the output position in the vertex shader is ModelViewProjectionMatrix * Vertex, ok that is just fine.

HOWEVER, in Molehill the ModelViewProjectionMatrix has to be transposed so that it will render the vertex correctly to the screen. In GLSL that is not necessary.

How did I find that out?

I created the Matrix3D modelViewProjection, I applied the ModelView to that matrix and then the Projection matrix. I tried to give the vertex shader that matrix and it displayed nothing until I transposed the modelViewProjection.

In GLSL this is not necessary, I could just say output.position = projection * modelview * vertex and it would be displayed correctly, I don’t need to do transpose(projection * modelview * vertex).

So… I’m wondering if there’s something that I am not seeing here or is this a special part of Molehill that we just have to follow? Or could it be a bug in Molehill?

Any answers would be highly appreciated. I will create a new post tonight with my Phong shader and hope that someone sees what I may be doing wrong. But this is confusing me a lot at the moment and would like to know why the matrix has to be transposed. :jail:

Thanks!