<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Allright after a short holiday, I had another few hours to debug the
    issue. But no success.<br>
    <br>
    Some other stuff that I tried (but now I'm out of ideas):<br>
    * Installing everything inside a VirtualBox running Ubuntu 14.04
    (using the Ubuntu-provided<br>
      vtk packages, which are broken btw:
    <a class="moz-txt-link-freetext" href="https://bugs.launchpad.net/ubuntu/+source/vtk6/+bug/1354127">https://bugs.launchpad.net/ubuntu/+source/vtk6/+bug/1354127</a>)<br>
    * Using VTK 6.2 (building my own version of VTK)<br>
    * Using OpenGL software rendering (I thought that maybe it's a
    driver issue of the intel drivers)<br>
    <br>
    All yield the same corrupted result: The image that I sent in the
    last email.<br>
    I haven't tried running it on a completely different machine, since
    I have none available ATM.<br>
    Any ideas on how I could proceed?<br>
    <br>
    - Stefan<br>
    <br>
    <div class="moz-cite-prefix">Am 29.06.2015 um 16:23 schrieb David
      Lonie:<br>
    </div>
    <blockquote
cite="mid:CA+=e1oth94nwkzg_mc9OL6ZYp8zygzH4V7sHMJQ=1PEUC_ryRA@mail.gmail.com"
      type="cite">
      <div dir="ltr">and the attachment...</div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Mon, Jun 29, 2015 at 10:22 AM, David
          Lonie <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:david.lonie@kitware.com" target="_blank">david.lonie@kitware.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Running the test script works for me -- see
              attachment, the VTK window is on the right, and the svg
              rendered in chrome on the left.
              <div><br>
              </div>
              <div>Some other issues that might be coming into play:</div>
              <div><br>
              </div>
              <div>1) What Qt version are you using, and</div>
              <div>2) Which OpenGL backend is being used on VTK? (Did
                you explicitly select the experimental OpenGL2 backend
                while building VTK?)</div>
              <div><br>
              </div>
              <div>Dave</div>
              <div>
                <div class="h5">
                  <div><br>
                  </div>
                  <div class="gmail_extra"><br>
                    <div class="gmail_quote">On Mon, Jun 29, 2015 at
                      8:54 AM, Stefan Lau <span dir="ltr"><<a
                          moz-do-not-send="true"
                          href="mailto:github@stefanlau.com"
                          target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:github@stefanlau.com">github@stefanlau.com</a></a>></span>
                      wrote:<br>
                      <blockquote class="gmail_quote" style="margin:0 0
                        0 .8ex;border-left:1px #ccc
                        solid;padding-left:1ex">Hi,<br>
                        <br>
                        I'm trying to export an image from my
                        application created in PyQt4 to a<br>
                        vector image. While the vtkGL2PSExporter works
                        fine from outside my QT<br>
                        application, when trying to export the image
                        from inside it the output looks corrupted. A
                        minimal example can be found at the end of this
                        email. Did I miss something (or call something
                        incorrectly)? Is this a known issue?<br>
                        <br>
                        Version: VTK 6.1.0<br>
                        <br>
                        Thanks for any help,<br>
                        Stefan Lau
                        <div>
                          <div><br>
                            <br>
                            <br>
                            Minimal Example:<br>
                            #!/usr/bin/env python<br>
                            <br>
                            import sys<br>
                            import os<br>
                            import vtk<br>
                            from PyQt4 import QtCore, QtGui<br>
                            from vtk.qt4.QVTKRenderWindowInteractor
                            import QVTKRenderWindowInteractor<br>
                            <br>
                            class MainWindow(QtGui.QMainWindow):<br>
                            <br>
                                def __init__(self, parent = None):<br>
                                    QtGui.QMainWindow.__init__(self,
                            parent)<br>
                            <br>
                                    self.frame = QtGui.QFrame()<br>
                            <br>
                                    self.vl = QtGui.QVBoxLayout()<br>
                                    self.vtkWidget =
                            QVTKRenderWindowInteractor(self.frame)<br>
                                    self.vl.addWidget(self.vtkWidget)<br>
                            <br>
                                    self.ren = vtk.vtkRenderer()<br>
                                   
                            self.vtkWidget.GetRenderWindow().AddRenderer(self.ren)<br>
                                    self.iren =
                            self.vtkWidget.GetRenderWindow().GetInteractor()<br>
                            <br>
                                    # Create source<br>
                                    source = vtk.vtkSphereSource()<br>
                                    source.SetCenter(0, 0, 0)<br>
                                    source.SetRadius(5.0)<br>
                            <br>
                                    # Create a mapper<br>
                                    mapper = vtk.vtkPolyDataMapper()<br>
                                   
                            mapper.SetInputConnection(source.GetOutputPort())<br>
                            <br>
                                    # Create an actor<br>
                                    actor = vtk.vtkActor()<br>
                                    actor.SetMapper(mapper)<br>
                            <br>
                                    button =
                            QtGui.QPushButton(self.frame)<br>
                                    button.setGeometry(20, 20, 32, 32)<br>
                                   
                            button.setIcon(QtGui.QIcon.fromTheme('document-save'))<br>
                                    button.setToolTip('Save
                            Visualization')<br>
                            <br>
                                   
                            button.clicked.connect(self.store_visualization)<br>
                            <br>
                                    self.ren.AddActor(actor)<br>
                            <br>
                                    self.ren.ResetCamera()<br>
                            <br>
                                    self.frame.setLayout(self.vl)<br>
                                    self.setCentralWidget(self.frame)<br>
                            <br>
                                    self.show()<br>
                                    self.iren.Initialize()<br>
                            <br>
                          </div>
                        </div>
                            def store_visualization(self,
                        render_window):<span><br>
                                  file_name =
                          str(QtGui.QFileDialog.getSaveFileName(<br>
                                      self,<br>
                                      'Save Visualization',<br>
                                      os.path.join(os.getcwd(),
                          '/visualization.svg'),<br>
                                      'SVG-Images (*.svg)'<br>
                                  ))<br>
                          <br>
                                  if len(file_name) > 0:<br>
                                      exporter = vtk.vtkGL2PSExporter()<br>
exporter.SetRenderWindow(self.vtkWidget.GetRenderWindow())<br>
                                      exporter.SetFileFormatToSVG()<br>
                                      exporter.CompressOff()<br>
                                      exporter.DrawBackgroundOff()<br>
                                     
                          exporter.SetFilePrefix(os.path.splitext(file_name)[0])<br>
                                      exporter.Write()<br>
                          <br>
                          <br>
                          if __name__ == "__main__":<br>
                              app = QtGui.QApplication(sys.argv)<br>
                              window = MainWindow()<br>
                              sys.exit(app.exec_())<br>
                        </span>
                        _______________________________________________<br>
                        Powered by <a moz-do-not-send="true"
                          href="http://www.kitware.com" rel="noreferrer"
                          target="_blank">www.kitware.com</a><br>
                        <br>
                        Visit other Kitware open-source projects at <a
                          moz-do-not-send="true"
                          href="http://www.kitware.com/opensource/opensource.html"
                          rel="noreferrer" target="_blank"><a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a></a><br>
                        <br>
                        Please keep messages on-topic and check the VTK
                        FAQ at: <a moz-do-not-send="true"
                          href="http://www.vtk.org/Wiki/VTK_FAQ"
                          rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
                        <br>
                        Search the list archives at: <a
                          moz-do-not-send="true"
                          href="http://markmail.org/search/?q=vtkusers"
                          rel="noreferrer" target="_blank"><a class="moz-txt-link-freetext" href="http://markmail.org/search/?q=vtkusers">http://markmail.org/search/?q=vtkusers</a></a><br>
                        <br>
                        Follow this link to subscribe/unsubscribe:<br>
                        <a moz-do-not-send="true"
                          href="http://public.kitware.com/mailman/listinfo/vtkusers"
                          rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
                      </blockquote>
                    </div>
                    <br>
                  </div>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>