Not sure if I’m missing something … I’m having trouble getting shapes (approx. 100 shapes, generated by a for loop in setup(), using the method .addChild() to create a group that is visible OK in draw()) to accept any styling when contained within PGraphics beginDraw() ~ endDraw().
If I draw a primitive within the PGraphics say, beginDraw(), pg.rect(), endDraww() then I can alter styling with pg.fill() and pg.noStroke() etc. etc… … but my shape group remains stuck on default styling no matter what I do (black stroke, white fill).
Are there any caveats when using shape groups in PGraphics? Happy to paste some of my code here.
@glv – thanks for the reply. Your example demo got me in the right direction.
I had declared disableStyle() elsewhere during setup() which for some reason was not passing into the draw() PGraphics beginDraw() ~ endDraw() part of my code.
So thanks to you, I got the result I wanted via this:
void draw() {
int liveKey = int(key);
if (keyPressed && liveKey >= 97 && liveKey <= 122) { // lowercase QWERTY: 97 = key a, 122 = key z
liveKey = liveKey - 97;
shape = shapeGroup[liveKey];
shape.disableStyle(); // disableStyle only works for me when declared before beginDraw() ?
pg.beginDraw();
pg.colorMode(RGB, 1.0);
pg.background(0, 0, 0, 1);
pg.fill(1, 1, 1, 1);
pg.stroke(1, 1, 1, 1);
pg.shape(shape);
pg.endDraw();
blendMode(MULTIPLY);
image(pg, 0, 0);
}
// etc. etc.
}
And with this, my shapes are now rendered how I actually want.
Without declaring disableStyle() as above, the shapes would always revert to default styling no matter what code I wrote after beginDraw()