title: Loading of uniform structures to the fragment glsl shader
body: <p>There is the fragment shader with structures inside. Here is a part of the code:</p>
  
  <pre><code>#version 330          
  
  const int MAX_POINT_LIGHTS = 3;
  
  in vec2 texCoord0;
  in vec3 normal0;
  in vec3 worldPos0;
  
  out vec4 fragColor;
  
  struct BaseLight
  {
    vec3  color;
    float ambientIntensity;
    float diffuseIntensity;
  };
  
  struct DirectionalLight
  {
    BaseLight base;
    vec3 direction;
  };
  
  struct Attenuation
  {
    float constant;
    float linear;
    float expVar;
  };
  
  struct PointLight
  {
    BaseLight     base;
    vec3          position;
    Attenuation   atten;
  };
  
  uniform int                 gNumPointLights;
  uniform PointLight          gPointLights [ MAX_POINT_LIGHTS ];
  uniform DirectionalLight    gDirectionalLight;
  //...
  </code></pre>
  
  <p>In my application i need to transfer some data to the uniform paramets of shader. Compilation of shader was succeessful, pipeline is correct. Before tranferring data we need uniform positions. Here is what i did:</p>
  
  <pre><code>  //...
    m_WVPLocation         = GetUniformLocation ( "gWVP" );
    m_WorldMatrixLocation = GetUniformLocation ( "gWorld" );
    m_samplerLocation     = GetUniformLocation ( "gSampler" );
  
  
    m_dirLightLocation.color            =   GetUniformLocation ( "gDirectionalLight.base.color" );
    m_dirLightLocation.ambientIntensity =   GetUniformLocation ( "gDirectionalLight.base.ambientIntensity" );
    m_dirLightLocation.diffuseIntensity =   GetUniformLocation ( "gDirectionalLight.base.diffuseIntensity" );
    m_dirLightLocation.direction        =   GetUniformLocation ( "gDirectionalLight.direction" );
  
    m_eyeWorldPosLocation           = GetUniformLocation ( "gEyeWorldPos" );
    m_matSpecularIntensityLocation  = GetUniformLocation ( "gMatSpecularIntensity" );
    m_matSpecularPowerLocation      = GetUniformLocation ( "gSpecularPower" );
    //...
  </code></pre>
  
  <p>Because of nesting of the structures i cannot get positions of the fields with nesting level 2 or more, except the first field. For example, for <code>gDirectionalLight</code> i got position of this fields:</p>
  
  <ul>
  <li><code>gDirectionalLight.base.color</code></li>
  <li><code>gDirectionalLight.direction</code></li>
  </ul>
  
  <p>And didn't get for this:</p>
  
  <ul>
  <li><code>gDirectionalLight.base.ambientIntensity</code> </li>
  <li><code>gDirectionalLight.base.diffuseIntensity</code></li>
  </ul>
  
  <p>I cannot believe that the only solution is repetition of code in the shader. Clarification: cannot get positions of only <code>ase.ambientIntensity</code> and <code>base.diffuseIntensity</code> fields in any structure. In the GLSL 3.0 nesting of structures are supported for non-anonymous structures due to the specifications. OpenGL version is 3.x</p>