I’m working on a project that’s using a PGraphics buffer to display to the screen.
Whenever I attempt to draw a shape, PGraphics.ellipse(5, 5, 25 ,25);
, or some other shape call, it won’t display at all.
I’ve tried to see if it’s just incorrectly being displayed in one of the XYZ dimensions, but it appears as if that is not the case.
PGraphics.background()
works just fine, but none of the shape calls.
Code: Slightly simplified
public void settings(){
size(1200, 800, PApplet.P3D);
}
PGraphics base;
public void setup(){
base = createGraphics(width, height, PApplet.P3D);
}
public void draw(){
background(255, 255, 255);
//Start drawing to the PGraphics object.
base.beginDraw();
//Background works fine, so I'm not sure what the issue is.
base.background(200, 200, 200);
//Draw calls made here:
base.pushMatrix();
//Translate to the user's mouse.
base.translate(mouseX, mouseY, 0);
//Draw a circle.
base.fill(140,0,140);
base.ellipse(0, 0, 25, 25);
//Pop back to normal and end the draw cycle.
base.popMatrix();
base.endDraw();
//Finally display to the screen.
image(base, 0, 0);
}
I’m using eclipse as the IDE instead of processing’s IDE. The class extends out PApplet, with a couple other custom methods for random things.
I’m not sure if this is a normal bug or something I’m just doing wrong (as I typically only use the generic CPU renderer instead).
I do get the performance boost from using the OpenGL renderers but I’m not sure why nothing is being drawn.