Gtk2 + openGL + Threads
- From: Andreas Volz <andreas brachttal net>
- To: gtk-app-devel-list gnome org <gtk-app-devel-list gnome org>
- Subject: Gtk2 + openGL + Threads
- Date: Sun, 1 Dec 2002 13:42:42 +0000
Hello,
I've a problem that is related on gtk2, opengl and threads. But I think
the problem is gtk, so I'll ask the question on this list. Some time ago
I wrote an openGL application. Now, I want to include it in a gtk2 gui.
I don't want to use a gtk2 openGL-widget, because it must be able to run
without gtk2. This was a problem because there is a gtk_main-loop and a
glutMainLoop. So I used threads to solve this problem. But there are
still some problems.
If I do gtk_init() the openGL window is simply black. I could "work"
with the openGL-Display, but nothing is displayed. It works only if I
sleep for at least 1 sec. before gtk_init(). But if I reload the
openGL-Display it's simply black again.
I think this could be because gtk_init() loads another colortable as
openGl needs. What could I do to solve this problem? Should I better use
processes instead of threads?
int main (int argc, char **argv)
{
GtkWidget *toolbox_window;
GtkWidget *properties_window;
GThread *oglThread_id;
/* glInterpret Thread */
if (!g_thread_supported ()) g_thread_init (NULL);
oglThread_id = g_thread_create (&oglThread, NULL, FALSE, NULL);
sleep (1);
gtk_init (&argc, &argv);
add_pixmap_directory ("../pixmaps");
toolbox_window = create_window_toolbox ();
properties_window = create_window_properties ();
gtk_widget_show (toolbox_window);
gtk_widget_show (properties_window);
gtk_main ();
return 0;
}
Thanks
Andreas
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]