Jump to content

shadmar

Members
  • Posts

    3,618
  • Joined

  • Last visited

Posts posted by shadmar

  1. Here is the GLSL equivalent (just for fun)

     

    #version 400
    
    uniform bool isbackbuffer;
    uniform vec2 buffersize;
    
    out vec4 fragData0;
    
    float RoundRect(in float radius, in vec2 fragCoord)
    {
       vec2 halfSize=vec2(buffersize/2.0);
       vec2 distFromCenter=fragCoord.xy - halfSize;
       return clamp(length(max(abs(distFromCenter) - (halfSize - radius), vec2(0.0))) - radius, 0.0, 1.0);
    
    }
    
    void main(void)
    {
       vec2 tcoord = vec2(gl_FragCoord.xy);
       if (isbackbuffer) tcoord.y = buffersize.y - tcoord.y;
    
       float pct = RoundRect(100.,tcoord);    
       fragData0 = mix(vec4(1.0), vec4(0.0), pct);
    }

    • Upvote 1
×
×
  • Create New...