# Texture on primitive object appear inverted?

**URL:** https://discourse.processing.org/t/texture-on-primitive-object-appear-inverted/19487
**Category:** Coding Questions
**Created:** [April 7, 2020, 1:40am UTC](https://discourse.processing.org/t/texture-on-primitive-object-appear-inverted/19487 "2020-04-07T01:40:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Samizen](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@Samizen](https://discourse.processing.org/u/Samizen)
#### Post date: [April 7, 2020, 1:40am UTC](https://discourse.processing.org/t/texture-on-primitive-object-appear-inverted/19487/1 "2020-04-07T01:40:03Z")

</div>

I have used a primitive box and textured it, though the texture appears to be inverted.

 ![Image 2](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/9/9c156987b69e95532388ad9bdf54817c7b4469a6.jpeg)

How do I flip it horizontally? I think its got something to do with transformation but it confused me a lot.

Here is the code

```auto
PImage worldMap;
PShape box;

Table table;
int rowCount;
float x1, y1, z1, x2, y2, z2;

void setup() {
  size(1400, 800, P3D);
  table = new Table("From_USA_Coordinates.tsv");
  rowCount = table.getRowCount();
  worldMap = loadImage("world.topo.bathy.200406.3x5400x2700.jpg"); 
  worldMap.resize(500, 300);
  textureMode(NORMAL);
  fill(255);
  stroke(color(44,48,32));
  box = createShape(BOX, 650, 300, 30);
  box.beginShape(BOX);
  box.endShape();
  box.setTexture(worldMap);
}

void draw() {
  background(255);
  noStroke();
  translate(350, 600, -50);
  rotateX(PI/4);
  //rotateY(PI);
  //rotateZ(PI/4);
  
  shape(box);  
  //Second Box:
  translate(700,0,0);
  shape(box);
  //translate(-1400, 0);  
  //rotate(radians(-10));

```

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [April 7, 2020, 2:19am UTC](https://discourse.processing.org/t/texture-on-primitive-object-appear-inverted/19487/2 "2020-04-07T02:19:11Z")

</div>

Hello,

Try this:  
`box = createShape(BOX, -650, 300, 30);`

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/5/5bed2790fa1db691df1b75feca51eb46cacb4a49.jpeg)

You could also create your own box and map a texture onto the geometry:  
[https://processing.org/reference/vertex\_.html](https://processing.org/reference/vertex_.html)

`:)`

---

<div class="post-metadata">

### Author: ![Samizen](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@Samizen](https://discourse.processing.org/u/Samizen)
#### Post date: [April 7, 2020, 2:45am UTC](https://discourse.processing.org/t/texture-on-primitive-object-appear-inverted/19487/3 "2020-04-07T02:45:24Z")

</div>

Thanks @glv This did the trick.
