mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
imgui_impl_opengl3: Advertised as a ES2/ES3 renderer. Defaults to ES3 on Android. Default on "#version 300 es" on ES 3. (#2002, #1873)
This commit is contained in:
parent
34203d5008
commit
d5793102db
@ -125,7 +125,7 @@ Languages: (third-party bindings)
|
|||||||
- Swift [swift-imgui](https://github.com/mnmly/Swift-imgui)
|
- Swift [swift-imgui](https://github.com/mnmly/Swift-imgui)
|
||||||
|
|
||||||
Frameworks:
|
Frameworks:
|
||||||
- Renderers: DirectX 9, DirectX 10, DirectX 11, DirectX 12, Metal, OpenGL2, OpenGL3+, Vulkan: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
- Renderers: DirectX 9, DirectX 10, DirectX 11, DirectX 12, Metal, OpenGL2, OpenGL3+/ES2/ES3, Vulkan: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||||
- Platform: GLFW, SDL, Win32, OSX, Freeglut: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
- Platform: GLFW, SDL, Win32, OSX, Freeglut: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||||
- Framework: Allegro 5, Marmalade: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
- Framework: Allegro 5, Marmalade: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||||
- Unmerged PR: SDL2 + OpenGLES + Emscripten: [#336](https://github.com/ocornut/imgui/pull/336)
|
- Unmerged PR: SDL2 + OpenGLES + Emscripten: [#336](https://github.com/ocornut/imgui/pull/336)
|
||||||
|
@ -111,7 +111,7 @@ List of Renderer Bindings in this repository:
|
|||||||
imgui_impl_dx12.cpp ; DirectX12
|
imgui_impl_dx12.cpp ; DirectX12
|
||||||
imgui_impl_metal.mm ; Metal (with ObjC)
|
imgui_impl_metal.mm ; Metal (with ObjC)
|
||||||
imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
|
imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
|
||||||
imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
|
imgui_impl_opengl3.cpp ; OpenGL3, OpenGL ES 2, OpenGL ES 3 (modern programmable pipeline)
|
||||||
imgui_impl_vulkan.cpp ; Vulkan
|
imgui_impl_vulkan.cpp ; Vulkan
|
||||||
|
|
||||||
List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
|
List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
|
||||||
@ -185,7 +185,7 @@ example_glfw_opengl2/
|
|||||||
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp
|
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp
|
||||||
|
|
||||||
example_glfw_opengl3/
|
example_glfw_opengl3/
|
||||||
GLFW (Win32, Mac, Linux) + OpenGL3+ example (programmable pipeline, binding modern functions with GL3W).
|
GLFW (Win32, Mac, Linux) + OpenGL3+/ES2/ES3 example (programmable pipeline, binding modern functions with GL3W).
|
||||||
This uses more modern OpenGL calls and custom shaders.
|
This uses more modern OpenGL calls and custom shaders.
|
||||||
Prefer using that if you are using modern OpenGL in your application (anything with shaders).
|
Prefer using that if you are using modern OpenGL in your application (anything with shaders).
|
||||||
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
|
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
|
||||||
@ -206,7 +206,7 @@ example_sdl_opengl2/
|
|||||||
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl2.cpp
|
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl2.cpp
|
||||||
|
|
||||||
example_sdl_opengl3/
|
example_sdl_opengl3/
|
||||||
SDL2 (Win32, Mac, Linux, etc.) + OpenGL3+ example.
|
SDL2 (Win32, Mac, Linux, etc.) + OpenGL3+/ES2/ES3 example.
|
||||||
This uses more modern OpenGL calls and custom shaders.
|
This uses more modern OpenGL calls and custom shaders.
|
||||||
Prefer using that if you are using modern OpenGL in your application (anything with shaders).
|
Prefer using that if you are using modern OpenGL in your application (anything with shaders).
|
||||||
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp
|
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: OpenGL3 (modern OpenGL with shaders / programmatic pipeline)
|
// ImGui Renderer for: OpenGL3 / OpenGL ES2 / OpenGL ES3 (modern OpenGL with shaders / programmatic pipeline)
|
||||||
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
||||||
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
|
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
|
||||||
|
|
||||||
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
|
// 2018-08-09: OpenGL: Default to OpenGL ES 3 on iOS and Android. GLSL version default to "#version 300 ES".
|
||||||
// 2018-07-30: OpenGL: Support for GLSL 300 ES and 410 core. Fixes for Emscripten compilation.
|
// 2018-07-30: OpenGL: Support for GLSL 300 ES and 410 core. Fixes for Emscripten compilation.
|
||||||
// 2018-07-10: OpenGL: Support for more GLSL versions (based on the GLSL version string). Added error output when shaders fail to compile/link.
|
// 2018-07-10: OpenGL: Support for more GLSL versions (based on the GLSL version string). Added error output when shaders fail to compile/link.
|
||||||
// 2018-06-08: Misc: Extracted imgui_impl_opengl3.cpp/.h away from the old combined GLFW/SDL+OpenGL3 examples.
|
// 2018-06-08: Misc: Extracted imgui_impl_opengl3.cpp/.h away from the old combined GLFW/SDL+OpenGL3 examples.
|
||||||
@ -61,13 +62,20 @@
|
|||||||
#include "TargetConditionals.h"
|
#include "TargetConditionals.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(__APPLE__) && TARGET_OS_IOS) || (defined(__EMSCRIPTEN__))
|
// iOS, Android and Emscripten can use GL ES 3
|
||||||
|
// Call ImGui_ImplOpenGL3_Init() with "#version 300 es"
|
||||||
|
#if (defined(__APPLE__) && TARGET_OS_IOS) || (defined(__ANDROID__)) || (defined(__EMSCRIPTEN__))
|
||||||
|
#define USE_GL_ES3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_GL_ES3
|
||||||
|
// OpenGL ES 3
|
||||||
#include <GLES3/gl3.h> // Use GL ES 3
|
#include <GLES3/gl3.h> // Use GL ES 3
|
||||||
#else
|
#else
|
||||||
// About OpenGL function loaders:
|
// OpenGL Regular
|
||||||
// Modern OpenGL requires individual functions to be loaded manually. Helper libraries are often used for this purpose.
|
// (About OpenGL function loaders: modern OpenGL doesn't have a standard header file and requires individual functions to be loaded manually.
|
||||||
// Here we are using gl3w.h, which requires a call to gl3wInit().
|
// Helper libraries are often used for this purpose! Here we are using gl3w.h, which requires a call to gl3wInit().
|
||||||
// You may use another any other loader/header of your choice, such as glew, glext, glad, glLoadGen, etc.
|
// You may use another any other loader/header of your choice, such as glew, glext, glad, glLoadGen, etc.)
|
||||||
#include <GL/gl3w.h>
|
#include <GL/gl3w.h>
|
||||||
//#include <glew.h>
|
//#include <glew.h>
|
||||||
//#include <glext.h>
|
//#include <glext.h>
|
||||||
@ -86,8 +94,13 @@ static unsigned int g_VboHandle = 0, g_ElementsHandle = 0;
|
|||||||
bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
||||||
{
|
{
|
||||||
// Store GLSL version string so we can refer to it later in case we recreate shaders. Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure.
|
// Store GLSL version string so we can refer to it later in case we recreate shaders. Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure.
|
||||||
|
#ifdef USE_GL_ES3
|
||||||
|
if (glsl_version == NULL)
|
||||||
|
glsl_version = "#version 300 es";
|
||||||
|
#else
|
||||||
if (glsl_version == NULL)
|
if (glsl_version == NULL)
|
||||||
glsl_version = "#version 130";
|
glsl_version = "#version 130";
|
||||||
|
#endif
|
||||||
IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(g_GlslVersionString));
|
IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(g_GlslVersionString));
|
||||||
strcpy(g_GlslVersionString, glsl_version);
|
strcpy(g_GlslVersionString, glsl_version);
|
||||||
strcat(g_GlslVersionString, "\n");
|
strcat(g_GlslVersionString, "\n");
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: OpenGL3 (modern OpenGL with shaders / programmatic pipeline)
|
// ImGui Renderer for: OpenGL3 / OpenGL ES2 / OpenGL ES3 (modern OpenGL with shaders / programmatic pipeline)
|
||||||
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
||||||
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
|
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
|
||||||
|
|
||||||
@ -15,8 +15,9 @@
|
|||||||
// You may use another any other loader/header of your choice, such as glew, glext, glad, glLoadGen, etc.
|
// You may use another any other loader/header of your choice, such as glew, glext, glad, glLoadGen, etc.
|
||||||
|
|
||||||
// About GLSL version:
|
// About GLSL version:
|
||||||
// The 'glsl_version' initialization parameter defaults to "#version 130" if NULL.
|
// The 'glsl_version' initialization parameter should be NULL (default) or a "#version XXX" string.
|
||||||
// Only override if your GL version doesn't handle this GLSL version (see table at the top of imgui_impl_opengl3.cpp). Keep NULL if unsure!
|
// On computer platform the GLSL version default to "#version 130". On OpenGL ES 3 platform it defaults to "#version 300 es"
|
||||||
|
// Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp.
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL);
|
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL);
|
||||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown();
|
IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown();
|
||||||
|
@ -13929,8 +13929,9 @@ void ImGui::EndDragDropTarget()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS))
|
#if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS))
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
#ifndef __MINGW32__
|
#ifndef __MINGW32__
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user