QOpenGLPaintDevice 類啓用描繪到 OpenGL 上下文使用 QPainter . 更多...
| 頭: | #include <QOpenGLPaintDevice> |
| qmake: | QT += gui |
| Since: | Qt 5.0 |
| 繼承: | QPaintDevice |
該類在 Qt 5.0 引入。
| QOpenGLPaintDevice (int width , int height ) | |
| QOpenGLPaintDevice (const QSize & size ) | |
| QOpenGLPaintDevice () | |
| virtual | ~QOpenGLPaintDevice () |
| QOpenGLContext * | context () const |
| qreal | dotsPerMeterX () const |
| qreal | dotsPerMeterY () const |
| virtual void | ensureActiveTarget () |
| bool | paintFlipped () const |
| void | setDevicePixelRatio (qreal devicePixelRatio ) |
| void | setDotsPerMeterX (qreal dpmx ) |
| void | setDotsPerMeterY (qreal dpmy ) |
| void | setPaintFlipped (bool flipped ) |
| void | setSize (const QSize & size ) |
| QSize | size () const |
| virtual QPaintEngine * | paintEngine () const override |
| virtual int | metric (QPaintDevice::PaintDeviceMetric metric ) const override |
QOpenGLPaintDevice 使用 current QOpenGL 上下文來渲染 QPainter 繪製命令。上下文是構造時捕獲的。它要求支持 OpenGL (ES) 2.0 或更高版本。
QOpenGLPaintDevice 幾乎始終硬件加速且擁有比軟件光柵化快得多的潛力。不管怎樣,它對狀態變化更敏感,因此要求小心謹慎排序繪製命令以實現最優性能。
OpenGL 描繪引擎中的抗鋸齒是使用多重采樣完成的。大多數硬件顯著要求更多內存來做多重采樣,且結果的品質與軟件描繪引擎的品質不相上下。OpenGL 描繪引擎的優勢在於它的性能,而不是它的視覺渲染品質。
當描繪到 QOpenGLPaintDevice 使用 QPainter , the state of the current OpenGL context will be altered by the paint engine to reflect its needs. Applications should not rely upon the OpenGL state being reset to its original conditions, particularly the current shader program, OpenGL viewport, texture units, and drawing modes.
當混閤 QPainter and OpenGL, it is important to notify QPainter that the OpenGL state may have been cluttered so it can restore its internal state. This is achieved by calling QPainter::beginNativePainting () before starting the OpenGL rendering and calling QPainter::endNativePainting () after finishing.
另請參閱 OpenGL 窗口範例 .
構造 QOpenGLPaintDevice 采用給定 width and height .
QOpenGLPaintDevice 僅對當前上下文有效。
另請參閱 QOpenGLContext::currentContext ().
構造 QOpenGLPaintDevice 采用給定 size .
QOpenGLPaintDevice 僅對當前上下文有效。
另請參閱 QOpenGLContext::currentContext ().
構造 QOpenGLPaintDevice。
QOpenGLPaintDevice 僅對當前上下文有效。
另請參閱 QOpenGLContext::currentContext ().
[虛擬]
QOpenGLPaintDevice::
~QOpenGLPaintDevice
()
銷毀 QOpenGLPaintDevice .
Returns the OpenGL context associated with the paint device.
返迴水平每米的像素數。
另請參閱 setDotsPerMeterX ().
返迴垂直每米的像素數。
另請參閱 setDotsPerMeterY ().
[虛擬]
void
QOpenGLPaintDevice::
ensureActiveTarget
()
This virtual method is provided as a callback to allow re-binding a target frame buffer object or context when different QOpenGLPaintDevice instances are issuing draw calls alternately.
beginNativePainting() will also trigger this method.
默認實現什麼都不做。
[override virtual protected]
int
QOpenGLPaintDevice::
metric
(
QPaintDevice::PaintDeviceMetric
metric
) const
重實現: QPaintDevice::metric (QPaintDevice::PaintDeviceMetric metric) const.
[override virtual]
QPaintEngine
*QOpenGLPaintDevice::
paintEngine
() const
重實現: QPaintDevice::paintEngine () const.
返迴
true
若描繪是圍繞 Y 軸翻轉。
另請參閱 setPaintFlipped ().
Sets the device pixel ratio for the paint device to devicePixelRatio .
Sets the number of pixels per meter horizontally to dpmx .
另請參閱 dotsPerMeterX ().
Sets the number of pixels per meter vertically to dpmy .
另請參閱 dotsPerMeterY ().
Sets whether painting should be flipped around the Y-axis or not to flipped .
另請參閱 paintFlipped ().
Sets the pixel size of the paint device to size .
另請參閱 size ().
返迴描繪設備的像素尺寸。
另請參閱 setSize ().