[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: gtk-app-devel-list Digest, Vol 44, Issue 35
- From: "Chris H" <arbuckle911 gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: gtk-app-devel-list Digest, Vol 44, Issue 35
- Date: Sat, 22 Dec 2007 17:20:07 -0500
Thanks Brian, g_idle_add in combination with gtk_widget_queue_draw_area()
worked perfectly. Just one question about the inner workings of
gtk_widget_queue_draw_area().
Here is my call:
gtk_widget_queue_draw_area(drawing_area,
0, 0,
drawing_area->allocation.width,
drawing_area->allocation.height);
are the coords in this call relative to the drawing area widget? they seem
to be but I'd like to make sure I'm actually invalidating the area I think I
am and not redrawing the entire window or something.
Thanks again,
-Chris.
On Dec 22, 2007 12:00 PM, <gtk-app-devel-list-request gnome org> wrote:
> Send gtk-app-devel-list mailing list submissions to
> gtk-app-devel-list gnome org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> or, via email, send a message with subject or body 'help' to
> gtk-app-devel-list-request gnome org
>
> You can reach the person managing the list at
> gtk-app-devel-list-owner gnome org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of gtk-app-devel-list digest..."
>
>
> Today's Topics:
>
> 1. recommended way to create a render loop with gtkglext (Chris H)
> 2. Re: recommended way to create a render loop with gtkglext
> (Brian J. Tarricone)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 21 Dec 2007 13:53:54 -0500
> From: "Chris H" <arbuckle911 gmail com>
> Subject: recommended way to create a render loop with gtkglext
> To: gtk-app-devel-list gnome org
> Message-ID:
> <c9d034c50712211053q1f0f840v24160fd4f46834cc mail gmail com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hello,
> I'm writing a GLSL shader editor and I need to be able to create a loop
> that
> will force the gtkglext widget to constantly refresh at 60Hz or less if
> the
> frames take too long to render. I've tried to copy the code from the
> logo.cexample but it just isn't refreshing. Honestly I'd rather stay
> away from
> g_timeout for this task. I tried using threads but it became really
> unstable
> (segfaults) when calling
> /* Invalidate the whole window. */
> gdk_window_invalidate_rect (widget->window, &widget->allocation, FALSE);
>
> /* Update synchronously. */
> gdk_window_process_updates (widget->window, FALSE);
> in the separate thread. Is there a way I could simply have the separate
> thread send a redraw signal to the widget, and would that event work? I'm
> open to just about any ideas that don't involve g_timeout.
> Thanks.
>
>
> ------------------------------
>
> Message: 2
> Date: Fri, 21 Dec 2007 11:12:52 -0800
> From: "Brian J. Tarricone" <bjt23 cornell edu>
> Subject: Re: recommended way to create a render loop with gtkglext
> To: gtk-app-devel-list gnome org
> Message-ID: <476C1034 6090402 cornell edu>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Chris H wrote:
> > Hello,
> > I'm writing a GLSL shader editor and I need to be able to create a loop
> that
> > will force the gtkglext widget to constantly refresh at 60Hz or less if
> the
> > frames take too long to render. I've tried to copy the code from the
> > logo.cexample but it just isn't refreshing. Honestly I'd rather stay
> > away from
> > g_timeout for this task. I tried using threads but it became really
> unstable
> > (segfaults) when calling
> > /* Invalidate the whole window. */
> > gdk_window_invalidate_rect (widget->window, &widget->allocation,
> FALSE);
> >
> > /* Update synchronously. */
> > gdk_window_process_updates (widget->window, FALSE);
> > in the separate thread. Is there a way I could simply have the separate
> > thread send a redraw signal to the widget, and would that event work?
> I'm
> > open to just about any ideas that don't involve g_timeout.
>
> gdk_window_invalidate_rect() *is* the way to send a redraw signal to the
> widget's underlying GdkWindow. Give gtk_widget_queue_draw_area() a try
> instead.
>
> If you're calling this from a separate thread, be sure you've
> initialized gthread (with g_thread_init()) and gdk's locking (with
> gdk_threads_init()) before gtk_init() in main(). You'll need to
> surround your call to gtk_main() with gdk_threads_enter() and
> gdk_threads_leave(), and you'll have to do the same for any gtk/gdk
> calls you make in other threads.
>
> Alternatively, you can *not* initialise gdk's threading at all, and use
> g_idle_add() from your worker thread to schedule a function to call
> gtk_widget_queue_draw_area() (the idle function will run in the main
> thread, regardless of where you call g_idle_add()).
>
> -brian
>
>
> ------------------------------
>
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
> End of gtk-app-devel-list Digest, Vol 44, Issue 35
> **************************************************
>
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]