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

Thread: Getting Eye direction vector

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2012
    Posts
    28

    Getting Eye direction vector

    Hello, I'm trying to draw some water in modern OpenGL (greather than 3.x).
    I've got model matrix, view matrix and projection matrix uniforms and my positions' attribute. The problem is: how can I get the eye direction vector?
    Thanks in advance.

  2. #2
    Member Regular Contributor
    Join Date
    Jun 2013
    Posts
    491
    Quote Originally Posted by rodrigoloc View Post
    how can I get the eye direction vector?
    The eye position is 0,0,0 in eye space, which is what the model-view matrix transforms to. So after you've transformed the vertex position by the model-view matrix, the eye direction is simply the negation of the transformed vertex position (ignoring the w coordinate, which should be 1; the model-view matrix shouldn't contain any projective transformations).

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2012
    Posts
    28
    Thanks. The error was that I've negated the entire output vertex including w coord.

Posting Permissions

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