make lights blink
How do I make lights blink?
I have them drawn using a simple polygon.I want them to be orange/yellowish and when they come one to go very dark
Hi to all
This sounds very fascinating. Please post the code when you have it running.
Looking forward to it.
This sounds very fascinating. Please post the code when you have it running.
Looking forward to it.
You could possibly use a simple reducing counter..
Use red, green and blue values at 1.0f, 0.5f, 0.0f and have two values to indicate full and low intensity, have this as 1.0f and possibly 0.002f (for very dark)
in the InitGL set the variables (as an example).
int counter = 1000;
float high = 1.0f;
float low = 0.002f;
float intensity = 0.0f;
in the main draw function you can reduce the counter by one..
counter--;
if (counter < 20)
{
intensity = high;
glColorf(red * intensity, green * intensity, blue * intensity);
if (counter = 0)
{
// reset the counter when zero
counter = 1000;
}
}
else
{
intensity = low;
glColorf(red * intenisty, green * intensity, blue * intensity);
}
Use red, green and blue values at 1.0f, 0.5f, 0.0f and have two values to indicate full and low intensity, have this as 1.0f and possibly 0.002f (for very dark)
in the InitGL set the variables (as an example).
int counter = 1000;
float high = 1.0f;
float low = 0.002f;
float intensity = 0.0f;
in the main draw function you can reduce the counter by one..
counter--;
if (counter < 20)
{
intensity = high;
glColorf(red * intensity, green * intensity, blue * intensity);
if (counter = 0)
{
// reset the counter when zero
counter = 1000;
}
}
else
{
intensity = low;
glColorf(red * intenisty, green * intensity, blue * intensity);
}
Reduce/increase the counter every time the key is pressed...
[edited by - James Trotter on April 29, 2003 2:32:02 PM]
[edited by - James Trotter on April 29, 2003 2:32:02 PM]
I had the same problem and solved it turning on and off the lights at a given frequency...
It should not be too difficult...
Ther are 10 type of people:
those who knows binary code
and those who doesn''t
It should not be too difficult...
Ther are 10 type of people:
those who knows binary code
and those who doesn''t
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement