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

Thread: uniform struct array

Threaded View

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    11

    uniform struct array

    Hi, all.

    I try to write a structure and declare an array as follow :

    Code :
    struct ShadowMapping
    {
    	mat4            light_coordinate_system;
    	sampler2DShadow shadow_map;
    	int             shadow_map_width;
    	int             shadow_map_height;
    };
     
    ...
     
    //shadow mapping info
    uniform ShadowMapping shadow_mapping_list[8]; //declaration
    uniform int           shadow_mapping_number;

    Then I use the array in my shading program(fragment shader).

    If the condition in for loop is large than 1, I won't get all location of variables in my shader.

    So how can I use the uniform struct array in my shader?

    P.S. I post my code occurring the problem.

    Code :
     
            int i;
            for( i = 0 ; i < shadow_mapping_number ; i++)//if I modify the shadow_mapping_number to a constant 1, it's working. Otherwise, it's failure.
    	{
    		//use the uniform struct array by the form : shadow_mapping_list[i].light_coordinate_system, and etc... .
    	}

    And my version of glsl is #version 120
    Graphics card is Nvidia GTX 460

    By the way, the complied result is on error occurred in any shader.

    Thanks.
    Last edited by LaLaChen; 04-26-2013 at 10:07 AM.

Posting Permissions

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