Results 1 to 3 of 3

Thread: How to loop though all OpenGL lights ?

  1. #1
    Senior Member Regular Contributor
    Join Date
    Mar 2002
    Location
    Pori, Finland
    Posts
    191

    How to loop though all OpenGL lights ?

    How can I loop through all the lights that I have defined ?

    I need something like this:
    for (light = 0, light <= max_light, light++)
    switch_on(light);

    The Problem is that OpenGL uses the enum const GL_LIGHT0, GL_LIGHT1 and so on. And I can not rely on that GL_LIGHT1 = GL_LIGHT0 + 1

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: How to loop though all OpenGL lights ?

    The specifications says thay GL_LIGHTn is identical to GL_LIGHT0 + n. So you can do like that to loop through all lights.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Mar 2002
    Location
    Pori, Finland
    Posts
    191

    Re: How to loop though all OpenGL lights ?

    Hey that's great. That will make it quite comfortable. Thank you for clarifying this.

Similar Threads

  1. understanding the opengl main loop / swapbuffers
    By drhexgl in forum OpenGL: Basic Coding
    Replies: 12
    Last Post: 03-10-2017, 06:32 AM
  2. opengl in loop help
    By asda333 in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 08-10-2013, 12:15 PM
  3. Speed of built in lights v.s. custom lights
    By STTrife in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-23-2013, 05:11 PM
  4. Optimizing the drawing loop, OpenGL ES 2.0 2D
    By Sawtan in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 11-17-2012, 01:37 PM
  5. Replies: 13
    Last Post: 11-29-2000, 02:19 PM

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