Using hardware acceleration(GPU) for QWidget::paintEvent()
Unsolved
General and Desktop
-
How would I convert below code to use hardware rendering ?
- My BaseWidget class has to be a custom QWidget.
- Do I have to perform hardware checks before writing any GPU related code?
- Will OpenGLWidget help ?
BaseWidget::BaseWidget() { ... m_pCanvas = new QWidget; m_pQVBoxLayout->addWidget(m_pCanvas); this->setLayout(m_pQVBoxLayout); ... } //supposed to be called 30 times a second. BaseWidget::getImageData(uchar* buf, size_t size) { m_pQPixmap->loadFromData(buf,size,"BMP"); this->update(); } BaseWidget::paintEvent() { ... painter.drawPixmap(rect,*m_pQPixmap, m_pQImage->rect()); ... }
-
Hi,
- Why ?
- Depends on your target
- Might be. QWidget doesn't use hardware acceleration.
-
Thanks for the reply
- Has to be a QWidget because the host software API takes Qwidget object as an argument.
- I guess OpenGL should relieve me of that checks.
-
- If you are sure that the target has a GPU.
-
@SGaist
Yes it does have a GPU.What does Qt use for drawing on Windows? GDI ?
-
It uses the raster engine. See here for historical informations.
3/6