Results 1 to 5 of 5

Thread: Moving 3D objects

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2001
    Location
    Blagoevgrad,Bulgaria
    Posts
    18

    Moving 3D objects

    How can I move 3D objects?
    Which is the GLUT function?

  2. #2
    Guest

    Re: Moving 3D objects

    use glTranslatef(....) and glRotate(...) to move your
    objects

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2001
    Location
    Blagoevgrad,Bulgaria
    Posts
    18

    Re: Moving 3D objects

    But how can I move this quad for example one unit right.

    glBegin(GL_QUADS);
    glVertex3f(-1.0f, 1.0f, 0.0f);
    glVertex3f( 1.0f, 1.0f, 0.0f);
    glVertex3f( 1.0f,-1.0f, 0.0f);
    glVertex3f(-1.0f,-1.0f, 0.0f);
    glEnd();

  4. #4
    Member Contributor
    Join Date
    Jul 2001
    Location
    South Africa
    Posts
    52

    Re: Moving 3D objects

    Ok do you know what a cartesian plain is?
    Consider youre 3D space a cartesian plane.
    Ok now it depends whether you want to move the object or the entire scene. I'm gonna take it you want to move the object as you stated. After you pushed the matrix state, have glTranslatef(varX,y,z);
    Ok every time the loop executes you can increment varX with a value, to get the object to move either left or right, considering that you did not change youre plain. I suggest, increment it with about 0.1f. Do you understand? To rotate it, you just change the angle at which it rotates, in other words you will have youre variable like so. glRotatef(varAngle, 0.0f,1.0f,0.0f);
    Hope it helps

  5. #5
    Member Contributor
    Join Date
    Jul 2001
    Location
    South Africa
    Posts
    52

    Re: Moving 3D objects

    Oh crap yeah, almost forgot. Glut doesn't have a specific function to translate or rotate, seeing that it's so simple already.

Similar Threads

  1. moving 3D objects
    By shoman007 in forum OpenGL: macOS
    Replies: 0
    Last Post: 12-18-2018, 03:12 AM
  2. Moving Objects
    By CoolBeanJ in forum OpenGL: Basic Coding
    Replies: 17
    Last Post: 04-26-2011, 07:00 AM
  3. Moving two objects together
    By Sklar in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-31-2004, 11:26 AM
  4. Moving 3D objects
    By Itskata in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-09-2001, 03:25 AM
  5. Moving objects in 3D
    By wrapper in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 11-24-2000, 11:47 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