Processing: shapeMode() never works when shape = createShape(a_2D_native, ...)

Created on 11 Jan 2018  Â·  3Comments  Â·  Source: processing/processing





Description



The use of shapeMode() does not affect upon drawing

Expected Behavior



The drawing of a shape should be depending on the state of shapeMode.

Current Behavior


If you create a shape adapted from a 2D native such as ELLIPSE and state that shapeMode(CENTER), it does the same as shapeMode(CORNER)

Steps to Reproduce


  1. The following code
PShape circle;

void setup() {
  size(200, 200);
  circle = createShape(ELLIPSE, 0, 0, 60, 60);
}

void draw() {
  shapeMode(CORNER);
  shape(circle, 100, 100);
  shapeMode(CENTER);
  shape(circle, 100, 100);
}

only puts one white circle in the center, when it should add two distinct ones:

1

  1. As a comparison, this code produces two different circles:
PShape circle;

void setup() {
  size(200, 200);
  circle = createShape(ELLIPSE, 0, 0, 60, 60);
}

void draw() {
  shapeMode(CORNER);
  shape(circle, 100, 100);
  shapeMode(CENTER);
  shape(circle, 100, 200);
}

because one of them is simply drawn further down (y2 = 200):

2

  1. Also, a scaled up version of the createShape() page in the Processing reference works just fine:
PShape bot;

void setup() {
  size(200, 200);
  bot = loadShape("bot.svg");
}

void draw() {
  shapeMode(CENTER);
  shape(bot, 70, 70, 100, 100);
  shapeMode(CORNER);
  shape(bot, 70, 70, 100, 100);
}

3

Your Environment



  • Processing version: 3.3.6
  • Operating System and OS version: Windows 10, version 1709
  • Other information: N/A

Possible Causes / Solutions


It seems that shape() does not take in consideration that the context instructed by shapeMode() might change, but I don't have a better guess.

Most helpful comment

I was puzzling over this today. It is still not fixed, as of 3.5.3.

All 3 comments

You should know that it's still the case for 3.3.7

I was puzzling over this today. It is still not fixed, as of 3.5.3.

Neither 3.5.4. ಥ_ಥ

Was this page helpful?
0 / 5 - 0 ratings

Related issues

moritzsalla picture moritzsalla  Â·  8Comments

jdslab picture jdslab  Â·  4Comments

danieltorrer picture danieltorrer  Â·  10Comments

liquidev picture liquidev  Â·  6Comments

GenJamGuy picture GenJamGuy  Â·  10Comments