mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
fixes in imgui gl2 interaction with renderers
This commit is contained in:
@@ -782,6 +782,10 @@ eu07_application::init_glfw() {
|
||||
glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 3 );
|
||||
}
|
||||
else {
|
||||
#ifdef EU07_USEIMGUIIMPLOPENGL2
|
||||
ErrorLog("gles not supported in imgui gl2 build");
|
||||
return -1;
|
||||
#endif
|
||||
#ifdef GLFW_CONTEXT_CREATION_API
|
||||
if (m_glfwversion >= 30200)
|
||||
glfwWindowHint( GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API );
|
||||
@@ -791,6 +795,10 @@ eu07_application::init_glfw() {
|
||||
glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 0 );
|
||||
}
|
||||
} else {
|
||||
if (Global.gfx_usegles) {
|
||||
ErrorLog("legacy renderer not supported in gles mode");
|
||||
return -1;
|
||||
}
|
||||
Global.gfx_shadergamma = false;
|
||||
glfwWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_ANY_PROFILE );
|
||||
glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 0 );
|
||||
|
||||
@@ -124,8 +124,6 @@ void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data)
|
||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||
const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;
|
||||
const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, pos)));
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, uv)));
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, col)));
|
||||
|
||||
@@ -670,8 +670,13 @@ void opengl33_renderer::Render_pass(viewport_config &vp, rendermode const Mode)
|
||||
gl::framebuffer::unbind();
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
if (vp.main)
|
||||
if (vp.main) {
|
||||
// clear state for ui
|
||||
gl::vao::unbind();
|
||||
gl::buffer::unbind();
|
||||
gl::program::unbind();
|
||||
Application.render_ui();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -938,6 +943,10 @@ void opengl33_renderer::Render_pass(viewport_config &vp, rendermode const Mode)
|
||||
Timer::subsystem.gfx_gui.start();
|
||||
|
||||
if (vp.main) {
|
||||
// clear state for ui
|
||||
gl::vao::unbind();
|
||||
gl::buffer::unbind();
|
||||
gl::program::unbind();
|
||||
draw_debug_ui();
|
||||
Application.render_ui();
|
||||
}
|
||||
|
||||
@@ -339,6 +339,9 @@ opengl_renderer::Render() {
|
||||
setup_units( true, false, false );
|
||||
::glPushClientAttrib( GL_CLIENT_VERTEX_ARRAY_BIT );
|
||||
::glClientActiveTexture( GL_TEXTURE0 + m_diffusetextureunit );
|
||||
|
||||
// clear state for ui
|
||||
::glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 );
|
||||
::glBindBuffer( GL_ARRAY_BUFFER, 0 );
|
||||
Application.render_ui();
|
||||
::glPopClientAttrib();
|
||||
|
||||
Reference in New Issue
Block a user