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 &
)
拷贝赋值运算符。