diff options
author | wm4 <wm4@nowhere> | 2015-01-28 22:22:29 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-01-28 22:22:29 +0100 |
commit | 34d3a27f28030a05830a775420cc692a2156bf7d (patch) | |
tree | ac0733ed43569ce1ab471773dbbe342b239741a5 /video/out/gl_utils.h | |
parent | 616481ad290b3bc43d551d946dd5c0fe7423f8b2 (diff) | |
download | mpv-34d3a27f28030a05830a775420cc692a2156bf7d.tar.bz2 mpv-34d3a27f28030a05830a775420cc692a2156bf7d.tar.xz |
vo_opengl: create abstraction for VAOs
Handles stupid boilerplate OpenGL requires you to handle. It's the same
code as in gl_video.c, although if no VAOs are available, the fallback
code rebinds them on every draw call instead of just once.
Diffstat (limited to 'video/out/gl_utils.h')
-rw-r--r-- | video/out/gl_utils.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/video/out/gl_utils.h b/video/out/gl_utils.h index 4f32e5ff56..482c88a0fa 100644 --- a/video/out/gl_utils.h +++ b/video/out/gl_utils.h @@ -43,4 +43,27 @@ mp_image_t *glGetWindowScreenshot(GL *gl); // log, lev: module and log level, as in mp_msg() void mp_log_source(struct mp_log *log, int lev, const char *src); +struct gl_vao_entry { + const char *name; + int num_elems; + GLenum type; + bool normalized; + int offset; +}; + +struct gl_vao { + GL *gl; + GLuint vao; + GLuint buffer; + int stride; // always assuming interleaved elements + const struct gl_vao_entry *entries; +}; + +void gl_vao_init(struct gl_vao *vao, GL *gl, int stride, + const struct gl_vao_entry *entries); +void gl_vao_uninit(struct gl_vao *vao); +void gl_vao_bind(struct gl_vao *vao); +void gl_vao_unbind(struct gl_vao *vao); +void gl_vao_bind_attribs(struct gl_vao *vao, GLuint program); + #endif |