Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First of all libglade is an old library. If you are writing new project start with <a href="http://library.gnome.org/devel/gtkmm/stable/classGtk_1_1Builder.html" rel="noreferrer">gtk builder</a>.</p> <p>As you can see <a href="http://library.gnome.org/devel/gtkmm-tutorial/unstable/sec-builder-using-derived-widgets.html.en" rel="noreferrer">here</a> gtkmm provide easy way to create your own widgets and see them (almost) in glade tool. You simply insert plain DrawinArea widget to window and then tell gtk-builder to put in this place yours derived class.</p> <p>Here is all together:</p> <p>Setting up gtk-builder:</p> <pre><code>refBuilder = Gtk::Builder::create_from_file(ui_file); GlDrawingArea*glArea = NULL; refBuilder-&gt;get_widget_derived("drawing_gl",glArea); </code></pre> <p>Opengl DrawingArea class:</p> <pre><code> class GlDrawingArea : public Gtk::DrawingArea , public Gtk::GL::Widget&lt;GlDrawingArea&gt; { public: GlDrawingArea(BaseObjectType* cobject, const Glib::RefPtr&lt;Gtk::Builder&gt;&amp; builder); virtual ~GlDrawingArea(); protected: void on_realize(); bool on_expose_event(GdkEventExpose* event); bool on_configure_event(GdkEventConfigure* event); private: Glib::RefPtr&lt;Gtk::Builder&gt; refBuilder; }; </code></pre> <p>Constructing opengl drawingarea:</p> <pre><code>// GlDrawingArea: GlDrawingArea::GlDrawingArea(BaseObjectType*cobject, const Glib::RefPtr&lt;Gtk::Builder&gt;&amp; builder) : Gtk::DrawingArea(cobject), refBuilder(builder), screen_tex(0) { // // Configure OpenGL-capable visual. // Glib::RefPtr&lt;Gdk::GL::Config&gt; glconfig; // Try double-buffered visual glconfig = Gdk::GL::Config::create(Gdk::GL::MODE_RGB | Gdk::GL::MODE_DEPTH | Gdk::GL::MODE_DOUBLE); if (!glconfig) { std::cerr &lt;&lt; "*** Cannot find the double-buffered visual.\n" &lt;&lt; "*** Trying single-buffered visual.\n"; // Try single-buffered visual glconfig = Gdk::GL::Config::create(Gdk::GL::MODE_RGB |Gdk::GL::MODE_DEPTH); if (!glconfig) { std::cerr &lt;&lt; "*** Cannot find any OpenGL-capable visual.\n"; std::exit(1); } } // print frame buffer attributes. GLConfigUtil::examine_gl_attrib(glconfig); // // Set OpenGL-capability to the widget. // set_gl_capability(glconfig); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload