Skip to content
Snippets Groups Projects
Commit cc6d60e1 authored by Tristan Walter's avatar Tristan Walter
Browse files

Merge branch 'gl2' of https://github.com/mooch443/trex into gl2

parents 32976878 d6910c1a
No related branches found
No related tags found
No related merge requests found
...@@ -53,6 +53,9 @@ using ImTextureID_t = ImGui_OpenGL2_TextureID; ...@@ -53,6 +53,9 @@ using ImTextureID_t = ImGui_OpenGL2_TextureID;
#define GLIMPL_CHECK_THREAD_ID() check_thread_id( __LINE__ , __FILE__ ) #define GLIMPL_CHECK_THREAD_ID() check_thread_id( __LINE__ , __FILE__ )
namespace gl {
int major = 0, minor = 0;
}
//#include "misc/freetype/imgui_freetype.h" //#include "misc/freetype/imgui_freetype.h"
//#include "misc/freetype/imgui_freetype.cpp" //#include "misc/freetype/imgui_freetype.cpp"
...@@ -74,11 +77,6 @@ void GLImpl::init() { ...@@ -74,11 +77,6 @@ void GLImpl::init() {
draw_calls = 0; draw_calls = 0;
_update_thread = std::this_thread::get_id(); _update_thread = std::this_thread::get_id();
if OPENGL3_CONDITION
Debug("Using OpenGL3.2 (seems supported).");
else
Debug("Using OpenGL2.0");
} }
void GLImpl::post_init() { void GLImpl::post_init() {
...@@ -122,17 +120,17 @@ void GLImpl::create_window(int width, int height) { ...@@ -122,17 +120,17 @@ void GLImpl::create_window(int width, int height) {
// GL 3.2 + GLSL 150 // GL 3.2 + GLSL 150
const char* glsl_version = "#version 150"; const char* glsl_version = "#version 150";
if OPENGL3_CONDITION { #if !CMN_USE_OPENGL2
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // Required on Mac glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // Required on Mac
#else
} else {
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
} #endif
#else #else
// GL 3.0 + GLSL 130 // GL 3.0 + GLSL 130
const char* glsl_version = "#version 130"; const char* glsl_version = "#version 130";
...@@ -164,6 +162,14 @@ void GLImpl::create_window(int width, int height) { ...@@ -164,6 +162,14 @@ void GLImpl::create_window(int width, int height) {
U_EXCEPTION("Failed to initialize OpenGL loader!"); U_EXCEPTION("Failed to initialize OpenGL loader!");
} }
glGetIntegerv(GL_MAJOR_VERSION, &gl::major);
glGetIntegerv(GL_MINOR_VERSION, &gl::minor);
if OPENGL3_CONDITION
Debug("Using OpenGL3.2 (seems supported, %d.%d %s).", gl::major, gl::minor, glGetString(GL_VERSION));
else
Debug("Using OpenGL2.0 (%d.%d) %s", gl::major, gl::minor, glGetString(GL_VERSION));
IMGUI_CHECKVERSION(); IMGUI_CHECKVERSION();
ImGui::CreateContext(); ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io; ImGuiIO& io = ImGui::GetIO(); (void)io;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment