How to pause a program for a few milliseconds using managed C ++ code? I tried Sleep (), but it did not work, when I included the winbase.h file, I had a lot of compilation errors!
for(int i=0; i<10; i++) { simpleOpenGlControl1->MakeCurrent(); System::Threading::Thread::Sleep(100); theta_rotated += 2.0* 3.141592653/(double)Model->size()/10.0; simpleOpenGlControl1->Invalidate(); } private: System::Void simpleOpenGlControl1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) { Gl::glMatrixMode(Gl::GL_MODELVIEW); Gl::glLoadIdentity(); Gl::glClearColor(1, 1, 1, 1); Gl::glClear(Gl::GL_COLOR_BUFFER_BIT | Gl::GL_DEPTH_BUFFER_BIT); camera->Tellgl(); Gl::glRotated(Angle,X,Y,Z); RenderModels(); } void RenderModels(void) { Points = gcnew System::Collections::Generic::List<Point>(); Point p(0,0) ; int t = -5; double r = 5; double x, z, theta; for(int i = 0;i < Model->size();i++) { theta = i*2* 3.141592653/ (double)Model->size(); x = r*sin(theta + theta_rotated); z = r*cos(theta + theta_rotated); Gl::glPushMatrix(); Gl::glTranslated(x,0,z); Model->at(i).Render(); pX=x; pY=0; Points->Add(p); t +=1; Gl::glPopMatrix(); }
source share