示例#1
0
        public void Draw()
        {
            if (m_uint_DC == 0 || m_uint_RC == 0)
            {
                return;
            }

            GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_STENCIL_BUFFER_BIT);
            GL.glLoadIdentity();
            GL.glTranslated(0, 0, -5);

            GLU.gluLookAt(
                LookAtEyeX, LookAtEyeY, LookAtEyeZ,
                LookAtCenterX, LookAtCenterY, LookAtCenterZ,
                LookAtUpX, LookAtUpY, LookAtUpZ);

            checkSticksState();
            enableLightning();
            drawReflectedScene();

            // the world is moving (the helicopter always on 0,0,0), its looks like the helicopter is moving
            GL.glRotatef(m_yRotate, 0, 1, 0);
            GL.glTranslatef(m_xTranslate, m_yTranslate, m_zTranslate);

            m_skyscraper.Draw();

            // the skybox always keep the same distance from the helicopter, so it is not affected by translation
            GL.glTranslatef(-m_xTranslate, -m_yTranslate, -m_zTranslate);
            m_skyBox.Draw();

            // the helicopter is not affected by translation or rotation (first person view)
            GL.glRotatef(m_yRotate, 0, -1, 0);
            m_helicopter.Draw();

            drawShadows();

            GL.glFlush();
            WGL.wglSwapBuffers(m_uint_DC);
        }