OGRE 14.3
Object-Oriented Graphics Rendering Engine
Loading...
Searching...
No Matches
OgreBites::ApplicationContextQt Class Reference

Specialization for connecting with Qt. More...

#include <OgreApplicationContextQt.h>

+ Inheritance diagram for OgreBites::ApplicationContextQt:

Public Member Functions

 ApplicationContextQt (const Ogre::String &appName="Ogre3D")
 
void addInputListener (InputListener *lis)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
virtual void addInputListener (NativeWindowType *win, InputListener *lis)
 attach input listener
 
void addInputListener (NativeWindowType *win, InputListener *lis) override
 attach input listener
 
NativeWindowPair createWindow (const Ogre::String &name, uint32_t w=0, uint32_t h=0, Ogre::NameValuePairList miscParams=Ogre::NameValuePairList()) override
 Create a new render window.
 
NativeWindowPair createWindow (QWindow *window, Ogre::NameValuePairList miscParams=Ogre::NameValuePairList())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void injectMainWindow (QWindow *window)
 allows overriding the main (first) Window with a pre-created QWindow
 
void pollEvents () override
 process all window events since last call
 
void removeInputListener (InputListener *lis)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
virtual void removeInputListener (NativeWindowType *win, InputListener *lis)
 detatch input listener
 
void removeInputListener (NativeWindowType *win, InputListener *lis) override
 detatch input listener
 
void setWindowGrab (bool grab=true)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void setWindowGrab (NativeWindowType *win, bool grab) override
 When input is grabbed the mouse is confined to the window.
 
virtual void setWindowGrab (NativeWindowType *win, bool grab=true)
 When input is grabbed the mouse is confined to the window.
 
void shutdown () override
 Cleans up and shuts down the context.
 
void useQtEventLoop (bool enable)
 signal that you want to use the Qt event loop
 
- Public Member Functions inherited from OgreBites::ApplicationContextBase
 ApplicationContextBase (const Ogre::String &appName="Ogre3D")
 
virtual ~ApplicationContextBase ()
 
void _fireInputEvent (const Event &event, uint32_t windowID) const
 inspect the event and call one of the corresponding functions on the registered InputListener
 
void addInputListener (InputListener *lis)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void closeApp ()
 This function closes down the application - saves the configuration then shutdowns.
 
void createDummyScene ()
 Creates dummy scene to allow rendering GUI in viewport.
 
virtual void createRoot ()
 Creates the OGRE root.
 
void destroyDummyScene ()
 Destroys dummy scene.
 
void destroyRTShaderSystem ()
 Destroy the RT Shader system.
 
void destroyWindow (const Ogre::String &name)
 destroy and erase an NativeWindowPair by name
 
void enableShaderCache () const
 enables the caching of compiled shaders to file
 
bool frameEnded (const Ogre::FrameEvent &evt) override
 Called just after a frame has been rendered.
 
bool frameRenderingQueued (const Ogre::FrameEvent &evt) override
 Called after all render targets have had their rendering commands issued, but before render windows have been asked to flip their buffers over.
 
bool frameStarted (const Ogre::FrameEvent &evt) override
 Called when a frame is about to begin rendering.
 
virtual float getDisplayDPI () const
 get the vertical DPI of the display
 
Ogre::FileSystemLayergetFSLayer () const
 get the FileSystemLayer instance pointing to an application specific directory
 
InputListenergetImGuiInputListener () const
 
Ogre::OverlaySystemgetOverlaySystem () const
 
Ogre::RenderWindowgetRenderWindow () const
 get the main RenderWindow owns the context on OpenGL
 
Ogre::RootgetRoot () const
 
void initApp ()
 This function initializes the render system and resources.
 
Ogre::ImGuiOverlayinitialiseImGui ()
 Set up the overlay system for usage with ImGui.
 
bool initialiseRTShaderSystem ()
 Initialize the RT Shader system.
 
virtual void loadResources ()
 Loads context-wide resource groups.
 
virtual void locateResources ()
 Finds context-wide resource groups.
 
virtual bool oneTimeConfig ()
 Configures the startup settings for OGRE.
 
void reconfigure (const Ogre::String &renderer, Ogre::NameValuePairList &options)
 
void removeInputListener (InputListener *lis)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void runRenderingSettingsDialog ()
 Show the renderer configuration menu.
 
void setRTSSWriteShadersToDisk (bool write)
 make the RTSS write out the generated shaders for caching and debugging
 
virtual void setup ()
 Sets up the context after configuration.
 
void setWindowGrab (bool grab=true)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
virtual void windowClosed (Ogre::RenderWindow *rw)
 
virtual bool windowClosing (Ogre::RenderWindow *rw)
 
virtual void windowFocusChange (Ogre::RenderWindow *rw)
 
virtual void windowMoved (Ogre::RenderWindow *rw)
 
