示例#1
0
        public void Run(IGuiExternalInterface IGuiExternalInterface)
        {
            CommonGuiDisplayOpengl     = new CommonGuiDisplayOpengl(IGuiExternalInterface, this);
            CommonGuiInput             = new CommonGuiInput(IGuiExternalInterface);
            this.IGuiExternalInterface = IGuiExternalInterface;
            //var Window = new Window("Hello world!");
            Application.Init();
            Window                = new Window("Soywiz's Psp Emulator");
            this.GLWidget         = new GLWidget(OpenglGpuImpl.UsedGraphicsMode);
            Window.WindowPosition = WindowPosition.Center;
            Window.SetSizeRequest(480, 272);
            Window.Child          = GLWidget;
            GLWidget.RenderFrame += GLWidget_RenderFrame;
            GLWidget.SetSizeRequest(480, 272);
            //GLWidget.ShowAll();
            Window.Removed         += Window_Removed;
            Window.KeyPressEvent   += Window_KeyPressEvent;
            Window.KeysChanged     += Window_KeysChanged;
            Window.KeyReleaseEvent += Window_KeyReleaseEvent;

            Window.ShowAll();

            //GLWidget.KeyPressEvent += Window_KeyPressEvent;
            //GLWidget.KeyReleaseEvent += Window_KeyReleaseEvent;

            PspDisplay.DrawEvent += PspDisplay_DrawEvent;

            OpenOpenDialog();
            CommonGuiInput.ReLoadControllerConfig();

            Application.Run();
        }
        public OpenGLView()
        {
            if (!GtkOpenGL.IsInitialized)
            {
                throw new InvalidOperationException("call GtkOpenGL.Init() before use OpenGLView");
            }

            GraphicsMode graphicsMode = GraphicsMode.Default;

            _glWidget = new GLWidget(GraphicsMode.Default);

            _glWidget.SingleBuffer         = true;
            _glWidget.ColorBPP             = graphicsMode.ColorFormat.BitsPerPixel;
            _glWidget.AccumulatorBPP       = graphicsMode.AccumulatorFormat.BitsPerPixel;
            _glWidget.DepthBPP             = graphicsMode.Depth;
            _glWidget.Samples              = graphicsMode.Samples;
            _glWidget.StencilBPP           = graphicsMode.Stencil;
            _glWidget.Stereo               = graphicsMode.Stereo;
            _glWidget.GlVersionMajor       = 2;
            _glWidget.GlVersionMinor       = 1;
            _glWidget.CanFocus             = true;
            _glWidget.GraphicsContextFlags = GraphicsContextFlags.Default;

            _glWidget.Initialized += new EventHandler(OnGLWidgetInitialized);
            _glWidget.RenderFrame += new EventHandler(OnGLWidgetRenderer);
            _glWidget.Destroyed   += new EventHandler(OnGLWidgetDestroy);

            _glWidget.AddEvents((int)Gdk.EventMask.AllEventsMask);

            Add(_glWidget);

            _glWidget.ShowAll();
        }
