/*!**************************************************************************** @Function RenderScene @Return bool true if no error occured @Description Main rendering loop function of the program. The shell will call this function every frame. eglSwapBuffers() will be performed by PVRShell automatically. PVRShell will also manage important OS events. Will also manage relevent OS events. The user has access to these events through an abstraction layer provided by PVRShell. ******************************************************************************/ bool OGLESFur::RenderScene() { // Reset the states that print3D changes glDisable(GL_CULL_FACE); glEnable(GL_FOG); glEnable(GL_LIGHT0); glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); // User input bool bNewPage = false; if(PVRShellIsKeyPressed(PVRShellKeyNameSELECT)) m_bPause = !m_bPause; if(PVRShellIsKeyPressed(PVRShellKeyNameLEFT)) { if(--m_i32WndPage < 0) m_i32WndPage = 5; bNewPage = true; } if(PVRShellIsKeyPressed(PVRShellKeyNameRIGHT)) { if(++m_i32WndPage > 5) m_i32WndPage = 0; bNewPage = true; } if(bNewPage) { switch(m_i32WndPage) { case 0: m_bViewMode = false; m_i32FurShellNo = 7; break; case 1: m_bViewMode = true; m_i32FurShellNo = 0; break; case 2: m_bViewMode = true; m_i32FurShellNo = 1; break; case 3: m_bViewMode = true; m_i32FurShellNo = 2; break; case 4: m_bViewMode = true; m_i32FurShellNo = 7; break; case 5: m_bViewMode = false; m_i32FurShellNo = 7; break; } // Since the number of fur shells has changed, update them UpdateFurShells(); } // Clear glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Animation DoAnimation(); // View matrix glMatrixMode(GL_MODELVIEW); myglLoadMatrix(m_mView.f); // Enable the vertex and normal arrays glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); // Begin Scene if(!m_bViewMode) DrawEnvironment(); // Draw the Duck DrawDuck(); // Display the information window if required if(m_bWndRender) m_Print3D.DisplayWindow(m_ui32WindowID[m_i32WndPage]); // Display Paused if the app is paused if(m_bPause) m_Print3D.Print3D(78.0f, 2.0f, 1.0f, PVRTRGBA(255,255,255,255), "Paused"); // Display the IMG logo m_Print3D.DisplayDefaultTitle(NULL, NULL, ePVRTPrint3DSDKLogo); m_Print3D.Flush(); return true; }