summaryrefslogtreecommitdiffstats
path: root/video/out/vo_opengl.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-26 20:48:11 +0100
committerwm4 <wm4@nowhere>2014-11-26 20:48:18 +0100
commit3fe57e3cb691d75dc8813c29cada5e3ddfd2a295 (patch)
tree93962472662b8d3c402d97cd3f78b91f2d0f4c89 /video/out/vo_opengl.c
parent7e62f2b0527e2a4d96418b9d8009dd840a45df0c (diff)
downloadmpv-3fe57e3cb691d75dc8813c29cada5e3ddfd2a295.tar.bz2
mpv-3fe57e3cb691d75dc8813c29cada5e3ddfd2a295.tar.xz
gl_common: factor context creation
Always create the context in mpgl_init(), instead of doing it when mpgl_config_window() is called the first time. This is a small step towards cleaning up the GL backend interface, and adding other things like perhaps GLES support, or a callback-driven backend for libmpv.
Diffstat (limited to 'video/out/vo_opengl.c')
-rw-r--r--video/out/vo_opengl.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c
index 0c35ca3ee0..c7d274ec72 100644
--- a/video/out/vo_opengl.c
+++ b/video/out/vo_opengl.c
@@ -186,23 +186,6 @@ static int query_format(struct vo *vo, uint32_t format)
return caps;
}
-static bool config_window(struct gl_priv *p, int flags)
-{
- if (p->renderer_opts->stereo_mode == GL_3D_QUADBUFFER)
- flags |= VOFLAG_STEREO;
-
- if (p->renderer_opts->alpha_mode == 1)
- flags |= VOFLAG_ALPHA;
-
- if (p->use_gl_debug)
- flags |= VOFLAG_GL_DEBUG;
-
- int mpgl_caps = MPGL_CAP_GL21 | MPGL_CAP_TEX_RG;
- if (!p->allow_sw)
- mpgl_caps |= MPGL_CAP_NO_SW;
- return mpgl_config_window(p->glctx, mpgl_caps, flags);
-}
-
static void video_resize_redraw_callback(struct vo *vo, int w, int h)
{
struct gl_priv *p = vo->priv;
@@ -216,7 +199,7 @@ static int reconfig(struct vo *vo, struct mp_image_params *params, int flags)
mpgl_lock(p->glctx);
- if (!config_window(p, flags)) {
+ if (!mpgl_reconfig_window(p->glctx, flags)) {
mpgl_unlock(p->glctx);
return -1;
}
@@ -462,14 +445,26 @@ static int preinit(struct vo *vo)
struct gl_priv *p = vo->priv;
p->vo = vo;
- p->glctx = mpgl_init(vo, p->backend);
+ int vo_flags = 0;
+
+ if (p->renderer_opts->stereo_mode == GL_3D_QUADBUFFER)
+ vo_flags |= VOFLAG_STEREO;
+
+ if (p->renderer_opts->alpha_mode == 1)
+ vo_flags |= VOFLAG_ALPHA;
+
+ if (p->use_gl_debug)
+ vo_flags |= VOFLAG_GL_DEBUG;
+
+ int mpgl_caps = MPGL_CAP_GL21 | MPGL_CAP_TEX_RG;
+ if (!p->allow_sw)
+ mpgl_caps |= MPGL_CAP_NO_SW;
+
+ p->glctx = mpgl_init(vo, p->backend, mpgl_caps, vo_flags);
if (!p->glctx)
goto err_out;
p->gl = p->glctx->gl;
- if (!config_window(p, VOFLAG_HIDDEN))
- goto err_out;
-
mpgl_set_context(p->glctx);
if (p->gl->SwapInterval)