示例#3
0
        public GladeExample()
        {
            // Load the file glwidget.glade and collect all the objects starting from
            // the specified "glwidget" root. This is the name of the Window in the
            // glade file.
            Glade.XML gxml = new Glade.XML(null, "glwidget.glade", "glwidget", null);

            // Connect the Signals defined in Glade. Also connect any matching names
            // of objects to properties of the object specified ('this') that are marked
            // with the [Widget] attribute. In turn this makes this.glwidget get assigned
            // to the glwidget Gtk.Window object.
            gxml.Autoconnect(this);

            // Create a new glw widget and request a size.
            glw = new GLWidget();

            // Create a new Vertical Box that the glw can live in.
            VBox vb = (Gtk.VBox)gxml["vbox1"];

            // Pack the glw widget into the VBox.
            vb.PackStart (glw);

            // Create a new clickable button.
            Button butModal = new Button();
            butModal.Label = "Press For Modal!";
            butModal.Clicked += new EventHandler(butModal_Clicked);

            // Stick the button into the vbox.
            vb.PackStart(butModal);
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Everlook.Viewport.ViewportRenderer"/> class.
        /// </summary>
        public ViewportRenderer(GLWidget viewportWidget)
        {
            this.ViewportWidget = viewportWidget;
            this.Camera         = new ViewportCamera();
            this.Movement       = new CameraMovement(this.Camera);

            this.IsInitialized = false;
        }
示例#5
0
        public VisualizationDisplayWidget()
        {
            visualizationMenu        = new Menu();
            noVisualizationsMenuItem = new MenuItem(
                AddinManager.CurrentLocalizer.GetString("No visualizations installed"));
            noVisualizationsMenuItem.Sensitive = false;
            noVisualizationsMenuItem.Show();
            visualizationMenu.Add(noVisualizationsMenuItem);

            glWidget = new GLWidget();
            glWidget.DoubleBuffered = true;
            glWidget.Render        += OnRender;
            glWidget.SizeAllocated += OnGlSizeAllocated;
            glWidget.Show();

            Add(glWidget);
            Show();

            playerData        = new BansheePlayerData(ServiceManager.PlayerEngine.ActiveEngine);
            playerData.Active = false;

            glWidget.Realized += delegate {
                if (!loopRunning)
                {
                    loopRunning  = true;
                    renderThread = new Thread(RenderLoop);
                    renderThread.Start();
                }

                ConnectVisualization();
            };

            glWidget.Unrealized += delegate {
                DisposeRenderer();
            };

            AddinManager.AddExtensionNodeHandler("/Banshee/OpenVP/Visualization", OnVisualizationChanged);

            InterfaceActionService ias = ServiceManager.Get <InterfaceActionService>();

            ias.GlobalActions.AddImportant(new ActionEntry(SELECT_VIS_ACTION,
                                                           null,
                                                           AddinManager.CurrentLocalizer.GetString("Select visualization"),
                                                           null, null,
                                                           OnSelectVisualizationClicked));

            ias.GlobalActions.AddImportant(new ToggleActionEntry(LOW_RES_ACTION,
                                                                 null,
                                                                 AddinManager.CurrentLocalizer.GetString("Low resolution"),
                                                                 null, null,
                                                                 OnHalfResolutionToggled, false));

            ias.GlobalActions.UpdateAction(SELECT_VIS_ACTION, false);
            ias.GlobalActions.UpdateAction(LOW_RES_ACTION, false);

            global_ui_id = ias.UIManager.AddUiFromResource("ActiveSourceUI.xml");
        }
示例#6
0
        public GladeExample()
        {
            Glade.XML gxml = new Glade.XML (null, "glwidget.glade", "glwidget", null);

            // Connect the Signals defined in Glade
            gxml.Autoconnect (this);

            // Create a new glw widget and request a size
            glw = new GLWidget ();

            // Create a new Vertical Box that the glw can live in
            VBox vb = (Gtk.VBox)gxml["vbox1"];

            // Pack the glw widget into the VBox
            vb.PackStart (glw);

            window = (Gtk.Window)gxml["glwidget"];
        }
        public VisualizationDisplayWidget()
        {
            Stetic.BinContainer.Attach(this);

            BuildHeaderExtension();

            this.visualizationList.Model = this.visualizationStore;

            CellRendererText text = new CellRendererText();

            this.visualizationList.PackStart(text, true);
            this.visualizationList.SetCellDataFunc(text, VisualizationCellDataFunc);

            this.glWidget = new GLWidget();
            this.glWidget.DoubleBuffered = true;
            this.glWidget.Render        += this.OnRender;
            this.glWidget.SizeAllocated += this.OnGlSizeAllocated;
            this.glWidget.Show();

            this.Add(this.glWidget);
            this.Show();

            this.playerData        = new BansheePlayerData(ServiceManager.PlayerEngine.ActiveEngine);
            this.playerData.Active = false;

            this.glWidget.Realized += delegate {
                if (!this.loopRunning)
                {
                    this.loopRunning  = true;
                    this.RenderThread = new Thread(this.RenderLoop);
                    this.RenderThread.Start();
                }

                this.ConnectVisualization();
            };

            this.glWidget.Unrealized += delegate {
                this.DisposeRenderer();
            };

            AddinManager.AddExtensionNodeHandler("/Banshee/OpenVP/Visualization", this.OnVisualizationChanged);
        }
示例#8
0
        protected MainWindow(Builder builder, IntPtr handle)
            : base(handle)
        {
            builder.Autoconnect(this);
            DeleteEvent += OnDeleteEvent;

            this.GLInit = false;
            ResetCamera();

            OpenTK.Toolkit.Init();

            this.MainGLWidget = new GLWidget(GraphicsMode.Default)
            {
                CanFocus             = true,
                SingleBuffer         = false,
                ColorBPP             = 24,
                DepthBPP             = 24,
                Samples              = 4,
                GLVersionMajor       = 3,
                GLVersionMinor       = 3,
                GraphicsContextFlags = GraphicsContextFlags.ForwardCompatible | GraphicsContextFlags.Debug,
                IsRenderHandler      = true
            };

            this.MainGLWidget.Events |=
                EventMask.ButtonPressMask |
                EventMask.ButtonReleaseMask |
                EventMask.KeyPressMask |
                EventMask.KeyReleaseMask;

            this.MainGLWidget.Initialized        += OnViewportInitialized;
            this.MainGLWidget.ButtonPressEvent   += OnViewportButtonPressed;
            this.MainGLWidget.ButtonReleaseEvent += OnViewportButtonReleased;
            this.MainGLWidget.KeyPressEvent      += OnViewportKeyPressed;
            this.MainGLWidget.KeyReleaseEvent    += OnViewportKeyReleased;

            // Add the GL widget to the UI
            this.GLWidgetAlignment.Add(this.MainGLWidget);
            this.GLWidgetAlignment.ShowAll();
        }
    public Engine(string[] args)
    {
        Application.Init ();

        // Create a new GL widget
        glw = new GLWidget();

        glw.GLSetup += GtkGL.GLWidget.EnableLighting;

           		// Create a new Teapot object
        GtkGL.OldTeapot teapot = new OldTeapot();

        // Create a controller that manages rotation of the Teapot object
        controller = new GLObjectRotationController(teapot);

        // Add our Teapot object to the GLWidget's list of associated GLObjects
        glw.AddGLObject( teapot );

        // Read in the glade file that describes the widget layout
        Glade.XML gxml = new Glade.XML (null, "glwidget.glade", "glwidget", null);

        // Connect the Signals defined in Glade
        gxml.Autoconnect ( glw );

        // Pack the gl window into the vbox
        Gtk.VBox vbox1 = (Gtk.VBox)gxml["vbox1"];
        vbox1.PackStart ( glw );

        // Show the GL widget
        Gtk.Window window = (Gtk.Window)gxml["glwidget"];
        window.Show();

        // Show the GL widget
        glw.Show();

        // Go dog, go!
        Application.Run ();
    }