# QVTKOpenGLNativeWidget crash when using Mesa

**URL:** https://discourse.vtk.org/t/qvtkopenglnativewidget-crash-when-using-mesa/8283
**Category:** Support
**Created:** [April 12, 2022, 2:16pm UTC](https://discourse.vtk.org/t/qvtkopenglnativewidget-crash-when-using-mesa/8283 "2022-04-12T14:16:42Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![andra](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/9fc29f/32.png) [@andra](https://discourse.vtk.org/u/andra)
#### Post date: [April 12, 2022, 2:16pm UTC](https://discourse.vtk.org/t/qvtkopenglnativewidget-crash-when-using-mesa/8283/1 "2022-04-12T14:16:42Z")

</div>

Hello,  
I have a problem with QVTKOpenGLNativeWidget when using software rendering mode. The application crashes when widget-\>show() is called.  
I am using vtk 9.0.1 with Qt6 ( 6.2.4) and Mesa driver 22.0 ([Releases · pal1000/mesa-dist-win · GitHub](https://github.com/pal1000/mesa-dist-win/releases)).

This minimal example illustrates the problem:

#include \<QtGui/qsurfaceformat.h\>  
#include   
#include \<vtkAutoInit.h\>

VTK\_MODULE\_INIT( vtkRenderingOpenGL2 )  
VTK\_MODULE\_INIT( vtkRenderingContextOpenGL2 )  
#include \<QVTKOpenGLNativeWidget.h\>  
#include \<vtkGenericOpenGLRenderWindow.h\>

int main( int argc, char\*\* argv ) {

```
SetEnvironmentVariableW( L"gallium_driver", L"llvmpipe" );
SetEnvironmentVariableW( L"QT_LOGGING_RULES", L"qt.qpa.gl=true" );

//when setting this to false, it works without problems 
QCoreApplication::setAttribute( Qt::AA_UseSoftwareOpenGL, true );

auto format = QVTKOpenGLNativeWidget::defaultFormat();
QSurfaceFormat::setDefaultFormat( format );
QApplication app( argc, argv );

auto* qvtkWidget_ = new QVTKOpenGLNativeWidget();
qvtkWidget_->show(); // crashes here 

std::cout << "Window is ready to render " << std::boolalpha << qvtkWidget_->isValid();
qvtkWidget_->close();
delete qvtkWidget_;

return EXIT_SUCCESS;

```

}

Any help would be very appreciated.

Output from qt.qpa.gl:

 ![grafik](https://discourse.vtk.org/uploads/default/original/2X/4/497c6dfa7dc8691733c6466a3bc4ac4eb8abc34b.png)

Crash

 ![grafik](https://discourse.vtk.org/uploads/default/original/2X/a/a4acf791714a2173fa6595ed2b0b8b946c30bddf.png)
