|
Author |
Topic: [newbie] why does noBackground = noFill (Read 547 times) |
|
solipsys
|
[newbie] why does noBackground = noFill
« on: May 29th, 2003, 3:49am » |
|
Hi, I just started using P5 tonight and I'm having a lot of fun so far. The first problem I've run into though is getting noBackground to work with filled shapes. With background ON filled shapes work fine... with noBackground, only strokes. Example: float s = 0.0; int c = 0; float rect_size; void setup() { size (400, 300); rect_size = (width/4); noBackground(); clearit(); } void clearit() { fill(100); noStroke(); rect(0, 0, width, height); } void loop() { if(c == 0) {clearit();} c += 1; if (c > 314) {c = 0;} s += 0.01; if(s >= PI) {s = 0.0;} translate(width/2, height/2); rotateY(s); // why doesn't fill work? fill(255); stroke(10); rect(-rect_size, -rect_size, rect_size*2, rect_size*2); } I know it's something silly, but I can't get it? I'm using 0055 in case that helps. Thanks! Ethan
|
« Last Edit: May 29th, 2003, 3:50am by solipsys » |
|
|
|
|
arielm
|
Re: [newbie] why does noBackground = noFill
« Reply #1 on: May 29th, 2003, 11:13am » |
|
i don't know if it's a bug in processing or a deliberate issue, but it seems that noBackground() is best suited for works that deals with pixels[] rather than say, drawing 3d polygons... anyway, there is this dirty workaround that could fix your problem: Code: void clearZBuffer() { int pc = g.pixelCount; float[] zb = g.zbuffer; for (int i = 0; i < pc; i++) { zb[i] = 3.402823E+038F; } } |
| just put this method at the very beginning of loop() hope it helped...
|
Ariel Malka | www.chronotext.org
|
|
|
REAS
|
Re: [newbie] why does noBackground = noFill
« Reply #2 on: May 29th, 2003, 1:42pm » |
|
it seems to be a bug caused by rotateY(). if you change it to rotate() it draws fine. it would be helpful if you could post this in the bugs section.
|
|
|
|
|