I want to draw many spheres (~100k) using OpenGL. So far, I m doing something like
for (int i=0; i<pnum; i++){
glPushMatrix();
glTranslatef(bpos[i].x, bpos[i].y, bpos[i].z);
glCallList(DListSPHERE);
glPopMatrix();
}
Before using proper spheres, I used GL_POINTS
. That allowed me to call glDrawArrays
with an array containing all points which was very efficient. Is there a better way than the above code to draw many, identical objects?