no gl inside nvg frame
This commit is contained in:
parent
f66fac1a0b
commit
b9c14c92a7
|
@ -486,7 +486,7 @@ void ui_draw_vision_alert(UIState *s, cereal::ControlsState::AlertSize va_size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_draw_vision(UIState *s) {
|
static void ui_draw_vision_frame(UIState *s) {
|
||||||
const UIScene *scene = &s->scene;
|
const UIScene *scene = &s->scene;
|
||||||
const Rect &viz_rect = scene->viz_rect;
|
const Rect &viz_rect = scene->viz_rect;
|
||||||
|
|
||||||
|
@ -498,6 +498,10 @@ static void ui_draw_vision(UIState *s) {
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
|
||||||
glViewport(0, 0, s->fb_w, s->fb_h);
|
glViewport(0, 0, s->fb_w, s->fb_h);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ui_draw_vision(UIState *s) {
|
||||||
|
const UIScene *scene = &s->scene;
|
||||||
|
|
||||||
// Draw augmented elements
|
// Draw augmented elements
|
||||||
if (!scene->frontview && scene->world_objects_visible) {
|
if (!scene->frontview && scene->world_objects_visible) {
|
||||||
|
@ -533,14 +537,22 @@ void ui_draw(UIState *s) {
|
||||||
s->scene.ui_viz_ro = -(sbr_w - 6 * bdr_s);
|
s->scene.ui_viz_ro = -(sbr_w - 6 * bdr_s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool draw_vision = s->started && s->active_app == cereal::UiLayoutState::App::NONE &&
|
||||||
|
s->status != STATUS_OFFROAD && s->vision_connected;
|
||||||
|
|
||||||
|
// GL drawing functions
|
||||||
ui_draw_background(s);
|
ui_draw_background(s);
|
||||||
|
if (draw_vision) {
|
||||||
|
ui_draw_vision_frame(s);
|
||||||
|
}
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glViewport(0, 0, s->fb_w, s->fb_h);
|
glViewport(0, 0, s->fb_w, s->fb_h);
|
||||||
|
|
||||||
|
// NVG drawing functions - should be no GL inside NVG frame
|
||||||
nvgBeginFrame(s->vg, s->fb_w, s->fb_h, 1.0f);
|
nvgBeginFrame(s->vg, s->fb_w, s->fb_h, 1.0f);
|
||||||
ui_draw_sidebar(s);
|
ui_draw_sidebar(s);
|
||||||
if (s->started && s->active_app == cereal::UiLayoutState::App::NONE &&
|
if (draw_vision) {
|
||||||
s->status != STATUS_OFFROAD && s->vision_connected) {
|
|
||||||
ui_draw_vision(s);
|
ui_draw_vision(s);
|
||||||
}
|
}
|
||||||
nvgEndFrame(s->vg);
|
nvgEndFrame(s->vg);
|
||||||
|
|
Loading…
Reference in a new issue