/** * @name context_2d_new * @brief create's and returns a new context * @param canvas - (tealeaf_canvas *) * @param url - (const char *) name of the canvas * @param dest_tex - (int) * @retval context_2d* - pointer to the created context */ context_2d *context_2d_new(tealeaf_canvas *canvas, const char *url, int dest_tex) { context_2d *ctx; if (!strcmp(url, "onscreen")) { ctx = context_2d_get_onscreen(); } else { ctx = context_2d_init(canvas, url, dest_tex, false); } return ctx; }
/** * @name tealeaf_canvas_init * @brief initilizes the tealeaf canvas object * @param framebuffer_name - (int) gl id of the onscreen framebuffer * @retval NONE */ void tealeaf_canvas_init(int framebuffer_name) { LOG("{canvas} Initializing Canvas"); int width = config_get_screen_width(); int height = config_get_screen_height(); GLuint offscreen_buffer_name; GLTRACE(glGenFramebuffers(1, &offscreen_buffer_name)); canvas.offscreen_framebuffer = offscreen_buffer_name; canvas.view_framebuffer = framebuffer_name; canvas.onscreen_ctx = context_2d_init(&canvas, "onscreen", -1, true); canvas.onscreen_ctx->width = width; canvas.onscreen_ctx->height = height; canvas.active_ctx = 0; // TODO: should_resize is not respected on iOS tealeaf_canvas_context_2d_bind(canvas.onscreen_ctx); }