I am a beginner at openGL, but have managed to cobble together an otherwise quite nice program that is supposed to animate a number of spheres.
The trouble is that each frame takes a very long time to create (~1 sec). When I rotate the image, it moves quite smoothly, so I guess from that that it is definately my frame CREATION that takes too much time, not the rendering.
Here is my current code:
As you can see, m_ppf (this can often be ~1000) individual spheres are created in each frame.
void CAnimationDialog::buildFrame(int f)
int i, n;
GLUquadricObj *quadratic; // Storage For Our Quadratic Objects ( NEW )
double X, Y, Z;
float r = 0.1f;
quadratic = gluNewQuadric();
for(i=0; i<m_ppf; i++)
n = m_ppf*f + i;
X = m_x[n];
Y = m_y[n];
Z = m_z[n];
glTranslated(X, Y, Z);
gluSphere(quadratic, m_radius, 12, 12);
Am I doing this a silly, time-consumiing way? Any suggestions to speed it up?
Can I make use of the fact that all the spheres are the same? Or that they all exist in all frames (i.e. can I create them one, and then just move them)?
On a different topic, when I zoom out, all the spheres get very pale - which is the gl_command that controls this effect?
Thanks everyone - hope you can help,