Results 1 to 3 of 3

Thread: How to move the light position?

  1. #1
    Member Newbie
    Join Date
    Aug 2003
    Posts
    38

    How to move the light position?

    How to move the light position in runtime?
    I did the following:

    glLightfv(GL_LIGHT0, GL_POSITION,AmbientLightPosition);

    with the new value,but wheren't any effect.

    How to update only the changes connected to lighting ?

  2. #2
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,450

    Re: How to move the light position?

    Light position is manipulated by the current modelview matrix. The position stays fixed if you update light positions outside a modelview matrix hierarchy, it will move with objects of you do it inside.

    "Ambient" light has no direction and position.

    If you set the w coordinate of the light position to 0.0 you get a directional light, if you set it to 1.0 you get a positional light (pointlight, spotlight).

    And you have to redraw your whole scene, of course.

  3. #3
    Member Newbie
    Join Date
    Aug 2003
    Posts
    38

    Re: How to move the light position?

    Thanks a lot.It works now.

    I'm confused - in many examples I saw defining of "AmbientLightPosition".Seems that meaning of this is general light source position.

Similar Threads

  1. Light position
    By Lee_Jennifer_82 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 11-10-2015, 12:34 AM
  2. LIGHT position.
    By VasRoG in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-04-2005, 10:54 AM
  3. Light position
    By MaHoHo in forum OpenGL ES
    Replies: 0
    Last Post: 10-21-2004, 11:32 PM
  4. Light position
    By FenKz in forum OpenGL: GLSL
    Replies: 11
    Last Post: 09-05-2004, 06:48 PM
  5. no position light
    By tbjerman in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-03-2002, 02:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean