mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
gl: fixup vao and vbo usage for legacy GL
This commit is contained in:
parent
b428dec737
commit
ba3a3cd783
6 changed files with 19 additions and 9 deletions
|
@ -468,6 +468,7 @@ _callback (gpointer stuff)
|
|||
|
||||
if (gl->GenVertexArrays) {
|
||||
_bind_buffer (cube_filter);
|
||||
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1215,8 +1215,12 @@ gst_glimage_sink_thread_init_redisplay (GstGLImageSink * gl_sink)
|
|||
gl->GenBuffers (1, &gl_sink->vertex_buffer);
|
||||
_bind_buffer (gl_sink);
|
||||
|
||||
if (gl->GenVertexArrays)
|
||||
if (gl->GenVertexArrays) {
|
||||
gl->BindVertexArray (0);
|
||||
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
} else {
|
||||
_unbind_buffer (gl_sink);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1229,8 +1233,10 @@ gst_glimage_sink_cleanup_glthread (GstGLImageSink * gl_sink)
|
|||
gl_sink->redisplay_shader = NULL;
|
||||
}
|
||||
|
||||
if (gl_sink->vao)
|
||||
if (gl_sink->vao) {
|
||||
gl->DeleteVertexArrays (1, &gl_sink->vao);
|
||||
gl_sink->vao = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -532,6 +532,7 @@ gst_gl_overlay_callback (gint width, gint height, guint texture, gpointer stuff)
|
|||
if (overlay->geometry_change)
|
||||
_bind_buffer (overlay, overlay->overlay_vbo);
|
||||
gl->BindVertexArray (overlay->overlay_vao);
|
||||
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
} else {
|
||||
_bind_buffer (overlay, overlay->overlay_vbo);
|
||||
}
|
||||
|
|
|
@ -465,8 +465,6 @@ _upload_vertices (GstGLTransformation * transformation)
|
|||
|
||||
gl->BufferData (GL_ARRAY_BUFFER, 4 * 6 * sizeof (GLfloat), vertices,
|
||||
GL_STATIC_DRAW);
|
||||
|
||||
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -546,12 +544,16 @@ gst_gl_transformation_callback (gpointer stuff)
|
|||
if (gl->GenVertexArrays)
|
||||
gl->BindVertexArray (transformation->vao);
|
||||
|
||||
if (transformation->caps_change)
|
||||
if (transformation->caps_change) {
|
||||
_upload_vertices (transformation);
|
||||
|
||||
if (!gl->GenVertexArrays || transformation->caps_change)
|
||||
_bind_buffer (transformation);
|
||||
|
||||
if (gl->GenVertexArrays)
|
||||
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
} else if (!gl->GenVertexArrays) {
|
||||
_bind_buffer (transformation);
|
||||
}
|
||||
|
||||
gl->DrawElements (GL_TRIANGLE_STRIP, 5, GL_UNSIGNED_SHORT, indices);
|
||||
|
||||
if (gl->GenVertexArrays)
|
||||
|
|
|
@ -747,9 +747,8 @@ gst_gl_video_mixer_callback (gpointer stuff)
|
|||
|
||||
if (gl->GenVertexArrays)
|
||||
gl->BindVertexArray (0);
|
||||
else
|
||||
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
|
||||
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
gl->BindTexture (GL_TEXTURE_2D, 0);
|
||||
|
||||
gl->Disable (GL_BLEND);
|
||||
|
|
|
@ -1596,6 +1596,7 @@ gst_gl_filter_draw_texture (GstGLFilter * filter, GLuint texture,
|
|||
|
||||
if (gl->GenVertexArrays) {
|
||||
_bind_buffer (filter);
|
||||
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue