QOpenGLPaintDevice Class
QOpenGLPaintDevice 클래스는 ` QPainter`를 사용하여 OpenGL 컨텍스트에 렌더링을 수행할 수 있게 해줍니다. 더 보기...
| 헤더: | #include <QOpenGLPaintDevice> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS OpenGL) target_link_libraries(mytarget PRIVATE Qt6::OpenGL) |
| qmake: | QT += opengl |
| 상속: | QPaintDevice |
- 상속받은 멤버를 포함한 모든 멤버 목록
- QOpenGLPaintDevice는 3D 렌더링의 일부입니다.
공개 함수
| QOpenGLPaintDevice() | |
| QOpenGLPaintDevice(const QSize &size) | |
| QOpenGLPaintDevice(int width, int height) | |
| virtual | ~QOpenGLPaintDevice() |
| QOpenGLContext * | context() const |
| qreal | dotsPerMeterX() const |
| qreal | dotsPerMeterY() const |
| virtual void | ensureActiveTarget() |
| bool | paintFlipped() const |
| void | setDevicePixelRatio(qreal devicePixelRatio) |
| void | setDotsPerMeterX(qreal dpmx) |
| void | setDotsPerMeterY(qreal dpmy) |
| void | setPaintFlipped(bool flipped) |
| void | setSize(const QSize &size) |
| QSize | size() const |
재구현된 공용 함수
| virtual QPaintEngine * | paintEngine() const override |
보호된 함수
| QOpenGLPaintDevice(const QOpenGLPaintDevice &) | |
| QOpenGLPaintDevice & | operator=(const QOpenGLPaintDevice &) |
재구현된 보호 함수
| virtual int | metric(QPaintDevice::PaintDeviceMetric metric) const override |
상세 설명
QOpenGLPaintDevice는 현재 QOpenGL 컨텍스트를 사용하여 QPainter 드로잉 명령을 렌더링합니다. 컨텍스트는 생성 시 캡처됩니다. OpenGL (ES) 2.0 이상을 지원해야 합니다.
성능
QOpenGLPaintDevice는 거의 항상 하드웨어 가속을 지원하며, 소프트웨어 래스터화보다 훨씬 더 빠른 속도를 낼 수 있습니다. 그러나 상태 변화에 더 민감하므로, 최적의 성능을 얻으려면 드로잉 명령의 순서를 신중하게 정해야 합니다.
앤티앨리어싱 및 품질
OpenGL 페인트 엔진의 앤티앨리어싱은 멀티샘플링을 사용하여 수행됩니다. 대부분의 하드웨어는 멀티샘플링을 수행하는 데 상당히 더 많은 메모리를 필요로 하며, 그 결과로 얻어지는 품질은 소프트웨어 페인트 엔진의 품질에 미치지 못합니다. OpenGL 페인트 엔진의 강점은 시각적 렌더링 품질이 아니라 성능에 있습니다.
상태 변경
QPainter 를 사용하여 QOpenGLPaintDevice에 페인팅할 때, 페인트 엔진은 자체 요구 사항을 반영하기 위해 현재 OpenGL 컨텍스트의 상태를 변경합니다. 애플리케이션은 OpenGL 상태가 원래 조건으로 재설정될 것이라고 가정해서는 안 되며, 특히 현재 셰이더 프로그램, OpenGL 뷰포트, 텍스처 유닛 및 그리기 모드에 대해서는 더욱 그렇습니다.
QPainter와 OpenGL의 병용
QPainter 와 OpenGL을 함께 사용할 때는, OpenGL 상태가 혼란스러워졌을 수 있음을 QPainter 에 알리는 것이 중요합니다. 그래야 해당 클래스가 내부 상태를 복원할 수 있습니다. 이를 위해서는 OpenGL 렌더링을 시작하기 전에 QPainter::beginNativePainting()를 호출하고, 완료된 후에는 QPainter::endNativePainting()를 호출해야 합니다.
보안 고려 사항
경고: QOpenGLPaintDevice를 통해 렌더링되는모든 콘텐츠는 신뢰할 수 있는 콘텐츠여야 합니다. 벡터 지오메트리, 이미지 및 기타 그리기 데이터는 처리되고, 경우에 따라 수정된 후 기본 OpenGL 구현체로 전달됩니다. 애플리케이션 개발자는 사용자가 제공한 콘텐츠를 렌더링(전달)하기 전에 잠재적인 영향을 신중하게 고려해야 합니다.
OpenGL 창 예제도참조하십시오 .
멤버 함수 문서
QOpenGLPaintDevice::QOpenGLPaintDevice()
QOpenGLPaintDevice를 생성합니다.
QOpenGLPaintDevice는 현재 컨텍스트에서만 유효합니다.
QOpenGLContext::currentContext()도 참조하십시오 .
[explicit] QOpenGLPaintDevice::QOpenGLPaintDevice(const QSize &size)
지정된 ` size`을 사용하여 `QOpenGLPaintDevice`를 생성합니다.
QOpenGLPaintDevice는 현재 컨텍스트에서만 유효합니다.
QOpenGLContext::currentContext()도 참조하십시오 .
QOpenGLPaintDevice::QOpenGLPaintDevice(int width, int height)
지정된 ` width ` 및 ` height`을 사용하여 `QOpenGLPaintDevice`를 생성합니다.
QOpenGLPaintDevice는 현재 컨텍스트에서만 유효합니다.
QOpenGLContext::currentContext()도 참조하십시오 .
[protected delete] QOpenGLPaintDevice::QOpenGLPaintDevice(const QOpenGLPaintDevice &)
QOpenGLPaintDevice 의 인스턴스를 복사 생성합니다. 이 함수는 삭제되었습니다.
[virtual noexcept] QOpenGLPaintDevice::~QOpenGLPaintDevice()
QOpenGLPaintDevice 를 삭제합니다.
QOpenGLContext *QOpenGLPaintDevice::context() const
페인트 장치와 연결된 OpenGL 컨텍스트를 반환합니다.
qreal QOpenGLPaintDevice::dotsPerMeterX() const
수평 방향으로 1미터당 픽셀 수를 반환합니다.
setDotsPerMeterX()도 참조하십시오 .
qreal QOpenGLPaintDevice::dotsPerMeterY() const
수직 방향으로 1미터당 픽셀 수를 반환합니다.
setDotsPerMeterY()도 참조하십시오 .
[virtual] void QOpenGLPaintDevice::ensureActiveTarget()
이 가상 메서드는 서로 다른 ` QOpenGLPaintDevice ` 인스턴스가 번갈아 가며 드로우 호출을 발행할 때 대상 프레임 버퍼 객체나 컨텍스트를 재바인딩할 수 있도록 콜백으로 제공됩니다.
beginNativePainting()도 이 메서드를 트리거합니다.
기본 구현은 아무런 작업도 수행하지 않습니다.
[override virtual protected] int QOpenGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
QPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const를 재구현합니다.
[override virtual] QPaintEngine *QOpenGLPaintDevice::paintEngine() const
QPaintDevice::paintEngine() const를 재구현합니다.
bool QOpenGLPaintDevice::paintFlipped() const
painting이 Y축을 중심으로 뒤집혀 있으면 true 를 반환합니다.
setPaintFlipped()도 참조하십시오 .
void QOpenGLPaintDevice::setDevicePixelRatio(qreal devicePixelRatio)
페인트 장치의 장치 픽셀 비율을 devicePixelRatio 로 설정합니다.
void QOpenGLPaintDevice::setDotsPerMeterX(qreal dpmx)
수평 방향의 1미터당 픽셀 수를 dpmx 로 설정합니다.
dotsPerMeterX()도 참조하십시오 .
void QOpenGLPaintDevice::setDotsPerMeterY(qreal dpmy)
수직 방향의 1미터당 픽셀 수를 dpmy 로 설정합니다.
dotsPerMeterY()도 참조하십시오 .
void QOpenGLPaintDevice::setPaintFlipped(bool flipped)
flipped 에 따라 그림을 Y축을 중심으로 뒤집을지 여부를 설정합니다.
paintFlipped()도 참조하십시오 .
void QOpenGLPaintDevice::setSize(const QSize &size)
페인트 장치의 픽셀 크기를 size 로 설정합니다.
size()도 참조하십시오 .
QSize QOpenGLPaintDevice::size() const
페인트 장치의 픽셀 크기를 반환합니다.
setSize()도 참조하십시오 .
[protected delete] QOpenGLPaintDevice &QOpenGLPaintDevice::operator=(const QOpenGLPaintDevice &)
other 를 이 QOpenGLPaintDevice 인스턴스에 복사-할당합니다. 이 함수는 삭제되었습니다.
© 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.