Пример #1
0
static CoglBool
_cogl_winsys_set_gles2_context (CoglGLES2Context *gles2_ctx, CoglError **error)
{
  CoglContext *ctx = gles2_ctx->context;
  CoglDisplayEGL *egl_display = ctx->display->winsys;
  CoglBool status;

  if (gles2_ctx->write_buffer &&
      cogl_is_onscreen (gles2_ctx->write_buffer))
    status =
      bind_onscreen_with_context (COGL_ONSCREEN (gles2_ctx->write_buffer),
                                  gles2_ctx->winsys);
  else
    status = _cogl_winsys_egl_make_current (ctx->display,
                                            egl_display->dummy_surface,
                                            egl_display->dummy_surface,
                                            gles2_ctx->winsys);

  if (!status)
    {
      _cogl_set_error (error,
                   COGL_WINSYS_ERROR,
                   COGL_WINSYS_ERROR_MAKE_CURRENT,
                   "Failed to make gles2 context current");
      return FALSE;
    }

  return TRUE;
}
Пример #2
0
SDL_Window *
cogl_sdl_onscreen_get_window (CoglOnscreen *onscreen)
{
  CoglOnscreenSdl2 *sdl_onscreen;

  _COGL_RETURN_VAL_IF_FAIL (cogl_is_onscreen (onscreen), NULL);

  if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (onscreen), NULL))
    return NULL;

  sdl_onscreen = onscreen->winsys;

  return sdl_onscreen->window;
}