I've been playing around with OpenGL and I'm trying to build out my own UI component library containing things like buttons, text views, labels, views, etc. Eventually I want to abstract it similar to iOS UIKit where I can just call UIButton() or UIView() and just generate that UI element. Before I let my imagination go, I am still trying to understand the most effective way to actually develop the initial library. Eventually I want it to be a combination of 2D and 3D graphics. Should I build all the components in say Blender and export the bmp file as a texture and use that? I don't think that's a viable option because eventually I want to add text in runtime to the UI elements and eventually re-shape the size based on constantly changing variables. Even better, is there already a library with this extracted? Similar to CoreGraphics/UIKit?

  • $\begingroup$ If creating library is your goal, that's ok. If you just need UI for testing - check ImGui project. ; Regarding your question - it depends how complicated your library is going to be. I've achieved similar results to ImGui with using very simple shaders with single color. To create text, I've used Rastertek font engine - rastertek.com/dx11tut12.html - it was working reasonably well, at least for my purposes. I don't understand part about mixing 2D and 3D graphics. What do you mean by that? $\endgroup$ Oct 6 '20 at 8:18
  • 1
    $\begingroup$ +1 for dear imgui if you're looking for a ready made UI library you can plug into an OpenGL renderer, that allows creating UI elements in code by calling functions, and everything is dynamic. Or if you want to develop your own, you could still look at that for design inspiration. $\endgroup$ Oct 6 '20 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.