Hi,<br><br>I am updating Mokka (<a href="http://b-tk.googlecode.com/svn/web/mokka/index.html" target="_blank">http://b-tk.googlecode.com/svn/web/mokka/index.html</a> - a software used in Biomechanics) from VTK 5.6.1 to VTK 5.10 and everything is fine except the text rendering in the charts.<br>



<br>As there is is lots of differences in the charts module between vtk 5.6.1 and vtk 5.10, I checked if the problem came from my code. For that, I created a small executable based on the example &quot;Line plot&quot; but embedded in a QVTKWidget.<br>



<br>The following link (<a href="http://derp.co.uk/c040e" target="_blank">http://derp.co.uk/c040e</a>) gives you the result for VTK 5.6.1 and VTK 5.10. Both version were compiled with Qt 4.7.3 and with the same options (VTK_USE_QT, VTK_USE_QVTK_QTOPENGL)<br>


<br>As you can see the text rendering is not the same and in the case of vtk-5.10, the method <span style="font-family:courier new,monospace">vtkOpenGLContextDevice2D::</span><span style="font-family:courier new,monospace">SetStringRendererToQt</span>() returns false (and then  &quot;No Qt rendering&quot;  is displayed in the title). I tested under Windows 7 and MacOS X (Leopard - 10.5.8) and I have each time the same problem.<br>


<br>Is there anything special to do in VTK 5.10 to have a Qt text rendering in the charts? Should I use QVTKWidget2?<br>
<br>Regards,<br><br>Arnaud<br><br>The code is joined in the ZIP file, but if necessary, here is the source code and the CMake project<br><br><u>main.cpp</u><br><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">#include &lt;vtkRenderWindow.h&gt;</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">#include &lt;vtkSmartPointer.h&gt;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">#include &lt;vtkChartXY.h&gt;</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">#include &lt;vtkPlot.h&gt;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">#include &lt;vtkPen.h&gt;</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">#include &lt;vtkTable.h&gt;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">#include &lt;vtkFloatArray.h&gt;</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">#include &lt;vtkContextView.h&gt;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">#include &lt;vtkContextScene.h&gt;</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">#include &lt;vtkContext2D.h&gt;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">#include &lt;vtkOpenGLContextDevice2D.h&gt;</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">#include &lt;vtkVersion.h&gt;</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">#include &lt;QApplication&gt;</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">#include &lt;QVTKWidget.h&gt;</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">#define VTK_CREATE(type, name) \</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  vtkSmartPointer&lt;type&gt; name = vtkSmartPointer&lt;type&gt;::New()</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">int main(int argc, char *argv[])</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">{</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  QApplication app(argc,argv);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  </span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  QVTKWidget widget;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  widget.resize(640,480);</span><br style="font-family:courier new,monospace">



<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  // Set up a 2D scene, add an XY chart to it</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  VTK_CREATE(vtkContextView, view);</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  VTK_CREATE(vtkChartXY, chart);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  view-&gt;GetScene()-&gt;AddItem(chart);</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  // Link the view with the widget</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  view-&gt;SetInteractor(widget.GetInteractor());</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  widget.SetRenderWindow(view-&gt;GetRenderWindow());</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  // Create a table with some points in it</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  VTK_CREATE(vtkTable, table);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  VTK_CREATE(vtkFloatArray, arrX);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  arrX-&gt;SetName(&quot;X Axis&quot;);</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  table-&gt;AddColumn(arrX);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  VTK_CREATE(vtkFloatArray, arrC);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  arrC-&gt;SetName(&quot;Cosine&quot;);</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  table-&gt;AddColumn(arrC);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  VTK_CREATE(vtkFloatArray, arrS);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  arrS-&gt;SetName(&quot;Sine&quot;);</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  table-&gt;AddColumn(arrS);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  // Fill in the table with some example values</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  int numPoints = 69;</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  float inc = 7.5 / (numPoints-1);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  table-&gt;SetNumberOfRows(numPoints);</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  for (int i = 0; i &lt; numPoints; ++i)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  {</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">    table-&gt;SetValue(i, 0, i * inc);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    table-&gt;SetValue(i, 1, cos(i * inc));</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">    table-&gt;SetValue(i, 2, sin(i * inc));</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  }</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  // Add multiple line plots, setting the colors etc</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  vtkPlot *line = chart-&gt;AddPlot(vtkChart::LINE);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">#if VTK_MAJOR_VERSION &lt;= 5</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  line-&gt;SetInput(table, 0, 1);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">#else</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  line-&gt;SetInputData(table, 0, 1);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">#endif</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  line-&gt;SetColor(0, 255, 0, 255);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  line-&gt;SetWidth(1.0);</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  line = chart-&gt;AddPlot(vtkChart::LINE);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">#if VTK_MAJOR_VERSION &lt;= 5</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  line-&gt;SetInput(table, 0, 2);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">#else</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  line-&gt;SetInputData(table, 0, 2);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">#endif</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  line-&gt;SetColor(255, 0, 0, 255);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  line-&gt;SetWidth(5.0);</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  line-&gt;GetPen()-&gt;SetLineType(2);//For dotted line, can be from 2 to 5 for different dot patterns</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  std::string vtkVersion = vtkVersion::GetVTKVersion();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  std::string qtVersion = qVersion();</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  std::string title = &quot;VTK-&quot; + vtkVersion + &quot; &amp; Qt-&quot; + qtVersion + &quot;: &quot;;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  </span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  if (!vtkOpenGLContextDevice2D::SafeDownCast(view-&gt;GetContext()-&gt;GetDevice())-&gt;SetStringRendererToQt())</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    title += &quot;No Qt Rendering&quot;;</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  else</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    title += &quot;Qt Rendering&quot;;</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  chart-&gt;SetTitle(title.c_str());</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  widget.show();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  app.exec();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  return EXIT_SUCCESS;</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">}</span><br><br><u>CMakeLists.txt</u><br><br><span style="font-family:courier new,monospace">cmake_minimum_required(VERSION 2.6)</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">PROJECT(vtkChartQtTextRendering)</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">FIND_PACKAGE(VTK)</span><br style="font-family:courier new,monospace">


<span style="font-family:courier new,monospace">INCLUDE(${VTK_USE_FILE})</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">SET(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH &quot;&quot;)</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">SET(QT_MOC_EXECUTABLE ${VTK_QT_MOC_EXECUTABLE} CACHE FILEPATH &quot;&quot;)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">SET(QT_UIC_EXECUTABLE ${VTK_QT_UIC_EXECUTABLE} CACHE FILEPATH &quot;&quot;)</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">FIND_PACKAGE(Qt4 REQUIRED)</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">INCLUDE(${QT_USE_FILE})</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace"># Use the include path and library for Qt that is used by VTK.</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR}</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">                    ${QT_QTGUI_INCLUDE_DIR}</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">                    ${QT_QTCORE_INCLUDE_DIR})</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">ADD_EXECUTABLE(vtkChartQtTextRendering main.cpp)</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">TARGET_LINK_LIBRARIES(vtkChartQtTextRendering</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  QVTK</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  ${QT_LIBRARIES}</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">  vtkCharts</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">)</span><br>