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 |
재구현된 보호 함수
virtual int | metric(QPaintDevice::PaintDeviceMetric metric) const override |
상세 설명
QOpenGLPaintDevice는 현재 QOpenGL 컨텍스트를 사용하여 QPainter draw 명령을 렌더링합니다. 컨텍스트는 생성 시 캡처됩니다. OpenGL (ES) 2.0 이상을 지원해야 합니다.
성능
QOpenGLPaintDevice는 거의 항상 하드웨어 가속되며 소프트웨어 래스터화보다 훨씬 빠를 수 있는 잠재력을 가지고 있습니다. 그러나 상태 변화에 더 민감하므로 최적의 성능을 얻으려면 그리기 명령을 신중하게 주문해야 합니다.
앤티앨리어싱 및 품질
OpenGL 페인트 엔진의 앤티앨리어싱은 멀티샘플링을 사용하여 수행됩니다. 대부분의 하드웨어는 멀티샘플링을 수행하기 위해 훨씬 더 많은 메모리를 필요로 하며 그 결과 품질은 소프트웨어 페인트 엔진의 품질과 동등하지 않습니다. OpenGL 페인트 엔진의 강점은 시각적 렌더링 품질이 아닌 성능에 있습니다.
상태 변경
QPainter 를 사용하여 QOpenGLPaintDevice에 페인팅할 때 현재 OpenGL 컨텍스트의 상태는 페인트 엔진의 요구 사항을 반영하여 변경됩니다. 응용 프로그램은 OpenGL 상태, 특히 현재 셰이더 프로그램, OpenGL 뷰포트, 텍스처 단위 및 그리기 모드가 원래 조건으로 재설정되는 것에 의존해서는 안 됩니다.
QPainter와 OpenGL 혼합
QPainter 와 OpenGL을 혼합할 때는 내부 상태를 복원할 수 있도록 QPainter 에 OpenGL 상태가 혼란스러워졌을 수 있음을 알려야 합니다. 이는 OpenGL 렌더링을 시작하기 전에 QPainter::beginNativePainting()를 호출하고 완료 후 QPainter::endNativePainting()를 호출하여 수행합니다.
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()도 참조하십시오 .
[virtual noexcept]
QOpenGLPaintDevice::~QOpenGLPaintDevice()
QOpenGLPaintDevice 를 파괴합니다.
QOpenGLContext *QOpenGLPaintDevice::context() const
페인트 장치와 연관된 OpenGL 컨텍스트를 반환합니다.
qreal QOpenGLPaintDevice::dotsPerMeterX() const
가로로 미터당 픽셀 수를 반환합니다.
setDotsPerMeterX()도 참조하세요 .
qreal QOpenGLPaintDevice::dotsPerMeterY() const
세로로 미터당 픽셀 수를 반환합니다.
setDotsPerMeterY()도 참조하세요 .
[virtual]
void QOpenGLPaintDevice::ensureActiveTarget()
이 가상 메서드는 여러 QOpenGLPaintDevice 인스턴스가 번갈아 그리기 호출을 실행할 때 대상 프레임 버퍼 객체 또는 컨텍스트를 다시 바인딩할 수 있도록 콜백으로 제공됩니다.
beginNativePainting()도 이 메서드를 트리거합니다.
기본 구현은 아무 작업도 수행하지 않습니다.
[override virtual protected]
int QOpenGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
재구현합니다: QPaintDevice::metric(QPaintDevice::PaintDeviceMetric 메트릭) const.
[override virtual]
QPaintEngine *QOpenGLPaintDevice::paintEngine() const
재구현합니다: QPaintDevice::paintEngine() const.
bool QOpenGLPaintDevice::paintFlipped() const
그림이 Y축을 중심으로 뒤집힌 경우 true
을 반환합니다.
setPaintFlipped()도 참조하세요 .
void QOpenGLPaintDevice::setDevicePixelRatio(qreal devicePixelRatio)
페인트 장치의 장치 픽셀 비율을 devicePixelRatio 으로 설정합니다.
void QOpenGLPaintDevice::setDotsPerMeterX(qreal dpmx)
가로로 미터당 픽셀 수를 dpmx 로 설정합니다.
dotsPerMeterX()도 참조하세요 .
void QOpenGLPaintDevice::setDotsPerMeterY(qreal dpmy)
미터당 픽셀 수를 수직으로 dpmy 으로 설정합니다.
dotsPerMeterY()도 참조하세요 .
void QOpenGLPaintDevice::setPaintFlipped(bool flipped)
그림이 Y축을 중심으로 뒤집힐지 여부를 flipped 로 설정합니다.
paintFlipped()도 참조하세요 .
void QOpenGLPaintDevice::setSize(const QSize &size)
페인트 장치의 픽셀 크기를 size 로 설정합니다.
size()도 참조하세요 .
QSize QOpenGLPaintDevice::size() const
페인트 장치의 픽셀 크기를 반환합니다.
setSize()도 참조하세요 .
© 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.