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: Viewing Matrix

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2004
    Posts
    9

    Viewing Matrix

    I'm having a bit of a problem with creating a viewing matrix and i reckon I've done it so terribly wrong. I create my U V and N as follows:

    Code :
            N->x=(position->x-direction->x);
    	N->y=(position->x-direction->y);
    	N->z=(position->z-direction->z);
     
    	U=CrossProd_Vector3(upVector, N);
    	V=CrossProd_Vector3(N, U);
     
    	CU=DotProd_Vector3(position, U);
    	CV=DotProd_Vector3(position, V);
    	CN=DotProd_Vector3(position, N);
    all my functions for the dot products and cross products are working. If i set the position to (0, 0, 0) it does actually work but anything else it all just disapears. upvector is (0, 1, 0) and direction is (0, 0, -1).

    If anyone could help i would be most grateful.

    Cheers,

  2. #2
    Junior Member Newbie
    Join Date
    Apr 2004
    Posts
    11

    Re: Viewing Matrix

    to begin, N should be direction - position, not the other way around. Remember, always final minus initial.
    capn_midnight | Captain Midnight | deviantArt
    ACM | SIGGRAPH | Generation5

Posting Permissions

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