Results 1 to 4 of 4

Thread: problem binding matrix from shader

  1. #1

    problem binding matrix from shader

    System: Vista/WindowsXP | Ati HD4800 driver version 09.12
    Compiler/IDE: Delphi2009
    Libraries: OpenGL 3.x / GLSL

    On making a bones example it struggled upon the fact that my normalMatrix is not willing to be bound anymore.

    This is a part of the shader:
    #version 150
    uniform mat3 normalMatrix;
    uniform mat4 boneMatrices[2];
    uniform mat4 projectionMatrix;
    uniform mat4 modelViewMatrix;
    This is how i call it:
    g_projectionLocation := glslsimpleprog.GetUniformLocation('projectionMatrix');
    g_modelViewLocation := glslsimpleprog.GetUniformLocation('modelViewMatrix');
    g_normalMatrixLocation := glslsimpleprog.GetUniformLocation('normalMatrix');
    g_location_boneMatrices_0  := glslsimpleprog.GetUniformLocation('boneMatrices[0]');
    g_location_boneMatrices_1  := glslsimpleprog.GetUniformLocation('boneMatrices[1]');
    All other matrices do work and so has the normalMatrix

    Here is the complete code:

    What am i missing here? - create adventure games without programming

  2. #2

    Re: problem binding matrix from shader

    On the delphigl forum is pointed to the fact that when a uniform is not used in an shader it is not availeable. Next to that somewhere during the day something on my pc became corrupted as source that did not work yesterday now works :-)

    Here is the bugfixed version: and for those who are interested the original: - create adventure games without programming

  3. #3
    PGD Staff / News Reporter phibermon's Avatar
    Join Date
    Sep 2009

    Re: problem binding matrix from shader

    that's quite a slow method, much better to upload all per vertex data into a VBO, one array after another, bind the VBO and then use glVertexAttribPointer with an offset into the VBO for each attribute (message me for an example).

    Then you only have to pass the bone matricies or positons and Quaternions in as uniforms. Bone ID's, weights, normals, vertices etc etc can all live in the VBO.
    When the moon hits your eye like a big pizza pie - that's an extinction level impact event.

  4. #4

    Re: problem binding matrix from shader

    It is an example helping me to understand what is going on. Moving slowly away from doing such things on the cpu.

    Do provide an example how to do things efficiently. So me and other can learn from that. - create adventure games without programming


Posting Permissions

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