Rendering Text in OpenGLES 2.0

Hii All,

How to render a Text (string) in OpenGLES 2.0 ?
Is there any available source code for any such example ?
Note : I am not allowed to use glut or any other library like free-type library
Please let me know if any solution for this.

Thanks and regards …
Arpita Jena

Either render each character as a textured quad (triangle pair), or render a textured quad containing the entire string. Which is more efficient depends upon the amount of text and how frequently it changes.

Well, getting the font data into your program is going to be awkward without FreeType (or similar). OpenGL doesn’t include any functionality for reading font files. If you’re only dealing with Windows, you could use wglUseFontBitmaps(). Otherwise, you’ll probably need to create a program which uses FreeType to render glyphs and dump them as C source code which you can incorporate into your program. From a legal (copyright) perspective, you should limit yourself to fonts with an open-source licence (e.g. those from the X11 distribution).

Thanks for your help.

Can I use Qt 5.9.6 with opengl to render text and other designs ?

Thanks and regards …
Arpita Jena

With Qt4, you can use QPainter to draw to any type which inherits from QPaintDevice, which includes QImage, QGLPixelBuffer and QGLFramebufferObject. The first two allow you to transfer the pixel data to an OpenGL texture, the latter allows you to render directly onto a texture.

Beyond that, questions about Qt APIs should be directed to a Qt forum.