Hello,<div>Very nice to join the mail list!!</div><div>I started studying kiviwiewer and ves/vtk just a few days ago trying to put an image as background in kiwiviewer.</div><div><div>I found the function that should do it</div>
<div><br></div><div>KiwiviewerApp::setBackgroundTexture(const std:string & fileName);</div><div><br></div><div>but has no code inside it, so I tried this :</div><div><br></div><div>







<p class="p1"><span class="s1">void</span> vesKiwiViewerApp::setBackgroundTexture(<span class="s1">const</span> std::string& filename)</p>
<p class="p1">{  </p>
<p class="p3"><span class="s2">  </span>   vtkSmartPointer<vtkJPEGReader> reader = vtkSmartPointer<vtkJPEGReader>::New();</p><p class="p3">    reader->SetFileName(filename);</p>
<p class="p1">    reader->Update();</p>
<p class="p1">    vtkSmartPointer<vtkImageData> image = reader->GetOutput();</p>
<p class="p2">    assert(image);</p>
<p class="p2">    vtkSmartPointer<vtkUnsignedCharArray> pixels = vtkUnsignedCharArray::SafeDownCast(image->GetPointData()->GetScalars());</p>
<p class="p1">    <span class="s1">int</span> width = image->GetDimensions()[<span class="s3">0</span>];</p>
<p class="p1">    <span class="s1">int</span> height = image->GetDimensions()[<span class="s3">1</span>];</p>
<p class="p2">    assert(pixels);</p>
<p class="p1">    assert(pixels->GetNumberOfTuples() == width*height);</p>
<p class="p2">    <span class="s1">this</span>->Image = vesImage::Ptr(<span class="s1">new</span> vesImage());</p>
<p class="p1">    <span class="s1">this</span>->Image->setWidth(width);</p>
<p class="p1">    <span class="s1">this</span>->Image->setHeight(height);</p>
<p class="p1">    <span class="s1">this</span>->Image->setPixelFormat(pixels->GetNumberOfComponents() == <span class="s3">4</span> ? vesColorDataType::RGBA</p>
<p class="p1">                            : pixels->GetNumberOfComponents() == <span class="s3">3</span> ? vesColorDataType::RGB</p>
<p class="p1">                            : vesColorDataType::Luminance);</p>
<p class="p1">    <span class="s1">this</span>->Image->setPixelDataType(vesColorDataType::UnsignedByte);</p>
<p class="p1">    <span class="s1">this</span>->Image->setData(pixels->WriteVoidPointer(<span class="s3">0</span>, <span class="s3">0</span>), pixels->GetSize());</p>
<p class="p1">    <span class="s1">this</span>->renderer()->background()->setImage(<span class="s1">this</span>->Image);</p>
<p class="p2">}</p><p class="p2"><br></p><p class="p2">The code above is based from a test file inside the repository called TestTexturedBackground.cpp</p><p class="p2">This should work but doesn't, the functions did not return any errors so I assume that I'm configuring all ok, but the background is not rendered at all.</p>
<p class="p2">Can you please help me?</p><p class="p2">Thanks in advance.</p><p class="p2">Walter</p></div></div>