From 807097148e5ca5869e8b06468f53f27e705fc681 Mon Sep 17 00:00:00 2001 From: Saran Tunyasuvunakool Date: Mon, 25 Jul 2022 03:46:27 -0700 Subject: [PATCH] Add internal-only API for creating `mjrContext` with custom offscreen FBO size. PiperOrigin-RevId: 463048634 Change-Id: I195cbbf0e13a6c032e86070e8e4c11ad53af8a71 --- src/render/render_context.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/render/render_context.c b/src/render/render_context.c index a235f37b..849137fd 100644 --- a/src/render/render_context.c +++ b/src/render/render_context.c @@ -1463,8 +1463,8 @@ static int glDebugEnabled() { -// allocate resources in custom OpenGL context -void mjr_makeContext(const mjModel* m, mjrContext* con, int fontscale) { +void mjr_makeContext_offSize(const mjModel* m, mjrContext* con, int fontscale, + int default_offwidth, int default_offheight) { // fix fontscale fontscale = 50 * mju_round(((mjtNum)fontscale)/50.0); if (fontscale<100) { @@ -1539,8 +1539,8 @@ void mjr_makeContext(const mjModel* m, mjrContext* con, int fontscale) { // no model: offscreen and font only if (!m) { // default offscreen - con->offWidth = 800; - con->offHeight = 600; + con->offWidth = default_offwidth; + con->offHeight = default_offheight; con->offSamples = 0; makeOff(con); @@ -1606,6 +1606,13 @@ void mjr_makeContext(const mjModel* m, mjrContext* con, int fontscale) { +// allocate resources in custom OpenGL context +void mjr_makeContext(const mjModel* m, mjrContext* con, int fontscale) { + mjr_makeContext_offSize(m, con, fontscale, 800, 600); +} + + + // Change font of existing context. void mjr_changeFont(int fontscale, mjrContext* con) { // free existing font