<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hello Alex,<br>
<br>
I found as well the OffScreenRendering option. To make it work I
had to install osmesa (8.0.4 Ubuntu 12.04) and compile paraview
3.14-1 with option VTK_OPENGL_HAS_OSMESA set to ON.<br>
Then in my code I have following set of instructions:<br>
<br>
vtkSmartPointer<vtkGraphicsFactory> graphics_factory =<br>
vtkSmartPointer<vtkGraphicsFactory>::New();<br>
graphics_factory->SetOffScreenOnlyMode( 1);<br>
graphics_factory->SetUseMesaClasses( 1 );<br>
<br>
vtkSmartPointer<vtkImagingFactory> imaging_factory =<br>
vtkSmartPointer<vtkImagingFactory>::New();<br>
imaging_factory->SetUseMesaClasses( 1 );<br>
<br>
VTK_CREATE(vtkRenderWindow, renderWindow);<br>
renderWindow->AddRenderer(view->GetRenderer());<br>
renderWindow->SetOffScreenRendering(1);<br>
renderWindow->Render(); <br>
VTK_CREATE(vtkWindowToImageFilter, windowToImageFilter);<br>
windowToImageFilter->SetInput(renderWindow);<br>
windowToImageFilter->Update();<br>
<br>
VTK_CREATE(vtkPNGWriter, pngWriter);<br>
pngWriter->SetFileName("ble.png");<br>
pngWriter->SetInput(windowToImageFilter->GetOutput());<br>
pngWriter->Write();<br>
<br>
<br>
When program reach instruction renderWindow->Render, the
segmentation fault occurs. It is caused by code from
vtkOpenGLExtensionManager.<br>
First one is at the line 567 (version is NULL):<br>
const char *version =<br>
reinterpret_cast<const char *>(glGetString(GL_VERSION));<br>
<br>
Version seems to be NULL therefore I applied patch according to
this bug description:<br>
<a class="moz-txt-link-freetext" href="http://paraview.org/Bug/bug_relationship_graph.php?bug_id=8554&graph=relation">http://paraview.org/Bug/bug_relationship_graph.php?bug_id=8554&graph=relation</a><br>
<br>
Then segmentation fault comes from
vtkOpenGLContextDevice2D::LoadExtensions<br>
const char *gl_version =<br>
reinterpret_cast<const char
*>(glGetString(GL_VERSION));<br>
const char *mesa_version = strstr(gl_version, "Mesa");<br>
if (mesa_version != 0)<br>
{<br>
supported = false;<br>
}<br>
}<br>
this time gl_version is NULL:<br>
<br>
Does anyone having similar behaviour. Am I missing something?<br>
I've attached glxinfo -s log if someone is curious, and my version
of system is Ubuntu 12.04:<br>
Linux 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012
x86_64 x86_64 x86_64 GNU/Linux<br>
<br>
Thank you in advance for any help.<br>
Jakub <br>
<br>
On 10/25/2012 03:39 AM, Alex Malyushytskyy wrote:<br>
> Actually I take it back, I am not sure this would work when
system is<br>
> not able to support X11.<br>
><br>
> Alex<br>
><br>
> On Wed, Oct 24, 2012 at 6:33 PM, Alex Malyushytskyy<br>
> <a class="moz-txt-link-rfc2396E" href="mailto:alexmalvtk@gmail.com"><alexmalvtk@gmail.com></a> wrote:<br>
>> You can forcevtk use an offscreen rendering:<br>
>>
<a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/OffScreenRendering">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/OffScreenRendering</a><br>
>><br>
>> Alex<br>
>><br>
>> On Wed, Oct 24, 2012 at 6:29 AM, Jakub Poła
<a class="moz-txt-link-rfc2396E" href="mailto:jakub.pola@gmail.com"><jakub.pola@gmail.com></a> wrote:<br>
>>><br>
>>> Thank you for your help Jothy. This filter is working
but I have to create<br>
>>> renderWindow and call at least once Render() method
to obtain proper output<br>
>>> data from vtkWindowToImageFilter. I would like to
omit render window and go<br>
>>> directly from vtkChartXY to PNG ( Let assume that
there is no X11 support<br>
>>> on the machine where program will work), but I
suppose that it is not<br>
>>> possible easily.<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> On 10/24/2012 01:55 PM, Jothybasu Selvaraj wrote:<br>
>>>><br>
>>>> Here you go<br>
>>>><br>
>>>> vtkSmartPointer<vtkWindowToImageFilter>
windowToImageFilter =<br>
>>>>
vtkSmartPointer<vtkWindowToImageFilter>::New();<br>
>>>>
windowToImageFilter->SetInput(this->view->GetRenderWindow());<br>
>>>> windowToImageFilter->Update();<br>
>>>><br>
>>>><br>
>>>> vtkSmartPointer<vtkPNGWriter> writer =<br>
>>>>
vtkSmartPointer<vtkPNGWriter>::New();<br>
>>>> writer->SetFileName("FileName");<br>
>>>>
writer->SetInput(windowToImageFilter->GetOutput());<br>
>>>> writer->Write();<br>
>>>><br>
>>>> Jothy<br>
>>>><br>
>>>> On Wed, Oct 24, 2012 at 12:52 PM, Jakub Poła
<a class="moz-txt-link-rfc2396E" href="mailto:jakub.pola@gmail.com"><jakub.pola@gmail.com></a> wrote:<br>
>>>>><br>
>>>>> Good Morning,<br>
>>>>><br>
>>>>> I have question related to create charts in
vtk. Is it possible to save<br>
>>>>> chart as png image without creating the
snapshot of window like in<br>
>>>>> paraview?<br>
>>>>> I would like to write a batch program which
aims to analyze large data<br>
>>>>> set<br>
>>>>> and creates series of charts.<br>
>>>>> I have vtkTable feeded by the
vtkExtractArraysOverTime filter, then<br>
>>>>> basing<br>
>>>>> on this table I would like to create chart
object which I would like save<br>
>>>>> as<br>
>>>>> PNG image.<br>
>>>>><br>
>>>>> Thank you very much for your support.<br>
>>>>> Jakub<br>
>>>>><br>
>>>>> --<br>
>>>>> Pozdrawiam,<br>
>>>>> Jakub Poła<br>
>>>>><br>
>>>>>
_______________________________________________<br>
>>>>> Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a><br>
>>>>><br>
>>>>> Visit other Kitware open-source projects at<br>
>>>>>
<a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
>>>>><br>
>>>>> Please keep messages on-topic and check the
VTK FAQ at:<br>
>>>>> <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>>>>><br>
>>>>> Follow this link to subscribe/unsubscribe:<br>
>>>>> <a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
>>>><br>
>>>><br>
>>>><br>
>>><br>
>>><br>
>>> --<br>
>>> Pozdrawiam,<br>
>>> Jakub Poła<br>
>>><br>
>>> _______________________________________________<br>
>>> Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a><br>
>>><br>
>>> Visit other Kitware open-source projects at<br>
>>> <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
>>><br>
>>> Please keep messages on-topic and check the VTK FAQ
at:<br>
>>> <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>>><br>
>>> Follow this link to subscribe/unsubscribe:<br>
>>> <a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
> _______________________________________________<br>
> Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at
<a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br>
<br>
-- <br>
Pozdrawiam,<br>
Jakub Poła<small><font face="Courier 10 Pitch"><font
face="sans-serif"><big><br>
</big></font><br>
</font></small>On 10/25/2012 03:39 AM, Alex Malyushytskyy wrote:<br>
</div>
<blockquote
cite="mid:CAHR9pJ3ogx5kXQcYRh9ZRDCP0HuWG-prqHCTonux0-z3q=_vKg@mail.gmail.com"
type="cite">
<pre wrap="">Actually I take it back, I am not sure this would work when system is
not able to support X11.
Alex
On Wed, Oct 24, 2012 at 6:33 PM, Alex Malyushytskyy
<a class="moz-txt-link-rfc2396E" href="mailto:alexmalvtk@gmail.com"><alexmalvtk@gmail.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">You can forcevtk use an offscreen rendering:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/OffScreenRendering">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/OffScreenRendering</a>
Alex
On Wed, Oct 24, 2012 at 6:29 AM, Jakub Poła <a class="moz-txt-link-rfc2396E" href="mailto:jakub.pola@gmail.com"><jakub.pola@gmail.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">
Thank you for your help Jothy. This filter is working but I have to create
renderWindow and call at least once Render() method to obtain proper output
data from vtkWindowToImageFilter. I would like to omit render window and go
directly from vtkChartXY to PNG ( Let assume that there is no X11 support
on the machine where program will work), but I suppose that it is not
possible easily.
On 10/24/2012 01:55 PM, Jothybasu Selvaraj wrote:
</pre>
<blockquote type="cite">
<pre wrap="">
Here you go
vtkSmartPointer<vtkWindowToImageFilter> windowToImageFilter =
vtkSmartPointer<vtkWindowToImageFilter>::New();
windowToImageFilter->SetInput(this->view->GetRenderWindow());
windowToImageFilter->Update();
vtkSmartPointer<vtkPNGWriter> writer =
vtkSmartPointer<vtkPNGWriter>::New();
writer->SetFileName("FileName");
writer->SetInput(windowToImageFilter->GetOutput());
writer->Write();
Jothy
On Wed, Oct 24, 2012 at 12:52 PM, Jakub Poła <a class="moz-txt-link-rfc2396E" href="mailto:jakub.pola@gmail.com"><jakub.pola@gmail.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">
Good Morning,
I have question related to create charts in vtk. Is it possible to save
chart as png image without creating the snapshot of window like in
paraview?
I would like to write a batch program which aims to analyze large data
set
and creates series of charts.
I have vtkTable feeded by the vtkExtractArraysOverTime filter, then
basing
on this table I would like to create chart object which I would like save
as
PNG image.
Thank you very much for your support.
Jakub
--
Pozdrawiam,
Jakub Poła
_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at
<a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the VTK FAQ at:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
</pre>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
<pre wrap="">
--
Pozdrawiam,
Jakub Poła
_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at
<a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the VTK FAQ at:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
</pre>
</blockquote>
</blockquote>
<pre wrap="">_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the VTK FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Pozdrawiam,
Jakub Poła</pre>
</body>
</html>