Add internal-only API for creating mjrContext with custom offscreen FBO size.

PiperOrigin-RevId: 463048634
Change-Id: I195cbbf0e13a6c032e86070e8e4c11ad53af8a71
This commit is contained in:
Saran Tunyasuvunakool
2022-07-25 03:46:27 -07:00
committed by Copybara-Service
parent 95b6327bb5
commit 807097148e
+11 -4
View File
@@ -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