move vao from WorkspaceSceneOpenGL to GlxContext
EglContext already had a vao, and it makes more sense for the context to take care of this than the scene
This commit is contained in:
parent
7e095412aa
commit
8db8dd24bf
3 changed files with 11 additions and 5 deletions
|
@ -21,10 +21,20 @@ GlxContext::GlxContext(::Display *display, GLXWindow window, GLXContext handle)
|
|||
, m_window(window)
|
||||
, m_handle(handle)
|
||||
{
|
||||
// It is not legal to not have a vertex array object bound in a core context
|
||||
// to make code handling old and new OpenGL versions easier, bind a dummy vao that's used for everything
|
||||
if (!isOpenglES() && hasOpenglExtension(QByteArrayLiteral("GL_ARB_vertex_array_object"))) {
|
||||
glGenVertexArrays(1, &m_vao);
|
||||
glBindVertexArray(m_vao);
|
||||
}
|
||||
}
|
||||
|
||||
GlxContext::~GlxContext()
|
||||
{
|
||||
if (m_vao) {
|
||||
makeCurrent();
|
||||
glDeleteVertexArrays(1, &m_vao);
|
||||
}
|
||||
glXDestroyContext(m_display, m_handle);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ private:
|
|||
::Display *const m_display;
|
||||
const GLXWindow m_window;
|
||||
const GLXContext m_handle;
|
||||
uint32_t m_vao = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -43,11 +43,6 @@ WorkspaceSceneOpenGL::WorkspaceSceneOpenGL(OpenGLBackend *backend)
|
|||
: WorkspaceScene(std::make_unique<ItemRendererOpenGL>())
|
||||
, m_backend(backend)
|
||||
{
|
||||
// It is not legal to not have a vertex array object bound in a core context
|
||||
if (!GLPlatform::instance()->isGLES() && hasGLExtension(QByteArrayLiteral("GL_ARB_vertex_array_object"))) {
|
||||
glGenVertexArrays(1, &vao);
|
||||
glBindVertexArray(vao);
|
||||
}
|
||||
}
|
||||
|
||||
WorkspaceSceneOpenGL::~WorkspaceSceneOpenGL()
|
||||
|
|
Loading…
Reference in a new issue