예제 #1
0
        private void BlendBuffer_Loading(object sender, EventArgs e)
        {
            vertexVBO = ScreenTri.Vertices().ToVBO();
            indexVBO  = ScreenTri.Indices().ToVBO();

            this.sourcegbuffer.SetSlot(0, new GBuffer.TextureSlotParam(TextureTarget.Texture2D, PixelInternalFormat.Rgba, PixelFormat.Rgba, PixelType.UnsignedByte, false, new List <ITextureParameter>
            {
                new TextureParameterInt(TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear),
                new TextureParameterInt(TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear),
                new TextureParameterInt(TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge),
                new TextureParameterInt(TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge)
            }));
            this.sourcegbuffer.Init(this.Width, this.Height);

            InitTextures();

            this.destinationgbuffer.SetSlot(0, frame[0]);
            this.destinationgbuffer.Init(this.Width, this.Height);

            this.gbufferCombiner = new GBufferCombiner(this.sourcegbuffer);
            this.Reload();
        }
예제 #2
0
        //public Func<Texture> GetTex2 { get; set; } = null;

        public TestComponent()
        {
            Resources.Add("tex1", tex1 = @"Resources/Textures/tex1.png".LoadImageToTextureRgba());

            Resources.Add(shader = new ReloadableResource <ShaderProgram>("p1r", () => new ShaderProgram(
                                                                              "p1",
                                                                              "vertex",
                                                                              "",
                                                                              true,
                                                                              "testshader.glsl|vert",
                                                                              "testshader.glsl|frag"
                                                                              ), (s) => new ShaderProgram(s)));

            Resources.Add(vertexBuffer = BufferObject <Vector3> .CreateVertexBuffer("vbuf", ScreenTri.Vertices().ToArray()));
            Resources.Add(indexBuffer  = BufferObject <uint> .CreateIndexBuffer("ibuf", ScreenTri.Indices().ToArray()));

            ModelMatrix      = Matrix4.CreateTranslation(0.0f, 0.0f, -0.1f);
            ProjectionMatrix = Matrix4.CreateOrthographicOffCenter(0.0f, 1.0f, 0.0f, 1.0f, 0.001f, 2.0f);
        }