static void BeginFrame() { glClearColor(0.3f, 0.3f, 0.3f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); SetModelViewMatrix(); SetPerspectiveMatrix(); glViewport(0, 0, renderwidth, renderheight); }
void OpenGlRenderState::Follow(const OpenGlMatrix& T_wc, bool follow) { this->T_cw = T_wc.Inverse(); if(follow != this->follow) { if(follow) { const OpenGlMatrix T_vc = GetModelViewMatrix() * T_wc; SetModelViewMatrix(T_vc); this->follow = true; }else{ Unfollow(); } } }
void OpenGlRenderState::Unfollow() { const OpenGlMatrix T_vw = GetModelViewMatrix() * T_cw; SetModelViewMatrix(T_vw); this->follow = false; }