
Text: absolute vs relative coordinates
Posted Wednesday, 21 January, 2009 - 11:09 by the Fiddler inIn an effort to finalize the text branch and get 0.9.2 out, I'd like some input on this matter.
Currently, text rendering takes place in ortho 2D with absolute coordinates (0, Width) - (0, Height). This allows for pixel-perfect rendering, but is invasive (it changes your projection matrix) and it is resolution dependent.
Would you prefer it, if the text renderer left your projection matrix alone (i.e. text is rendered in 3d space unless you specify otherwise)?


Comments
Re: Text: absolute vs relative coordinates
Re: Text: absolute vs relative coordinates
Yes, I would like a way for the text renderer to leave the projection matrix alone.
I would also like to be able to manage the rendering state for the text rendering.
Here is just a quickly thought out interface allowing both simple usage and advanced usage of text rendering. It is just an example to demonstrate what I would find useful.
Basic Usage - The Render() function sets and restores the projection, state, and position.
Basic Example
Advanced Usage - Each step has it's own functions
Advanced Example - Using the IDisposable methods
In my GUI I am hoping to only setup the projection matrix at the beginning of the GUI rendering. I would like to manage the state to reduce state changes. I will be caching the VBO and GL state calls in cascading Display Lists. From frame to frame if nothing changes, the top display list will be called which calls child display lists which set state, call VBOs, etc... When something does change only the display list containing that item will need to be updated. All of this requires good state management. I am eagerly awaiting the new text rendering code.
Re: Text: absolute vs relative coordinates
My preference would be that the text renderer does its rendering in ortho 2D by default, and have the option to specify other behaviors, ie. using the current projection matrix. How easy is it to achieve pixel-perfect resolution independent text rendering? Could this be done by telling TextPrinter the orthogonal matrix to use?
Personally, I can't see a whole lot of use of rendering text in a general 3D space. For something like the computer screens in doom 3 I would think the way to go would be to use a framebuffer object to do the 2D rendering of the screen.
Re: Text: absolute vs relative coordinates
I've been pondering this more. I believe I can work with either relative or absolute. As for optimizing the rendering by controlling the state, well there's usually not too much text on the screen that it would make a difference with today's hardware acceleration.
Re: Text: absolute vs relative coordinates
Some uses cases I think all of us would like to see:
- Frames-per-second display
- Debug/console text (HalfLife)
- RPG-style storylines/conversations (Chronotrigger)
- Game menus (Doom)
- GUI widget captions (Golem3d)
- Playlists in media players (3d Winamp anyone?)
If the text rendering APIs handles these, I'm fine.