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

Thread: Shader Light Array

  1. #1
    Junior Member Newbie
    Join Date
    May 2004
    Posts
    9

    Shader Light Array

    Hi all!

    I have a strange problem with my shader code written in OGSL. I have written a "fixed function lightning" vertex shader which works with one light perfect! But if i try to access all lights via the [] operator (like gl_LightSource[i]), i have a compiler error: "array must be redeclared with a size before being indexed with a variable". I thought the gl_LightSource global variable was defined with "uniform gl_LightSourceParameters gl_LightSource[gl_MaxLights];", and gl_MaxLights gives the array size! What have i do wrong? I'm using a Radeaon 9800.

    Greetings Mario

  2. #2
    Junior Member Newbie
    Join Date
    Mar 2004
    Location
    parksville, BC, Canada
    Posts
    4

    Re: Shader Light Array

    Did you ever get this to work. I am currently still having exactly the same problem with Radeon 9800 and Catalyst 5.11 divers

    // Mike

  3. #3
    Junior Member Regular Contributor Zulfiqar Malik's Avatar
    Join Date
    Jun 2004
    Location
    London, UK
    Posts
    248

    Re: Shader Light Array

    If you are using pre-SM3.0 hardware, then you can't use an application defined value as an index to any array (be it gl_LightSource or some other). You must give in constants.
    Zulfiqar Inayat Malik.
    Senior Developer, The Foundry.

  4. #4
    Intern Newbie
    Join Date
    Oct 2004
    Posts
    33

    Re: Shader Light Array

    Yes you can, but this is the same problem as mentioned here:
    http://www.opengl.org/discussion_boa...;f=11;t=000920

Posting Permissions

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