aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar torque <torque@1>2015-05-23 09:06:57 -0700
committerGravatar wm4 <wm4@nowhere>2015-05-23 19:21:10 +0200
commit36b1b84216343fd31661ea49991a52187975dc8a (patch)
treea818905203f66acdfb45dc238d56ec2fc616e607
parent8054c034b883b23e68fd8c9ca64749e9776f9fcf (diff)
DOCS/client_api_examples/cocoa-openglcb: do initial flush correctly.
-rw-r--r--DOCS/client_api_examples/cocoa-openglcb/cocoa-openglcb.m16
1 files changed, 5 insertions, 11 deletions
diff --git a/DOCS/client_api_examples/cocoa-openglcb/cocoa-openglcb.m b/DOCS/client_api_examples/cocoa-openglcb/cocoa-openglcb.m
index f65c6a3664..4a4e8aa533 100644
--- a/DOCS/client_api_examples/cocoa-openglcb/cocoa-openglcb.m
+++ b/DOCS/client_api_examples/cocoa-openglcb/cocoa-openglcb.m
@@ -34,7 +34,7 @@ static void glupdate(void *ctx);
@property mpv_opengl_cb_context *mpvGL;
- (instancetype)initWithFrame:(NSRect)frame;
- (void)drawRect;
-- (void)flushBlack;
+- (void)fillBlack;
@end
@implementation MpvClientOGLView
@@ -55,29 +55,23 @@ static void glupdate(void *ctx);
GLint swapInt = 1;
[[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
[[self openGLContext] makeCurrentContext];
+ self.mpvGL = nil;
}
return self;
}
-- (void)flushBlack
+- (void)fillBlack
{
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
- [[self openGLContext] flushBuffer];
- [[self openGLContext] flushBuffer];
-}
-
-- (void)prepareOpenGL
-{
- [super prepareOpenGL];
- [self flushBlack];
- self.mpvGL = nil;
}
- (void)drawRect
{
if (self.mpvGL)
mpv_opengl_cb_draw(self.mpvGL, 0, self.bounds.size.width, -self.bounds.size.height);
+ else
+ [self fillBlack];
[[self openGLContext] flushBuffer];
}