# Ignition Rendering

## API Reference

5.1.0
Text geometry

This example shows how to include text in the scene.

## Compile and run the example

Clone the source code, create a build directory and use cmake and make to compile the code:

git clone https://github.com/ignitionrobotics/ign-rendering
cd ign-rendering/examples/text_geom
mkdir build
cd build
cmake ..
make

Execute the example:

./text_geom

You'll see:

Engine 'optix' is not supported
===============================
TAB - Switch render engines
ESC - Exit
===============================

## Code

We can create text in the same way we create other objects in the scene. We just need to use the scene to create the text using the method CreateText. It's possible to configure: font, text and alignment. Then we need to add the text as a visual in the scene:

TextPtr textGeom = _scene->CreateText();
textGeom->SetFontName("Liberation Sans");
textGeom->SetTextString("Hello World!");
textGeom->SetShowOnTop(true);
textGeom->SetTextAlignment(TextHorizontalAlign::LEFT,
TextVerticalAlign::BOTTOM);
// create text visual
VisualPtr text = _scene->CreateVisual();