16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 00:49:19 +02:00

imgui2 fix, relax GL context requirements for legacy mode

This commit is contained in:
milek7
2021-01-21 20:23:53 +01:00
parent 0aa4293a5a
commit 1374dec99c
2 changed files with 10 additions and 2 deletions

View File

@@ -30,11 +30,13 @@ http://mozilla.org/MPL/2.0/.
#include "dictionary.h" #include "dictionary.h"
#include "version_info.h" #include "version_info.h"
#ifdef _WIN32
#pragma comment (lib, "dsound.lib") #pragma comment (lib, "dsound.lib")
#pragma comment (lib, "winmm.lib") #pragma comment (lib, "winmm.lib")
#pragma comment (lib, "setupapi.lib") #pragma comment (lib, "setupapi.lib")
#pragma comment (lib, "dbghelp.lib") #pragma comment (lib, "dbghelp.lib")
#pragma comment (lib, "version.lib") #pragma comment (lib, "version.lib")
#endif
#ifdef __unix__ #ifdef __unix__
#include <unistd.h> #include <unistd.h>
@@ -751,9 +753,13 @@ eu07_application::init_glfw() {
} }
} else { } else {
Global.gfx_shadergamma = false; Global.gfx_shadergamma = false;
glfwWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_COMPAT_PROFILE ); glfwWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_ANY_PROFILE );
glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 0 );
#ifndef EU07_USEIMGUIIMPLOPENGL2
glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 3 ); glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 3 );
glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 3 ); #else
glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 2 );
#endif
} }
glfwWindowHint(GLFW_SRGB_CAPABLE, !Global.gfx_shadergamma); glfwWindowHint(GLFW_SRGB_CAPABLE, !Global.gfx_shadergamma);

View File

@@ -124,6 +124,8 @@ void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data)
const ImDrawList* cmd_list = draw_data->CmdLists[n]; const ImDrawList* cmd_list = draw_data->CmdLists[n];
const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data; const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;
const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.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))); 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))); 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))); glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, col)));