PShape::beginShape() does not accept a shape type as an argument #4826

Closed
seanwooj opened this Issue Jan 11, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@seanwooj

Not sure if this is true in P3D, but in the P2D engine, the following code does not work as specified:

void display() {
    plus = createShape();
    plus.beginShape(LINES);
      // horizontal line
      plus.vertex(0, size/2);
      plus.vertex(size, size/2);
      // vertical line
      //plus.vertex(size/2, 0);
      plus.vertex(size/2, size);
    plus.endShape();
    
    shape(plus);
  }

size is passed into the class which this display method is inside of. In this case I am using LINES, which should create two lines which intersect at their midpoint. Instead I am getting the following, which is 3 lines, which is the expected behavior if there is no shape type passed in as an argument.

image

If I change the shape type to POINTS, it also does not work, again, defaulting to the typical PShape::beginShape() without an argument output.

Of course, this is an issue only if the PShape::beginShape method does not support arguments, but this documentation implies that it should behave like the beginShape function

https://processing.org/reference/beginShape_.html
https://processing.org/reference/PShape_beginShape_.html - note the syntax section.

GKFX added a commit to GKFX/processing that referenced this issue Jan 17, 2017

@GKFX

This comment has been minimized.

Show comment
Hide comment
@GKFX

GKFX Jan 17, 2017

Contributor

@seanwooj I've fixed it, but I think you meant Java 2D, rather than P2D. If you change your size line to size(###, ###, P2D), does the bug go away? And what happens if you then leave out P2D? Thanks!

Contributor

GKFX commented Jan 17, 2017

@seanwooj I've fixed it, but I think you meant Java 2D, rather than P2D. If you change your size line to size(###, ###, P2D), does the bug go away? And what happens if you then leave out P2D? Thanks!

@benfry benfry closed this in #4834 Jan 18, 2017

benfry added a commit that referenced this issue Jan 18, 2017

Merge pull request #4834 from GKFX/bugfix-pshape
Fix #4826. PShape in Java2D wasn't respecting kind.
@seanwooj

This comment has been minimized.

Show comment
Hide comment
@seanwooj

seanwooj Jan 18, 2017

@GKFX - Yep, that was the case -- sorry for the confusion, and thanks for the quick fix!

@GKFX - Yep, that was the case -- sorry for the confusion, and thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment