trans_view_to_world in glsl?

Hi,

I tried to get trans_view_to_world matrix in glsl shader but it didn’t work. Could you please help me?

References page: panda3d.org/manual/index.ph … ate_Spaces

How are you using it, and how is it failing?

You may have to use apiview instead of view, depending on your use case.

I am going to get viewDirection of gl_Vertex in world coordinate. Then I will use it for applying Cube Texture to my model

//vs
vec4 positionInViewSpace = (gl_ModelViewMatrix * gl_Vertex);
vec3 viewDirection = vec3(trans_view_to_world * viewDirectionInViewSpace);
vec3 Normal = normalize(gl_NormalMatrix*gl_Normal);
reflectDir = reflect(viewDirection, Normal);

//fs
gl_FragColor = textureCube(p3d_Texture0, vec3(reflectDir.x, -reflectDir.z,
reflectDir.y));