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는 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도 참조하십시오 .
멤버 유형 문서
열거형 QOpenGLShader::ShaderTypeBit
플래그 QOpenGLShader::ShaderType
이 열거형은 생성 중인 QOpenGLShader 의 유형을 지정합니다.
Constant | 값 | 설명 |
---|---|---|
QOpenGLShader::Vertex | 0x0001 | OpenGL 셰이딩 언어(GLSL)로 작성된 버텍스 셰이더입니다. |
QOpenGLShader::Fragment | 0x0002 | OpenGL 셰이딩 언어(GLSL)로 작성된 프래그먼트 셰이더입니다. |
QOpenGLShader::Geometry | 0x0004 | OpenGL 셰이딩 언어(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.