Exemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad (e);

            String version = GL.GetString(StringName.Version);
            Console.WriteLine("GL version: " + version);

            context = GLGraphics.NewContext(Context, true);

            program = context.NewProgramFromFiles("Render.vert", "Render.frag");

            texture0 = context.NewTexture(TextureMinFilter.Nearest, TextureMagFilter.Nearest, TextureWrapMode.Clamp, TextureWrapMode.Clamp);
            texture0.UploadImage(sourceImage);
            sourceImage.Dispose();

            texture1 = context.NewTexture(TextureMinFilter.Nearest, TextureMagFilter.Nearest, TextureWrapMode.Clamp, TextureWrapMode.Clamp);
            texture1.UploadImage(new byte[4 * 4 * 4], 4, 4, PixelInternalFormat.Four, PixelFormat.Rgba, PixelType.UnsignedByte);

            CreateAndFillBuffers();
            paramSpec = ImmutableList<Tuple<String, Object>>.List(new Tuple<String, Object>[] {
                Tuple.Create<String, Object>("a_position", positions),
                Tuple.Create<String, Object>("a_texPos", textureCoords),
                Tuple.Create<String, Object>("u_texture0", texture0),
                Tuple.Create<String, Object>("u_texture1", texture1)});
        }