Skip to content

RuntimeException when calling strokeWeight using FX2D #4206

Description

@mikechambers

Processing 3.0.1
OS X 10.10.5 / Windows 10

When using FX2D renderer, I get a RuntimeException (see below). Exception does not occur when using default renderer, or in processing 2.

Exception:

java.lang.RuntimeException: pushMatrix() cannot use push more than 32 times
    at processing.javafx.PGraphicsFX2D.pushMatrix(PGraphicsFX2D.java:1598)
    at processing.javafx.PGraphicsFX2D.beginShape(PGraphicsFX2D.java:217)
    at processing.core.PGraphics.beginShape(PGraphics.java:1185)
    at processing.core.PApplet.beginShape(PApplet.java:10710)
    at BezierPlay2.draw(BezierPlay2.java:110)
    at processing.core.PApplet.handleDraw(PApplet.java:2399)
    at processing.javafx.PSurfaceFX$1.handle(PSurfaceFX.java:75)
    at processing.javafx.PSurfaceFX$1.handle(PSurfaceFX.java:1)
    at com.sun.scenario.animation.shared.TimelineClipCore.visitKeyFrame(TimelineClipCore.java:226)
    at com.sun.scenario.animation.shared.TimelineClipCore.playTo(TimelineClipCore.java:184)
    at javafx.animation.Timeline.impl_playTo(Timeline.java:176)
    at javafx.animation.AnimationAccessorImpl.playTo(AnimationAccessorImpl.java:39)
    at com.sun.scenario.animation.shared.InfiniteClipEnvelope.timePulse(InfiniteClipEnvelope.java:126)
    at javafx.animation.Animation.impl_timePulse(Animation.java:1102)
    at javafx.animation.Animation$1.lambda$timePulse$26(Animation.java:186)
    at javafx.animation.Animation$1$$Lambda$98/682942078.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at javafx.animation.Animation$1.timePulse(Animation.java:185)
    at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:344)
    at com.sun.scenario.animation.AbstractMasterTimer$MainLoop.run(AbstractMasterTimer.java:267)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:521)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:505)
    at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$400(QuantumToolkit.java:334)
    at com.sun.javafx.tk.quantum.QuantumToolkit$$Lambda$56/1775377411.run(Unknown Source)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
handleDraw() called before finishing
Could not run the sketch (Target VM failed to initialize).
For more information, read revisions.txt and Help → Troubleshooting.

The issue is the call to strokeWeight(1.0) on line 82. If you comment out this line, project works without issue.

Note: If you also set strokeWeight to a value greater that 1.0, everything works. When it is set to 1.0, then PGraphicsFX2D.drawingThinLines() returns true, which cause all of the pushMatrix calls.

  @Override
  public void beginShape(int kind) {
    shape = kind;
    vertexCount = 0;

    workPath.reset();
    auxPath.reset();

    flushPixels();

    if (drawingThinLines()) {
      pushMatrix();
      translate(0.5f, 0.5f);
    }
  }

drawingThingLines was added in this commit in august: 0b143c6

Project attached.
BezierPlay2.zip

To reproduce, run code, move mouse around on screen. RTE.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions