Advertisement
mivebe

Ex: 1 - Circle

Nov 21st, 2023
1,455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #version 300 es
  2. #ifdef GL_ES
  3. precision mediump float;
  4. #endif
  5.  
  6. uniform vec2 u_resolution;
  7. out vec4 outColor;
  8.  
  9. float circleshape(vec2 position, float radius) {
  10.   return step(radius, length(position - vec2(0.5)));
  11. }
  12.  
  13. void main() {
  14.   vec2 position = gl_FragCoord.xy / u_resolution.x;
  15.   vec3 color = vec3(0.0);
  16.  
  17.   float circle = circleshape(position, 0.3);
  18.  
  19.   color = vec3(circle);
  20.  
  21.   outColor = vec4(color, 1.0);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement