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)
이 컨텍스트의 버전 및 프로필에 대한 모든 함수에 접근할 수 있게 해주는 객체에 대한 포인터를 반환합니다. ` context `가 최신 상태인 한, `QAbstractOpenGLFunctions::initializeOpenGLFunctions()`를 호출할 필요가 없습니다. context 가 현재 상태가 아닐 때도 이 함수를 호출할 수 있지만, 이 경우 호출자는 나중에 QAbstractOpenGLFunctions::initializeOpenGLFunctions()를 호출하여 올바르게 초기화되도록 해야 할 책임이 있습니다.
일반적으로 이 함수의 템플릿 버전을 사용하여 결과가 올바른 형식으로 자동 변환되도록 합니다.
auto funcs = 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 `가 해당 객체의 소유권을 유지한다는 점에 유의하십시오. 이는 객체를 캐시하고 공유할 수 있도록 하기 위함입니다.
이 함수는 ` QOpenGLVersionFunctionsFactory::get()`를 오버로드합니다.
© 2026 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.