color fading

Started by
1 comment, last by branhield 21 years, 11 months ago
im trying to get my background fading from 0.0f to 1.0f. but when i try to execute this, it will only fade in to 1.0f, and for some reason it wont fade out. It stays at 1.0f. why is that? bool increase = true; ... if(increase) { bgBlue += 0.1f; } else { bgBlue -= 0.1f; } if(bgBlue < 1.0f) { increase = true; } if(bgBlue >= 1.0f) { increase = false; } glClearColor(0.0f, 0.0f, bgBlue, 0.0f);
Advertisement

  bool increase=true;...if(increase){bgBlue += 0.1f;}else{bgBlue -= 0.1f;}//Changed this line!!!if(bgBlue <= 0.0f){increase = true;}if(bgBlue >= 1.0f){increase = false;}  


The way you had it, any-time the background was less than 1.0 it would increase (so, it would decrease for only ONE frame (0.1f), then it would be < 1.0f and increase again. Hope this helps.

Billy - BillyB@mrsnj.com
(Hey, I''''m no longer anonymous!)
yeah it works. thanks alot man

This topic is closed to new replies.

Advertisement