Solved

Spotlights in OpenGL

Posted on 2002-03-27
6
290 Views
Last Modified: 2013-12-26
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
0
Comment
Question by:Patterson
6 Comments
 
LVL 4

Expert Comment

by:joachimc
ID: 6912996
You should probably use some kind of additative effect for it.

/Joachim
0
 
LVL 3

Author Comment

by:Patterson
ID: 6913642
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

0
 
LVL 1

Expert Comment

by:effectstudios
ID: 6936440
I am not sure but maybe it has something to do with fog.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 19

Accepted Solution

by:
DreamMaster earned 200 total points
ID: 6936601
Maybe this is of use to you?

It discusses most of the different options you have with glLightf and glLightfv

http://www.listensoftware.com/lamp.html

Max.
0
 
LVL 3

Author Comment

by:Patterson
ID: 6937159
That's what I was looking for...

Thanks,

Patterson
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 6937416
Glad to have been helpfull Patterson...

Thanks for the Grade A.. :)

Max.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now