color fading
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);
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!)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement