Auto triangulate text to mesh at game start

is it possible AUTOMATICALY triangulate text to mesh at game start?
I have many text and i like to edit text at any time in editor.
But default text in BGE do not look good (pixelated).
It look much better, if i convert text to mesh.

Triangulate modifier create a mesh (visible in wireframe mode)
but it is not possible to use this mesh in BGE
and i think that this modifier was not designed for text
if i click to “apply” - i get a message:
“cannot apply modifier for this object type”

any idea?

select object, in object menu at top = convert text to mesh

Now you need to take the code (bpy) that does this and run it before the game loop,

be aware, the game won’t work in stand alone this way.

do the meshes need to be converted in game?

you can just convert them in the viewport/save them?

if i convert text to mesh, i can no more edit this text,
so i need to copy text before

i had also a idea to convert with bpy to new objects,
but this is a bit dirty with double objects (text+mesh)

as is see it is not possible to convert in BGE on the fly,
so i must convert in Blender first…

strange that triangulate modifier work only for display:

there are scripts to place font images to make text, you could probably
write a script that placed a object instead for each letter,

i wrote a code that do this job…
it was really difficult to make it stable…

the solution is simple.

  1. it delete all objects with #mesh# prefix in object name
  2. it create for every text object new duplicate, converted to mesh and move this to last layer

so… in my app, i need only to hide all real text objects (without #mesh#)

import bpy

def game_start_pre(context):
    #delete all text meshs = None
    obj = bpy.context.scene.objects[:]

    for o in obj: = False
            o.layers = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
            o.hide = False
            o.hide_select = False
   = True


    #create new text meshs
    obj = bpy.context.scene.objects[:]
    for o in obj:
        if o.type=="FONT":
            l = o.layers[:]
            h = o.hide
            s = o.hide_select

            o.layers = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
            o.hide = False
            o.hide_select = False
   = True

   = o
            bpy.ops.object.convert(target='MESH', keep_original=True)
            a = bpy.context.active_object
   = None

            o.layers = l[:]
            o.hide = h
            o.hide_select = s
   = False

            if a != None and !=
                a.layers = [False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,True]
                a.hide = h
                a.hide_select = s
       = False
       = "#mesh#" +


you wont be able to run that in standalone,

i need a first run in blender
once i started this in blender, all text is converted and is usable later in BGE…

i add later hash values to detect text changes, so i can skip conversions…

You can also increase text resolution in game and still maintain dynamic text. Attach this to your text object;

import bge

cont = bge.logic.getCurrentController()
own = cont.owner
own.resolution = 5

I was just curious as to why you would need to do all this rather than use one of the many of the other ways to make text in the BGE that does not require BPY, so you woudnlt even have to get into this problem.

  1. Bitmap fonts seem to work fine and scale well…Theres a new Thread in the resource section showing how to make your own fonts.
  2. Text objects work well, but yes they will look pixelated according to scale and how far away they are from the camera, but this can be fixed with that code in the above post, and it comes out clear and sharp.
    3.There is another way to use text directly in BGE using another code snippet but Im not sure off the top of my head. but a search can bring it up.

Option 2 with the code in the above post works fine and fixes the pixelation. And only has to be run once when the text object is added if I remember correctly. . However, I have had problems loading Text objects with LibLoad and linked blends

Good Luck

Off Topic: I really gotta change my avatar, Im tired of looking at Randy Marsh


to 1: i do not know how to do this with bitmap fonts
is this good, if i use say: 3 different fonts and many text colors?
so should i create new bitmap font, if i need black, blue and red font?
have i any preview in editor for bitmap fonts?
(i do not think this is so)
and where is this thread?

to 2: i noticed that the size of non-triangulated text is different,
this is not good for large text
i do not tested this with higer font resolution…

Do sou see the difference?
Both from game engine using same font without changes
1st text is normal text object
2nd text is triangulated text

it is very important to me that text look equal in editor in BGE

and is this a good solution, if i use many many text
i found this:

I did some tests, and it’s converted to bitmap as the game is running- if you resize the text while the game is running (with an IPO, for example) the resolution changes (and the framerate takes a massive dive)