void DisplayGL() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //clear currenr render target /buffers //change rendering scene based on globals value switch(g_eCurrentScene) { case ST_Scene1: { RenderScene1(); } break; case ST_Scene2: { RenderScene2(); } break; case ST_Scene3: { RenderScene3(); } break; case ST_Scene4: { RenderScene4(); } break; } glutSwapBuffers(); //flip buffers (current buffer to off-screen buffer glutPostRedisplay(); //tell GLUT that we are ready to render another frame. Marks current window to be redisplayed }
void DisplayGL() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clean up the colour of the window // and the depth buffer switch (g_eCurrentScene) { case 1: { RenderScene1(); } break; case 2: { RenderScene2(); } break; case 3: { RenderScene3(); } break; case 4: { RenderScene4(); } break; case 5: { RenderScene5(); } break; case 6: { RenderScene6(); } break; } glutSwapBuffers(); // All drawing commands applied to the // hidden buffer, so now, bring forward // the hidden buffer and hide the visible one }
void DisplayGL() { std::this_thread::sleep_for(std::chrono::milliseconds(33)); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); switch (g_eCurrentScene) { case 1: RenderScene1(); break; case 2: RenderScene2(); break; } glutSwapBuffers(); }
HRESULT ActionScene( int &asStage ) { //CParser CPrsr; HRESULT hr; D3DXMATRIX acMatrixView; pDirect3DDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB( 191, 245, 251 ), 1.0f, 0); pDirect3DDevice->BeginScene(); if( asStage == 10 ) { GetDInputAction(); Calculation(); ++ asStage; } if( asStage == 11 ) { D3DXMatrixLookAtLH(&acMatrixView, &D3DXVECTOR3( 0.0f, 40.0f, 0.f ), // определяет точку, из которой происходит просмотр сцены &D3DXVECTOR3(0.0f, 0.0f, 0.0001f), // определяет то на что мы смотрим &D3DXVECTOR3(0.0f, 1.0f, 0.0f)); pDirect3DDevice->SetTransform( D3DTS_VIEW, &acMatrixView ); if( Start() ) { GetDInputAction(); if( s_start ) { ++ asStage; } } RenderScene(); } //Движение согласно XML if( asStage == 12 ) { GetDInputAction(); if( first ) { CPrsr.InitCarList(); Mesh *a; Mesh *b; Mesh *c; Mesh *d; for( int i = 0; i < 4; ++ i) { a = *(CPrsr.iteratorList); CPrsr.Iteration(); b = *(CPrsr.iteratorList); CPrsr.Iteration(); c = *(CPrsr.iteratorList); CPrsr.Iteration(); d = *(CPrsr.iteratorList); hr = CPrsr.YourTurn( a, b, c, d ); if( hr == S_OK ) a->ICanGo = true; else if( hr == S_FALSE ) MessageBox( NULL, L"Нет машин, проезжающих перекресток", L"End", MB_OK ); CPrsr.Iteration(); CPrsr.Iteration(); first = false; } } CPrsr.MoveCars(); RenderScene2(); } pDirect3DDevice->EndScene(); pDirect3DDevice->Present( NULL, NULL, NULL, NULL ); return S_OK; }