Re: Redrawing a widget



Hi,

"Ignacio Nodal" <inodal teleline es> writes:

> Hi, i'm working on an OpenGL project using GTK+ & GtkGLArea. My question
> is... how can i force a widget to be redraw? Not by an expose event, but at
> anytime.
> A simple example, suppose i want to clear the widget contents, call the
> glClear function and then i call gtk_widget_draw passing the widget and the
> area i want to be redraw, but it doesn't work.. is this a problem with
> OpenGL code or GTK+ one?? I mean.. Is gtk_widget_draw the correct way to
> redraw any kind of widget?

Under almost all circumstances you want to call gtk_widget_queue_draw()
instead of gtk_widget_draw().

To your problem (also described in a second mail of yours): I'd suggest
you change the logic of your program, so that the GL paint functions
take place in the expose_event handler. When you want to clear the GL
area for example, you set a flag that the desired painting function is 
to clear and create an expose_event using gtk_widget_queue_draw(). Your
expose handler then takes care of drawing the right stuff to the screen.
This will also make your application behave correctly when it gets 
expose_events from the outside, for example if your window was (partially)
hidden and becomes visible again.


Salut, Sven




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