QQuickFramebufferObject Class
QQuickFramebufferObject 클래스는 프레임버퍼 객체(FBO)를 사용하여 OpenGL 렌더링을 Qt Quick 와 통합하기 위한 편의 클래스입니다. 더 보기...
헤더: | #include <QQuickFramebufferObject> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Quick) target_link_libraries(mytarget PRIVATE Qt6::Quick) |
qmake: | QT += quick |
상속합니다: | QQuickItem |
공용 유형
class | Renderer |
속성
- mirrorVertically : bool
- textureFollowsItemSize : bool
공용 함수
QQuickFramebufferObject(QQuickItem *parent = nullptr) | |
virtual QQuickFramebufferObject::Renderer * | createRenderer() const = 0 |
bool | mirrorVertically() const |
void | setMirrorVertically(bool enable) |
void | setTextureFollowsItemSize(bool follows) |
bool | textureFollowsItemSize() const |
재구현된 공용 함수
virtual bool | isTextureProvider() const override |
virtual void | releaseResources() override |
virtual QSGTextureProvider * | textureProvider() const override |
신호
void | mirrorVerticallyChanged(bool) |
void | textureFollowsItemSizeChanged(bool) |
상세 설명
경고: 이 클래스는 Qt Quick 가 OpenGL을 통해 렌더링할 때만 작동합니다. 벌칸이나 메탈과 같은 다른 그래픽 API와는 호환되지 않습니다. 이 클래스는 Qt 5 애플리케이션이 OpenGL에 연결되는 한 소스 호환성 중단 없이 작동할 수 있도록 하기 위해서만 존재하는 레거시 클래스로 취급해야 합니다.
대부분의 플랫폼에서 렌더링은 전용 스레드에서 이루어집니다. 이러한 이유로 QQuickFramebufferObject 클래스는 항목 구현과 FBO 렌더링을 엄격하게 분리합니다. QML에 필요한 프로퍼티 및 UI 관련 헬퍼 함수와 같은 모든 항목 로직은 QQuickFramebufferObject 클래스 서브클래스에 위치해야 합니다. 렌더링과 관련된 모든 것은 QQuickFramebufferObject::Renderer 클래스에 위치해야 합니다.
두 스레드에서 발생하는 경합 조건과 읽기/쓰기 문제를 방지하려면 렌더러와 항목이 공유 변수를 읽거나 쓰지 않도록 하는 것이 중요합니다. 항목과 렌더러 간의 통신은 주로 QQuickFramebufferObject::Renderer::synchronize() 함수를 통해 이루어져야 합니다. 이 함수는 GUI 스레드가 차단된 상태에서 렌더링 스레드에서 호출됩니다.
항목과 렌더러 간의 통신을 위해 대기 중인 연결 또는 이벤트를 사용할 수도 있습니다.
렌더러와 FBO는 모두 내부적으로 메모리가 관리됩니다.
FBO로 렌더링하려면 사용자는 Renderer 클래스를 서브클래싱하고 Renderer::render() 함수를 다시 구현해야 합니다. Renderer 서브클래스는 createRenderer()에서 반환됩니다.
FBO의 크기는 기본적으로 항목의 크기에 맞게 조정됩니다. 고정 크기를 선호하는 경우 textureFollowsItemSize 를 false
로 설정하고 QQuickFramebufferObject::Renderer::createFramebufferObject()에서 원하는 텍스처를 반환합니다.
Qt 5.4부터 QQuickFramebufferObject 클래스는 texture provider 이며 ShaderEffects 및 텍스처 공급자를 소비하는 다른 클래스에서 직접 사용할 수 있습니다.
씬 그래프와 렌더링도참조하십시오 .
프로퍼티 문서
mirrorVertically : bool
이 속성은 그릴 때 FBO 콘텐츠의 크기를 세로로 미러링할지 여부를 제어합니다. 이를 통해 표준 기대치를 따르지 않는 타사 렌더링 코드를 쉽게 통합할 수 있습니다.
기본값은 false
입니다.
기능에 액세스합니다:
bool | mirrorVertically() const |
void | setMirrorVertically(bool enable) |
알림 신호:
void | mirrorVerticallyChanged(bool) |
textureFollowsItemSize : bool
이 속성은 FBO의 텍스처 크기가 QQuickFramebufferObject 항목의 치수를 따라야 하는지 여부를 제어합니다. 이 속성이 false인 경우 FBO는 처음 표시될 때 한 번만 생성됩니다. true로 설정하면 항목의 치수가 변경될 때마다 FBO가 다시 생성됩니다.
기본값은 true
입니다.
기능에 접근합니다:
bool | textureFollowsItemSize() const |
void | setTextureFollowsItemSize(bool follows) |
알림 신호:
void | textureFollowsItemSizeChanged(bool) |
멤버 함수 문서
QQuickFramebufferObject::QQuickFramebufferObject(QQuickItem *parent = nullptr)
부모가 parent 인 새 QQuickFramebufferObject를 생성합니다.
[pure virtual]
QQuickFramebufferObject::Renderer *QQuickFramebufferObject::createRenderer() const
이 함수를 다시 구현하여 FBO로 렌더링하는 데 사용되는 렌더러를 생성합니다.
이 함수는 GUI 스레드가 차단된 상태에서 렌더링 스레드에서 호출됩니다.
[override virtual]
bool QQuickFramebufferObject::isTextureProvider() const
재구현합니다: QQuickItem::isTextureProvider() const.
[override virtual]
void QQuickFramebufferObject::releaseResources()
다시 구현합니다: QQuickItem::releaseResources().
[override virtual]
QSGTextureProvider *QQuickFramebufferObject::textureProvider() const
재구현합니다: QQuickItem::textureProvider() const.
© 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.