Hi community,
Could you please let me know how to get the vertex coordinates in world space in shaders. I would like to send this coordinate to my fragment shader using the varying vposition.
I know that “position” provides vertex coordinate in local space.
I tried the following but I no luck
varying vec3 vposition
vec4 modelViewPosition = modelViewMatrix * vec4(position, 1.0);
gl_Position = projectionMatrix * modelViewPosition;
vposition = vec3 (gl_Position.x, gl_Position .y, gl_Position .z);
Thanks,