-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Using SDL+Direct3D #2612
Comments
Well, as long as you get SDL2 to render properly with DirectX, implementing ImGui should be pretty straightforward. Just put needed API implementation calls (you can refer to the examples for that) in your code, and render your GUI with ImGui. |
The _opengl2.cpp binding is misnamed and should work on your machine. Doesn’t it? You can use SDL with DirectX, yes. I suppose we could provide an example at some point. |
Well thank you for everything. |
I tried creating my bindings for this case, and I ended up with these files:
I am using VS2019's compiler and compiling in 64-bit mode with:
|
@TerensTare We have now added an example of using SDL2+DirectX11 in the repository: Basically don't pass |
@TerensTare Hi Terens, reading this post, I am a bit confused : was your goal to use both imgui/DX and SDL2/DX renderer together on the same window (I mean with SDL2 calling graphic primitives like SDL_RenderRect or any of those presented in https://wiki.libsdl.org/CategoryRender) ? |
Hey there @binbinhfr , I wanted to create a small tool that uses ImGui. As I mentioned earlier, my machine is way too old for OpenGL3, so I decided to go for DirectX. The problem with DirectX is that it needs many lines of code to do sth "small". Meanwhile, there was SDL2 which uses DirectX for rendering by default on Windows (at least I think so), and that made it the perfect tool for me. That means I wanted to use SDL2 to shorten the lines of code and make the code more readable. I ended up using the new example provided by @ocornut which ran perfectly fine for me. |
ok man, thx for your answer. So if I understand right, at the end, you do not use SDL, but only ImGui with the DirectX backend provided by @ocornut in the example section ? |
Yes, that's it (kinda). I just used SDL2 to create the window and then handle events. Then I just let DirectX and ImGui do the rest (thinks like rendering, clearing the screen, etc.). |
so, as @ocornut advised me, you are using imgui, not only for its GUI features (menus, buttons, etc...) but also for rendering other things on screen ? |
Not really. I was forced to do the rendering of "other stuff" (things that are NOT widgets) with DirectX. I learned some stuff by checking the source code of the render folder of SDL2. |
Hello there!
I have just discovered ImGui and I thought of using it with SDL.
The problem is that I have an old PC and it supports onnly up to OpenGL1.1.
However, I have installed Windows 10 on it, so its DirectX capabilities are better than its OpenGL capabilities.
I was wondering : Is there a way to use ImGui with SDL2 with Direct3D as a renderer?
thank you in advance.
The text was updated successfully, but these errors were encountered: