Problems drawing 2000 spheres in OpenGL

  c++, freeglut, opengl

I want to draw 2000 spheres with the following code.

glNewList(id, GL_COMPILE);

int m = 0;

for (int j = 0; j < 10; j++) {
    for (int k = 0; k < 10; k++) {
        for (int l = 0; l < 20; l++) {
            printf("%dn", m++);
            glPushMatrix();
            glTranslatef(j, k, l);
            gluSphere(myQuad, sphereRadius, slices, stacks);
            glPopMatrix();
        }
    }
}

glEndList();

When I run it, the following error message appears.
"freeglut : fgInitGL2 : fghGenBuffers is NULL"
But I don’t know what’s wrong with my code. Please help.

Source: Windows Questions C++

LEAVE A COMMENT