3

I want to move my light source in my OpenGL-Scene, which is working. But to actually I want to see thee light source as well.

How can I do this?

...
glPushMatrix();
GLfloat lightPos[]      = {0, 0, 200, 1};
glLightfv(GL_LIGHT0, GL_POSITION, lightPos);

GLfloat ambientLight[]  = { 0.2,  0.2,   0.2,  1.0};
GLfloat lightColor[]    = { 0.5,  0.5,   0.5, 1.0};

glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientLight);

glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor);          
glLightfv(GL_LIGHT0, GL_SPECULAR, lightColor);           
glutSolidSphere(5,50,50);
glPopMatrix();
...
Shahbaz
  • 46,337
  • 19
  • 116
  • 182
buddy
  • 821
  • 2
  • 12
  • 30

1 Answers1

8

A light source is not a visible object, per se. If you want to "see" a light, you have to place some object at the position that your light is. Maybe use a sphere, a sprite, an arrow (pointing in the direction the light is pointing in, if it's a directional light), etc.

Jim Buck
  • 20,482
  • 11
  • 57
  • 74