Re: gtk drawing area with gtkglext and glade3
Tristan Van Berkom <[email protected]> Thu, 6 Sep 2012 04:36:24 +0900
| Newsgroups | gmane.comp.gnome.glade.user |
|---|---|
| Message-ID | <CAGUy9WJuhUnek2nNkY6ABub8M=HofJrRag-pttGs3AQGv6Fw8w@mail.gmail.com> |
On Thu, Sep 6, 2012 at 4:25 AM, Tristan Van Berkom <[email protected]> wrote: > On Thu, Sep 6, 2012 at 4:07 AM, Roland Graham <[email protected]> wrote: >> Please help. I have an application that was using glade2 and I am >> trying to convert it to glade3. It has four gtk_drawingareas configured >> inside a main window. With glade2 I was able to initialize these >> drawing areas with gtk_drawingarea_new and the areas were realized and >> everything worked fine. >> >> Under glade3, I do not know how to call the drawingarea_new function, >> as they are created inside the gtk_builder_add_from_file function as >> g_objects. When I call the gtk_widget_set_gl_capability function after >> creating glconfig[i] with gdk_gl_config_new_by_mode, it fails because >> the drawing area has not been realized. Is there a way to realize these >> drawing areas after they have been set up? I can create my own drawing >> areas and the set_gl_capability function works ok, but then how do I >> connect them to the widget structure? >> >> I am an engineer and program only to do various chores, so I am only >> semi-fluent in these things. Please help! > > Its not entirely clear to me what is the order of events needed, when you > say realize /after being setup/ you only mean, after creating the drawing > areas ? and before doing the GtkGLExt magic on them ? > > The best way to do this I think would be to subclass GtkDrawingArea > and override the ->realize() method on your custom GtkGLExtDrawingArea > widget class, then you would chain up before calling the custom gl stuff > you need. This would work in a reliable and centralised way in the sense > that you can then simply reuse that drawing area widget in multiple places > without ever having to remember this detail again. > > Other then that, you should be able to manually call gtk_widget_realize() > on the created drawing area after obtaining it from the interface built with > GtkBuilder and before displaying the toplevel window. > > Hope this helps > I forgot to mention, once you've created a GtkDrawingArea subclass, you can include that in Glade's palette with a simple xml file like this: <glade-catalog name="foo" supports="gtkbuilder" depends="gtk+"> <glade-widget-classes> <glade-widget-class name="FooGLArea" generic-name="FooGLArea" title="GLArea" parent="GtkDrawingArea"> </glade-widget-class> </glade-widget-classes> <glade-widget-group name="foo-widgets" title="Foo Widgets"> <glade-widget-class-ref name="FooGLArea"/> </glade-widget-group> </glade-catalog> This will allow you to add your custom "Foo" catalog to Glade's palette containing the FooGLArea object deriving from GtkDrawingArea in a simple way... it's all in the developer documentation but I thought I'd mention it anyway. After creating the catalog, just place it in a directory and set GLADE_CATALOG_SEARCH_PATH to search that directory before starting Glade. Cheers, -Tristan > Cheers, > -Tristan > > >> _______________________________________________ >> Glade-users maillist - [email protected] >> http://lists.ximian.com/mailman/listinfo/glade-users _______________________________________________ Glade-users maillist - [email protected] http://lists.ximian.com/mailman/listinfo/glade-users