//what to do when the image has to be draw void Game::render(void) { //set the clear color (the background color) glClearColor(0.0, 0.0, 0.0, 1.0); // Clear the window and the depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Put the camera matrices on the stack of OpenGL (only for fixed rendering) camera->set(); //Draw out world drawGrid(500); //background grid //draw the plane Matrix44 m; m.setRotation(angle * DEG2RAD, Vector3(0,1,0) ); //build a rotation matrix glPushMatrix(); m.set(); plane->render(); //render plane glPopMatrix(); //swap between front buffer and back buffer SDL_GL_SwapWindow(this->window); }
void Camera::rotate(float angle, const Vector3& axis) { Matrix44 R; R.setRotation(angle,axis); Vector3 new_front = R * (center - eye); center = eye + new_front; updateViewMatrix(); }
void Camera::orbit( const Vector3& center, float angle, const Vector3& axis ) { Matrix44 R; R.setRotation(angle,axis); Matrix44 T; T.setTranslation( center.x, center.y, center.z ); Matrix44 M = T * R; T.setTranslation( -center.x, -center.y, -center.z ); M = M * T; this->center = M * this->center; this->eye = M * this->eye; updateViewMatrix(); }
void Matrix44::rotateLocal( Float angle_in_rad, const Vector3& axis ) { Matrix44 R; R.setRotation(angle_in_rad, axis); *this = R * *this; }
void Matrix44::rotate( Float angle_in_rad, const Vector3& axis ) { Matrix44 R; R.setRotation(angle_in_rad, axis); *this = *this * R; }