/////////////////////////////////////////////////////////////////////////////// // Called to draw scene void RenderScene(void) { // Clear the window with current clearing color glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); modelViewMatrix.PushMatrix(); M3DMatrix44f mCamera; cameraFrame.GetCameraMatrix(mCamera); modelViewMatrix.MultMatrix(mCamera); M3DMatrix44f mObjectFrame; objectFrame.GetMatrix(mObjectFrame); modelViewMatrix.MultMatrix(mObjectFrame); shaderManager.UseStockShader(GLT_SHADER_FLAT, transformPipeline.GetModelViewProjectionMatrix(), vBlack); switch(nStep) { case 0: glPointSize(4.0f); pointBatch.Draw(); glPointSize(1.0f); break; case 1: glLineWidth(2.0f); lineBatch.Draw(); glLineWidth(1.0f); break; case 2: glLineWidth(2.0f); lineStripBatch.Draw(); glLineWidth(1.0f); break; case 3: glLineWidth(2.0f); lineLoopBatch.Draw(); glLineWidth(1.0f); break; case 4: DrawWireFramedBatch(&triangleBatch); break; case 5: DrawWireFramedBatch(&triangleStripBatch); break; case 6: DrawWireFramedBatch(&triangleFanBatch); break; } modelViewMatrix.PopMatrix(); // Flush drawing commands glutSwapBuffers(); }
void CubeApp::OnRenderScene() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); modelViewMatrix.PushMatrix(); M3DMatrix44f mCamera; cameraFrame.GetCameraMatrix(mCamera); modelViewMatrix.MultMatrix(mCamera); M3DMatrix44f mObject; objectFrame.GetMatrix(mObject); modelViewMatrix.MultMatrix(mObject); DrawWireFramedBatch(&triangleBatch); modelViewMatrix.PopMatrix(); glutSwapBuffers(); }