Example #1
0
 void Toggle()
 {
     if (camera.RenderBuffer != 0)
     {
         ppSh.ClearColorBuffer = false;
         camera.Background     = backgroundBackup;
         camera.RenderBuffer   = 0;
     }
     else
     {
         ppSh.ClearColorBuffer = true;
         backgroundBackup      = camera.Background;
         camera.Background     = null;
         camera.RenderBuffer   = renderBufferId;
     }
 }
Example #2
0
        void Update()
        {
            if (width != camera.Width || height != camera.Height)
            {
                width  = camera.Width;
                height = camera.Height;
                renderBuffer.OnResize(width, height);
                form.Width  = camera.Width;
                form.Height = camera.Height;
                ppSh.OnResize(width, height);
                imageBitmap.Dispose();
                imageBitmap = new Bitmap(width, height);
            }

            var keyState = GLWindow.gLWindow.KeyboardState;

            if (keyState.IsKeyPressed(OpenTK.Windowing.GraphicsLibraryFramework.Keys.B) && !keyPressed)
            {
                if (camera.RenderBuffer != 0)
                {
                    ppSh.ClearColorBuffer = false;
                    camera.Background     = backgroundBackup;
                    camera.RenderBuffer   = 0;
                    form.Hide();
                }
                else
                {
                    ppSh.ClearColorBuffer = true;
                    backgroundBackup      = camera.Background;
                    camera.Background     = null;
                    camera.RenderBuffer   = renderBufferId;
                    form.Show();
                }

                keyPressed = true;
            }

            if (!keyState.IsKeyPressed(OpenTK.Windowing.GraphicsLibraryFramework.Keys.B) && keyPressed)
            {
                keyPressed = false;
            }
        }