virtual void windowResized (Ogre::RenderWindow *rw)
 
- Public Member Functions inherited from Ogre::FrameListener
virtual ~FrameListener ()
 

Additional Inherited Members

- Static Public Member Functions inherited from OgreBites::ApplicationContextBase
static Ogre::String getDefaultMediaDir ()
 the directory where the media files were installed
 

Detailed Description

Specialization for connecting with Qt.

  • Set a QBasicTimer on this or call startTimer() to update all associated windows using Root::renderOneFrame.
  • Use the QWindow::requestUpdate() slot to refresh a single Window using RenderWindow::update
  • QWidget::createWindowContainer and QWidget::windowHandle() provide translation between QWidget and QWindow

Assumes that Ogre Main loop is used for compatibility with other implementations.

Constructor & Destructor Documentation

◆ ApplicationContextQt()

OgreBites::ApplicationContextQt::ApplicationContextQt ( const Ogre::String appName = "Ogre3D")
inlineexplicit

Member Function Documentation

◆ createWindow() [1/2]

NativeWindowPair OgreBites::ApplicationContextQt::createWindow ( const Ogre::String name,
uint32_t  w = 0,
uint32_t  h = 0,
Ogre::NameValuePairList  miscParams = Ogre::NameValuePairList() 
)
overridevirtual

Create a new render window.

You must use SDL and not an auto-created window as SDL does not get the events otherwise.

By default the values from ogre.cfg are used for w, h and miscParams.

Reimplemented from OgreBites::ApplicationContextBase.

◆ createWindow() [2/2]

NativeWindowPair OgreBites::ApplicationContextQt::createWindow ( QWindow *  window,
Ogre::NameValuePairList  miscParams = Ogre::NameValuePairList() 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ injectMainWindow()

void OgreBites::ApplicationContextQt::injectMainWindow ( QWindow *  window)
inline

allows overriding the main (first) Window with a pre-created QWindow

Parameters
window

References OgreAssert.

◆ useQtEventLoop()

void OgreBites::ApplicationContextQt::useQtEventLoop ( bool  enable)
inline

signal that you want to use the Qt event loop

aka QApplication::exec() instead of Root::startRendering. In this case you may want to call startTimer on this QObject which ensures that Root::renderOneFrame is called periodically.

Parameters
enable

◆ setWindowGrab() [1/3]

void OgreBites::ApplicationContextQt::setWindowGrab ( NativeWindowType win,
bool  grab 
)
overridevirtual

When input is grabbed the mouse is confined to the window.

Reimplemented from OgreBites::ApplicationContextBase.

◆ addInputListener() [1/3]

void OgreBites::ApplicationContextQt::addInputListener ( NativeWindowType win,
InputListener lis 
)
overridevirtual

attach input listener

Parameters
listhe listener
winthe window to receive the events for.

Reimplemented from OgreBites::ApplicationContextBase.

◆ removeInputListener() [1/3]

void OgreBites::ApplicationContextQt::removeInputListener ( NativeWindowType win,
InputListener lis 
)
overridevirtual

detatch input listener

Parameters
listhe listener
winthe window to receive the events for.

Reimplemented from OgreBites::ApplicationContextBase.

◆ pollEvents()

void OgreBites::ApplicationContextQt::pollEvents ( )
overridevirtual

process all window events since last call

Reimplemented from OgreBites::ApplicationContextBase.

◆ shutdown()

void OgreBites::ApplicationContextQt::shutdown ( )
overridevirtual

Cleans up and shuts down the context.

Reimplemented from OgreBites::ApplicationContextBase.

◆ setWindowGrab() [2/3]

virtual void OgreBites::ApplicationContextBase::setWindowGrab ( NativeWindowType win,
bool  grab = true 
)
inlinevirtual

When input is grabbed the mouse is confined to the window.

Reimplemented from OgreBites::ApplicationContextBase.

◆ setWindowGrab() [3/3]

void OgreBites::ApplicationContextBase::setWindowGrab ( bool  grab = true)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ addInputListener() [2/3]

virtual void OgreBites::ApplicationContextBase::addInputListener ( NativeWindowType win,
InputListener lis 
)
virtual

attach input listener

Parameters
listhe listener
winthe window to receive the events for.

Reimplemented from OgreBites::ApplicationContextBase.

◆ addInputListener() [3/3]

void OgreBites::ApplicationContextBase::addInputListener ( InputListener lis)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ removeInputListener() [2/3]

virtual void OgreBites::ApplicationContextBase::removeInputListener ( NativeWindowType win,
InputListener lis 
)
virtual

detatch input listener

Parameters
listhe listener
winthe window to receive the events for.

Reimplemented from OgreBites::ApplicationContextBase.

◆ removeInputListener() [3/3]

void OgreBites::ApplicationContextBase::removeInputListener ( InputListener lis)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.


The documentation for this class was generated from the following file: