summaryrefslogtreecommitdiffstats
path: root/video/out/gl_utils.h
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_utils.h
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_utils.h')
-rw-r--r--video/out/gl_utils.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/video/out/gl_utils.h b/video/out/gl_utils.h
index b73e12a8eb..1934396afe 100644
--- a/video/out/gl_utils.h
+++ b/video/out/gl_utils.h
@@ -44,8 +44,10 @@ mp_image_t *glGetWindowScreenshot(GL *gl);
void mp_log_source(struct mp_log *log, int lev, const char *src);
struct gl_vao_entry {
+ // used for shader / glBindAttribLocation
const char *name;
- int num_elems;
+ // glVertexAttribPointer() arguments
+ int num_elems; // size (number of elements)
GLenum type;
bool normalized;
int offset;
@@ -53,9 +55,9 @@ struct gl_vao_entry {
struct gl_vao {
GL *gl;
- GLuint vao;
- GLuint buffer;
- int stride; // always assuming interleaved elements
+ GLuint vao; // the VAO object, or 0 if unsupported by driver
+ GLuint buffer; // GL_ARRAY_BUFFER used for the data
+ int stride; // size of each element (interleaved elements are assumed)
const struct gl_vao_entry *entries;
};
@@ -65,6 +67,7 @@ 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);
+void gl_vao_draw_data(struct gl_vao *vao, GLenum prim, void *ptr, size_t num);
struct fbotex {
GL *gl;