Results 1 to 2 of 2

Thread: Direction Loader using Keys - glScalef

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2012
    Posts
    12

    Exclamation Direction Loader using Keys - glScalef

    I have a small problem (its a bit difficult to explain so i have added some pictures too)

    The problem is that when i click the left key on the keyboard the red loader is mean to decrease and stay in the same position.

    The only problem is that it does decrease (get smaller) but loader moves out of the loader barrier I am not sure why this is, please help.


    glPushMatrix();
    glTranslatef(0, 0, 320);
    directionIndicator();

    if (ballXpos == 40.0)
    glScalef(1.0, 1.0, 1.0);

    if (ballXpos < 10.0)
    glScalef(0.75, 1.0, 1.0);

    //etc

    directionLoader();
    glPopMatrix();

    I have also uploaded pictures

    1.jpg 2.jpg 3.jpg

    Thanks in advance

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    Try scaling before you translate. You normally want scaling to occur in object space (ie with the object at the origin).

Similar Threads

  1. glScalef() problem
    By herba in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-09-2012, 05:48 AM
  2. glScalef()
    By mark-w in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-12-2005, 12:00 PM
  3. does glScalef...
    By grimoire in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-29-2004, 12:24 AM
  4. looking for glScalef examples
    By cg-hci_novice in forum OpenGL: Basic Coding
    Replies: 18
    Last Post: 09-05-2003, 10:11 AM
  5. regarding glScalef()
    By karteek in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-28-2003, 05:41 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