이 페이지에서

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();
}

OpenGL 관련 사항도 참조하십시오 .

멤버 함수 문서

[static] QSurfaceFormat QQuick3D::idealSurfaceFormat(int samples = -1)

해당 플랫폼에 적합한 이상적인 표면 형식을 반환합니다. 선택적으로 ` samples ` 매개변수를 지정하여 앤티앨리어싱에 사용할 멀티샘플 수를 선택할 수 있습니다.

© 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.