glutSolidSphere
can't we put glutSolidSphere function in a "for loop" :S
i tried but it says "program is not responding" :S
error is about glutSolidSphere,because when i write the same code by using glVertex instead of glutSolidSphere,it works:S
Yeah, show your code. I did a quick test since I'm a bit rusty with OpenGL and it worked fine for me.
while (!feof ( file ) )
{
fscanf(file,"%lf%lf%lf%",&ko.x,&ko.y,&ko.z);
glColor3f(0,1,0);
glLoadIdentity();
glTranslatef(ko.x,ko.y,ko.z);
glutSolidSphere(1,25,25);
}
fclose(file);
glutSwapBuffers();
// ko means coordinate :D
{
fscanf(file,"%lf%lf%lf%",&ko.x,&ko.y,&ko.z);
glColor3f(0,1,0);
glLoadIdentity();
glTranslatef(ko.x,ko.y,ko.z);
glutSolidSphere(1,25,25);
}
fclose(file);
glutSwapBuffers();
// ko means coordinate :D
Try verifying what values you're reading from your file. That code is pretty odd. Why would you only want to render the spheres one frame? Or do you read from a file every frame?
Also gluSolidSphere is quite slow so it will slow down your application MUCH more than a single glVertex call.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement