QQuick3D Class
올바른 서피스 형식을 선택하기 위한 도우미 클래스입니다. 더 보기...
Header: | #include <QQuick3D> |
정적 공용 멤버
QSurfaceFormat | idealSurfaceFormat(int samples = -1) |
상세 설명
OpenGL에서 Qt Quick 3D 을 사용하는 경우 Qt Quick 을 초기화할 때 어떤 종류의 surface format 을 사용할지 정의하는 추가 단계를 수행해야 합니다. Qt Quick 이 3D 콘텐츠가 사용 중임을 인식할 때쯤이면 이미 OpenGL 컨텍스트와 창 표면이 초기화되어 있기 때문입니다. 따라서 이 헬퍼 클래스는 초기화 전에 Qt Quick 3D 에서 이상적인 표면 형식을 요청하여 Qt Quick 에 대한 기본 표면으로 설정할 수 있도록 제공됩니다.
이 헬퍼가 OpenGL이 아닌 다른 렌더링 백엔드를 사용할 때 실행되면 요청된 샘플과 함께 현재 기본값 QSurfaceFormat 의 복사본만 반환합니다.
이 헬퍼가 OpenGL 렌더링 백엔드를 사용할 때 실행되면 충분히 최신 버전의 OpenGL을 테스트하고 요청 시 멀티샘플링을 지원합니다. 일반적으로 Qt Quick 은 OpenGL 2.0 또는 OpenGL ES 2.0 컨텍스트를 요청하므로 Qt Quick 3D 을 사용할 때 사용할 수 있는 기능이 제한되므로 더 성능이 좋은 컨텍스트를 요청하려면 추가 단계가 필요합니다.
올바른 사용 패턴은 QSurfaceFormat::setDefaultFormat 을 호출하여 QQuick3D::idealSurfaceFormat 에서 반환한 QSurfaceFormat 을 설정하는 것입니다. 이 메서드는 QGuiApplication 이 구성된 후 Qt Quick 애플리케이션 콘텐츠가 로드되기 전에 호출하는 것이 중요합니다. 이 코드 스니펫은 올바른 사용 패턴을 보여줍니다:
#include <QGuiApplication> #include <QQmlApplicationEngine> #include <QtGui> #include <QtQuick3D/qquick3d.h> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QSurfaceFormat::setDefaultFormat(QQuick3D::idealSurfaceFormat(4)); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); }
멤버 함수 문서
[static]
QSurfaceFormat QQuick3D::idealSurfaceFormat(int samples = -1)
플랫폼에 이상적인 표면 형식을 반환합니다. 선택적으로 samples 을 지정하여 앤티앨리어싱을 위한 멀티 샘플 수를 선택할 수 있습니다.
© 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.