Immediate-Mode-UI / Nuklear

A single-header ANSI C immediate mode cross-platform GUI library
https://immediate-mode-ui.github.io/Nuklear/doc/index.html
Other
9.28k stars 564 forks source link

Backend: Renderer #74

Closed dumblob closed 7 months ago

dumblob commented 4 years ago

Anyone here using https://github.com/zauonlok/renderer ? Do you think such backend would make sense for Nuklear?

saidm00 commented 4 years ago

SDL2 software renderer probably makes more sense as more people are using it, and it works everywhere, but this one is impressive as a software renderer

rswinkle commented 4 years ago

I had a pull request on a non-OpenGL SDL2 backend on the old repo. I've been meaning to resubmit it after the string API change and after getting my other one in. It's just a conversion of the old SDL1.2 backend that was removed. It requires SDL2-gfx as well and uses that library's built in 8x8 pixel ASCII only font. Long term I'd want to remove that limitation.

"Software rendering" is kind of ambiguous these days. Most people use it to mean 3D rendering done on the CPU like that project. However we're also referring to an SDL2 "software renderer" when even using plain SDL2 (whether the end result is 2D or 3D) the default renderers are "accelerated" which unless I'm very much mistaken usually means using the GPU; just not its 3D capabilities.

Nuklear doesn't actually use/take advantage of any 3D features right? Otherwise it wouldn't look the same on the non-3D API backends. So while that project is an impressive achievement, I don't really see the benefit to Nuklear. I can't actually think of a use-case for a different 3D backend. Putting aside the fact that pretty much anything you can possibly run 3D graphics on has some kind of GPU with OpenGL support on it already, you could always just use the software renderer(s) in Mesa3D with the OpenGL backends if you wanted/had to.

dumblob commented 4 years ago

Hm, my idea was quite different - someone wants to (for whatever reason) use the linked 3D renderer might also want some UI. If Nuklear had an existing backend, it'd make things a bit easier to start with :wink:. That's why I also asked if anybody is using that 3D renderer and whether it would make sense.

rswinkle commented 4 years ago

Hmm. Couldn't they already use the x11 backend with that project since it also uses x11 for Linux? And maybe that would work for GDI and windows too (I don't know windows API's but I associate GDI with win32/HWND type code which I see in their windows platform; maybe they're not exactly the same).

Wouldn't it be about as complicated as using OpenGL based Nuklear in an app that was also doing OpenGL 3D rendering? Other than worrying about not preserving/restoring conflicting state between UI and your graphics code, it works.

saidm00 commented 4 years ago

@rswinkle That makes sense to me, or you could use OpenGL to render the CPU drawn frames and UI overlayed on top. I do see the advantage of doing an SDL2 software renderer though, GDI and x11 obviously aren't portable and that's an issue for those who want to keep their project 100% using CPU.

saidm00 commented 4 years ago

I actually at some point even wanted it myself, but I got discouraged, I wanted to write a software ray tracer, and have a UI for it, and I was gonna write a Nuklear renderer in SDL2, but never really got the time or drive to do it.

dumblob commented 4 years ago

Thanks for the comments. I'll leave this open for some time yet to allow some more discussion (and new contributors), but currently it seems to me as we shouldn't push this idea much.

RobLoach commented 2 years ago

Feel free to experiment with creating a backend for Renderer. Looks like a really cool platform!