# Image texture on a softbody

**URL:** <https://discourse.processing.org/t/image-texture-on-a-softbody/3193>\
**Category:** Coding Questions\
**Created:** [September 2, 2018, 2:24pm UTC](https://discourse.processing.org/t/image-texture-on-a-softbody/3193 "2018-09-02T14:24:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adrien](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/adrien/32/1289_2.png) [@Adrien](https://discourse.processing.org/u/Adrien)\
**Post date:** [September 2, 2018, 2:24pm UTC](https://discourse.processing.org/t/image-texture-on-a-softbody/3193/1 "2018-09-02T14:24:03Z")

</div>

Hi, I want to make a image fly like an paper blow by the wind…  
Do you know if it’s possible to apply a texture on a softbody, for exemple using pixelflow lib?  
Thanks!  
A.

---

<div class="post-metadata">

**Author:** ![Adrien](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/adrien/32/1289_2.png) [@Adrien](https://discourse.processing.org/u/Adrien)\
**Post date:** [September 2, 2018, 2:42pm UTC](https://discourse.processing.org/t/image-texture-on-a-softbody/3193/2 "2018-09-02T14:42:47Z")

</div>

Ok, I found a way, I though it would be very hard, but it’s more easy than what I was thinking 😉  
A.

---

<div class="post-metadata">

**Author:** ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)\
**Post date:** [September 3, 2018, 6:14pm UTC](https://discourse.processing.org/t/image-texture-on-a-softbody/3193/3 "2018-09-03T18:14:01Z")

</div>

You can’t leave us hanging!

---

<div class="post-metadata">

**Author:** ![Adrien](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/adrien/32/1289_2.png) [@Adrien](https://discourse.processing.org/u/Adrien)\
**Post date:** [September 5, 2018, 1:18pm UTC](https://discourse.processing.org/t/image-texture-on-a-softbody/3193/4 "2018-09-05T13:18:56Z")

</div>

Ah ah sorry 😉

For exemple, in the Softboy2D\_cloth example from the PixelFlow lib, just change

```auto
    texture.beginDraw();
    {
      texture.background(cloth.material_color);
  
      // grid
      int num_lines = nodex_x;
      float dx = tex_w/(float)(num_lines-1);
      float dy = tex_h/(float)(num_lines-1);
      texture.strokeWeight(1f);
      texture.stroke(0);
      for(int ix = 0; ix < num_lines; ix++){
        texture.line((int)(dx*ix), 0,(int)(dx*ix), tex_h);
        texture.line(0, (int)(dy*ix), tex_w, (int)(dy*ix));
      }
      
      // text
      texture.fill(0);
      texture.textFont(font);
      texture.textAlign(CENTER, CENTER);
      texture.textFont(font);
      texture.text(text, tex_w/2, tex_h/2);
  
      // border
      texture.noFill();
      texture.stroke(0);
      texture.strokeWeight(5);
      texture.rect(0, 0, tex_w, tex_h);
    }
    texture.endDraw();
    
    cloth.texture_XYp = texture;

```

with something like

```auto
  texture.beginDraw();
  {
    texture.background(0, 0);
    texture.image(imgText, 0, 0, tex_w, tex_h);
  }
  texture.endDraw();

  cloth.texture_XYp = texture;

```

where imgText is your PImage…and here you go 😉
