OGRE Wiki
Support and community documentation for Ogre3D
Ogre Forums
ogre3d.org
Log in
Username:
Password:
CapsLock is on.
Remember me (for 1 year)
Log in
Home
Tutorials
Tutorials Home
Basic Tutorials
Intermediate Tutorials
Mad Marx Tutorials
In Depth Tutorials
Older Tutorials
External Tutorials
Cookbook
Cookbook Home
CodeBank
Snippets
Experiences
Ogre Articles
Libraries
Libraries Home
Alternative Languages
Assembling A Toolset
Development Tools
OGRE Libraries
List of Libraries
Tools
Tools Home
DCC Tools
DCC Tutorials
DCC Articles
DCC Resources
Assembling a production pipeline
Development
Development Home
Roadmap
Building Ogre
Installing the Ogre SDK
Setting Up An Application
Ogre Wiki Tutorial Framework
Frequently Asked Questions
Google Summer Of Code
Help Requested
Ogre Core Articles
Community
Community Home
Projects Using Ogre
Recommended Reading
Contractors
Wiki
Immediate Wiki Tasklist
Wiki Ideas
Wiki Guidelines
Article Writing Guidelines
Wiki Styles
Wiki Page Tracker
Ogre Wiki Help
Ogre Wiki Help Overview
Help - Basic Syntax
Help - Images
Help - Pages and Structures
Help - Wiki Plugins
Toolbox
Freetags
Categories
List Pages
Structures
Trackers
Statistics
Rankings
List Galleries
Ogre Lexicon
Comments
History: Embedding OGRE in wxWidgets 2.8
View page
Source of version: 5
(current)
{maketoc} !!!What is wxWidgets? [http://www.wxwidgets.org/|wxWidgets] is a cross-platform GUI library ([http://wxwidgets.org/about/newlicen.htm|wxWindows License] (like L-GPL)). !!!Step 1: Setup wxWidgets After downloading and installing [http://www.wxwidgets.org/|wxWidgets] 2.8, we may create an environment variable called WXWIN and set it to the installation directory (including drive letter). Then open ($WXWin)\build\msw\wx.dsw and click build solution (for release and debug configurations). !!!Step 2: Create OGRE Project We may use ((The Complete Blanks Guide To Using The OGRE SDK AppWizard - Shoggoth|OGRE SDK AppWizard)), choosing ''Empty Project'' at ''Application Settings'' page. !!!Step 3: Add source files to our project We will add wxOgre.h and wxOgre.cpp from ((WxOgre for OGRE v1.2)) plus: __app.h__ {CODE(wrap="1", colors="c++")}#ifndef APP_H #define APP_H #include <wx/wxprec.h> #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include <wx/wx.h> #endif class MyApp : public wxApp { public: virtual bool OnInit(); }; #endif // APP_H{CODE} __main.h__ {CODE(wrap="1", colors="c++")}#ifndef MAIN_H #define MAIN_H #include "app.h" #include "wxOgre.h" class MyFrame: public wxFrame { public: MyFrame(wxFrame *frame, const wxString& title); ~MyFrame(); void UpdateOgre() { wxOgrePane->update(); } private: wxOgre* wxOgrePane; void OnQuit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); DECLARE_EVENT_TABLE(); }; #endif // MAIN_H{CODE} __app.cpp__ {CODE(wrap="1", colors="c++")}#include "app.h" #include "main.h" #include "wxOgre.h" IMPLEMENT_APP(MyApp); bool MyApp::OnInit() { MyFrame* frame = new MyFrame(0L, _("wxWidgets Application Template")); frame->Show(); frame->UpdateOgre(); return true; }{CODE} __main.cpp__ {CODE(wrap="1", colors="c++")}#include "main.h" int idMenuQuit = wxNewId(); int idMenuAbout = wxNewId(); BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(idMenuQuit, MyFrame::OnQuit) EVT_MENU(idMenuAbout, MyFrame::OnAbout) END_EVENT_TABLE() MyFrame::MyFrame(wxFrame *frame, const wxString& title) : wxFrame(frame, -1, title) { // create a menu bar wxMenuBar* mbar = new wxMenuBar(); wxMenu* fileMenu = new wxMenu(_T("")); fileMenu->Append(idMenuQuit, _("&Quit\tAlt-F4"), _("Quit the application")); mbar->Append(fileMenu, _("&File")); wxMenu* helpMenu = new wxMenu(_T("")); helpMenu->Append(idMenuAbout, _("&About\tF1"), _("Show info about this application")); mbar->Append(helpMenu, _("&Help")); SetMenuBar(mbar); // create a status bar with some information about the used wxWidgets version CreateStatusBar(2); SetStatusText(_("Hello Code::Blocks user !"),0); SetStatusText("Hello Code::Blocks user !",1); wxOgrePane = new wxOgre(this); } MyFrame::~MyFrame() { } void MyFrame::OnQuit(wxCommandEvent& event) { Close(); } void MyFrame::OnAbout(wxCommandEvent& event) { wxString msg = _("Welcome to..."); wxMessageBox(msg, _("Welcome to...")); }{CODE} !!!Step 4: Set Project Properties Time to setup our project. For debug configuration we will set: * Debugging Node: ** (optional) We may want to remove $(OGRE_HOME) variable from both __Command__ and __Working Directory__ fields. If we do so, we will also copy bin and media folder from OGRE sdk to our project folder. * C/C++ Node ** General: __Additional Include Directories__ field should contain the following: *** $(WXWIN)\include *** $(WXWIN)\contrib\include *** $(WXWIN)\lib\vc_lib\mswd ** Preprocessor: WIN32 _DEBUG _WINDOWS __WINDOWS__ __WXMSW__ __WXDEBUG__ WXDEBUG=1 __WIN95__ __WIN32__ WINVER=0x0400 STRICT ** Precompiled Headers: The __Not using precompiled headers__ or __Automatic use of precompiled headers__ button should be selected. ** Code Generation: __Runtime Library__ field should be set to __Debug Multithreaded DLL__. * Linker Node ** General: __Additional Library Directories__ field should contain the following: *** $(WXWIN)\lib\vc_lib *** $(WXWIN)\contrib\lib ** Input: Add the following to __Additional Dependencies__ field: wxmsw28d_core.lib wxbase28d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib And for release configuration: * C/C++ Node ** General: __Additional Include Directories__ field should contain the following: *** $(WXWIN)\include *** $(WXWIN)\contrib\include *** $(WXWIN)\lib\vc_lib\msw ** Preprocessor: NDEBUG WIN32 _WINDOWS __WINDOWS__ __WXMSW__ __WIN95__ __WIN32__ WINVER=0x0400 STRICT ** Precompiled Headers: The __Not using precompiled headers__ or __Automatic use of precompiled headers__ button should be selected. ** Code Generation: __Runtime Library__ field should be set to __Multithreaded DLL__. * Linker Node ** General: __Additional Library Directories__ field should contain the following: *** $(WXWIN)\lib\vc_lib *** $(WXWIN)\contrib\lib ** Input: Add the following to __Additional Dependencies__ field: wxmsw28_core.lib wxbase28.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib Thats was all. if you have any suggestions for improvements, or find any error, then please post in [http://www.ogre3d.org/phpBB2/viewtopic.php?p=196949|this] forum thread. Thank you.
Search by Tags
Search Wiki by Freetags
Latest Changes
IDE Eclipse
FMOD SoundManager
HDRlib
Building Ogre V2 with CMake
Ogre 2.1 FAQ
Minimal Ogre Collision
Artifex Terra
OpenMB
Advanced Mogre Framework
MogreSocks
...more
Search
Find
Advanced
Search Help
Online Users
186 online users