can anyone please point me to a tut or explain how to move a 2d coloured polygon across the screen and stop at a given point

Had a look at neheâ€™s site but none of the examples deal specificly with what i want to do. All beginners tutorials seem to deal with movement by using glRotatef(). Is glTranslatef() able to move objects across the screen if so how does it work? If not then how is it done?

A basic explanation would be helpfull.

Hm, hope a very basic explanation helps youâ€¦

Ok so, you can use 3 modelisation transformations:

_glRotate[ type ]( angle , x, y, z);

where type is d (for double), i(for int), f(for float), and angle is your angle of rotation, because this function is used for rotating objects. x, y and z are your coords in 3D space (x axis, y axis, z axisâ€¦)

in theory: This function multiply the active matrix by a rotation about an object.

_glTranslate[ type ](x, y, z);

where type is d (for double), i(for int), f(for float), this function is used for translate objects in 3D space (left or right, up or down, far or near).

in theory: This function multiply the active matrix by a matrix that move an object (moving the local coords system).

_glScale[ type ](x, y, z);

where type is d (for double), i(for int), f(for float), this function is used to modify how your object look like, at every coords (x, y or z) if you specify a value < 1, the object appear more little, if the value is > 1, the object appear bigger.

in theory: This function multiply the active matrix by a matrix that modify the appearence (more little, more big, more deepâ€¦)

Tricks and counter traps:

_Donâ€™t forget that if you want to translate and rotate an object, the result is not the same if you translate before rotate or rotate before translate !

There is no â€śgoodâ€ť order, because you can use this little trap such as a bonus to facilitate your transformations

_Donâ€™t forget, angle is in degree (:

_You must use glLoadIdentity() function very often, i.e. between 2 transformations, because if you donâ€™t, the current transformation willbe affected by the older transformation, note: such as rotate and translate, this traps can be used like a bonusâ€¦

_all transformation are multiplications of matrix by other matrix in reality, so check your math out !

```
(note that your transformations may look like
( 1 0 0 )
( 0 1 0 ) <-- erks ! (i.e. an identity matrix)
( 0 0 1 )
```

If you want to move an object from a point to another point you can try something like that:

```
// globals
GLfloat myXmove;
....
// renderer
glTranslatef( myXmove, y, z);
glBegin();
glVertex....
...
glEnd();
if(myXmove < 10.0f)
{
myxmove += 0.001f;
}
else
{
another_transformations...
}
```

(donâ€™t hurt, this is an example (: )

Hope that helps, donâ€™t forget to check the OpenGL RedBook out (this is the official bible)

Gollum