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

Thread: inverse MV matrix

  1. #1
    Junior Member Regular Contributor
    Join Date
    Oct 2000
    Location
    Montreal, Canada
    Posts
    106

    inverse MV matrix

    I'm trying to use the inverse of the modelview matrix, but it doesn't seem to exist as it did on the vertex program extension.

    Am I right? If so, I don't see a built-in function to invert a matrix neither. Do I have to build my own?

  2. #2
    Super Moderator Regular Contributor
    Join Date
    Jul 2001
    Posts
    401

    Re: inverse MV matrix

    I think so. Our solution was to add it within the scene graph as a uniform to the shader. That way you can get it just as a built in in the shader program. Hopefully this will be revised in later implementations of GLSL.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Oct 2000
    Location
    Montreal, Canada
    Posts
    106

    Re: inverse MV matrix

    That's what I thought. It's dissapointing the GLSL doesn't have built-in that are in the vertex program extension, but such is live.

    Thanks for the answer.

  4. #4
    Advanced Member Frequent Contributor yooyo's Avatar
    Join Date
    Apr 2003
    Location
    Belgrade, Serbia
    Posts
    872

    Re: inverse MV matrix

    Try to use gl_NormalMatrix. This should be gl_ModelViewInverseTranspose.

    yooyo

  5. #5
    Junior Member Regular Contributor
    Join Date
    Oct 2000
    Location
    Montreal, Canada
    Posts
    106

    Re: inverse MV matrix

    Originally posted by yooyo:
    Try to use gl_NormalMatrix. This should be gl_ModelViewInverseTranspose.
    I'm not sure I understand your answer. gl_ModelViewInverseTranspose doesn't exist in GLSL. Are you saying gl_NormalMatrix is the same thing than what shoulf be in the transpose of the inverse of the modelview matrix?

  6. #6
    Member Regular Contributor
    Join Date
    Apr 2002
    Location
    Austria
    Posts
    328

    Re: inverse MV matrix

    gl_NormalMatrix is the upper 3x3 part of the inverse transpose Model View Matrix. This matrix is used for Normal transformation (as the name tells).
    There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.

    There is another theory which states that this has already happened...

Posting Permissions

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