Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: The order of adding lights and vertices to a scene

  1. #1
    Newbie Newbie
    Join Date
    Jul 2013
    Posts
    1

    The order of adding lights and vertices to a scene

    Hi,
    I've been reading the Redbook's chapter about lighting,
    and although I have found some clues, I didn't manage
    to get a definite answer to the following question:

    at which stage are the lights calculated?
    is it (1) during the call to glFinish(), after all lights
    were specified and all vertices issued, or
    (2) does it happen immediately, that whenever
    new vertices are added, they get lit by the
    lights that were already set up before that moment,
    or (3) perchance it is implementation-specific?

    Thanks in advance,
    Maciek Godek

  2. #2
    Member Regular Contributor
    Join Date
    Jun 2013
    Posts
    490
    Quote Originally Posted by panicz View Post
    at which stage are the lights calculated?
    If lighting is enabled (glEnable(GL_LIGHTING)), then each vertex is assigned a colour based upon the vertex position and normal, the material, and the lights. The calculation is performed as each vertex is processed (i.e. glVertex() for immediate mode).

    Note that lighting state cannot be modified within a glBegin/glEnd pair, although material state can.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •