View Full Version : Shader Light Array

05-14-2004, 11:01 PM
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

12-04-2005, 05:39 PM
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

Zulfiqar Malik
12-04-2005, 09:50 PM
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.

12-05-2005, 09:43 AM
Yes you can, but this is the same problem as mentioned here: