이 페이지에서

Qt 3D: 다중 뷰포트 QML 예제

여러 뷰포트에서 씬그래프를 렌더링하는 방법을 보여주는 QML 예제입니다.

다양한 각도에서 본 3D 물체를 보여주는 일러스트레이션

다중 뷰포트는 4대의 가상 카메라 시점에서 씬그래프를 렌더링하여 창의 4개 사분면에 표시합니다. 이는 3D CAD나 모델링 도구에서 흔히 사용되는 구성이며, 자동차 레이싱 게임의 백미러 렌더링이나 CCTV 카메라 화면을 구현하는 데에도 적용할 수 있습니다.

자세한 내용은 ‘다중 뷰포트 프레임그래프’를 참조하십시오.

예제 실행

다음 경로에서 예제를 실행할 수 있습니다.

여러 RenderView 생성

Framegraph Rules에 정의된 규칙을 사용하여 FrameGraph에서 다섯 개의 RenderView 객체를 생성합니다:

Viewport {
    id: mainViewport
    normalizedRect: Qt.rect(0, 0, 1, 1)

    ClearBuffers {
        buffers: ClearBuffers.ColorDepthBuffer
        clearColor: Qt.rgba(0.6, 0.6, 0.6, 1.0)
    }

    Viewport {
        id: topLeftViewport
        normalizedRect: Qt.rect(0, 0, 0.5, 0.5)
        CameraSelector { id: cameraSelectorTopLeftViewport }
    }

    Viewport {
        id: topRightViewport
        normalizedRect: Qt.rect(0.5, 0, 0.5, 0.5)
        CameraSelector { id: cameraSelectorTopRightViewport }
    }

    Viewport {
        id: bottomLeftViewport
        normalizedRect: Qt.rect(0, 0.5, 0.5, 0.5)
        CameraSelector { id: cameraSelectorBottomLeftViewport }
    }

    Viewport {
        id: bottomRightViewport
        normalizedRect: Qt.rect(0.5, 0.5, 0.5, 0.5)
        CameraSelector { id: cameraSelectorBottomRightViewport }
    }
}

순서가 중요합니다. ClearBuffers 노드가 첫 번째가 아닌 마지막에 위치한다면, 모든 것이 정성스럽게 렌더링된 직후에 바로 지워지게 되어 화면이 검게 표시되는 결과가 발생합니다. 비슷한 이유로, 이 노드를 FrameGraph의 루트로 사용할 수 없습니다. 그렇게 되면 각 뷰포트마다 화면 전체를 지우는 호출이 발생하게 되기 때문입니다.

FrameGraph의 선언 순서는 중요하지만, Qt 3D 는 각 RenderView가 RenderView의 상태가 유효한 동안 제출될 RenderCommands 세트를 생성하는 데 있어 서로 독립적이기 때문에 각 RenderView를 병렬로 처리할 수 있습니다.

Qt 3D xml-ph-0000@deepl.internal는 사용 가능한 코어 수에 따라 자연스럽게 확장되는 태스크 기반 병렬 처리 방식을 사용합니다. RenderView에 대한 RenderCommand는 여러 코어에서 병렬로 생성될 수 있으며, 전용 OpenGL 제출 스레드에서 RenderView를 올바른 순서대로 제출하기만 한다면 결과 장면은 올바르게 렌더링됩니다.

예제 프로젝트 @ code.qt.io

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