Results 1 to 2 of 2

Thread: gluLookAt question

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2004
    Location
    San Francisco
    Posts
    16

    gluLookAt question

    Hi everyone,

    In my application I'm provided with three axes in world coordinates. They are called vup, vpn and vright, and correspond to the y, z and x axes I'd like to use when applying transformations to my verticies. I also have a point which will serve as the origin for this new coordinate system. It's called "origin".

    I'm going crazy trying to use these things when establishing up my modelview transform. I want to apply all transformations based on this new origin and x, y and z axes, but I can't get it working right. I've tried gluLookAt() in this fashion:

    gluLookAt(origin.x, origin.y, origin.z, vpn.x, vpn.y, vpn.z, vup.x, vup.y, vup.z)

    ....and it doesn't work right. After setting the modelview this way and drawing primitives things look kooky. I've done things like subtracted the origin from my vpn and used that in the second portion of gluLookAt() and it was no better.

    Does anyone see something obviously wrong with what I'm doing? I know for a fact the three axes I'm using are mutually perpendicular; I can draw them with GL_LINEs using the default identity modelview matrix, at my origin point, and they look great.

    Is there a way I can directly set the modelview matrix to use those axes and origin, instead of going through gluLookAt()? Thanks very much.

  2. #2
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010
    Posts
    2,466

    Re: gluLookAt question

    try
    gluLookAt(origin.x, origin.y, origin.z, origin.x+vpn.x, origin.y+vpn.y, origin.z+vpn.z, vup.x, vup.y, vup.z)

Similar Threads

  1. question about gluLookAt command
    By chen in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 03-27-2006, 02:00 AM
  2. gluLookAt Question
    By dvm in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-13-2003, 07:47 AM
  3. Question about gluLookAt()
    By in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 10-25-2002, 07:16 PM
  4. Quick gluLookAt() question
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-27-2001, 01:45 PM
  5. question about gluLookAt...
    By imported_tornado in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-27-2000, 05:23 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