summaryrefslogtreecommitdiffstats
path: root/video/out/gl_cocoa.c
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-09-28 13:51:29 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-09-28 15:08:40 +0200
commit9d3943840cb472e7921a933a06477f53eca4a17e (patch)
treed993adfc14f5c84a2549a7fdea7ef551fc6a4482 /video/out/gl_cocoa.c
parent73808cd8f0dd30e4cf361fc4bce20cb347e65172 (diff)
downloadmpv-9d3943840cb472e7921a933a06477f53eca4a17e.tar.bz2
mpv-9d3943840cb472e7921a933a06477f53eca4a17e.tar.xz
cocoa_common: call gl_clear indirectly
glClear needs GL headers and we don't want those in `cocoa_common`. Create a callback in `gl_cocoa` and register it `cocoa_common`. Fixes #264
Diffstat (limited to 'video/out/gl_cocoa.c')
-rw-r--r--video/out/gl_cocoa.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/video/out/gl_cocoa.c b/video/out/gl_cocoa.c
index f9acffb2fb..80be3a471d 100644
--- a/video/out/gl_cocoa.c
+++ b/video/out/gl_cocoa.c
@@ -22,6 +22,13 @@
#include "cocoa_common.h"
#include "gl_common.h"
+static void gl_clear(void *ctx)
+{
+ struct GL *gl = ctx;
+ gl->ClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ gl->Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+}
+
static bool config_window_cocoa(struct MPGLContext *ctx, uint32_t d_width,
uint32_t d_height, uint32_t flags)
{
@@ -39,6 +46,8 @@ static bool config_window_cocoa(struct MPGLContext *ctx, uint32_t d_width,
if (!ctx->gl->SwapInterval)
ctx->gl->SwapInterval = vo_cocoa_swap_interval;
+ vo_cocoa_register_gl_clear_callback(ctx->vo, ctx->gl, gl_clear);
+
return true;
}