[OpenGL] Some code clean-ups

libdrm_amdgpu
jackun 3 years ago
parent ea45caa876
commit b6dab97d08
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3

@ -158,11 +158,6 @@ void imgui_create(void *ctx)
ImGui::GetIO().DisplaySize = ImVec2(last_vp[2], last_vp[3]);
ImGui_ImplOpenGL3_Init();
// Make a dummy GL call (we don't actually need the result)
// IF YOU GET A CRASH HERE: it probably means that you haven't initialized the OpenGL function loader used by this code.
// Desktop OpenGL 3/4 need a function loader. See the IMGUI_IMPL_OPENGL_LOADER_xxx explanation above.
GLint current_texture;
glGetIntegerv(GL_TEXTURE_BINDING_2D, &current_texture);
create_fonts(params, sw_stats.font1, sw_stats.font_text);
sw_stats.font_params_hash = params.font_params_hash;

@ -78,13 +78,6 @@ namespace MangoHud { namespace GL {
extern overlay_params params;
// Desktop GL 3.2+ has glDrawElementsBaseVertex() which GL ES and WebGL don't have.
#if defined(IMGUI_IMPL_OPENGL_ES2) || defined(IMGUI_IMPL_OPENGL_ES3) || !defined(GL_VERSION_3_2)
#define IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET 0
#else
#define IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET 1
#endif
// OpenGL Data
static GLuint g_GlVersion = 0; // Extracted at runtime using GL_MAJOR_VERSION, GL_MINOR_VERSION queries.
static char g_GlslVersionString[32] = ""; // Specified by user or detected based on compile time GL settings.
@ -400,8 +393,8 @@ void GetOpenGLVersion(int& major, int& minor, bool& isGLES)
if (!version)
return;
//if (glGetError() == 0x500) {
//if (glGetError() == 0x500)
{
for (int i = 0; prefixes[i]; i++) {
const size_t length = strlen(prefixes[i]);
if (strncmp(version, prefixes[i], length) == 0) {
@ -412,7 +405,7 @@ void GetOpenGLVersion(int& major, int& minor, bool& isGLES)
}
sscanf(version, "%d.%d", &major, &minor);
//}
}
}
bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
@ -454,7 +447,7 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
ImGuiIO& io = ImGui::GetIO();
io.BackendRendererName = "imgui_impl_opengl3";
//#if IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET
if ((!g_IsGLES && g_GlVersion >= 320) || (g_IsGLES && g_GlVersion >= 320))
if (g_GlVersion >= 320) // GL/GLES 3.2+
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
// Store GLSL version string so we can refer to it later in case we recreate shaders.

Loading…
Cancel
Save