└── VideoImgui ├── API ├── GLEW │ ├── GL │ │ ├── eglew.h │ │ ├── glew.h │ │ ├── glxew.h │ │ └── wglew.h │ ├── glew32.dll │ ├── glew32.lib │ └── glew32s.lib └── GLFW │ ├── glfw3.dll │ ├── glfw3.lib │ ├── glfw3_mt.lib │ ├── glfw3dll.lib │ └── include │ └── GLFW │ ├── glfw3.h │ └── glfw3native.h ├── VideoImgui.sln ├── VideoImgui ├── GUI.h ├── Imgui │ ├── imconfig.h │ ├── imgui.cpp │ ├── imgui.h │ ├── imgui_demo.cpp │ ├── imgui_draw.cpp │ ├── imgui_impl_glfw.cpp │ ├── imgui_impl_glfw.h │ ├── imgui_impl_opengl3.cpp │ ├── imgui_impl_opengl3.h │ ├── imgui_impl_opengl3_loader.h │ ├── imgui_internal.h │ ├── imgui_tables.cpp │ ├── imgui_widgets.cpp │ ├── imstb_rectpack.h │ ├── imstb_textedit.h │ └── imstb_truetype.h ├── TextEditor.cpp ├── TextEditor.h ├── VideoImgui.vcxproj ├── VideoImgui.vcxproj.filters ├── VideoImgui.vcxproj.user ├── glew32.dll ├── glfw3.dll ├── imgui.ini ├── kaiu.ttf ├── main.cpp └── x64 │ └── Release │ ├── TextEditor.obj │ ├── VideoImgui.exe.recipe │ ├── VideoImgui.iobj │ ├── VideoImgui.ipdb │ ├── VideoImgui.log │ ├── VideoImgui.tlog │ ├── CL.command.1.tlog │ ├── CL.read.1.tlog │ ├── CL.write.1.tlog │ ├── VideoImgui.lastbuildstate │ ├── link.command.1.tlog │ ├── link.read.1.tlog │ └── link.write.1.tlog │ ├── imgui.obj │ ├── imgui_demo.obj │ ├── imgui_draw.obj │ ├── imgui_impl_glfw.obj │ ├── imgui_impl_opengl3.obj │ ├── imgui_tables.obj │ ├── imgui_widgets.obj │ ├── main.obj │ └── vc142.pdb └── x64 └── Release ├── VideoImgui.exe ├── VideoImgui.pdb ├── glew32.dll ├── glfw3.dll └── kaiu.ttf /VideoImgui/API/GLEW/glew32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/API/GLEW/glew32.dll -------------------------------------------------------------------------------- /VideoImgui/API/GLEW/glew32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/API/GLEW/glew32.lib -------------------------------------------------------------------------------- /VideoImgui/API/GLEW/glew32s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/API/GLEW/glew32s.lib -------------------------------------------------------------------------------- /VideoImgui/API/GLFW/glfw3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/API/GLFW/glfw3.dll -------------------------------------------------------------------------------- /VideoImgui/API/GLFW/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/API/GLFW/glfw3.lib -------------------------------------------------------------------------------- /VideoImgui/API/GLFW/glfw3_mt.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/API/GLFW/glfw3_mt.lib -------------------------------------------------------------------------------- /VideoImgui/API/GLFW/glfw3dll.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/API/GLFW/glfw3dll.lib -------------------------------------------------------------------------------- /VideoImgui/API/GLFW/include/GLFW/glfw3native.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * GLFW 3.3 - www.glfw.org 3 | * A library for OpenGL, window and input 4 | *------------------------------------------------------------------------ 5 | * Copyright (c) 2002-2006 Marcus Geelnard 6 | * Copyright (c) 2006-2018 Camilla Löwy 7 | * 8 | * This software is provided 'as-is', without any express or implied 9 | * warranty. In no event will the authors be held liable for any damages 10 | * arising from the use of this software. 11 | * 12 | * Permission is granted to anyone to use this software for any purpose, 13 | * including commercial applications, and to alter it and redistribute it 14 | * freely, subject to the following restrictions: 15 | * 16 | * 1. The origin of this software must not be misrepresented; you must not 17 | * claim that you wrote the original software. If you use this software 18 | * in a product, an acknowledgment in the product documentation would 19 | * be appreciated but is not required. 20 | * 21 | * 2. Altered source versions must be plainly marked as such, and must not 22 | * be misrepresented as being the original software. 23 | * 24 | * 3. This notice may not be removed or altered from any source 25 | * distribution. 26 | * 27 | *************************************************************************/ 28 | 29 | #ifndef _glfw3_native_h_ 30 | #define _glfw3_native_h_ 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | 37 | /************************************************************************* 38 | * Doxygen documentation 39 | *************************************************************************/ 40 | 41 | /*! @file glfw3native.h 42 | * @brief The header of the native access functions. 43 | * 44 | * This is the header file of the native access functions. See @ref native for 45 | * more information. 46 | */ 47 | /*! @defgroup native Native access 48 | * @brief Functions related to accessing native handles. 49 | * 50 | * **By using the native access functions you assert that you know what you're 51 | * doing and how to fix problems caused by using them. If you don't, you 52 | * shouldn't be using them.** 53 | * 54 | * Before the inclusion of @ref glfw3native.h, you may define zero or more 55 | * window system API macro and zero or more context creation API macros. 56 | * 57 | * The chosen backends must match those the library was compiled for. Failure 58 | * to do this will cause a link-time error. 59 | * 60 | * The available window API macros are: 61 | * * `GLFW_EXPOSE_NATIVE_WIN32` 62 | * * `GLFW_EXPOSE_NATIVE_COCOA` 63 | * * `GLFW_EXPOSE_NATIVE_X11` 64 | * * `GLFW_EXPOSE_NATIVE_WAYLAND` 65 | * 66 | * The available context API macros are: 67 | * * `GLFW_EXPOSE_NATIVE_WGL` 68 | * * `GLFW_EXPOSE_NATIVE_NSGL` 69 | * * `GLFW_EXPOSE_NATIVE_GLX` 70 | * * `GLFW_EXPOSE_NATIVE_EGL` 71 | * * `GLFW_EXPOSE_NATIVE_OSMESA` 72 | * 73 | * These macros select which of the native access functions that are declared 74 | * and which platform-specific headers to include. It is then up your (by 75 | * definition platform-specific) code to handle which of these should be 76 | * defined. 77 | * 78 | * If you do not want the platform-specific headers to be included, define 79 | * `GLFW_NATIVE_INCLUDE_NONE` before including the @ref glfw3native.h header. 80 | * 81 | * @code 82 | * #define GLFW_EXPOSE_NATIVE_WIN32 83 | * #define GLFW_EXPOSE_NATIVE_WGL 84 | * #define GLFW_NATIVE_INCLUDE_NONE 85 | * #include 86 | * @endcode 87 | */ 88 | 89 | 90 | /************************************************************************* 91 | * System headers and types 92 | *************************************************************************/ 93 | 94 | #if !defined(GLFW_NATIVE_INCLUDE_NONE) 95 | 96 | #if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL) 97 | /* This is a workaround for the fact that glfw3.h needs to export APIENTRY (for 98 | * example to allow applications to correctly declare a GL_KHR_debug callback) 99 | * but windows.h assumes no one will define APIENTRY before it does 100 | */ 101 | #if defined(GLFW_APIENTRY_DEFINED) 102 | #undef APIENTRY 103 | #undef GLFW_APIENTRY_DEFINED 104 | #endif 105 | #include 106 | #elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL) 107 | #if defined(__OBJC__) 108 | #import 109 | #else 110 | #include 111 | #include 112 | #endif 113 | #elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX) 114 | #include 115 | #include 116 | #elif defined(GLFW_EXPOSE_NATIVE_WAYLAND) 117 | #include 118 | #endif 119 | 120 | #if defined(GLFW_EXPOSE_NATIVE_WGL) 121 | /* WGL is declared by windows.h */ 122 | #endif 123 | #if defined(GLFW_EXPOSE_NATIVE_NSGL) 124 | /* NSGL is declared by Cocoa.h */ 125 | #endif 126 | #if defined(GLFW_EXPOSE_NATIVE_GLX) 127 | /* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by 128 | * default it also acts as an OpenGL header 129 | * However, glx.h will include gl.h, which will define it unconditionally 130 | */ 131 | #if defined(GLFW_GLAPIENTRY_DEFINED) 132 | #undef GLAPIENTRY 133 | #undef GLFW_GLAPIENTRY_DEFINED 134 | #endif 135 | #include 136 | #endif 137 | #if defined(GLFW_EXPOSE_NATIVE_EGL) 138 | #include 139 | #endif 140 | #if defined(GLFW_EXPOSE_NATIVE_OSMESA) 141 | /* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by 142 | * default it also acts as an OpenGL header 143 | * However, osmesa.h will include gl.h, which will define it unconditionally 144 | */ 145 | #if defined(GLFW_GLAPIENTRY_DEFINED) 146 | #undef GLAPIENTRY 147 | #undef GLFW_GLAPIENTRY_DEFINED 148 | #endif 149 | #include 150 | #endif 151 | 152 | #endif /*GLFW_NATIVE_INCLUDE_NONE*/ 153 | 154 | 155 | /************************************************************************* 156 | * Functions 157 | *************************************************************************/ 158 | 159 | #if defined(GLFW_EXPOSE_NATIVE_WIN32) 160 | /*! @brief Returns the adapter device name of the specified monitor. 161 | * 162 | * @return The UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`) 163 | * of the specified monitor, or `NULL` if an [error](@ref error_handling) 164 | * occurred. 165 | * 166 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. 167 | * 168 | * @thread_safety This function may be called from any thread. Access is not 169 | * synchronized. 170 | * 171 | * @since Added in version 3.1. 172 | * 173 | * @ingroup native 174 | */ 175 | GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor); 176 | 177 | /*! @brief Returns the display device name of the specified monitor. 178 | * 179 | * @return The UTF-8 encoded display device name (for example 180 | * `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an 181 | * [error](@ref error_handling) occurred. 182 | * 183 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. 184 | * 185 | * @thread_safety This function may be called from any thread. Access is not 186 | * synchronized. 187 | * 188 | * @since Added in version 3.1. 189 | * 190 | * @ingroup native 191 | */ 192 | GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor); 193 | 194 | /*! @brief Returns the `HWND` of the specified window. 195 | * 196 | * @return The `HWND` of the specified window, or `NULL` if an 197 | * [error](@ref error_handling) occurred. 198 | * 199 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. 200 | * 201 | * @remark The `HDC` associated with the window can be queried with the 202 | * [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc) 203 | * function. 204 | * @code 205 | * HDC dc = GetDC(glfwGetWin32Window(window)); 206 | * @endcode 207 | * This DC is private and does not need to be released. 208 | * 209 | * @thread_safety This function may be called from any thread. Access is not 210 | * synchronized. 211 | * 212 | * @since Added in version 3.0. 213 | * 214 | * @ingroup native 215 | */ 216 | GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window); 217 | #endif 218 | 219 | #if defined(GLFW_EXPOSE_NATIVE_WGL) 220 | /*! @brief Returns the `HGLRC` of the specified window. 221 | * 222 | * @return The `HGLRC` of the specified window, or `NULL` if an 223 | * [error](@ref error_handling) occurred. 224 | * 225 | * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref 226 | * GLFW_NOT_INITIALIZED. 227 | * 228 | * @remark The `HDC` associated with the window can be queried with the 229 | * [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc) 230 | * function. 231 | * @code 232 | * HDC dc = GetDC(glfwGetWin32Window(window)); 233 | * @endcode 234 | * This DC is private and does not need to be released. 235 | * 236 | * @thread_safety This function may be called from any thread. Access is not 237 | * synchronized. 238 | * 239 | * @since Added in version 3.0. 240 | * 241 | * @ingroup native 242 | */ 243 | GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window); 244 | #endif 245 | 246 | #if defined(GLFW_EXPOSE_NATIVE_COCOA) 247 | /*! @brief Returns the `CGDirectDisplayID` of the specified monitor. 248 | * 249 | * @return The `CGDirectDisplayID` of the specified monitor, or 250 | * `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred. 251 | * 252 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. 253 | * 254 | * @thread_safety This function may be called from any thread. Access is not 255 | * synchronized. 256 | * 257 | * @since Added in version 3.1. 258 | * 259 | * @ingroup native 260 | */ 261 | GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor); 262 | 263 | /*! @brief Returns the `NSWindow` of the specified window. 264 | * 265 | * @return The `NSWindow` of the specified window, or `nil` if an 266 | * [error](@ref error_handling) occurred. 267 | * 268 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. 269 | * 270 | * @thread_safety This function may be called from any thread. Access is not 271 | * synchronized. 272 | * 273 | * @since Added in version 3.0. 274 | * 275 | * @ingroup native 276 | */ 277 | GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window); 278 | #endif 279 | 280 | #if defined(GLFW_EXPOSE_NATIVE_NSGL) 281 | /*! @brief Returns the `NSOpenGLContext` of the specified window. 282 | * 283 | * @return The `NSOpenGLContext` of the specified window, or `nil` if an 284 | * [error](@ref error_handling) occurred. 285 | * 286 | * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref 287 | * GLFW_NOT_INITIALIZED. 288 | * 289 | * @thread_safety This function may be called from any thread. Access is not 290 | * synchronized. 291 | * 292 | * @since Added in version 3.0. 293 | * 294 | * @ingroup native 295 | */ 296 | GLFWAPI id glfwGetNSGLContext(GLFWwindow* window); 297 | #endif 298 | 299 | #if defined(GLFW_EXPOSE_NATIVE_X11) 300 | /*! @brief Returns the `Display` used by GLFW. 301 | * 302 | * @return The `Display` used by GLFW, or `NULL` if an 303 | * [error](@ref error_handling) occurred. 304 | * 305 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. 306 | * 307 | * @thread_safety This function may be called from any thread. Access is not 308 | * synchronized. 309 | * 310 | * @since Added in version 3.0. 311 | * 312 | * @ingroup native 313 | */ 314 | GLFWAPI Display* glfwGetX11Display(void); 315 | 316 | /*! @brief Returns the `RRCrtc` of the specified monitor. 317 | * 318 | * @return The `RRCrtc` of the specified monitor, or `None` if an 319 | * [error](@ref error_handling) occurred. 320 | * 321 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. 322 | * 323 | * @thread_safety This function may be called from any thread. Access is not 324 | * synchronized. 325 | * 326 | * @since Added in version 3.1. 327 | * 328 | * @ingroup native 329 | */ 330 | GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor); 331 | 332 | /*! @brief Returns the `RROutput` of the specified monitor. 333 | * 334 | * @return The `RROutput` of the specified monitor, or `None` if an 335 | * [error](@ref error_handling) occurred. 336 | * 337 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. 338 | * 339 | * @thread_safety This function may be called from any thread. Access is not 340 | * synchronized. 341 | * 342 | * @since Added in version 3.1. 343 | * 344 | * @ingroup native 345 | */ 346 | GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor); 347 | 348 | /*! @brief Returns the `Window` of the specified window. 349 | * 350 | * @return The `Window` of the specified window, or `None` if an 351 | * [error](@ref error_handling) occurred. 352 | * 353 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. 354 | * 355 | * @thread_safety This function may be called from any thread. Access is not 356 | * synchronized. 357 | * 358 | * @since Added in version 3.0. 359 | * 360 | * @ingroup native 361 | */ 362 | GLFWAPI Window glfwGetX11Window(GLFWwindow* window); 363 | 364 | /*! @brief Sets the current primary selection to the specified string. 365 | * 366 | * @param[in] string A UTF-8 encoded string. 367 | * 368 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 369 | * GLFW_PLATFORM_ERROR. 370 | * 371 | * @pointer_lifetime The specified string is copied before this function 372 | * returns. 373 | * 374 | * @thread_safety This function must only be called from the main thread. 375 | * 376 | * @sa @ref clipboard 377 | * @sa glfwGetX11SelectionString 378 | * @sa glfwSetClipboardString 379 | * 380 | * @since Added in version 3.3. 381 | * 382 | * @ingroup native 383 | */ 384 | GLFWAPI void glfwSetX11SelectionString(const char* string); 385 | 386 | /*! @brief Returns the contents of the current primary selection as a string. 387 | * 388 | * If the selection is empty or if its contents cannot be converted, `NULL` 389 | * is returned and a @ref GLFW_FORMAT_UNAVAILABLE error is generated. 390 | * 391 | * @return The contents of the selection as a UTF-8 encoded string, or `NULL` 392 | * if an [error](@ref error_handling) occurred. 393 | * 394 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 395 | * GLFW_PLATFORM_ERROR. 396 | * 397 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You 398 | * should not free it yourself. It is valid until the next call to @ref 399 | * glfwGetX11SelectionString or @ref glfwSetX11SelectionString, or until the 400 | * library is terminated. 401 | * 402 | * @thread_safety This function must only be called from the main thread. 403 | * 404 | * @sa @ref clipboard 405 | * @sa glfwSetX11SelectionString 406 | * @sa glfwGetClipboardString 407 | * 408 | * @since Added in version 3.3. 409 | * 410 | * @ingroup native 411 | */ 412 | GLFWAPI const char* glfwGetX11SelectionString(void); 413 | #endif 414 | 415 | #if defined(GLFW_EXPOSE_NATIVE_GLX) 416 | /*! @brief Returns the `GLXContext` of the specified window. 417 | * 418 | * @return The `GLXContext` of the specified window, or `NULL` if an 419 | * [error](@ref error_handling) occurred. 420 | * 421 | * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref 422 | * GLFW_NOT_INITIALIZED. 423 | * 424 | * @thread_safety This function may be called from any thread. Access is not 425 | * synchronized. 426 | * 427 | * @since Added in version 3.0. 428 | * 429 | * @ingroup native 430 | */ 431 | GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window); 432 | 433 | /*! @brief Returns the `GLXWindow` of the specified window. 434 | * 435 | * @return The `GLXWindow` of the specified window, or `None` if an 436 | * [error](@ref error_handling) occurred. 437 | * 438 | * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref 439 | * GLFW_NOT_INITIALIZED. 440 | * 441 | * @thread_safety This function may be called from any thread. Access is not 442 | * synchronized. 443 | * 444 | * @since Added in version 3.2. 445 | * 446 | * @ingroup native 447 | */ 448 | GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window); 449 | #endif 450 | 451 | #if defined(GLFW_EXPOSE_NATIVE_WAYLAND) 452 | /*! @brief Returns the `struct wl_display*` used by GLFW. 453 | * 454 | * @return The `struct wl_display*` used by GLFW, or `NULL` if an 455 | * [error](@ref error_handling) occurred. 456 | * 457 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. 458 | * 459 | * @thread_safety This function may be called from any thread. Access is not 460 | * synchronized. 461 | * 462 | * @since Added in version 3.2. 463 | * 464 | * @ingroup native 465 | */ 466 | GLFWAPI struct wl_display* glfwGetWaylandDisplay(void); 467 | 468 | /*! @brief Returns the `struct wl_output*` of the specified monitor. 469 | * 470 | * @return The `struct wl_output*` of the specified monitor, or `NULL` if an 471 | * [error](@ref error_handling) occurred. 472 | * 473 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. 474 | * 475 | * @thread_safety This function may be called from any thread. Access is not 476 | * synchronized. 477 | * 478 | * @since Added in version 3.2. 479 | * 480 | * @ingroup native 481 | */ 482 | GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor); 483 | 484 | /*! @brief Returns the main `struct wl_surface*` of the specified window. 485 | * 486 | * @return The main `struct wl_surface*` of the specified window, or `NULL` if 487 | * an [error](@ref error_handling) occurred. 488 | * 489 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. 490 | * 491 | * @thread_safety This function may be called from any thread. Access is not 492 | * synchronized. 493 | * 494 | * @since Added in version 3.2. 495 | * 496 | * @ingroup native 497 | */ 498 | GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window); 499 | #endif 500 | 501 | #if defined(GLFW_EXPOSE_NATIVE_EGL) 502 | /*! @brief Returns the `EGLDisplay` used by GLFW. 503 | * 504 | * @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an 505 | * [error](@ref error_handling) occurred. 506 | * 507 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. 508 | * 509 | * @remark Because EGL is initialized on demand, this function will return 510 | * `EGL_NO_DISPLAY` until the first context has been created via EGL. 511 | * 512 | * @thread_safety This function may be called from any thread. Access is not 513 | * synchronized. 514 | * 515 | * @since Added in version 3.0. 516 | * 517 | * @ingroup native 518 | */ 519 | GLFWAPI EGLDisplay glfwGetEGLDisplay(void); 520 | 521 | /*! @brief Returns the `EGLContext` of the specified window. 522 | * 523 | * @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an 524 | * [error](@ref error_handling) occurred. 525 | * 526 | * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref 527 | * GLFW_NOT_INITIALIZED. 528 | * 529 | * @thread_safety This function may be called from any thread. Access is not 530 | * synchronized. 531 | * 532 | * @since Added in version 3.0. 533 | * 534 | * @ingroup native 535 | */ 536 | GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window); 537 | 538 | /*! @brief Returns the `EGLSurface` of the specified window. 539 | * 540 | * @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an 541 | * [error](@ref error_handling) occurred. 542 | * 543 | * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref 544 | * GLFW_NOT_INITIALIZED. 545 | * 546 | * @thread_safety This function may be called from any thread. Access is not 547 | * synchronized. 548 | * 549 | * @since Added in version 3.0. 550 | * 551 | * @ingroup native 552 | */ 553 | GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window); 554 | #endif 555 | 556 | #if defined(GLFW_EXPOSE_NATIVE_OSMESA) 557 | /*! @brief Retrieves the color buffer associated with the specified window. 558 | * 559 | * @param[in] window The window whose color buffer to retrieve. 560 | * @param[out] width Where to store the width of the color buffer, or `NULL`. 561 | * @param[out] height Where to store the height of the color buffer, or `NULL`. 562 | * @param[out] format Where to store the OSMesa pixel format of the color 563 | * buffer, or `NULL`. 564 | * @param[out] buffer Where to store the address of the color buffer, or 565 | * `NULL`. 566 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an 567 | * [error](@ref error_handling) occurred. 568 | * 569 | * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref 570 | * GLFW_NOT_INITIALIZED. 571 | * 572 | * @thread_safety This function may be called from any thread. Access is not 573 | * synchronized. 574 | * 575 | * @since Added in version 3.3. 576 | * 577 | * @ingroup native 578 | */ 579 | GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height, int* format, void** buffer); 580 | 581 | /*! @brief Retrieves the depth buffer associated with the specified window. 582 | * 583 | * @param[in] window The window whose depth buffer to retrieve. 584 | * @param[out] width Where to store the width of the depth buffer, or `NULL`. 585 | * @param[out] height Where to store the height of the depth buffer, or `NULL`. 586 | * @param[out] bytesPerValue Where to store the number of bytes per depth 587 | * buffer element, or `NULL`. 588 | * @param[out] buffer Where to store the address of the depth buffer, or 589 | * `NULL`. 590 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an 591 | * [error](@ref error_handling) occurred. 592 | * 593 | * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref 594 | * GLFW_NOT_INITIALIZED. 595 | * 596 | * @thread_safety This function may be called from any thread. Access is not 597 | * synchronized. 598 | * 599 | * @since Added in version 3.3. 600 | * 601 | * @ingroup native 602 | */ 603 | GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height, int* bytesPerValue, void** buffer); 604 | 605 | /*! @brief Returns the `OSMesaContext` of the specified window. 606 | * 607 | * @return The `OSMesaContext` of the specified window, or `NULL` if an 608 | * [error](@ref error_handling) occurred. 609 | * 610 | * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref 611 | * GLFW_NOT_INITIALIZED. 612 | * 613 | * @thread_safety This function may be called from any thread. Access is not 614 | * synchronized. 615 | * 616 | * @since Added in version 3.3. 617 | * 618 | * @ingroup native 619 | */ 620 | GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* window); 621 | #endif 622 | 623 | #ifdef __cplusplus 624 | } 625 | #endif 626 | 627 | #endif /* _glfw3_native_h_ */ 628 | 629 | -------------------------------------------------------------------------------- /VideoImgui/VideoImgui.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.32106.194 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VideoImgui", "VideoImgui\VideoImgui.vcxproj", "{A74C3829-8579-4AE7-A408-480B76B70C2C}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {A74C3829-8579-4AE7-A408-480B76B70C2C}.Debug|x64.ActiveCfg = Debug|x64 17 | {A74C3829-8579-4AE7-A408-480B76B70C2C}.Debug|x64.Build.0 = Debug|x64 18 | {A74C3829-8579-4AE7-A408-480B76B70C2C}.Debug|x86.ActiveCfg = Debug|Win32 19 | {A74C3829-8579-4AE7-A408-480B76B70C2C}.Debug|x86.Build.0 = Debug|Win32 20 | {A74C3829-8579-4AE7-A408-480B76B70C2C}.Release|x64.ActiveCfg = Release|x64 21 | {A74C3829-8579-4AE7-A408-480B76B70C2C}.Release|x64.Build.0 = Release|x64 22 | {A74C3829-8579-4AE7-A408-480B76B70C2C}.Release|x86.ActiveCfg = Release|Win32 23 | {A74C3829-8579-4AE7-A408-480B76B70C2C}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {CD7271EC-AF07-4439-B4DD-82F2719CDEEC} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/GUI.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/GUI.h -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/Imgui/imconfig.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI 3 | // Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure. 4 | // You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions. 5 | //----------------------------------------------------------------------------- 6 | // A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/rebased branch with your modifications to it) 7 | // B) or '#define IMGUI_USER_CONFIG "my_imgui_config.h"' in your project and then add directives in your own file without touching this template. 8 | //----------------------------------------------------------------------------- 9 | // You need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include the imgui*.cpp 10 | // files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures. 11 | // Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts. 12 | // Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using. 13 | //----------------------------------------------------------------------------- 14 | 15 | #pragma once 16 | 17 | //---- Define assertion handler. Defaults to calling assert(). 18 | // If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement. 19 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR) 20 | //#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts 21 | 22 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows 23 | // Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility. 24 | // DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions() 25 | // for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details. 26 | //#define IMGUI_API __declspec( dllexport ) 27 | //#define IMGUI_API __declspec( dllimport ) 28 | 29 | //---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names. 30 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 31 | //#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87: disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This will be folded into IMGUI_DISABLE_OBSOLETE_FUNCTIONS in a few versions. 32 | 33 | //---- Disable all of Dear ImGui or don't implement standard windows/tools. 34 | // It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp. 35 | //#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty. 36 | //#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. 37 | //#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowStackToolWindow() will be empty (this was called IMGUI_DISABLE_METRICS_WINDOW before 1.88). 38 | 39 | //---- Don't implement some functions to reduce linkage requirements. 40 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a) 41 | //#define IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with Visual Studio] Implement default IME handler (require imm32.lib/.a, auto-link for Visual Studio, -limm32 on command-line for MinGW) 42 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with non-Visual Studio compilers] Don't implement default IME handler (won't require imm32.lib/.a) 43 | //#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, ime). 44 | //#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default). 45 | //#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf) 46 | //#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself. 47 | //#define IMGUI_DISABLE_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle at all (replace them with dummies) 48 | //#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function. 49 | //#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions(). 50 | //#define IMGUI_DISABLE_SSE // Disable use of SSE intrinsics even if available 51 | 52 | //---- Include imgui_user.h at the end of imgui.h as a convenience 53 | //#define IMGUI_INCLUDE_IMGUI_USER_H 54 | 55 | //---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another) 56 | //#define IMGUI_USE_BGRA_PACKED_COLOR 57 | 58 | //---- Use 32-bit for ImWchar (default is 16-bit) to support unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...) 59 | //#define IMGUI_USE_WCHAR32 60 | 61 | //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version 62 | // By default the embedded implementations are declared static and not available outside of Dear ImGui sources files. 63 | //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h" 64 | //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h" 65 | //#define IMGUI_STB_SPRINTF_FILENAME "my_folder/stb_sprintf.h" // only used if enabled 66 | //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION 67 | //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION 68 | 69 | //---- Use stb_sprintf.h for a faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined) 70 | // Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by stb_sprintf.h. 71 | //#define IMGUI_USE_STB_SPRINTF 72 | 73 | //---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui) 74 | // Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided). 75 | // On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'. 76 | //#define IMGUI_ENABLE_FREETYPE 77 | 78 | //---- Use stb_truetype to build and rasterize the font atlas (default) 79 | // The only purpose of this define is if you want force compilation of the stb_truetype backend ALONG with the FreeType backend. 80 | //#define IMGUI_ENABLE_STB_TRUETYPE 81 | 82 | //---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4. 83 | // This will be inlined as part of ImVec2 and ImVec4 class declarations. 84 | /* 85 | #define IM_VEC2_CLASS_EXTRA \ 86 | constexpr ImVec2(const MyVec2& f) : x(f.x), y(f.y) {} \ 87 | operator MyVec2() const { return MyVec2(x,y); } 88 | 89 | #define IM_VEC4_CLASS_EXTRA \ 90 | constexpr ImVec4(const MyVec4& f) : x(f.x), y(f.y), z(f.z), w(f.w) {} \ 91 | operator MyVec4() const { return MyVec4(x,y,z,w); } 92 | */ 93 | 94 | //---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices. 95 | // Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices). 96 | // Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer. 97 | // Read about ImGuiBackendFlags_RendererHasVtxOffset for details. 98 | //#define ImDrawIdx unsigned int 99 | 100 | //---- Override ImDrawCallback signature (will need to modify renderer backends accordingly) 101 | //struct ImDrawList; 102 | //struct ImDrawCmd; 103 | //typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data); 104 | //#define ImDrawCallback MyImDrawCallback 105 | 106 | //---- Debug Tools: Macro to break in Debugger 107 | // (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.) 108 | //#define IM_DEBUG_BREAK IM_ASSERT(0) 109 | //#define IM_DEBUG_BREAK __debugbreak() 110 | 111 | //---- Debug Tools: Enable slower asserts 112 | //#define IMGUI_DEBUG_PARANOID 113 | 114 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files. 115 | /* 116 | namespace ImGui 117 | { 118 | void MyFunction(const char* name, const MyMatrix44& v); 119 | } 120 | */ 121 | -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/Imgui/imgui_impl_glfw.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Backend for GLFW 2 | // This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan, WebGPU..) 3 | // (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.) 4 | // (Requires: GLFW 3.1+. Prefer GLFW 3.3+ for full feature support.) 5 | 6 | // Implemented features: 7 | // [X] Platform: Clipboard support. 8 | // [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy GLFW_KEY_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set] 9 | // [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 10 | // [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange' (note: the resizing cursors requires GLFW 3.4+). 11 | // [X] Platform: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 12 | 13 | // Issues: 14 | // [ ] Platform: Multi-viewport support: ParentViewportID not honored, and so io.ConfigViewportsNoDefaultParent has no effect (minor). 15 | 16 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 17 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 18 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 19 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 20 | 21 | #pragma once 22 | #include "imgui.h" // IMGUI_IMPL_API 23 | 24 | struct GLFWwindow; 25 | struct GLFWmonitor; 26 | 27 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks); 28 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks); 29 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOther(GLFWwindow* window, bool install_callbacks); 30 | IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown(); 31 | IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame(); 32 | 33 | // GLFW callbacks (installer) 34 | // - When calling Init with 'install_callbacks=true': ImGui_ImplGlfw_InstallCallbacks() is called. GLFW callbacks will be installed for you. They will chain-call user's previously installed callbacks, if any. 35 | // - When calling Init with 'install_callbacks=false': GLFW callbacks won't be installed. You will need to call individual function yourself from your own GLFW callbacks. 36 | IMGUI_IMPL_API void ImGui_ImplGlfw_InstallCallbacks(GLFWwindow* window); 37 | IMGUI_IMPL_API void ImGui_ImplGlfw_RestoreCallbacks(GLFWwindow* window); 38 | 39 | // GLFW callbacks (individual callbacks to call if you didn't install callbacks) 40 | IMGUI_IMPL_API void ImGui_ImplGlfw_WindowFocusCallback(GLFWwindow* window, int focused); // Since 1.84 41 | IMGUI_IMPL_API void ImGui_ImplGlfw_CursorEnterCallback(GLFWwindow* window, int entered); // Since 1.84 42 | IMGUI_IMPL_API void ImGui_ImplGlfw_CursorPosCallback(GLFWwindow* window, double x, double y); // Since 1.87 43 | IMGUI_IMPL_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods); 44 | IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset); 45 | IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods); 46 | IMGUI_IMPL_API void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c); 47 | IMGUI_IMPL_API void ImGui_ImplGlfw_MonitorCallback(GLFWmonitor* monitor, int event); 48 | -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/Imgui/imgui_impl_opengl3.cpp: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for modern OpenGL with shaders / programmatic pipeline 2 | // - Desktop GL: 2.x 3.x 4.x 3 | // - Embedded GL: ES 2.0 (WebGL 1.0), ES 3.0 (WebGL 2.0) 4 | // This needs to be used along with a Platform Backend (e.g. GLFW, SDL, Win32, custom..) 5 | 6 | // Implemented features: 7 | // [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID! 8 | // [X] Renderer: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 9 | // [x] Renderer: Large meshes support (64k+ vertices) with 16-bit indices (Desktop OpenGL only). 10 | 11 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 12 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 13 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 14 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 15 | 16 | // CHANGELOG 17 | // (minor and older changes stripped away, please see git history for details) 18 | // 2022-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface. 19 | // 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11. 20 | // 2022-09-27: OpenGL: Added ability to '#define IMGUI_IMPL_OPENGL_DEBUG'. 21 | // 2022-05-23: OpenGL: Reworking 2021-12-15 "Using buffer orphaning" so it only happens on Intel GPU, seems to cause problems otherwise. (#4468, #4825, #4832, #5127). 22 | // 2022-05-13: OpenGL: Fix state corruption on OpenGL ES 2.0 due to not preserving GL_ELEMENT_ARRAY_BUFFER_BINDING and vertex attribute states. 23 | // 2021-12-15: OpenGL: Using buffer orphaning + glBufferSubData(), seems to fix leaks with multi-viewports with some Intel HD drivers. 24 | // 2021-08-23: OpenGL: Fixed ES 3.0 shader ("#version 300 es") use normal precision floats to avoid wobbly rendering at HD resolutions. 25 | // 2021-08-19: OpenGL: Embed and use our own minimal GL loader (imgui_impl_opengl3_loader.h), removing requirement and support for third-party loader. 26 | // 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX). 27 | // 2021-06-25: OpenGL: Use OES_vertex_array extension on Emscripten + backup/restore current state. 28 | // 2021-06-21: OpenGL: Destroy individual vertex/fragment shader objects right after they are linked into the main shader. 29 | // 2021-05-24: OpenGL: Access GL_CLIP_ORIGIN when "GL_ARB_clip_control" extension is detected, inside of just OpenGL 4.5 version. 30 | // 2021-05-19: OpenGL: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement) 31 | // 2021-04-06: OpenGL: Don't try to read GL_CLIP_ORIGIN unless we're OpenGL 4.5 or greater. 32 | // 2021-02-18: OpenGL: Change blending equation to preserve alpha in output buffer. 33 | // 2021-01-03: OpenGL: Backup, setup and restore GL_STENCIL_TEST state. 34 | // 2020-10-23: OpenGL: Backup, setup and restore GL_PRIMITIVE_RESTART state. 35 | // 2020-10-15: OpenGL: Use glGetString(GL_VERSION) instead of glGetIntegerv(GL_MAJOR_VERSION, ...) when the later returns zero (e.g. Desktop GL 2.x) 36 | // 2020-09-17: OpenGL: Fix to avoid compiling/calling glBindSampler() on ES or pre 3.3 context which have the defines set by a loader. 37 | // 2020-07-10: OpenGL: Added support for glad2 OpenGL loader. 38 | // 2020-05-08: OpenGL: Made default GLSL version 150 (instead of 130) on OSX. 39 | // 2020-04-21: OpenGL: Fixed handling of glClipControl(GL_UPPER_LEFT) by inverting projection matrix. 40 | // 2020-04-12: OpenGL: Fixed context version check mistakenly testing for 4.0+ instead of 3.2+ to enable ImGuiBackendFlags_RendererHasVtxOffset. 41 | // 2020-03-24: OpenGL: Added support for glbinding 2.x OpenGL loader. 42 | // 2020-01-07: OpenGL: Added support for glbinding 3.x OpenGL loader. 43 | // 2019-10-25: OpenGL: Using a combination of GL define and runtime GL version to decide whether to use glDrawElementsBaseVertex(). Fix building with pre-3.2 GL loaders. 44 | // 2019-09-22: OpenGL: Detect default GL loader using __has_include compiler facility. 45 | // 2019-09-16: OpenGL: Tweak initialization code to allow application calling ImGui_ImplOpenGL3_CreateFontsTexture() before the first NewFrame() call. 46 | // 2019-05-29: OpenGL: Desktop GL only: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag. 47 | // 2019-04-30: OpenGL: Added support for special ImDrawCallback_ResetRenderState callback to reset render state. 48 | // 2019-03-29: OpenGL: Not calling glBindBuffer more than necessary in the render loop. 49 | // 2019-03-15: OpenGL: Added a GL call + comments in ImGui_ImplOpenGL3_Init() to detect uninitialized GL function loaders early. 50 | // 2019-03-03: OpenGL: Fix support for ES 2.0 (WebGL 1.0). 51 | // 2019-02-20: OpenGL: Fix for OSX not supporting OpenGL 4.5, we don't try to read GL_CLIP_ORIGIN even if defined by the headers/loader. 52 | // 2019-02-11: OpenGL: Projecting clipping rectangles correctly using draw_data->FramebufferScale to allow multi-viewports for retina display. 53 | // 2019-02-01: OpenGL: Using GLSL 410 shaders for any version over 410 (e.g. 430, 450). 54 | // 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window. 55 | // 2018-11-13: OpenGL: Support for GL 4.5's glClipControl(GL_UPPER_LEFT) / GL_CLIP_ORIGIN. 56 | // 2018-08-29: OpenGL: Added support for more OpenGL loaders: glew and glad, with comments indicative that any loader can be used. 57 | // 2018-08-09: OpenGL: Default to OpenGL ES 3 on iOS and Android. GLSL version default to "#version 300 ES". 58 | // 2018-07-30: OpenGL: Support for GLSL 300 ES and 410 core. Fixes for Emscripten compilation. 59 | // 2018-07-10: OpenGL: Support for more GLSL versions (based on the GLSL version string). Added error output when shaders fail to compile/link. 60 | // 2018-06-08: Misc: Extracted imgui_impl_opengl3.cpp/.h away from the old combined GLFW/SDL+OpenGL3 examples. 61 | // 2018-06-08: OpenGL: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle. 62 | // 2018-05-25: OpenGL: Removed unnecessary backup/restore of GL_ELEMENT_ARRAY_BUFFER_BINDING since this is part of the VAO state. 63 | // 2018-05-14: OpenGL: Making the call to glBindSampler() optional so 3.2 context won't fail if the function is a nullptr pointer. 64 | // 2018-03-06: OpenGL: Added const char* glsl_version parameter to ImGui_ImplOpenGL3_Init() so user can override the GLSL version e.g. "#version 150". 65 | // 2018-02-23: OpenGL: Create the VAO in the render function so the setup can more easily be used with multiple shared GL context. 66 | // 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplSdlGL3_RenderDrawData() in the .h file so you can call it yourself. 67 | // 2018-01-07: OpenGL: Changed GLSL shader version from 330 to 150. 68 | // 2017-09-01: OpenGL: Save and restore current bound sampler. Save and restore current polygon mode. 69 | // 2017-05-01: OpenGL: Fixed save and restore of current blend func state. 70 | // 2017-05-01: OpenGL: Fixed save and restore of current GL_ACTIVE_TEXTURE. 71 | // 2016-09-05: OpenGL: Fixed save and restore of current scissor rectangle. 72 | // 2016-07-29: OpenGL: Explicitly setting GL_UNPACK_ROW_LENGTH to reduce issues because SDL changes it. (#752) 73 | 74 | //---------------------------------------- 75 | // OpenGL GLSL GLSL 76 | // version version string 77 | //---------------------------------------- 78 | // 2.0 110 "#version 110" 79 | // 2.1 120 "#version 120" 80 | // 3.0 130 "#version 130" 81 | // 3.1 140 "#version 140" 82 | // 3.2 150 "#version 150" 83 | // 3.3 330 "#version 330 core" 84 | // 4.0 400 "#version 400 core" 85 | // 4.1 410 "#version 410 core" 86 | // 4.2 420 "#version 410 core" 87 | // 4.3 430 "#version 430 core" 88 | // ES 2.0 100 "#version 100" = WebGL 1.0 89 | // ES 3.0 300 "#version 300 es" = WebGL 2.0 90 | //---------------------------------------- 91 | 92 | #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) 93 | #define _CRT_SECURE_NO_WARNINGS 94 | #endif 95 | 96 | #include "imgui.h" 97 | #include "imgui_impl_opengl3.h" 98 | #include 99 | #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier 100 | #include // intptr_t 101 | #else 102 | #include // intptr_t 103 | #endif 104 | #if defined(__APPLE__) 105 | #include 106 | #endif 107 | 108 | // Clang warnings with -Weverything 109 | #if defined(__clang__) 110 | #pragma clang diagnostic push 111 | #pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast 112 | #pragma clang diagnostic ignored "-Wsign-conversion" // warning: implicit conversion changes signedness 113 | #endif 114 | 115 | // GL includes 116 | #if defined(IMGUI_IMPL_OPENGL_ES2) 117 | #if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) 118 | #include // Use GL ES 2 119 | #else 120 | #include // Use GL ES 2 121 | #endif 122 | #if defined(__EMSCRIPTEN__) 123 | #ifndef GL_GLEXT_PROTOTYPES 124 | #define GL_GLEXT_PROTOTYPES 125 | #endif 126 | #include 127 | #endif 128 | #elif defined(IMGUI_IMPL_OPENGL_ES3) 129 | #if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) 130 | #include // Use GL ES 3 131 | #else 132 | #include // Use GL ES 3 133 | #endif 134 | #elif !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM) 135 | // Modern desktop OpenGL doesn't have a standard portable header file to load OpenGL function pointers. 136 | // Helper libraries are often used for this purpose! Here we are using our own minimal custom loader based on gl3w. 137 | // In the rest of your app/engine, you can use another loader of your choice (gl3w, glew, glad, glbinding, glext, glLoadGen, etc.). 138 | // If you happen to be developing a new feature for this backend (imgui_impl_opengl3.cpp): 139 | // - You may need to regenerate imgui_impl_opengl3_loader.h to add new symbols. See https://github.com/dearimgui/gl3w_stripped 140 | // - You can temporarily use an unstripped version. See https://github.com/dearimgui/gl3w_stripped/releases 141 | // Changes to this backend using new APIs should be accompanied by a regenerated stripped loader version. 142 | #define IMGL3W_IMPL 143 | #include "imgui_impl_opengl3_loader.h" 144 | #endif 145 | 146 | // Vertex arrays are not supported on ES2/WebGL1 unless Emscripten which uses an extension 147 | #ifndef IMGUI_IMPL_OPENGL_ES2 148 | #define IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY 149 | #elif defined(__EMSCRIPTEN__) 150 | #define IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY 151 | #define glBindVertexArray glBindVertexArrayOES 152 | #define glGenVertexArrays glGenVertexArraysOES 153 | #define glDeleteVertexArrays glDeleteVertexArraysOES 154 | #define GL_VERTEX_ARRAY_BINDING GL_VERTEX_ARRAY_BINDING_OES 155 | #endif 156 | 157 | // Desktop GL 2.0+ has glPolygonMode() which GL ES and WebGL don't have. 158 | #ifdef GL_POLYGON_MODE 159 | #define IMGUI_IMPL_HAS_POLYGON_MODE 160 | #endif 161 | 162 | // Desktop GL 3.2+ has glDrawElementsBaseVertex() which GL ES and WebGL don't have. 163 | #if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && defined(GL_VERSION_3_2) 164 | #define IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET 165 | #endif 166 | 167 | // Desktop GL 3.3+ has glBindSampler() 168 | #if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && defined(GL_VERSION_3_3) 169 | #define IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER 170 | #endif 171 | 172 | // Desktop GL 3.1+ has GL_PRIMITIVE_RESTART state 173 | #if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && defined(GL_VERSION_3_1) 174 | #define IMGUI_IMPL_OPENGL_MAY_HAVE_PRIMITIVE_RESTART 175 | #endif 176 | 177 | // Desktop GL use extension detection 178 | #if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) 179 | #define IMGUI_IMPL_OPENGL_MAY_HAVE_EXTENSIONS 180 | #endif 181 | 182 | // [Debugging] 183 | //#define IMGUI_IMPL_OPENGL_DEBUG 184 | #ifdef IMGUI_IMPL_OPENGL_DEBUG 185 | #include 186 | #define GL_CALL(_CALL) do { _CALL; GLenum gl_err = glGetError(); if (gl_err != 0) fprintf(stderr, "GL error 0x%x returned from '%s'.\n", gl_err, #_CALL); } while (0) // Call with error check 187 | #else 188 | #define GL_CALL(_CALL) _CALL // Call without error check 189 | #endif 190 | 191 | // OpenGL Data 192 | struct ImGui_ImplOpenGL3_Data 193 | { 194 | GLuint GlVersion; // Extracted at runtime using GL_MAJOR_VERSION, GL_MINOR_VERSION queries (e.g. 320 for GL 3.2) 195 | char GlslVersionString[32]; // Specified by user or detected based on compile time GL settings. 196 | GLuint FontTexture; 197 | GLuint ShaderHandle; 198 | GLint AttribLocationTex; // Uniforms location 199 | GLint AttribLocationProjMtx; 200 | GLuint AttribLocationVtxPos; // Vertex attributes location 201 | GLuint AttribLocationVtxUV; 202 | GLuint AttribLocationVtxColor; 203 | unsigned int VboHandle, ElementsHandle; 204 | GLsizeiptr VertexBufferSize; 205 | GLsizeiptr IndexBufferSize; 206 | bool HasClipOrigin; 207 | bool UseBufferSubData; 208 | 209 | ImGui_ImplOpenGL3_Data() { memset((void*)this, 0, sizeof(*this)); } 210 | }; 211 | 212 | // Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts 213 | // It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts. 214 | static ImGui_ImplOpenGL3_Data* ImGui_ImplOpenGL3_GetBackendData() 215 | { 216 | return ImGui::GetCurrentContext() ? (ImGui_ImplOpenGL3_Data*)ImGui::GetIO().BackendRendererUserData : nullptr; 217 | } 218 | 219 | // Forward Declarations 220 | static void ImGui_ImplOpenGL3_InitPlatformInterface(); 221 | static void ImGui_ImplOpenGL3_ShutdownPlatformInterface(); 222 | 223 | // OpenGL vertex attribute state (for ES 1.0 and ES 2.0 only) 224 | #ifndef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY 225 | struct ImGui_ImplOpenGL3_VtxAttribState 226 | { 227 | GLint Enabled, Size, Type, Normalized, Stride; 228 | GLvoid* Ptr; 229 | 230 | void GetState(GLint index) 231 | { 232 | glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &Enabled); 233 | glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_SIZE, &Size); 234 | glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_TYPE, &Type); 235 | glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &Normalized); 236 | glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &Stride); 237 | glGetVertexAttribPointerv(index, GL_VERTEX_ATTRIB_ARRAY_POINTER, &Ptr); 238 | } 239 | void SetState(GLint index) 240 | { 241 | glVertexAttribPointer(index, Size, Type, (GLboolean)Normalized, Stride, Ptr); 242 | if (Enabled) glEnableVertexAttribArray(index); else glDisableVertexAttribArray(index); 243 | } 244 | }; 245 | #endif 246 | 247 | // Functions 248 | bool ImGui_ImplOpenGL3_Init(const char* glsl_version) 249 | { 250 | ImGuiIO& io = ImGui::GetIO(); 251 | IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!"); 252 | 253 | // Initialize our loader 254 | #if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM) 255 | if (imgl3wInit() != 0) 256 | { 257 | fprintf(stderr, "Failed to initialize OpenGL loader!\n"); 258 | return false; 259 | } 260 | #endif 261 | 262 | // Setup backend capabilities flags 263 | ImGui_ImplOpenGL3_Data* bd = IM_NEW(ImGui_ImplOpenGL3_Data)(); 264 | io.BackendRendererUserData = (void*)bd; 265 | io.BackendRendererName = "imgui_impl_opengl3"; 266 | 267 | // Query for GL version (e.g. 320 for GL 3.2) 268 | #if !defined(IMGUI_IMPL_OPENGL_ES2) 269 | GLint major = 0; 270 | GLint minor = 0; 271 | glGetIntegerv(GL_MAJOR_VERSION, &major); 272 | glGetIntegerv(GL_MINOR_VERSION, &minor); 273 | if (major == 0 && minor == 0) 274 | { 275 | // Query GL_VERSION in desktop GL 2.x, the string will start with "." 276 | const char* gl_version = (const char*)glGetString(GL_VERSION); 277 | sscanf(gl_version, "%d.%d", &major, &minor); 278 | } 279 | bd->GlVersion = (GLuint)(major * 100 + minor * 10); 280 | 281 | // Query vendor to enable glBufferSubData kludge 282 | #ifdef _WIN32 283 | if (const char* vendor = (const char*)glGetString(GL_VENDOR)) 284 | if (strncmp(vendor, "Intel", 5) == 0) 285 | bd->UseBufferSubData = true; 286 | #endif 287 | #else 288 | bd->GlVersion = 200; // GLES 2 289 | #endif 290 | 291 | #ifdef IMGUI_IMPL_OPENGL_DEBUG 292 | printf("GL_MAJOR_VERSION = %d\nGL_MINOR_VERSION = %d\nGL_VENDOR = '%s'\nGL_RENDERER = '%s'\n", major, minor, (const char*)glGetString(GL_VENDOR), (const char*)glGetString(GL_RENDERER)); // [DEBUG] 293 | #endif 294 | 295 | #ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET 296 | if (bd->GlVersion >= 320) 297 | io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes. 298 | #endif 299 | io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional) 300 | 301 | // Store GLSL version string so we can refer to it later in case we recreate shaders. 302 | // Note: GLSL version is NOT the same as GL version. Leave this to nullptr if unsure. 303 | if (glsl_version == nullptr) 304 | { 305 | #if defined(IMGUI_IMPL_OPENGL_ES2) 306 | glsl_version = "#version 100"; 307 | #elif defined(IMGUI_IMPL_OPENGL_ES3) 308 | glsl_version = "#version 300 es"; 309 | #elif defined(__APPLE__) 310 | glsl_version = "#version 150"; 311 | #else 312 | glsl_version = "#version 130"; 313 | #endif 314 | } 315 | IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(bd->GlslVersionString)); 316 | strcpy(bd->GlslVersionString, glsl_version); 317 | strcat(bd->GlslVersionString, "\n"); 318 | 319 | // Make an arbitrary GL call (we don't actually need the result) 320 | // IF YOU GET A CRASH HERE: it probably means the OpenGL function loader didn't do its job. Let us know! 321 | GLint current_texture; 322 | glGetIntegerv(GL_TEXTURE_BINDING_2D, ¤t_texture); 323 | 324 | // Detect extensions we support 325 | bd->HasClipOrigin = (bd->GlVersion >= 450); 326 | #ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_EXTENSIONS 327 | GLint num_extensions = 0; 328 | glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions); 329 | for (GLint i = 0; i < num_extensions; i++) 330 | { 331 | const char* extension = (const char*)glGetStringi(GL_EXTENSIONS, i); 332 | if (extension != nullptr && strcmp(extension, "GL_ARB_clip_control") == 0) 333 | bd->HasClipOrigin = true; 334 | } 335 | #endif 336 | 337 | if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) 338 | ImGui_ImplOpenGL3_InitPlatformInterface(); 339 | 340 | return true; 341 | } 342 | 343 | void ImGui_ImplOpenGL3_Shutdown() 344 | { 345 | ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData(); 346 | IM_ASSERT(bd != nullptr && "No renderer backend to shutdown, or already shutdown?"); 347 | ImGuiIO& io = ImGui::GetIO(); 348 | 349 | ImGui_ImplOpenGL3_ShutdownPlatformInterface(); 350 | ImGui_ImplOpenGL3_DestroyDeviceObjects(); 351 | io.BackendRendererName = nullptr; 352 | io.BackendRendererUserData = nullptr; 353 | IM_DELETE(bd); 354 | } 355 | 356 | void ImGui_ImplOpenGL3_NewFrame() 357 | { 358 | ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData(); 359 | IM_ASSERT(bd != nullptr && "Did you call ImGui_ImplOpenGL3_Init()?"); 360 | 361 | if (!bd->ShaderHandle) 362 | ImGui_ImplOpenGL3_CreateDeviceObjects(); 363 | } 364 | 365 | static void ImGui_ImplOpenGL3_SetupRenderState(ImDrawData* draw_data, int fb_width, int fb_height, GLuint vertex_array_object) 366 | { 367 | ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData(); 368 | 369 | // Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill 370 | glEnable(GL_BLEND); 371 | glBlendEquation(GL_FUNC_ADD); 372 | glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); 373 | glDisable(GL_CULL_FACE); 374 | glDisable(GL_DEPTH_TEST); 375 | glDisable(GL_STENCIL_TEST); 376 | glEnable(GL_SCISSOR_TEST); 377 | #ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_PRIMITIVE_RESTART 378 | if (bd->GlVersion >= 310) 379 | glDisable(GL_PRIMITIVE_RESTART); 380 | #endif 381 | #ifdef IMGUI_IMPL_HAS_POLYGON_MODE 382 | glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 383 | #endif 384 | 385 | // Support for GL 4.5 rarely used glClipControl(GL_UPPER_LEFT) 386 | #if defined(GL_CLIP_ORIGIN) 387 | bool clip_origin_lower_left = true; 388 | if (bd->HasClipOrigin) 389 | { 390 | GLenum current_clip_origin = 0; glGetIntegerv(GL_CLIP_ORIGIN, (GLint*)¤t_clip_origin); 391 | if (current_clip_origin == GL_UPPER_LEFT) 392 | clip_origin_lower_left = false; 393 | } 394 | #endif 395 | 396 | // Setup viewport, orthographic projection matrix 397 | // Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps. 398 | GL_CALL(glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height)); 399 | float L = draw_data->DisplayPos.x; 400 | float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x; 401 | float T = draw_data->DisplayPos.y; 402 | float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y; 403 | #if defined(GL_CLIP_ORIGIN) 404 | if (!clip_origin_lower_left) { float tmp = T; T = B; B = tmp; } // Swap top and bottom if origin is upper left 405 | #endif 406 | const float ortho_projection[4][4] = 407 | { 408 | { 2.0f/(R-L), 0.0f, 0.0f, 0.0f }, 409 | { 0.0f, 2.0f/(T-B), 0.0f, 0.0f }, 410 | { 0.0f, 0.0f, -1.0f, 0.0f }, 411 | { (R+L)/(L-R), (T+B)/(B-T), 0.0f, 1.0f }, 412 | }; 413 | glUseProgram(bd->ShaderHandle); 414 | glUniform1i(bd->AttribLocationTex, 0); 415 | glUniformMatrix4fv(bd->AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0]); 416 | 417 | #ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER 418 | if (bd->GlVersion >= 330) 419 | glBindSampler(0, 0); // We use combined texture/sampler state. Applications using GL 3.3 may set that otherwise. 420 | #endif 421 | 422 | (void)vertex_array_object; 423 | #ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY 424 | glBindVertexArray(vertex_array_object); 425 | #endif 426 | 427 | // Bind vertex/index buffers and setup attributes for ImDrawVert 428 | GL_CALL(glBindBuffer(GL_ARRAY_BUFFER, bd->VboHandle)); 429 | GL_CALL(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bd->ElementsHandle)); 430 | GL_CALL(glEnableVertexAttribArray(bd->AttribLocationVtxPos)); 431 | GL_CALL(glEnableVertexAttribArray(bd->AttribLocationVtxUV)); 432 | GL_CALL(glEnableVertexAttribArray(bd->AttribLocationVtxColor)); 433 | GL_CALL(glVertexAttribPointer(bd->AttribLocationVtxPos, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, pos))); 434 | GL_CALL(glVertexAttribPointer(bd->AttribLocationVtxUV, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, uv))); 435 | GL_CALL(glVertexAttribPointer(bd->AttribLocationVtxColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, col))); 436 | } 437 | 438 | // OpenGL3 Render function. 439 | // Note that this implementation is little overcomplicated because we are saving/setting up/restoring every OpenGL state explicitly. 440 | // This is in order to be able to run within an OpenGL engine that doesn't do so. 441 | void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data) 442 | { 443 | // Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates) 444 | int fb_width = (int)(draw_data->DisplaySize.x * draw_data->FramebufferScale.x); 445 | int fb_height = (int)(draw_data->DisplaySize.y * draw_data->FramebufferScale.y); 446 | if (fb_width <= 0 || fb_height <= 0) 447 | return; 448 | 449 | ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData(); 450 | 451 | // Backup GL state 452 | GLenum last_active_texture; glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint*)&last_active_texture); 453 | glActiveTexture(GL_TEXTURE0); 454 | GLuint last_program; glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&last_program); 455 | GLuint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint*)&last_texture); 456 | #ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER 457 | GLuint last_sampler; if (bd->GlVersion >= 330) { glGetIntegerv(GL_SAMPLER_BINDING, (GLint*)&last_sampler); } else { last_sampler = 0; } 458 | #endif 459 | GLuint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, (GLint*)&last_array_buffer); 460 | #ifndef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY 461 | // This is part of VAO on OpenGL 3.0+ and OpenGL ES 3.0+. 462 | GLint last_element_array_buffer; glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &last_element_array_buffer); 463 | ImGui_ImplOpenGL3_VtxAttribState last_vtx_attrib_state_pos; last_vtx_attrib_state_pos.GetState(bd->AttribLocationVtxPos); 464 | ImGui_ImplOpenGL3_VtxAttribState last_vtx_attrib_state_uv; last_vtx_attrib_state_uv.GetState(bd->AttribLocationVtxUV); 465 | ImGui_ImplOpenGL3_VtxAttribState last_vtx_attrib_state_color; last_vtx_attrib_state_color.GetState(bd->AttribLocationVtxColor); 466 | #endif 467 | #ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY 468 | GLuint last_vertex_array_object; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, (GLint*)&last_vertex_array_object); 469 | #endif 470 | #ifdef IMGUI_IMPL_HAS_POLYGON_MODE 471 | GLint last_polygon_mode[2]; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode); 472 | #endif 473 | GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport); 474 | GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box); 475 | GLenum last_blend_src_rgb; glGetIntegerv(GL_BLEND_SRC_RGB, (GLint*)&last_blend_src_rgb); 476 | GLenum last_blend_dst_rgb; glGetIntegerv(GL_BLEND_DST_RGB, (GLint*)&last_blend_dst_rgb); 477 | GLenum last_blend_src_alpha; glGetIntegerv(GL_BLEND_SRC_ALPHA, (GLint*)&last_blend_src_alpha); 478 | GLenum last_blend_dst_alpha; glGetIntegerv(GL_BLEND_DST_ALPHA, (GLint*)&last_blend_dst_alpha); 479 | GLenum last_blend_equation_rgb; glGetIntegerv(GL_BLEND_EQUATION_RGB, (GLint*)&last_blend_equation_rgb); 480 | GLenum last_blend_equation_alpha; glGetIntegerv(GL_BLEND_EQUATION_ALPHA, (GLint*)&last_blend_equation_alpha); 481 | GLboolean last_enable_blend = glIsEnabled(GL_BLEND); 482 | GLboolean last_enable_cull_face = glIsEnabled(GL_CULL_FACE); 483 | GLboolean last_enable_depth_test = glIsEnabled(GL_DEPTH_TEST); 484 | GLboolean last_enable_stencil_test = glIsEnabled(GL_STENCIL_TEST); 485 | GLboolean last_enable_scissor_test = glIsEnabled(GL_SCISSOR_TEST); 486 | #ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_PRIMITIVE_RESTART 487 | GLboolean last_enable_primitive_restart = (bd->GlVersion >= 310) ? glIsEnabled(GL_PRIMITIVE_RESTART) : GL_FALSE; 488 | #endif 489 | 490 | // Setup desired GL state 491 | // Recreate the VAO every time (this is to easily allow multiple GL contexts to be rendered to. VAO are not shared among GL contexts) 492 | // The renderer would actually work without any VAO bound, but then our VertexAttrib calls would overwrite the default one currently bound. 493 | GLuint vertex_array_object = 0; 494 | #ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY 495 | GL_CALL(glGenVertexArrays(1, &vertex_array_object)); 496 | #endif 497 | ImGui_ImplOpenGL3_SetupRenderState(draw_data, fb_width, fb_height, vertex_array_object); 498 | 499 | // Will project scissor/clipping rectangles into framebuffer space 500 | ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports 501 | ImVec2 clip_scale = draw_data->FramebufferScale; // (1,1) unless using retina display which are often (2,2) 502 | 503 | // Render command lists 504 | for (int n = 0; n < draw_data->CmdListsCount; n++) 505 | { 506 | const ImDrawList* cmd_list = draw_data->CmdLists[n]; 507 | 508 | // Upload vertex/index buffers 509 | // - On Intel windows drivers we got reports that regular glBufferData() led to accumulating leaks when using multi-viewports, so we started using orphaning + glBufferSubData(). (See https://github.com/ocornut/imgui/issues/4468) 510 | // - On NVIDIA drivers we got reports that using orphaning + glBufferSubData() led to glitches when using multi-viewports. 511 | // - OpenGL drivers are in a very sorry state in 2022, for now we are switching code path based on vendors. 512 | const GLsizeiptr vtx_buffer_size = (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert); 513 | const GLsizeiptr idx_buffer_size = (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx); 514 | if (bd->UseBufferSubData) 515 | { 516 | if (bd->VertexBufferSize < vtx_buffer_size) 517 | { 518 | bd->VertexBufferSize = vtx_buffer_size; 519 | GL_CALL(glBufferData(GL_ARRAY_BUFFER, bd->VertexBufferSize, nullptr, GL_STREAM_DRAW)); 520 | } 521 | if (bd->IndexBufferSize < idx_buffer_size) 522 | { 523 | bd->IndexBufferSize = idx_buffer_size; 524 | GL_CALL(glBufferData(GL_ELEMENT_ARRAY_BUFFER, bd->IndexBufferSize, nullptr, GL_STREAM_DRAW)); 525 | } 526 | GL_CALL(glBufferSubData(GL_ARRAY_BUFFER, 0, vtx_buffer_size, (const GLvoid*)cmd_list->VtxBuffer.Data)); 527 | GL_CALL(glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, idx_buffer_size, (const GLvoid*)cmd_list->IdxBuffer.Data)); 528 | } 529 | else 530 | { 531 | GL_CALL(glBufferData(GL_ARRAY_BUFFER, vtx_buffer_size, (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW)); 532 | GL_CALL(glBufferData(GL_ELEMENT_ARRAY_BUFFER, idx_buffer_size, (const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW)); 533 | } 534 | 535 | for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++) 536 | { 537 | const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i]; 538 | if (pcmd->UserCallback != nullptr) 539 | { 540 | // User callback, registered via ImDrawList::AddCallback() 541 | // (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.) 542 | if (pcmd->UserCallback == ImDrawCallback_ResetRenderState) 543 | ImGui_ImplOpenGL3_SetupRenderState(draw_data, fb_width, fb_height, vertex_array_object); 544 | else 545 | pcmd->UserCallback(cmd_list, pcmd); 546 | } 547 | else 548 | { 549 | // Project scissor/clipping rectangles into framebuffer space 550 | ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x, (pcmd->ClipRect.y - clip_off.y) * clip_scale.y); 551 | ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x, (pcmd->ClipRect.w - clip_off.y) * clip_scale.y); 552 | if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y) 553 | continue; 554 | 555 | // Apply scissor/clipping rectangle (Y is inverted in OpenGL) 556 | GL_CALL(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))); 557 | 558 | // Bind texture, Draw 559 | GL_CALL(glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->GetTexID())); 560 | #ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET 561 | if (bd->GlVersion >= 320) 562 | GL_CALL(glDrawElementsBaseVertex(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx)), (GLint)pcmd->VtxOffset)); 563 | else 564 | #endif 565 | GL_CALL(glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx)))); 566 | } 567 | } 568 | } 569 | 570 | // Destroy the temporary VAO 571 | #ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY 572 | GL_CALL(glDeleteVertexArrays(1, &vertex_array_object)); 573 | #endif 574 | 575 | // Restore modified GL state 576 | glUseProgram(last_program); 577 | glBindTexture(GL_TEXTURE_2D, last_texture); 578 | #ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER 579 | if (bd->GlVersion >= 330) 580 | glBindSampler(0, last_sampler); 581 | #endif 582 | glActiveTexture(last_active_texture); 583 | #ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY 584 | glBindVertexArray(last_vertex_array_object); 585 | #endif 586 | glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer); 587 | #ifndef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY 588 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, last_element_array_buffer); 589 | last_vtx_attrib_state_pos.SetState(bd->AttribLocationVtxPos); 590 | last_vtx_attrib_state_uv.SetState(bd->AttribLocationVtxUV); 591 | last_vtx_attrib_state_color.SetState(bd->AttribLocationVtxColor); 592 | #endif 593 | glBlendEquationSeparate(last_blend_equation_rgb, last_blend_equation_alpha); 594 | glBlendFuncSeparate(last_blend_src_rgb, last_blend_dst_rgb, last_blend_src_alpha, last_blend_dst_alpha); 595 | if (last_enable_blend) glEnable(GL_BLEND); else glDisable(GL_BLEND); 596 | if (last_enable_cull_face) glEnable(GL_CULL_FACE); else glDisable(GL_CULL_FACE); 597 | if (last_enable_depth_test) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST); 598 | if (last_enable_stencil_test) glEnable(GL_STENCIL_TEST); else glDisable(GL_STENCIL_TEST); 599 | if (last_enable_scissor_test) glEnable(GL_SCISSOR_TEST); else glDisable(GL_SCISSOR_TEST); 600 | #ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_PRIMITIVE_RESTART 601 | if (bd->GlVersion >= 310) { if (last_enable_primitive_restart) glEnable(GL_PRIMITIVE_RESTART); else glDisable(GL_PRIMITIVE_RESTART); } 602 | #endif 603 | 604 | #ifdef IMGUI_IMPL_HAS_POLYGON_MODE 605 | glPolygonMode(GL_FRONT_AND_BACK, (GLenum)last_polygon_mode[0]); 606 | #endif 607 | glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]); 608 | glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]); 609 | (void)bd; // Not all compilation paths use this 610 | } 611 | 612 | bool ImGui_ImplOpenGL3_CreateFontsTexture() 613 | { 614 | ImGuiIO& io = ImGui::GetIO(); 615 | ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData(); 616 | 617 | // Build texture atlas 618 | unsigned char* pixels; 619 | int width, height; 620 | io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bit (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory. 621 | 622 | // Upload texture to graphics system 623 | // (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling) 624 | GLint last_texture; 625 | GL_CALL(glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture)); 626 | GL_CALL(glGenTextures(1, &bd->FontTexture)); 627 | GL_CALL(glBindTexture(GL_TEXTURE_2D, bd->FontTexture)); 628 | GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); 629 | GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); 630 | #ifdef GL_UNPACK_ROW_LENGTH // Not on WebGL/ES 631 | GL_CALL(glPixelStorei(GL_UNPACK_ROW_LENGTH, 0)); 632 | #endif 633 | GL_CALL(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels)); 634 | 635 | // Store our identifier 636 | io.Fonts->SetTexID((ImTextureID)(intptr_t)bd->FontTexture); 637 | 638 | // Restore state 639 | GL_CALL(glBindTexture(GL_TEXTURE_2D, last_texture)); 640 | 641 | return true; 642 | } 643 | 644 | void ImGui_ImplOpenGL3_DestroyFontsTexture() 645 | { 646 | ImGuiIO& io = ImGui::GetIO(); 647 | ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData(); 648 | if (bd->FontTexture) 649 | { 650 | glDeleteTextures(1, &bd->FontTexture); 651 | io.Fonts->SetTexID(0); 652 | bd->FontTexture = 0; 653 | } 654 | } 655 | 656 | // If you get an error please report on github. You may try different GL context version or GLSL version. See GL<>GLSL version table at the top of this file. 657 | static bool CheckShader(GLuint handle, const char* desc) 658 | { 659 | ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData(); 660 | GLint status = 0, log_length = 0; 661 | glGetShaderiv(handle, GL_COMPILE_STATUS, &status); 662 | glGetShaderiv(handle, GL_INFO_LOG_LENGTH, &log_length); 663 | if ((GLboolean)status == GL_FALSE) 664 | fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile %s! With GLSL: %s\n", desc, bd->GlslVersionString); 665 | if (log_length > 1) 666 | { 667 | ImVector buf; 668 | buf.resize((int)(log_length + 1)); 669 | glGetShaderInfoLog(handle, log_length, nullptr, (GLchar*)buf.begin()); 670 | fprintf(stderr, "%s\n", buf.begin()); 671 | } 672 | return (GLboolean)status == GL_TRUE; 673 | } 674 | 675 | // If you get an error please report on GitHub. You may try different GL context version or GLSL version. 676 | static bool CheckProgram(GLuint handle, const char* desc) 677 | { 678 | ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData(); 679 | GLint status = 0, log_length = 0; 680 | glGetProgramiv(handle, GL_LINK_STATUS, &status); 681 | glGetProgramiv(handle, GL_INFO_LOG_LENGTH, &log_length); 682 | if ((GLboolean)status == GL_FALSE) 683 | fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to link %s! With GLSL %s\n", desc, bd->GlslVersionString); 684 | if (log_length > 1) 685 | { 686 | ImVector buf; 687 | buf.resize((int)(log_length + 1)); 688 | glGetProgramInfoLog(handle, log_length, nullptr, (GLchar*)buf.begin()); 689 | fprintf(stderr, "%s\n", buf.begin()); 690 | } 691 | return (GLboolean)status == GL_TRUE; 692 | } 693 | 694 | bool ImGui_ImplOpenGL3_CreateDeviceObjects() 695 | { 696 | ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData(); 697 | 698 | // Backup GL state 699 | GLint last_texture, last_array_buffer; 700 | glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture); 701 | glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer); 702 | #ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY 703 | GLint last_vertex_array; 704 | glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array); 705 | #endif 706 | 707 | // Parse GLSL version string 708 | int glsl_version = 130; 709 | sscanf(bd->GlslVersionString, "#version %d", &glsl_version); 710 | 711 | const GLchar* vertex_shader_glsl_120 = 712 | "uniform mat4 ProjMtx;\n" 713 | "attribute vec2 Position;\n" 714 | "attribute vec2 UV;\n" 715 | "attribute vec4 Color;\n" 716 | "varying vec2 Frag_UV;\n" 717 | "varying vec4 Frag_Color;\n" 718 | "void main()\n" 719 | "{\n" 720 | " Frag_UV = UV;\n" 721 | " Frag_Color = Color;\n" 722 | " gl_Position = ProjMtx * vec4(Position.xy,0,1);\n" 723 | "}\n"; 724 | 725 | const GLchar* vertex_shader_glsl_130 = 726 | "uniform mat4 ProjMtx;\n" 727 | "in vec2 Position;\n" 728 | "in vec2 UV;\n" 729 | "in vec4 Color;\n" 730 | "out vec2 Frag_UV;\n" 731 | "out vec4 Frag_Color;\n" 732 | "void main()\n" 733 | "{\n" 734 | " Frag_UV = UV;\n" 735 | " Frag_Color = Color;\n" 736 | " gl_Position = ProjMtx * vec4(Position.xy,0,1);\n" 737 | "}\n"; 738 | 739 | const GLchar* vertex_shader_glsl_300_es = 740 | "precision highp float;\n" 741 | "layout (location = 0) in vec2 Position;\n" 742 | "layout (location = 1) in vec2 UV;\n" 743 | "layout (location = 2) in vec4 Color;\n" 744 | "uniform mat4 ProjMtx;\n" 745 | "out vec2 Frag_UV;\n" 746 | "out vec4 Frag_Color;\n" 747 | "void main()\n" 748 | "{\n" 749 | " Frag_UV = UV;\n" 750 | " Frag_Color = Color;\n" 751 | " gl_Position = ProjMtx * vec4(Position.xy,0,1);\n" 752 | "}\n"; 753 | 754 | const GLchar* vertex_shader_glsl_410_core = 755 | "layout (location = 0) in vec2 Position;\n" 756 | "layout (location = 1) in vec2 UV;\n" 757 | "layout (location = 2) in vec4 Color;\n" 758 | "uniform mat4 ProjMtx;\n" 759 | "out vec2 Frag_UV;\n" 760 | "out vec4 Frag_Color;\n" 761 | "void main()\n" 762 | "{\n" 763 | " Frag_UV = UV;\n" 764 | " Frag_Color = Color;\n" 765 | " gl_Position = ProjMtx * vec4(Position.xy,0,1);\n" 766 | "}\n"; 767 | 768 | const GLchar* fragment_shader_glsl_120 = 769 | "#ifdef GL_ES\n" 770 | " precision mediump float;\n" 771 | "#endif\n" 772 | "uniform sampler2D Texture;\n" 773 | "varying vec2 Frag_UV;\n" 774 | "varying vec4 Frag_Color;\n" 775 | "void main()\n" 776 | "{\n" 777 | " gl_FragColor = Frag_Color * texture2D(Texture, Frag_UV.st);\n" 778 | "}\n"; 779 | 780 | const GLchar* fragment_shader_glsl_130 = 781 | "uniform sampler2D Texture;\n" 782 | "in vec2 Frag_UV;\n" 783 | "in vec4 Frag_Color;\n" 784 | "out vec4 Out_Color;\n" 785 | "void main()\n" 786 | "{\n" 787 | " Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n" 788 | "}\n"; 789 | 790 | const GLchar* fragment_shader_glsl_300_es = 791 | "precision mediump float;\n" 792 | "uniform sampler2D Texture;\n" 793 | "in vec2 Frag_UV;\n" 794 | "in vec4 Frag_Color;\n" 795 | "layout (location = 0) out vec4 Out_Color;\n" 796 | "void main()\n" 797 | "{\n" 798 | " Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n" 799 | "}\n"; 800 | 801 | const GLchar* fragment_shader_glsl_410_core = 802 | "in vec2 Frag_UV;\n" 803 | "in vec4 Frag_Color;\n" 804 | "uniform sampler2D Texture;\n" 805 | "layout (location = 0) out vec4 Out_Color;\n" 806 | "void main()\n" 807 | "{\n" 808 | " Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n" 809 | "}\n"; 810 | 811 | // Select shaders matching our GLSL versions 812 | const GLchar* vertex_shader = nullptr; 813 | const GLchar* fragment_shader = nullptr; 814 | if (glsl_version < 130) 815 | { 816 | vertex_shader = vertex_shader_glsl_120; 817 | fragment_shader = fragment_shader_glsl_120; 818 | } 819 | else if (glsl_version >= 410) 820 | { 821 | vertex_shader = vertex_shader_glsl_410_core; 822 | fragment_shader = fragment_shader_glsl_410_core; 823 | } 824 | else if (glsl_version == 300) 825 | { 826 | vertex_shader = vertex_shader_glsl_300_es; 827 | fragment_shader = fragment_shader_glsl_300_es; 828 | } 829 | else 830 | { 831 | vertex_shader = vertex_shader_glsl_130; 832 | fragment_shader = fragment_shader_glsl_130; 833 | } 834 | 835 | // Create shaders 836 | const GLchar* vertex_shader_with_version[2] = { bd->GlslVersionString, vertex_shader }; 837 | GLuint vert_handle = glCreateShader(GL_VERTEX_SHADER); 838 | glShaderSource(vert_handle, 2, vertex_shader_with_version, nullptr); 839 | glCompileShader(vert_handle); 840 | CheckShader(vert_handle, "vertex shader"); 841 | 842 | const GLchar* fragment_shader_with_version[2] = { bd->GlslVersionString, fragment_shader }; 843 | GLuint frag_handle = glCreateShader(GL_FRAGMENT_SHADER); 844 | glShaderSource(frag_handle, 2, fragment_shader_with_version, nullptr); 845 | glCompileShader(frag_handle); 846 | CheckShader(frag_handle, "fragment shader"); 847 | 848 | // Link 849 | bd->ShaderHandle = glCreateProgram(); 850 | glAttachShader(bd->ShaderHandle, vert_handle); 851 | glAttachShader(bd->ShaderHandle, frag_handle); 852 | glLinkProgram(bd->ShaderHandle); 853 | CheckProgram(bd->ShaderHandle, "shader program"); 854 | 855 | glDetachShader(bd->ShaderHandle, vert_handle); 856 | glDetachShader(bd->ShaderHandle, frag_handle); 857 | glDeleteShader(vert_handle); 858 | glDeleteShader(frag_handle); 859 | 860 | bd->AttribLocationTex = glGetUniformLocation(bd->ShaderHandle, "Texture"); 861 | bd->AttribLocationProjMtx = glGetUniformLocation(bd->ShaderHandle, "ProjMtx"); 862 | bd->AttribLocationVtxPos = (GLuint)glGetAttribLocation(bd->ShaderHandle, "Position"); 863 | bd->AttribLocationVtxUV = (GLuint)glGetAttribLocation(bd->ShaderHandle, "UV"); 864 | bd->AttribLocationVtxColor = (GLuint)glGetAttribLocation(bd->ShaderHandle, "Color"); 865 | 866 | // Create buffers 867 | glGenBuffers(1, &bd->VboHandle); 868 | glGenBuffers(1, &bd->ElementsHandle); 869 | 870 | ImGui_ImplOpenGL3_CreateFontsTexture(); 871 | 872 | // Restore modified GL state 873 | glBindTexture(GL_TEXTURE_2D, last_texture); 874 | glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer); 875 | #ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY 876 | glBindVertexArray(last_vertex_array); 877 | #endif 878 | 879 | return true; 880 | } 881 | 882 | void ImGui_ImplOpenGL3_DestroyDeviceObjects() 883 | { 884 | ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData(); 885 | if (bd->VboHandle) { glDeleteBuffers(1, &bd->VboHandle); bd->VboHandle = 0; } 886 | if (bd->ElementsHandle) { glDeleteBuffers(1, &bd->ElementsHandle); bd->ElementsHandle = 0; } 887 | if (bd->ShaderHandle) { glDeleteProgram(bd->ShaderHandle); bd->ShaderHandle = 0; } 888 | ImGui_ImplOpenGL3_DestroyFontsTexture(); 889 | } 890 | 891 | //-------------------------------------------------------------------------------------------------------- 892 | // MULTI-VIEWPORT / PLATFORM INTERFACE SUPPORT 893 | // This is an _advanced_ and _optional_ feature, allowing the backend to create and handle multiple viewports simultaneously. 894 | // If you are new to dear imgui or creating a new binding for dear imgui, it is recommended that you completely ignore this section first.. 895 | //-------------------------------------------------------------------------------------------------------- 896 | 897 | static void ImGui_ImplOpenGL3_RenderWindow(ImGuiViewport* viewport, void*) 898 | { 899 | if (!(viewport->Flags & ImGuiViewportFlags_NoRendererClear)) 900 | { 901 | ImVec4 clear_color = ImVec4(0.0f, 0.0f, 0.0f, 1.0f); 902 | glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w); 903 | glClear(GL_COLOR_BUFFER_BIT); 904 | } 905 | ImGui_ImplOpenGL3_RenderDrawData(viewport->DrawData); 906 | } 907 | 908 | static void ImGui_ImplOpenGL3_InitPlatformInterface() 909 | { 910 | ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO(); 911 | platform_io.Renderer_RenderWindow = ImGui_ImplOpenGL3_RenderWindow; 912 | } 913 | 914 | static void ImGui_ImplOpenGL3_ShutdownPlatformInterface() 915 | { 916 | ImGui::DestroyPlatformWindows(); 917 | } 918 | 919 | #if defined(__clang__) 920 | #pragma clang diagnostic pop 921 | #endif 922 | -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/Imgui/imgui_impl_opengl3.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for modern OpenGL with shaders / programmatic pipeline 2 | // - Desktop GL: 2.x 3.x 4.x 3 | // - Embedded GL: ES 2.0 (WebGL 1.0), ES 3.0 (WebGL 2.0) 4 | // This needs to be used along with a Platform Backend (e.g. GLFW, SDL, Win32, custom..) 5 | 6 | // Implemented features: 7 | // [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID! 8 | // [X] Renderer: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 9 | // [x] Renderer: Large meshes support (64k+ vertices) with 16-bit indices (Desktop OpenGL only). 10 | 11 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 12 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 13 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 14 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 15 | 16 | // About GLSL version: 17 | // The 'glsl_version' initialization parameter should be nullptr (default) or a "#version XXX" string. 18 | // On computer platform the GLSL version default to "#version 130". On OpenGL ES 3 platform it defaults to "#version 300 es" 19 | // Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp. 20 | 21 | #pragma once 22 | #include "imgui.h" // IMGUI_IMPL_API 23 | 24 | // Backend API 25 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = nullptr); 26 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown(); 27 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame(); 28 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data); 29 | 30 | // (Optional) Called by Init/NewFrame/Shutdown 31 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateFontsTexture(); 32 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyFontsTexture(); 33 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects(); 34 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects(); 35 | 36 | // Specific OpenGL ES versions 37 | //#define IMGUI_IMPL_OPENGL_ES2 // Auto-detected on Emscripten 38 | //#define IMGUI_IMPL_OPENGL_ES3 // Auto-detected on iOS/Android 39 | 40 | // You can explicitly select GLES2 or GLES3 API by using one of the '#define IMGUI_IMPL_OPENGL_LOADER_XXX' in imconfig.h or compiler command-line. 41 | #if !defined(IMGUI_IMPL_OPENGL_ES2) \ 42 | && !defined(IMGUI_IMPL_OPENGL_ES3) 43 | 44 | // Try to detect GLES on matching platforms 45 | #if defined(__APPLE__) 46 | #include 47 | #endif 48 | #if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) || (defined(__ANDROID__)) 49 | #define IMGUI_IMPL_OPENGL_ES3 // iOS, Android -> GL ES 3, "#version 300 es" 50 | #elif defined(__EMSCRIPTEN__) || defined(__amigaos4__) 51 | #define IMGUI_IMPL_OPENGL_ES2 // Emscripten -> GL ES 2, "#version 100" 52 | #else 53 | // Otherwise imgui_impl_opengl3_loader.h will be used. 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/Imgui/imgui_impl_opengl3_loader.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // About imgui_impl_opengl3_loader.h: 3 | // 4 | // We embed our own OpenGL loader to not require user to provide their own or to have to use ours, 5 | // which proved to be endless problems for users. 6 | // Our loader is custom-generated, based on gl3w but automatically filtered to only include 7 | // enums/functions that we use in our imgui_impl_opengl3.cpp source file in order to be small. 8 | // 9 | // YOU SHOULD NOT NEED TO INCLUDE/USE THIS DIRECTLY. THIS IS USED BY imgui_impl_opengl3.cpp ONLY. 10 | // THE REST OF YOUR APP SHOULD USE A DIFFERENT GL LOADER: ANY GL LOADER OF YOUR CHOICE. 11 | // 12 | // IF YOU GET BUILD ERRORS IN THIS FILE (commonly macro redefinitions or function redefinitions): 13 | // IT LIKELY MEANS THAT YOU ARE BUILDING 'imgui_impl_opengl3.cpp' OR INCUDING 'imgui_impl_opengl3_loader.h' 14 | // IN THE SAME COMPILATION UNIT AS ONE OF YOUR FILE WHICH IS USING A THIRD-PARTY OPENGL LOADER. 15 | // (e.g. COULD HAPPEN IF YOU ARE DOING A UNITY/JUMBO BUILD, OR INCLUDING .CPP FILES FROM OTHERS) 16 | // YOU SHOULD NOT BUILD BOTH IN THE SAME COMPILATION UNIT. 17 | // BUT IF YOU REALLY WANT TO, you can '#define IMGUI_IMPL_OPENGL_LOADER_CUSTOM' and imgui_impl_opengl3.cpp 18 | // WILL NOT BE USING OUR LOADER, AND INSTEAD EXPECT ANOTHER/YOUR LOADER TO BE AVAILABLE IN THE COMPILATION UNIT. 19 | // 20 | // Regenerate with: 21 | // python gl3w_gen.py --output ../imgui/backends/imgui_impl_opengl3_loader.h --ref ../imgui/backends/imgui_impl_opengl3.cpp ./extra_symbols.txt 22 | // 23 | // More info: 24 | // https://github.com/dearimgui/gl3w_stripped 25 | // https://github.com/ocornut/imgui/issues/4445 26 | //----------------------------------------------------------------------------- 27 | 28 | /* 29 | * This file was generated with gl3w_gen.py, part of imgl3w 30 | * (hosted at https://github.com/dearimgui/gl3w_stripped) 31 | * 32 | * This is free and unencumbered software released into the public domain. 33 | * 34 | * Anyone is free to copy, modify, publish, use, compile, sell, or 35 | * distribute this software, either in source code form or as a compiled 36 | * binary, for any purpose, commercial or non-commercial, and by any 37 | * means. 38 | * 39 | * In jurisdictions that recognize copyright laws, the author or authors 40 | * of this software dedicate any and all copyright interest in the 41 | * software to the public domain. We make this dedication for the benefit 42 | * of the public at large and to the detriment of our heirs and 43 | * successors. We intend this dedication to be an overt act of 44 | * relinquishment in perpetuity of all present and future rights to this 45 | * software under copyright law. 46 | * 47 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 48 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 49 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 50 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 51 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 52 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 53 | * OTHER DEALINGS IN THE SOFTWARE. 54 | */ 55 | 56 | #ifndef __gl3w_h_ 57 | #define __gl3w_h_ 58 | 59 | // Adapted from KHR/khrplatform.h to avoid including entire file. 60 | #ifndef __khrplatform_h_ 61 | typedef float khronos_float_t; 62 | typedef signed char khronos_int8_t; 63 | typedef unsigned char khronos_uint8_t; 64 | typedef signed short int khronos_int16_t; 65 | typedef unsigned short int khronos_uint16_t; 66 | #ifdef _WIN64 67 | typedef signed long long int khronos_intptr_t; 68 | typedef signed long long int khronos_ssize_t; 69 | #else 70 | typedef signed long int khronos_intptr_t; 71 | typedef signed long int khronos_ssize_t; 72 | #endif 73 | 74 | #if defined(_MSC_VER) && !defined(__clang__) 75 | typedef signed __int64 khronos_int64_t; 76 | typedef unsigned __int64 khronos_uint64_t; 77 | #elif (defined(__clang__) || defined(__GNUC__)) && (__cplusplus < 201100) 78 | #include 79 | typedef int64_t khronos_int64_t; 80 | typedef uint64_t khronos_uint64_t; 81 | #else 82 | typedef signed long long khronos_int64_t; 83 | typedef unsigned long long khronos_uint64_t; 84 | #endif 85 | #endif // __khrplatform_h_ 86 | 87 | #ifndef __gl_glcorearb_h_ 88 | #define __gl_glcorearb_h_ 1 89 | #ifdef __cplusplus 90 | extern "C" { 91 | #endif 92 | /* 93 | ** Copyright 2013-2020 The Khronos Group Inc. 94 | ** SPDX-License-Identifier: MIT 95 | ** 96 | ** This header is generated from the Khronos OpenGL / OpenGL ES XML 97 | ** API Registry. The current version of the Registry, generator scripts 98 | ** used to make the header, and the header can be found at 99 | ** https://github.com/KhronosGroup/OpenGL-Registry 100 | */ 101 | #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) 102 | #ifndef WIN32_LEAN_AND_MEAN 103 | #define WIN32_LEAN_AND_MEAN 1 104 | #endif 105 | #include 106 | #endif 107 | #ifndef APIENTRY 108 | #define APIENTRY 109 | #endif 110 | #ifndef APIENTRYP 111 | #define APIENTRYP APIENTRY * 112 | #endif 113 | #ifndef GLAPI 114 | #define GLAPI extern 115 | #endif 116 | /* glcorearb.h is for use with OpenGL core profile implementations. 117 | ** It should should be placed in the same directory as gl.h and 118 | ** included as . 119 | ** 120 | ** glcorearb.h includes only APIs in the latest OpenGL core profile 121 | ** implementation together with APIs in newer ARB extensions which 122 | ** can be supported by the core profile. It does not, and never will 123 | ** include functionality removed from the core profile, such as 124 | ** fixed-function vertex and fragment processing. 125 | ** 126 | ** Do not #include both and either of or 127 | ** in the same source file. 128 | */ 129 | /* Generated C header for: 130 | * API: gl 131 | * Profile: core 132 | * Versions considered: .* 133 | * Versions emitted: .* 134 | * Default extensions included: glcore 135 | * Additional extensions included: _nomatch_^ 136 | * Extensions removed: _nomatch_^ 137 | */ 138 | #ifndef GL_VERSION_1_0 139 | typedef void GLvoid; 140 | typedef unsigned int GLenum; 141 | 142 | typedef khronos_float_t GLfloat; 143 | typedef int GLint; 144 | typedef int GLsizei; 145 | typedef unsigned int GLbitfield; 146 | typedef double GLdouble; 147 | typedef unsigned int GLuint; 148 | typedef unsigned char GLboolean; 149 | typedef khronos_uint8_t GLubyte; 150 | #define GL_COLOR_BUFFER_BIT 0x00004000 151 | #define GL_FALSE 0 152 | #define GL_TRUE 1 153 | #define GL_TRIANGLES 0x0004 154 | #define GL_ONE 1 155 | #define GL_SRC_ALPHA 0x0302 156 | #define GL_ONE_MINUS_SRC_ALPHA 0x0303 157 | #define GL_FRONT_AND_BACK 0x0408 158 | #define GL_POLYGON_MODE 0x0B40 159 | #define GL_CULL_FACE 0x0B44 160 | #define GL_DEPTH_TEST 0x0B71 161 | #define GL_STENCIL_TEST 0x0B90 162 | #define GL_VIEWPORT 0x0BA2 163 | #define GL_BLEND 0x0BE2 164 | #define GL_SCISSOR_BOX 0x0C10 165 | #define GL_SCISSOR_TEST 0x0C11 166 | #define GL_UNPACK_ROW_LENGTH 0x0CF2 167 | #define GL_PACK_ALIGNMENT 0x0D05 168 | #define GL_TEXTURE_2D 0x0DE1 169 | #define GL_UNSIGNED_BYTE 0x1401 170 | #define GL_UNSIGNED_SHORT 0x1403 171 | #define GL_UNSIGNED_INT 0x1405 172 | #define GL_FLOAT 0x1406 173 | #define GL_RGBA 0x1908 174 | #define GL_FILL 0x1B02 175 | #define GL_VENDOR 0x1F00 176 | #define GL_RENDERER 0x1F01 177 | #define GL_VERSION 0x1F02 178 | #define GL_EXTENSIONS 0x1F03 179 | #define GL_LINEAR 0x2601 180 | #define GL_TEXTURE_MAG_FILTER 0x2800 181 | #define GL_TEXTURE_MIN_FILTER 0x2801 182 | typedef void (APIENTRYP PFNGLPOLYGONMODEPROC) (GLenum face, GLenum mode); 183 | typedef void (APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height); 184 | typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); 185 | typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); 186 | typedef void (APIENTRYP PFNGLCLEARPROC) (GLbitfield mask); 187 | typedef void (APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); 188 | typedef void (APIENTRYP PFNGLDISABLEPROC) (GLenum cap); 189 | typedef void (APIENTRYP PFNGLENABLEPROC) (GLenum cap); 190 | typedef void (APIENTRYP PFNGLFLUSHPROC) (void); 191 | typedef void (APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param); 192 | typedef void (APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); 193 | typedef GLenum (APIENTRYP PFNGLGETERRORPROC) (void); 194 | typedef void (APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data); 195 | typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGPROC) (GLenum name); 196 | typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC) (GLenum cap); 197 | typedef void (APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height); 198 | #ifdef GL_GLEXT_PROTOTYPES 199 | GLAPI void APIENTRY glPolygonMode (GLenum face, GLenum mode); 200 | GLAPI void APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); 201 | GLAPI void APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); 202 | GLAPI void APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); 203 | GLAPI void APIENTRY glClear (GLbitfield mask); 204 | GLAPI void APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); 205 | GLAPI void APIENTRY glDisable (GLenum cap); 206 | GLAPI void APIENTRY glEnable (GLenum cap); 207 | GLAPI void APIENTRY glFlush (void); 208 | GLAPI void APIENTRY glPixelStorei (GLenum pname, GLint param); 209 | GLAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); 210 | GLAPI GLenum APIENTRY glGetError (void); 211 | GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *data); 212 | GLAPI const GLubyte *APIENTRY glGetString (GLenum name); 213 | GLAPI GLboolean APIENTRY glIsEnabled (GLenum cap); 214 | GLAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); 215 | #endif 216 | #endif /* GL_VERSION_1_0 */ 217 | #ifndef GL_VERSION_1_1 218 | typedef khronos_float_t GLclampf; 219 | typedef double GLclampd; 220 | #define GL_TEXTURE_BINDING_2D 0x8069 221 | typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices); 222 | typedef void (APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture); 223 | typedef void (APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures); 224 | typedef void (APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures); 225 | #ifdef GL_GLEXT_PROTOTYPES 226 | GLAPI void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices); 227 | GLAPI void APIENTRY glBindTexture (GLenum target, GLuint texture); 228 | GLAPI void APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); 229 | GLAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures); 230 | #endif 231 | #endif /* GL_VERSION_1_1 */ 232 | #ifndef GL_VERSION_1_3 233 | #define GL_TEXTURE0 0x84C0 234 | #define GL_ACTIVE_TEXTURE 0x84E0 235 | typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); 236 | #ifdef GL_GLEXT_PROTOTYPES 237 | GLAPI void APIENTRY glActiveTexture (GLenum texture); 238 | #endif 239 | #endif /* GL_VERSION_1_3 */ 240 | #ifndef GL_VERSION_1_4 241 | #define GL_BLEND_DST_RGB 0x80C8 242 | #define GL_BLEND_SRC_RGB 0x80C9 243 | #define GL_BLEND_DST_ALPHA 0x80CA 244 | #define GL_BLEND_SRC_ALPHA 0x80CB 245 | #define GL_FUNC_ADD 0x8006 246 | typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); 247 | typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); 248 | #ifdef GL_GLEXT_PROTOTYPES 249 | GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); 250 | GLAPI void APIENTRY glBlendEquation (GLenum mode); 251 | #endif 252 | #endif /* GL_VERSION_1_4 */ 253 | #ifndef GL_VERSION_1_5 254 | typedef khronos_ssize_t GLsizeiptr; 255 | typedef khronos_intptr_t GLintptr; 256 | #define GL_ARRAY_BUFFER 0x8892 257 | #define GL_ELEMENT_ARRAY_BUFFER 0x8893 258 | #define GL_ARRAY_BUFFER_BINDING 0x8894 259 | #define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 260 | #define GL_STREAM_DRAW 0x88E0 261 | typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); 262 | typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); 263 | typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); 264 | typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); 265 | typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); 266 | #ifdef GL_GLEXT_PROTOTYPES 267 | GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer); 268 | GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); 269 | GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); 270 | GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage); 271 | GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); 272 | #endif 273 | #endif /* GL_VERSION_1_5 */ 274 | #ifndef GL_VERSION_2_0 275 | typedef char GLchar; 276 | typedef khronos_int16_t GLshort; 277 | typedef khronos_int8_t GLbyte; 278 | typedef khronos_uint16_t GLushort; 279 | #define GL_BLEND_EQUATION_RGB 0x8009 280 | #define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 281 | #define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 282 | #define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 283 | #define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 284 | #define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 285 | #define GL_BLEND_EQUATION_ALPHA 0x883D 286 | #define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A 287 | #define GL_FRAGMENT_SHADER 0x8B30 288 | #define GL_VERTEX_SHADER 0x8B31 289 | #define GL_COMPILE_STATUS 0x8B81 290 | #define GL_LINK_STATUS 0x8B82 291 | #define GL_INFO_LOG_LENGTH 0x8B84 292 | #define GL_CURRENT_PROGRAM 0x8B8D 293 | #define GL_UPPER_LEFT 0x8CA2 294 | typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); 295 | typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); 296 | typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); 297 | typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); 298 | typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); 299 | typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); 300 | typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); 301 | typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); 302 | typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); 303 | typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); 304 | typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); 305 | typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); 306 | typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); 307 | typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); 308 | typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); 309 | typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); 310 | typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); 311 | typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer); 312 | typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); 313 | typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); 314 | typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); 315 | typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); 316 | typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); 317 | typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); 318 | #ifdef GL_GLEXT_PROTOTYPES 319 | GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); 320 | GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader); 321 | GLAPI void APIENTRY glCompileShader (GLuint shader); 322 | GLAPI GLuint APIENTRY glCreateProgram (void); 323 | GLAPI GLuint APIENTRY glCreateShader (GLenum type); 324 | GLAPI void APIENTRY glDeleteProgram (GLuint program); 325 | GLAPI void APIENTRY glDeleteShader (GLuint shader); 326 | GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader); 327 | GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index); 328 | GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index); 329 | GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); 330 | GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); 331 | GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); 332 | GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); 333 | GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); 334 | GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); 335 | GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); 336 | GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer); 337 | GLAPI void APIENTRY glLinkProgram (GLuint program); 338 | GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); 339 | GLAPI void APIENTRY glUseProgram (GLuint program); 340 | GLAPI void APIENTRY glUniform1i (GLint location, GLint v0); 341 | GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); 342 | GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); 343 | #endif 344 | #endif /* GL_VERSION_2_0 */ 345 | #ifndef GL_VERSION_3_0 346 | typedef khronos_uint16_t GLhalf; 347 | #define GL_MAJOR_VERSION 0x821B 348 | #define GL_MINOR_VERSION 0x821C 349 | #define GL_NUM_EXTENSIONS 0x821D 350 | #define GL_FRAMEBUFFER_SRGB 0x8DB9 351 | #define GL_VERTEX_ARRAY_BINDING 0x85B5 352 | typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data); 353 | typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data); 354 | typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index); 355 | typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array); 356 | typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays); 357 | typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); 358 | #ifdef GL_GLEXT_PROTOTYPES 359 | GLAPI const GLubyte *APIENTRY glGetStringi (GLenum name, GLuint index); 360 | GLAPI void APIENTRY glBindVertexArray (GLuint array); 361 | GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays); 362 | GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays); 363 | #endif 364 | #endif /* GL_VERSION_3_0 */ 365 | #ifndef GL_VERSION_3_1 366 | #define GL_VERSION_3_1 1 367 | #define GL_PRIMITIVE_RESTART 0x8F9D 368 | #endif /* GL_VERSION_3_1 */ 369 | #ifndef GL_VERSION_3_2 370 | #define GL_VERSION_3_2 1 371 | typedef struct __GLsync *GLsync; 372 | typedef khronos_uint64_t GLuint64; 373 | typedef khronos_int64_t GLint64; 374 | typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); 375 | typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); 376 | #ifdef GL_GLEXT_PROTOTYPES 377 | GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); 378 | #endif 379 | #endif /* GL_VERSION_3_2 */ 380 | #ifndef GL_VERSION_3_3 381 | #define GL_VERSION_3_3 1 382 | #define GL_SAMPLER_BINDING 0x8919 383 | typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler); 384 | #ifdef GL_GLEXT_PROTOTYPES 385 | GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler); 386 | #endif 387 | #endif /* GL_VERSION_3_3 */ 388 | #ifndef GL_VERSION_4_1 389 | typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data); 390 | typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data); 391 | #endif /* GL_VERSION_4_1 */ 392 | #ifndef GL_VERSION_4_3 393 | typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); 394 | #endif /* GL_VERSION_4_3 */ 395 | #ifndef GL_VERSION_4_5 396 | #define GL_CLIP_ORIGIN 0x935C 397 | typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint *param); 398 | typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI64_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint64 *param); 399 | #endif /* GL_VERSION_4_5 */ 400 | #ifndef GL_ARB_bindless_texture 401 | typedef khronos_uint64_t GLuint64EXT; 402 | #endif /* GL_ARB_bindless_texture */ 403 | #ifndef GL_ARB_cl_event 404 | struct _cl_context; 405 | struct _cl_event; 406 | #endif /* GL_ARB_cl_event */ 407 | #ifndef GL_ARB_clip_control 408 | #define GL_ARB_clip_control 1 409 | #endif /* GL_ARB_clip_control */ 410 | #ifndef GL_ARB_debug_output 411 | typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); 412 | #endif /* GL_ARB_debug_output */ 413 | #ifndef GL_EXT_EGL_image_storage 414 | typedef void *GLeglImageOES; 415 | #endif /* GL_EXT_EGL_image_storage */ 416 | #ifndef GL_EXT_direct_state_access 417 | typedef void (APIENTRYP PFNGLGETFLOATI_VEXTPROC) (GLenum pname, GLuint index, GLfloat *params); 418 | typedef void (APIENTRYP PFNGLGETDOUBLEI_VEXTPROC) (GLenum pname, GLuint index, GLdouble *params); 419 | typedef void (APIENTRYP PFNGLGETPOINTERI_VEXTPROC) (GLenum pname, GLuint index, void **params); 420 | typedef void (APIENTRYP PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param); 421 | typedef void (APIENTRYP PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, void **param); 422 | #endif /* GL_EXT_direct_state_access */ 423 | #ifndef GL_NV_draw_vulkan_image 424 | typedef void (APIENTRY *GLVULKANPROCNV)(void); 425 | #endif /* GL_NV_draw_vulkan_image */ 426 | #ifndef GL_NV_gpu_shader5 427 | typedef khronos_int64_t GLint64EXT; 428 | #endif /* GL_NV_gpu_shader5 */ 429 | #ifndef GL_NV_vertex_buffer_unified_memory 430 | typedef void (APIENTRYP PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT *result); 431 | #endif /* GL_NV_vertex_buffer_unified_memory */ 432 | #ifdef __cplusplus 433 | } 434 | #endif 435 | #endif 436 | 437 | #ifndef GL3W_API 438 | #define GL3W_API 439 | #endif 440 | 441 | #ifndef __gl_h_ 442 | #define __gl_h_ 443 | #endif 444 | 445 | #ifdef __cplusplus 446 | extern "C" { 447 | #endif 448 | 449 | #define GL3W_OK 0 450 | #define GL3W_ERROR_INIT -1 451 | #define GL3W_ERROR_LIBRARY_OPEN -2 452 | #define GL3W_ERROR_OPENGL_VERSION -3 453 | 454 | typedef void (*GL3WglProc)(void); 455 | typedef GL3WglProc (*GL3WGetProcAddressProc)(const char *proc); 456 | 457 | /* gl3w api */ 458 | GL3W_API int imgl3wInit(void); 459 | GL3W_API int imgl3wInit2(GL3WGetProcAddressProc proc); 460 | GL3W_API int imgl3wIsSupported(int major, int minor); 461 | GL3W_API GL3WglProc imgl3wGetProcAddress(const char *proc); 462 | 463 | /* gl3w internal state */ 464 | union GL3WProcs { 465 | GL3WglProc ptr[58]; 466 | struct { 467 | PFNGLACTIVETEXTUREPROC ActiveTexture; 468 | PFNGLATTACHSHADERPROC AttachShader; 469 | PFNGLBINDBUFFERPROC BindBuffer; 470 | PFNGLBINDSAMPLERPROC BindSampler; 471 | PFNGLBINDTEXTUREPROC BindTexture; 472 | PFNGLBINDVERTEXARRAYPROC BindVertexArray; 473 | PFNGLBLENDEQUATIONPROC BlendEquation; 474 | PFNGLBLENDEQUATIONSEPARATEPROC BlendEquationSeparate; 475 | PFNGLBLENDFUNCSEPARATEPROC BlendFuncSeparate; 476 | PFNGLBUFFERDATAPROC BufferData; 477 | PFNGLBUFFERSUBDATAPROC BufferSubData; 478 | PFNGLCLEARPROC Clear; 479 | PFNGLCLEARCOLORPROC ClearColor; 480 | PFNGLCOMPILESHADERPROC CompileShader; 481 | PFNGLCREATEPROGRAMPROC CreateProgram; 482 | PFNGLCREATESHADERPROC CreateShader; 483 | PFNGLDELETEBUFFERSPROC DeleteBuffers; 484 | PFNGLDELETEPROGRAMPROC DeleteProgram; 485 | PFNGLDELETESHADERPROC DeleteShader; 486 | PFNGLDELETETEXTURESPROC DeleteTextures; 487 | PFNGLDELETEVERTEXARRAYSPROC DeleteVertexArrays; 488 | PFNGLDETACHSHADERPROC DetachShader; 489 | PFNGLDISABLEPROC Disable; 490 | PFNGLDISABLEVERTEXATTRIBARRAYPROC DisableVertexAttribArray; 491 | PFNGLDRAWELEMENTSPROC DrawElements; 492 | PFNGLDRAWELEMENTSBASEVERTEXPROC DrawElementsBaseVertex; 493 | PFNGLENABLEPROC Enable; 494 | PFNGLENABLEVERTEXATTRIBARRAYPROC EnableVertexAttribArray; 495 | PFNGLFLUSHPROC Flush; 496 | PFNGLGENBUFFERSPROC GenBuffers; 497 | PFNGLGENTEXTURESPROC GenTextures; 498 | PFNGLGENVERTEXARRAYSPROC GenVertexArrays; 499 | PFNGLGETATTRIBLOCATIONPROC GetAttribLocation; 500 | PFNGLGETERRORPROC GetError; 501 | PFNGLGETINTEGERVPROC GetIntegerv; 502 | PFNGLGETPROGRAMINFOLOGPROC GetProgramInfoLog; 503 | PFNGLGETPROGRAMIVPROC GetProgramiv; 504 | PFNGLGETSHADERINFOLOGPROC GetShaderInfoLog; 505 | PFNGLGETSHADERIVPROC GetShaderiv; 506 | PFNGLGETSTRINGPROC GetString; 507 | PFNGLGETSTRINGIPROC GetStringi; 508 | PFNGLGETUNIFORMLOCATIONPROC GetUniformLocation; 509 | PFNGLGETVERTEXATTRIBPOINTERVPROC GetVertexAttribPointerv; 510 | PFNGLGETVERTEXATTRIBIVPROC GetVertexAttribiv; 511 | PFNGLISENABLEDPROC IsEnabled; 512 | PFNGLLINKPROGRAMPROC LinkProgram; 513 | PFNGLPIXELSTOREIPROC PixelStorei; 514 | PFNGLPOLYGONMODEPROC PolygonMode; 515 | PFNGLREADPIXELSPROC ReadPixels; 516 | PFNGLSCISSORPROC Scissor; 517 | PFNGLSHADERSOURCEPROC ShaderSource; 518 | PFNGLTEXIMAGE2DPROC TexImage2D; 519 | PFNGLTEXPARAMETERIPROC TexParameteri; 520 | PFNGLUNIFORM1IPROC Uniform1i; 521 | PFNGLUNIFORMMATRIX4FVPROC UniformMatrix4fv; 522 | PFNGLUSEPROGRAMPROC UseProgram; 523 | PFNGLVERTEXATTRIBPOINTERPROC VertexAttribPointer; 524 | PFNGLVIEWPORTPROC Viewport; 525 | } gl; 526 | }; 527 | 528 | GL3W_API extern union GL3WProcs imgl3wProcs; 529 | 530 | /* OpenGL functions */ 531 | #define glActiveTexture imgl3wProcs.gl.ActiveTexture 532 | #define glAttachShader imgl3wProcs.gl.AttachShader 533 | #define glBindBuffer imgl3wProcs.gl.BindBuffer 534 | #define glBindSampler imgl3wProcs.gl.BindSampler 535 | #define glBindTexture imgl3wProcs.gl.BindTexture 536 | #define glBindVertexArray imgl3wProcs.gl.BindVertexArray 537 | #define glBlendEquation imgl3wProcs.gl.BlendEquation 538 | #define glBlendEquationSeparate imgl3wProcs.gl.BlendEquationSeparate 539 | #define glBlendFuncSeparate imgl3wProcs.gl.BlendFuncSeparate 540 | #define glBufferData imgl3wProcs.gl.BufferData 541 | #define glBufferSubData imgl3wProcs.gl.BufferSubData 542 | #define glClear imgl3wProcs.gl.Clear 543 | #define glClearColor imgl3wProcs.gl.ClearColor 544 | #define glCompileShader imgl3wProcs.gl.CompileShader 545 | #define glCreateProgram imgl3wProcs.gl.CreateProgram 546 | #define glCreateShader imgl3wProcs.gl.CreateShader 547 | #define glDeleteBuffers imgl3wProcs.gl.DeleteBuffers 548 | #define glDeleteProgram imgl3wProcs.gl.DeleteProgram 549 | #define glDeleteShader imgl3wProcs.gl.DeleteShader 550 | #define glDeleteTextures imgl3wProcs.gl.DeleteTextures 551 | #define glDeleteVertexArrays imgl3wProcs.gl.DeleteVertexArrays 552 | #define glDetachShader imgl3wProcs.gl.DetachShader 553 | #define glDisable imgl3wProcs.gl.Disable 554 | #define glDisableVertexAttribArray imgl3wProcs.gl.DisableVertexAttribArray 555 | #define glDrawElements imgl3wProcs.gl.DrawElements 556 | #define glDrawElementsBaseVertex imgl3wProcs.gl.DrawElementsBaseVertex 557 | #define glEnable imgl3wProcs.gl.Enable 558 | #define glEnableVertexAttribArray imgl3wProcs.gl.EnableVertexAttribArray 559 | #define glFlush imgl3wProcs.gl.Flush 560 | #define glGenBuffers imgl3wProcs.gl.GenBuffers 561 | #define glGenTextures imgl3wProcs.gl.GenTextures 562 | #define glGenVertexArrays imgl3wProcs.gl.GenVertexArrays 563 | #define glGetAttribLocation imgl3wProcs.gl.GetAttribLocation 564 | #define glGetError imgl3wProcs.gl.GetError 565 | #define glGetIntegerv imgl3wProcs.gl.GetIntegerv 566 | #define glGetProgramInfoLog imgl3wProcs.gl.GetProgramInfoLog 567 | #define glGetProgramiv imgl3wProcs.gl.GetProgramiv 568 | #define glGetShaderInfoLog imgl3wProcs.gl.GetShaderInfoLog 569 | #define glGetShaderiv imgl3wProcs.gl.GetShaderiv 570 | #define glGetString imgl3wProcs.gl.GetString 571 | #define glGetStringi imgl3wProcs.gl.GetStringi 572 | #define glGetUniformLocation imgl3wProcs.gl.GetUniformLocation 573 | #define glGetVertexAttribPointerv imgl3wProcs.gl.GetVertexAttribPointerv 574 | #define glGetVertexAttribiv imgl3wProcs.gl.GetVertexAttribiv 575 | #define glIsEnabled imgl3wProcs.gl.IsEnabled 576 | #define glLinkProgram imgl3wProcs.gl.LinkProgram 577 | #define glPixelStorei imgl3wProcs.gl.PixelStorei 578 | #define glPolygonMode imgl3wProcs.gl.PolygonMode 579 | #define glReadPixels imgl3wProcs.gl.ReadPixels 580 | #define glScissor imgl3wProcs.gl.Scissor 581 | #define glShaderSource imgl3wProcs.gl.ShaderSource 582 | #define glTexImage2D imgl3wProcs.gl.TexImage2D 583 | #define glTexParameteri imgl3wProcs.gl.TexParameteri 584 | #define glUniform1i imgl3wProcs.gl.Uniform1i 585 | #define glUniformMatrix4fv imgl3wProcs.gl.UniformMatrix4fv 586 | #define glUseProgram imgl3wProcs.gl.UseProgram 587 | #define glVertexAttribPointer imgl3wProcs.gl.VertexAttribPointer 588 | #define glViewport imgl3wProcs.gl.Viewport 589 | 590 | #ifdef __cplusplus 591 | } 592 | #endif 593 | 594 | #endif 595 | 596 | #ifdef IMGL3W_IMPL 597 | #ifdef __cplusplus 598 | extern "C" { 599 | #endif 600 | 601 | #include 602 | 603 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 604 | 605 | #if defined(_WIN32) 606 | #ifndef WIN32_LEAN_AND_MEAN 607 | #define WIN32_LEAN_AND_MEAN 1 608 | #endif 609 | #include 610 | 611 | static HMODULE libgl; 612 | typedef PROC(__stdcall* GL3WglGetProcAddr)(LPCSTR); 613 | static GL3WglGetProcAddr wgl_get_proc_address; 614 | 615 | static int open_libgl(void) 616 | { 617 | libgl = LoadLibraryA("opengl32.dll"); 618 | if (!libgl) 619 | return GL3W_ERROR_LIBRARY_OPEN; 620 | wgl_get_proc_address = (GL3WglGetProcAddr)GetProcAddress(libgl, "wglGetProcAddress"); 621 | return GL3W_OK; 622 | } 623 | 624 | static void close_libgl(void) { FreeLibrary(libgl); } 625 | static GL3WglProc get_proc(const char *proc) 626 | { 627 | GL3WglProc res; 628 | res = (GL3WglProc)wgl_get_proc_address(proc); 629 | if (!res) 630 | res = (GL3WglProc)GetProcAddress(libgl, proc); 631 | return res; 632 | } 633 | #elif defined(__APPLE__) 634 | #include 635 | 636 | static void *libgl; 637 | static int open_libgl(void) 638 | { 639 | libgl = dlopen("/System/Library/Frameworks/OpenGL.framework/OpenGL", RTLD_LAZY | RTLD_LOCAL); 640 | if (!libgl) 641 | return GL3W_ERROR_LIBRARY_OPEN; 642 | return GL3W_OK; 643 | } 644 | 645 | static void close_libgl(void) { dlclose(libgl); } 646 | 647 | static GL3WglProc get_proc(const char *proc) 648 | { 649 | GL3WglProc res; 650 | *(void **)(&res) = dlsym(libgl, proc); 651 | return res; 652 | } 653 | #else 654 | #include 655 | 656 | static void *libgl; 657 | static GL3WglProc (*glx_get_proc_address)(const GLubyte *); 658 | 659 | static int open_libgl(void) 660 | { 661 | libgl = dlopen("libGL.so.1", RTLD_LAZY | RTLD_LOCAL); 662 | if (!libgl) 663 | return GL3W_ERROR_LIBRARY_OPEN; 664 | *(void **)(&glx_get_proc_address) = dlsym(libgl, "glXGetProcAddressARB"); 665 | return GL3W_OK; 666 | } 667 | 668 | static void close_libgl(void) { dlclose(libgl); } 669 | 670 | static GL3WglProc get_proc(const char *proc) 671 | { 672 | GL3WglProc res; 673 | res = glx_get_proc_address((const GLubyte *)proc); 674 | if (!res) 675 | *(void **)(&res) = dlsym(libgl, proc); 676 | return res; 677 | } 678 | #endif 679 | 680 | static struct { int major, minor; } version; 681 | 682 | static int parse_version(void) 683 | { 684 | if (!glGetIntegerv) 685 | return GL3W_ERROR_INIT; 686 | glGetIntegerv(GL_MAJOR_VERSION, &version.major); 687 | glGetIntegerv(GL_MINOR_VERSION, &version.minor); 688 | if (version.major < 3) 689 | return GL3W_ERROR_OPENGL_VERSION; 690 | return GL3W_OK; 691 | } 692 | 693 | static void load_procs(GL3WGetProcAddressProc proc); 694 | 695 | int imgl3wInit(void) 696 | { 697 | int res = open_libgl(); 698 | if (res) 699 | return res; 700 | atexit(close_libgl); 701 | return imgl3wInit2(get_proc); 702 | } 703 | 704 | int imgl3wInit2(GL3WGetProcAddressProc proc) 705 | { 706 | load_procs(proc); 707 | return parse_version(); 708 | } 709 | 710 | int imgl3wIsSupported(int major, int minor) 711 | { 712 | if (major < 3) 713 | return 0; 714 | if (version.major == major) 715 | return version.minor >= minor; 716 | return version.major >= major; 717 | } 718 | 719 | GL3WglProc imgl3wGetProcAddress(const char *proc) { return get_proc(proc); } 720 | 721 | static const char *proc_names[] = { 722 | "glActiveTexture", 723 | "glAttachShader", 724 | "glBindBuffer", 725 | "glBindSampler", 726 | "glBindTexture", 727 | "glBindVertexArray", 728 | "glBlendEquation", 729 | "glBlendEquationSeparate", 730 | "glBlendFuncSeparate", 731 | "glBufferData", 732 | "glBufferSubData", 733 | "glClear", 734 | "glClearColor", 735 | "glCompileShader", 736 | "glCreateProgram", 737 | "glCreateShader", 738 | "glDeleteBuffers", 739 | "glDeleteProgram", 740 | "glDeleteShader", 741 | "glDeleteTextures", 742 | "glDeleteVertexArrays", 743 | "glDetachShader", 744 | "glDisable", 745 | "glDisableVertexAttribArray", 746 | "glDrawElements", 747 | "glDrawElementsBaseVertex", 748 | "glEnable", 749 | "glEnableVertexAttribArray", 750 | "glFlush", 751 | "glGenBuffers", 752 | "glGenTextures", 753 | "glGenVertexArrays", 754 | "glGetAttribLocation", 755 | "glGetError", 756 | "glGetIntegerv", 757 | "glGetProgramInfoLog", 758 | "glGetProgramiv", 759 | "glGetShaderInfoLog", 760 | "glGetShaderiv", 761 | "glGetString", 762 | "glGetStringi", 763 | "glGetUniformLocation", 764 | "glGetVertexAttribPointerv", 765 | "glGetVertexAttribiv", 766 | "glIsEnabled", 767 | "glLinkProgram", 768 | "glPixelStorei", 769 | "glPolygonMode", 770 | "glReadPixels", 771 | "glScissor", 772 | "glShaderSource", 773 | "glTexImage2D", 774 | "glTexParameteri", 775 | "glUniform1i", 776 | "glUniformMatrix4fv", 777 | "glUseProgram", 778 | "glVertexAttribPointer", 779 | "glViewport", 780 | }; 781 | 782 | GL3W_API union GL3WProcs imgl3wProcs; 783 | 784 | static void load_procs(GL3WGetProcAddressProc proc) 785 | { 786 | size_t i; 787 | for (i = 0; i < ARRAY_SIZE(proc_names); i++) 788 | imgl3wProcs.ptr[i] = proc(proc_names[i]); 789 | } 790 | 791 | #ifdef __cplusplus 792 | } 793 | #endif 794 | #endif 795 | -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/Imgui/imstb_rectpack.h: -------------------------------------------------------------------------------- 1 | // [DEAR IMGUI] 2 | // This is a slightly modified version of stb_rect_pack.h 1.01. 3 | // Grep for [DEAR IMGUI] to find the changes. 4 | // 5 | // stb_rect_pack.h - v1.01 - public domain - rectangle packing 6 | // Sean Barrett 2014 7 | // 8 | // Useful for e.g. packing rectangular textures into an atlas. 9 | // Does not do rotation. 10 | // 11 | // Before #including, 12 | // 13 | // #define STB_RECT_PACK_IMPLEMENTATION 14 | // 15 | // in the file that you want to have the implementation. 16 | // 17 | // Not necessarily the awesomest packing method, but better than 18 | // the totally naive one in stb_truetype (which is primarily what 19 | // this is meant to replace). 20 | // 21 | // Has only had a few tests run, may have issues. 22 | // 23 | // More docs to come. 24 | // 25 | // No memory allocations; uses qsort() and assert() from stdlib. 26 | // Can override those by defining STBRP_SORT and STBRP_ASSERT. 27 | // 28 | // This library currently uses the Skyline Bottom-Left algorithm. 29 | // 30 | // Please note: better rectangle packers are welcome! Please 31 | // implement them to the same API, but with a different init 32 | // function. 33 | // 34 | // Credits 35 | // 36 | // Library 37 | // Sean Barrett 38 | // Minor features 39 | // Martins Mozeiko 40 | // github:IntellectualKitty 41 | // 42 | // Bugfixes / warning fixes 43 | // Jeremy Jaussaud 44 | // Fabian Giesen 45 | // 46 | // Version history: 47 | // 48 | // 1.01 (2021-07-11) always use large rect mode, expose STBRP__MAXVAL in public section 49 | // 1.00 (2019-02-25) avoid small space waste; gracefully fail too-wide rectangles 50 | // 0.99 (2019-02-07) warning fixes 51 | // 0.11 (2017-03-03) return packing success/fail result 52 | // 0.10 (2016-10-25) remove cast-away-const to avoid warnings 53 | // 0.09 (2016-08-27) fix compiler warnings 54 | // 0.08 (2015-09-13) really fix bug with empty rects (w=0 or h=0) 55 | // 0.07 (2015-09-13) fix bug with empty rects (w=0 or h=0) 56 | // 0.06 (2015-04-15) added STBRP_SORT to allow replacing qsort 57 | // 0.05: added STBRP_ASSERT to allow replacing assert 58 | // 0.04: fixed minor bug in STBRP_LARGE_RECTS support 59 | // 0.01: initial release 60 | // 61 | // LICENSE 62 | // 63 | // See end of file for license information. 64 | 65 | ////////////////////////////////////////////////////////////////////////////// 66 | // 67 | // INCLUDE SECTION 68 | // 69 | 70 | #ifndef STB_INCLUDE_STB_RECT_PACK_H 71 | #define STB_INCLUDE_STB_RECT_PACK_H 72 | 73 | #define STB_RECT_PACK_VERSION 1 74 | 75 | #ifdef STBRP_STATIC 76 | #define STBRP_DEF static 77 | #else 78 | #define STBRP_DEF extern 79 | #endif 80 | 81 | #ifdef __cplusplus 82 | extern "C" { 83 | #endif 84 | 85 | typedef struct stbrp_context stbrp_context; 86 | typedef struct stbrp_node stbrp_node; 87 | typedef struct stbrp_rect stbrp_rect; 88 | 89 | typedef int stbrp_coord; 90 | 91 | #define STBRP__MAXVAL 0x7fffffff 92 | // Mostly for internal use, but this is the maximum supported coordinate value. 93 | 94 | STBRP_DEF int stbrp_pack_rects (stbrp_context *context, stbrp_rect *rects, int num_rects); 95 | // Assign packed locations to rectangles. The rectangles are of type 96 | // 'stbrp_rect' defined below, stored in the array 'rects', and there 97 | // are 'num_rects' many of them. 98 | // 99 | // Rectangles which are successfully packed have the 'was_packed' flag 100 | // set to a non-zero value and 'x' and 'y' store the minimum location 101 | // on each axis (i.e. bottom-left in cartesian coordinates, top-left 102 | // if you imagine y increasing downwards). Rectangles which do not fit 103 | // have the 'was_packed' flag set to 0. 104 | // 105 | // You should not try to access the 'rects' array from another thread 106 | // while this function is running, as the function temporarily reorders 107 | // the array while it executes. 108 | // 109 | // To pack into another rectangle, you need to call stbrp_init_target 110 | // again. To continue packing into the same rectangle, you can call 111 | // this function again. Calling this multiple times with multiple rect 112 | // arrays will probably produce worse packing results than calling it 113 | // a single time with the full rectangle array, but the option is 114 | // available. 115 | // 116 | // The function returns 1 if all of the rectangles were successfully 117 | // packed and 0 otherwise. 118 | 119 | struct stbrp_rect 120 | { 121 | // reserved for your use: 122 | int id; 123 | 124 | // input: 125 | stbrp_coord w, h; 126 | 127 | // output: 128 | stbrp_coord x, y; 129 | int was_packed; // non-zero if valid packing 130 | 131 | }; // 16 bytes, nominally 132 | 133 | 134 | STBRP_DEF void stbrp_init_target (stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes); 135 | // Initialize a rectangle packer to: 136 | // pack a rectangle that is 'width' by 'height' in dimensions 137 | // using temporary storage provided by the array 'nodes', which is 'num_nodes' long 138 | // 139 | // You must call this function every time you start packing into a new target. 140 | // 141 | // There is no "shutdown" function. The 'nodes' memory must stay valid for 142 | // the following stbrp_pack_rects() call (or calls), but can be freed after 143 | // the call (or calls) finish. 144 | // 145 | // Note: to guarantee best results, either: 146 | // 1. make sure 'num_nodes' >= 'width' 147 | // or 2. call stbrp_allow_out_of_mem() defined below with 'allow_out_of_mem = 1' 148 | // 149 | // If you don't do either of the above things, widths will be quantized to multiples 150 | // of small integers to guarantee the algorithm doesn't run out of temporary storage. 151 | // 152 | // If you do #2, then the non-quantized algorithm will be used, but the algorithm 153 | // may run out of temporary storage and be unable to pack some rectangles. 154 | 155 | STBRP_DEF void stbrp_setup_allow_out_of_mem (stbrp_context *context, int allow_out_of_mem); 156 | // Optionally call this function after init but before doing any packing to 157 | // change the handling of the out-of-temp-memory scenario, described above. 158 | // If you call init again, this will be reset to the default (false). 159 | 160 | 161 | STBRP_DEF void stbrp_setup_heuristic (stbrp_context *context, int heuristic); 162 | // Optionally select which packing heuristic the library should use. Different 163 | // heuristics will produce better/worse results for different data sets. 164 | // If you call init again, this will be reset to the default. 165 | 166 | enum 167 | { 168 | STBRP_HEURISTIC_Skyline_default=0, 169 | STBRP_HEURISTIC_Skyline_BL_sortHeight = STBRP_HEURISTIC_Skyline_default, 170 | STBRP_HEURISTIC_Skyline_BF_sortHeight 171 | }; 172 | 173 | 174 | ////////////////////////////////////////////////////////////////////////////// 175 | // 176 | // the details of the following structures don't matter to you, but they must 177 | // be visible so you can handle the memory allocations for them 178 | 179 | struct stbrp_node 180 | { 181 | stbrp_coord x,y; 182 | stbrp_node *next; 183 | }; 184 | 185 | struct stbrp_context 186 | { 187 | int width; 188 | int height; 189 | int align; 190 | int init_mode; 191 | int heuristic; 192 | int num_nodes; 193 | stbrp_node *active_head; 194 | stbrp_node *free_head; 195 | stbrp_node extra[2]; // we allocate two extra nodes so optimal user-node-count is 'width' not 'width+2' 196 | }; 197 | 198 | #ifdef __cplusplus 199 | } 200 | #endif 201 | 202 | #endif 203 | 204 | ////////////////////////////////////////////////////////////////////////////// 205 | // 206 | // IMPLEMENTATION SECTION 207 | // 208 | 209 | #ifdef STB_RECT_PACK_IMPLEMENTATION 210 | #ifndef STBRP_SORT 211 | #include 212 | #define STBRP_SORT qsort 213 | #endif 214 | 215 | #ifndef STBRP_ASSERT 216 | #include 217 | #define STBRP_ASSERT assert 218 | #endif 219 | 220 | #ifdef _MSC_VER 221 | #define STBRP__NOTUSED(v) (void)(v) 222 | #define STBRP__CDECL __cdecl 223 | #else 224 | #define STBRP__NOTUSED(v) (void)sizeof(v) 225 | #define STBRP__CDECL 226 | #endif 227 | 228 | enum 229 | { 230 | STBRP__INIT_skyline = 1 231 | }; 232 | 233 | STBRP_DEF void stbrp_setup_heuristic(stbrp_context *context, int heuristic) 234 | { 235 | switch (context->init_mode) { 236 | case STBRP__INIT_skyline: 237 | STBRP_ASSERT(heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight || heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight); 238 | context->heuristic = heuristic; 239 | break; 240 | default: 241 | STBRP_ASSERT(0); 242 | } 243 | } 244 | 245 | STBRP_DEF void stbrp_setup_allow_out_of_mem(stbrp_context *context, int allow_out_of_mem) 246 | { 247 | if (allow_out_of_mem) 248 | // if it's ok to run out of memory, then don't bother aligning them; 249 | // this gives better packing, but may fail due to OOM (even though 250 | // the rectangles easily fit). @TODO a smarter approach would be to only 251 | // quantize once we've hit OOM, then we could get rid of this parameter. 252 | context->align = 1; 253 | else { 254 | // if it's not ok to run out of memory, then quantize the widths 255 | // so that num_nodes is always enough nodes. 256 | // 257 | // I.e. num_nodes * align >= width 258 | // align >= width / num_nodes 259 | // align = ceil(width/num_nodes) 260 | 261 | context->align = (context->width + context->num_nodes-1) / context->num_nodes; 262 | } 263 | } 264 | 265 | STBRP_DEF void stbrp_init_target(stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes) 266 | { 267 | int i; 268 | 269 | for (i=0; i < num_nodes-1; ++i) 270 | nodes[i].next = &nodes[i+1]; 271 | nodes[i].next = NULL; 272 | context->init_mode = STBRP__INIT_skyline; 273 | context->heuristic = STBRP_HEURISTIC_Skyline_default; 274 | context->free_head = &nodes[0]; 275 | context->active_head = &context->extra[0]; 276 | context->width = width; 277 | context->height = height; 278 | context->num_nodes = num_nodes; 279 | stbrp_setup_allow_out_of_mem(context, 0); 280 | 281 | // node 0 is the full width, node 1 is the sentinel (lets us not store width explicitly) 282 | context->extra[0].x = 0; 283 | context->extra[0].y = 0; 284 | context->extra[0].next = &context->extra[1]; 285 | context->extra[1].x = (stbrp_coord) width; 286 | context->extra[1].y = (1<<30); 287 | context->extra[1].next = NULL; 288 | } 289 | 290 | // find minimum y position if it starts at x1 291 | static int stbrp__skyline_find_min_y(stbrp_context *c, stbrp_node *first, int x0, int width, int *pwaste) 292 | { 293 | stbrp_node *node = first; 294 | int x1 = x0 + width; 295 | int min_y, visited_width, waste_area; 296 | 297 | STBRP__NOTUSED(c); 298 | 299 | STBRP_ASSERT(first->x <= x0); 300 | 301 | #if 0 302 | // skip in case we're past the node 303 | while (node->next->x <= x0) 304 | ++node; 305 | #else 306 | STBRP_ASSERT(node->next->x > x0); // we ended up handling this in the caller for efficiency 307 | #endif 308 | 309 | STBRP_ASSERT(node->x <= x0); 310 | 311 | min_y = 0; 312 | waste_area = 0; 313 | visited_width = 0; 314 | while (node->x < x1) { 315 | if (node->y > min_y) { 316 | // raise min_y higher. 317 | // we've accounted for all waste up to min_y, 318 | // but we'll now add more waste for everything we've visted 319 | waste_area += visited_width * (node->y - min_y); 320 | min_y = node->y; 321 | // the first time through, visited_width might be reduced 322 | if (node->x < x0) 323 | visited_width += node->next->x - x0; 324 | else 325 | visited_width += node->next->x - node->x; 326 | } else { 327 | // add waste area 328 | int under_width = node->next->x - node->x; 329 | if (under_width + visited_width > width) 330 | under_width = width - visited_width; 331 | waste_area += under_width * (min_y - node->y); 332 | visited_width += under_width; 333 | } 334 | node = node->next; 335 | } 336 | 337 | *pwaste = waste_area; 338 | return min_y; 339 | } 340 | 341 | typedef struct 342 | { 343 | int x,y; 344 | stbrp_node **prev_link; 345 | } stbrp__findresult; 346 | 347 | static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int width, int height) 348 | { 349 | int best_waste = (1<<30), best_x, best_y = (1 << 30); 350 | stbrp__findresult fr; 351 | stbrp_node **prev, *node, *tail, **best = NULL; 352 | 353 | // align to multiple of c->align 354 | width = (width + c->align - 1); 355 | width -= width % c->align; 356 | STBRP_ASSERT(width % c->align == 0); 357 | 358 | // if it can't possibly fit, bail immediately 359 | if (width > c->width || height > c->height) { 360 | fr.prev_link = NULL; 361 | fr.x = fr.y = 0; 362 | return fr; 363 | } 364 | 365 | node = c->active_head; 366 | prev = &c->active_head; 367 | while (node->x + width <= c->width) { 368 | int y,waste; 369 | y = stbrp__skyline_find_min_y(c, node, node->x, width, &waste); 370 | if (c->heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight) { // actually just want to test BL 371 | // bottom left 372 | if (y < best_y) { 373 | best_y = y; 374 | best = prev; 375 | } 376 | } else { 377 | // best-fit 378 | if (y + height <= c->height) { 379 | // can only use it if it first vertically 380 | if (y < best_y || (y == best_y && waste < best_waste)) { 381 | best_y = y; 382 | best_waste = waste; 383 | best = prev; 384 | } 385 | } 386 | } 387 | prev = &node->next; 388 | node = node->next; 389 | } 390 | 391 | best_x = (best == NULL) ? 0 : (*best)->x; 392 | 393 | // if doing best-fit (BF), we also have to try aligning right edge to each node position 394 | // 395 | // e.g, if fitting 396 | // 397 | // ____________________ 398 | // |____________________| 399 | // 400 | // into 401 | // 402 | // | | 403 | // | ____________| 404 | // |____________| 405 | // 406 | // then right-aligned reduces waste, but bottom-left BL is always chooses left-aligned 407 | // 408 | // This makes BF take about 2x the time 409 | 410 | if (c->heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight) { 411 | tail = c->active_head; 412 | node = c->active_head; 413 | prev = &c->active_head; 414 | // find first node that's admissible 415 | while (tail->x < width) 416 | tail = tail->next; 417 | while (tail) { 418 | int xpos = tail->x - width; 419 | int y,waste; 420 | STBRP_ASSERT(xpos >= 0); 421 | // find the left position that matches this 422 | while (node->next->x <= xpos) { 423 | prev = &node->next; 424 | node = node->next; 425 | } 426 | STBRP_ASSERT(node->next->x > xpos && node->x <= xpos); 427 | y = stbrp__skyline_find_min_y(c, node, xpos, width, &waste); 428 | if (y + height <= c->height) { 429 | if (y <= best_y) { 430 | if (y < best_y || waste < best_waste || (waste==best_waste && xpos < best_x)) { 431 | best_x = xpos; 432 | //STBRP_ASSERT(y <= best_y); [DEAR IMGUI] 433 | best_y = y; 434 | best_waste = waste; 435 | best = prev; 436 | } 437 | } 438 | } 439 | tail = tail->next; 440 | } 441 | } 442 | 443 | fr.prev_link = best; 444 | fr.x = best_x; 445 | fr.y = best_y; 446 | return fr; 447 | } 448 | 449 | static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, int width, int height) 450 | { 451 | // find best position according to heuristic 452 | stbrp__findresult res = stbrp__skyline_find_best_pos(context, width, height); 453 | stbrp_node *node, *cur; 454 | 455 | // bail if: 456 | // 1. it failed 457 | // 2. the best node doesn't fit (we don't always check this) 458 | // 3. we're out of memory 459 | if (res.prev_link == NULL || res.y + height > context->height || context->free_head == NULL) { 460 | res.prev_link = NULL; 461 | return res; 462 | } 463 | 464 | // on success, create new node 465 | node = context->free_head; 466 | node->x = (stbrp_coord) res.x; 467 | node->y = (stbrp_coord) (res.y + height); 468 | 469 | context->free_head = node->next; 470 | 471 | // insert the new node into the right starting point, and 472 | // let 'cur' point to the remaining nodes needing to be 473 | // stiched back in 474 | 475 | cur = *res.prev_link; 476 | if (cur->x < res.x) { 477 | // preserve the existing one, so start testing with the next one 478 | stbrp_node *next = cur->next; 479 | cur->next = node; 480 | cur = next; 481 | } else { 482 | *res.prev_link = node; 483 | } 484 | 485 | // from here, traverse cur and free the nodes, until we get to one 486 | // that shouldn't be freed 487 | while (cur->next && cur->next->x <= res.x + width) { 488 | stbrp_node *next = cur->next; 489 | // move the current node to the free list 490 | cur->next = context->free_head; 491 | context->free_head = cur; 492 | cur = next; 493 | } 494 | 495 | // stitch the list back in 496 | node->next = cur; 497 | 498 | if (cur->x < res.x + width) 499 | cur->x = (stbrp_coord) (res.x + width); 500 | 501 | #ifdef _DEBUG 502 | cur = context->active_head; 503 | while (cur->x < context->width) { 504 | STBRP_ASSERT(cur->x < cur->next->x); 505 | cur = cur->next; 506 | } 507 | STBRP_ASSERT(cur->next == NULL); 508 | 509 | { 510 | int count=0; 511 | cur = context->active_head; 512 | while (cur) { 513 | cur = cur->next; 514 | ++count; 515 | } 516 | cur = context->free_head; 517 | while (cur) { 518 | cur = cur->next; 519 | ++count; 520 | } 521 | STBRP_ASSERT(count == context->num_nodes+2); 522 | } 523 | #endif 524 | 525 | return res; 526 | } 527 | 528 | static int STBRP__CDECL rect_height_compare(const void *a, const void *b) 529 | { 530 | const stbrp_rect *p = (const stbrp_rect *) a; 531 | const stbrp_rect *q = (const stbrp_rect *) b; 532 | if (p->h > q->h) 533 | return -1; 534 | if (p->h < q->h) 535 | return 1; 536 | return (p->w > q->w) ? -1 : (p->w < q->w); 537 | } 538 | 539 | static int STBRP__CDECL rect_original_order(const void *a, const void *b) 540 | { 541 | const stbrp_rect *p = (const stbrp_rect *) a; 542 | const stbrp_rect *q = (const stbrp_rect *) b; 543 | return (p->was_packed < q->was_packed) ? -1 : (p->was_packed > q->was_packed); 544 | } 545 | 546 | STBRP_DEF int stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects) 547 | { 548 | int i, all_rects_packed = 1; 549 | 550 | // we use the 'was_packed' field internally to allow sorting/unsorting 551 | for (i=0; i < num_rects; ++i) { 552 | rects[i].was_packed = i; 553 | } 554 | 555 | // sort according to heuristic 556 | STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_height_compare); 557 | 558 | for (i=0; i < num_rects; ++i) { 559 | if (rects[i].w == 0 || rects[i].h == 0) { 560 | rects[i].x = rects[i].y = 0; // empty rect needs no space 561 | } else { 562 | stbrp__findresult fr = stbrp__skyline_pack_rectangle(context, rects[i].w, rects[i].h); 563 | if (fr.prev_link) { 564 | rects[i].x = (stbrp_coord) fr.x; 565 | rects[i].y = (stbrp_coord) fr.y; 566 | } else { 567 | rects[i].x = rects[i].y = STBRP__MAXVAL; 568 | } 569 | } 570 | } 571 | 572 | // unsort 573 | STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order); 574 | 575 | // set was_packed flags and all_rects_packed status 576 | for (i=0; i < num_rects; ++i) { 577 | rects[i].was_packed = !(rects[i].x == STBRP__MAXVAL && rects[i].y == STBRP__MAXVAL); 578 | if (!rects[i].was_packed) 579 | all_rects_packed = 0; 580 | } 581 | 582 | // return the all_rects_packed status 583 | return all_rects_packed; 584 | } 585 | #endif 586 | 587 | /* 588 | ------------------------------------------------------------------------------ 589 | This software is available under 2 licenses -- choose whichever you prefer. 590 | ------------------------------------------------------------------------------ 591 | ALTERNATIVE A - MIT License 592 | Copyright (c) 2017 Sean Barrett 593 | Permission is hereby granted, free of charge, to any person obtaining a copy of 594 | this software and associated documentation files (the "Software"), to deal in 595 | the Software without restriction, including without limitation the rights to 596 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 597 | of the Software, and to permit persons to whom the Software is furnished to do 598 | so, subject to the following conditions: 599 | The above copyright notice and this permission notice shall be included in all 600 | copies or substantial portions of the Software. 601 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 602 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 603 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 604 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 605 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 606 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 607 | SOFTWARE. 608 | ------------------------------------------------------------------------------ 609 | ALTERNATIVE B - Public Domain (www.unlicense.org) 610 | This is free and unencumbered software released into the public domain. 611 | Anyone is free to copy, modify, publish, use, compile, sell, or distribute this 612 | software, either in source code form or as a compiled binary, for any purpose, 613 | commercial or non-commercial, and by any means. 614 | In jurisdictions that recognize copyright laws, the author or authors of this 615 | software dedicate any and all copyright interest in the software to the public 616 | domain. We make this dedication for the benefit of the public at large and to 617 | the detriment of our heirs and successors. We intend this dedication to be an 618 | overt act of relinquishment in perpetuity of all present and future rights to 619 | this software under copyright law. 620 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 621 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 622 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 623 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 624 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 625 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 626 | ------------------------------------------------------------------------------ 627 | */ 628 | -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/TextEditor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include "imgui.h" 12 | 13 | class TextEditor 14 | { 15 | public: 16 | enum class PaletteIndex 17 | { 18 | Default, 19 | Keyword, 20 | Number, 21 | String, 22 | CharLiteral, 23 | Punctuation, 24 | Preprocessor, 25 | Identifier, 26 | KnownIdentifier, 27 | PreprocIdentifier, 28 | Comment, 29 | MultiLineComment, 30 | Background, 31 | Cursor, 32 | Selection, 33 | ErrorMarker, 34 | Breakpoint, 35 | LineNumber, 36 | CurrentLineFill, 37 | CurrentLineFillInactive, 38 | CurrentLineEdge, 39 | Max 40 | }; 41 | 42 | enum class SelectionMode 43 | { 44 | Normal, 45 | Word, 46 | Line 47 | }; 48 | 49 | struct Breakpoint 50 | { 51 | int mLine; 52 | bool mEnabled; 53 | std::string mCondition; 54 | 55 | Breakpoint() 56 | : mLine(-1) 57 | , mEnabled(false) 58 | {} 59 | }; 60 | 61 | // Represents a character coordinate from the user's point of view, 62 | // i. e. consider an uniform grid (assuming fixed-width font) on the 63 | // screen as it is rendered, and each cell has its own coordinate, starting from 0. 64 | // Tabs are counted as [1..mTabSize] count empty spaces, depending on 65 | // how many space is necessary to reach the next tab stop. 66 | // For example, coordinate (1, 5) represents the character 'B' in a line "\tABC", when mTabSize = 4, 67 | // because it is rendered as " ABC" on the screen. 68 | struct Coordinates 69 | { 70 | int mLine, mColumn; 71 | Coordinates() : mLine(0), mColumn(0) {} 72 | Coordinates(int aLine, int aColumn) : mLine(aLine), mColumn(aColumn) 73 | { 74 | assert(aLine >= 0); 75 | assert(aColumn >= 0); 76 | } 77 | static Coordinates Invalid() { static Coordinates invalid(-1, -1); return invalid; } 78 | 79 | bool operator ==(const Coordinates& o) const 80 | { 81 | return 82 | mLine == o.mLine && 83 | mColumn == o.mColumn; 84 | } 85 | 86 | bool operator !=(const Coordinates& o) const 87 | { 88 | return 89 | mLine != o.mLine || 90 | mColumn != o.mColumn; 91 | } 92 | 93 | bool operator <(const Coordinates& o) const 94 | { 95 | if (mLine != o.mLine) 96 | return mLine < o.mLine; 97 | return mColumn < o.mColumn; 98 | } 99 | 100 | bool operator >(const Coordinates& o) const 101 | { 102 | if (mLine != o.mLine) 103 | return mLine > o.mLine; 104 | return mColumn > o.mColumn; 105 | } 106 | 107 | bool operator <=(const Coordinates& o) const 108 | { 109 | if (mLine != o.mLine) 110 | return mLine < o.mLine; 111 | return mColumn <= o.mColumn; 112 | } 113 | 114 | bool operator >=(const Coordinates& o) const 115 | { 116 | if (mLine != o.mLine) 117 | return mLine > o.mLine; 118 | return mColumn >= o.mColumn; 119 | } 120 | }; 121 | 122 | struct Identifier 123 | { 124 | Coordinates mLocation; 125 | std::string mDeclaration; 126 | }; 127 | 128 | typedef std::string String; 129 | typedef std::unordered_map Identifiers; 130 | typedef std::unordered_set Keywords; 131 | typedef std::map ErrorMarkers; 132 | typedef std::unordered_set Breakpoints; 133 | typedef std::array Palette; 134 | typedef uint8_t Char; 135 | 136 | struct Glyph 137 | { 138 | Char mChar; 139 | PaletteIndex mColorIndex = PaletteIndex::Default; 140 | bool mComment : 1; 141 | bool mMultiLineComment : 1; 142 | bool mPreprocessor : 1; 143 | 144 | Glyph(Char aChar, PaletteIndex aColorIndex) : mChar(aChar), mColorIndex(aColorIndex), 145 | mComment(false), mMultiLineComment(false), mPreprocessor(false) {} 146 | }; 147 | 148 | typedef std::vector Line; 149 | typedef std::vector Lines; 150 | 151 | struct LanguageDefinition 152 | { 153 | typedef std::pair TokenRegexString; 154 | typedef std::vector TokenRegexStrings; 155 | typedef bool(*TokenizeCallback)(const char * in_begin, const char * in_end, const char *& out_begin, const char *& out_end, PaletteIndex & paletteIndex); 156 | 157 | std::string mName; 158 | Keywords mKeywords; 159 | Identifiers mIdentifiers; 160 | Identifiers mPreprocIdentifiers; 161 | std::string mCommentStart, mCommentEnd, mSingleLineComment; 162 | char mPreprocChar; 163 | bool mAutoIndentation; 164 | 165 | TokenizeCallback mTokenize; 166 | 167 | TokenRegexStrings mTokenRegexStrings; 168 | 169 | bool mCaseSensitive; 170 | 171 | LanguageDefinition() 172 | : mPreprocChar('#'), mAutoIndentation(true), mTokenize(nullptr), mCaseSensitive(true) 173 | { 174 | } 175 | 176 | static const LanguageDefinition& CPlusPlus(); 177 | static const LanguageDefinition& HLSL(); 178 | static const LanguageDefinition& GLSL(); 179 | static const LanguageDefinition& C(); 180 | static const LanguageDefinition& SQL(); 181 | static const LanguageDefinition& AngelScript(); 182 | static const LanguageDefinition& Lua(); 183 | }; 184 | 185 | TextEditor(); 186 | ~TextEditor(); 187 | 188 | void SetLanguageDefinition(const LanguageDefinition& aLanguageDef); 189 | const LanguageDefinition& GetLanguageDefinition() const { return mLanguageDefinition; } 190 | 191 | const Palette& GetPalette() const { return mPaletteBase; } 192 | void SetPalette(const Palette& aValue); 193 | 194 | void SetErrorMarkers(const ErrorMarkers& aMarkers) { mErrorMarkers = aMarkers; } 195 | void SetBreakpoints(const Breakpoints& aMarkers) { mBreakpoints = aMarkers; } 196 | 197 | void Render(const char* aTitle, const ImVec2& aSize = ImVec2(), bool aBorder = false); 198 | void SetText(const std::string& aText); 199 | std::string GetText() const; 200 | 201 | void SetTextLines(const std::vector& aLines); 202 | std::vector GetTextLines() const; 203 | 204 | std::string GetSelectedText() const; 205 | std::string GetCurrentLineText()const; 206 | 207 | int GetTotalLines() const { return (int)mLines.size(); } 208 | bool IsOverwrite() const { return mOverwrite; } 209 | 210 | void SetReadOnly(bool aValue); 211 | bool IsReadOnly() const { return mReadOnly; } 212 | bool IsTextChanged() const { return mTextChanged; } 213 | bool IsCursorPositionChanged() const { return mCursorPositionChanged; } 214 | 215 | bool IsColorizerEnabled() const { return mColorizerEnabled; } 216 | void SetColorizerEnable(bool aValue); 217 | 218 | Coordinates GetCursorPosition() const { return GetActualCursorCoordinates(); } 219 | void SetCursorPosition(const Coordinates& aPosition); 220 | 221 | inline void SetHandleMouseInputs (bool aValue){ mHandleMouseInputs = aValue;} 222 | inline bool IsHandleMouseInputsEnabled() const { return mHandleKeyboardInputs; } 223 | 224 | inline void SetHandleKeyboardInputs (bool aValue){ mHandleKeyboardInputs = aValue;} 225 | inline bool IsHandleKeyboardInputsEnabled() const { return mHandleKeyboardInputs; } 226 | 227 | inline void SetImGuiChildIgnored (bool aValue){ mIgnoreImGuiChild = aValue;} 228 | inline bool IsImGuiChildIgnored() const { return mIgnoreImGuiChild; } 229 | 230 | inline void SetShowWhitespaces(bool aValue) { mShowWhitespaces = aValue; } 231 | inline bool IsShowingWhitespaces() const { return mShowWhitespaces; } 232 | 233 | void SetTabSize(int aValue); 234 | inline int GetTabSize() const { return mTabSize; } 235 | 236 | void InsertText(const std::string& aValue); 237 | void InsertText(const char* aValue); 238 | 239 | void MoveUp(int aAmount = 1, bool aSelect = false); 240 | void MoveDown(int aAmount = 1, bool aSelect = false); 241 | void MoveLeft(int aAmount = 1, bool aSelect = false, bool aWordMode = false); 242 | void MoveRight(int aAmount = 1, bool aSelect = false, bool aWordMode = false); 243 | void MoveTop(bool aSelect = false); 244 | void MoveBottom(bool aSelect = false); 245 | void MoveHome(bool aSelect = false); 246 | void MoveEnd(bool aSelect = false); 247 | 248 | void SetSelectionStart(const Coordinates& aPosition); 249 | void SetSelectionEnd(const Coordinates& aPosition); 250 | void SetSelection(const Coordinates& aStart, const Coordinates& aEnd, SelectionMode aMode = SelectionMode::Normal); 251 | void SelectWordUnderCursor(); 252 | void SelectAll(); 253 | bool HasSelection() const; 254 | 255 | void Copy(); 256 | void Cut(); 257 | void Paste(); 258 | void Delete(); 259 | 260 | bool CanUndo() const; 261 | bool CanRedo() const; 262 | void Undo(int aSteps = 1); 263 | void Redo(int aSteps = 1); 264 | 265 | static const Palette& GetDarkPalette(); 266 | static const Palette& GetLightPalette(); 267 | static const Palette& GetRetroBluePalette(); 268 | 269 | private: 270 | typedef std::vector> RegexList; 271 | 272 | struct EditorState 273 | { 274 | Coordinates mSelectionStart; 275 | Coordinates mSelectionEnd; 276 | Coordinates mCursorPosition; 277 | }; 278 | 279 | class UndoRecord 280 | { 281 | public: 282 | UndoRecord() {} 283 | ~UndoRecord() {} 284 | 285 | UndoRecord( 286 | const std::string& aAdded, 287 | const TextEditor::Coordinates aAddedStart, 288 | const TextEditor::Coordinates aAddedEnd, 289 | 290 | const std::string& aRemoved, 291 | const TextEditor::Coordinates aRemovedStart, 292 | const TextEditor::Coordinates aRemovedEnd, 293 | 294 | TextEditor::EditorState& aBefore, 295 | TextEditor::EditorState& aAfter); 296 | 297 | void Undo(TextEditor* aEditor); 298 | void Redo(TextEditor* aEditor); 299 | 300 | std::string mAdded; 301 | Coordinates mAddedStart; 302 | Coordinates mAddedEnd; 303 | 304 | std::string mRemoved; 305 | Coordinates mRemovedStart; 306 | Coordinates mRemovedEnd; 307 | 308 | EditorState mBefore; 309 | EditorState mAfter; 310 | }; 311 | 312 | typedef std::vector UndoBuffer; 313 | 314 | void ProcessInputs(); 315 | void Colorize(int aFromLine = 0, int aCount = -1); 316 | void ColorizeRange(int aFromLine = 0, int aToLine = 0); 317 | void ColorizeInternal(); 318 | float TextDistanceToLineStart(const Coordinates& aFrom) const; 319 | void EnsureCursorVisible(); 320 | int GetPageSize() const; 321 | std::string GetText(const Coordinates& aStart, const Coordinates& aEnd) const; 322 | Coordinates GetActualCursorCoordinates() const; 323 | Coordinates SanitizeCoordinates(const Coordinates& aValue) const; 324 | void Advance(Coordinates& aCoordinates) const; 325 | void DeleteRange(const Coordinates& aStart, const Coordinates& aEnd); 326 | int InsertTextAt(Coordinates& aWhere, const char* aValue); 327 | void AddUndo(UndoRecord& aValue); 328 | Coordinates ScreenPosToCoordinates(const ImVec2& aPosition) const; 329 | Coordinates FindWordStart(const Coordinates& aFrom) const; 330 | Coordinates FindWordEnd(const Coordinates& aFrom) const; 331 | Coordinates FindNextWord(const Coordinates& aFrom) const; 332 | int GetCharacterIndex(const Coordinates& aCoordinates) const; 333 | int GetCharacterColumn(int aLine, int aIndex) const; 334 | int GetLineCharacterCount(int aLine) const; 335 | int GetLineMaxColumn(int aLine) const; 336 | bool IsOnWordBoundary(const Coordinates& aAt) const; 337 | void RemoveLine(int aStart, int aEnd); 338 | void RemoveLine(int aIndex); 339 | Line& InsertLine(int aIndex); 340 | void EnterCharacter(ImWchar aChar, bool aShift); 341 | void Backspace(); 342 | void DeleteSelection(); 343 | std::string GetWordUnderCursor() const; 344 | std::string GetWordAt(const Coordinates& aCoords) const; 345 | ImU32 GetGlyphColor(const Glyph& aGlyph) const; 346 | 347 | void HandleKeyboardInputs(); 348 | void HandleMouseInputs(); 349 | void Render(); 350 | 351 | float mLineSpacing; 352 | Lines mLines; 353 | EditorState mState; 354 | UndoBuffer mUndoBuffer; 355 | int mUndoIndex; 356 | 357 | int mTabSize; 358 | bool mOverwrite; 359 | bool mReadOnly; 360 | bool mWithinRender; 361 | bool mScrollToCursor; 362 | bool mScrollToTop; 363 | bool mTextChanged; 364 | bool mColorizerEnabled; 365 | float mTextStart; // position (in pixels) where a code line starts relative to the left of the TextEditor. 366 | int mLeftMargin; 367 | bool mCursorPositionChanged; 368 | int mColorRangeMin, mColorRangeMax; 369 | SelectionMode mSelectionMode; 370 | bool mHandleKeyboardInputs; 371 | bool mHandleMouseInputs; 372 | bool mIgnoreImGuiChild; 373 | bool mShowWhitespaces; 374 | 375 | Palette mPaletteBase; 376 | Palette mPalette; 377 | LanguageDefinition mLanguageDefinition; 378 | RegexList mRegexList; 379 | 380 | bool mCheckComments; 381 | Breakpoints mBreakpoints; 382 | ErrorMarkers mErrorMarkers; 383 | ImVec2 mCharAdvance; 384 | Coordinates mInteractiveStart, mInteractiveEnd; 385 | std::string mLineBuffer; 386 | uint64_t mStartTime; 387 | 388 | float mLastClick; 389 | }; 390 | -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/VideoImgui.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {a74c3829-8579-4ae7-a408-480b76b70c2c} 25 | VideoImgui 26 | 10.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v142 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v142 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v142 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v142 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | true 75 | 76 | 77 | false 78 | 79 | 80 | true 81 | 82 | 83 | false 84 | 85 | 86 | 87 | Level3 88 | true 89 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 90 | true 91 | 92 | 93 | Console 94 | true 95 | 96 | 97 | 98 | 99 | Level3 100 | true 101 | true 102 | true 103 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 104 | true 105 | ..\API\GLFW\include;..\API\GLEW;Imgui;%(AdditionalIncludeDirectories) 106 | 107 | 108 | Console 109 | true 110 | true 111 | true 112 | 113 | 114 | 115 | 116 | Level3 117 | true 118 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 119 | true 120 | 121 | 122 | Console 123 | true 124 | 125 | 126 | 127 | 128 | Level3 129 | true 130 | true 131 | true 132 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 133 | true 134 | ..\API\GLFW\include;..\API\GLEW;Imgui;%(AdditionalIncludeDirectories) 135 | 136 | 137 | Console 138 | true 139 | true 140 | true 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/VideoImgui.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {e0f43fe3-8832-47bc-8ea0-f1ce6c13949b} 18 | 19 | 20 | 21 | 22 | 資源檔 23 | 24 | 25 | 標頭檔 26 | 27 | 28 | 標頭檔 29 | 30 | 31 | 標頭檔 32 | 33 | 34 | 標頭檔 35 | 36 | 37 | 標頭檔 38 | 39 | 40 | 標頭檔 41 | 42 | 43 | 標頭檔 44 | 45 | 46 | ImguiTextEditor 47 | 48 | 49 | 50 | 51 | 標頭檔 52 | 53 | 54 | 標頭檔 55 | 56 | 57 | 標頭檔 58 | 59 | 60 | 標頭檔 61 | 62 | 63 | 標頭檔 64 | 65 | 66 | 標頭檔 67 | 68 | 69 | 標頭檔 70 | 71 | 72 | 標頭檔 73 | 74 | 75 | 標頭檔 76 | 77 | 78 | 資源檔 79 | 80 | 81 | ImguiTextEditor 82 | 83 | 84 | -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/VideoImgui.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/glew32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/glew32.dll -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/glfw3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/glfw3.dll -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/imgui.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/imgui.ini -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/kaiu.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/kaiu.ttf -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #define GLEW_STATIC 3 | #include 4 | #include 5 | #pragma comment(lib,"../API/GLFW/glfw3.lib") 6 | #pragma comment(lib,"../API/GLEW/glew32s.lib") 7 | #pragma comment(lib,"Opengl32.lib") 8 | #include 9 | #include 10 | 11 | 12 | #include "imgui.h" 13 | #include "imgui_impl_glfw.h" 14 | #include "imgui_impl_opengl3.h" 15 | #include "GUI.h" 16 | 17 | GLFWwindow* Windows; 18 | 19 | int main() 20 | { 21 | glfwInit(); 22 | glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); 23 | glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); 24 | glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); 25 | 26 | Windows = glfwCreateWindow(900, 800,"HalfPeople-Imgui",NULL,NULL); 27 | 28 | glfwMakeContextCurrent(Windows); 29 | glfwSwapInterval(0); 30 | 31 | IMGUI_CHECKVERSION(); 32 | ImGui::CreateContext(NULL); 33 | ImGuiIO& io = ImGui::GetIO(); (void)io; 34 | io.Fonts->AddFontFromFileTTF("kaiu.ttf", 18, NULL, io.Fonts->GetGlyphRangesChineseFull()); 35 | 36 | io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; 37 | io.ConfigFlags |= ImGuiViewportFlags_NoDecoration; 38 | io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; 39 | io.ConfigFlags |= ImGuiCol_DockingEmptyBg; 40 | 41 | 42 | ImGui::StyleColorsDark(); 43 | ImGuiStyle& style = ImGui::GetStyle(); 44 | 45 | ImVec4* colors = style.Colors; 46 | colors[ImGuiCol_FrameBg] = ImVec4(0.16f, 0.16f, 0.17f, 1.00f); 47 | colors[ImGuiCol_FrameBgHovered] = ImVec4(0.37f, 0.36f, 0.36f, 102.00f); 48 | colors[ImGuiCol_FrameBgActive] = ImVec4(0.10f, 0.10f, 0.10f, 171.00f); 49 | colors[ImGuiCol_TitleBgActive] = ImVec4(0.20f, 0.20f, 0.20f, 255.00f); 50 | colors[ImGuiCol_CheckMark] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f); 51 | colors[ImGuiCol_SliderGrab] = ImVec4(0.64f, 0.64f, 0.64f, 1.00f); 52 | colors[ImGuiCol_SliderGrabActive] = ImVec4(0.31f, 0.31f, 0.31f, 1.00f); 53 | colors[ImGuiCol_Button] = ImVec4(0.22f, 0.22f, 0.22f, 0.40f); 54 | colors[ImGuiCol_ButtonHovered] = ImVec4(0.29f, 0.29f, 0.29f, 1.00f); 55 | colors[ImGuiCol_ButtonActive] = ImVec4(0.13f, 0.13f, 0.13f, 1.00f); 56 | colors[ImGuiCol_Header] = ImVec4(0.45f, 0.45f, 0.45f, 0.31f); 57 | colors[ImGuiCol_HeaderHovered] = ImVec4(0.55f, 0.55f, 0.55f, 0.80f); 58 | colors[ImGuiCol_HeaderActive] = ImVec4(0.09f, 0.09f, 0.09f, 1.00f); 59 | colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.20f); 60 | colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.46f, 0.46f, 0.46f, 0.67f); 61 | colors[ImGuiCol_ResizeGripActive] = ImVec4(0.17f, 0.17f, 0.17f, 0.95f); 62 | colors[ImGuiCol_SeparatorActive] = ImVec4(0.42f, 0.42f, 0.42f, 1.00f); 63 | colors[ImGuiCol_SeparatorHovered] = ImVec4(0.50f, 0.50f, 0.50f, 0.78f); 64 | colors[ImGuiCol_TabHovered] = ImVec4(0.45f, 0.45f, 0.45f, 0.80f); 65 | colors[ImGuiCol_TabActive] = ImVec4(0.28f, 0.28f, 0.28f, 1.00f); 66 | colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.19f, 0.19f, 0.19f, 1.00f); 67 | colors[ImGuiCol_DockingPreview] = ImVec4(0.51f, 0.51f, 0.51f, 0.70f); 68 | colors[ImGuiCol_Tab] = ImVec4(0.21f, 0.21f, 0.21f, 0.86f); 69 | colors[ImGuiCol_TabUnfocused] = ImVec4(0.15f, 0.15f, 0.15f, 0.97f); 70 | colors[ImGuiCol_NavHighlight] = ImVec4(1.00f, 0.40f, 0.13f, 1.00f); 71 | colors[ImGuiCol_TextSelectedBg] = ImVec4(0.45f, 1.00f, 0.85f, 0.35f); 72 | 73 | 74 | style.WindowRounding = 4; 75 | style.FrameRounding = 4; 76 | style.GrabRounding = 3; 77 | style.ScrollbarSize = 7; 78 | style.ScrollbarRounding = 0; 79 | 80 | 81 | ImGui_ImplGlfw_InitForOpenGL(Windows, true); 82 | ImGui_ImplOpenGL3_Init("#version 330"); 83 | 84 | te = new TextEditor(); 85 | te->SetLanguageDefinition(TextEditor::LanguageDefinition::C()); 86 | while (!glfwWindowShouldClose(Windows)) 87 | { 88 | glClear(GL_COLOR_BUFFER_BIT); 89 | 90 | ImGui_ImplOpenGL3_NewFrame(); 91 | ImGui_ImplGlfw_NewFrame(); 92 | ImGui::NewFrame(); 93 | ImGui::DockSpaceOverViewport(); 94 | 95 | DrawGUI(); 96 | 97 | ImGui::ShowDemoWindow(); 98 | 99 | ImGui::Render(); 100 | ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); 101 | 102 | if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) 103 | { 104 | GLFWwindow* backup_current_context = glfwGetCurrentContext(); 105 | ImGui::UpdatePlatformWindows(); 106 | ImGui::RenderPlatformWindowsDefault(); 107 | glfwMakeContextCurrent(backup_current_context); 108 | } 109 | 110 | glfwSwapBuffers(Windows); 111 | glfwPollEvents(); 112 | } 113 | } -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/TextEditor.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/TextEditor.obj -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/VideoImgui.exe.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | G:\HalfPeopleStudioC++ Porject\VideoImgui\x64\Release\VideoImgui.exe 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/VideoImgui.iobj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/VideoImgui.iobj -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/VideoImgui.ipdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/VideoImgui.ipdb -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/VideoImgui.log: -------------------------------------------------------------------------------- 1 |  main.cpp 2 | TextEditor.cpp 3 | 正在產生程式碼 4 | 1991 of 4323 functions (46.1%) were compiled, the rest were copied from previous compilation. 5 | 1840 functions were new in current compilation 6 | 264 functions had inline decision re-evaluated but remain unchanged 7 | 已完成程式碼產生 8 | VideoImgui.vcxproj -> G:\HalfPeopleStudioC++ Porject\VideoImgui\x64\Release\VideoImgui.exe 9 | -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/VideoImgui.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/VideoImgui.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/VideoImgui.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/VideoImgui.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/VideoImgui.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/VideoImgui.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/VideoImgui.tlog/VideoImgui.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:VCServicingVersionCrtHeaders=14.29.30136:TargetPlatformVersion=10.0.19041.0: 2 | Release|x64|G:\HalfPeopleStudioC++ Porject\VideoImgui\| 3 | -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/VideoImgui.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/VideoImgui.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/VideoImgui.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/VideoImgui.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/VideoImgui.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/VideoImgui.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/imgui.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/imgui.obj -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/imgui_demo.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/imgui_demo.obj -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/imgui_draw.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/imgui_draw.obj -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/imgui_impl_glfw.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/imgui_impl_glfw.obj -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/imgui_impl_opengl3.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/imgui_impl_opengl3.obj -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/imgui_tables.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/imgui_tables.obj -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/imgui_widgets.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/imgui_widgets.obj -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/main.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/main.obj -------------------------------------------------------------------------------- /VideoImgui/VideoImgui/x64/Release/vc142.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/VideoImgui/x64/Release/vc142.pdb -------------------------------------------------------------------------------- /VideoImgui/x64/Release/VideoImgui.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/x64/Release/VideoImgui.exe -------------------------------------------------------------------------------- /VideoImgui/x64/Release/VideoImgui.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/x64/Release/VideoImgui.pdb -------------------------------------------------------------------------------- /VideoImgui/x64/Release/glew32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/x64/Release/glew32.dll -------------------------------------------------------------------------------- /VideoImgui/x64/Release/glfw3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/x64/Release/glfw3.dll -------------------------------------------------------------------------------- /VideoImgui/x64/Release/kaiu.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Half-People/Video-ImGuiCode/277c425622e91d351e5dae463c1455ed9d278d34/VideoImgui/x64/Release/kaiu.ttf --------------------------------------------------------------------------------