0

I understand that for any of the Qt OpenGL convenience classes to correctly be initialized and used, they must be called with a valid current context. So, I designed my classes to be initialized from my overloaded QOpenGLWidget::initializeGL() function, in which the documentation states the context is created and made current (albeit without a framebuffer).

However, when initializeGL() attempts to initialize one of my subclasses MeshObject, specifically calling the function QOpenGLVertexArrayObject::create(), the program crashes with the message

Read access violation at 0x0 Going through with a debugger, note the call stack:

enter image description here

There are calls being made to QPainter::drawImage, which would surely fail as there is no framebuffer present.

But why is there a QPainter::drawImage call happening when I try to create a vertexArrayObject? Surely this function should have no involvement with painting to the screen.

ALthough the documentation also states that QOpenGLVertexArrayObjects will only work on some OpenGL ES 2.0 platforms, vbuffer.create() causes exactly the same scenario to occur, and I've already used QOpenGLVertexArrayObjects on this exact machine on a previous project with absolutely no problems.

Complete stack trace:

0   QPainter::drawImage Qt5Guid     0x58292a56  
1   QPainter::drawImage Qt5Guid     0x5829203c  
2   MeshState::initBuffers  meshobject.cpp  71  0x2fb793    
3   SceneObject::setupObjects   sceneobject.cpp 18  0x2fa1eb    
4   SceneObject::initialize sceneobject.cpp 12  0x2fa12f    
5   OpenGLWidget::initializeGL  openglwidget.cpp    34  0x2f8ecf    
6   QAbstractScrollArea::setHorizontalScrollBar Qt5Widgetsd     0x587a9859  
7   QAbstractScrollArea::setHorizontalScrollBar Qt5Widgetsd     0x587a86da  
8   QAbstractScrollArea::setHorizontalScrollBar Qt5Widgetsd     0x58770104  
9   QAbstractScrollArea::setHorizontalScrollBar Qt5Widgetsd     0x587a8850  
10  QAbstractScrollArea::setHorizontalScrollBar Qt5Widgetsd     0x5872548e  
11  QAbstractScrollArea::setHorizontalScrollBar Qt5Widgetsd     0x587235f5  
12  QSortFilterProxyModel::mapToSource  Qt5Cored        0x591b6b47  
13  QSortFilterProxyModel::mapToSource  Qt5Cored        0x591bf379  
14  QAbstractScrollArea::setHorizontalScrollBar Qt5Widgetsd     0x5877a3a3  
15  QAbstractScrollArea::setHorizontalScrollBar Qt5Widgetsd     0x5877a618  
16  QAbstractScrollArea::setHorizontalScrollBar Qt5Widgetsd     0x5876be41  
17  QAbstractScrollArea::setHorizontalScrollBar Qt5Widgetsd     0x5876c0bb  
18  QAbstractScrollArea::setHorizontalScrollBar Qt5Widgetsd     0x58779441  
19  QAbstractScrollArea::setHorizontalScrollBar Qt5Widgetsd     0x5877a62e  
20  QAbstractScrollArea::setHorizontalScrollBar Qt5Widgetsd     0x5876be41  
21  QAbstractScrollArea::setHorizontalScrollBar Qt5Widgetsd     0x5876c0bb  
22  main    main.cpp    10  0x2f3419    
23  WinMain qtmain_win.cpp  113 0x2fdcdd    
24  __tmainCRTStartup   crtexe.c    618 0x2fd0bf    
25  WinMainCRTStartup   crtexe.c    466 0x2fce7d    
26  BaseThreadInitThunk KERNEL32        0x772e38f4  
27  __RtlUserThreadStart    ntdll       0x77865de3  
28  _RtlUserThreadStart ntdll       0x77865dae  
Maxim Blinov
  • 886
  • 9
  • 33

0 Answers0