void RenderBrain(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
ifstream myFile("brainData.txt");
if (!myFile.is_open())
{
cout << "Unable to open file";
exit(1); // terminate with error
}
glRotatef(80.0f, 1.0f, 0.0f, 0.0f);
while (! myFile.eof())
{
myFile>>a[0];
myFile>>a[1];
myFile>>a[2];
myFile>>a[3];
glColor3f(0.60f,0.80f,0.90f);
glLoadIdentity();
glTranslatef((a[0]-1.15)*26, a[2]*30, a[1]*30);
glutSolidSphere(6, 5, 5);
}
myFile.close();
glFlush();
glutSwapBuffers();
}
Above is part of my code, I have problem making it rotate after adding glLoadIdentity(); inside the loop. If I remove it it'll result that all my spheres to fly towards all directions.
Can anybody help?