We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexSuggestions & BugsSoftware Bugs › Rect with translate() and background(), bug
Page Index Toggle Pages: 1
Rect with translate() and background(), bug? (Read 2219 times)
Rect with translate() and background(), bug?
May 7th, 2006, 3:59pm
 
The following code make a white rect at the right-bottom corner.
(108 +OSX 10.4.3)
Is this a P5's bug???

void setup(){
 size(300,300)
}
void draw(){  
translate(width/2,height/2.);  
background(255);
}

All white bg when  background -> translate .
Re: Rect with translate() and background(), bug?
Reply #1 - May 7th, 2006, 4:34pm
 
"no, this is not a bug." --> actually it is .. see below.

background() is used to fill the whole (!) background with the given color.

i guess what you are trying to do is:
Code:

void setup(){
 size(300,300)
}
void draw(){
 background(255);
 translate(width/2,height/2.);
 fill( 125 );                  // set fill-color to medium gray
 rect( 0, 0, 20, 20 );    // draw a rect
}


see reference:
background()
rect()
fill()

best,
F

Re: Rect with translate() and background(), bug?
Reply #2 - May 8th, 2006, 5:02pm
 
Thank you fjen.
It might not have been transmitted well to want to say. (English is not my native)
The following script correctly paints out the entire window though the above-mentioned script paints out only the lower right of the window in white.
void setup(){
 size(300,300)
}
void draw(){  
background(255);
translate(width/2,height/2.);  
}
Another problem was found. In Windows version (108), the straight line drawn y axially after the rotate(HALF_PI) is distorted.
Re: Rect with translate() and background(), bug?
Reply #3 - May 10th, 2006, 11:04am
 
hi,

first i recomend that you download the latest version .. i don't think you problems are related to 108, but it's good to work with current version (114) so you don't run into anything that's already been fixed.

i agree that the below is confusing ... since background should always clear (fill) the entire window. so you should file a bug-report for that. (login with your forum-email and forum-password)
Code:
translate( width/2 , height/2 );
background( 255 );


i'm not sure i get the problem with rotate. i can't see any distortion here:
Code:
translate( width/2 , height/2 );
rotate( HALF_PI );
line( 0,0, 0,height );


best,
F
Re: Rect with translate() and background(), bug?
Reply #4 - May 10th, 2006, 2:47pm
 
Thank you fjen.
I'll try to bug-report.


About another problem, pls try the following code.
Good line on OSX(PPC), but nogood on WinXP.

translate( width/2, 0);
rotate( HALF_PI );
line( 0,0,width,0 );
Re: Rect with translate() and background(), bug?
Reply #5 - May 11th, 2006, 11:50am
 
i've just fixed the translate problem, though generally you should always put background() at the beginning of draw().

the rotate problem is in the bugs db somewhere (i can't seem to find it) and it's a problem with the java vm (as you can see since it's ok on the mac and not on pc). in other situations it works better/worse in other places.
Re: Rect with translate() and background(), bug?
Reply #6 - May 11th, 2006, 6:00pm
 
Thank you fry.  I understand.


By the way, I try 115 now and find the bug has been fixed.
That is I have reported.
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1143991823

Is there any announce?
Re: Rect with translate() and background(), bug?
Reply #7 - May 14th, 2006, 2:04pm
 
just marked the bug as fixed, must have missed it.
Page Index Toggle Pages: 1