Link to home
Start Free TrialLog in
Avatar of Patterson
Patterson

asked on

Spotlights in OpenGL

I am trying to make a streetlight in a program I am working on and I have all the code to make the light, point it in the right direction and everything works fine. What I want is to be able to see the light...or in other words make the actual light semi-transparent. I have done this before but I can't remember the parameters I used to do it...

Thanks,

Patterson
Avatar of joachimc
joachimc

You should probably use some kind of additative effect for it.

/Joachim
Avatar of Patterson

ASKER

float ambience[4] = {0, .1, .1, 1.0};
float g_LightPosition[4] = {164, 5, 10, 1};

glLightfv( GL_LIGHT0, GL_AMBIENT,  ambience );
glLightfv( GL_LIGHT0, GL_POSITION, g_LightPosition );

float light1_diffuse[4] = {1, 1, 1, 1};
float light1_pos[4] = {380, -75, 30, 1};
float light1_direction[4] = {(float)-380/388.5, (float)75/388.5, (float)-30/388.5};

glLightfv( GL_LIGHT1, GL_POSITION, light1_pos );
glLightfv( GL_LIGHT1, GL_SPOT_DIRECTION, light1_direction);
glLightf( GL_LIGHT1, GL_SPOT_CUTOFF, 45);
glLightf( GL_LIGHT1, GL_CONSTANT_ATTENUATION, .2);
glLightfv( GL_LIGHT1, GL_DIFFUSE, light1_diffuse);

glLightf(GL_LIGHT1, ...);

From what I remember it was just a one line function call from glLightf.

Thanks,

Patterson

I am not sure but maybe it has something to do with fog.
ASKER CERTIFIED SOLUTION
Avatar of DreamMaster
DreamMaster

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That's what I was looking for...

Thanks,

Patterson
Glad to have been helpfull Patterson...

Thanks for the Grade A.. :)

Max.