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 › setting colorMode does not stick
Page Index Toggle Pages: 1
setting colorMode does not stick (Read 2866 times)
setting colorMode does not stick
Feb 13th, 2008, 2:35am
 
Hi all,
I wrote this code for my students to demonstrate the HSB color mode, unfortunately the output is buggy. (It will occasionally take a few runs before the bug appears, so give it a few chances to fail!) If colorMode(HSB, 360)  is called in setup, sometimes it will not stick, and the sketch runs in the default colorspace.  It runs properly only if the colorMode is set inside draw().
[Mac OS X 10.5.2, 0153 Beta]
Code:

color frontColor, backColor;
int hueValue, compHueValue;

void setup() {
 size(500, 500);
 colorMode(HSB, 360);
 frameRate(15);
 
 hueValue = 0;
 compHueValue = hueValue + 180;
 smooth();
}

void draw() {
frontColor = color(hueValue, 359, 359);
backColor = color (compHueValue, 359, 359);
background(backColor);

fill(frontColor);
noStroke();
ellipse(width/2, height/2, 500, 500);

hueValue+=1;
if (hueValue == 360)
 hueValue = 0;

compHueValue = hueValue + 180;
if (compHueValue >= 360)
  compHueValue -= 360;    
}

Re: setting colorMode does not stick
Reply #1 - May 6th, 2008, 2:27pm
 
now posted as bug #767
http://dev.processing.org/bugs/show_bug.cgi?id=767
Page Index Toggle Pages: 1