Qt 3D: 멀티 뷰포트 QML 예제
여러 뷰포트에서 씬그래프를 렌더링하는 것을 보여주는 QML 예제입니다.
멀티 뷰포트는 네 개의 가상 카메라 시점의 씬그래프를 창의 네 사분면으로 렌더링합니다. 이는 3D CAD 또는 모델링 툴의 일반적인 구성이며, 자동차 레이싱 게임이나 CCTV 카메라 디스플레이에서 백미러를 렌더링하는 데 도움이 되도록 조정할 수 있습니다.
자세한 내용은 멀티 뷰포트 프레임그래프를 참조하십시오.
예제 실행하기
에서 예제를 실행하려면 Qt Creator에서 Welcome 모드를 열고 Examples 에서 예제를 선택합니다. 자세한 내용은 예제 빌드 및 실행을 참조하십시오.
다중 렌더뷰 생성
프레임그래프 규칙에 정의된 규칙을 사용하여 프레임그래프에서 5개의 렌더뷰 객체를 생성합니다:
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 노드가 첫 번째가 아닌 마지막 노드라면 모든 렌더링이 완료된 직후 모든 것이 지워지기 때문에 검은색 화면이 나타납니다. 비슷한 이유로 프레임그래프의 루트로 사용할 수 없는데, 이는 각 뷰포트의 전체 화면을 지우는 호출이 발생하기 때문입니다.
프레임그래프의 선언 순서가 중요하지만, Qt 3D 는 각 렌더뷰가 다른 렌더뷰와 독립적이기 때문에 렌더뷰의 상태가 유효한 동안 제출할 렌더커맨드 세트를 생성할 목적으로 각 렌더뷰를 병렬로 처리할 수 있습니다.
Qt 3D 는 사용 가능한 코어 수에 따라 자연스럽게 확장되는 작업 기반 병렬 처리 방식을 사용합니다. 렌더뷰에 대한 렌더커맨드는 여러 코어에서 병렬로 생성할 수 있으며, 전용 OpenGL 제출 스레드에서 올바른 순서로 렌더뷰를 제출하기만 하면 결과 장면이 올바르게 렌더링됩니다.
© 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.