37
Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

Embed Size (px)

Citation preview

Page 1: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

Cross-platform GUI Frameworks for 3D Apps and Games:

Qt vs wxWidgets

April 1, 2011

Nima NikfetratAmirSam Khataie

Page 2: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam 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

Page 3: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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)

Page 4: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

4

Page 5: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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)

Page 6: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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)

Page 7: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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

Page 8: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

8

DialogBlocks

(A GUI Generator for wxWidgets)

Page 9: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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

Page 10: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

10

Any platforms

No Drag&Drop

Page 11: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

11

C++ Source Codes

inside the dialog class

Page 12: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

12

.xrc format(XML)

Page 13: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

13

Generated Event for a

button

Page 14: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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

Page 15: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

15

Page 16: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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)

Page 17: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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

Page 18: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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

Page 19: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

19

Qt Visual Studio integration No complex setup

No libs configuration

Exclusive Qt Menu and wizard available

Dynamic or static libs

Page 20: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

20

Qt Designer

(GUI Generator for Qt)

Page 21: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

21

Qt Designer

Page 22: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

22

Qt Designer

Edit Signal / Slots

First Implement methods in .cpp

Connect signals to slots

Example: clicked() showText()

Page 23: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

23

Qt Designer

Extended properties

Visual text paragraph, font , color editor (html format)

Page 24: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

24

Qt Designer

Style sheet:

Customizing

appearance

of widgets

ToolTip

WhatsThis

Morph to other widgets

Page 25: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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

Page 26: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

26

Qt Widgets **Custom Widgets are visible in QtDesigner**

Page 27: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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

Page 28: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

28

Comparison

and

Evaluation

Page 29: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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)

Page 30: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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)

Page 31: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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

Page 32: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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

Page 33: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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

Email

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

Page 34: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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

Page 35: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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

Page 36: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

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

Page 37: Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets April 1, 2011 Nima Nikfetrat AmirSam Khataie

37

Thank you