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

Thread: bit wise operation giving link error

  1. #1
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117

    bit wise operation giving link error

    the following shader code

    Code :
      uint layerseed = gl_PrimitiveID * 32;
      gl_SampleMask[0] = int((layerseed) << 12);
    generates a link error

    Code :
      uint layerseed = gl_PrimitiveID * 32;
      gl_SampleMask[0] = (int(layerseed) << 12);
    does not.

    I checked for link errors with this code
    Code :
      glGetProgramiv( c_ProgramID, GL_LINK_STATUS, &amp;linked);
      if (!linked)
      {
        int l, l1;
        glGetProgramiv( c_ProgramID, GL_INFO_LOG_LENGTH, &amp;l);
        GLchar* compilerSpew = new GLchar[l+1];
        glGetShaderInfoLog(c_ProgramID, l, &amp;l1, compilerSpew);
      }

    the length of the error string is 86; but the error string is junk.

    Can anyone explain why the glsl code is wrong and how I get a sensible error message

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

    Re: bit wise operation giving link error

    You have use glGetShaderInfoLog.
    You should use glGetProgramInfoLog.
    ------------------------------
    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);

  3. #3
    Member Regular Contributor malexander's Avatar
    Join Date
    Aug 2009
    Location
    Ontario
    Posts
    315

    Re: bit wise operation giving link error

    It's likely not happy with the int / uint implicit conversion in the bit shift operation. The '12' is an int, not a uint. Try 12U instead, or just use your second code sample.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117

    Re: bit wise operation giving link error

    Thanks malexander the 12U solved my problem.

    Thanks V-man I didn't realise there was a glGetProgramInfoLog

Posting Permissions

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