QOpenGLShader Class
QOpenGLShaderクラスは、OpenGLシェーダーをコンパイルできるようにします。詳細...
ヘッダー | #include <QOpenGLShader> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS OpenGL) target_link_libraries(mytarget PRIVATE Qt6::OpenGL) |
qmake: | QT += opengl |
継承: | QObject |
- 継承メンバを含む全メンバのリスト
- QOpenGLShaderは、Rendering in 3D に含まれています。
パブリックタイプ
flags | ShaderType |
enum | ShaderTypeBit { Vertex, Fragment, Geometry, TessellationControl, TessellationEvaluation, Compute } |
パブリック関数
QOpenGLShader(QOpenGLShader::ShaderType type, QObject *parent = nullptr) | |
virtual | ~QOpenGLShader() |
bool | compileSourceCode(const char *source) |
bool | compileSourceCode(const QByteArray &source) |
bool | compileSourceCode(const QString &source) |
bool | compileSourceFile(const QString &fileName) |
bool | isCompiled() const |
QString | log() const |
GLuint | shaderId() const |
QOpenGLShader::ShaderType | shaderType() const |
QByteArray | sourceCode() const |
静的パブリック・メンバー
bool | hasOpenGLShaders(QOpenGLShader::ShaderType type, QOpenGLContext *context = nullptr) |
詳細説明
このクラスは、OpenGLシェーディング言語(GLSL)とOpenGL/ESシェーディング言語(GLSL/ES)で書かれたシェーダーをサポートします。
QOpenGLShader とQOpenGLShaderProgram は、頂点シェーダーとフラグメント・シェーダーのコンパイルとリンクの詳細からプログラマーを保護します。
QOpenGLShaderProgramも参照してください 。
メンバ型ドキュメント
enum QOpenGLShader::ShaderTypeBit
flags QOpenGLShader::ShaderType
この enum は、作成されるQOpenGLShader のタイプを指定します。
定数 | 値 | 説明 |
---|---|---|
QOpenGLShader::Vertex | 0x0001 | OpenGL Shading Language (GLSL) で書かれた頂点シェーダ。 |
QOpenGLShader::Fragment | 0x0002 | OpenGL Shading Language(GLSL)で書かれたフラグメントシェーダ。 |
QOpenGLShader::Geometry | 0x0004 | OpenGL Shading Language(GLSL)で書かれたジオメトリ・シェーダ(OpenGL >= 3.2またはOpenGL ES >= 3.2が必要)。 |
QOpenGLShader::TessellationControl | 0x0008 | OpenGLシェーディング言語(GLSL)で書かれたテッセレーション・コントロール・シェーダー(OpenGL >= 4.0またはOpenGL ES >= 3.2が必要)。 |
QOpenGLShader::TessellationEvaluation | 0x0010 | OpenGLシェーディング言語(GLSL)で書かれたテッセレーション評価シェーダ(OpenGL >= 4.0またはOpenGL ES >= 3.2が必要)。 |
QOpenGLShader::Compute | 0x0020 | OpenGLシェーディング言語(GLSL)で書かれたコンピュート・シェーダー(OpenGL >= 4.3またはOpenGL ES >= 3.1が必要)。 |
ShaderType型はQFlags<ShaderTypeBit>のtypedefです。ShaderTypeBitの値のORの組み合わせを格納する。
メンバー関数ドキュメント
[explicit]
QOpenGLShader::QOpenGLShader(QOpenGLShader::ShaderType type, QObject *parent = nullptr)
指定されたtype の新しい QOpenGLShader オブジェクトを構築し、parent にアタッチします。シェーダープログラムがサポートされていない場合、QOpenGLShaderProgram::hasOpenGLShaderPrograms() は false を返します。
このコンストラクタの後には通常、compileSourceCode() またはcompileSourceFile() を呼び出します。
シェーダは現在のQOpenGLContext に関連付けられます。
compileSourceCode() およびcompileSourceFile()も参照してください 。
[virtual noexcept]
QOpenGLShader::~QOpenGLShader()
このシェーダを削除します。シェーダがQOpenGLShaderProgram オブジェクトにアタッチされている場合、実際のシェーダはQOpenGLShaderProgram が破棄されるまで残ります。
bool QOpenGLShader::compileSourceCode(const char *source)
このシェーダーのsource コードを設定し、コンパイルします。ソースのコンパイルに成功した場合はtrue
を返し、失敗した場合は false を返します。
compileSourceFile()も参照してください 。
bool QOpenGLShader::compileSourceCode(const QByteArray &source)
これはオーバーロードされた関数です。
このシェーダのsource コードを設定し、コンパイルします。ソースのコンパイルに成功した場合はtrue
を返し、失敗した場合は false を返します。
compileSourceFile()も参照してください 。
bool QOpenGLShader::compileSourceCode(const QString &source)
これはオーバーロードされた関数です。
このシェーダのsource コードを設定し、コンパイルします。ソースのコンパイルに成功した場合はtrue
を返し、失敗した場合は false を返します。
compileSourceFile()も参照してください 。
bool QOpenGLShader::compileSourceFile(const QString &fileName)
このシェーダーのソースコードをfileName の内容に設定し、コンパイルします。ファイルを開いてソースをコンパイルできた場合はtrue
を返し、そうでない場合は false を返します。
compileSourceCode()も参照してください 。
[static]
bool QOpenGLShader::hasOpenGLShaders(QOpenGLShader::ShaderType type, QOpenGLContext *context = nullptr)
type 型のシェーダープログラムがこのシステムでサポートされている場合はtrue
を返し、そうでない場合は false を返す。
context は GLSL 拡張を解決するために使用される。context がnullptr
の場合、QOpenGLContext::currentContext() が使用される。
bool QOpenGLShader::isCompiled() const
このシェーダがコンパイルされていればtrue
を返し、そうでなければ false を返します。
compileSourceCode() およびcompileSourceFile()も参照して ください。
QString QOpenGLShader::log() const
最後のコンパイル時に発生したエラーと警告を返します。
compileSourceCode() およびcompileSourceFile()も参照 。
GLuint QOpenGLShader::shaderId() const
このシェーダーに関連付けられた OpenGL 識別子を返します。
QOpenGLShaderProgram::programId()も参照してください 。
QOpenGLShader::ShaderType QOpenGLShader::shaderType() const
このシェーダーのタイプを返します。
QByteArray QOpenGLShader::sourceCode() const
このシェーダのソースコードを返します。
compileSourceCode()も参照してください 。
© 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.