Esempio n. 1
0
        public DynamicTexture(Context context, Format format, Vector4i size)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (format == null)
            {
                throw new ArgumentNullException("format");
            }
            this.format      = format;
            this.frameBuffer = new FrameBuffer();
            this.mainProgram = new Program();
            this.dimensions  = size;

            var builder = ShaderBuilder.CreateFromAssemblyResource("Glare.Graphics.Shaders.DynamicTexture.glsl");

            mainProgram.Shaders.AddRange(
                builder.VertexShader("Common", "Vertex"),
                builder.FragmentShader("Common", "Fragment"));
            mainProgram.MustLink();
            mainProgramAction = mainProgram.FragmentStage.Uniforms["Act"];
            mainProgram.Attributes["Position"].BindArray(new Vector2f[] {
                new Vector2f(-1, 1), new Vector2f(-1, -1),
                new Vector2f(1, 1), new Vector2f(1, -1)
            });
        }
Esempio n. 2
0
        public DynamicTexture(Context context, Format format, Vector4i size)
        {
            if (context == null)
                throw new ArgumentNullException("context");
            if (format == null)
                throw new ArgumentNullException("format");
            this.format = format;
            this.frameBuffer = new FrameBuffer();
            this.mainProgram = new Program();
            this.dimensions = size;

            var builder = ShaderBuilder.CreateFromAssemblyResource("Glare.Graphics.Shaders.DynamicTexture.glsl");
            mainProgram.Shaders.AddRange(
                builder.VertexShader("Common", "Vertex"),
                builder.FragmentShader("Common", "Fragment"));
            mainProgram.MustLink();
            mainProgramAction = mainProgram.FragmentStage.Uniforms["Act"];
            mainProgram.Attributes["Position"].BindArray(new Vector2f[] {
                new Vector2f(-1, 1), new Vector2f(-1, -1),
                new Vector2f(1, 1), new Vector2f(1, -1) });
        }