Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Spotlights in OpenGL

Posted on 2002-03-27
6
294 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

856 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