How to do OpenGL live text-rendering for a GUI?

后端 未结 7 2032
面向向阳花
面向向阳花 2020-12-04 08:12

I\'m implementing a GUI built on top of OpenGL. I came to the problem that each GUI will have -- text rendering. I know of several methods of rendering text in OpenGL, howev

7条回答
  •  佛祖请我去吃肉
    2020-12-04 08:38

    Per quad character handled thought a display list (updated only when text changes) is quite enough for most cases.

    I used it with X11 fonts using the XLoadQueryFont, glGenLists, glXUseXFont, glCallLists you have an array of display lists describing each character.

    the glCallLists function accepts a char * argument for your text and it can be embedded inside a display list.

    So you end up with a single call to display blocks text.

    The font texture suggested by G. Pakosz is similar, but you compute your own "by character" display lists.

    Your first options will be quite slower as it will require processor based rendering at each text change.

提交回复
热议问题