void GLAnimationCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) ) { // must always be here wxPaintDC dc(this); SetCurrent(*m_pGLRC); // Initialize OpenGL if (!m_gldata.initialized) { InitGL(); ResetProjectionMode(); m_gldata.initialized = true; } static DWORD last = timeGetTime(); DWORD curr = timeGetTime(); DWORD delta = curr - last; last = curr; CAnimationManager::GetInstance()->Update((float)delta/1000); CRenderManager::GetInstance()->Render(); SwapBuffers(); }
void TestGLCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) ) { // must always be here wxPaintDC dc(this); SetCurrent(*m_glRC); // Initialize OpenGL if (!m_gldata.initialized) { InitGL(); ResetProjectionMode(); m_gldata.initialized = true; } // Clear glClearColor( 0.3f, 0.4f, 0.6f, 1.0f ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // Transformations glLoadIdentity(); glTranslatef( 0.0f, 0.0f, -20.0f ); GLfloat m[4][4]; build_rotmatrix( m, m_gldata.quat ); glMultMatrixf( &m[0][0] ); m_renderer.Render(); // Flush glFlush(); // Swap SwapBuffers(); }
void GLAnimationCanvas::OnSize(wxSizeEvent& WXUNUSED(event)) { // Reset the OpenGL view aspect. // This is OK only because there is only one canvas that uses the context. // See the cube sample for that case that multiple canvases are made current with one context. ResetProjectionMode(); }
void TestGLCanvas::OnSize(wxSizeEvent& event) { // this is also necessary to update the context on some platforms wxGLCanvas::OnSize(event); // Reset the OpenGL view aspect ResetProjectionMode(); }