Ejemplo n.º 1
0
        private void PlatformInitialize()
        {
            _viewport = new Viewport(
                0, 0, PresentationParameters.BackBufferWidth, PresentationParameters.BackBufferHeight);

            // Ensure the vertex attributes are reset
            EnabledVertexAttributes.Clear();

            // Free all the cached shader programs.
            _programCache.Clear();
            _shaderProgram = null;

            _framebufferHelper = FramebufferHelper.Create(this);

            // Force resetting states
            PlatformApplyBlend(true);
            DepthStencilState.PlatformApplyState(this, true);
            RasterizerState.PlatformApplyState(this, true);

            _bufferBindingInfos = new BufferBindingInfo[_maxVertexBufferSlots];
            for (int i = 0; i < _bufferBindingInfos.Length; i++)
            {
                _bufferBindingInfos[i] = new BufferBindingInfo {
                    Vbo = default
                }
            }
            ;
        }
Ejemplo n.º 2
0
        private void PlatformInitialize()
        {
            _viewport = new Viewport(0, 0, PresentationParameters.BackBufferWidth, PresentationParameters.BackBufferHeight);

            // Ensure the vertex attributes are reset
            _enabledVertexAttributes.Clear();

            // Free all the cached shader programs.
            _programCache.Clear();
            _shaderProgram = null;

            if (GraphicsCapabilities.SupportsFramebufferObjectARB)
            {
                this.framebufferHelper = new FramebufferHelper(this);
            }
            #if !(GLES || MONOMAC)
            else if (GraphicsCapabilities.SupportsFramebufferObjectEXT)
            {
                this.framebufferHelper = new FramebufferHelperEXT(this);
            }
            #endif
            else
            {
                throw new PlatformNotSupportedException(
                          "MonoGame requires either ARB_framebuffer_object or EXT_framebuffer_object." +
                          "Try updating your graphics drivers.");
            }

            // Force reseting states
            this.BlendState.PlatformApplyState(this, true);
            this.DepthStencilState.PlatformApplyState(this, true);
            this.RasterizerState.PlatformApplyState(this, true);
        }
Ejemplo n.º 3
0
 public static FramebufferHelper Create(GraphicsDevice gd)
 {
     if (gd.GraphicsCapabilities.SupportsFramebufferObjectARB)
     {
         _instance = new FramebufferHelper(gd);
     }
     else
     {
     }
     return(_instance);
 }
            public static FramebufferHelper Create(GraphicsDevice gd)
            {
                if (gd.GraphicsCapabilities.SupportsFramebufferObjectARB || gd.GraphicsCapabilities.SupportsFramebufferObjectEXT)
                {
                    _instance = new FramebufferHelper(gd);
                }
                else
                {
                    throw new PlatformNotSupportedException(
                              "MonoGame requires either ARB_framebuffer_object or EXT_framebuffer_object." +
                              "Try updating your graphics drivers.");
                }

                return(_instance);
            }
Ejemplo n.º 5
0
        /// <summary>
        /// 图形平台初始化
        /// </summary>
        private void PlatformInitialize()
        {
            _viewport = new Viewport(0, 0, PresentationParameters.BackBufferWidth, PresentationParameters.BackBufferHeight);
            _enabledVertexAttributes.Clear();
            _programCache.Clear();
            _shaderProgram = null;
            //if (GraphicsCapabilities.SupportsFramebufferObjectARB)
            //{
            //    framebufferHelper = new FramebufferHelper(this);
            //}
            framebufferHelper = FramebufferHelper.Create(this);

            //Force resetting states
            this.PlatformApplyBlend(true);
            this.DepthStencilState.PlatformApplyState(this, true);
            this.RasterizerState.PlatformApplyState(this, true);

            _maxVertexBufferSlots = 1;
        }
Ejemplo n.º 6
0
        private void PlatformInitialize()
        {
            _viewport = new Viewport(0, 0, PresentationParameters.BackBufferWidth, PresentationParameters.BackBufferHeight);

            // Ensure the vertex attributes are reset
            _enabledVertexAttributes.Clear();

            // Free all the cached shader programs.
            _programCache.Clear();
            _shaderProgram = null;

            framebufferHelper = FramebufferHelper.Create(this);

            // Force resetting states
            this.PlatformApplyBlend(true);
            this.DepthStencilState.PlatformApplyState(this, true);
            this.RasterizerState.PlatformApplyState(this, true);

            // TODO: Add support for multiple vertex buffers (SetVertexBuffers).
            _maxVertexBufferSlots = 1;
        }