QOpenGLPaintDevice Class
QOpenGLPaintDevice クラスは、QPainter を使用して OpenGL コンテキストへのペイントを可能にします。さらに...
ヘッダー | #include <QOpenGLPaintDevice> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS OpenGL) target_link_libraries(mytarget PRIVATE Qt6::OpenGL) |
qmake: | QT += opengl |
継承: | QPaintDevice |
- 継承メンバを含む全メンバのリスト
- QOpenGLPaintDeviceは、3Dレンダリングに含まれています。
パブリック関数
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 |
再実装された保護された関数
virtual int | metric(QPaintDevice::PaintDeviceMetric metric) const override |
詳細説明
QOpenGLPaintDevice は、現在のQOpenGL コンテキストを使用してQPainter 描画コマンドをレンダリングします。コンテキストは構築時にキャプチャされます。OpenGL (ES) 2.0以上のサポートが必要です。
パフォーマンス
QOpenGLPaintDevice は、ほとんどの場合ハードウェアアクセラレーションを使用し、ソフトウェアによるラスタライズよりもはるかに高速になる可能性があります。ただし、状態の変化に対してより敏感であるため、最適なパフォーマンスを得るには描画コマンドを慎重に順序付ける必要があります。
アンチエイリアシングと品質
OpenGLペイントエンジンのアンチエイリアシングは、マルチサンプリングを使って行われます。ほとんどのハードウェアは、マルチサンプリングを行うためにかなり多くのメモリを必要とし、結果として得られる品質はソフトウェアペイントエンジンの品質と同等ではありません。OpenGLペイントエンジンの強みは、そのパフォーマンスであり、ビジュアルレンダリングの品質ではありません。
状態の変化
QPainter を使用して QOpenGLPaintDevice にペイントするとき、現在の OpenGL コンテキストの状態は、ペイントエンジンのニーズを反映するために変更されます。特に、現在のシェーダプログラム、OpenGLビューポート、テクスチャユニット、描画モードなどです。
QPainterとOpenGLの混合
QPainter と OpenGL を混在させるときは、QPainter に OpenGL の状態が乱れたかもしれないことを通知して、内部状態を復元できるようにすることが重要です。これは、OpenGLレンダリングを開始する前にQPainter::beginNativePainting ()を呼び出し、終了後にQPainter::endNativePainting ()を呼び出すことで達成される。
OpenGLウィンドウの例も参照 。
メンバ関数のドキュメント
QOpenGLPaintDevice::QOpenGLPaintDevice()
QOpenGLPaintDevice を構築します。
QOpenGLPaintDevice は現在のコンテキストでのみ有効です。
QOpenGLContext::currentContext()も参照してください 。
[explicit]
QOpenGLPaintDevice::QOpenGLPaintDevice(const QSize &size)
与えられたsize で QOpenGLPaintDevice を構築します。
QOpenGLPaintDevice は現在のコンテキストでのみ有効です。
QOpenGLContext::currentContext()も参照してください 。
QOpenGLPaintDevice::QOpenGLPaintDevice(int width, int height)
与えられたwidth とheight で QOpenGLPaintDevice を構築します。
QOpenGLPaintDevice は現在のコンテキストでのみ有効です。
QOpenGLContext::currentContext()も参照してください 。
[virtual noexcept]
QOpenGLPaintDevice::~QOpenGLPaintDevice()
QOpenGLPaintDevice を破壊する。
QOpenGLContext *QOpenGLPaintDevice::context() const
ペイントデバイスに関連付けられたOpenGLコンテキストを返します。
qreal QOpenGLPaintDevice::dotsPerMeterX() const
水平1メートルあたりのピクセル数を返す。
setDotsPerMeterX()も参照 。
qreal QOpenGLPaintDevice::dotsPerMeterY() const
縦 1m あたりのピクセル数を返す。
setDotsPerMeterY()も参照 。
[virtual]
void QOpenGLPaintDevice::ensureActiveTarget()
この仮想メソッドは、異なるQOpenGLPaintDevice インスタンスが交互に描画コールを発行している場合に、ターゲットフレームバッファオブジェクトまたはコンテキストを再バインドできるようにするためのコールバックとして提供されます。
beginNativePainting() もこのメソッドを起動します。
デフォルトの実装は何もしません。
[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.
bool QOpenGLPaintDevice::paintFlipped() const
ペイントが Y 軸を中心に反転している場合はtrue
を返す。
setPaintFlipped()も参照 。
void QOpenGLPaintDevice::setDevicePixelRatio(qreal devicePixelRatio)
ペイントデバイスのピクセル比率をdevicePixelRatio に設定します。
void QOpenGLPaintDevice::setDotsPerMeterX(qreal dpmx)
水平1メートルあたりのピクセル数をdpmx に設定する。
dotsPerMeterX()も参照 。
void QOpenGLPaintDevice::setDotsPerMeterY(qreal dpmy)
縦1メートルあたりのピクセル数をdpmy に設定する。
dotsPerMeterY()も参照 。
void QOpenGLPaintDevice::setPaintFlipped(bool flipped)
ペインティングをY軸周りに反転させるかどうかをflipped に設定する。
paintFlipped()も参照のこと 。
void QOpenGLPaintDevice::setSize(const QSize &size)
ペイントデバイスのピクセルサイズをsize に設定する。
size()も参照 。
QSize QOpenGLPaintDevice::size() const
ペイントデバイスのピクセルサイズを返します。
setSize()も参照 。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.