2013-03-01 14:55:08 +00:00
|
|
|
/*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
* You can alternatively redistribute this file and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "cocoa_common.h"
|
|
|
|
#include "gl_common.h"
|
|
|
|
|
2013-09-28 11:51:29 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2014-05-07 19:34:05 +00:00
|
|
|
static bool config_window_cocoa(struct MPGLContext *ctx, int flags)
|
2013-03-01 14:55:08 +00:00
|
|
|
{
|
2014-05-06 20:00:17 +00:00
|
|
|
int rv = vo_cocoa_config_window(ctx->vo, flags,
|
2013-03-01 14:55:08 +00:00
|
|
|
ctx->requested_gl_version >= MPGL_VER(3, 0));
|
|
|
|
if (rv != 0)
|
|
|
|
return false;
|
|
|
|
|
2013-09-11 22:57:32 +00:00
|
|
|
mpgl_load_functions(ctx->gl, (void *)vo_cocoa_glgetaddr, NULL, ctx->vo->log);
|
2013-03-01 14:55:08 +00:00
|
|
|
|
|
|
|
ctx->depth_r = vo_cocoa_cgl_color_size(ctx->vo);
|
|
|
|
ctx->depth_g = vo_cocoa_cgl_color_size(ctx->vo);
|
|
|
|
ctx->depth_b = vo_cocoa_cgl_color_size(ctx->vo);
|
|
|
|
|
|
|
|
if (!ctx->gl->SwapInterval)
|
|
|
|
ctx->gl->SwapInterval = vo_cocoa_swap_interval;
|
|
|
|
|
2013-09-28 11:51:29 +00:00
|
|
|
vo_cocoa_register_gl_clear_callback(ctx->vo, ctx->gl, gl_clear);
|
|
|
|
|
2013-03-01 14:55:08 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void releaseGlContext_cocoa(MPGLContext *ctx)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void swapGlBuffers_cocoa(MPGLContext *ctx)
|
|
|
|
{
|
|
|
|
vo_cocoa_swap_buffers(ctx->vo);
|
|
|
|
}
|
|
|
|
|
2013-03-04 13:23:06 +00:00
|
|
|
static void set_current_cocoa(MPGLContext *ctx, bool current)
|
|
|
|
{
|
|
|
|
vo_cocoa_set_current_context(ctx->vo, current);
|
|
|
|
}
|
|
|
|
|
2013-03-01 14:55:08 +00:00
|
|
|
void mpgl_set_backend_cocoa(MPGLContext *ctx)
|
|
|
|
{
|
|
|
|
ctx->config_window = config_window_cocoa;
|
|
|
|
ctx->releaseGlContext = releaseGlContext_cocoa;
|
|
|
|
ctx->swapGlBuffers = swapGlBuffers_cocoa;
|
|
|
|
ctx->vo_init = vo_cocoa_init;
|
2013-03-04 13:23:06 +00:00
|
|
|
ctx->register_resize_callback = vo_cocoa_register_resize_callback;
|
2013-03-01 14:55:08 +00:00
|
|
|
ctx->vo_uninit = vo_cocoa_uninit;
|
2013-05-15 16:17:18 +00:00
|
|
|
ctx->vo_control = vo_cocoa_control;
|
2013-03-04 13:23:06 +00:00
|
|
|
ctx->set_current = set_current_cocoa;
|
2013-03-01 14:55:08 +00:00
|
|
|
}
|