QOpenGLVersionFunctionsFactory Class
指定されたバージョンとプロファイルのOpenGL関数へのアクセスを提供します。詳細...
ヘッダー | #include <QOpenGLVersionFunctionsFactory> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS OpenGL) target_link_libraries(mytarget PRIVATE Qt6::OpenGL) |
qmake: | QT += opengl |
以来: | Qt 6.0 |
静的パブリックメンバ
QAbstractOpenGLFunctions * | get(const QOpenGLVersionProfile &versionProfile = QOpenGLVersionProfile(), QOpenGLContext *context = nullptr) |
TYPE * | get(QOpenGLContext *context = nullptr) |
メンバ関数の説明
[static]
QAbstractOpenGLFunctions *QOpenGLVersionFunctionsFactory::get(const QOpenGLVersionProfile &versionProfile = QOpenGLVersionProfile(), QOpenGLContext *context = nullptr)
versionProfile contextQAbstractOpenGLFunctions::initializeOpenGLFunctions() は、context がカレントである限り、呼び出す必要はない。context が最新でないときにこの関数を呼び出すことも可能ですが、その場合、QAbstractOpenGLFunctions::initializeOpenGLFunctions() を後で呼び出すことによって適切な初期化を保証するのは呼び出し側の責任です。
通常、この関数のテンプレート・バージョンを使用して、結果を自動的に正しい型にキャストします。
[static]
template <typename TYPE> TYPE *QOpenGLVersionFunctionsFactory::get(QOpenGLContext *context = nullptr)
この関数はget()をオーバーロードする。
このコンテキストのバージョンとプロファイルのすべての関数へのアクセスを提供するオブジェクトへのポインタを返します。context がカレントである限り、QAbstractOpenGLFunctions::initializeOpenGLFunctions() を呼び出す必要はありません。context が最新でないときにこの関数を呼び出すことも可能ですが、その場合、QAbstractOpenGLFunctions::initializeOpenGLFunctions() を後で呼び出して適切な初期化を保証するのは呼び出し側の責任です。
通常、この関数のテンプレート・バージョンを使用して、結果を自動的に正しい型にキャストします。
autofuncs=QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_3_3_Core>(コンテキスト);if(!funcs) { { { { funcs qFatal("Could not obtain required OpenGL context version"); }
コンテキストが作成されたものとは異なるバージョンやプロファイルの関数オブジェクトを要求することが可能です。これを行うには、この関数のテンプレート・バージョンを使用して、テンプレート・パラメータとして希望の関数オブジェクト・タイプを指定するか、QOpenGLVersionProfile オブジェクトを非テンプレート関数の引数として渡します。
他のバージョンやプロファイルの関数オブジェクトへのリクエストは失敗する可能性があり、その場合はnullptr
を返すことに注意してください。関数オブジェクトの生成に失敗する可能性がある状況とは、このコンテキストのバージョンやプロファイルにない関数を要求したために要求を満たすことができない場合です。例えば
- 3.3コアプロファイルの関数オブジェクトを要求すると成功します。
- 3.3互換性プロファイル関数オブジェクトを要求すると失敗します。非推奨関数の解決に失敗するでしょう。
- 4.3 コア・プロファイル関数オブジェクトを要求すると失敗します。バージョン4.0-4.3で導入された新しいコア関数の解決に失敗するでしょう。
- 3.1の関数オブジェクトを要求すると成功します。3.1には3.3コアにもないものはありません。
このメソッドで関数オブジェクトを作成した場合、QOpenGLContext がオブジェクトの所有権を保持することに注意してください。これは、オブジェクトをキャッシュして共有できるようにするためです。
© 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.