Ejemplo n.º 1
0
        bool IGraphicsDeviceManager.BeginDraw()
        {
            if (GraphicsDevice == null)
            {
                return(false);
            }

            beginDrawOk = false;

            if (!CheckDeviceState())
            {
                return(false);
            }

            GraphicsDevice.Begin();

            // TODO GRAPHICS REFACTOR
            //// Before drawing, we should clear the state to make sure that there is no unstable graphics device states (On some WP8 devices for example)
            //// An application should not rely on previous state (last frame...etc.) after BeginDraw.
            //GraphicsDevice.ClearState();
            //
            //// By default, we setup the render target to the back buffer, and the viewport as well.
            //if (GraphicsDevice.BackBuffer != null)
            //{
            //    GraphicsDevice.SetDepthAndRenderTarget(GraphicsDevice.DepthStencilBuffer, GraphicsDevice.BackBuffer);
            //}

            beginDrawOk = true;
            return(beginDrawOk);
        }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);

            // TODO should we clear drawing context parameter collection at each frame?

            try
            {
                GraphicsDevice.Begin();

                GraphicsDevice.ClearState();

                if (GraphicsDevice.IsProfilingSupported)
                {
                    GraphicsDevice.EnableProfile(true);
                }

                // Draw recursively the Pipeline
                Draw(Pipeline, drawContext);
            }
            catch (Exception ex)
            {
                Log.Error("An exception occured while rendering", ex);
            }
            finally
            {
                GraphicsDevice.End();
            }
        }
Ejemplo n.º 3
0
        public void Draw()
        {
            device.Clear(Color.LightSlateGray);
            device.Begin();

            cube.Draw(scene);

            device.End();
        }
Ejemplo n.º 4
0
        private void UpdateScreen()
        {
            device.Clear(Color.White);
            device.Begin();

            foo.Draw(scene);
            bar.Draw(scene);
            selectionCursor.Draw(scene);
            highlightingCursor.Draw(scene);

            labelPolygons.Text = device.PolygonsCount.ToString();
            device.End();
        }