protected override void OnRenderFrame(FrameEventArgs e)
        {
            GL.Clear(ClearBufferMask.ColorBufferBit);

            _spriteShader.Begin();
            if (Graph != null)
            {
                Graph.Render(_spriteShader);
            }
            _spriteShader.End();

            SwapBuffers();
        }
Пример #2
0
        /*
         * private void OnChunkEvent( object sender, ChunkEventArgs e )
         * {
         *  if ( myClosing )
         *      return;
         *
         *  if ( e.EventType == ChunkEventType.Loaded )
         *  {
         *      ChunkRenderer renderer = new ChunkRenderer( e.Chunk );
         *      renderer.UpdateVertices( myGeoShader );
         *
         *      Monitor.Enter( myGeoRenderers );
         *      myGeoRenderers.Add( renderer );
         *      Monitor.Exit( myGeoRenderers );
         *  }
         *  else
         *  {
         *      Monitor.Enter( myGeoRenderers );
         *      ChunkRenderer renderer = myGeoRenderers.Find( x => x.Chunk == e.Chunk );
         *      if ( e.EventType == ChunkEventType.Unloaded )
         *          myGeoRenderers.Remove( renderer );
         *      Monitor.Exit( myGeoRenderers );
         *      if ( e.EventType == ChunkEventType.Changed )
         *          renderer.UpdateVertices( myGeoShader );
         *  }
         * }
         */

        protected override void OnRenderFrame(FrameEventArgs e)
        {
            GL.Clear(ClearBufferMask.ColorBufferBit);
            GL.Clear(ClearBufferMask.DepthBufferBit);

            /*
             * myGeoShader.StartBatch();
             * Monitor.Enter( myGeoRenderers );
             * foreach( ChunkRenderer renderer in myGeoRenderers )
             *  renderer.Render( myGeoShader );
             * Monitor.Exit( myGeoRenderers );
             * myGeoShader.EndBatch();
             */

            mySpriteShader.Begin();
            myUIRoot.Render(mySpriteShader);
            mySpriteShader.End();

            SwapBuffers();

            myTotalFrameTime += myFrameTimer.ElapsedTicks;
            ++myFramesCompleted;
            myFrameTimer.Restart();
        }