make lights blink

Started by
5 comments, last by crossbrigade2000 20 years, 11 months ago
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
Advertisement
Hi to all
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);
}




Hi
I want to know how to do in direct3D or openGL

I already face this question
Yee
I want to be able to change this using a keystroke.
Reduce/increase the counter every time the key is pressed...

[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
---------------------------------------There are 10 type of people:those who knows binary codeand those who doesn't---------------------------------------

This topic is closed to new replies.

Advertisement