# Why this does not work?

**URL:** <https://discourse.processing.org/t/why-this-does-not-work/32786>\
**Category:** Processing\
**Created:** [October 13, 2021, 12:18am UTC](https://discourse.processing.org/t/why-this-does-not-work/32786 "2021-10-13T00:18:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![creepercrack](https://avatars.discourse-cdn.com/v4/letter/c/3bc359/32.png) [@creepercrack](https://discourse.processing.org/u/creepercrack)\
**Post date:** [October 13, 2021, 12:18am UTC](https://discourse.processing.org/t/why-this-does-not-work/32786/1 "2021-10-13T00:18:10Z")

</div>

I’m trying to visualize openstreetmap data but when I go to render it to the screen, if I change the noFill and stroke it wont render anything. The weird thing is that it works perfectly with those two lines commented. Maybe you can look at it because I don’t know what it could be causing the problem

So this is my code:

```auto
import java.util.Map;

XML xml;

XML bounds;
HashMap<String, XML> nodes;
HashMap<String, XML> ways;
HashMap<String, XML> relations;

float minlat;
float minlon;
float maxlat;
float maxlon;

int x;
int y;
int scale;

void settings() {
  xml = loadXML("map.osm");

  bounds = xml.getChildren("bounds")[0];
  nodes = new HashMap<String, XML>();
  ways = new HashMap<String, XML>();
  relations = new HashMap<String, XML>();

  for (XML node : xml.getChildren("node")) nodes.put(node.getString("id"), node);
  for (XML way : xml.getChildren("way")) ways.put(way.getString("id"), way);
  for (XML relation : xml.getChildren("relations")) relations.put(relation.getString("relation"), relation);

  minlat = bounds.getFloat("minlat");
  minlon = bounds.getFloat("minlon");
  maxlat = bounds.getFloat("maxlat");
  maxlon = bounds.getFloat("maxlon");

  x = 0;
  y = 0;
  scale = 400000;

  size((int)((maxlon - minlon) * scale), (int)((maxlat - minlat) * scale), P2D);
}

void setup() {
  stroke(255);
}

void draw() {
  background(0);

  if (mousePressed && mouseButton == LEFT) {
    x += mouseX - pmouseX;
    y += mouseY - pmouseY;
  }

  translate(-minlon * scale + x, maxlat * scale + y);

  for (XML way : ways.values()) {
    PShape wayShape = createShape();
    
    wayShape.beginShape();
    //wayShape.noFill();
    //wayShape.stroke(255);
    
    for (XML nd : way.getChildren("nd")) {
      XML node = nodes.get(nd.getString("ref"));
      
      float lat = node.getFloat("lat");
      float lon = node.getFloat("lon");
      
      wayShape.vertex(lon * scale, -lat * scale);
    }
    
    wayShape.endShape();
    shape(wayShape);
  }

  println("FPS: " + frameRate);`Preformatted text`
}

```

This is whitout the lines commented:

 ![imagen](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/cf7923aefd0fbeaff0b5aafc0e3567ea910540d2.png)

This is with the stroke only (I should see the lines forming the shapes, but it’s black):

 ![imagen](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/4/4824d855b8f6f3538253c59b2a8d76a4891222d9.png)

The transformations are done right and I’m not appliyng and scale sho I the the lines should be visible

This is the file:  
[https://mega.nz/file/8Y521ZCZ#P96Njpd6WUpUjU19XsVmm7DRSI\_31ryNoMhUpaP0Dro](https://mega.nz/file/8Y521ZCZ#P96Njpd6WUpUjU19XsVmm7DRSI_31ryNoMhUpaP0Dro)

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [October 13, 2021, 9:28pm UTC](https://discourse.processing.org/t/why-this-does-not-work/32786/2 "2021-10-13T21:28:57Z")

</div>

Maybe try setting your draw background to 128. Then try setting your wayShape fill and stroke – separately, one at a time – to 0 and 255, and see what happens?

---

<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:** [October 13, 2021, 9:36pm UTC](https://discourse.processing.org/t/why-this-does-not-work/32786/3 "2021-10-13T21:36:13Z")

</div>

Hello,

With Processing 4.0b1 and 3.5.4…

Using P3D renderer and this:

```auto
wayShape.noFill();
wayShape.strokeWeight(2);
wayShape.stroke(color(255, 0, 0));

```

I got this:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/cde07f0ebbb8e2a584d61a8579b72e58fc9d8cac.png)

The default and FX3D renderer gave me a solid 60 fps!

I do not know why it does not work with P2D.

Reference for renderers:

> **[Reference](https://processing.org/reference/size_.html)**
>
> Defines the dimension of the display window width and height in units of pixels. In a program that has the setup() function, the size() function must be the first line of code inside …

`:)`

---

<div class="post-metadata">

**Author:** ![creepercrack](https://avatars.discourse-cdn.com/v4/letter/c/3bc359/32.png) [@creepercrack](https://discourse.processing.org/u/creepercrack)\
**Post date:** [October 16, 2021, 5:14pm UTC](https://discourse.processing.org/t/why-this-does-not-work/32786/4 "2021-10-16T17:14:45Z")

</div>

Ok, so the default renderer gives a more stable framerate than P2D or P3D and P2D does not work for wathever reason as you said (may be a bug?). Thank you `:D`
