OpenGL error occurs in Ubuntu with Qt and VTK

I tried loading of DICOM data example from

in QT application using VTK in Ubuntu system.

I have VTK 8.2.0 and Qt 5.13.1 installed on Ubuntu system.

Compiling and building of this example was successful. But when run it it shows me following error.

ERROR: In /media/bme/ACAA28E4AA28AD30/VTK/VTK-8.2.0/Rendering/OpenGL2/vtkTextureObject.cxx, line 324
vtkTextureObject (0x5583e84d2000): failed at glGenTextures 1 OpenGL errors detected
  0 : (1282) Invalid operation

It also show following message -

Gtk-Message: 17:52:56.210: GtkDialog mapped without a transient parent. This is discouraged.

Could anyone please tell me how to solve it?

P.S. This example works fine in Windows.

Could you write a bit more about what you are trying to achieve? Since there are a number of open-source VTK/Qt DICOM viewer applications out there that actually work well on windows/linux/mac, it is hard to justify spending time with debugging this particular one.

Sorry I did not mention that before.
I am trying to load Dicom series from folder and then I can read it qvtkwidget of Qt using VTK.
Then I can use it for further processing like segmentation.

I tried this example in windows, and it was working fine. But when I use it Ubuntu system, it shows me above error.

You may want to ask the developper of this very example for help :

I have one more question related to qt and vtk.
I tried this example

But while configuring it using ccmake command, it show “GuiSupportQt not found.”
How to solve it? Should I build my VTK again?

Have you tried to build 3D Slicer or MITK? They are well supported medical image visualization software that work on all platforms. If you can work in Python then you don’t even need to build anything just add your custom modules in Python or run custom processing in the interactive Python console.

Ok. But do you know any particular reasons that causes this error?
ERROR: In /media/bme/ACAA28E4AA28AD30/VTK/VTK-8.2.0/Rendering/OpenGL2/vtkTextureObject.cxx, line 324
vtkTextureObject (0x7faccc001620): failed at glGenTextures 1 OpenGL errors detected
0 : (1282) Invalid operation

Because in my QT gui application (And Linux ubuntu), when I load dicom data , this error occurs. In qvtkwidget window, i cannot see the dicom images as well.

Also, I get the following error -
ERROR: In /media/bme/ACAA28E4AA28AD30/VTK/VTK-8.2.0/GUISupport/Qt/QVTKInteractor.cxx, line 147
QVTKInteractor (0x56005ff445e0): QVTKInteractor cannot control the event loop.

Please tell me, if you have any idea, why these errors are occuring. So that i can try to solve it.
Thanks again.

I dont want to use Slicer or MITK for it.
I want to create my own QT GUI application to achieve segmentation.
I created it in windows and it can load dicom data. But the same code does not work in my Linux ubuntu system.
Also, I am struggling with getting coordinates of dicom images after loading it into QT widgets.
Could you please help me by suggesting any code examples?
Thanks again.

We are investing a lot of time into integrating VTK, Qt, and other libraries and make them work well on all platforms, keep them up-to-date, support many users with all their slightly different hardware and software configurations, screen resolutions, GPUs, etc. You can keep redoing this work but you might find that it hard to find collaborators or funding source for this endeavor. If you need to work alone then it is hard to reach feature parity with existing software and keep up with new trends - and it is less fun. I just recommend to join a nice developer community (centered around a software platform that you can build your software on) so that you can focus on what makes a difference in the world: your ideas, your algorithms, the clinical problems that you want to solve.

I don’t have any specific suggestions to the errors that you are experiencing or the questions that you have, but you can check out how these things are done in existing VTK/Qt-based medical applications.