Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Rendering Text in OpenGLES 2.0

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2018
    Posts
    3

    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

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,067
    Quote Originally Posted by arpita.j View Post
    How to render a Text (string) in OpenGLES 2.0 ?
    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.

    Quote Originally Posted by arpita.j View Post
    Note : I am not allowed to use glut or any other library like free-type library
    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).

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2018
    Posts
    3
    Thanks for your help.

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

    Thanks and regards ...
    Arpita Jena

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,067
    Quote Originally Posted by arpita.j View Post
    Can I use Qt 5.9.6 with opengl to render text and other designs ?
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •