示例#1
0
        private void button6_Click(object sender, EventArgs e)
        {
            FormGLTest formGLTest = new FormGLTest();

            formGLTest.InitMiniGLControl(800, 600);
            formGLTest.Show();
            formGLTest.WindowState = FormWindowState.Maximized;
        }
示例#2
0
        void listBox1_DoubleClick(object sender, EventArgs e)
        {
            //load sample form
            ExampleAndDesc exAndDesc = this.listBox1.SelectedItem as ExampleAndDesc;

            if (exAndDesc == null)
            {
                return; //early exit
            }
            //
            //
            switch ((RenderBackendChoice)lstBackEndRenderer.SelectedItem)
            {
            case RenderBackendChoice.PureAgg:
            {
                FormTestBed testBed = new FormTestBed();
                testBed.WindowState      = FormWindowState.Maximized;
                testBed.UseGdiPlusOutput = false;
                testBed.UseGdiAntiAlias  = chkGdiAntiAlias.Checked;
                testBed.Show();
                testBed.LoadExample(exAndDesc);
            }
            break;

            case RenderBackendChoice.GdiPlus:
            {
                FormTestBed testBed = new FormTestBed();
                testBed.WindowState      = FormWindowState.Maximized;
                testBed.UseGdiPlusOutput = true;
                testBed.UseGdiAntiAlias  = chkGdiAntiAlias.Checked;
                testBed.Show();
                testBed.LoadExample(exAndDesc);
            }
            break;

            case RenderBackendChoice.OpenGLES2:
            {
                //create demo
                DemoBase exBase = Activator.CreateInstance(exAndDesc.Type) as DemoBase;
                if (exBase == null)
                {
                    return;
                }

                //create form
                FormGLTest formGLTest = new FormGLTest();
                formGLTest.Text = exAndDesc.ToString();
                formGLTest.Show();
                //----------------------
                //get target control that used to present the example
                OpenTK.MyGLControl control = formGLTest.InitMiniGLControl(800, 600);

                {
                    GLDemoContextWinForm glbaseDemo = new GLDemoContextWinForm();
                    glbaseDemo.LoadGLControl(control);
                    glbaseDemo.LoadSample(exBase);
                    //----------------------
                    formGLTest.FormClosing += (s2, e2) =>
                    {
                        glbaseDemo.CloseDemo();
                    };
                }
                //{
                //    //test another example
                //    DemoBase exBase2 = Activator.CreateInstance(exAndDesc.Type) as DemoBase;
                //    OpenTK.MyGLControl control2 = formGLTest.InitMiniGLControl2(400, 300);
                //    GLDemoContextWinForm glbaseDemo = new GLDemoContextWinForm();
                //    glbaseDemo.LoadGLControl(control2);
                //    glbaseDemo.LoadSample(exBase2);
                //    //----------------------
                //    formGLTest.FormClosing += (s2, e2) =>
                //    {
                //        glbaseDemo.CloseDemo();
                //    };
                //}


                formGLTest.WindowState = FormWindowState.Maximized;
            }
            break;

#if SKIA_ENABLE
            case RenderBackendChoice.SkiaMemoryBackend:
            {
                TestSkia1.FormSkia1 formSkia = new TestSkia1.FormSkia1();
                formSkia.SelectBackend(TestSkia1.FormSkia1.SkiaBackend.Memory);
                formSkia.Show();
                formSkia.LoadExample(exAndDesc);
            }
            break;

            case RenderBackendChoice.SkiaGLBackend:
            {
                TestSkia1.FormSkia1 formSkia = new TestSkia1.FormSkia1();
                formSkia.SelectBackend(TestSkia1.FormSkia1.SkiaBackend.GLES);
                formSkia.Show();
                formSkia.LoadExample(exAndDesc);
            }
            break;
#endif
            default:
                throw new NotSupportedException();
            }
        }