Original Post
This is just a curiousity at the moment, as I haven't gotten a performance hit out of it yet, but I'm wondering if my method for rendering text could be improved.
Currently, I have a single texture with a basic set of ascii characters in it that I reference.
I build the string into a VBO such that each character in the string gets 6 vertices, 1 at the start that will be "invisible", 4 for the 2 triangles, 1 at the end that will be "invisible". The invisible triangles are there to seperate each character from the next and to prevent the texture from bleeding everywhere.
There is no kerning, and each character has 1 unit space between it and the last character.
Looks like this (not an actual string here):
First character :
Vertices: 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1
Textures: 0, 0, x, x, x, x, x, x, x, x, 0, 0
Second character:
Vertices: 2, 0, 2, 0, 3, 0, 0, 3, 3, 3, 3, 3
Textures: 0, 0, y, y, y, y, y, y, y, y, 0, 0
and so on...
Is there a better way to do this when using a triangle strip vbo?
Currently, I have a single texture with a basic set of ascii characters in it that I reference.
I build the string into a VBO such that each character in the string gets 6 vertices, 1 at the start that will be "invisible", 4 for the 2 triangles, 1 at the end that will be "invisible". The invisible triangles are there to seperate each character from the next and to prevent the texture from bleeding everywhere.
There is no kerning, and each character has 1 unit space between it and the last character.
Looks like this (not an actual string here):
First character :
Vertices: 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1
Textures: 0, 0, x, x, x, x, x, x, x, x, 0, 0
Second character:
Vertices: 2, 0, 2, 0, 3, 0, 0, 3, 3, 3, 3, 3
Textures: 0, 0, y, y, y, y, y, y, y, y, 0, 0
and so on...
Is there a better way to do this when using a triangle strip vbo?