Results 1 to 8 of 8

Thread: GLSL 1.5, inverse() and transpose() functions....

  1. #1
    Junior Member Newbie
    Join Date
    May 2012
    Posts
    23

    GLSL 1.5, inverse() and transpose() functions....

    Hi everybody.

    Does anybody know why when I use those functions on a 4x4 matrix the shader fails to compile (I use it in the vertex shader, if it matters anything...), stating that there is no overloaded version matching the arguments?

    Thanks,
    Heinrich

  2. #2
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,674

    Re: GLSL 1.5, inverse() and transpose() functions....

    First, what version of GLSL are you using? You should have a #version declaration at the top of your shader, and it probably needs to be at least 1.20 to access those functions if not later.

    Second, let's see your shader code to make sure you're using them correctly.

  3. #3
    Junior Member Newbie
    Join Date
    May 2012
    Posts
    23

    Re: GLSL 1.5, inverse() and transpose() functions....

    as I wrote.... GLSL 1.5...


    #version 150

    .
    .
    .

    uniform mat4 modelingMatrix;

    void main() {

    mat4 myMatrix = transpose(inverse(modelingMatrix));
    .
    .
    .
    }

    Thanks,
    Heinrich

  4. #4
    Senior Member Regular Contributor
    Join Date
    Jan 2012
    Location
    Germany
    Posts
    325

    Re: GLSL 1.5, inverse() and transpose() functions....

    If you want the normal matrix, do the inverse transpose of the upper 3*3 part of the modelmatrix and do it on the CPU side instead of once per vertex, doing it in the vertex shader can be quite slow - unbelievable slow on a GeForce 9600M on MacOSX btw...

    But: It should work, transpose and inverse are defined for 4x4 matrices and the shader should compile fine. What OS/driver are you using?

  5. #5
    Junior Member Newbie
    Join Date
    May 2012
    Posts
    23

    Re: GLSL 1.5, inverse() and transpose() functions....

    It is windows... I think the problem is in the machine - I'm using intels hd3000...
    Well. I already decided to do it on the CPU, and already got a bug:
    Took the upper left corner of the matrix resulting after inverting and transposing.
    I guess I should have made the inversion and transposition on the 3*3 corner... right?

    Heinrich

  6. #6
    Senior Member Regular Contributor Kopelrativ's Avatar
    Join Date
    Apr 2011
    Posts
    214

    Re: GLSL 1.5, inverse() and transpose() functions....

    If you don't have non-uniform scaling as part of your model view matrix, the upper 3x3 of the model-view matrix is just as good as the "normal matrix" (which is the transpose of the inverse of the model view matrix) for transforming normals.

    Copied from http://hacksoflife.blogspot.com/2009...transpose.html

  7. #7
    Junior Member Newbie
    Join Date
    May 2012
    Posts
    23

    Re: GLSL 1.5, inverse() and transpose() functions....

    Yes, I know it.
    The problem is: I have non-uniform scaling, but never really tested it, and so far I used the modeling matrix very well...
    Once I did test the non-uniform scaling: SURPRISE!!!

    Heinrich

  8. #8
    Senior Member Regular Contributor
    Join Date
    Jan 2012
    Location
    Germany
    Posts
    325

    Re: GLSL 1.5, inverse() and transpose() functions....

    Last time i checked Intel did not provide OpenGL 3.2 drivers for the HD 3000, so a shader with #version 150 should not compile. The chip should support 3.2 (and Apple supplies 3.2 drivers for the HD 3000) but Intels drivers are behind.
    What OpenGL version does your drivers clain to support?

Similar Threads

  1. New challenge!, inverse transpose matrix under GLSL 120... !!!
    By S-h-0-X in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 05-21-2012, 06:31 AM
  2. GLSL 1.5 mat4 inverse
    By welford in forum OpenGL: GLSL
    Replies: 2
    Last Post: 03-22-2010, 06:52 PM
  3. inverse and transpose of matrices in glSlang state
    By Chris Lux in forum OpenGL: GLSL
    Replies: 8
    Last Post: 03-31-2004, 12:15 PM
  4. inverse and transpose of matrices in glSlang state
    By Chris Lux in forum OpenGL: General
    Replies: 11
    Last Post: 03-17-2004, 11:06 AM
  5. GLSL & Inverse matrices
    By NitroGL in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 11-20-2003, 09:05 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
  •  
Proudly hosted by Digital Ocean