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

Thread: Replacing gl_NormalMatrx...

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2007
    Posts
    16

    Replacing gl_NormalMatrx...

    I'm trying to write some simple vertex lighting in GL3 without using any deprecated functionality, but I'm a bit stuck.

    According to the spec, gl_NormalMatrix is the transpose of the inverse of the top-left 3x3 elements of the modelview matrix. Well, that's easy enough (I thought)...

    In the shader I grabbed the top-left 3x3 matrix, and then realized there is no inverse() function in GLSL. Can someone point me in the right direction to build a normal matrix from the modelview matrix?

    Thanks,

    Luke.

  2. #2
    Super Moderator Frequent Contributor Groovounet's Avatar
    Join Date
    Jul 2004
    Posts
    936

    Re: Replacing gl_NormalMatrx...

    You have to build this matrix on the C++ (or else) side... and send the matrix as an uniform variable.

Posting Permissions

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