Viewport, Platform: Added void* to render/swap buffer functions. Comments. (#1542, #1042)

This commit is contained in:
omar
2018-03-19 15:20:47 +01:00
parent 0e09032750
commit 2fecd332fc
24 changed files with 71 additions and 48 deletions

View File

@ -208,9 +208,9 @@ int main(int, char**)
ImGui::Render();
ImGui_ImplDX10_RenderDrawData(ImGui::GetDrawData());
// Update and Render additional Platform Windows
// Update and Render additional Platform Windows (when ImGuiConfigFlags_EnableViewports is enabled)
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindows();
ImGui::RenderPlatformWindows(NULL, NULL);
g_pSwapChain->Present(1, 0); // Present with vsync
//g_pSwapChain->Present(0, 0); // Present without vsync

View File

@ -226,9 +226,9 @@ int main(int, char**)
ImGui::Render();
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
// Update and Render additional Platform Windows
// Update and Render additional Platform Windows (when ImGuiConfigFlags_EnableViewports is enabled)
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindows();
ImGui::RenderPlatformWindows(NULL, NULL);
g_pSwapChain->Present(1, 0); // Present with vsync
//g_pSwapChain->Present(0, 0); // Present without vsync

View File

@ -401,9 +401,9 @@ int main(int, char**)
g_pd3dCommandQueue->ExecuteCommandLists(1, (ID3D12CommandList* const*)&g_pd3dCommandList);
// Update and Render additional Platform Windows
// Update and Render additional Platform Windows (when ImGuiConfigFlags_EnableViewports is enabled)
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindows();
ImGui::RenderPlatformWindows(NULL, NULL);
g_pSwapChain->Present(1, 0); // Present with vsync
//g_pSwapChain->Present(0, 0); // Present without vsync

View File

@ -3,6 +3,7 @@
// Implemented features:
// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@ -581,7 +582,7 @@ static void ImGui_ImplDX10_SetWindowSize(ImGuiViewport* viewport, ImVec2 size)
}
}
static void ImGui_ImplDX10_RenderViewport(ImGuiViewport* viewport)
static void ImGui_ImplDX10_RenderViewport(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataDx10* data = (ImGuiViewportDataDx10*)viewport->RendererUserData;
ImVec4 clear_color = ImVec4(0.0f, 0.0f, 0.0f, 1.0f);
@ -591,7 +592,7 @@ static void ImGui_ImplDX10_RenderViewport(ImGuiViewport* viewport)
ImGui_ImplDX10_RenderDrawData(viewport->DrawData);
}
static void ImGui_ImplDX10_SwapBuffers(ImGuiViewport* viewport)
static void ImGui_ImplDX10_SwapBuffers(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataDx10* data = (ImGuiViewportDataDx10*)viewport->RendererUserData;
data->SwapChain->Present(0, 0); // Present without vsync

View File

@ -3,6 +3,7 @@
// Implemented features:
// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().

View File

@ -3,6 +3,7 @@
// Implemented features:
// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@ -589,7 +590,7 @@ static void ImGui_ImplDX11_SetWindowSize(ImGuiViewport* viewport, ImVec2 size)
}
}
static void ImGui_ImplDX11_RenderWindow(ImGuiViewport* viewport)
static void ImGui_ImplDX11_RenderWindow(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataDx11* data = (ImGuiViewportDataDx11*)viewport->RendererUserData;
ImVec4 clear_color = ImVec4(0.0f, 0.0f, 0.0f, 1.0f);
@ -599,7 +600,7 @@ static void ImGui_ImplDX11_RenderWindow(ImGuiViewport* viewport)
ImGui_ImplDX11_RenderDrawData(viewport->DrawData);
}
static void ImGui_ImplDX11_SwapBuffers(ImGuiViewport* viewport)
static void ImGui_ImplDX11_SwapBuffers(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataDx11* data = (ImGuiViewportDataDx11*)viewport->RendererUserData;
data->SwapChain->Present(0, 0); // Present without vsync

View File

@ -3,6 +3,7 @@
// Implemented features:
// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().

View File

@ -726,7 +726,7 @@ static void ImGui_ImplDX12_SetWindowSize(ImGuiViewport* viewport, ImVec2 size)
*/
}
static void ImGui_ImplDX12_RenderWindow(ImGuiViewport* viewport)
static void ImGui_ImplDX12_RenderWindow(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataDx12* data = (ImGuiViewportDataDx12*)viewport->RendererUserData;
IM_ASSERT(0);
@ -740,7 +740,7 @@ static void ImGui_ImplDX12_RenderWindow(ImGuiViewport* viewport)
ImGui_ImplDX12_RenderDrawData(viewport->DrawData);
}
static void ImGui_ImplDX12_SwapBuffers(ImGuiViewport* viewport)
static void ImGui_ImplDX12_SwapBuffers(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataDx12* data = (ImGuiViewportDataDx12*)viewport->RendererUserData;
IM_ASSERT(0);

View File

@ -4,6 +4,7 @@
// Implemented features:
// [X] Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
// [X] Multi-viewport windows (when ImGuiConfigFlags_EnableViewports is enabled).
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@ -448,14 +449,14 @@ static void ImGui_ImplGlfw_SetWindowTitle(ImGuiViewport* viewport, const char* t
glfwSetWindowTitle(data->Window, title);
}
static void ImGui_ImplGlfw_RenderWindow(ImGuiViewport* viewport)
static void ImGui_ImplGlfw_RenderWindow(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataGlfw* data = (ImGuiViewportDataGlfw*)viewport->PlatformUserData;
if (g_ClientApi == GlfwClientApi_OpenGL)
glfwMakeContextCurrent(data->Window);
}
static void ImGui_ImplGlfw_SwapBuffers(ImGuiViewport* viewport)
static void ImGui_ImplGlfw_SwapBuffers(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataGlfw* data = (ImGuiViewportDataGlfw*)viewport->PlatformUserData;
if (g_ClientApi == GlfwClientApi_OpenGL)

View File

@ -4,6 +4,7 @@
// Implemented features:
// [X] Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
// [X] Multi-viewport windows (when ImGuiConfigFlags_EnableViewports is enabled).
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().

View File

@ -1,6 +1,9 @@
// ImGui Renderer for: OpenGL2 (legacy OpenGL, fixed pipeline)
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
// Implemented features:
// [X] User texture binding. Use 'GLUint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
// **Prefer using the code in imgui_impl_opengl3.cpp**
// This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read.

View File

@ -1,6 +1,9 @@
// ImGui Renderer for: OpenGL2 (legacy OpenGL, fixed pipeline)
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
// Implemented features:
// [X] User texture binding. Use 'GLUint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
// **Prefer using the code in imgui_impl_opengl3.cpp**
// This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read.

View File

@ -2,6 +2,10 @@
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
// Implemented features:
// [X] User texture binding. Use 'GLUint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
@ -328,7 +332,7 @@ void ImGui_ImplOpenGL3_DestroyDeviceObjects()
// Platform Interface (Optional, for multi-viewport support)
//--------------------------------------------------------------------------------------------------------
static void ImGui_ImplOpenGL3_RenderWindow(ImGuiViewport* viewport)
static void ImGui_ImplOpenGL3_RenderWindow(ImGuiViewport* viewport, void*)
{
if (!(viewport->Flags & ImGuiViewportFlags_NoRendererClear))
{

View File

@ -2,6 +2,10 @@
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
// Implemented features:
// [X] User texture binding. Use 'GLUint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
IMGUI_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL);
IMGUI_API void ImGui_ImplOpenGL3_Shutdown();
IMGUI_API void ImGui_ImplOpenGL3_NewFrame();

View File

@ -3,7 +3,7 @@
// (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
// Implemented features:
// [X] User texture binding. Cast 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// [X] Multi-viewport windows (when ImGuiConfigFlags_EnableViewports is enabled).
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@ -400,14 +400,14 @@ static void ImGui_ImplSDL2_SetWindowTitle(ImGuiViewport* viewport, const char* t
SDL_SetWindowTitle(data->Window, title);
}
static void ImGui_ImplSDL2_RenderWindow(ImGuiViewport* viewport)
static void ImGui_ImplSDL2_RenderWindow(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataSDL2* data = (ImGuiViewportDataSDL2*)viewport->PlatformUserData;
if (data->GLContext)
SDL_GL_MakeCurrent(data->Window, data->GLContext);
}
static void ImGui_ImplSDL2_SwapBuffers(ImGuiViewport* viewport)
static void ImGui_ImplSDL2_SwapBuffers(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataSDL2* data = (ImGuiViewportDataSDL2*)viewport->PlatformUserData;
if (data->GLContext)

View File

@ -2,6 +2,9 @@
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
// (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
// Implemented features:
// [X] Multi-viewport windows (when ImGuiConfigFlags_EnableViewports is enabled).
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.

View File

@ -3,6 +3,7 @@
// Missing features:
// [ ] User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914
// [ ] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled). WORK-IN-PROGRESS.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 5 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXX_CreateFontsTexture(), ImGui_ImplXXXX_NewFrame(), ImGui_ImplXXXX_Render() and ImGui_ImplXXXX_Shutdown().
@ -1113,7 +1114,7 @@ static void ImGui_ImplVulkan_SetWindowSize(ImGuiViewport* viewport, ImVec2 size)
ImGui_ImplVulkanH_CreateWindowDataSwapChainAndFramebuffer(g_PhysicalDevice, g_Device, &data->WindowData, g_Allocator, (int)size.x, (int)size.y);
}
static void ImGui_ImplVulkan_RenderWindow(ImGuiViewport* viewport)
static void ImGui_ImplVulkan_RenderWindow(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataVulkan* data = (ImGuiViewportDataVulkan*)viewport->RendererUserData;
ImGui_ImplVulkan_WindowData* wd = &data->WindowData;
@ -1184,7 +1185,7 @@ static void ImGui_ImplVulkan_RenderWindow(ImGuiViewport* viewport)
}
}
static void ImGui_ImplVulkan_SwapBuffers(ImGuiViewport* viewport)
static void ImGui_ImplVulkan_SwapBuffers(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataVulkan* data = (ImGuiViewportDataVulkan*)viewport->RendererUserData;
ImGui_ImplVulkan_WindowData* wd = &data->WindowData;

View File

@ -3,6 +3,7 @@
// Missing features:
// [ ] User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914
// [ ] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled). WORK-IN-PROGRESS.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 5 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXX_CreateFontsTexture(), ImGui_ImplXXXX_NewFrame(), ImGui_ImplXXXX_Render() and ImGui_ImplXXXX_Shutdown().

View File

@ -124,9 +124,9 @@ int main(int, char**)
glClear(GL_COLOR_BUFFER_BIT);
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
// Update and Render additional Platform Windows
// Update and Render additional Platform Windows (when ImGuiConfigFlags_EnableViewports is enabled)
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindows();
ImGui::RenderPlatformWindows(NULL, NULL);
glfwMakeContextCurrent(window);
glfwSwapBuffers(window);

View File

@ -132,9 +132,9 @@ int main(int, char**)
glClear(GL_COLOR_BUFFER_BIT);
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
// Update and Render additional Platform Windows
// Update and Render additional Platform Windows (when ImGuiConfigFlags_EnableViewports is enabled)
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindows();
ImGui::RenderPlatformWindows(NULL, NULL);
SDL_GL_MakeCurrent(window, gl_context);
SDL_GL_SwapWindow(window);

View File

@ -469,9 +469,9 @@ int main(int, char**)
memcpy(&wd->ClearValue.color.float32[0], &clear_color, 4 * sizeof(float));
FrameRender(wd);
// Update and Render additional Platform Windows
// Update and Render additional Platform Windows (when ImGuiConfigFlags_EnableViewports is enabled)
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindows();
ImGui::RenderPlatformWindows(NULL, NULL);
FramePresent(wd);
}

View File

@ -479,9 +479,9 @@ int main(int, char**)
memcpy(&wd->ClearValue.color.float32[0], &clear_color, 4 * sizeof(float));
FrameRender(wd);
// Update and Render additional Platform Windows
// Update and Render additional Platform Windows (when ImGuiConfigFlags_EnableViewports is enabled)
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindows();
ImGui::RenderPlatformWindows(NULL, NULL);
FramePresent(wd);
}