How to make a FPS counter in OpenGL c++

Hey. I wanted to know how to render text with a FPS counter. I have seen videos about rendering text but they never work with FPS counters. Please send me code about how I can do this.

That makes no sense. Text rendering means rendering… text. An “FPS counter” is simply a particular piece of text. Any text rendering system can render an “FPS counter,” because that’s just text. So either the text rendering system itself is broken or the “FPS counter” is not delivering a valid value.

But in any case, this is way too much of a thing to ask for from this forum. You’re basically asking people to write a lot of code for you. OpenGL has no native text rendering functionality, so you’d have to assemble it from raw materials. It has no native “FPS counter” computing functionality, so you’d have to assemble it from raw materials. And you’d have to combine them both.

That’s just not a reasonable thing to ask on a forum.

I have tried watching tutorials in c++ with text rendering and I haven’t been able to add a FPS counter. I can add text but now value in it

not sure if i understand the problem correctly, but this might help:

char txt[256];
snprintf(txt, 256, "%3.2f FPS", 98.76);

it is c, not c++, but you can use that in c++ too.

Thank you. But how can I use c++