Test the 3D rendering performance of Qt Quick on various platforms.
Test the 3D rendering performance of Qt Quick on various platforms
Qt is a cross-platform GUI framework. Its QtQuick supports rendering with OpenGL native code. I want to integrate my previous programs into QtQuick to see if the rendering effect is satisfactory. So I wrote a small program to perform a rendering benchmark test. The running results are not optimistic.
Jiang caiyang's original article, first published at: http://blog.csdn.net/gamesdev/article/details/43842.pdf. Welcome to the discussion.
First, to describe the basic situation, I made a cube with textures. It uses perspective projection, and is supplemented by a simple shader to complete the texture and render it. Rendering code may be relatively long, but it is also quite streamlined.
Void rotate: render (void) {EntityPrivate: render (); // motion rotate (); m_ModelViewMatrix.translate (0.0f, 0.0f,-601_f); m_ModelViewMatrix.rotate (m_RotateAngle, m_Axis.x (), m_Axis.y (), m_Axis.z (); // render GL_DEPTH_TEST); glable (GL_CULL_FACE); glFrontFace (GL_CW); merge (); int offset = 0; setVertexAttribute ("position", GL_FLOAT, 3, offset); offset + = 3 * sizeof (GLfloat); setVertexAttribute ("texCoord", GL_FLOAT, 2, offset); Evaluate ("modelViewMatrix", m_ModelViewMatrix); Evaluate ("projectionMatrix", m_ProjectionMatrix); m_texture.bind (); glDrawArrays (GL_TRIANGLES, 0, VERTEX_COUNT ); m_ShaderProgram.disableAttributeArray ("position"); attributes ("texCoord"); m_texture.release (); m_VertexBuffer.release (); m_ShaderProgram.release ();}
The final result is as follows:
A very simple cube uses 36 vertices, 16 triangles, and 1 texture image. The OpenGLES 2.0 code is very simple. Based on this example, I made some improvements by using the dynamic loading of QML files to create component for rendering as a child in the window. At the same time, I also made a simple FPS function, so I tried to achieve the performance of rendering on different platforms.
First, let's take a look at our Android system. I have an electric tablet computer A10, which is an Android system and has 1 GB of memory. Use it to test the rendering performance and check whether the rendering performance is good. As a result, it is quite disappointing.
I swear, in order to get these three, I don't know how many times to restart the program. The main reason is that it is very difficult to use the built-in Android program in such high-density rendering. In many cases, the program will crash without waiting for you. In addition, the system will be restarted.
In Android, when rendering 5000 or less vertices, the FPS is quite good. It can be maintained at 60, but when it reaches 5000 or more, the system will not be able to afford it, FPS will keep falling, and more than 15000, basically to the edge of the crash, I also happen to be able to cut off when the vertex is 17064. In short, we can see the bottleneck of Qt combined with OpenGL in Android rendering.
The next step is the Windows Phone System. My WindowsPhone mobile Phone is a new low-end mobile Phone, with a Lumia530 memory of only 512 MB. I doubt whether it can hold the rendering.
The experimental results show that the performance of my Lumia system is still not good. Because of the problem of rendering the font glyph, the rendered font cannot be displayed. But the cube can still be seen. I just clicked it and found that the cube will be stuck at the moment of creation, but the rendering will still be smooth after the creation. Because there is no data, we do not know what the final result will be ......
Finally, our PC client was launched. The PC client does not need to render this point, and the efficiency is much better than that of the mobile platform. I don't know how many times! The FPS of the 20 thousand vertices is also maintained at 40.
Of course, this may be related to the update of the viewport. As you can see, the PC-side is indeed relatively small.
However, we need to pay attention to the rendering performance of the Mobile End. Since we need to implement cross-platform programs, we must take care of the lowest performance end according to the barrel principle. That is to say, to cover more user groups, during performance testing, we need to test machines with as low configuration as possible.