Skip to content

Instantly share code, notes, and snippets.

@fmorency
Created June 27, 2012 17:43
Show Gist options
  • Save fmorency/3005627 to your computer and use it in GitHub Desktop.
Save fmorency/3005627 to your computer and use it in GitHub Desktop.
GLXBadDrawable when using multiple QVTKRenderWindow
import sys
import vtk
from vtk.qt4.QVTKRenderWindowInteractor import *
from PySide.QtCore import *
from PySide.QtGui import *
if __name__ == '__main__':
#Qt boilerplate
app = QApplication(sys.argv)
vtk_interactor1 = QVTKRenderWindowInteractor()
vtk_interactor2 = QVTKRenderWindowInteractor()
vtk_interactor1.Initialize()
vtk_interactor2.Initialize()
#Create our VTK renderer
ren1 = vtk.vtkRenderer()
ren2 = vtk.vtkRenderer()
vtk_interactor1.GetRenderWindow().AddRenderer(ren1)
vtk_interactor2.GetRenderWindow().AddRenderer(ren2)
#A cone source
cone = vtk.vtkConeSource()
cone.SetResolution(8)
coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInputConnection(cone.GetOutputPort())
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
#Each renderer will display a cone
ren1.AddActor(coneActor)
ren2.AddActor(coneActor)
vtk_interactor1.show()
vtk_interactor2.show()
#Render our cone
vtk_interactor1.GetRenderWindow().Render()
vtk_interactor2.GetRenderWindow().Render()
app.exec_()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment