OGRE-Next  3.0.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::MetalWindow Class Reference

#include <OgreMetalWindow.h>

+ Inheritance diagram for Ogre::MetalWindow:

Public Member Functions

 MetalWindow (const String &title, uint32 width, uint32 height, bool fullscreenMode, const NameValuePairList *miscParams, MetalDevice *ownerDevice)
 ~MetalWindow () override
void _initialize (TextureGpuManager *textureGpuManager) override
void _setVisible (bool visible) override
 Internal method to notify the window it has been obscured or minimized. More...
bool canDownloadData () const override
 Returns true if you can download to CPU (i.e. More...
virtual void create (bool fullScreen, const NameValuePairList *miscParams)
void destroy () override
void getCustomAttribute (IdString name, void *pData) override
float getViewPointToPixelScale () const override
 Many windowing systems that support HiDPI displays use special points to specify size of the windows and controls, so that windows and controls with hardcoded sizes does not become too small on HiDPI displays. More...
bool isClosed () const override
 Indicates whether the window has been closed by the user. More...
bool isHidden () const override
 Indicates whether the window was set to hidden (not displayed) More...
bool isManualSwapRelease () const override
 Returns the value set by setManualSwapRelease when supported. More...
bool isVisible () const override
bool nextDrawable ()
void performManualRelease () override
 See Window::setManualSwapRelease. More...
void reposition (int32 left, int32 top) override
void requestResolution (uint32 width, uint32 height) override
 Requests a change in resolution. More...
void setHidden (bool hidden) override
 Hide (or show) the window. More...
void setManualSwapRelease (bool bManualRelease) override
 Metal doesn't want us to hold on to a drawable after presenting. More...
void setWantsToDownload (bool bWantsToDownload) override
 On Metal you must call this function and set it to true in order to take pictures. More...
void swapBuffers () override
void windowMovedOrResized () override
 Notify that the window has been resized. More...
- Public Member Functions inherited from Ogre::Window
 Window (const String &title, uint32 widthPt, uint32 heightPt, bool fullscreenMode)
virtual ~Window ()
void _setPrimary ()
 Indicates that this is the primary window. More...
bool getBorderless () const
TextureGpugetDepthBuffer () const
uint32 getFrequencyDenominator () const
uint32 getFrequencyNumerator () const
uint32 getHeight () const
virtual void getMetrics (uint32 &width, uint32 &height, int32 &left, int32 &top) const
 Overloaded version of getMetrics from RenderTarget, including extra details specific to windowing systems. More...
PixelFormatGpu getPixelFormat () const
uint32 getRequestedHeightPt () const
uint32 getRequestedWidthPt () const
SampleDescription getSampleDescription () const
TextureGpugetStencilBuffer () const
TextureGpugetTexture () const
 WARNING: Attempting to change the TextureGpu (e.g. More...
const StringgetTitle () const
bool getVSync () const
uint32 getVSyncInterval () const
uint32 getWidth () const
bool isFocused () const
bool isFullscreen () const
 Returns true if we are currently in fullscreen mode. More...
bool isMultisample () const
bool isPrimary () const
virtual void requestFullscreenSwitch (bool goFullscreen, bool borderless, uint32 monitorIdx, uint32 widthPt, uint32 heightPt, uint32 frequencyNumerator, uint32 frequencyDenominator)
 Requests to toggle between fullscreen and windowed mode. More...
virtual void setBorderless (bool borderless)
virtual void setFocused (bool focused)
virtual void setFsaa (const String &fsaa)
 Set the FSAA mode to be used if hardware support it. More...
virtual void setTitle (const String &title)
virtual void setVSync (bool vSync, uint32 vSyncInterval)
 Turns VSync on/off. More...
bool wantsToGoFullscreen () const
 Returns true if we are in windowed mode right now, but want to go fullscreen. More...
bool wantsToGoWindowed () const
 Returns true if we are in fullscreen mode right now, but want to go windowed mode. More...

Constructor & Destructor Documentation

◆ MetalWindow()

Ogre::MetalWindow::MetalWindow ( const String title,
uint32  width,
uint32  height,
bool  fullscreenMode,
const NameValuePairList miscParams,
MetalDevice ownerDevice 

◆ ~MetalWindow()

Ogre::MetalWindow::~MetalWindow ( )

Member Function Documentation

◆ _initialize()

void Ogre::MetalWindow::_initialize ( TextureGpuManager textureGpuManager)

Implements Ogre::Window.

◆ _setVisible()

void Ogre::MetalWindow::_setVisible ( bool  visible)

Internal method to notify the window it has been obscured or minimized.

Implements Ogre::Window.

◆ canDownloadData()

bool Ogre::MetalWindow::canDownloadData ( ) const

Returns true if you can download to CPU (i.e.

transfer it via AsyncTextureTicket) If it returns false, attempting to do so could result in a crash

See Window::setWantsToDownload See Window::setManualSwapRelease

Reimplemented from Ogre::Window.

◆ create()

virtual void Ogre::MetalWindow::create ( bool  fullScreen,
const NameValuePairList miscParams 

◆ destroy()

void Ogre::MetalWindow::destroy ( )

Implements Ogre::Window.

◆ getCustomAttribute()

void Ogre::MetalWindow::getCustomAttribute ( IdString  name,
void *  pData 

Reimplemented from Ogre::Window.

◆ getViewPointToPixelScale()

float Ogre::MetalWindow::getViewPointToPixelScale ( ) const

Many windowing systems that support HiDPI displays use special points to specify size of the windows and controls, so that windows and controls with hardcoded sizes does not become too small on HiDPI displays.

Such points have constant density ~ 100 points per inch (probably 96 on Windows and 72 on Mac), that is independent of pixel density of real display, and are used through the all windowing system.

Sometimes, such view points are choosen bigger for output devices that are viewed from larger distances, like 30" TV comparing to 30" monitor, therefore maintaining constant points angular density rather than constant linear density.

In any case, all such windowing system provides the way to convert such view points to pixels, be it DisplayProperties::LogicalDpi on WinRT or backingScaleFactor on MacOSX. We use pixels consistently through the Ogre, but window/view management functions takes view points for convenience, as does the rest of windowing system. Such parameters are named using xxxxPt pattern, and should not be mixed with pixels without being converted using getViewPointToPixelScale() function.

Sometimes such scale factor can change on-the-fly, for example if window is dragged to monitor with different DPI. In such situation, window size in view points is usually preserved by windowing system, and Ogre should adjust pixel size of RenderWindow.

Reimplemented from Ogre::Window.

◆ isClosed()

bool Ogre::MetalWindow::isClosed ( ) const

Indicates whether the window has been closed by the user.

Implements Ogre::Window.

◆ isHidden()

bool Ogre::MetalWindow::isHidden ( ) const

Indicates whether the window was set to hidden (not displayed)

Implements Ogre::Window.

◆ isManualSwapRelease()

bool Ogre::MetalWindow::isManualSwapRelease ( ) const

Returns the value set by setManualSwapRelease when supported.

Reimplemented from Ogre::Window.

◆ isVisible()

bool Ogre::MetalWindow::isVisible ( ) const

Implements Ogre::Window.

◆ nextDrawable()

bool Ogre::MetalWindow::nextDrawable ( )

◆ performManualRelease()

void Ogre::MetalWindow::performManualRelease ( )

See Window::setManualSwapRelease.

Reimplemented from Ogre::Window.

◆ reposition()

void Ogre::MetalWindow::reposition ( int32  left,
int32  top 

Implements Ogre::Window.

◆ requestResolution()

void Ogre::MetalWindow::requestResolution ( uint32  widthPt,
uint32  heightPt 

Requests a change in resolution.

Change is not immediate. Use getRequestedWidthPt & getRequestedHeightPt if you need to know what you've requested, but beware you may not get that resolution, and once we get word from the OS, getRequested{Width/Height}Pt will change again so that getWidth == getRequestedWidthPt * getViewPointToPixelScale.

Reimplemented from Ogre::Window.

◆ setHidden()

void Ogre::MetalWindow::setHidden ( bool  hidden)

Hide (or show) the window.

If called with hidden=true, this will make the window completely invisible to the user.

Setting a window to hidden is useful to create a dummy primary RenderWindow hidden from the user so that you can create and recreate your actual RenderWindows without having to recreate all your resources.

Implements Ogre::Window.

◆ setManualSwapRelease()

void Ogre::MetalWindow::setManualSwapRelease ( bool  bManualRelease)

Metal doesn't want us to hold on to a drawable after presenting.

If you want to take a screenshot capture of the window this is a problem because we no longer have a pointer of the backbuffer to download from.

You can either take your screenshot before swapBuffers() gets called, or, if you intend to take a screenshot, do the following:

window->setWantsToDownload( true );
window->setManualSwapRelease( true );
if( window->canDownloadData() )
Ogre::TextureGpu *texture = window->getTexture();
img.convertFromTexture( texture, 0u, texture->getNumMipmaps() - 1u );
window->setManualSwapRelease( false );
Class representing an image file.
Definition: OgreImage2.h:57
void convertFromTexture(TextureGpu *texture, uint8 minMip, uint8 maxMip, bool automaticResolve=true)
Synchronously downloads the selected mips from a TextureGpu into this Image.
Definition: OgreTextureGpu.h:291
uint8 getNumMipmaps() const

Technically you can do setManualSwapRelease( true ) and leave it like that, but then you MUST call performManualRelease and that's bug prone.

Incorrect usage of this functionality may result in crashes or leaks

Alternatively you can avoid setManualSwapRelease by taking pictures before calling Window::swapBuffers.

To do that use FrameListener::frameRenderingQueued listener, but* you still have to call setWantsToDownload( true ) and check canDownloadData returns true.

Reimplemented from Ogre::Window.

◆ setWantsToDownload()

void Ogre::MetalWindow::setWantsToDownload ( bool  bWantsToDownload)

On Metal you must call this function and set it to true in order to take pictures.

If you no longer need that functionality, set it to false to improve performance

Reimplemented from Ogre::Window.

◆ swapBuffers()

void Ogre::MetalWindow::swapBuffers ( )

Implements Ogre::Window.

◆ windowMovedOrResized()

void Ogre::MetalWindow::windowMovedOrResized ( )

Notify that the window has been resized.

You don't need to call this unless you created the window externally.

Reimplemented from Ogre::Window.

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