Esempio 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
                }
            }
            ;
        }
Esempio n. 2
0
 internal static void SetVertexAttributeArray(bool[] attrs)
 {
     for (int i = 0; i < attrs.Length; i++)
     {
         bool contains = EnabledVertexAttributes.Contains(i);
         if (attrs[i] && !contains)
         {
             EnabledVertexAttributes.Add(i);
             GL.EnableVertexAttribArray(i);
             GL.CheckError();
         }
         else if (!attrs[i] && contains)
         {
             EnabledVertexAttributes.Remove(i);
             GL.DisableVertexAttribArray(i);
             GL.CheckError();
         }
     }
 }