K
K
Kirill Khalitov2014-12-03 22:38:30
Canvas
Kirill Khalitov, 2014-12-03 22:38:30

How to improve rendering performance on canvas?

Hello.
Qt has a rendering technique that inherits the QGlWidget (QOpenGlWidget) class as the base class for the canvas (widget). I understand correctly that in this case OpenGL is used for rendering, which is supposedly faster than some other way (but what is used according to the standard?).
Can a similar technique be applied to QWebKit (QWebView) to speed up the Canvas Web API?
By the way, what native tool is used for rendering in the web canvas?
PS Here in the comments I found a similar question, but did not understand the answer to it. Although I may not understand the question.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Armenian Radio, 2014-12-04
@gbg

According to the documentation , QT always uses something derived from QPainter as its renderer.
QOpenGLPaintDevice is a renderer that uses OpenGL hardware acceleration.
If you set it as a renderer when starting the application, the entire GUI, including WebView, will be drawn through it.

K
Kirill Khalitov, 2014-12-04
@Voronar

Armenian Radio : I checked this code:

#include <QApplication>
#include <QWidget>
#include <QOpenGLPaintDevice>
#include <QDebug>

int main(int argv, char **args)
{
  QApplication app(argv, args);

  QWidget               window;
  QPaintDevice*         pd    = nullptr;
  QOpenGLPaintDevice*   pgld  = nullptr;

  pd    = dynamic_cast<QPaintDevice*>(&window);
  pgld  = dynamic_cast<QOpenGLPaintDevice*>(&window);

  window.resize(250, 150);
  window.show();

  qDebug() << pd;   //0x7fffd5b2bb30
  qDebug() << pgld; //0x0

  return app.exec();
}

The second cast for QOpenGLPaintDevice did not work, this can be seen from the output of the address to the console.
It turns out that we have software rendering by default?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question