VTK9.0.1+pyqt5 on TX2 cannot initialize
I can run my code correctly on the pc(ubuntu18.04+i5+gtx1060), but it cannot be displayed when deployed on tx2. The error message is “ERR| vtkXOpenGLRenderWindow (0x198ce420): GLEW could not be initialized: Missing GL version”
vtk is installed by compilation (VTK_PYTHON_VERSION = 3, VTK_WRAP_PYTHON = ON)
the code is:
from PyQt5.QtWidgets import QApplication, QMainWindow
import sys
import vtk
from PyQt5 import QtCore, QtGui, QtWidgets
from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor
class myMainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
QtWidgets.QMainWindow.__init__(self, parent)
self.frame = QtWidgets.QFrame()
self.vl = QtWidgets.QVBoxLayout()
self.vtkWidget = QVTKRenderWindowInteractor(self.frame)
self.vl.addWidget(self.vtkWidget)
self.ren = vtk.vtkRenderer()
self.vtkWidget.GetRenderWindow().AddRenderer(self.ren)
self.iren = self.vtkWidget.GetRenderWindow().GetInteractor()
# Create source
source = vtk.vtkConeSource()
source.SetCenter(0, 0, 0)
source.SetRadius(0.1)
source1 = vtk.vtkSphereSource()
source1.SetCenter(0, 0, 0)
source1.SetRadius(0.3)
# Create a mapper
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(source.GetOutputPort())
mapper1 = vtk.vtkPolyDataMapper()
mapper1.SetInputConnection(source1.GetOutputPort())
# Create an actor
actor = vtk.vtkActor()
actor.SetMapper(mapper)
actor1 = vtk.vtkActor()
actor1.SetMapper(mapper1)
self.ren.AddActor(actor)
self.ren.AddActor(actor1)
self.ren.ResetCamera()
self.frame.setLayout(self.vl)
self.setCentralWidget(self.frame)
self.show()
self.iren.Initialize()
if __name__ == "__main__":
app = QApplication(sys.argv)
window = myMainWindow()
sys.exit(app.exec_())
the full error message is :
$ python3 test.py
2021-01-20 20:20:47.692 ( 0.988s) [ A4946E00]vtkOpenGLRenderWindow.c:569 ERR| vtkXOpenGLRenderWindow (0x2588420): GLEW could not be initialized: Missing GL version
2021-01-20 20:20:47.692 ( 0.988s) [ A4946E00] vtkOpenGLState.cxx:63 WARN| Error in cache state for GL_DEPTH_WRITEMASK
2021-01-20 20:20:47.692 ( 0.988s) [ A4946E00] vtkOpenGLState.cxx:72 WARN| Error in cache state for GL_COLOR_WRITEMASK
2021-01-20 20:20:47.692 ( 0.988s) [ A4946E00] vtkOpenGLState.cxx:79 WARN| Error in cache state for GL_BLEND
2021-01-20 20:20:47.692 ( 0.988s) [ A4946E00] vtkOpenGLState.cxx:86 WARN| Error in cache state for GL_DEPTH_TEST
2021-01-20 20:20:47.692 ( 0.988s) [ A4946E00] vtkOpenGLState.cxx:109 WARN| Error in cache state for GL_SCISSOR_TEST
2021-01-20 20:20:47.692 ( 0.988s) [ A4946E00] vtkOpenGLState.cxx:132 WARN| Error in cache state for GL_VIEWPORT
2021-01-20 20:20:47.692 ( 0.988s) [ A4946E00] vtkOpenGLState.cxx:140 WARN| Error in cache state for GL_SCISSOR_BOX
2021-01-20 20:20:47.692 ( 0.988s) [ A4946E00] vtkOpenGLState.cxx:147 WARN| Error in cache state for GL_CULL_FACE_MODE
2021-01-20 20:20:47.692 ( 0.988s) [ A4946E00] vtkOpenGLState.cxx:154 WARN| Error in cache state for GL_ACTIVE_TEXTURE
2021-01-20 20:20:47.692 ( 0.988s) [ A4946E00] vtkOpenGLState.cxx:161 WARN| Error in cache state for GL_DEPTH_FUNC
2021-01-20 20:20:47.692 ( 0.988s) [ A4946E00] vtkOpenGLState.cxx:168 WARN| Error in cache state for GL_BLEND_SRC_RGB
2021-01-20 20:20:47.692 ( 0.988s) [ A4946E00] vtkOpenGLState.cxx:175 WARN| Error in cache state for GL_BLEND_SRC_ALPHA
2021-01-20 20:20:47.692 ( 0.988s) [ A4946E00] vtkOpenGLState.cxx:182 WARN| Error in cache state for GL_BLEND_DST_RGB
2021-01-20 20:20:47.692 ( 0.988s) [ A4946E00] vtkOpenGLState.cxx:189 WARN| Error in cache state for GL_BLEND_DST_ALPHA
2021-01-20 20:20:47.692 ( 0.988s) [ A4946E00] vtkOpenGLState.cxx:196 WARN| Error in cache state for GL_DRAW_FRAMEBUFFER_BINDING
2021-01-20 20:20:47.692 ( 0.989s) [ A4946E00] vtkOpenGLState.cxx:203 WARN| Error in cache state for GL_READ_FRAMEBUFFER_BINDING
2021-01-20 20:20:47.692 ( 0.989s) [ A4946E00] vtkOpenGLState.cxx:222 WARN| Error in cache state for GL_DRAW_BUFFER got -148227696 expected1026
2021-01-20 20:20:47.692 ( 0.989s) [ A4946E00] vtkOpenGLState.cxx:240 WARN| Error in cache state for GL_READ_BUFFER
2021-01-20 20:20:47.692 ( 0.989s) [ A4946E00] vtkOpenGLState.cxx:257 WARN| Error in cache state for GL_COLOR_CLEAR_VALUE
2021-01-20 20:20:47.695 ( 0.991s) [ A4946E00] vtkOpenGLState.cxx:265 WARN| at stack loc
0x7f9e4753e0 : ??? [(???) ???:-1]
0x7f9e46ff54 : vtksys::SystemInformation::GetProgramStack[abi:cxx11](int, int) [(libvtksys-9.0.so.1) ???:-1]
0x7f9759e178 : vtkOpenGLState::CheckState() [(libvtkRenderingOpenGL2-9.0.so.1) ???:-1]
0x7f975a1ebc : vtkOpenGLState::vtkglGetIntegerv(unsigned int, int*) [(libvtkRenderingOpenGL2-9.0.so.1) ???:-1]
0x7f97579ddc : vtkOpenGLRenderWindow::CreateOffScreenFramebuffer(int, int) [(libvtkRenderingOpenGL2-9.0.so.1) ???:-1]
0x7f9757750c : vtkOpenGLRenderWindow::Start() [(libvtkRenderingOpenGL2-9.0.so.1) ???:-1]
0x7f976581c0 : vtkXOpenGLRenderWindow::Start() [(libvtkRenderingOpenGL2-9.0.so.1) ???:-1]
0x7f9bcf1554 : vtkRenderWindow::Render() [(libvtkRenderingCore-9.0.so.1) ???:-1]
0x7f9757ab7c : vtkOpenGLRenderWindow::Render() [(libvtkRenderingOpenGL2-9.0.so.1) ???:-1]
0x7f9765ab28 : vtkXOpenGLRenderWindow::Render() [(libvtkRenderingOpenGL2-9.0.so.1) ???:-1]
0x7f9bcfacfc : vtkRenderWindowInteractor::Render() [(libvtkRenderingCore-9.0.so.1) ???:-1]
0x7f9bcfdbc8 : vtkRenderWindowInteractor::Initialize() [(libvtkRenderingCore-9.0.so.1) ???:-1]
0x7f9c035a70 : ??? [(???) ???:-1]
0x5bbd4c : _PyCFunction_FastCallDict [(python3) ???:-1]
0x52ba70 : ??? [(???) ???:-1]
0x5306c0 : _PyEval_EvalFrameDefault [(python3) ???:-1]
0x52b108 : ??? [(???) ???:-1]
0x52b42c : _PyFunction_FastCallDict [(python3) ???:-1]
0x607a20 : _PyObject_FastCallDict [(python3) ???:-1]
0x5f4d34 : ??? [(???) ???:-1]
0x608da8 : PyObject_Call [(python3) ???:-1]
0x597e30 : ??? [(???) ???:-1]
0x5a740c : ??? [(???) ???:-1]
0x607948 : _PyObject_FastCallDict [(python3) ???:-1]
0x52b850 : ??? [(???) ???:-1]
0x5306c0 : _PyEval_EvalFrameDefault [(python3) ???:-1]
0x52b108 : ??? [(???) ???:-1]
0x631598 : PyRun_FileExFlags [(python3) ???:-1]
0x636c2c : PyRun_SimpleFileExFlags [(python3) ???:-1]
0x621428 : Py_Main [(python3) ???:-1]
0x420d3c : main [(python3) ???:-1]
0x7fa46156e0 : __libc_start_main [(libc.so.6) ???:-1]
0x420e94 : ??? [(???) ???:-1]
Segmentation fault (core dumped)