Inheritance: IDisposable
コード例 #1
0
        private void Initialize()
        {
            Smaa = new Smaa();

            Shader = new GLShader(
                "attribute vec4 position; attribute vec4 texCoords; varying vec2 v_texCoord; void main() { gl_Position = position; v_texCoord = texCoords.xy; }",
                "uniform sampler2D texture; varying vec2 v_texCoord; void main() { gl_FragColor = texture2D(texture, v_texCoord); }"
            );

            VertexBuffer = GLBuffer.Create().SetData(CSharpPlatform.RectangleF.FromCoords(-1, -1, +1, +1).GetFloat2TriangleStripCoords());

            Shader.BindUniformsAndAttributes(ShaderInfo);

            // TestTexture = GLTexture.Create().SetFormat(TextureFormat.RGBA).SetSize(2, 2).SetData(new uint[] { 0xFF0000FF, 0xFF00FFFF, 0xFFFF00FF, 0xFFFFFFFF });
        }
コード例 #2
0
        private static void _MainData()
        {
            var Context = GLContextFactory.CreateWindowless().MakeCurrent();
            var BitmapIn = new Bitmap(Image.FromFile(@"C:\temp\test.png"));
            var Smaa = new Smaa();
            var TextureIn = GLTextureCreateFromBitmap(BitmapIn);
            var TextureOut = Smaa.Process(TextureIn, null);

            new Bitmap(BitmapIn.Width, BitmapIn.Height).SetChannelsDataInterleaved(TextureOut.GetDataFromGpu(), BitmapChannelList.RGBA).Save(@"c:\temp\test.out.png");

            File.WriteAllBytes(@"c:\temp\test.out.bin", TextureOut.GetDataFromGpu());
            Environment.Exit(0);
        }