Hi,
So, I have the following function that is passed in the “glutDisplayFunc”.
void drawScene() {
//Clear information from last draw
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW); //Switch to the drawing perspective
glLoadIdentity(); //Reset the drawing perspective
//Declare varaibles.
//This is for rows.
int row = 0;
//Goes through array NOT for the drawing.
int i;
//This is for drawing. Because it can be reset with affecting the length of the loop.
int g;
for (i = 0; i < 100; i++)
{
g++;
if (cellActivation[i] == false)
{
glColor3f(1.0f, 1.0f, 1.0f);
glBegin(GL_QUADS);
glVertex3f(g-3, row, -10);
glVertex3f(g-2, row, -10);
glVertex3f(g-2, row-1, -10);
glVertex3f(g-3, row-1, -10);
glEnd();
}
else if (cellActivation[i] == true)
{
glColor3f(0.2f, 0.3f, 1.0f);
glBegin(GL_QUADS);
glVertex3f(g-3, row, -10);
glVertex3f(g-2, row, -10);
glVertex3f(g-2, row-1, -10);
glVertex3f(g-3, row-1, -10);
glEnd();
}
if(g == 5)
{
row--;
g = 0;
}
}
glutSwapBuffers(); //Send the 3D scene to the screen
}
And it does make a “graph” but, it only generates the “graph” after I move the window. This probably (not quite sure though) has to do with redisplaying caused by “glutReshapeFunc” but I do not know exactly why. Any suggestions?