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


pixel colours by Brendan
1
 
void CalcSet(double length, double centre_x, double centre_y)
{
    double x_step = length/WIDTH;
    double y_step = length/HEIGHT;
    int iterations;

    double blah;

    for(int i=0;i<WIDTH;i++)
    {
        for(int j=0;j<HEIGHT;j++)
        {
            iterations = MandleCalc(centre_x - 0.5*length + i*x_step,centre_y - 0.5*length + j*y_step);

            if(iterations <= ((MAXITERATIONS/2)-1))
            {
                m_set[j][i][0] = (GLubyte)255*iterations/((MAXITERATIONS/2)-1);
                m_set[j][i][1] = (GLubyte)0;
                m_set[j][i][2] = (GLubyte)0;
            }
            else if(iterations < MAXITERATIONS)
            {
                blah = 127.5*iterations/MAXITERATIONS;
                m_set[j][i][0] = (GLubyte)blah;
                m_set[j][i][1] = (GLubyte)blah;
                m_set[j][i][2] = (GLubyte)blah;
            }
            else
            {
                m_set[j][i][0] = (GLubyte)0;
                m_set[j][i][1] = (GLubyte)0;
                m_set[j][i][2] = (GLubyte)0;
            }
        }
    }
}