# Importing SVG to p5.js sketch

**URL:** <https://discourse.processing.org/t/importing-svg-to-p5-js-sketch/24072>\
**Category:** Beginners\
**Created:** [September 23, 2020, 7:37am UTC](https://discourse.processing.org/t/importing-svg-to-p5-js-sketch/24072 "2020-09-23T07:37:06Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Sven](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sven/32/8293_2.png) [@Sven](https://discourse.processing.org/u/Sven)\
**Post date:** [September 26, 2020, 2:54pm UTC](https://discourse.processing.org/t/importing-svg-to-p5-js-sketch/24072/11 "2020-09-26T14:54:44Z")

</div>

As I wrote before, WebGL isn’t really my thing. Someone more knowledgeable in the subject should take a swing at this. But maybe there’s a different way to attack the problem? Keep the depth test enabled, replace the SVG with a photo of your choice and add it as texture to a circle (not a rectangle). Doing the above, I got this result:

 ![A circular photograph and other shapes in 3D space.](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/2/2d5f899a73ef79ea97471e2fc33c12b3b23e2b74.png)

By making the following changes to your code.

```auto
function preload() {
  //img = loadImage('Artboard 1.svg');
  img = loadImage('https://picsum.photos/800/800');
  img2 = loadImage('Dana_2.png');
  img3 = loadImage('Dana_3.png');
}

function setup() {
  createCanvas(windowWidth, windowHeight, WEBGL);
  // rectMode(CENTER);
  imageMode(CENTER);
  noStroke();
  img.resize(400, 0);

  //drawingContext.disable(drawingContext.DEPTH_TEST);
}

function draw() {
  // [...] code not shown for brevity.

  texture(img);

  //rect(0, 0, 400, 400);
  circle(200, 200, 400, 400);
  
  // [...] rest of function hidden for brevity.
} 

```

---

_[View the full topic](https://discourse.processing.org/t/importing-svg-to-p5-js-sketch/24072)._
