Results 1 to 4 of 4

Thread: Translating different objects at different speeds

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2009
    Posts
    2

    Translating different objects at different speeds

    I want to translate three circles at three different velocities but at the same time. How do i do that? If i use the glTranslatef() funciton, it translates all the objects/circles i have dreawn.
    I'm absolutely new to the openGL. Im using C.
    Thank you.

  2. #2
    Member Newbie
    Join Date
    Jan 2009
    Posts
    47

    Re: Translating different objects at different speeds

    You can use glPushMatrix() then translate the first object and draw it then end it with glPopMatrix().

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2009
    Posts
    2

    Re: Translating different objects at different speeds

    Could you pls give more details with a bit of codes?
    Suppose drawCircle1() draws the 1st circle and drawCircle2() draws the 2nd circle. What code do i have to write to translate the 2 cirlces at different speeds/velocities?

  4. #4
    Senior Member Regular Contributor
    Join Date
    Dec 2008
    Location
    USA
    Posts
    134

    Re: Translating different objects at different speeds

    Well, each frame the circles are in some spot. You compute the spot in your code ( I don't know how you want them to move ). Then you do something like this:

    Code :
    glPushMatrix();
    glTranslatef(x,y,z);
    drawCircle1();
    glPopMatrix();
     
    glPushMatrix();
    glTranslatef(x,y,z);
    drawCircle2();
    glPopMatrix();

    In the first section, x,y and z are the location of the first circle, and the second time they are the location of the second circle. Update the screen, recompute the positions for the next frame, and repeat.

Similar Threads

  1. Moving the camera at different speeds
    By Manolo2 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-24-2017, 11:28 AM
  2. Enforce speeds and focus on 2D! and More
    By fobbix in forum OpenGL: General
    Replies: 29
    Last Post: 05-14-2012, 09:11 AM
  3. FBO vs PBuffer mipmap speeds
    By Lord crc in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 05-16-2007, 01:01 AM
  4. Mainaining same look with different speeds
    By jbich in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 05-20-2005, 03:30 PM
  5. CVA speeds.
    By dabeav in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-25-2002, 12:49 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