Exemplo n.º 1
0
        public void Draw(StateSetGL stateSetGL)
        {
            stateSetGL.BackfaceCulling = BackfaceCulling;
            stateSetGL.ShaderPointSize = ShaderPointSize;
            stateSetGL.ZBufferTest     = ZBufferTest;
            stateSetGL.Shader          = Shader;

            BindTextures();
            ActivateBuffers();

            var vao = Vao;

            if (ReferenceEquals(null, vao))
            {
                if (1 == InstanceCount)
                {
                    GL.DrawArrays(PrimitiveType.Quads, 0, 4);                     //todo: make this general -> mesh with only vertex count? particle system, sprites
                }
                else
                {
                    GL.DrawArrays(PrimitiveType.Points, 0, InstanceCount);
                }
            }
            else
            {
                Vao.Draw(InstanceCount);
            }

            DeactivateBuffers();
            UnbindTextures();
        }
Exemplo n.º 2
0
 public Image(bool hasDepthBuffer = false)
 {
     if (ReferenceEquals(null, stateSetGL))
     {
         stateSetGL = new StateSetGL();
     }
     if (hasDepthBuffer)
     {
         actionClear = () => GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
     }
     else
     {
         actionClear = () => GL.Clear(ClearBufferMask.ColorBufferBit);
     }
 }