lightweight UI library for OpenGL [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and cita开发者_JAVA百科tions.
Closed 8 years ago.
Improve this questionLike the title says, I'm looking for a library that's platform-agnostic and lightweight, for the purpose of displaying buttons, slider bars, check boxes, etc. in OpenGL. Ideally, something that is not directly coupled with OpenGL is best (ie. so that I may replace the rendering with DirectX if need be).
My 'ideal' library would have an event system that supports callbacks or something similar. This is a nice-to-have, but not absolutely required.
I looked into Qt and wxWidgets and both seem very heavy. CEGUI looks like a mess of code. Most other libraries I seen are GLUT based.
There's Dear IMGUI
https://github.com/ocornut/imgui
It's completely graphics API agnostic. It just builds vertices. Its up to you to render them.
There's also nuklear inspired by Dear ImGUI.
You might want to have a look at a game engine such as Irrlicht which provides OpenGL, DirectX and Software renderers and supports a 2D GUI System with Buttons, Lists, Edit boxes. See the feature page to learn more about its capabilities and the user interface sample to try this specific UI feature.
Irrlicht is open source and works on many platforms. From the feature page it supports:
- Windows 98, ME, NT 4, 2000, XP, XP64, Vista, CE
- Linux
- OSX
- Sun Solaris/SPARC
- All platforms using SDL
Neither wxWidgets nor Qt draw in OpenGL; they don't use OpenGL rendering commands to draw. They allow you to create OpenGL windows, but the regular GUI controls (buttons, lists, etc) are not drawing through OpenGL. They're drawn through the native drawing mechanism of your platform of choice.
You are generally not going to find very many standalone GUI libraries that actually do their rendering in OpenGL. The only one I know of is CeGUI, which fits all of your requirements but you dismissed as being "a mess of code." Everything else is generally going to be "heavyweight", because it's part of a game engine.
Now, if you're not looking for something that actually draws using OpenGL commands, but is simply something that you can use alongside an OpenGL window, then things open up somewhat. However, your dismissal of wxWidgets as being "very heavy" is disconcerting, because GUI libraries aren't really going to get much lighter weight than that. A good GUI system requires a lot of stuff.
The smallest cross-platform GUI library that supports making an OpenGL window is probably FLTK. And even that's pretty big.
精彩评论