I have come to a point where i want to render LOTS of text. My idea here is i want to render the text to a "screen" in my 3D space.
I have a few ideas on how i want to do it but i am not sure if it's going to be a good solution.
I have fiddled with text rendering in the past with GDI, GDI+ and even in XNA but every time i have run into a limiting factor performance wise.
My goal here is to make a computer screen kinda deal with a console. I want it to be as fast as possible to allow text to flash by as fast as it would in your average command prompt. (Not even this has been working for me in the past, always too slow)
My first idea is to render the text to a surface and then send that surface to a single quad representing the screen. The downside here is that sending such large textures (I am thinking 1920x1080 in size which obviously would translate to a 2048x2048 texture) every frame or even every other frame etc would still be very slow.
So my second idea was to make a single texture, a bitmap font and send that to the GPU once and have X number of quads times Y number of quads for rows and columns. Then update an array or likewise with the tu and tv values for each quad.
So if my screen has 80 columns and 50 rows then that would be 4,000 * 2 floats = 32,000 bytes per frame. At least that would be an improvement over sending a new 2048x2048 texture which would be ~16 Megabytes per frame.
Then my third idea was to somehow handle the texture coordinates on the GPU and simply sending bytes describing what goes in each column and row. So i have a texture on the GPU and 8,000 triangles. They don't have any texture coordinates assigned initially and i send a stream of 4,000 bytes per frame that the shader would use to set the appropriate texture coordinates. (Obviously i am going for a monospace font here too)
Of course the screen wouldn't need to be updates once every frame but i am looking for at least 60 updates per second per virtual screen. And i would love to have more than 80x50 columns and rows too!
Which option would be the most viable one and could anyone provide an example for me if he/she has one in mind?
For instance, i have no idea of how to actually implement the third option in shader code and even the second option is untested territory for me.
Thanks in advance for any help! I will now attempt to make a testbed using at least the 2nd option.
I am also looking for any other alternatives that would be easier to implement and still fast. Those three options where just off the top of my head.
CaddeMember Since 11 Mar 2012
Offline Last Active Apr 19 2012 04:08 AM
- Group Members
- Active Posts 9
- Profile Views 650
- Submitted Links 0
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown