rendered paste bodyvoid 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);
static std::vector<float> vertices;
static std::vector<float> colors;
colors.clear();
vertices.clear();
while(i < iScreenHeight - 1)
{
float fResult[2];
int j = 0;
while(j < iScreenWidth) {
fResult[0] = grid[(i + 1) * iScreenWidth + j];
fResult[1] = grid[i * iScreenWidth + j];
colors.push_back(0.0);
colors.push_back(0.0);
colors.push_back(0.75 - fResult[0]*10);
colors.push_back(0.0);
colors.push_back(0.0);
colors.push_back(0.75 - fResult[1]*10);
vertices.push_back(fMinX+(i+1)*fDistX);
vertices.push_back(fMinY+j*fDistY);
vertices.push_back(fResult[0]);
vertices.push_back(fMinX+i*fDistX);
vertices.push_back(fMinY+j*fDistY);
vertices.push_back(fResult[1]);
j++;
}
i++;
}
glVertexPointer(3, GL_FLOAT, 0, &vertices[0]);
glColorPointer(3, GL_FLOAT, 0, &colors[0]);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
for (int i = 0; i < iScreenHeight; ++i)
glDrawArrays(GL_TRIANGLE_STRIP, iScreenWidth*i*2, iScreenWidth*2);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}