예제 #1
0
 private void PrepareForDispatch()
 {
     if (_unit0Texture != null)
     {
         _unit0Texture.Bind(0);
     }
 }
예제 #2
0
        public void Draw(
            TextureView texture,
            Sampler sampler,
            float x0,
            float y0,
            float x1,
            float y1,
            float s0,
            float t0,
            float s1,
            float t1)
        {
            EnsureInitialized();

            GL.UseProgram(_programHandle);

            texture.Bind(0);
            sampler.Bind(0);

            if (x0 > x1)
            {
                float temp = s0;
                s0 = s1;
                s1 = temp;
            }

            if (y0 > y1)
            {
                float temp = t0;
                t0 = t1;
                t1 = temp;
            }

            GL.Uniform1(_uniformSrcX0Location, s0);
            GL.Uniform1(_uniformSrcY0Location, t0);
            GL.Uniform1(_uniformSrcX1Location, s1);
            GL.Uniform1(_uniformSrcY1Location, t1);

            GL.ViewportIndexed(0, MathF.Min(x0, x1), MathF.Min(y0, y1), MathF.Abs(x1 - x0), MathF.Abs(y1 - y0));

            GL.DrawArrays(PrimitiveType.TriangleStrip, 0, 4);
        }