Re: GtkGLArea and signals



>sven gimp org wrote:
>>> Why is it that I can't simply have the glarea widget signal 
>>> itself that it is in need of a refresh? Isn't a widget allowed
>>> to signal itself?
>> 
>> if you would emit the signal correctly it would probably work
>> (you missed to pass a valid GdkEvent to signal_emit). However 
>> the correct way of emitting an expose event is to use 
>> gtk_widget_queue_draw() or gtk_widget_queue_draw_area().
>
>OK, I see what you mean. Thanks :)
>
>I have another signal related problem now - I want to refresh the GL widget
>as soon as it is displayed, otherwise a load of random crap in memory is
>displayed until I (for example) rotate the view with the mouse. I really need
>to force this refresh to occur before the user interacts with the program.

as has been said many, many times on this list recently: you draw ONLY
in an expose event. the X server will not blit the pixels for the
window till the expose event handler is finished - if there are still
random bits there when it does, then its your fault, AFAIK. 

X (and other systems to which GDK has been ported) send something
equivalent to an expose event anytime(*) part of a window's visibility
changes, whether its caused by mapping to the screen, stacking order
changes, window motion, etc.

realize and map are useful events for marking when certain things
happen, but they are not the right place to draw from - only an expose
event handler should be doing that.

--p

(*) except on those odd occassions where save-unders are used, but
    this is infrequent these days.



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