ImGuiNET / ImGui.NET

An ImGui wrapper for .NET.
MIT License
1.87k stars 304 forks source link

Feature suggestion: Provide an API that allows the developers to change graphics backends #390

Closed tommai78101 closed 1 year ago

tommai78101 commented 1 year ago

I currently am using Veldrid on a Windows machine with an NVIDIA RTX 2070, and am learning how to set up an environment for 3D application development.

While setting up the environment, I noticed that no matter what I do to run the Veldrid application, I could not change the graphics backend from Direct3D 11 to a different backend. I wished to be able to switch to OpenGL and then back to Direct3D 11, and vice versa, at any point during the application's lifecycle.

So far, I have not been successful when searching for resources on how to change the graphics backend type Veldrid uses when the application is running. For this reason, I would like to feature request to provide a way for a developer like me to change the graphics backend type to another backend.

Either that, or, can someone show me how to properly force Windows to use OpenGL using Veldrid? The sample ImGUI.NET application and this OpenTK ImGUI.NET sample project doesn't really explain to me how the graphic backend types are chosen in Veldrid, and how those are determined. It would also be nice and welcoming if the Veldrid Tutorials and API Documentation can demonstrate how to switch between different graphics backends.

Thank you.

zaafar commented 1 year ago

Kindly check veldrid Demo for this feature rather than checking ImGui.NET demos.

Veldrid demo is NeoDemo and is available in the veldrid repository.

tommai78101 commented 1 year ago

Thank you for pointing it out for me. The NeoDemo.cs source code indeed does contain code on how to choose the preferred graphics backend. I guess I will need to use and reuse the windows and graphics device creation API to choose a different backend when necessary.

Thank you for your help.