depth.vs 380 B

123456789101112131415161718
  1. #version 120
  2. attribute vec3 vPosition;
  3. attribute vec2 vTexcoord;
  4. uniform mat4 world;
  5. uniform mat4 view;
  6. uniform mat4 proj;
  7. varying vec2 fTexcoord;
  8. varying float fDepth;
  9. void main() {
  10. fTexcoord = vTexcoord;
  11. vec4 screen_position = proj * view * world * vec4(vPosition, 1);
  12. fDepth = screen_position.z / screen_position.w;
  13. gl_Position = screen_position;
  14. }