imgui_impl_opengl3.cpp (imgui-1.86) | : | imgui_impl_opengl3.cpp (imgui-1.87) | ||
---|---|---|---|---|
skipping to change at line 99 | skipping to change at line 99 | |||
#include "imgui.h" | #include "imgui.h" | |||
#include "imgui_impl_opengl3.h" | #include "imgui_impl_opengl3.h" | |||
#include <stdio.h> | #include <stdio.h> | |||
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier | #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier | |||
#include <stddef.h> // intptr_t | #include <stddef.h> // intptr_t | |||
#else | #else | |||
#include <stdint.h> // intptr_t | #include <stdint.h> // intptr_t | |||
#endif | #endif | |||
// Clang warnings with -Weverything | ||||
#if defined(__clang__) | ||||
#pragma clang diagnostic push | ||||
#pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-s | ||||
tyle cast | ||||
#pragma clang diagnostic ignored "-Wsign-conversion" // warning: implicit con | ||||
version changes signedness | ||||
#if __has_warning("-Wzero-as-null-pointer-constant") | ||||
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" | ||||
#endif | ||||
#endif | ||||
// GL includes | // GL includes | |||
#if defined(IMGUI_IMPL_OPENGL_ES2) | #if defined(IMGUI_IMPL_OPENGL_ES2) | |||
#include <GLES2/gl2.h> | #if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) | |||
#include <OpenGLES/ES2/gl.h> // Use GL ES 2 | ||||
#else | ||||
#include <GLES2/gl2.h> // Use GL ES 2 | ||||
#endif | ||||
#if defined(__EMSCRIPTEN__) | #if defined(__EMSCRIPTEN__) | |||
#ifndef GL_GLEXT_PROTOTYPES | #ifndef GL_GLEXT_PROTOTYPES | |||
#define GL_GLEXT_PROTOTYPES | #define GL_GLEXT_PROTOTYPES | |||
#endif | #endif | |||
#include <GLES2/gl2ext.h> | #include <GLES2/gl2ext.h> | |||
#endif | #endif | |||
#elif defined(IMGUI_IMPL_OPENGL_ES3) | #elif defined(IMGUI_IMPL_OPENGL_ES3) | |||
#if defined(__APPLE__) | #if defined(__APPLE__) | |||
#include <TargetConditionals.h> | #include <TargetConditionals.h> | |||
#endif | #endif | |||
skipping to change at line 467 | skipping to change at line 481 | |||
} | } | |||
else | else | |||
{ | { | |||
// Project scissor/clipping rectangles into framebuffer space | // Project scissor/clipping rectangles into framebuffer space | |||
ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x, (pcmd->ClipRect.y - clip_off.y) * clip_scale.y); | ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x, (pcmd->ClipRect.y - clip_off.y) * clip_scale.y); | |||
ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x, (pcmd->ClipRect.w - clip_off.y) * clip_scale.y); | ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x, (pcmd->ClipRect.w - clip_off.y) * clip_scale.y); | |||
if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y) | if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y) | |||
continue; | continue; | |||
// Apply scissor/clipping rectangle (Y is inverted in OpenGL) | // Apply scissor/clipping rectangle (Y is inverted in OpenGL) | |||
glScissor((int)clip_min.x, (int)(fb_height - clip_max.y), (int)( clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y)); | glScissor((int)clip_min.x, (int)((float)fb_height - clip_max.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y)); | |||
// Bind texture, Draw | // Bind texture, Draw | |||
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->GetTexID()) ; | glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->GetTexID()) ; | |||
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET | #ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET | |||
if (bd->GlVersion >= 320) | if (bd->GlVersion >= 320) | |||
glDrawElementsBaseVertex(GL_TRIANGLES, (GLsizei)pcmd->ElemCo unt, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intpt r_t)(pcmd->IdxOffset * sizeof(ImDrawIdx)), (GLint)pcmd->VtxOffset); | glDrawElementsBaseVertex(GL_TRIANGLES, (GLsizei)pcmd->ElemCo unt, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intpt r_t)(pcmd->IdxOffset * sizeof(ImDrawIdx)), (GLint)pcmd->VtxOffset); | |||
else | else | |||
#endif | #endif | |||
glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(Im DrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->Idx Offset * sizeof(ImDrawIdx))); | glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(Im DrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->Idx Offset * sizeof(ImDrawIdx))); | |||
} | } | |||
skipping to change at line 794 | skipping to change at line 808 | |||
} | } | |||
void ImGui_ImplOpenGL3_DestroyDeviceObjects() | void ImGui_ImplOpenGL3_DestroyDeviceObjects() | |||
{ | { | |||
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData(); | ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData(); | |||
if (bd->VboHandle) { glDeleteBuffers(1, &bd->VboHandle); bd->VboHandle = 0; } | if (bd->VboHandle) { glDeleteBuffers(1, &bd->VboHandle); bd->VboHandle = 0; } | |||
if (bd->ElementsHandle) { glDeleteBuffers(1, &bd->ElementsHandle); bd->Eleme ntsHandle = 0; } | if (bd->ElementsHandle) { glDeleteBuffers(1, &bd->ElementsHandle); bd->Eleme ntsHandle = 0; } | |||
if (bd->ShaderHandle) { glDeleteProgram(bd->ShaderHandle); bd->ShaderHandl e = 0; } | if (bd->ShaderHandle) { glDeleteProgram(bd->ShaderHandle); bd->ShaderHandl e = 0; } | |||
ImGui_ImplOpenGL3_DestroyFontsTexture(); | ImGui_ImplOpenGL3_DestroyFontsTexture(); | |||
} | } | |||
#if defined(__clang__) | ||||
#pragma clang diagnostic pop | ||||
#endif | ||||
End of changes. 4 change blocks. | ||||
2 lines changed or deleted | 18 lines changed or added |