UnityEngine.GL.Clear C# (CSharp) Method

Clear() public static method

Clear the current render buffer.

public static Clear ( bool clearDepth, bool clearColor, UnityEngine backgroundColor, [ depth ) : void
clearDepth bool Should the depth buffer be cleared?
clearColor bool Should the color buffer be cleared?
backgroundColor UnityEngine The color to clear with, used only if clearColor is true.
depth [ The depth to clear Z buffer with, used only if clearDepth is true.
return void
        public static void Clear(bool clearDepth, bool clearColor, UnityEngine.Color backgroundColor, [DefaultValue("1.0f")] float depth)
        {
            Internal_Clear(clearDepth, clearColor, backgroundColor, depth);
        }

Same methods

GL::Clear ( bool clearDepth, bool clearColor, UnityEngine backgroundColor ) : void

Usage Example

コード例 #1
0
        internal bool DoRenderIfNeed(Camera camera, Renderer renderer)
        {
            SizeI size;

            if (!NeedsUpdate ||
                Unity_RenderManager.Instance == null ||
                (size = Size).IsEmpty)
            {
                return(false);
            }


            NeedsUpdate = false;

            m_LastRenderTime = Alt.IntervalTimer.Ticks;

            m_FPSCounter.Tick();


            if (RenderType == Alt.Sketch.Rendering.RenderType.Software)
            {
                if (!(m_Texture is Texture2D))
                {
                    KillTextures();
                }

                if (m_Texture != null &&
                    (m_Texture.width != size.Width ||
                     m_Texture.height != size.Height))
                {
                    m_Texture = null;
                }

                if (m_Texture == null)
                {
                    m_Texture = new Texture2D(
                        size.Width, size.Height,
                        Unity_RenderManager.ToTextureFormat(PixelFormat.Format32bppArgb),
                        false);
                    m_Texture.filterMode = FilterMode.Point;

                    RefreshMaterial();
                }

                Bitmap backBuffer            = SoftwareBackBuffer;
                Alt.Sketch.Graphics graphics = Alt.Sketch.Graphics.FromImage(backBuffer);

                //graphics.Clear(Alt.Sketch.Color.FromArgb(0, 128, 128, 128));
                graphics.Clear(Alt.Sketch.Color.FromArgb(0, 0, 0, 0));

                DoPaintInternal(new Alt.GUI.PaintEventArgs(graphics, new Alt.Sketch.Rect(0, 0, size)));

                Unity_RenderManager.SetTextureData(m_Texture as Texture2D, backBuffer, backBuffer.PixelRectangle, true);
            }
            else
            {
                if (m_RenderTexture != null &&
                    (m_RenderTexture.width != size.Width ||
                     m_RenderTexture.height != size.Height))
                {
                    KillTextures();
                }

                if (m_RenderTexture == null)
                {
                    m_RenderTexture = new RenderTexture(
                        size.Width, size.Height,
                        0,
                        Unity_RenderManager.ToRenderTextureFormat(PixelFormat.Format32bppArgb));
                    m_RenderTexture.filterMode = FilterMode.Point;

                    m_Texture = m_RenderTexture;

                    RefreshMaterial();
                }

                if (m_RenderTexture != null)
                {
                    RenderTexture oldRenderTexture = RenderTexture.active;
                    RenderTexture.active = m_RenderTexture;
                    try
                    {
                        GL.Clear(true, true, Unity_RenderManager.ToColor(Alt.Sketch.Color.Empty));

                        if (m_Renderer == null)
                        {
                            m_Renderer = new Unity_Renderer(Unity_RenderManager.Instance);
                            m_Renderer.DefaultSmoothingMode = Alt.Sketch.SmoothingMode.None;
                        }

                        m_Renderer.BeginRender(camera, renderer, size.Width, size.Height, true);
                        {
                            Alt.Sketch.Graphics graphics = Alt.Sketch.Graphics.FromRenderer(m_Renderer);
                            if (graphics != null)
                            {
                                DoPaintInternal(new Alt.GUI.PaintEventArgs(graphics, new Alt.Sketch.Rect(0, 0, size)));
                            }
                        }
                        m_Renderer.EndRender();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
                    finally
                    {
                        RenderTexture.active = oldRenderTexture;
                    }
                }
            }

            return(true);
        }
All Usage Examples Of UnityEngine.GL::Clear