Continuous rotation of scene

Hello all!
I working at C++ Builder 6.0 and now I have a project of program, that making a 3D graphics, that user can rotating and scaling. Now I making a test, point-by-point graphic.

It isn’t a problem to make a graphic, but I don’t know how it can rotate. In my stage of project I need continuous rotation, that isn’t terminating.
I am using this code:


// This function is calling in a function Timer1Timer

void __fastcall TForm3::DrawObjects()
{
   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
   glPushMatrix();

   latitude += latinc;
   longitude += longinc;
   glLoadIdentity();
   polarView(radius, 0, latitude, longitude );  

   glLineWidth(3);
   glColor3f(0.0,0.0,0.0);
   glEnable(GL_LINE_SMOOTH);
   
   // Drawing three coordinates axes
   glBegin(GL_LINES);
   glVertex3f(0,0,0);
   glVertex3f(20,0,0);
   glEnd();

   glBegin(GL_LINES);
   glVertex3f(0,0,0);
   glVertex3f(0,20,0);
   glEnd();

   glBegin(GL_LINES);
   glVertex3f(0,0,0);
   glVertex3f(0,0,20);
   glEnd();

   // Drawing a test point graphic (F(X,Y) = sin(X+Y))
   glEnable(GL_POINT_SMOOTH);
   glPointSize(4);
   for (int i = 0; i<20; i++)
       for (int j = 0; j<20; j++)
        {
            X = i; Y = j;
            Z = sin(X+Y);
            glBegin(GL_POINTS);
            glVertex3f(X,Y,Z);
            glEnd();
        }
     glPopMatrix();
     SwapBuffers(hdc);
}

void TForm3::polarView(GLdouble radius, GLdouble twist, GLdouble latitude, GLdouble longitude)
{
    glTranslated(0.0, 0.0, -radius);
    glRotated(-twist, 0.0, 0.0, 1.0);
    glRotated(-latitude, 1.0, 0.0, 0.0);
    glRotated(longitude, 0.0, 0.0, 1.0);
}

The graphic is succefully drawing, but on the form there is a non-OpenGL objects (buttons, labels and PerformanceGraph object) and when executing a function SwapBuffers(), labels are disappearing and a PerformanceGraph is blinking on each OnTimer event.
English isn’t my language, so sorry for a mistakes.

To perform rotation I advice you use the glRotatef function. The UI elements are blinking because penGL drawing is usually not compatible to the GDI rendering. Basically, don’t put another controls onto the control that will be uses as the OpenGl view, but keep them separate (make two panels on the form, on epanel containing the controls and another being the GL view).

Thank you, Zengar. It was my main problem in this project!