1

As I understand, there were no modules in early Qt versions, there were separate classes with different functions, including graphical. Opengl support was realized In qt 1.2. However, QPainter, QImage existed in early versions. So, is it correct to say that these classes are native (in other words, classes, which were primordial); opengl classes - non-native (it is a separste branch, after all)? I`d like to learn a further evolution of Qtopengl as non-native and alternative way for creating 2D graphics ih Qt, influence of this module on evolution of native methods (for creating 2D graphics).

László Papp
  • 51,870
  • 39
  • 111
  • 135
  • 1
    Your other question has just been closed because you did not explain what you mean by native, but for now I _might_ be getting it. You mean software rasterization as opposed to hardware acceleration? Perhaps, you should use this term rather than the confusing "native". – László Papp Apr 12 '14 at 15:13

2 Answers2

2

So, is it correct to say that these classes are native?

No, it is not.

The reason for that is "native" would mean different things to different people. It is the matter of interpretation. See your other question how confused we got.

By now, I think you mean "non-opengl" 2/3D by native. That probably means software rasterization as opposed to be going through the display driver directly. So, still on the Qt level, but without the opengl classes in Qt.

Now, this is the point where we can come back to QImage and QPainter. Yes, QPainter is basically the initial generation for software rasterization from the times where GPUs were not so common and cheap as these days.

They are basically doing the rendering purely with software techniques. That is, it is more limited, but it worked without more expensive and less common hardwares around.

(Those were the times of Quake and other software products, fun times looking at it from today's perspective ...)

László Papp
  • 51,870
  • 39
  • 111
  • 135
  • Thank you. I thought that opengl for qt is like foreign words for any language (imagine that a language is graphical constituent of Qt). They can dissolve in native words (QImage, QPainter) and become alternative to them (or smth like that) with time. – user3519802 Apr 12 '14 at 15:45
2

If by "native" you mean "hardware assisted", then the line isn't all so clear anymore. Note that QPainter can use various paint engines to do the painting, so merely using a QPainter doesn't mean anything by itself.

If by "hardware assisted" one merely means using something more than legacy integer or floating point execution units of the CPU, then yes, the raster paint engine does use various SIMD/vectored operations where available. The raster paint engine is the engine used to paint on QImage, QPixmap and non-GL QWidget.

If by "hardware assistance" you mean "rendered by the graphics card hardware", then you need to use an OpenGL paint engine. It's used when you paint on a QGLWidget or in a QQuickPaintedItem. Of course the painting is still defined by the software - geometry setup and shaders are just code! This software runs on hardware that can execute it much faster than general purpose CPUs can.

Given that the fixed-function OpenGL pipeline is more-or-less a historical artifact these days, it's not incorrect to state that all of rendering in Qt is done using purely software techniques, but the software can run on a general-purpose CPU, or leverage SIMD/vector execution units on a general-purpose CPU, or can run on a GPU.

It should also be said that typical Windows drivers these days do not accelerate GDI/gdiplus drawing other than blits. Thus when doing 2D drawing using the raster engine, especially on older Windows versions like XP, Qt can be faster than platform-native 2D drawing.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313