[vtkusers] vtkArrowSource problem w/ offscreen rendering

Charles Boivin okeovtk at gmail.com
Mon Dec 5 12:12:35 EST 2005


Hello VTK gurus,

I have just encountered a strange problem with vtkArrowSource. It seems that
the color (or is it the light?) of these glyphs is not correct when I use
offscreen rendering. I am running VTK 4.4. on Windows, compiled with
VS.NET<http://vs.net/>2003. I have included two images that illustrate
the problem, the first one
is a snapshot made without using offscreen rendering, and the second one is
a snapshot when using offscreen rendering.

The image has 4 large arrows that are vtkArrowSource fed through vtkGlyph3D.
The smaller arrows are on a plane below the 4 large arrows, and are also
glyphs using vtkGlyph3D, but are using a different source that I wrote
myself. You'll notice that the thin arrows, as well as the other objects in
the scene, are rendered properly in both images. It seems that only the
vtkArrowSource arrows do not get the right 'light' on them.

I display these using calls like:

    this->pGlyphSource = vtkArrowSource::New();
    this->pGlyph       = vtkGlyph3D::New();

    this->pGlyph->SetSource(this- >pGlyphSource->GetOutput());
    this->pGlyph->SetVectorModeToUseVector();
    this->pGlyph->SetScaleModeToScaleByVector();
    this->pGlyph->SetColorModeToColorByVector();
    this->pGlyph->ClampingOff();

The calls are exactly the same for the thin arrows.

The switch to offscreen rendering is done this way:

        this->pWinRenderWindow = vtkWin32OpenGLRenderWindow::New();
        this->pWinRenderWindow->SetOffScreenRendering(1);
        this->iOffscreenHeight = 480;
        this->iOffscreenWidth  = 640;

        this->pWinRenderWindow->AddRenderer(this->pRenderer);
        // Connect the W2I filter
        this->pW2I->SetInput(this->pWinRenderWindow);
        // Set the size
        this->pWinRenderWindow->SetSize(this->iOffscreenWidth,
this->iOffscreenHeight);

(this->pW2I is a vtkWindowToImageFilter that writes the PNG files to disk)

What is really puzzling me is that the other glyphs in the scene seem to be
colored properly..

Any ideas, help? I would gladly welcome any suggestions.

Thank you,

Charles Boivin

P.S. Sorry about the poor quality JPEGs, but I wanted to keep the size
small. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051205/ea2dfb91/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ProperColorCrop.jpg
Type: image/jpeg
Size: 13571 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051205/ea2dfb91/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OffscreenColorProblemCrop.jpg
Type: image/jpeg
Size: 10945 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051205/ea2dfb91/attachment-0001.jpg>


More information about the vtkusers mailing list