Elapsed time can be measured using the <ctime> library.
I am not an expert on displaying things on screen (yet), so if you want to just easily and quickly test something i'd recommend debugging it somewhere.

That's platform-specific. There are standard C functions (e.g. time()), but those have no specified resolution, and the actual resolution is typically 1 second, which is too coarse if you're trying to measure the time taken to render a frame. On Windows, use GetTickCount() or QueryPerformanceCounter(). On Unix, use gettimeofday() or clock_gettime().

Originally Posted by debonair

and can we display integer on the screen?

Create a texture containing the digits 0-9 (and optionally a decimal point), and render each digit as a textured quad (or pair of triangles). Other methods for rendering text are available from utility libraries (e.g. GLUT).

Second, debonair: In addition to what GClements said, you can use std::chrono in C++11 or boost::chrono otherwise. Also, what Windowing toolkit are you using? FreeGLUT, Qt, SDL, GLFW, ... ? Most if not all of these already provide means for timing in a x-platform manner.

Aside from the usual approach GClements mentioned, OpenGL has never had any facilities to directly render text. You can use various libraries like FreeType, libcairo + libpango and various others or you go the easy way and do it yourself, with the obvious drawback that you don't have support for multiple fonts and can only support characters you already represent with a texture. In other words, yes, you can haz integerz.

Second, debonair: In addition to what GClements said, you can use std::chrono in C++11 or boost::chrono otherwise. Also, what Windowing toolkit are you using? FreeGLUT, Qt, SDL, GLFW, ... ? Most if not all of these already provide means for timing in a x-platform manner.

Aside from the usual approach GClements mentioned, OpenGL has never had any facilities to directly render text. You can use various libraries like FreeType, libcairo + libpango and various others or you go the easy way and do it yourself, with the obvious drawback that you don't have support for multiple fonts and can only support characters you already represent with a texture. In other words, yes, you can haz integerz.

I am using GLUT library.

I came across BitmapCharacter API of glut but it looks painful for displaying scores on the screen. Is there any other simple way to display the time/ticks on the screen?

Ugh. This will consume 100% CPU (at least, for one core). Any platform which supports OpenGL can be expected to have some form of sleep() function, even if it's not standardised or entirely the same between platforms; e.g. Unix has sleep (seconds), usleep (microseconds) and nanosleep (guess), while Windows has Sleep (milliseconds, upper-case "S").