# How to render vtk objects in different thread.

**URL:** https://discourse.vtk.org/t/how-to-render-vtk-objects-in-different-thread/12641
**Category:** Support
**Tags:** code
**Created:** [November 8, 2023, 10:41am UTC](https://discourse.vtk.org/t/how-to-render-vtk-objects-in-different-thread/12641 "2023-11-08T10:41:32Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![KSJ](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ksj/32/8659_2.png) [@KSJ](https://discourse.vtk.org/u/KSJ)
#### Post date: [November 8, 2023, 10:41am UTC](https://discourse.vtk.org/t/how-to-render-vtk-objects-in-different-thread/12641/1 "2023-11-08T10:41:32Z")

</div>

Hello Everyone,  
I am building an application using VTK , OpenGL and QT . I am using VTKGenericOpenGLRenderWindow for rendering. I need to execute a part of my module in different thread. I tried by using thread but since OpenGL and vtk does not support Threads, Iam getting "OpenGL context cannot be shared "error . I tried to solve by using separate context and "donecurrent()"before calling the thread. But i couldn’t do that. Basically i have a foreverloop  
while(true)  
{  
//i am using renderwindow and interactor in this loop  
}  
which i wish to execute in the background thread, while the vtk’s interaction loop needs to be executed in the main thread. Any ideas would be highly appreciated…
