int makeOpenGLContextCurrent()

in mujoco_py/gl/eglshim.c [128:147]


int makeOpenGLContextCurrent(int device_id) {
    if (device_id < 0 || device_id > MAX_DEVICES) {
        printf("Device id outside of range.\n");
        return -1;
    }
    if (!is_device_initialized[device_id])
        return -2;

    if( eglMakeCurrent(eglDisplays[device_id],
                       EGL_NO_SURFACE,
                       EGL_NO_SURFACE,
                       eglContexts[device_id]) != EGL_TRUE ) {
        eglDestroyContext(eglDisplays[device_id],
                          eglContexts[device_id]);
        printf("Could not make EGL context current\n");
        return -3;
    } else {
        return 1;
    }
}