I have a program which reads in coordinates of cubes (essentially) from various external ASCII files. What is supposed to happen is the program reads in this data, then plots the cubes as required. Essentially each file is a frame (generated by an external simulation program). When I just try to read in one frame, using the following code ( I am just going to post where I know the error is located), the program works perfectly.
Code: Select all
if(ReadData(file_name)){return 0;} // Read in the data
while(device->run())
{
driver->beginScene(true, true, SColor(255,255,255,255));
smgr->drawAll();
for (int w=0;w<NUM_PARTICLES;w++)
{ // loop over all the x,y,z points and plot them
glColor4f(XYZ[w].f8,(1-XYZ[w].f8),0.0,0.2);
glPushMatrix();
glTranslatef(XYZ[w].x,XYZ[w].y,XYZ[w].z);
glutSolidCube(0.5);
glPopMatrix();
}
driver->endScene();
}
Code: Select all
while(device->run())
{
driver->beginScene(true, true, SColor(255,255,255,255));
smgr->drawAll();
sprintf(file_name,"%s%06i",name_str,i);
if(ReadData(file_name)){return 0;} // Read in the data
for (int w=0;w<NUM_PARTICLES;w++)
{ // loop over all the x,y,z points and plot them
glColor4f(XYZ[w].f8,(1-XYZ[w].f8),0.0,0.2);
glPushMatrix();
glTranslatef(XYZ[w].x,XYZ[w].y,XYZ[w].z);
glutSolidCube(0.5);
glPopMatrix();
}
driver->endScene();
i++; if(i>10){i=1;}
}