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

Thread: Had a problem access gl_LightSource on intel X3100

  1. #1
    Junior Member Regular Contributor
    Join Date
    Sep 2006
    Location
    thailand
    Posts
    130

    Had a problem access gl_LightSource on intel X3100

    Since intel finally release latest driver for X3100 that support OpenGL 2.0 and DirectX 10.1,so I try to run my simple GLSL application on it.

    the problem is I cant access gl_LightSource in shader.

    trying to call some thing like gl_LightSource[0].diffuse will cause program to render some garbage or some time just render black geometry.

    even GLSL demo I loaded from lighthouse 3d website (Toon shade ARB/Toon shade GL2) wont work (the teapot turn totally black).

    all the shader are compile & link successfully and sending/using
    custom uniform variable cause no problem.

    anybody who use x3100 chipset has the same problem ?

    Sorry for my bad english.

  2. #2
    Senior Member OpenGL Pro Ilian Dinev's Avatar
    Join Date
    Jan 2008
    Location
    Watford, UK
    Posts
    1,290

    Re: Had a problem access gl_LightSource on intel X3100

    Imho, nothing new from the Intel camp.
    I'd try to find what functionality exactly the x3100 _really_ supports. Probably you need to ignore all predefined uniforms, and set ones yourself. Find a tutorial/demo that works on x3100, and stick with the functionality subset used there.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Sep 2006
    Location
    thailand
    Posts
    130

    Re: Had a problem access gl_LightSource on intel X3100

    are the value in gl_LightSource[x].position using in shader the same as position I send via glLightfv() or it has been tranform ?

    since I may had to create uniform variable to store lighting variable myself.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Sep 2004
    Location
    Prombaatu
    Posts
    1,386

    Re: Had a problem access gl_LightSource on intel X3100

    Try sending your own light stuff to the shader. I think those light builtins are deprecated anyways...

  5. #5
    Junior Member Newbie
    Join Date
    Nov 2007
    Location
    Poland
    Posts
    17

    Re: Had a problem access gl_LightSource on intel X3100

    Quote Originally Posted by somboon
    are the value in gl_LightSource[x].position using in shader the same as position I send via glLightfv() or it has been tranform ?

    since I may had to create uniform variable to store lighting variable myself.
    hi, while sending light position as uniform Yourself, You have to make some thingz to have it working properly. It depends on the light source type.

    For directional light source it's simple cause position means direction also:

    Code :
    uniform vec3 position;
    ...
    vec3 L = normalize(position);

    For light sources that have position in space (like point light) You have to do like this:

    Code :
    vec4 V4 = gl_ModelViewMatrix * gl_Vertex;
     
    vec3 Vpos = V4.xyz / V4.w;
     
    L = position - Vpos;
    ...
    L = normalize(L);

    because You have to get vector from vertex to light for further computations .

  6. #6
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,264

    Re: Had a problem access gl_LightSource on intel X3100

    Quote Originally Posted by somboon
    are the value in gl_LightSource[x].position using in shader the same as position I send via glLightfv() or it has been tranform ?

    since I may had to create uniform variable to store lighting variable myself.
    They have been transformed by the modelview matrix at the time that you called glLightfv().
    I recommend that you call glLoadIdentity before glLightfv or better yet, just use your own uniforms.
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  7. #7
    Senior Member OpenGL Pro
    Join Date
    Sep 2004
    Location
    Prombaatu
    Posts
    1,386

    Re: Had a problem access gl_LightSource on intel X3100

    how about a combo? I use something like this to deal with both types:
    Code :
    vec3 lightDir = normalize(lightPos.xyz - fragWorldPos.xyz * lightPos.w);

Posting Permissions

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