I appear to have a recurring problem, with my program outputs as compared to the outputs resulted form the OpenGL Super Bible outputs. For example one of his programs generates "randomly" placed spheres with a Torus in the middle of the viewpoint and a sphere rotating around the Torus. Mine only displays the Torus with the sphere rotating around it but not the "randomly" placed spheres. I've isolated the problem to the function SetupRC() which in his code example is as follows:
void SetupRC()
{
int iSphere;
// Bluish background
glClearColor(0.0f, 0.0f, .50f, 1.0f );
// Draw everything as wire frame
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
// Randomly place the sphere inhabitants
for(iSphere = 0; iSphere < NUM_SPHERES; iSphere++)
{
// Pick a random location between -20 and 20 at .1 increments
float x = ((float)((rand() % 400) - 200) * 0.1f);
float z = (float)((rand() % 400) - 200) * 0.1f;
spheres[iSphere].SetOrigin(x, 0.0f, z);
}
}
where as in mine it is as follows:
void SetupRC()
{
int iSphere;
//Blue-ish background
glClearColor(0.0f, 0.0f, .50f, 1.0f);
//Draw everything as wireframe
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
//randomly place there spheres
for(iSphere = 0; iSphere < NUM_SPHERES; iSphere++);
{
float x = ((float)((rand() % 400) - 200) * 0.1f);
float z = (float)((rand() % 400) - 200) * 0.1f;
spheres[iSphere].SetOrigin(x, 0.0f, z);
}
}
The rest of my program is identical to his and these functions too seem identical yet when I copy his function into my program the spheres are generated but when I use my function (which seems identical to his) the spheres are not generated.
Could anyone please provide me with some insight as to why this is the case?
[Edited by - ApochPiQ on October 24, 2009 9:13:08 AM]