Date post: | 28-Dec-2015 |
Category: |
Documents |
Upload: | clementine-baker |
View: | 219 times |
Download: | 2 times |
Cross-platform GUI Frameworks for 3D Apps and Games:
Qt vs wxWidgets
April 1, 2011
Nima NikfetratAmirSam Khataie
2
Introduction Ultra Entertainment , a new game development company
GUI frameworks to accelerate the production of: 3D tools / editors for game development.
C/C++ Cross-platform GUI frameworks Qt wxWidgets.
Third-party or built-In GUI generators: “Qt Designer” “DialogBlocks”
1. We present candidate frameworks and tools 2. Present our 3D sample applications3. Ranking for each section
3
Introduction How the company uses or sells our 3D tools:
Binary Tools + Source codes (Game Engines):
To distribute/sell the binary format + source codes
A few customers ($1,000$ to $+50,000 per license / per game)
Binary format tools (Game / Apps):
Only binary format (bundled with the game)
Thousands of customers
Rank: Poor (1) to excellent (5)
Criterion: Low impact (1) to High impact (4)
4
5
Introduction of wxWidgets wxWidgets was started in 1992
by Julian Smart at the University of Edinburgh
Initially for Unix and Windows Later Mac platform, WinCE, etc.
Supported by volunteers (such as AOL)
GUI framework + more : Network, Clipboard , drag & drop, Multithreading, Image loading and saving, Database,
Platform Details:
wxGTK (GTK+ 2.0)wxX11 (X11)wxMotif (X11 using Motif)
wxOSX (Cocoa or Carbon API)
wxMSW (Windows API)
6
Hello world, wxWidgets
class MyApp : public wxApp
{
public:
virtual bool OnInit();
};
//-------------------------------------------
class MyFrame : public wxFrame
{
public:
MyFrame (const wxString& title);
void OnQuit (wxCommandEvent& event);
void OnAbout (wxCommandEvent& event);
private:
DECLARE_EVENT_TABLE()
};
For each compiler and platform:
Libraries must be compiled (very fast, less than 5 minutes)
Configuring compilers are a bit complex and different
// Using Macros
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU (Minimal_Quit, MyFrame::OnQuit)
EVT_MENU (Minimal_About, MyFrame::OnAbout)
END_EVENT_TABLE()
IMPLEMENT_APP (MyApp)
7
wxWidgets features Widgets will be defined with IDs
(Similar to Win32 API)
Uses Macros for Event handling
(Similar to MFC)
Platform specific flags for methods/classes:
Always documentations must be checked
Lacks:
No integrated UI builder
No integration with compilers (Only manually as a library)
A third party GUI generator is really needed
8
DialogBlocks
(A GUI Generator for wxWidgets)
9
DialogBlocks Price: $90 (student $47)
DialogBlocks is NOT a drag-and-drop tool !!
More efficient portable dialogs with sizers
Can create “gcc” / “VC++” project files
Using outputs of DialogBlocks:
1. generated C++ .h and .cpp file
2. A separate XRC resource file (for each dialog)
3. A global XRC resource file (contains all dialog resources)
4. copy and paste the C++ or XRC code into your own project
10
Any platforms
No Drag&Drop
11
C++ Source Codes
inside the dialog class
12
.xrc format(XML)
13
Generated Event for a
button
14
OpenGL in Qt (3D Rendering)
wxGLCanvas class, 3D view can be displayed on: widgets wxPanel wxFrame
To display:
Split the window: wxBoxSizer Flags: wxHORIZONTAL,
wxVERTICAL
15
16
Introduction of Qt
Nokia acquired Trolltech for $153 million, 2008
Not the end of freedom for Qt:
GPL license LGPL (Qt 4.5, March 2009)
17
Hello world, Qt#include “myApp.h"#include <QtGui/QApplication>
int main(int argc, char *argv[]){
QApplication app(argc, argv);myApp win;win.show();return app.exec();
}
buttonBox = new QDialogButtonBox(test1Class);
buttonBox->setObjectName (QString::fromUtf8("buttonBox"));buttonBox->setGeometry (QRect (80, 320, 156, 23));buttonBox->setStandardButtons (QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
setupUi: Automatic UI generation .ui file: An XML-based file format
18
Signals and Slots, Qt// ** Auto-Connect **private slots:
void on_pushButton_clicked(); // void on_<object name>_<signal name>();
void myApp::on_pushButton_clicked(){ QMessageBox::information(this, tr("Text"), lineEdit1->text(), QMessageBox::Cancel);}
// ** Without Auto-Connect **
connect (pushButton, SIGNAL (clicked()), this, SLOT (showTextMSg()));
// Notice Macros and new keywords
19
Qt Visual Studio integration No complex setup
No libs configuration
Exclusive Qt Menu and wizard available
Dynamic or static libs
20
Qt Designer
(GUI Generator for Qt)
21
Qt Designer
22
Qt Designer
Edit Signal / Slots
First Implement methods in .cpp
Connect signals to slots
Example: clicked() showText()
23
Qt Designer
Extended properties
Visual text paragraph, font , color editor (html format)
24
Qt Designer
Style sheet:
Customizing
appearance
of widgets
ToolTip
WhatsThis
Morph to other widgets
25
Qt Designer’s .ui file (XML) to C++ The qmake tool:
detects .ui file
generates the makefile rules
The uic tool:
converts .ui file into C++
puts the result in ui_name.h
26
Qt Widgets **Custom Widgets are visible in QtDesigner**
27
OpenGL in Qt (3D Rendering) QGLWidget class:
Enable OpenGL graphics to be rendered within a UI. 3D scenes can be displayed on widgets (can be placed in layouts)
QGLShader class:
Compiling OpenGL shaders
Displaying:1. QGLWidget subclass
as a QtDesigner plugin
2. Manually inside the source codes
28
Comparison
and
Evaluation
29
Property Editor Required for any Game editors
Available for Qt :
QtPropertyBrowser framework
(by source codes from Nokia)
Available for wxWidgets:
wxPropertyGrid (Active SourceForge project)
(Now Part of wxWidgets)
30
Summary of Evaluation
Qt 4.7 wxWidgets 2.9.1Priority of
CriteriaRank(Qt)
Rank(wxWidgets)
Standard widgets Fully satisfied Fully satisfied 1 5 5
Advanced widgets
Yes
Very customizable Yes 3 5 4
Custom Widgets
Yes
Plugins, VisualYes 4 5 4
Property Editor
Yes
External
Source Code
Yes
Built-In4 3 4
Rank: Poor (1) to excellent (5)
Criteria: Low impact (1) to High impact (4)
31
Summary of Evaluation
Advanced 2D/3D hardware accelerated features:
Qt 4.7 wxWidgets 2.9.1Priority of
CriteriaRank(Qt)
Rank(wxWidgets)
Basic 3D support Yes Yes 4 5 5
Advanced 3D support
Yes
Compiling ShadersNo 1 3 1
2D hardware rendering
Yes No 2 5 1
32
Summary of Evaluation
Qt 4.7 wxWidgets 2.9.1Priority of
CriteriaRank(Qt)
Rank(wxWidgets)
Portability and Compatibility Yes Yes 4 5 5
Compilers Integration
Yes
VC++, Eclipse
No
Only libs and
making project files
4 5 4
GUI designer YesYes
Third-party4 5 4
Documents
Excellent
Official book
Samples
Forum
Excellent
Official book
Samples
Forum / wxWiki
3 5 5
33
Summary of Evaluation
Qt 4.7 wxWidgets 2.9.1Priority of
CriteriaRank(Qt)
Rank(wxWidgets)
Maintainability development
stabilityExcellent Good 3 5 4
Ease of useLess codes
Less complex
More codes
A bit complex1 5 4
Support(Commercial)
Yes
Customer Portal
2,000$ - 5,000$/yr
Yes (Third-party)
TT-solutions
Email/phone/Skype
100€/hour
2 5 3
License
Pricing(12 months)
LGPL
GPL
Commercial
2,300$ – 3,700$
LGPL
and
User's own terms
(binary)
4 5 5
34
Summary of Evaluation Additional framework features:
Qt 4.7 wxWidgets 2.9.1Priority of
CriteriaRank(Qt)
Rank(wxWidgets)
XML Yes Yes 3 5 5
Multimedia Yes Yes 1 4 4
Multithreading Yes Yes 1 5 5
Standard C++
New keywords
added
e.g. Public slot:
Yes
Uses Macros a lot
e.g. for main()
1 3 4
35
Total Scores (out of 5) Qt: 4.74 wxWidgets: 4.18
We recommend using Qt to facilitate the development of 3D game tools.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 190
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
Qt wxWidgets
Criterion
Rank
36
Major Users and Applications
wxWidgets :
3D games / apps:
1. Unreal Game Engine 3 (Price: +1 million USD)
2. Shark 3D for games
Other apps:
Code::Blocks
FileZilla
AOL Communicator
AMD, Advanced Micro Devices
Qt :
3D games / apps:
1. Autodesk Maya 2011
2. Autodesk Mudbox3D
3. Nextlimit RealFlow
4. Google Earth
Other apps:
1. VLC player
2. Skype
37
Thank you