// dear imgui: Renderer Backend for SDL_Renderer for SDL2
2
// (Requires: SDL 2.0.17+)
3
4
// Note how SDL_Renderer is an _optional_ component of SDL2.
5
// For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX.
6
// If your application will want to render any non trivial amount of graphics other than UI,
7
// please be aware that SDL_Renderer currently offers a limited graphic API to the end-user and
8
// it might be difficult to step out of those boundaries.
9
10
// Implemented features:
11
// [X] Renderer: User texture binding. Use 'SDL_Texture*' as ImTextureID. Read the FAQ about ImTextureID!
12
// [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices.
13
// [X] Renderer: Expose selected render state for draw callbacks to use. Access in '(ImGui_ImplXXXX_RenderState*)GetPlatformIO().Renderer_RenderState'.
14
// Missing features:
15
// [ ] Renderer: Multi-viewport support (multiple windows).
16
17
// You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
18
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
19
// Learn about Dear ImGui:
20
// - FAQ https://dearimgui.com/faq
21
// - Getting Started https://dearimgui.com/getting-started
22
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
23
// - Introduction, links and more at the top of imgui.cpp
24
25
// CHANGELOG
26
// 2024-10-09: Expose selected render state in ImGui_ImplSDLRenderer2_RenderState, which you can access in 'void* platform_io.Renderer_RenderState' during draw callbacks.
27
// 2024-05-14: *BREAKING CHANGE* ImGui_ImplSDLRenderer3_RenderDrawData() requires SDL_Renderer* passed as parameter.
28
// 2023-05-30: Renamed imgui_impl_sdlrenderer.h/.cpp to imgui_impl_sdlrenderer2.h/.cpp to accommodate for upcoming SDL3.
29
// 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.
30
// 2021-12-21: Update SDL_RenderGeometryRaw() format to work with SDL 2.0.19.
31
// 2021-12-03: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
32
// 2021-10-06: Backup and restore modified ClipRect/Viewport.
// Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts
61
// It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.
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.
230
231
// Upload texture to graphics system
232
// (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)