[vtkusers] VTK and GTK segv

Joe Miller lpe540 at yahoo.com
Wed Jun 23 10:13:35 EDT 2004


Hi,

I'm working on imbedding VTK into a GTK window. From
the mailing list and the vtk gtk python renderers this
seems very plausible. However, my attempts keep
producing a strange segmentation fault. When I run
through a debugger the program gets to a gl function
get_dispatch(Display *dpy) and dies while looping
through the dispatch list. The function I call from my
program that leads to the segv is the gtk function 
gdk_gl_config_new_by_mode
(GdkGLConfigMode(GDK_GL_MODE_RGB    |                 
                        GDK_GL_MODE_DEPTH  |          
                               GDK_GL_MODE_DOUBLE))

This only happens after I try to load a second window
and call this function a second time. I was wondering
if anyones come across a similar problem.

The basic gist of the program looks like with
VtkWindow class being a child of Window class

Window (...)
{
   ...
   glconfig = gdk_gl_config_new_by_mode 
    (GdkGLConfigMode(GDK_GL_MODE_RGB    |
      GDK_GL_MODE_DEPTH  |
      GDK_GL_MODE_DOUBLE));
   window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   drawing_area = gtk_drawing_area_new ();
   gtk_widget_set_gl_capability (drawing_area,
      glconfig, NULL, TRUE, GDK_GL_RGBA_TYPE);
   g_signal_connect_swapped (G_OBJECT (drawing_area),
      "realize", G_CALLBACK (OnRealize), 
      static_cast <void*> (this));
   gtk_container_add (GTK_CONTAINER (window), 
      drawing_area);
   ...
}

VtkWindow (...) : ChipsWindow (...)
{
   ...
   base_renderer = vtkRenderer::New();
   base_renderer->SetBackground(1, 1, 1);
   renWin = vtkRenderWindow::New()
   renWin->AddRenderer (base_renderer);
   gtk_widget_show (drawing_area);
   gtk_widget_show(window);
   renWin->render ();
}
  
static void Window::OnRealize ()
{
   Window *vw = static_cast <Window *> (data);
   vw->set_window_id ();

}  

virtual void VtkWindow::set_window_id ()
{ 
   renWin->SetWindowId((void*)GDK_WINDOW_XWINDOW
   (drawing_area->window));
}

I think that's more or less the important parts. Sorry
for including it and making this email so long. I'm
just not sure if I'm missing something detramental or
if something's out of order or what. The main program
runs gtk_init and ends with running the gtk event
loop. If you have any suggestions I'd very much
appreciate it. Like I said this only happens after I
create several windows and it happens sporadically at
best. I also cant seem to reproduce it when I don't
render render window. I'm using GTK 2.0 and Vtk4.3.0
on Solaris if that helps.

Sorry again for the long posting. Thanks in advance.

-joe


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the vtkusers mailing list