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 3 of 3

Thread: OpenGL's Lights

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2004
    Location
    Australia
    Posts
    1

    OpenGL's Lights

    I've been told that OpenGL's 8 built in hardware lights are only limited to having 8 lights per face, and that it is quite acceptable to calculate 8 lights for one face, and then move onto the next face and use the same 8 lights to calculate the lighting for the next face. If this is so, would someone be able to post some psuedo code for doing this? If it is not, I'm wondering, how, after calculating all the light values for my vertices, I actually apply this to the vertices in my scene.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,651

    Re: OpenGL's Lights

    First of all, it is not true that you are limited to 8 lights, the OpenGL spec requires any OpenGL implementation to support a minimu of 8 lights but it may support more, in reality most of todays OpenGL hardware does only support 8 lights I think.

    This means that the OpenGL pipeline can handle at most 8 lights at any one single time and that's it.

    There are ways to use more lights if the need it but my first question has to be, do you need more then 8 lights ? it will have some pretty nasty impact on the performance of your application.

    Mikael

  3. #3
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: OpenGL's Lights

    If you really want to calculate yourself the light values, you can specify it as glColor3f before each glVertex.

    But unless you have a very simplified and optimized light model, use the gl lights, they are accelerated by T&L cards.

Posting Permissions

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