Example #1
0
        /// <summary>
        /// link into render event.
        /// </summary>
        private void Render(object sender, EventArgs e)
        {
            // clear everything.
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit | ClearBufferMask.StencilBufferBit);

            // Render
            m_CurrentDemo.Render();

            // swap buffers
            m_EglHelper.SwapBuffers();

            // check for errors and calculate FPS
            DoRenderStats();
        }
Example #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("PI GLES Demo. Press q to quit");
            Console.WriteLine("Initialising Graphics");

            // initalise pi graphics
            int init = PIGLHelper.Initialise();

            if (init != 0)
            {
                Console.WriteLine("Failed to initialise GL ES context");
                return;
            }

            // redirect trace / debug messages to the console.
            ConsoleTraceListener ctl = new ConsoleTraceListener();

            System.Diagnostics.Trace.Listeners.Add(ctl);

            GL.ClearColor(0, 0, 1, 1);
            GL.Disable(EnableCap.CullFace);

            SetCurrentDemo('1');

            m_Stopwatch.Start();


            // loop until exit.
            while (!m_Exit)
            {
                GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

                m_CurrentDemo.Render();

                PIGLHelper.SwapBuffers();

                DoRenderStats();

                HandleKeyPress();
            }

            // finish
            PIGLHelper.Cleanup();
        }