From f030087f8ece09d06db884a9562ccbc2d4ebfdd7 Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 26 Apr 2017 18:27:10 +0200 Subject: [PATCH] Comments to redirect people to OpenGL3 examples (#1116) --- examples/README.txt | 18 +++++++++++------- examples/opengl2_example/imgui_impl_glfw.cpp | 5 +++-- .../sdl_opengl2_example/imgui_impl_sdl.cpp | 3 +++ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/examples/README.txt b/examples/README.txt index 54be766a..9491ff1a 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -8,10 +8,11 @@ Third party languages and frameworks bindings: https://github.com/ocornut/imgui/ TL;DR; - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase. - - Refer to 'opengl2_example' to LEARN how the library is setup, it is the simplest one. + - To LEARN how the library is setup, you may refer to 'opengl2_example' because is the simplest one. The other examples requires more boilerplate and are harder to read. - - If you are using OpenGL in your application, probably use an opengl3_xxx backend. - Mixing old fixed pipeline OpenGL2 and programmable pipeline OpenGL3+ isn't well supported by drivers. + However, USE 'opengl3_example' in your application if you are using any modern OpenGL3+ calls. + Mixing old fixed pipeline OpenGL2 and programmable pipeline OpenGL3+ isn't well supported by some drivers. + If you are not sure, in doubt, use 'opengl3_example'. - If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files to your project and use them unmodified. - If you have your own engine, you probably want to start from one of the OpenGL example and adapt it to @@ -44,14 +45,17 @@ Also note that some setup or GPU drivers may be causing extra lag (possibly by e leaving you with no option but sadness/anger (Intel GPU drivers were reported as such). opengl2_example/ - GLFW + OpenGL example (old fixed pipeline). - This is simple to read. Prefer following this example to learn how ImGui works! + GLFW + OpenGL example (old, fixed graphic pipeline). + This is only provided as a reference to learn how ImGui integration works, because it is easier to read. + However, if your code is using GL3+ context, using this may confuse your driver. Please use the GL3 example below. (You might be able to use this code in a GL3/GL4 context but make sure you disable the programmable - pipeline by calling "glUseProgram(0)" before ImGui::Render.) + pipeline by calling "glUseProgram(0)" before ImGui::Render. It appears that many librairies and drivers + are having issues mixing GL2 calls and newer GL3/GL4 calls. So it isn't recommended that you use that.) opengl3_example/ GLFW + OpenGL example (programmable pipeline, binding modern functions with GL3W). - This uses more modern OpenGL calls and custom shaders. It's more messy. + This uses more modern OpenGL calls and custom shaders. + Prefer using that if you are using modern OpenGL3/4 in your application. directx9_example/ DirectX9 example, Windows only. diff --git a/examples/opengl2_example/imgui_impl_glfw.cpp b/examples/opengl2_example/imgui_impl_glfw.cpp index 3755c608..f3bb0b2b 100644 --- a/examples/opengl2_example/imgui_impl_glfw.cpp +++ b/examples/opengl2_example/imgui_impl_glfw.cpp @@ -1,9 +1,10 @@ // ImGui GLFW binding with OpenGL // In this binding, ImTextureID is used to store an OpenGL 'GLuint' texture identifier. Read the FAQ about ImTextureID in imgui.cpp. -// If your context is GL3/GL3 then prefer using the code in opengl3_example. +// If your context or own usage of OpenGL involve anything GL3/GL4, prefer using the code in opengl3_example. +// If you are not sure what that means, prefer using the code in opengl3_example. // You *might* use this code with a GL3/GL4 context but make sure you disable the programmable pipeline by calling "glUseProgram(0)" before ImGui::Render(). -// We cannot do that from GL2 code because the function doesn't exist. +// We cannot do that from GL2 code because the function doesn't exist. Mixing GL2 calls and GL3/GL4 calls is giving trouble to many librairies/drivers. // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. // If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). diff --git a/examples/sdl_opengl2_example/imgui_impl_sdl.cpp b/examples/sdl_opengl2_example/imgui_impl_sdl.cpp index 7be0fcdb..f0758bda 100644 --- a/examples/sdl_opengl2_example/imgui_impl_sdl.cpp +++ b/examples/sdl_opengl2_example/imgui_impl_sdl.cpp @@ -1,6 +1,9 @@ // ImGui SDL2 binding with OpenGL // In this binding, ImTextureID is used to store an OpenGL 'GLuint' texture identifier. Read the FAQ about ImTextureID in imgui.cpp. +// If your context or own usage of OpenGL involve anything GL3/GL4, prefer using the code in sdl_opengl3_example. +// If you are not sure what that means, prefer using the code in sdl_opengl3_example. + // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. // If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.