mccoyst / min-game

Automatically exported from code.google.com/p/min-game
MIT License
2 stars 1 forks source link

Drawing text is very slow. #56

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
On my laptop, it takes ~2ms to draw a string of text.  We only have 16ms 
per-frame so this is a big deal in my opinion.  I think that the main problem 
is re-rendering each string for each frame.  Most of the time, the text is 
static so the problem would probably go away if text strings could be saved as 
a texture on the GPU until they aren't needed any more, instead of re-creating 
them each frame.

Original issue reported on code.google.com by burns.ethan@gmail.com on 10 Nov 2012 at 7:30

GoogleCodeExporter commented 9 years ago
Here's one option:

The ui could have a string cache storing the textures for strings of text.  
Each call to Ui.Sync can remove strings from the cache that were not drawn this 
frame.  This way, each string will only be rendered once for each sequence of 
consecutive frames for which it is drawn.

Original comment by burns.ethan@gmail.com on 10 Nov 2012 at 7:39

GoogleCodeExporter commented 9 years ago
That sounds like a simple way to solve it.

Original comment by Mcco...@gmail.com on 10 Nov 2012 at 9:25

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 4f74461fe58d.

Original comment by burns.ethan@gmail.com on 11 Nov 2012 at 3:05