GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: No Line Numbers


drawsquare by cxmac
1
 
float SIN_OUT = 0.0;
float pi = 3.14159;

for ( float i = 0.0; TRUE; i = i + 0.1)
{
    if ( i = 2.1 )
        i = 0.0;

    SIN_OUT = sin ( i * pi );
    drawsquare( SIN_OUT );
}

/* ok, so, the idea is that the variable i constantly cycles through 0.0 to 2.0.  It is
multiplied by pi in the sin expression to give the rad measure necessary.  Then the
output is used as a parameter of the drawsquare function. */