Qt5GfxDevice class
#include <nCine/Backends/Qt5GfxDevice.h>
Graphics device that wraps a Qt5 Qt5Widget.
Drives an IGfxDevice whose surface and OpenGL context are owned by the hosting QOpenGLWidget, so most window operations are delegated to Qt5.
Base classes
- class nCine::IGfxDevice
- Represents the interface to the graphics device where everything is rendered.
Constructors, destructors, conversion operators
- Qt5GfxDevice(const WindowMode& windowMode, const ContextInfo& contextInfo, const DisplayMode& displayMode, Qt5Widget& widget)
Public functions
- void setSwapInterval(int interval) override
- Sets the number of vertical blanks to occur before a buffer swap.
- void setResolution(bool fullscreen, int width = 0, int height = 0) override
- Sets the screen resolution with two integers.
- void update() override
- No-op, the widget swaps its own buffers.
- void setWindowPosition(int x, int y) override
- Sets the position of the application window with two integers.
- void setWindowSize(int width, int height) override
- Sets the window size with two integers.
- void setWindowTitle(StringView windowTitle) override
- Sets the application window title.
- void setWindowIcon(StringView iconFilename) override
- Sets the application window icon.
- auto windowPosition() const -> const Vector2i override
- Returns the window position as a
Vector2iobject. - void flashWindow() const override
- Highlights the application window to notify the user.
- auto currentVideoMode(unsigned int monitorIndex) const -> const VideoMode& override
- Returns the current video mode for the specified monitor.
- void adoptWidgetFramebuffer()
- Points the engine's "screen" at the widget's framebuffer and re-syncs cached OpenGL state.
- void updateResolution(int drawableWidth, int drawableHeight)
- Adopts a framebuffer size the widget was resized to by Qt5 itself.
Protected functions
- void updateMonitors() override
- Updates the array of connected monitors.
- void setResolutionInternal(int width, int height) override
Function documentation
void nCine:: Backends:: Qt5GfxDevice:: setSwapInterval(int interval) override
Sets the number of vertical blanks to occur before a buffer swap.
An interval of -1 will enable adaptive v-sync if available.
void nCine:: Backends:: Qt5GfxDevice:: setWindowSize(int width,
int height) override
Sets the window size with two integers.
void nCine:: Backends:: Qt5GfxDevice:: adoptWidgetFramebuffer()
Points the engine's "screen" at the widget's framebuffer and re-syncs cached OpenGL state.
QOpenGLWidget renders into a framebuffer object of its own rather than into the window, and Qt5 draws the rest of the interface with the same context in between two engine frames. So the handle (which changes whenever the widget is resized) is republished and every cached binding dropped, exactly like the libretro backend does for the frontend's framebuffer.
void nCine:: Backends:: Qt5GfxDevice:: updateResolution(int drawableWidth,
int drawableHeight)
Adopts a framebuffer size the widget was resized to by Qt5 itself.
To be called from Qt5Widget::resizeGL() only, which is where the OpenGL context is current.