Using hardware acceleration for graphics, on March 13, 2009
Question 1: 给hardware分类.
标准一: 是UnifiedMemoryArchitecture(UMA), 还是Dedicated graphics memoery(Non-UMA) ?
标准二: 根据graphics operations来分five categories.
于是一共十种类型types.
我们在PC上常见的都是Non-UMA + programmable-3D的.
Question 2: How can Qt off-load graphics operations to these different types of hardware?
不同的hardware type有不同的rendering back end(QPaintEngine的具体实现):
Qt \ / QPaintEngine for type X:
| -- QPainter --| QPaintEngine for type Y:
Application / \ QPaintEngine for type Z:
Type UMA Non-UMA
None Raster Raster*
Blitter DirectFB DirectFB**
2D vector OpenVG*** OpenVG***
Fixed-3D OpenGL (ES) 1.x OpenGL (ES) 1.x
Programmable-3D OpenGL (ES) 2.x OpenGL (ES) 2.x****
* When using raster on NUMA, rendering is actually done in system memory first, then flushed to VRAM
** This is the one which is going to be slow when doing anything other than QPainter::drawPixmap()
*** It shouldn’t be a big surprise we’re researching an OpenVG paint engine!
**** Qt 4.5 contains a new paint engine for OpenGL ES 2.x which we’re now making work on desktop OpenGL 2.0.
Qt Graphics and Performance – An Overview, on December 16, 2009
关于QWidget and QWindowSurface:
关于Graphics systems:
You can select graphics systems either by starting the application with the command line option -graphicssystem raster|opengl|opengl1|x11|native, where “native” means to use the system default. Another option is to provide the exact same option to configure which will set that option for all applications using Qt. Finally there is the function QApplication::setGraphicsSystem which hardcodes the graphics system for a given application.
关于Images and Pixmaps:
The difference between these two is mostly covered in the documentation, but I would like to highlight a few things none the less.
Our documentation says: “QImage is designed and optimized for I/O, and for direct pixel access and manipulation, while QPixmap is designed and optimized for showing images on screen.”
这有点像Image跟Texture的区别, 后者可能是前者的封装加上一个OpenGL texture ID以便render.
Qt Graphics and Performance – OpenGL, on January 6, 2010
什么是OpenGL, 为什么选择OpenGL ES 2.0?
QPainter将东西传给OpenGL来画, GL paint engine turn the whole of the QPainter API into "just a bouch of triangles". 举了一个例子说明.
Interleaved Rendering:
void widget::paintEvent(QPaintEvent *)
{
QPainter .... // 不同的painter来画.
QPainter .... //
}
Mixing QPainter and Native OpenGL
QGLWidget vs OpenGL Graphics-System
我看懂了OpenGL paint engine, 但是不懂OpenGL Graphics-System是什么概念, 为什么跟QGLWidget来比较, 后者全部东西都是用OpenGL paint engine来画, "all use the OpenGL paint engine regardless of what graphics system is being used. QGLWidget is basically a regular widget which always has a native window ID and is always rendered to using OpenGL. You are free to choose whichever method you want to get OpenGL rendering (graphics system or QGLWidget). However, using the opengl graphics system can often be slower than using a QGLWidget". 是说我们App中可以选择用QGLWidget或者OpenGL graphics system?
QGLWidget的缺点是不能局部sub-area更新, 需要重画整个widget.
没有评论:
发表评论