• Как вырезать фон с картинки?

    @defild
    <canvas id="glCanvas" style="border: none;" width="400" height="400"></canvas>
    
     <script id="shader-fs" type="x-shader/x-fragment">
    
    precision mediump float;
    
    varying vec2 vTextureCoord;
    
     
    
    uniform sampler2D uSampler;
    
    uniform bool uUseColor;
    
    uniform vec4 uColor;
    
    void main(void)
    
    {
    
     if (uUseColor)
    
     gl_FragColor = uColor;
    
     else
    
     {
    
     gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
    
     
    
     if(gl_FragColor.a < 0.1)
    
     discard;
    
     }
    
    }
    
    </script>
    
    <script id="shader-vs" type="x-shader/x-vertex">
    
    attribute vec3 aVertexPosition;
    
    attribute vec2 aTextureCoord;
    
     
    
    uniform mat4 uMVMatrix;
    
    uniform mat4 uPMatrix;
    
     
    
    varying vec2 vTextureCoord;
    
     
    
    void main(void)
    
    {
    
     gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
    
     vTextureCoord = aTextureCoord;
    
    }
    
    </script>
    
    <script type="text/javascript" src="/webglpreviewer.js"></script>
    
    <script type="text/javascript">
    
    basePath = "http://test2-skins.ucoz.net";
    
      
    
    /* Set skin URL here to load */
    
    skinUrl = "/reshadecamp9161613.png";
    
    /* thin arms */
    
    alexArms = 0;
    
     
    /* Add backgrounds by calling preloadBackground */
    
    preloadBackground("/java/pmc_skin_bg.jpg");
    </script>
    <script type="text/javascript">
     webGLStart();
     </script>
    Ответ написан
    Комментировать