| 1 |
# MODIFIED |
| 2 |
|
| 3 |
this is a modified version of `https://github.com/JesusKrists/imgui_software_renderer`, which itself is a modified version of `https://github.com/emilk/imgui_software_renderer`. |
| 4 |
|
| 5 |
# Dear ImGui software renderer |
| 6 |
This is a software renderer for [Dear ImGui](https://github.com/ocornut/imgui). |
| 7 |
I built it not out of a specific need, but because it was fun. |
| 8 |
The goal was to get something accurate and decently fast in not too many lines of code. |
| 9 |
It renders a complex GUI in 1-10 milliseconds on a modern laptop. |
| 10 |
|
| 11 |
## What it is: |
| 12 |
As the name implies, this is a software renderer for ImGui. It does not handle any windows or input. In the supplied example I use [SDL2](www.libsdl.org) for that. |
| 13 |
|
| 14 |
## How to use it |
| 15 |
Just copy `imgui_sw.hpp` and `imgui_sw.cpp`. There are no other dependencies beside Dear ImGui. Requires C++11. |
| 16 |
|
| 17 |
## How to test it |
| 18 |
``` |
| 19 |
git clone https://github.com/emilk/imgui_software_renderer.git |
| 20 |
cd imgui_software_renderer |
| 21 |
git submodule update --init --recursive |
| 22 |
./build_and_run.sh |
| 23 |
``` |
| 24 |
|
| 25 |
For the example to work you will need to have SDL2 on your system. |
| 26 |
|
| 27 |
## Example: |
| 28 |
This renders in 7 ms on my MacBook Pro: |
| 29 |
|
| 30 |
 |
| 31 |
|
| 32 |
## Alternatives |
| 33 |
There is another software rasterizer for ImGui (which I did not know about when I wrote mine) at https://github.com/sronsse/imgui/tree/sw_rasterizer_example/examples/sdl_sw_example. |
| 34 |
I have not compared the two (yet). |
| 35 |
|
| 36 |
## Future work: |
| 37 |
* We do not yet support painting with any other texture than the default font texture. |
| 38 |
* Optimize rendering of gradient rectangles (common for color pickers) |
| 39 |
* Compare my software renderer to [the one by](https://github.com/sronsse/imgui/tree/sw_rasterizer_example/examples/sdl_sw_example) @sronsse |
| 40 |
|
| 41 |
## License: |
| 42 |
This software is dual-licensed to the public domain and under the following |
| 43 |
license: you are granted a perpetual, irrevocable license to copy, modify, |
| 44 |
publish, and distribute this file as you see fit. |