All pastes #904316 Raw Edit

Stuff

public text v1 · immutable
·published 2008-02-14 21:16 UTC
rendered paste body
void Drawer::Draw(float iT)
{
    int i = 0;
    glColor3f(0.0f,0.0f,1.0f);

    static std::vector<float> grid;
    grid.resize(iScreenHeight * iScreenWidth);
    for (int i = 0; i < iScreenHeight; ++i)
        for (int j = 0; j < iScreenWidth; ++j)
            grid[i * iScreenWidth + j] = Wrangle(i*64./iScreenWidth - iOriginX, j*64./iScreenHeight - iOriginY, iT);

    while(i < iScreenHeight - 1)
    {
        float fResult[2];
        int j = 0;

        //glColor3f(0.0f,0.0f,(float)i/128.0f);

        glBegin(GL_TRIANGLE_STRIP);
        {
            fResult[0] = grid[(i + 1) * iScreenWidth];
            fResult[1] = grid[i * iScreenWidth];
            glColor3f(0.0f,0.0f,0.75f - fResult[0]*10);
            glVertex3f(fMinX+((float)(i+1) * fDistX),fMinY + ((float)j*fDistY),fResult[0]);
            glColor3f(0.0f,0.0f,0.75f - fResult[1]*10);
            glVertex3f(fMinX + ((float)i * fDistX),fMinY + ((float)j * fDistY), fResult[1]);

            j=1;
            while(j < iScreenWidth)
            {
                fResult[0] = grid[(i + 1) * iScreenWidth + j];
                fResult[1] = grid[i * iScreenWidth + j];
                glColor3f(0.0f,0.0f,0.75f - fResult[0]*10);
                glVertex3f(fMinX + ((float)(i+1) * fDistX),fMinY + ((float)j * fDistY), fResult[0]);
                glColor3f(0.0f,0.0f,0.75f - fResult[1]*10);
                glVertex3f(fMinX + ((float)i * fDistX),fMinY + ((float)j * fDistY), fResult[1]);
                j++;
            }
        }
        glEnd();

        i++;
    }
}