Exemplo n.º 1
0
        public TestBench() : base(GameWindowSettings.Default, new NativeWindowSettings
        {
            Size       = new Vector2i(800, 600),
            APIVersion = new Version(4, 5),
            API        = OpenTK.Windowing.Common.ContextAPI.OpenGL,
            Profile    = ContextProfile.Compatability,
            Flags      = ContextFlags.Default
        })
            //base(
            //     800, 600,
            //     GraphicsMode.Default, "OpenTKExtensions TestBench",
            //     GameWindowFlags.Default, DisplayDevice.Default,
            //     4, 5, GraphicsContextFlags.ForwardCompatible
            //    )
        {
            VSync = VSyncMode.Off;

            // set static loader
            ShaderProgram.DefaultLoader = new OpenTKExtensions.Loaders.MultiPathFileSystemLoader(SHADERPATH);


            Load        += TestBench_Load;
            Unload      += TestBench_Unload;
            UpdateFrame += TestBench_UpdateFrame;
            RenderFrame += TestBench_RenderFrame;
            Resize      += TestBench_Resize;

            components.Add(font = new Font("Resources/Fonts/consolab.ttf_sdf_512.png", "Resources/Fonts/consolab.ttf_sdf_512.txt"));



            components.Add(renderTarget = new RenderTargetBase(false, false, 512, 512)
            {
                DrawOrder = 1
            });
            renderTarget.Loading += (s, e) =>
            {
                renderTarget.SetOutput(0, new TextureSlotParam(TextureTarget.Texture2D, PixelInternalFormat.Rgba32f, PixelFormat.Rgba, PixelType.Float, false,
                                                               Texture.Params().FilterNearest().Repeat().ToArray()
                                                               ));
            };
            renderTarget.Add(testcomp2 = new TestComponent2());

            components.Add(testcomp1 = new TestComponent()
            {
                DrawOrder = 2
            });
            testcomp1.PreRender += (s, e) => { testcomp1.tex2 = renderTarget.GetTexture(0); };


            //components.Add(new OperatorComponentTest());

            components.Add(new FrameCounter(font)
            {
                LoadOrder = 2, DrawOrder = 3
            });

            timer.Start();
        }
 private void BindRenderTargetFull(RenderTargetBase rt)
 {
     BindRenderTargetFull(RtToLoaded(rt));
 }
 private LoadedRenderTarget RtToLoaded(RenderTargetBase rt)
 {
     return(_renderTargets[rt.Handle]);
 }
Exemplo n.º 4
0
 public override void ClearRenderTarget(RenderTargetBase renderTarget, float r, float g, float b, float a)
 {
     throw new NotImplementedException();
 }