imgui_impl_opengl2.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // dear imgui: Renderer Backend for OpenGL2 (legacy OpenGL, fixed pipeline)
  2. // This needs to be used along with a Platform Backend (e.g. GLFW, SDL, Win32, custom..)
  3. // Implemented features:
  4. // [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture as texture identifier. Read the FAQ about ImTextureID/ImTextureRef!
  5. // [X] Renderer: Texture updates support for dynamic font atlas (ImGuiBackendFlags_RendererHasTextures).
  6. // Missing features or Issues:
  7. // [ ] Renderer: Large meshes support (64k+ vertices) even with 16-bit indices (ImGuiBackendFlags_RendererHasVtxOffset).
  8. // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
  9. // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
  10. // Learn about Dear ImGui:
  11. // - FAQ https://dearimgui.com/faq
  12. // - Getting Started https://dearimgui.com/getting-started
  13. // - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
  14. // - Introduction, links and more at the top of imgui.cpp
  15. // **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
  16. // **Prefer using the code in imgui_impl_opengl3.cpp**
  17. // This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read.
  18. // If your code is using GL3+ context or any semi modern OpenGL calls, using this is likely to make everything more
  19. // complicated, will require your code to reset every single OpenGL attributes to their initial state, and might
  20. // confuse your GPU driver.
  21. // The GL2 code is unable to reset attributes or even call e.g. "glUseProgram(0)" because they don't exist in that API.
  22. #pragma once
  23. #include "imgui.h" // IMGUI_IMPL_API
  24. #ifndef IMGUI_DISABLE
  25. // Follow "Getting Started" link and check examples/ folder to learn about using backends!
  26. IMGUI_IMPL_API bool ImGui_ImplOpenGL2_Init();
  27. IMGUI_IMPL_API void ImGui_ImplOpenGL2_Shutdown();
  28. IMGUI_IMPL_API void ImGui_ImplOpenGL2_NewFrame();
  29. IMGUI_IMPL_API void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data);
  30. // Called by Init/NewFrame/Shutdown
  31. IMGUI_IMPL_API bool ImGui_ImplOpenGL2_CreateDeviceObjects();
  32. IMGUI_IMPL_API void ImGui_ImplOpenGL2_DestroyDeviceObjects();
  33. // (Advanced) Use e.g. if you need to precisely control the timing of texture updates (e.g. for staged rendering), by setting ImDrawData::Textures = NULL to handle this manually.
  34. IMGUI_IMPL_API void ImGui_ImplOpenGL2_UpdateTexture(ImTextureData* tex);
  35. #endif // #ifndef IMGUI_DISABLE