Re: GtkGLArea and signals



pbd Op Net wrote:

> >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. 

My sincerest apologies - I've only had contact with the GTK materials for
a couple of days. In that time I've found the documentation wanting,
especially given that this is supposed to be a portable API and therefore the
programmer picking it up won't necessarily have been weened since birth on
the inner workings of X.

> 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.

Really? That's a shocker. Now then, could you please tell me why I can't
fire off a command to redraw the gl widget to remove the random data in memory
that the gl widget visualizes, before that widget has the chance to interact
with the user? Yes, all my *actual drawing commands* are encapsulated in
the expose event handler, but it seems I can only call on this handler a.k.a
send it a message/signal/event/whatever when the widget has already
gone through a certain set of states with those state changes invoked
by other messages. I suspect that this is the case (as per my example in my
previous mail) but am not certain, because no-one appears to have written it
down anywhere!
 
> 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.

I never said I drew from them. I said I fired off a message to make the
widget redraw itself (using the appropriate message and in turn the appropiate
handler). This failed. Why?

More to the point, why doesn't the glwidget get an expose event the
moment it is shown? Why does it seem that I have to manually prod it to
draw itself for the very first time?

Thanks,

Giles







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