Results 1 to 4 of 4

Thread: How to use gluLookAt() to rotate around object created

  1. #1
    Newbie Newbie
    Join Date
    Mar 2015
    Posts
    2

    How to use gluLookAt() to rotate around object created

    I'm new to openGl, I am starting on 3d stuff, but can't get gluLookAt() to work, right now it works by just pressing a button, the "camera" moves , which is fine, I want it to rotate around the object..How would I go about doing this?
    Here's what I have so far. I have attached a text file as they won't let me paste the code as a new member..
    Attached Files Attached Files

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Posts
    4,660
    If you refer to the arguments (gluLookAt), you see that you specify three things:

    1) where the eye is
    2) what point it is looking towards
    3) and direction is generally toward "up" in your view

    In your case, you already know #2

  3. #3
    Newbie Newbie
    Join Date
    Mar 2015
    Posts
    2
    I'm not sure I get you. I know how to move the camera around a little bit, and that the 0,0,0 is where it will look at, the final 3 values are just the up and down on each axis. But I am confused as to how to get the camera to actual orbit my object.

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Posts
    4,660
    If you want it to orbit, the first thing you need to do is come up with some formula which gives you the world-space position of the camera at any given time (x,y,z) as a function of time (t). For instance, Parametric Equation of a Circle. Then it's just a matter of computing the time (e.g. based on system time) and computing the camera position each frame, plug it in, and you're done.

Similar Threads

  1. Rotate triangles and set the gluLookAt
    By alihuseyin in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 12-18-2015, 04:07 PM
  2. gluLookAt rotate view problems
    By ardnaxur in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 11-10-2012, 04:57 PM
  3. about gluLookAt function and how to rotate the camera
    By zydgyy in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 10-29-2012, 12:00 PM
  4. gluLookAt() function to rotate around drawn object
    By glSpider in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 04-02-2009, 10:55 AM
  5. What better(faster):gluLookat or glTranslate/Rotate?
    By in forum OpenGL: Basic Coding
    Replies: 36
    Last Post: 07-09-2003, 11:05 PM

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