imgui_impl_opengl3.cpp
Go to the documentation of this file.
1 // dear imgui: Renderer 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 Binding (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: Desktop GL only: Support for large meshes (64k+ vertices) with 16-bit indices.
9 
10 // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
11 // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
12 // https://github.com/ocornut/imgui
13 
14 // CHANGELOG
15 // (minor and older changes stripped away, please see git history for details)
16 // 2020-03-24: OpenGL: Added support for glbinding 2.x OpenGL loader.
17 // 2020-01-07: OpenGL: Added support for glbinding 3.x OpenGL loader.
18 // 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.
19 // 2019-09-22: OpenGL: Detect default GL loader using __has_include compiler facility.
20 // 2019-09-16: OpenGL: Tweak initialization code to allow application calling ImGui_ImplOpenGL3_CreateFontsTexture() before the first NewFrame() call.
21 // 2019-05-29: OpenGL: Desktop GL only: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
22 // 2019-04-30: OpenGL: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
23 // 2019-03-29: OpenGL: Not calling glBindBuffer more than necessary in the render loop.
24 // 2019-03-15: OpenGL: Added a dummy GL call + comments in ImGui_ImplOpenGL3_Init() to detect uninitialized GL function loaders early.
25 // 2019-03-03: OpenGL: Fix support for ES 2.0 (WebGL 1.0).
26 // 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.
27 // 2019-02-11: OpenGL: Projecting clipping rectangles correctly using draw_data->FramebufferScale to allow multi-viewports for retina display.
28 // 2019-02-01: OpenGL: Using GLSL 410 shaders for any version over 410 (e.g. 430, 450).
29 // 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
30 // 2018-11-13: OpenGL: Support for GL 4.5's glClipControl(GL_UPPER_LEFT) / GL_CLIP_ORIGIN.
31 // 2018-08-29: OpenGL: Added support for more OpenGL loaders: glew and glad, with comments indicative that any loader can be used.
32 // 2018-08-09: OpenGL: Default to OpenGL ES 3 on iOS and Android. GLSL version default to "#version 300 ES".
33 // 2018-07-30: OpenGL: Support for GLSL 300 ES and 410 core. Fixes for Emscripten compilation.
34 // 2018-07-10: OpenGL: Support for more GLSL versions (based on the GLSL version string). Added error output when shaders fail to compile/link.
35 // 2018-06-08: Misc: Extracted imgui_impl_opengl3.cpp/.h away from the old combined GLFW/SDL+OpenGL3 examples.
36 // 2018-06-08: OpenGL: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
37 // 2018-05-25: OpenGL: Removed unnecessary backup/restore of GL_ELEMENT_ARRAY_BUFFER_BINDING since this is part of the VAO state.
38 // 2018-05-14: OpenGL: Making the call to glBindSampler() optional so 3.2 context won't fail if the function is a NULL pointer.
39 // 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".
40 // 2018-02-23: OpenGL: Create the VAO in the render function so the setup can more easily be used with multiple shared GL context.
41 // 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplSdlGL3_RenderDrawData() in the .h file so you can call it yourself.
42 // 2018-01-07: OpenGL: Changed GLSL shader version from 330 to 150.
43 // 2017-09-01: OpenGL: Save and restore current bound sampler. Save and restore current polygon mode.
44 // 2017-05-01: OpenGL: Fixed save and restore of current blend func state.
45 // 2017-05-01: OpenGL: Fixed save and restore of current GL_ACTIVE_TEXTURE.
46 // 2016-09-05: OpenGL: Fixed save and restore of current scissor rectangle.
47 // 2016-07-29: OpenGL: Explicitly setting GL_UNPACK_ROW_LENGTH to reduce issues because SDL changes it. (#752)
48 
49 //----------------------------------------
50 // OpenGL GLSL GLSL
51 // version version string
52 //----------------------------------------
53 // 2.0 110 "#version 110"
54 // 2.1 120 "#version 120"
55 // 3.0 130 "#version 130"
56 // 3.1 140 "#version 140"
57 // 3.2 150 "#version 150"
58 // 3.3 330 "#version 330 core"
59 // 4.0 400 "#version 400 core"
60 // 4.1 410 "#version 410 core"
61 // 4.2 420 "#version 410 core"
62 // 4.3 430 "#version 430 core"
63 // ES 2.0 100 "#version 100" = WebGL 1.0
64 // ES 3.0 300 "#version 300 es" = WebGL 2.0
65 //----------------------------------------
66 
67 #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
68 #define _CRT_SECURE_NO_WARNINGS
69 #endif
70 
71 #include "imgui.h"
72 #include "imgui_impl_opengl3.h"
73 #include <stdio.h>
74 #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
75 #include <stddef.h> // intptr_t
76 #else
77 #include <stdint.h> // intptr_t
78 #endif
79 #if defined(__APPLE__)
80 #include "TargetConditionals.h"
81 #endif
82 
83 // Auto-enable GLES on matching platforms
84 #if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3)
85 #if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) || (defined(__ANDROID__))
86 #define IMGUI_IMPL_OPENGL_ES3 // iOS, Android -> GL ES 3, "#version 300 es"
87 #elif defined(__EMSCRIPTEN__)
88 #define IMGUI_IMPL_OPENGL_ES2 // Emscripten -> GL ES 2, "#version 100"
89 #endif
90 #endif
91 
92 #if defined(IMGUI_IMPL_OPENGL_ES2) || defined(IMGUI_IMPL_OPENGL_ES3)
93 #undef IMGUI_IMPL_OPENGL_LOADER_GL3W
94 #undef IMGUI_IMPL_OPENGL_LOADER_GLEW
95 #undef IMGUI_IMPL_OPENGL_LOADER_GLAD
96 #undef IMGUI_IMPL_OPENGL_LOADER_GLBINDING2
97 #undef IMGUI_IMPL_OPENGL_LOADER_GLBINDING3
98 #undef IMGUI_IMPL_OPENGL_LOADER_CUSTOM
99 #endif
100 
101 // GL includes
102 #if defined(IMGUI_IMPL_OPENGL_ES2)
103 #include <GLES2/gl2.h>
104 #elif defined(IMGUI_IMPL_OPENGL_ES3)
105 #if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV))
106 #include <OpenGLES/ES3/gl.h> // Use GL ES 3
107 #else
108 #include <GLES3/gl3.h> // Use GL ES 3
109 #endif
110 #else
111 // About Desktop OpenGL function loaders:
112 // Modern desktop OpenGL doesn't have a standard portable header file to load OpenGL function pointers.
113 // Helper libraries are often used for this purpose! Here we are supporting a few common ones (gl3w, glew, glad).
114 // You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own.
115 #if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W)
116 #include <GL/gl3w.h> // Needs to be initialized with gl3wInit() in user's code
117 #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW)
118 #include <GL/glew.h> // Needs to be initialized with glewInit() in user's code.
119 #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
120 #include <glad/glad.h> // Needs to be initialized with gladLoadGL() in user's code.
121 #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING2)
122 #define GLFW_INCLUDE_NONE // GLFW including OpenGL headers causes ambiguity or multiple definition errors.
123 #include <glbinding/Binding.h> // Needs to be initialized with glbinding::Binding::initialize() in user's code.
124 #include <glbinding/gl/gl.h>
125 using namespace gl;
126 #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING3)
127 #define GLFW_INCLUDE_NONE // GLFW including OpenGL headers causes ambiguity or multiple definition errors.
128 #include <glbinding/glbinding.h>// Needs to be initialized with glbinding::initialize() in user's code.
129 #include <glbinding/gl/gl.h>
130 using namespace gl;
131 #else
132 #include IMGUI_IMPL_OPENGL_LOADER_CUSTOM
133 #endif
134 #endif
135 
136 // Desktop GL 3.2+ has glDrawElementsBaseVertex() which GL ES and WebGL don't have.
137 #if defined(IMGUI_IMPL_OPENGL_ES2) || defined(IMGUI_IMPL_OPENGL_ES3) || !defined(GL_VERSION_3_2)
138 #define IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET 0
139 #else
140 #define IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET 1
141 #endif
142 
143 // OpenGL Data
144 static GLuint g_GlVersion = 0; // Extracted at runtime using GL_MAJOR_VERSION, GL_MINOR_VERSION queries.
145 static char g_GlslVersionString[32] = ""; // Specified by user or detected based on compile time GL settings.
148 static int g_AttribLocationTex = 0, g_AttribLocationProjMtx = 0; // Uniforms location
149 static int g_AttribLocationVtxPos = 0, g_AttribLocationVtxUV = 0, g_AttribLocationVtxColor = 0; // Vertex attributes location
150 static unsigned int g_VboHandle = 0, g_ElementsHandle = 0;
151 
152 // Functions
153 bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
154 {
155  // Query for GL version
156 #if !defined(IMGUI_IMPL_OPENGL_ES2)
157  GLint major, minor;
160  g_GlVersion = major * 1000 + minor;
161 #else
162  g_GlVersion = 2000; // GLES 2
163 #endif
164 
165  // Setup back-end capabilities flags
166  ImGuiIO& io = ImGui::GetIO();
167  io.BackendRendererName = "imgui_impl_opengl3";
168 #if IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET
169  if (g_GlVersion >= 3200)
170  io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
171 #endif
172 
173  // Store GLSL version string so we can refer to it later in case we recreate shaders.
174  // Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure.
175 #if defined(IMGUI_IMPL_OPENGL_ES2)
176  if (glsl_version == NULL)
177  glsl_version = "#version 100";
178 #elif defined(IMGUI_IMPL_OPENGL_ES3)
179  if (glsl_version == NULL)
180  glsl_version = "#version 300 es";
181 #else
182  if (glsl_version == NULL)
183  glsl_version = "#version 130";
184 #endif
185  IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(g_GlslVersionString));
186  strcpy(g_GlslVersionString, glsl_version);
187  strcat(g_GlslVersionString, "\n");
188 
189  // Dummy construct to make it easily visible in the IDE and debugger which GL loader has been selected.
190  // The code actually never uses the 'gl_loader' variable! It is only here so you can read it!
191  // If auto-detection fails or doesn't select the same GL loader file as used by your application,
192  // you are likely to get a crash below.
193  // You can explicitly select a loader by using '#define IMGUI_IMPL_OPENGL_LOADER_XXX' in imconfig.h or compiler command-line.
194  const char* gl_loader = "Unknown";
195  IM_UNUSED(gl_loader);
196 #if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W)
197  gl_loader = "GL3W";
198 #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW)
199  gl_loader = "GLEW";
200 #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
201  gl_loader = "GLAD";
202 #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING2)
203  gl_loader = "glbinding2";
204 #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING3)
205  gl_loader = "glbinding3";
206 #elif defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM)
207  gl_loader = "custom";
208 #else
209  gl_loader = "none";
210 #endif
211 
212  // Make a dummy GL call (we don't actually need the result)
213  // IF YOU GET A CRASH HERE: it probably means that you haven't initialized the OpenGL function loader used by this code.
214  // Desktop OpenGL 3/4 need a function loader. See the IMGUI_IMPL_OPENGL_LOADER_xxx explanation above.
215  GLint current_texture;
216  glGetIntegerv(GL_TEXTURE_BINDING_2D, &current_texture);
217 
218  return true;
219 }
220 
222 {
224 }
225 
227 {
228  if (!g_ShaderHandle)
230 }
231 
232 static void ImGui_ImplOpenGL3_SetupRenderState(ImDrawData* draw_data, int fb_width, int fb_height, GLuint vertex_array_object)
233 {
234  // Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill
241 #ifdef GL_POLYGON_MODE
243 #endif
244 
245  // Setup viewport, orthographic projection matrix
246  // 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.
247  glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height);
248  float L = draw_data->DisplayPos.x;
249  float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;
250  float T = draw_data->DisplayPos.y;
251  float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y;
252  const float ortho_projection[4][4] =
253  {
254  { 2.0f/(R-L), 0.0f, 0.0f, 0.0f },
255  { 0.0f, 2.0f/(T-B), 0.0f, 0.0f },
256  { 0.0f, 0.0f, -1.0f, 0.0f },
257  { (R+L)/(L-R), (T+B)/(B-T), 0.0f, 1.0f },
258  };
261  glUniformMatrix4fv(g_AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0]);
262 #ifdef GL_SAMPLER_BINDING
263  glBindSampler(0, 0); // We use combined texture/sampler state. Applications using GL 3.3 may set that otherwise.
264 #endif
265 
266  (void)vertex_array_object;
267 #ifndef IMGUI_IMPL_OPENGL_ES2
268  glBindVertexArray(vertex_array_object);
269 #endif
270 
271  // Bind vertex/index buffers and setup attributes for ImDrawVert
280 }
281 
282 // OpenGL3 Render function.
283 // (this used to be set in io.RenderDrawListsFn and called by ImGui::Render(), but you can now call this directly from your main loop)
284 // Note that this implementation is little overcomplicated because we are saving/setting up/restoring every OpenGL state explicitly, in order to be able to run within any OpenGL engine that doesn't do so.
286 {
287  // Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
288  int fb_width = (int)(draw_data->DisplaySize.x * draw_data->FramebufferScale.x);
289  int fb_height = (int)(draw_data->DisplaySize.y * draw_data->FramebufferScale.y);
290  if (fb_width <= 0 || fb_height <= 0)
291  return;
292 
293  // Backup GL state
294  GLenum last_active_texture; glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint*)&last_active_texture);
296  GLint last_program; glGetIntegerv(GL_CURRENT_PROGRAM, &last_program);
297  GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
298 #ifdef GL_SAMPLER_BINDING
299  GLint last_sampler; glGetIntegerv(GL_SAMPLER_BINDING, &last_sampler);
300 #endif
301  GLint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer);
302 #ifndef IMGUI_IMPL_OPENGL_ES2
303  GLint last_vertex_array_object; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array_object);
304 #endif
305 #ifdef GL_POLYGON_MODE
306  GLint last_polygon_mode[2]; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode);
307 #endif
308  GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
309  GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box);
310  GLenum last_blend_src_rgb; glGetIntegerv(GL_BLEND_SRC_RGB, (GLint*)&last_blend_src_rgb);
311  GLenum last_blend_dst_rgb; glGetIntegerv(GL_BLEND_DST_RGB, (GLint*)&last_blend_dst_rgb);
312  GLenum last_blend_src_alpha; glGetIntegerv(GL_BLEND_SRC_ALPHA, (GLint*)&last_blend_src_alpha);
313  GLenum last_blend_dst_alpha; glGetIntegerv(GL_BLEND_DST_ALPHA, (GLint*)&last_blend_dst_alpha);
314  GLenum last_blend_equation_rgb; glGetIntegerv(GL_BLEND_EQUATION_RGB, (GLint*)&last_blend_equation_rgb);
315  GLenum last_blend_equation_alpha; glGetIntegerv(GL_BLEND_EQUATION_ALPHA, (GLint*)&last_blend_equation_alpha);
316  GLboolean last_enable_blend = glIsEnabled(GL_BLEND);
317  GLboolean last_enable_cull_face = glIsEnabled(GL_CULL_FACE);
318  GLboolean last_enable_depth_test = glIsEnabled(GL_DEPTH_TEST);
319  GLboolean last_enable_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
320  bool clip_origin_lower_left = true;
321 #if defined(GL_CLIP_ORIGIN) && !defined(__APPLE__)
322  GLenum last_clip_origin = 0; glGetIntegerv(GL_CLIP_ORIGIN, (GLint*)&last_clip_origin); // Support for GL 4.5's glClipControl(GL_UPPER_LEFT)
323  if (last_clip_origin == GL_UPPER_LEFT)
324  clip_origin_lower_left = false;
325 #endif
326 
327  // Setup desired GL state
328  // Recreate the VAO every time (this is to easily allow multiple GL contexts to be rendered to. VAO are not shared among GL contexts)
329  // The renderer would actually work without any VAO bound, but then our VertexAttrib calls would overwrite the default one currently bound.
330  GLuint vertex_array_object = 0;
331 #ifndef IMGUI_IMPL_OPENGL_ES2
332  glGenVertexArrays(1, &vertex_array_object);
333 #endif
334  ImGui_ImplOpenGL3_SetupRenderState(draw_data, fb_width, fb_height, vertex_array_object);
335 
336  // Will project scissor/clipping rectangles into framebuffer space
337  ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports
338  ImVec2 clip_scale = draw_data->FramebufferScale; // (1,1) unless using retina display which are often (2,2)
339 
340  // Render command lists
341  for (int n = 0; n < draw_data->CmdListsCount; n++)
342  {
343  const ImDrawList* cmd_list = draw_data->CmdLists[n];
344 
345  // Upload vertex/index buffers
348 
349  for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
350  {
351  const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
352  if (pcmd->UserCallback != NULL)
353  {
354  // User callback, registered via ImDrawList::AddCallback()
355  // (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
357  ImGui_ImplOpenGL3_SetupRenderState(draw_data, fb_width, fb_height, vertex_array_object);
358  else
359  pcmd->UserCallback(cmd_list, pcmd);
360  }
361  else
362  {
363  // Project scissor/clipping rectangles into framebuffer space
364  ImVec4 clip_rect;
365  clip_rect.x = (pcmd->ClipRect.x - clip_off.x) * clip_scale.x;
366  clip_rect.y = (pcmd->ClipRect.y - clip_off.y) * clip_scale.y;
367  clip_rect.z = (pcmd->ClipRect.z - clip_off.x) * clip_scale.x;
368  clip_rect.w = (pcmd->ClipRect.w - clip_off.y) * clip_scale.y;
369 
370  if (clip_rect.x < fb_width && clip_rect.y < fb_height && clip_rect.z >= 0.0f && clip_rect.w >= 0.0f)
371  {
372  // Apply scissor/clipping rectangle
373  if (clip_origin_lower_left)
374  glScissor((int)clip_rect.x, (int)(fb_height - clip_rect.w), (int)(clip_rect.z - clip_rect.x), (int)(clip_rect.w - clip_rect.y));
375  else
376  glScissor((int)clip_rect.x, (int)clip_rect.y, (int)clip_rect.z, (int)clip_rect.w); // Support for GL 4.5 rarely used glClipControl(GL_UPPER_LEFT)
377 
378  // Bind texture, Draw
379  glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId);
380 #if IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET
381  if (g_GlVersion >= 3200)
382  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);
383  else
384 #endif
385  glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx)));
386  }
387  }
388  }
389  }
390 
391  // Destroy the temporary VAO
392 #ifndef IMGUI_IMPL_OPENGL_ES2
393  glDeleteVertexArrays(1, &vertex_array_object);
394 #endif
395 
396  // Restore modified GL state
397  glUseProgram(last_program);
398  glBindTexture(GL_TEXTURE_2D, last_texture);
399 #ifdef GL_SAMPLER_BINDING
400  glBindSampler(0, last_sampler);
401 #endif
402  glActiveTexture(last_active_texture);
403 #ifndef IMGUI_IMPL_OPENGL_ES2
404  glBindVertexArray(last_vertex_array_object);
405 #endif
406  glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer);
407  glBlendEquationSeparate(last_blend_equation_rgb, last_blend_equation_alpha);
408  glBlendFuncSeparate(last_blend_src_rgb, last_blend_dst_rgb, last_blend_src_alpha, last_blend_dst_alpha);
409  if (last_enable_blend) glEnable(GL_BLEND); else glDisable(GL_BLEND);
410  if (last_enable_cull_face) glEnable(GL_CULL_FACE); else glDisable(GL_CULL_FACE);
411  if (last_enable_depth_test) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST);
412  if (last_enable_scissor_test) glEnable(GL_SCISSOR_TEST); else glDisable(GL_SCISSOR_TEST);
413 #ifdef GL_POLYGON_MODE
414  glPolygonMode(GL_FRONT_AND_BACK, (GLenum)last_polygon_mode[0]);
415 #endif
416  glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
417  glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
418 }
419 
421 {
422  // Build texture atlas
423  ImGuiIO& io = ImGui::GetIO();
424  unsigned char* pixels;
425  int width, height;
426  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.
427 
428  // Upload texture to graphics system
429  GLint last_texture;
430  glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
435 #ifdef GL_UNPACK_ROW_LENGTH
437 #endif
439 
440  // Store our identifier
441  io.Fonts->TexID = (ImTextureID)(intptr_t)g_FontTexture;
442 
443  // Restore state
444  glBindTexture(GL_TEXTURE_2D, last_texture);
445 
446  return true;
447 }
448 
450 {
451  if (g_FontTexture)
452  {
453  ImGuiIO& io = ImGui::GetIO();
455  io.Fonts->TexID = 0;
456  g_FontTexture = 0;
457  }
458 }
459 
460 // 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.
461 static bool CheckShader(GLuint handle, const char* desc)
462 {
463  GLint status = 0, log_length = 0;
464  glGetShaderiv(handle, GL_COMPILE_STATUS, &status);
465  glGetShaderiv(handle, GL_INFO_LOG_LENGTH, &log_length);
466  if ((GLboolean)status == GL_FALSE)
467  fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile %s!\n", desc);
468  if (log_length > 1)
469  {
471  buf.resize((int)(log_length + 1));
472  glGetShaderInfoLog(handle, log_length, NULL, (GLchar*)buf.begin());
473  fprintf(stderr, "%s\n", buf.begin());
474  }
475  return (GLboolean)status == GL_TRUE;
476 }
477 
478 // If you get an error please report on GitHub. You may try different GL context version or GLSL version.
479 static bool CheckProgram(GLuint handle, const char* desc)
480 {
481  GLint status = 0, log_length = 0;
482  glGetProgramiv(handle, GL_LINK_STATUS, &status);
483  glGetProgramiv(handle, GL_INFO_LOG_LENGTH, &log_length);
484  if ((GLboolean)status == GL_FALSE)
485  fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to link %s! (with GLSL '%s')\n", desc, g_GlslVersionString);
486  if (log_length > 1)
487  {
489  buf.resize((int)(log_length + 1));
490  glGetProgramInfoLog(handle, log_length, NULL, (GLchar*)buf.begin());
491  fprintf(stderr, "%s\n", buf.begin());
492  }
493  return (GLboolean)status == GL_TRUE;
494 }
495 
497 {
498  // Backup GL state
499  GLint last_texture, last_array_buffer;
500  glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
501  glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer);
502 #ifndef IMGUI_IMPL_OPENGL_ES2
503  GLint last_vertex_array;
504  glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array);
505 #endif
506 
507  // Parse GLSL version string
508  int glsl_version = 130;
509  sscanf(g_GlslVersionString, "#version %d", &glsl_version);
510 
511  const GLchar* vertex_shader_glsl_120 =
512  "uniform mat4 ProjMtx;\n"
513  "attribute vec2 Position;\n"
514  "attribute vec2 UV;\n"
515  "attribute vec4 Color;\n"
516  "varying vec2 Frag_UV;\n"
517  "varying vec4 Frag_Color;\n"
518  "void main()\n"
519  "{\n"
520  " Frag_UV = UV;\n"
521  " Frag_Color = Color;\n"
522  " gl_Position = ProjMtx * vec4(Position.xy,0,1);\n"
523  "}\n";
524 
525  const GLchar* vertex_shader_glsl_130 =
526  "uniform mat4 ProjMtx;\n"
527  "in vec2 Position;\n"
528  "in vec2 UV;\n"
529  "in vec4 Color;\n"
530  "out vec2 Frag_UV;\n"
531  "out vec4 Frag_Color;\n"
532  "void main()\n"
533  "{\n"
534  " Frag_UV = UV;\n"
535  " Frag_Color = Color;\n"
536  " gl_Position = ProjMtx * vec4(Position.xy,0,1);\n"
537  "}\n";
538 
539  const GLchar* vertex_shader_glsl_300_es =
540  "precision mediump float;\n"
541  "layout (location = 0) in vec2 Position;\n"
542  "layout (location = 1) in vec2 UV;\n"
543  "layout (location = 2) in vec4 Color;\n"
544  "uniform mat4 ProjMtx;\n"
545  "out vec2 Frag_UV;\n"
546  "out vec4 Frag_Color;\n"
547  "void main()\n"
548  "{\n"
549  " Frag_UV = UV;\n"
550  " Frag_Color = Color;\n"
551  " gl_Position = ProjMtx * vec4(Position.xy,0,1);\n"
552  "}\n";
553 
554  const GLchar* vertex_shader_glsl_410_core =
555  "layout (location = 0) in vec2 Position;\n"
556  "layout (location = 1) in vec2 UV;\n"
557  "layout (location = 2) in vec4 Color;\n"
558  "uniform mat4 ProjMtx;\n"
559  "out vec2 Frag_UV;\n"
560  "out vec4 Frag_Color;\n"
561  "void main()\n"
562  "{\n"
563  " Frag_UV = UV;\n"
564  " Frag_Color = Color;\n"
565  " gl_Position = ProjMtx * vec4(Position.xy,0,1);\n"
566  "}\n";
567 
568  const GLchar* fragment_shader_glsl_120 =
569  "#ifdef GL_ES\n"
570  " precision mediump float;\n"
571  "#endif\n"
572  "uniform sampler2D Texture;\n"
573  "varying vec2 Frag_UV;\n"
574  "varying vec4 Frag_Color;\n"
575  "void main()\n"
576  "{\n"
577  " gl_FragColor = Frag_Color * texture2D(Texture, Frag_UV.st);\n"
578  "}\n";
579 
580  const GLchar* fragment_shader_glsl_130 =
581  "uniform sampler2D Texture;\n"
582  "in vec2 Frag_UV;\n"
583  "in vec4 Frag_Color;\n"
584  "out vec4 Out_Color;\n"
585  "void main()\n"
586  "{\n"
587  " Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n"
588  "}\n";
589 
590  const GLchar* fragment_shader_glsl_300_es =
591  "precision mediump float;\n"
592  "uniform sampler2D Texture;\n"
593  "in vec2 Frag_UV;\n"
594  "in vec4 Frag_Color;\n"
595  "layout (location = 0) out vec4 Out_Color;\n"
596  "void main()\n"
597  "{\n"
598  " Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n"
599  "}\n";
600 
601  const GLchar* fragment_shader_glsl_410_core =
602  "in vec2 Frag_UV;\n"
603  "in vec4 Frag_Color;\n"
604  "uniform sampler2D Texture;\n"
605  "layout (location = 0) out vec4 Out_Color;\n"
606  "void main()\n"
607  "{\n"
608  " Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n"
609  "}\n";
610 
611  // Select shaders matching our GLSL versions
612  const GLchar* vertex_shader = NULL;
613  const GLchar* fragment_shader = NULL;
614  if (glsl_version < 130)
615  {
616  vertex_shader = vertex_shader_glsl_120;
617  fragment_shader = fragment_shader_glsl_120;
618  }
619  else if (glsl_version >= 410)
620  {
621  vertex_shader = vertex_shader_glsl_410_core;
622  fragment_shader = fragment_shader_glsl_410_core;
623  }
624  else if (glsl_version == 300)
625  {
626  vertex_shader = vertex_shader_glsl_300_es;
627  fragment_shader = fragment_shader_glsl_300_es;
628  }
629  else
630  {
631  vertex_shader = vertex_shader_glsl_130;
632  fragment_shader = fragment_shader_glsl_130;
633  }
634 
635  // Create shaders
636  const GLchar* vertex_shader_with_version[2] = { g_GlslVersionString, vertex_shader };
638  glShaderSource(g_VertHandle, 2, vertex_shader_with_version, NULL);
640  CheckShader(g_VertHandle, "vertex shader");
641 
642  const GLchar* fragment_shader_with_version[2] = { g_GlslVersionString, fragment_shader };
644  glShaderSource(g_FragHandle, 2, fragment_shader_with_version, NULL);
646  CheckShader(g_FragHandle, "fragment shader");
647 
652  CheckProgram(g_ShaderHandle, "shader program");
653 
659 
660  // Create buffers
663 
665 
666  // Restore modified GL state
667  glBindTexture(GL_TEXTURE_2D, last_texture);
668  glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer);
669 #ifndef IMGUI_IMPL_OPENGL_ES2
670  glBindVertexArray(last_vertex_array);
671 #endif
672 
673  return true;
674 }
675 
677 {
685 
687 }
GL_ARRAY_BUFFER
#define GL_ARRAY_BUFFER
Definition: glcorearb.h:468
glEnable
#define glEnable
Definition: gl3w.h:647
glPixelStorei
#define glPixelStorei
Definition: gl3w.h:656
ImDrawData::FramebufferScale
ImVec2 FramebufferScale
Definition: imgui.h:2077
g_AttribLocationTex
static int g_AttribLocationTex
Definition: imgui_impl_opengl3.cpp:148
ImDrawIdx
unsigned short ImDrawIdx
Definition: imgui.h:1888
height
GLint GLsizei GLsizei height
Definition: glcorearb.h:2768
ImDrawCmd::VtxOffset
unsigned int VtxOffset
Definition: imgui.h:1876
ImDrawData::DisplayPos
ImVec2 DisplayPos
Definition: imgui.h:2075
ImGuiIO::Fonts
ImFontAtlas * Fonts
Definition: imgui.h:1435
ImDrawList::IdxBuffer
ImVector< ImDrawIdx > IdxBuffer
Definition: imgui.h:1965
GL_TEXTURE_MIN_FILTER
#define GL_TEXTURE_MIN_FILTER
Definition: glcorearb.h:302
ImFontAtlas::TexID
ImTextureID TexID
Definition: imgui.h:2247
GL_VERTEX_ARRAY_BINDING
#define GL_VERTEX_ARRAY_BINDING
Definition: glcorearb.h:1668
imgui_impl_opengl3.h
ImDrawData::CmdListsCount
int CmdListsCount
Definition: imgui.h:2072
glShaderSource
#define glShaderSource
Definition: gl3w.h:762
GLsizei
int GLsizei
Definition: glcorearb.h:81
glGetShaderInfoLog
#define glGetShaderInfoLog
Definition: gl3w.h:750
NULL
NULL
Definition: test_security_zap.cpp:405
GL_LINK_STATUS
#define GL_LINK_STATUS
Definition: glcorearb.h:555
GL_FLOAT
#define GL_FLOAT
Definition: glcorearb.h:241
GL_FALSE
#define GL_FALSE
Definition: glcorearb.h:100
ImVec4::z
float z
Definition: imgui.h:223
ImGui_ImplOpenGL3_RenderDrawData
void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData *draw_data)
Definition: imgui_impl_opengl3.cpp:285
GLboolean
unsigned char GLboolean
Definition: glcorearb.h:76
GLsizeiptr
ptrdiff_t GLsizeiptr
Definition: glcorearb.h:2615
g_AttribLocationVtxUV
static int g_AttribLocationVtxUV
Definition: imgui_impl_opengl3.cpp:149
g_FontTexture
static GLuint g_FontTexture
Definition: imgui_impl_opengl3.cpp:146
GL_TEXTURE_2D
#define GL_TEXTURE_2D
Definition: glcorearb.h:213
GL_FRAGMENT_SHADER
#define GL_FRAGMENT_SHADER
Definition: glcorearb.h:526
GL_STREAM_DRAW
#define GL_STREAM_DRAW
Definition: glcorearb.h:479
GL_SCISSOR_TEST
#define GL_SCISSOR_TEST
Definition: glcorearb.h:190
ImGui_ImplOpenGL3_DestroyFontsTexture
void ImGui_ImplOpenGL3_DestroyFontsTexture()
Definition: imgui_impl_opengl3.cpp:449
GL_ACTIVE_TEXTURE
#define GL_ACTIVE_TEXTURE
Definition: glcorearb.h:413
glGetIntegerv
#define glGetIntegerv
Definition: gl3w.h:663
ImDrawData::CmdLists
ImDrawList ** CmdLists
Definition: imgui.h:2071
g_AttribLocationProjMtx
static int g_AttribLocationProjMtx
Definition: imgui_impl_opengl3.cpp:148
glVertexAttribPointer
#define glVertexAttribPointer
Definition: gl3w.h:820
GLuint
unsigned int GLuint
Definition: glcorearb.h:84
glDeleteShader
#define glDeleteShader
Definition: gl3w.h:739
desc
#define desc
Definition: extension_set.h:342
GL_BLEND_EQUATION_ALPHA
#define GL_BLEND_EQUATION_ALPHA
Definition: glcorearb.h:522
ImDrawList
Definition: imgui.h:1961
ImTextureID
void * ImTextureID
Definition: imgui.h:172
GL_POLYGON_MODE
#define GL_POLYGON_MODE
Definition: glcorearb.h:161
imgui.h
glViewport
#define glViewport
Definition: gl3w.h:672
ImGui_ImplOpenGL3_Shutdown
void ImGui_ImplOpenGL3_Shutdown()
Definition: imgui_impl_opengl3.cpp:221
glGetProgramInfoLog
#define glGetProgramInfoLog
Definition: gl3w.h:748
ImVector< char >
ImGui_ImplOpenGL3_Init
bool ImGui_ImplOpenGL3_Init(const char *glsl_version)
Definition: imgui_impl_opengl3.cpp:153
ImGui_ImplOpenGL3_CreateDeviceObjects
bool ImGui_ImplOpenGL3_CreateDeviceObjects()
Definition: imgui_impl_opengl3.cpp:496
g_GlslVersionString
static char g_GlslVersionString[32]
Definition: imgui_impl_opengl3.cpp:145
GL_TEXTURE_BINDING_2D
#define GL_TEXTURE_BINDING_2D
Definition: glcorearb.h:220
GL_UNSIGNED_SHORT
#define GL_UNSIGNED_SHORT
Definition: glcorearb.h:238
GLvoid
void GLvoid
Definition: glcorearb.h:90
GL_BLEND_SRC_ALPHA
#define GL_BLEND_SRC_ALPHA
Definition: glcorearb.h:446
glGetAttribLocation
#define glGetAttribLocation
Definition: gl3w.h:746
GL_BLEND_EQUATION_RGB
#define GL_BLEND_EQUATION_RGB
Definition: glcorearb.h:493
ImVec2
Definition: imgui.h:208
GLchar
char GLchar
Definition: glcorearb.h:2609
ImGui::GetIO
IMGUI_API ImGuiIO & GetIO()
Definition: imgui.cpp:3286
IM_UNUSED
#define IM_UNUSED(_VAR)
Definition: imgui.h:89
glGetShaderiv
#define glGetShaderiv
Definition: gl3w.h:749
T
#define T(upbtypeconst, upbtype, ctype, default_value)
glGetProgramiv
#define glGetProgramiv
Definition: gl3w.h:747
GL_FRONT_AND_BACK
#define GL_FRONT_AND_BACK
Definition: glcorearb.h:143
glAttachShader
#define glAttachShader
Definition: gl3w.h:733
ImDrawList::CmdBuffer
ImVector< ImDrawCmd > CmdBuffer
Definition: imgui.h:1964
ImDrawCmd
Definition: imgui.h:1871
GL_FILL
#define GL_FILL
Definition: glcorearb.h:281
ImDrawCmd::TextureId
ImTextureID TextureId
Definition: imgui.h:1875
GL_UNPACK_ROW_LENGTH
#define GL_UNPACK_ROW_LENGTH
Definition: glcorearb.h:199
GL_UNSIGNED_BYTE
#define GL_UNSIGNED_BYTE
Definition: glcorearb.h:236
glTexImage2D
#define glTexImage2D
Definition: gl3w.h:637
ImDrawCmd::UserCallback
ImDrawCallback UserCallback
Definition: imgui.h:1878
glGetUniformLocation
#define glGetUniformLocation
Definition: gl3w.h:752
ImVec4::y
float y
Definition: imgui.h:223
g_AttribLocationVtxPos
static int g_AttribLocationVtxPos
Definition: imgui_impl_opengl3.cpp:149
glEnableVertexAttribArray
#define glEnableVertexAttribArray
Definition: gl3w.h:742
GL_BLEND_SRC_RGB
#define GL_BLEND_SRC_RGB
Definition: glcorearb.h:444
GL_BLEND_DST_ALPHA
#define GL_BLEND_DST_ALPHA
Definition: glcorearb.h:445
glIsEnabled
#define glIsEnabled
Definition: gl3w.h:670
ImVector::Data
T * Data
Definition: imgui.h:1305
GL_UPPER_LEFT
#define GL_UPPER_LEFT
Definition: glcorearb.h:569
GLenum
unsigned int GLenum
Definition: glcorearb.h:75
glBindTexture
#define glBindTexture
Definition: gl3w.h:683
glDeleteTextures
#define glDeleteTextures
Definition: gl3w.h:684
glTexParameteri
#define glTexParameteri
Definition: gl3w.h:634
glDrawElements
#define glDrawElements
Definition: gl3w.h:674
ImDrawData
Definition: imgui.h:2068
ImVector::Size
int Size
Definition: imgui.h:1303
ImDrawVert
Definition: imgui.h:1893
ImVec2::x
float x
Definition: imgui.h:210
gl3w.h
glDrawElementsBaseVertex
#define glDrawElementsBaseVertex
Definition: gl3w.h:932
glDeleteProgram
#define glDeleteProgram
Definition: gl3w.h:738
ImDrawCmd::ClipRect
ImVec4 ClipRect
Definition: imgui.h:1874
GL_TEXTURE_MAG_FILTER
#define GL_TEXTURE_MAG_FILTER
Definition: glcorearb.h:301
glPolygonMode
#define glPolygonMode
Definition: gl3w.h:630
glUniformMatrix4fv
#define glUniformMatrix4fv
Definition: gl3w.h:782
IM_OFFSETOF
#define IM_OFFSETOF(_TYPE, _MEMBER)
Definition: imgui.h:93
major
int major
Definition: gl3w.c:93
glActiveTexture
#define glActiveTexture
Definition: gl3w.h:693
GL_BLEND
#define GL_BLEND
Definition: glcorearb.h:184
IM_ARRAYSIZE
#define IM_ARRAYSIZE(_ARR)
Definition: imgui.h:88
GL_MINOR_VERSION
#define GL_MINOR_VERSION
Definition: glcorearb.h:606
GL_ELEMENT_ARRAY_BUFFER
#define GL_ELEMENT_ARRAY_BUFFER
Definition: glcorearb.h:469
GL_VIEWPORT
#define GL_VIEWPORT
Definition: glcorearb.h:180
glBlendEquation
#define glBlendEquation
Definition: gl3w.h:688
g_AttribLocationVtxColor
static int g_AttribLocationVtxColor
Definition: imgui_impl_opengl3.cpp:149
GL_INFO_LOG_LENGTH
#define GL_INFO_LOG_LENGTH
Definition: glcorearb.h:557
GL_SAMPLER_BINDING
#define GL_SAMPLER_BINDING
Definition: glcorearb.h:1837
g_VboHandle
static unsigned int g_VboHandle
Definition: imgui_impl_opengl3.cpp:150
glUseProgram
#define glUseProgram
Definition: gl3w.h:763
GL_ARRAY_BUFFER_BINDING
#define GL_ARRAY_BUFFER_BINDING
Definition: glcorearb.h:470
ImVec4::x
float x
Definition: imgui.h:223
ImGui_ImplOpenGL3_SetupRenderState
static void ImGui_ImplOpenGL3_SetupRenderState(ImDrawData *draw_data, int fb_width, int fb_height, GLuint vertex_array_object)
Definition: imgui_impl_opengl3.cpp:232
buf
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:4175
glCreateShader
#define glCreateShader
Definition: gl3w.h:737
glBlendEquationSeparate
#define glBlendEquationSeparate
Definition: gl3w.h:728
ImGuiBackendFlags_RendererHasVtxOffset
@ ImGuiBackendFlags_RendererHasVtxOffset
Definition: imgui.h:1080
GL_UNSIGNED_INT
#define GL_UNSIGNED_INT
Definition: glcorearb.h:240
void
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
n
GLdouble n
Definition: glcorearb.h:4153
glBindSampler
#define glBindSampler
Definition: gl3w.h:964
ImDrawList::VtxBuffer
ImVector< ImDrawVert > VtxBuffer
Definition: imgui.h:1966
minor
int minor
Definition: gl3w.c:93
GL_CULL_FACE
#define GL_CULL_FACE
Definition: glcorearb.h:163
GL_MAJOR_VERSION
#define GL_MAJOR_VERSION
Definition: glcorearb.h:605
glLinkProgram
#define glLinkProgram
Definition: gl3w.h:761
glDeleteVertexArrays
#define glDeleteVertexArrays
Definition: gl3w.h:921
glBindVertexArray
#define glBindVertexArray
Definition: gl3w.h:920
GL_TEXTURE0
#define GL_TEXTURE0
Definition: glcorearb.h:381
glCompileShader
#define glCompileShader
Definition: gl3w.h:735
glBlendFuncSeparate
#define glBlendFuncSeparate
Definition: gl3w.h:702
GL_VERTEX_SHADER
#define GL_VERTEX_SHADER
Definition: glcorearb.h:527
glDeleteBuffers
#define glDeleteBuffers
Definition: gl3w.h:718
GL_TRUE
#define GL_TRUE
Definition: glcorearb.h:101
glGenTextures
#define glGenTextures
Definition: gl3w.h:685
GL_ONE_MINUS_SRC_ALPHA
#define GL_ONE_MINUS_SRC_ALPHA
Definition: glcorearb.h:126
glCreateProgram
#define glCreateProgram
Definition: gl3w.h:736
CheckProgram
static bool CheckProgram(GLuint handle, const char *desc)
Definition: imgui_impl_opengl3.cpp:479
g_ElementsHandle
static unsigned int g_ElementsHandle
Definition: imgui_impl_opengl3.cpp:150
ImVec4::w
float w
Definition: imgui.h:223
glScissor
#define glScissor
Definition: gl3w.h:631
glDisable
#define glDisable
Definition: gl3w.h:646
GL_RGBA
#define GL_RGBA
Definition: glcorearb.h:277
ImDrawCallback_ResetRenderState
#define ImDrawCallback_ResetRenderState
Definition: imgui.h:1866
ImGuiIO::BackendRendererName
const char * BackendRendererName
Definition: imgui.h:1456
g_VertHandle
static GLuint g_VertHandle
Definition: imgui_impl_opengl3.cpp:147
glBufferData
#define glBufferData
Definition: gl3w.h:721
ImGuiIO
Definition: imgui.h:1414
GL_FUNC_ADD
#define GL_FUNC_ADD
Definition: glcorearb.h:372
GL_TRIANGLES
#define GL_TRIANGLES
Definition: glcorearb.h:107
glDetachShader
#define glDetachShader
Definition: gl3w.h:740
ImVec4
Definition: imgui.h:221
GL_LINEAR
#define GL_LINEAR
Definition: glcorearb.h:294
GL_DEPTH_TEST
#define GL_DEPTH_TEST
Definition: glcorearb.h:167
glBindBuffer
#define glBindBuffer
Definition: gl3w.h:717
ImGui_ImplOpenGL3_DestroyDeviceObjects
void ImGui_ImplOpenGL3_DestroyDeviceObjects()
Definition: imgui_impl_opengl3.cpp:676
glGenVertexArrays
#define glGenVertexArrays
Definition: gl3w.h:922
IM_ASSERT
#define IM_ASSERT(_EXPR)
Definition: imgui.h:79
ImGui_ImplOpenGL3_NewFrame
void ImGui_ImplOpenGL3_NewFrame()
Definition: imgui_impl_opengl3.cpp:226
ImDrawData::DisplaySize
ImVec2 DisplaySize
Definition: imgui.h:2076
f
GLfloat f
Definition: glcorearb.h:3964
ImDrawCmd::IdxOffset
unsigned int IdxOffset
Definition: imgui.h:1877
GL_COMPILE_STATUS
#define GL_COMPILE_STATUS
Definition: glcorearb.h:554
GL_SCISSOR_BOX
#define GL_SCISSOR_BOX
Definition: glcorearb.h:189
g_GlVersion
static GLuint g_GlVersion
Definition: imgui_impl_opengl3.cpp:144
pixels
GLint GLint GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: glcorearb.h:2773
CheckShader
static bool CheckShader(GLuint handle, const char *desc)
Definition: imgui_impl_opengl3.cpp:461
GL_BLEND_DST_RGB
#define GL_BLEND_DST_RGB
Definition: glcorearb.h:443
glUniform1i
#define glUniform1i
Definition: gl3w.h:768
GL_CURRENT_PROGRAM
#define GL_CURRENT_PROGRAM
Definition: glcorearb.h:566
ImGui_ImplOpenGL3_CreateFontsTexture
bool ImGui_ImplOpenGL3_CreateFontsTexture()
Definition: imgui_impl_opengl3.cpp:420
ImGuiIO::BackendFlags
ImGuiBackendFlags BackendFlags
Definition: imgui.h:1421
g_ShaderHandle
static GLuint g_ShaderHandle
Definition: imgui_impl_opengl3.cpp:147
GL_SRC_ALPHA
#define GL_SRC_ALPHA
Definition: glcorearb.h:125
g_FragHandle
static GLuint g_FragHandle
Definition: imgui_impl_opengl3.cpp:147
glGenBuffers
#define glGenBuffers
Definition: gl3w.h:719
GLint
int GLint
Definition: glcorearb.h:80
ImVec2::y
float y
Definition: imgui.h:210
width
GLint GLsizei width
Definition: glcorearb.h:2768
ImDrawCmd::ElemCount
unsigned int ElemCount
Definition: imgui.h:1873
glBlendFunc
#define glBlendFunc
Definition: gl3w.h:650
ImFontAtlas::GetTexDataAsRGBA32
IMGUI_API void GetTexDataAsRGBA32(unsigned char **out_pixels, int *out_width, int *out_height, int *out_bytes_per_pixel=NULL)
Definition: imgui_draw.cpp:1679


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:54