PShape in retained mode: Can I change the diplay Style?
in
Programming Questions
•
10 months ago
Hi,
is it possible to change the style settings for a PShape in retained mode? The way I figured out mixes colors instead overwriting the previous one. Obviously, a style switch from frame to frame works perfect in immediate mode, whereas I would like to work with rigid shapes. The meshes stay the same all the time but in the case of e.g. collision events I would like to change their style.
Something like so:
PShape retShape;
void setup() {
size(400, 400, P3D);
fill(230);
noStroke();
retShape = createShape(RECT, 100, 100, 100, 100);
retShape.disableStyle();
}
void draw() {
background(250);
if (mousePressed) {
fill(200, 0, 0);
}
else {
fill(230);
}
PShape immShape = createShape(RECT, 200, 200, 100, 100);
shape(retShape);
shape(immShape);
}
void setup() {
size(400, 400, P3D);
fill(230);
noStroke();
retShape = createShape(RECT, 100, 100, 100, 100);
retShape.disableStyle();
}
void draw() {
background(250);
if (mousePressed) {
fill(200, 0, 0);
}
else {
fill(230);
}
PShape immShape = createShape(RECT, 200, 200, 100, 100);
shape(retShape);
shape(immShape);
}
thanks . Daniel
1