Text rendering bug

We are currently experiencing rendering artifacts when drawing text.

Is seems to be very difficult the get this bug to show itself, it is likely to depend on some timing criteria.

The bug will show it self as missing pixels, always in the first or second letter
of a text string.

Text strings are drawn to a single texture and rendered using a simple quad.

Below is a description of 3 different methods we’ve tried.
The bug is visible in the first and second method.

If it’s the text drawing routine that causes the problem, it would also appear in method 3 which it don’t.



Method 1:

* Each label control has allocated a single texture
* All text is drawn in a shared memory buffer

For each label control with changes:
    Draw text in global shared buffer
    Update label’s texture (glTexImage2D)

For all controls
    Set texture
    Render control using glDrawElements

eglSwapBuffers



Method 2:

* All text is drawn in a shared memory buffer

For each label control with changes:
    Draw text in global shared buffer
    Create a new texture
    Update texture (glTexImage2D)
    Delete old texture

For all controls
    Set texture
    Render control using glDrawElements

eglSwapBuffers



Method 3:

* Each label control has allocated a single texture
* Each label control has allocated a memory buffer with same size as texture
* All text is drawn in a shared memory buffer

For each label control with changes:
    Draw text in global shared buffer
    Copy text in global shared buffer to label’s memory buffer
    Update label’s texture using memory buffer
 (glTexImage2D)


For all controls
    Set texture
    Render control using glDrawElements

eglSwapBuffers