handle different window/framebuffer sizes

This commit is contained in:
milek7
2021-01-24 22:00:30 +01:00
parent 34113bf7e7
commit 90a6b7c3b5
15 changed files with 138 additions and 121 deletions

View File

@@ -68,6 +68,11 @@ ui::map_panel::map_panel() : ui_panel(STR_C("Map"), false)
}
}
glGetError();
glLineWidth(2.0f);
if (!glGetError())
m_widelines_supported = true;
scene_ubo = std::make_unique<gl::ubo>(sizeof(gl::scene_ubs), 0);
init_done = true;
@@ -131,7 +136,8 @@ void ui::map_panel::render_map_texture(glm::mat4 transform, glm::vec2 surface_si
}
m_track_shader->bind();
glLineWidth(1.5f);
if (m_widelines_supported)
glLineWidth(1.5f);
glViewport(0, 0, surface_size.x, surface_size.y);
scene_ubs.projection = transform;
@@ -144,22 +150,26 @@ void ui::map_panel::render_map_texture(glm::mat4 transform, glm::vec2 surface_si
gl33->Draw_Geometry(m_section_handles.begin(), m_section_handles.end());
glLineWidth(1.5f);
if (m_widelines_supported)
glLineWidth(4.5f);
scene_ubs.cascade_end = glm::vec3(0.7f, 0.7f, 0.0f);
scene_ubo->update(scene_ubs);
gl33->Draw_Geometry(m_colored_paths.future.begin(), m_colored_paths.future.end());
glLineWidth(3.0f);
if (m_widelines_supported)
glLineWidth(3.0f);
scene_ubs.cascade_end = glm::vec3(0.0f, 1.0f, 0.0f);
scene_ubo->update(scene_ubs);
gl33->Draw_Geometry(m_colored_paths.switches.begin(), m_colored_paths.switches.end());
glLineWidth(1.5f);
if (m_widelines_supported)
glLineWidth(1.5f);
scene_ubs.cascade_end = glm::vec3(1.0f, 0.0f, 0.0f);
scene_ubo->update(scene_ubs);
gl33->Draw_Geometry(m_colored_paths.occupied.begin(), m_colored_paths.occupied.end());
glLineWidth(4.0f);
if (m_widelines_supported)
glLineWidth(4.0f);
scene_ubs.cascade_end = glm::vec3(0.3f, 0.3f, 1.0f);
scene_ubo->update(scene_ubs);
gl33->Draw_Geometry(m_colored_paths.highlighted.begin(), m_colored_paths.highlighted.end());

View File

@@ -115,6 +115,8 @@ class map_panel : public ui_panel
std::vector<gfx::geometrybank_handle> m_section_handles;
map_colored_paths m_colored_paths;
bool m_widelines_supported;
const int fb_size = 1024;
glm::vec2 translate;