Re: [GtkGLExt] gtkglextmm + glade 3 + gtkbuilder...something must be missing on my code


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.


On Sat, May 8, 2010 at 8:21 PM, Cristobal Navarro <axischire gmail com> wrote:

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

//  OpenGL scene.
class GLWindow : public Gtk::DrawingArea, public Gtk::GL::Widget<GLWindow>{
  GLWindow(BaseObjectType* baseObject, Glib::RefPtr<Gtk::Builder>& refBuilder);
  virtual ~GLWindow();
  bool draw();

  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(),
        win->invalidate_rect(r, false);
    return true;

the other three virtual methods are the default implemented ones that come in the examples (
next,  my mainWindow class, where i setup opengl this way.

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);
      quitButton->signal_clicked().connect( sigc::mem_fun(*this, &Application::on_button_quit_clicked) );
    refBuilder->get_widget_derived("glWindow", myGL );
        printf("GL Initialized\n");

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


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