GUI thinking and testing ideas Open GL GUI

  • Slides: 11
Download presentation
GUI thinking and testing ideas Open. GL GUI Root Team meeting 01/10/2010 ROOT Team

GUI thinking and testing ideas Open. GL GUI Root Team meeting 01/10/2010 ROOT Team Meeting October 1 st 2010

Introduction Implementing TVirtual. X with Open. GL could allow a better portability and could

Introduction Implementing TVirtual. X with Open. GL 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. i. Phone, i. Pad, Android, . . . ). ROOT Team meeting October 1 st 2010 2

Reminder: Open. GL Quoting Open. GL Red Book: "Open. GL is designed as a

Reminder: Open. GL Quoting Open. GL Red Book: "Open. GL 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 Open. GL; instead, you must work through whatever windowing system controls the particular hardware you're using. " Quoting MSDN: "An Open. GL application with Windows uses either the windowing system of the target platform (X Windows or Windows), or a cross -platform library such as the Open. GL Graphics Library Utility Kit (GLUT)…" ROOT Team meeting October 1 st 2010 3

GLUT • Open. GL Utility Toolkit. It supports, among others: • • • Multiple

GLUT • Open. GL Utility Toolkit. It supports, among others: • • • Multiple windows for Open. GL rendering Callback driven event processing Support for bitmap and stroke fonts Miscellaneous window management functions …. • But, as specified on the Open. GL web page (http: //www. opengl. org/resources/libraries/glut/): GLUT is designed for constructing small to medium sized Open. GL programs. While GLUT is well-suited to learning Open. GL and developing simple Open. GL 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 TVirtual. X based on GLUT: It works! ROOT Team meeting October 1 st 2010 4

Examples Gui. Backend: native ROOT Team meeting October 1 st 2010 5

Examples Gui. Backend: native ROOT Team meeting October 1 st 2010 5

Examples Gui. Backend: glut ROOT Team meeting October 1 st 2010 6

Examples Gui. Backend: glut ROOT Team meeting October 1 st 2010 6

Examples ROOT Team meeting October 1 st 2010 7

Examples ROOT Team meeting October 1 st 2010 7

Issues • Major drawback: glut creates one Window and its GL Context per widget!

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 ROOT Team meeting October 1 st 2010 8

Issues • Performance issue (probably due to context switching – to be investigated): root

Issues • Performance issue (probably due to context switching – to be investigated): root [2] new TCanvas (class TCanvas*)0 x 3533218 Real time 0: 00: 15. 632000, CP time 0. 406 • Comparing with the native (win 32) one: root [2] new TCanvas (class TCanvas*)0 x 34 ba 5 e 0 Real time 0: 00. 253000, CP time 0. 218 • So they are right, GLUT is not a full-featured toolkit. . . ROOT Team meeting October 1 st 2010 9

Other options • Using an already existing toolkit is difficult, since we have to:

Other options • Using an already existing toolkit is difficult, since we have to: • Use a X 11 (Xlib) like API (TVirtual. X 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 Open. GL ROOT Team meeting October 1 st 2010 10

What Next • If glut is really not an option, and if there is

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 Open. GL, including: • Window management, with their relationship (parent/children) and their properties, keeping also the z-order • Graphics Context (GC) management • Pixmap management (conversion to Open. GL 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 ROOT Team meeting October 1 st 2010 11