How to create a cone of light

Good morning (here it’s 10 A.M.)!
I don’t know if this question has been already asked. If so, sorry in advance.
I need to create a cone of light that goes from a little lamp on the floor to the ceiling,inside a room. I’ve put a positional red light just on the lamp towards the point of the ceiling i want to reach, but i can only see the brightness on the wall and ceiling. Instead i’d like to see the cone of light that starts from the lamp and stops to the ceiling. I’ve tried with different exponent of the spotlight with no result. Even done with fog, but i still don’t see the cone.
Any ideas? :rolleyes:
Thanx

what you have so far is a point light - what you want is a spot light. to transform your point light into a a spot light, you have to add three lines of code:

glLightfv( GL_LIGHT0, GL_SPOT_DIRECTION, Direction );
glLightf( GL_LIGHT0, GL_SPOT_EXPONENT, Exponent );
glLightf( GL_LIGHT0, GL_SPOT_CUTOFF, Cutoff );

Direction has to be a float array of size 3, the other two variables have to be floats.

In OpenGL, lights are only used to compute the color of vertices. They aren’t visible themselves.

The same goes for fog. It only affects the color of vertices (and thereby polygons). You never see fog unless there is some geometry that is affected.

If you want to have a visible light cone, you need to model one, using an appropriate blend mode. You might try a gray cone with glBlendFunc(GL_ONE, GL_ONE). And make sure you render the cone last.

Thanx, i’ll try as soon as possible :slight_smile: