How to apply an image texture to a shape extracted from a .SVG file?

edited April 2016 in How To...

Hi all, I'm trying to apply an image texture to a shape extracted from a .SVG file. Apparently, shapefromSVG.setTexture(image) is not working properly, at least for me...It just fills the shape with the color of the pixel in the position (0,0) of the image :S

Many thanks in advance.


  • sounds like the texture coords are wrong.

    have you tried .setTextureMode(IMAGE) ? (although i thought that was the default)

  • Hi koogs, thanks for the answer. By now it's not working. With the following code, I get the output in the attached image. As you can see, the svg it's only fill with one color, instead of the whole pattern...

    void setup() { size(1024, 768,P3D); svg = loadShape("sample.svg"); pic=loadImage("img.jpg"); print(svg.getChildCount()); svg0=svg.getChild(1); }

    void draw(){

    image(pic,0,0); beginShape(); svg0.disableStyle(); svg0.setTextureMode(IMAGE); svg0.setTexture(pic); shape(svg0,0,0); endShape();


    Thanks again

    Captura de pantalla 2016-04-15 a las 14.52.10

Sign In or Register to comment.