Skip to content

Commit

Permalink
Added sensible destruction of vector array object to gl3widget
Browse files Browse the repository at this point in the history
  • Loading branch information
alanspencer committed Apr 10, 2020
1 parent 7a1072e commit a827cf4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions SPIERSview/src/gl3widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ GlWidget::~GlWidget()
lightingShaderProgramForColour.release();
lightingShaderProgram.deleteLater();
lightingShaderProgramForColour.deleteLater();

#ifdef __APPLE__
vao.release();
vao.deleteLater();
#endif
}

/**
Expand All @@ -87,8 +92,8 @@ void GlWidget::initializeGL()
#ifdef __APPLE__
// OpenGL version 3.x+ requires the VertexArrayBuffer to be created and bound at initialization.
// Current only needed for macOS
m_vao.create();
m_vao.bind();
vao.create();
vao.bind();
#endif

#ifdef __APPLE__
Expand Down
2 changes: 1 addition & 1 deletion SPIERSview/src/gl3widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class GlWidget : public QOpenGLWidget, protected QOpenGLFunctions
int xdim;
int ydim;

QOpenGLVertexArrayObject m_vao;
QOpenGLVertexArrayObject vao;
QOpenGLFunctions *glfunctions;
QOpenGLShaderProgram lightingShaderProgram;
QOpenGLShaderProgram lightingShaderProgramForColour;
Expand Down

0 comments on commit a827cf4

Please sign in to comment.