New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PShapes do not show up in PDF with P2D renderer #4647

Closed
gncgnc opened this Issue Sep 5, 2016 · 0 comments

Comments

Projects
None yet
2 participants
@gncgnc

gncgnc commented Sep 5, 2016

PShapes don't render to PDF; directly drawn shapes do render as expected. PShapes show up when using te default renderer. See here:

import processing.pdf.*;

boolean saveOneFrame = false;

PShape star;

void setup() {
  size(600, 600, P2D);
  frameRate(24);
  drawStar();
}

void draw() {
  if(saveOneFrame == true) {
    beginRecord(PDF, "Line.pdf"); 
  }

  background(255);
  stroke(0, 20);
  strokeWeight(20.0);
  line(mouseX, 0, width-mouseY, height);

  shape(star, mouseX,mouseY);

  if(saveOneFrame == true) {
    endRecord();
    saveOneFrame = false; 
  }
}

void mousePressed() {
  saveOneFrame = true; 
}

void drawStar(){
  star = createShape();
  star.beginShape();
  star.fill(102);
  star.stroke(255);
  star.strokeWeight(2);
  star.vertex(0, -50);
  star.vertex(14, -20);
  star.vertex(47, -15);
  star.vertex(23, 7);
  star.vertex(29, 40);
  star.vertex(0, 25);
  star.vertex(-29, 40);
  star.vertex(-23, 7);
  star.vertex(-47, -15);
  star.vertex(-14, -20);
  star.endShape(CLOSE);
}

PDF shows line, but not the star. Problem persists with alternative methods, like using createGraphics() to create a PDF, but goes away once we switch to the default renderer.
Line.pdf

@gncgnc gncgnc changed the title from PShapes not rendered in PDF with P2D renderer to PShapes do not show up in PDF with P2D renderer Sep 5, 2016

@benfry benfry added the opengl label Sep 6, 2016

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