Re: building OpenGL under GTK+ using gtkgl



Dov Kruger wrote:
Tristan,

Thanks for your response.
I'm sorry, but I need a bit more concrete help with the blizzard of
possible API calls.

The original code was simply:

gtk_main();

If I want to invalidate a rectangle, I saw a call, and thought I could
do something like:

  while (!gtk_main_iteration_do(FALSE)) {
    cout << "foo\n";
    gtk_propogate_event(..);
  }


The documentation said not to do this, and I found something, which I am
not finding now, about invalidating a rectangle.

gdk_window_invalidate_rect/region() will let you do a finer grained
screen update than calling gtk_widget_queue_draw().

Always use `GTK_WIDGET (widget)->window' for your GdkWindow and
`GTK_WIDGET (widget)->allocation' to know what part of that GdkWindow
is allocated to `widget'.

The call was in gdk though, and this is a gtk widget. In any case, it
took a gdk rectangle, and while I found a call to construct one, I did
not find the calls to set the, appropriately. Could you show me how to
do this, or alternatively, since you have said it's better to use a
timeout, I take it:

g_idle_add(animate, NULL);

Is this single threaded? Am I guaranteed that it won't be called while
I'm drawing?


Yes it is single threaded, only one GSource may execute at a time
in one GMainContext (read the Main Event Loop section of the glib
docs).

Cheers,
                        -Tristan



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