PDA

View Full Version : Direction of the light



KeSh
04-21-2004, 04:28 PM
Hi folks...i was just wonderingif we could specify a direction for the light. You know a table lamp is diferent from a flashlight, and it could be useful to spot and change the divergence of the light beam. How can i specify this?

chowe6685
04-21-2004, 06:03 PM
look at the paramaters for glLight on this page
http://www.mevis.de/~uwe/opengl/glLight.html

Dr. Coaster
04-24-2004, 11:22 AM
:D This is easy :D
A directional light has a "W" value of 0 (0.0f), a positional has anything <u>BUT</u> 0. Like this:

GLfloat direction_Light[]={0.0,1.0,0.0,0.0};

glLightf(GL_LIGHT0,GL_POSITION,direction_Light);

This creates a light pointing in the vector (0.0,1.0,0.0). I hope that works!

Dr. Coaster
04-24-2004, 11:23 AM
:eek:
I thought [U] was enabled! :p
Oh Well!

Dr. Coaster
04-24-2004, 11:45 AM
Change to that function, it's actually

glLightfv

KeSh
04-25-2004, 02:19 AM
Actually, i think that what i needed was the GL_SPOT_CUTOFF and GL_SPOT_DIRECTION.. then i can simulate a table lamp :p thanks folks