Update:

i managed to fix my problem.
in my GLWindow class, on the constructor.

i was missing the call of the parent constructor, so now it is like this.

GLWindow::GLWindow(BaseObjectType* baseObject, Glib::RefPtr<Gtk::Builder>&
refBuilder):Gtk::DrawingArea(baseObject)
after that, it works ok.

thanks anyways.

Cristobal




On Sat, May 8, 2010 at 8:21 PM, Cristobal Navarro <[email protected]>wrote:

> hello,
>
> i am having trouble with linking my OpenGL Scene with a Drawing area coming
> from glade3.
> im using gtkbuilder to read the GUI from c++ code.
>
> it is working for buttons and related events, but not for the inherited
> events that my GLWindow class implements.
>
>
> this is my GLWindow class
>
> ------------------CODE--START
> //
> //  OpenGL scene.
> //
> class GLWindow : public Gtk::DrawingArea, public Gtk::GL::Widget<GLWindow>{
> public:
>   GLWindow(BaseObjectType* baseObject, Glib::RefPtr<Gtk::Builder>&
> refBuilder);
>   virtual ~GLWindow();
>   bool draw();
>
> protected:
>   virtual void on_realize();
>   virtual bool on_configure_event(GdkEventConfigure* event);
>   virtual bool on_expose_event(GdkEventExpose* event);
>
> };
>
> //draw method, custom
> bool GLWindow::draw(){
>     // force our program to redraw the entire clock.
>     Glib::RefPtr<Gdk::Window> win = get_window();
>     if (win){
>         Gdk::Rectangle r(0, 0, get_allocation().get_width(),
>                 get_allocation().get_height());
>         win->invalidate_rect(r, false);
>     }
>     return true;
> }
> ---------------------CODE--END
>
> the other three virtual methods are the default implemented ones that come
> in the examples (simple.cc)
> next,  my mainWindow class, where i setup opengl this way.
>
> --------------------CODE--START
> void Application::init(Glib::RefPtr<Gtk::Builder> refBuilder){
>     //Get the GtkBuilder-instantiated Button, and connect a signal handler:
>     quitButton = 0;
>
>     refBuilder->get_widget("buttonExit", quitButton);
>     if(quitButton){
>       quitButton->signal_clicked().connect( sigc::mem_fun(*this,
> &Application::on_button_quit_clicked) );
>     }
>     refBuilder->get_widget_derived("glWindow", myGL );
>     if(myGL){
>         printf("GL Initialized\n");
>     }
>     myGL->draw();
> }
> --------------------CODE--END
>
> when i run the program, the drawing window remains gray, nothing is
> drawn....
> what am i doing wrong??
>
> if you need the whole source code for testing i can upload it
> any help is welcome
>
>
>
> Cristobal
>
>
>
_______________________________________________
gtkglext-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkglext-list

Reply via email to