skyBox.vert 387 B

12345678910111213
  1. #version 330 core
  2. //https://community.khronos.org/t/rendering-a-skybox-after-drawing-post-process-effects-to-a-screen-quad/74002
  3. out vec3 v_vsViewDirection;
  4. uniform mat4 u_invView;
  5. uniform mat4 u_invProj;
  6. void main()
  7. {
  8. gl_Position = vec4(((gl_VertexID & 1) << 2) - 1, (gl_VertexID & 2) * 2 - 1, 0.0, 1.0);
  9. v_vsViewDirection = mat3(u_invView) * (u_invProj * gl_Position).xyz;
  10. }