deal with a large text?

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

lcy03406
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Fri Apr 24, 2009 01:18

deal with a large text?

Postby lcy03406 » Thu Sep 03, 2009 07:28

I'm making a chat window. It's text may be hundreads of lines. I'm worrying about the performance. The text may append frequently, the string concatenating may be slow, and I'm not sure whether rendering such a large text(clipped by a small rect) may be slow or not.
Any good ideas about dealing with large texts?

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: deal with a large text?

Postby CrazyEddie » Thu Sep 03, 2009 08:59

As always the answer is, it depends... It sounds like you're using a multiline editbox for the chat history, which could be a poor choice. Generally people chose a Listbox of some kind for this, with each line being it's own item. Using this approach, I believe, the non-visible strings (listbox items) are rejected quickly, so you may get better performance overall. There's also the possibility of managing the text yourself and setting a sub-string to be drawn rather than the entire text, I've not tried this and it sounds expensive :)

Also be aware that in the 0.6.x and earlier releases, rendering large amounts of text can be expensive due to the nature of what the text is, and how it's represented from a geometry point of view. Typically a 'page' of text results in many tens of thousands - even hundreds of thousands - of triangles to be drawn, which clearly has an impact on performance. We have reduced this issue in the upcoming 0.7.0 release by allowing content to be cached to texture first, meaning that after the first render of any amount of text in a suitably initialised window, it's only ever two triangles (the only time it would not give better performance is if you were modifying the text many times each second - which given your description, you will not be (generally, people don't type that quickly!).

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 2 guests