Advertisement
Denisdude

Default vertex shader

Sep 10th, 2021
3,184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //uniform mat4 projectionMatrix;
  2. //uniform mat4 viewMatrix;
  3. //uniform mat4 modelMatrix;
  4.  
  5. uniform vec2 u_resolution;  // screen size (px) {width, height}
  6. uniform vec2 u_mouse;       // mouse cursor position (px) {x, y}
  7. uniform float u_time;       // time in milliseconds since the beginning
  8. uniform float u_deltaTime;  // time in milliseconds since the last frame
  9.  
  10. //attribute vec3 position;
  11. //attribute vec2 uv;
  12.  
  13. varying vec2 vUV;
  14.  
  15. void main() {
  16.     vec4 modelPosition = modelMatrix * vec4(position, 1.0);
  17.     vec4 viewPosition = viewMatrix * modelPosition;
  18.     vec4 projectedPosition = projectionMatrix * viewPosition;
  19.  
  20.     gl_Position = projectedPosition;
  21.     //gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.0);
  22.  
  23.     vUV = uv;
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement