Results 1 to 2 of 2

Thread: move

  1. #1
    Guest

    move

    I am trying to find out something strange.Maybe i missed it somehow but for example i have two balls rendered on screen in different positions.i want to select exactly one of two balls and move themprobably with gltranslate?Ive tried to find an answer but unsuccessfully.i dont want a book(i have them).Some simple code please.Look:
    -------------------------------------------

    a-O(first ball)--------->a-O(first ball moves-second one is still)

    b-O(second ball)

    if i want to translate it how can i select it?There are examples for one object but none for two.Please help.Eternally grateful.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: move

    For movement you need to set variables to track each ball's position. And glTranslate to move them.

    example:

    glPushMatrix();
    glTranslatef(Ball_1_x, Ball_1_y, Ball_1_z);
    Draw_ball();
    glPopMatrix();

    glPushMatrix();
    glTranslatef(Ball_2_x, Ball_2_y, Ball_2_z);
    Draw_ball();
    glPopMatrix();

    Look at nehe.gamedev.net he has a good tutor on selection.

Similar Threads

  1. Rotations and Transformations, Move the player or move the world?
    By neurocase in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-14-2014, 12:41 AM
  2. Arbitrary move
    By garvek in forum OpenGL: General
    Replies: 2
    Last Post: 08-18-2004, 11:06 PM
  3. Move FOG
    By thoean in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 07-02-2003, 11:40 AM
  4. How to move
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 08-07-2002, 10:11 AM
  5. how to move my car?
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-09-2001, 05:15 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