fps counter

How can I make an fps counter for my Symbian OpenGL ES app? I’ve downloaded an example from forum nokia but is very complicated!

[ August 05, 2005, 06:40 AM: Message edited by: Giacomo ]

I guess the only way to do it through the OpenGL ES API is to create a font texture with all the required fonts and then draw the FPS counter from it with triangles using the texture coordinates to offset inside the texture.

There are other ways (e.g., draw 3d scene, call readpixels to get the pixel data, draw your text on top of that data and then copy that to the display), but I believe that this is the most efficient way to do it (GFX HW friendly).


The example I’ve downloaded uses the texture as you say, but I don’t understand how to create this texture and display the number of frame…do you have some examples code?!

The PowerVR SDKs (http://www.pvrdev.com/Pub/MBX/Download/) have a tools library which includes a very easy to use text-drawing module called Print3D:

// Create a global variable using the Print3D class, or member variable, whatever...
CPVRTPrint3D AppPrint3D;

// After initialising OGLES (width/height is the size of your viewport)

// Each frame submit the text you want to draw:
for(int j = 0; j < 10; ++j)
	AppPrint3D.Print3D(5.0f, (float)j * 5, 0.5f, 0xFFFFFFFF, "a line of text with a number: %d", j);
AppPrint3D.Print3D(5.0f, 90.0f, 0.5f, 0xFFFFFFFF, "more text");

// Print3D buffers the text (performance optimisation "batching")
// Flush it to HW, once, when you're done drawing text in this frame

// Before shutting down OGLES:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.