Exemplo n.º 1
0
        public static Texture1D LoadFromBytes(GraphicsContext graphics, byte[] bytes, int length, TextureParams parameters)
        {
            if (graphics == null)
                throw new ArgumentNullException("graphics");

            if (bytes == null)
                throw new ArgumentNullException("bytes");

            Texture1D texture = new Texture1D(graphics);

            Texture.Initialize(texture, graphics, GLContext.Texture1D, bytes, parameters);

            graphics.GL.TexImage1D(
                GLContext.Texture1D,
                0,
                (int)GLContext.Rgba8,
                length,
                0,
                GLContext.Rgba,
                (int)GLContext.UnsignedByte,
                bytes);

            texture.Length = length;

            return texture;
        }
Exemplo n.º 2
0
        public FractalSample()
        {
            this.Window.Title = "Fractals";

            this.shaderProgram = new ShaderProgram(
                this.Graphics,
                VertexShader.Compile(this.Graphics, File.ReadAllText("Mandelbrot.vert")),
                FragmentShader.Compile(this.Graphics, File.ReadAllText("Mandelbrot.frag")));

            this.Graphics.ShaderProgram = this.shaderProgram;

            this.vertexBuffer = new StaticVertexBuffer<Vertex>(this.Graphics, this.vertexData);

            this.palette = Texture1D.LoadFromFile(this.Graphics, "Palette.png", new TextureParams()
                {
                    WrapS = TextureWrap.Repeat,
                    WrapT = TextureWrap.Repeat
                });

            this.keyboard = new Keyboard();
        }