[vtkusers] Offscreen rendering and text mapper.

JL jclopez+vtk at andrew.cmu.edu
Wed Apr 24 00:57:52 EDT 2002


Hi,

I'm running into a minor problem while using off-screen rendering.

Here's the scenario:
vtk version: 3.2
OS: Linux 2.4 (Red-Hat 7.1).
Mesa version: 4.0.1

I have a very simple program that uses off-screen rendering (i.e.,
it calls renWin->OffScreenRenderingOn()).  It works fine (no window
pops-up, no X server connection is required, etc).

I have a second program that is slightly more elaborated.  For
instance, it creates and uses vtkScalarBarActor and
vtkCubeAxesActor2D objects.

When I execute the second program it prints the following message:

ERROR: In ../../src/graphics/vtkXRenderWindow.cxx, line 176
vtkMesaRenderWindow (0x8057dd8): bad X server connection.

after that the program 'seg faults'.

After exploring a little bit here and there, it seems to me that
the problem is caused by the vtkXTextMapper which is used by
both vtkScalarBarActor and vtkCubeAxesActor2D.

My questions are:
1. Does this problem occur only with vtkXTextMapper, or does it
   occur with other 2D actors/mappers?
2. More important, is there a way I can use off-screen rendering
   with these actors / mappers? or
3. is this a well known 'feature'?  (I skimmed the mailing list
   and didn't find anything relevant).
4. If so, do I have to use a different off-screen rendering
   approach, like use vtkOpenGLOffscreenRenderWindow?
5. Or is this a 'bug' that has been fixed in the CVS version or
   in a later release (i.e. 4.x)?

Thanks in advance for any information you can provide,

-- Julio

P.S.:  If it is of any help, I've included additional details about how and
where the problem occurs.



----------------------------------------------------------------------

I tracked the problem down to:

vtkXTextMapper::DetermineSize(vtkViewport* viewport, int* size)

near the beginning, this method tries to get the display id ->

Display* displayId = (Display*) window->GetGenericDisplayId();
this in turns calls vtkXRenderWindow::GetDisplayId(), which in turn
calls XOpenDisplay((char *)NULL);

XOpenDisplay returns NULL since there's no X server running (i.e.,
the DISPLAY variable is not set), but that's intended since the goal
is to do off-screen rendering.  And here is where the error message
gets printed, and a NULL display is returned.

later vtkXTextMapper::DetermineSize(...) calls
XLoadFont(displayId,  fontname );  with a NULL display and this is
where the program crashes.

Here's a trace of the stack when the program crashes.

#0  0x414c5cbe in XListFonts () from /usr/X11R6/lib/libX11.so.6
#1  0x40f9789c in vtkXTextMapper::DetermineSize(vtkViewport*, int*) ()
    at eval.c:41
#2  0x40f97426 in vtkXTextMapper::GetSize(vtkViewport*, int*) () at
eval.c:41
#3  0x40f79e13 in vtkScalarBarActor::SizeTitle(int*, int*, vtkViewport*) ()
    at eval.c:41
#4  0x40f786ef in vtkScalarBarActor::RenderOpaqueGeometry(vtkViewport*) ()
    at eval.c:41
#5  0x4044e4be in vtkRenderer::UpdateGeometry() () at eval.c:41
#6  0x404f2cdd in vtkMesaRenderer::DeviceRender() () at eval.c:41
#7  0x4044d882 in vtkRenderer::Render() () at eval.c:41
#8  0x40451e10 in vtkRendererCollection::Render() () at eval.c:41
#9  0x40449657 in vtkRenderWindow::DoStereoRender() () at eval.c:41
#10 0x404495f4 in vtkRenderWindow::DoFDRender() () at eval.c:41
#11 0x40449174 in vtkRenderWindow::DoAARender() () at eval.c:41
#12 0x4044891c in vtkRenderWindow::Render() () at eval.c:41
#13 0x4050b1e9 in vtkXRenderWindow::Render() () at eval.c:41
#14 0x0804ac33 in ?? () at eval.c:41
#15 0x0804b1bc in ?? () at eval.c:41
#16 0x411b6306 in __libc_start_main (main=0x804b170, argc=10,






More information about the vtkusers mailing list