Multiple static Spheres/Cubes

I have a 3D grid of spheres. Each frame/update I add 1 or more spheres to the 3D grid. So over time more and more spheres are added. Once added they stay in the same positions. Think of it like a blob made from smaller spheres that grows as more spheres are added to the blob.

The basic flow each frame is;

Update the OpenGL Viewport, Lookat, Rotations, Lights, etc.
Then loop through the spheres and draw them by,

glpushmatrix;
gltranslatef(xpos,ypos,zpos);
quadric:=gluNewQuadric;
gluQuadricNormals(quadric, GLU_SMOOTH);
gluSphere(quadric,radius,precision,precision);
glpopmatrix;
gluDeleteQuadric(quadric);

Then display the result.

The problem is this gets very slow as the sphere count increases.

So my next idea was to only init/clear/lookat once before the main loop and then just render each sphere once as it gets added to the scene. This works but I cannot change the lookat position each frame (this is to auto zoom out to show the blob as it grows).

I have tried push and pop matrix at various points but cannot get it working.

So my basic flow is

InitOpenGL once before the sphere drawing begins
start loop
Draw next sphere (inside above glusphere code)
Update display
repeat loop until stopped

That works and the spheres are added (and a huge speedup from rendering them all each frame) but I cannot reset the view?

Any ideas? I hope I explained it clear enough and hope I am missing something obvious.

With a perspective projection, you cannot avoid redrawing everything whenever the viewpoint changes.

Also, if you’re using a double-buffered context, note that the contents of the back buffer are undefined after a buffer swap. Some implementations will preserve the contents (allowing you to add to the scene then perform another swap), some won’t.

I suggest learning how to use modern OpenGL so that you can make your rendering code much faster.

[QUOTE=GClements;1286779]With a perspective projection, you cannot avoid redrawing everything whenever the viewpoint changes.
I suggest learning how to use modern OpenGL so that you can make your rendering code much faster.[/QUOTE]

Thanks for the confirmation. I can stop trying to wrangle the old v1 OpenGL calls to do what I want.