PDA

View Full Version : Direction Loader using Keys - glScalef



donmitz
01-05-2013, 05:15 AM
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

936 937 938

Thanks in advance

tonyo_au
01-06-2013, 07:06 PM
Try scaling before you translate. You normally want scaling to occur in object space (ie with the object at the origin).