Hi, I’ve been getting a bit confused working with shaders in jme when it comes to names. In tutorials I keep seeing different names.
So for example, from the lighting shader
uniform mat4 g_WorldViewProjectionMatrix; I think this is called the ModelViewProjectionMatrix in opengl?
and so
uniform mat4 g_WorldViewMatrix; this would be the ModelViewMatrix?
What I want to do is find the position of the vertex being processed in the vertex shader. By position I ‘think’ I mean the world space position.
I’m assuming that
attribute vec3 inPosition;
is in object space, so I believe I need to multiply it by the ModelViewMatrix (so world in this case?), and then by the inverse ViewMatrix.
vec4 posWorld = g_WorldViewMatrix * vec4(inPosition, 0.0);
mat4 inv = inverse(g_ViewMatrix);
posWorld = posWorld * inv;
This has not gone well for me, getting confused. Can anyone tell me where I am going wrong?