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)
context 의 versionProfile 에 대한 모든 함수에 대한 액세스를 제공하는 객체에 대한 포인터를 반환합니다. context 가 최신 상태인 한 QAbstractOpenGLFunctions::initializeOpenGLFunctions() 를 호출할 필요가 없습니다. context 가 최신이 아닌 경우에도 이 함수를 호출할 수 있지만, 이 경우 나중에 QAbstractOpenGLFunctions::initializeOpenGLFunctions()를 호출하여 적절한 초기화를 보장하는 것은 호출자의 책임입니다.
일반적으로 이 함수의 템플릿 버전을 사용하면 결과가 자동으로 올바른 유형으로 캐스팅됩니다.
[static]
template <typename TYPE> TYPE *QOpenGLVersionFunctionsFactory::get(QOpenGLContext *context = nullptr)
이 함수는 get()을 오버로드합니다.
이 컨텍스트의 버전 및 프로필에 대한 모든 함수에 대한 액세스를 제공하는 객체에 대한 포인터를 반환합니다. context 가 최신 상태인 한 QAbstractOpenGLFunctions::initializeOpenGLFunctions()를 호출할 필요가 없습니다. context 가 최신이 아닌 경우에도 이 함수를 호출할 수 있지만, 이 경우 나중에 QAbstractOpenGLFunctions::initializeOpenGLFunctions()를 호출하여 적절한 초기화를 보장하는 것은 호출자의 책임입니다.
일반적으로 이 함수의 템플릿 버전을 사용하면 결과가 자동으로 올바른 유형으로 캐스팅됩니다.
자동 함수 = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_3_3_Core>(context);if (!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.