Model appears only when I'm about to close the window in freeglut

that’s the code where I’m drawing the model and the skybox, the skybox shows just fine but the ball appear only when I’m about to close the window:

void DrawGLScene(GLvoid)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();
    glMatrixMode(GL_MODELVIEW);
    gluLookAt(movx, movy, movz, cx, cy, 0, -5, 1, 0);
    /*skybox(30); */                        //60
    ball.pos.x = 0;
    ball.pos.y =0;
    ball.pos.z= 0;
    ball.scale = 2;
    ball.Draw();
    glEnd();
    ...

and then in main:

int main(int argc, char* argv[]) {

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH);
    glutInitWindowSize(1000, 800);
    glutCreateWindow("Hello, GL");
    glutReshapeFunc(changeViewPort);
    glutDisplayFunc(render);
    InitGL();

    glutDisplayFunc(DrawGLScene);

    glutKeyboardFunc(Keyboard);
    glutSpecialFunc(special);
    glutReshapeFunc(Reshape);
    GLenum err = glewInit();
    if (GLEW_OK != err) {
        fprintf(stderr, "GLEW error");
        return 1;
    }
    glutMainLoop();
    return 0;
}

draw() is a model function I call in the drawglscene function, anyway I don’t think this is the problem because when I tried the same code using glut it worked just fine. and as I said above the model appears but only when I’m about to close the window

Are you calling glFlush?

Most OpenGL functions simply append a command to a queue. For efficiency, enqueued commands are only sent to the driver when the buffer is full, or when it’s explicitly flushed (with glFlush or glFinish), or when it’s implicitly flushed (by a command which needs to read back data to client memory, or a SwapBuffers call).

If the buffer doesn’t get flushed, the commands won’t be executed.