Posts: 25
Joined: Tue Sep 16, 2014 5:29 pm

rasperf3d: OpenGL 3D performance analysis tool and sample

Fri Oct 03, 2014 11:42 pm

Rasperf3d is my 3D performance analysis tool for the Raspberry Pi. You can download it from

My goals were:

- Create an OpenGL ES sample program that's more complex than hello_triangle
- Measure the impact of screen resolution, model complexity, shader type, and other rendering settings on frame rate

The program draws many copies of the same model in a grid layout on the screen, and shows real-time rendering performance data. You can use the keyboard to change the current rendering settings, and see how it affects 3D performance and frame rate. Here's a screenshot of 81 dinosaur models, each about 19K triangles:


For Programmers

The source code compiles on a stock install of Raspbian Wheezy, with no extra libraries needed. X Windows is not required or used.

Some of the more interesting things demonstrated in the code are:
  • basic vertex and fragment shaders for Phong and Gouraud shading
  • rendering with vertex buffer objects
  • drawing text with a bitmap font
  • dynamically changing the screen resolution
  • dynamically enabling multi-sampling
  • taking a screen shot
For Benchmarkers

Press S to hide all but the first row of text - this improves performance slightly. Use the keyboard to modify these settings:
  • Number of objects rendered. Each object is 1 draw call.
  • Type of object: Five choices, from a 12 triangle cube, to a 55K triangle robot.
  • Screen resolution. From 1920 x 1080 down to 568 x 320.
  • 4x Multi-sampling: on/off.
  • Shader: textured with per-pixel lighting, textured with per-vertex lighting, untextured with per-pixel lighting, untextured with per-vertex lighting, flat colored.
  • Texture filter: linear or nearest.
  • Mipmaps: on/off.
  • Backface culling: on/off.
  • Depth test: on/off.
  • Wireframe view: on/off.
  • Camera distance away from the "wall of objects".
  • Camera yaw angle - view the wall of objects at an oblique angle, or edge-on.
  • Camera look away - rotate the camera 180 degrees, so that all triangles will get clipped out.
  • Secret feature: press R to take a screenshot.
For the curious: All the object models use one 256x256 texture, and the same shader with one directional light, so the only performance difference between them is due to their geometry. All models have indexed verts. Each vertex has position XYZ, normal XYZ, and texture UV for a total of 32 bytes per vertex. Rendering is done with VBOs (vertex buffer objects) and glDrawElements. Each copy of the model is a separate draw call to OpenGL.


I hope somebody finds this useful, and I welcome all feedback on how the tool could be improved. Thanks!

Posts: 25
Joined: Tue Sep 16, 2014 5:29 pm

Re: rasperf3d: OpenGL 3D performance analysis tool and sampl

Mon Oct 06, 2014 4:55 pm

I've updated the program to use ETC1 compressed textures instead of uncompressed bitmaps. This provides a moderate performance boost in some situations. The compressed textures were created using PVRTexTool and are stored in KTX files. I added a simple KTX file loader to the source code. Enjoy!

Posts: 1382
Joined: Thu Aug 18, 2011 9:21 pm

Re: rasperf3d: OpenGL 3D performance analysis tool and sampl

Tue Oct 07, 2014 11:24 am

I look forward to testing this out. thanks!
note: I may or may not know what I'm talking about...

Return to “OpenGLES”