How to draw the text to a Texture?

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
Just popping in
Just popping in
Posts: 8
Joined: Wed Mar 09, 2005 07:06

How to draw the text to a Texture?

Postby olvierwpz » Mon May 16, 2005 02:15

I want to draw the text to a Texture.I have found the
function follows:

void Font::drawTextLine(const String& text, const Vector3& position, const Rect& clip_rect, const ColourRect& colours, float x_scale, float y_scale) const
Vector3 cur_pos(position);

float base_y = position.d_y;

uint char_count = text.length();
CodepointMap::const_iterator pos, end = d_cp_map.end();

for (uint c = 0; c < char_count; ++c)
pos = d_cp_map.find(text[c]);

if (pos != end)
const Image* img = pos->second.d_image;
cur_pos.d_y = base_y - (img->getOffsetY() - img->getOffsetY() * y_scale);
Size sz(img->getWidth() * x_scale, img->getHeight() * y_scale);
img->draw(cur_pos, sz, clip_rect, colours);
cur_pos.d_x += (float)pos->second.d_horz_advance * x_scale;


This function get the image of the text from "d_cp_map" and draw them.But I want to draw the text image to another image and coverter it to a Texture.
How to do this ?I am new to CEGUI .THANKS!!

Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 4 guests