[Glade-users] gtk drawing area with gtkglext and glade3



On Thu, Sep 6, 2012 at 4:07 AM, Roland Graham <r.graham at skrltool.com> 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

Cheers,
         -Tristan


_______________________________________________
Glade-users maillist  -  Glade-users at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-users




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]