Home Download Buy Blog Forum Support

Curiosity about the way ST2 is rendering text

Curiosity about the way ST2 is rendering text

Postby wledoux on Tue Apr 12, 2011 10:15 am

Hi jps,

I'll have to write an opengl application with a lot of text in it.
I though that you may accept to answer to few questions about your experience in optimizing the rendering of text and UI elements in OpenGL/Dx.
And I post it on the forum because it may be of some interest to anyone.

* Could you summarize the achitecture and techniques that you use in ST for the rendering and refreshing ?
* Is it immediate mode GUI as described here (http://mollyrocket.com/861) ?
* Do you have some techniques that you have tried and would totally not recommend to use ?

I would understand if you don't want to answer.

Thanks for you work.
William.
wledoux
 
Posts: 17
Joined: Wed Mar 23, 2011 5:29 pm

Re: Curiosity about the way ST2 is rendering text

Postby jps on Wed Apr 13, 2011 12:38 am

Sublime Text 2 uses software rendering only. Ultimately, it caused too many compatibility issues in 1.x, and with going cross platform for version 2, that would only have increased. Nonetheless, I'll talk about Sublime Text 1.x for a bit.

The basic text rendering itself was fairly standard: textured quads are drawn to the screen, one per character. However, there are a few details worth noting:
* Characters are buffered, and sorted by color, to reduce state changes.
* Most OpenGL applications will have a single channel texture for the characters, and blend the desired color on top. Sublime Text uses RGB textures, with the text pre-composed with the correct foreground and background color. This takes more memory, but allows ClearType to be used, which is important for a text editor.

The Sublime Text 1.x UI code was inspired by some of the immediate mode GUI thoughts. For example, layout is done at drawing time, and controls are referred to by ids. I believe this was a mistake, and Sublime Text 2 doesn't do this, its UI toolkit more resembles a traditional one, and it's much, much better off for it.

While the rationale behind immediate mode UIs is appealing (the more stateless a thing is, the better, generally), it becomes less so as a UI gets more complex. Fundamentally, UIs are stateful entities, and trying to hide this isn't a long term win.
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot] and 18 guests