120 likes | 249 Views
GUI thinking and testing ideas OpenGL GUI. Root Team meeting 01/10/2010. Introduction.
E N D
GUI thinking and testing ideasOpenGL GUI Root Team meeting 01/10/2010
Introduction Implementing TVirtualX with OpenGL could allow a better portability and could probably allow to quickly port it on new platforms (e.g. Native Mac OSX) or even small devices (e.g. iPhone, iPad, Android, ...).
Reminder: OpenGL Quoting OpenGL Red Book: "OpenGL is designed as a streamlined, hardware-independent interface to be implemented on many different hardware platforms. To achieve these qualities, no commands for performing windowing tasks or obtaining user input are included in OpenGL; instead, you must work through whatever windowing system controls the particular hardware you're using." Quoting MSDN: "An OpenGL application with Windows uses either the windowing system of the target platform (X Windows or Windows), or a cross-platform library such as the OpenGL Graphics Library Utility Kit (GLUT)…"
GLUT • OpenGL Utility Toolkit. It supports, among others: • Multiple windows for OpenGL rendering • Callback driven event processing • Support for bitmap and stroke fonts • Miscellaneous window management functions • …. • But, as specified on the OpenGL web page (http://www.opengl.org/resources/libraries/glut/): GLUT is designed for constructing small to medium sized OpenGL programs. While GLUT is well-suited to learning OpenGL and developing simple OpenGL applications, GLUT is not a full-featured toolkit so large applications requiring sophisticated user interfaces are better off using native window system toolkits. GLUT is simple, easy, and small. • Quick implementation of TVirtualX based on GLUT: It works!
Examples Gui.Backend: native
Examples Gui.Backend: glut
Issues • Major drawback: glut creates one Window and its GL Context per widget! This implies a lot of context switching when drawing / updating each GUI element (see next slide) • Glut has its own main event loop • Some events are missing (e.g. enter/leave mouse event on Windows) • Vents are not propagated across sub-windows (e.g. the canvas menu doesn't work) • No real font (e.g. FTGL) support, only fixed (hard-coded) font • No image support
Issues • Performance issue (probably due to context switching – to be investigated): • Comparing with the native (win32) one: • So they are right, GLUT is not a full-featured toolkit... root [2] new TCanvas (class TCanvas*)0x3533218 Real time 0:00:15.632000, CP time 0.406 root [2] new TCanvas (class TCanvas*)0x34ba5e0 Real time 0:00:00.253000, CP time 0.218
Other options • Using an already existing toolkit is difficult, since we have to: • Use a X11 (Xlib) like API (TVirtualX is almost a one to one bridge to xlib) • Be backward compatible with the ROOT GUI • Existing packages have been designed and optimized to be used with OpenGL
What Next • If glut is really not an option, and if there is no alternative (i.e. no other toolkit), then start from scratch and implement a full Window manager in OpenGL, including: • Window management, with their relationship (parent/children) and their properties, keeping also the z-order • Graphics Context (GC) management • Pixmap management (conversion to OpenGL textures for rendering) • Font management (using FTGL) – how to get font properties? • Event handling mechanism with proper propagation among windows • The platform (WM) dependent part being only the creation of the top level Windows (containers) and the event handling