The QOpenGLPaintDevice class enables painting to an OpenGL context using QPainter . 更多...
| 頭: | #include <QOpenGLPaintDevice> |
| qmake: | QT += gui |
| Since: | Qt 5.0 |
| 繼承: | QPaintDevice |
| QOpenGLPaintDevice () | |
| QOpenGLPaintDevice (const QSize & size ) | |
| QOpenGLPaintDevice (int width , int height ) | |
| 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 |
| QOpenGLPaintDevice ( const QOpenGLPaintDevice & ) | |
| QOpenGLPaintDevice & | operator= ( const QOpenGLPaintDevice & ) |
| virtual int | metric (QPaintDevice::PaintDeviceMetric metric ) const override |
| QScopedPointer<QOpenGLPaintDevicePrivate> | d_ptr |
The QOpenGLPaintDevice class enables painting to an OpenGL context using QPainter .
The QOpenGLPaintDevice 使用 current QOpenGL 上下文來渲染 QPainter 繪製命令。上下文是構造時捕獲的。它要求支持 OpenGL (ES) 2.0 或更高版本。
The QOpenGLPaintDevice is almost always hardware accelerated and has the potential of being much faster than software rasterization. However, it is more sensitive to state changes, and therefore requires the drawing commands to be carefully ordered to achieve optimal performance.
OpenGL 描繪引擎中的抗鋸齒是使用多重采樣完成的。大多數硬件顯著要求更多內存來做多重采樣,且結果的品質與軟件描繪引擎的品質不相上下。OpenGL 描繪引擎的優勢在於它的性能,而不是它的視覺渲染品質。
When painting to a 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 .
The QOpenGLPaintDevice is only valid for the current context.
另請參閱 QOpenGLContext::currentContext ().
構造 QOpenGLPaintDevice 采用給定 size .
The QOpenGLPaintDevice is only valid for the current context.
另請參閱 QOpenGLContext::currentContext ().
構造 QOpenGLPaintDevice 采用給定 width and height .
The QOpenGLPaintDevice is only valid for the current context.
另請參閱 QOpenGLContext::currentContext ().
[protected]
QOpenGLPaintDevice::
QOpenGLPaintDevice
(
const QOpenGLPaintDevice &
)
Default constructs an instance of QOpenGLPaintDevice.
[虛擬]
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 ().
[override virtual]
QPaintEngine
*QOpenGLPaintDevice::
paintEngine
() const
重實現自 QPaintDevice::paintEngine ().
返迴
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 ().
[protected]
QOpenGLPaintDevice
&QOpenGLPaintDevice::
operator=
(
const QOpenGLPaintDevice &
)
拷貝賦值運算符。