OPENGL User Interface Programming

11,195

Solution 1

This is not an answer, more of a plea: Please don't do that.

Your reimplemented widgets will lack all sorts of functionality that users will miss. Will your text-entry boxes support drag'n'drop? Copy/paste? Right-to-left scripts? Drag-select? Double-click-select? Will all these mechanisms follow the native conventions of each platform you support?

With Wx your widgets might look inconsistant with the app, but at least they'll look consistant with the OS which is just as important. And more importantly, they'll do what users expect.

(edit) Three posts, and -3 points? Screw this den of karma-whores. Original poster: I have implemented a basic set of widgets in OpenGL (for a game UI) and it was an endless nightmare of a job.

Solution 2

In the latest releases of QT you can draw widgets into your OpenGL context, if you really would like to do something like that. Otherwise there is CEGui that is used in some game engines.

Implementing GUI Widgets yourself unless you want to edify yourself is a waste of your time, unless you would be satisfied with the most rudimentary of looks and functionality.

Solution 3

Python + Qt + OpenGL - I surely believe any application can be written faster and better using python. QT4 is cross-platform, beautifull, implements everything you need from widgets (acessibility, etc...), and...it integrates with OpenGL. That means, you can simply have a widget that is a viewport to openGL stuff you render in your code.

Another 3D capable solution that would cover most things, but not so nioce on user interface is to extend Blender3D with a python script. It has the 3d capabilities and rendering , you script it in python all of the same, and it would be cross platform - and you get higher level tools for woriking with the 3D things than openGL alone. There are obvious drawbacks, mainly from the UI standpoint when compared with PyQT but it could be done.

Solution 4

Try Qt instead of wx.

QT is cross platform, and you can style things alot using CSS. It's extremely well documented and has excellent python bindings. In point of fact, I use the C++ documentation and not the PyQT documentation.

Solution 5

Both wx and QT do an excellent job of creating an application that matches the OS look and feel. It is also possible to implment all the widgets yourself directly in openg, this slashdot post lists some of the sets available

http://ask.slashdot.org/askslashdot/02/12/24/1813219.shtml?tid=156 fox is probably the most developed but looks like windows on all platforms.

Share:
11,195
LarsH
Author by

LarsH

Updated on June 04, 2022

Comments

  • LarsH
    LarsH almost 2 years

    I'm developing a graphical application to present data (not a game but a real workhorse app). It needs to be cross platform, so I have chosen:

    • python
    • openGL (I need 3D, blending, textures etc)
    • pyopengl
    • wx/pywx - windowing, dialogs etc.

    The last component - WX - raises the question. I can put together a very nice looking app (the prototypes look slick) - but when I need to interact with the user to ask questions, get input, I have to use WX. It makes the app look inconsistent to have traditional UI with traditional dialogs and combos and text entry on top of a full screen 3D app with blending, smooth motion, textures etc.

    Has anyone developed a GUI using OpenGL and python? Can you share with me the toolkits and/or tricks you used? I need combos, text entry, buttons, radios, option buttons, tree view.

    There are some toolkits out there, but they are either incomplete or old and unmaintained. A great example is pyUI (http://pyui.sourceforge.net/) - looks slick but untouched for years.

    • thing2k
      thing2k over 15 years
      Any chance you could post a screenshot, to highlight the inconsistencies that you are referring to, Otherwise I agree with Mike F, as GUI implementation is a pain in the neck.
  • Russell Smith
    Russell Smith over 13 years
    I think your answer is valid part of the time, but not always. If the app is a full screen GL application that the user will use almost exclusively, the user may not be expecting standard desktop behavior. Think about console games (ps3, xbox, etc): they don't have traditional GUIs and nobody complains. I agree that, in general, desktop apps should have desktop GUIs, but exceptions can be made now and then.
  • Russell Smith
    Russell Smith over 13 years
    @Mike F: you wrote "your widgets might look inconsistant with the app, but at least they'll look consistant with the OS which is just as important". I've read in places that internal consistency ranks higher than OS consistency. Only slightly, but if there's a tradeoff to be made, the tradeoff isn't always as black and white as you seem to be implying.
  • JoséNunoFerreira
    JoséNunoFerreira over 12 years
    dear commenters, mr Mike F has got a very good point there: implementing simple widgets is very time consuming, precisely because of the little things users may be expecting, and the little differences between OS's. It is far preferable to find a compromise between the app visualizations/menus lack of harmony and use a well established ui toolkit, instead of re-inventing the wheel.