summaryrefslogtreecommitdiffstats
path: root/video/out/gl_video.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-29 17:19:01 +0100
committerwm4 <wm4@nowhere>2015-01-29 17:19:01 +0100
commit20c5c7e521d194c9be0fc3ee3ebdc0495afee9be (patch)
treef954963892ad05a8d45007dc577a851bafbcb835 /video/out/gl_video.c
parent0bd147bd14e077389535234599b1c2b3b42cbf1c (diff)
downloadmpv-20c5c7e521d194c9be0fc3ee3ebdc0495afee9be.tar.bz2
mpv-20c5c7e521d194c9be0fc3ee3ebdc0495afee9be.tar.xz
vo_opengl: split out a helper for drawing primitives
Useful if we want to reduce the size of gl_video.c further. To some degree this emulates traditional glDrawArrays() usage. It also leaves a loophole for avoiding a reupload every time by leaving ptr==NULL, although this is unused for now.
Diffstat (limited to 'video/out/gl_video.c')
-rw-r--r--video/out/gl_video.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index 26c3f30c1f..9bee4b477d 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -465,20 +465,9 @@ void gl_video_set_debug(struct gl_video *p, bool enable)
static void draw_triangles(struct gl_video *p, struct vertex *vb, int vert_count)
{
- GL *gl = p->gl;
-
assert(vert_count % 3 == 0);
- gl->BindBuffer(GL_ARRAY_BUFFER, p->vao.buffer);
- gl->BufferData(GL_ARRAY_BUFFER, vert_count * sizeof(struct vertex), vb,
- GL_DYNAMIC_DRAW);
- gl->BindBuffer(GL_ARRAY_BUFFER, 0);
-
- gl_vao_bind(&p->vao);
-
- gl->DrawArrays(GL_TRIANGLES, 0, vert_count);
-
- gl_vao_unbind(&p->vao);
+ gl_vao_draw_data(&p->vao, GL_TRIANGLES, vb, vert_count);
debug_check_gl(p, "after rendering");
}