[Bf-committers] Texture fonts in blender

James sheepzilla at gmail.com
Tue Nov 25 00:27:52 CET 2008

Hi Ivan,

On Sun, Nov 23, 2008 at 5:26 PM, Ivan Gagis <igagis at gmail.com> wrote:
> I recently started doing the same thing, because when I run blender on my
> Dell Inspiron 1501 laptop its interface works terribly slow.

Firstly, I agree; Blender's texture based text rendering is rubbish,
slow and ugly!

I haven't looked at this for a while; I've just started university so
I'm pretty busy at the moment, but from what I remember;

> But if I do the following actions then the fonts start behave badly:
>   Press middle mouse button in 3d view window and start rotating the camera
> by moving the mouse, do this for 1 minute.
>   Result:
>       text labels on buttons and in other places start disappearing. These
> labels may blink sometimes when you do some unrelated actions e.g. rotating
> camera with middle mouse button.

I think that what is most likely to be happening in your case is that
this causes part of the screen to be redrawn many times, but the area
with the text in is not re-drawn since nothing changes here, so
textures used for the text stay the same for a long time.
I think that this is causing those textures to be erroneously freed,
causing the text to disappear.

I don't really know why this would happen, but it might be the texture
garbage collector? You could try turning this off, and see if it

> I installed blender 2.46 from Ubuntu repository and I see the same problem
> there when I switch on the International fonts and "Use texture font" button
> is on. So, looks like there is some problem in blender (possibly a bug)

a bug, impossible! ;)

> which maybe changes OpenGL state at some point of time and that state is
> incompatible with texture font rendering.

This could be the cause, but in this case the bug would be dependant
on the order things were drawn in the interface, so I don't see why it
would only happen after a lot of doing the same thing, rather than as
soon as you start to drag the view around.

> So, just want to ask you if you observed the same problem with your
> implementation and if so, have you coped with it?

I do have a similar problem (although I am, myself, freeing textures
that are still being used because I have no way of knowing that they
are still in use, see (5) below); I don't really have any 'the right
thing' ways to fix this problem (if it is the problem I think it is).
The only way to squash it would be to force a re-draw of the whole
interface just before running any texture garbage collection, and to
have the text-drawing library report which textures were used during
that re-draw, and so should not be freed. In my opinion this would be
pretty ugly.

> And why had not your Tex font implementation been integrated into blender?
> Was it refused?

And my implementation hasn't been accepted because:
1) I've never submitted it. ;)
2) Its a pretty significant re-write of what is, essentially, a
no-longer maintained, external library used by Blender. (FTGL)
3) People still seemed worried by patent issues related to
anti-aliasing and hinting of text, and these features were what I was
most interested in.
4) My code, whilst functional (at least the last time I tried it on OS
X, a few months ago) is still unfinished and a little buggy, with one
really irritating bug that I can't squash. (Currently, I'm rather
suspecting of some of the metrics in bffont.ttf...)
5) I'm worried that there is an insurmountable obstacle of being
unable to track when texture IDs that I allocate are no longer in use,
so I can't reliably know when to free texture memory (similar to the
problem referred to above) This can lead (albeit in rather unusual
circumstances) to texture memory being eventually exhausted, something
which has disastrous consequences (for OS X, at least).

I hope I don't sound too pessimistic; anyway, I've cc-ed this to the
development mailing list, because someone there can probably correct
anything that I've got horribly wrong.


More information about the Bf-committers mailing list