Ok thank you a lot Patrick.
Patrick Dähne a écrit :
Hello Xavier,
the texture width is not related to the resolution of the text at all.
If you run testTextTXFTexture you can see the whole TXF texture
that is
generated. textureWidth defines the width of this texture, with the
height being calculated automatically.
hum so i suppose that with a width of 32 and a width of 1024 i won't
get the same quad on the textTXFGeo, but i'v got the same.
So i don't know how to have a smaller texture without using the
scale parameter wich make my texture ugly (mipmapping?) as you can
see here :
There seems to be a misunderstanding on your side about the way TXF
fonts work. When you change the textureWidth parameter, you will
*not* see any difference on the screen. A TXF font consists of a
texture that contains the whole alphabet. When you render a text, a
geometry consisting of quads is created. There is one quad for each
character of the text. On the each quad, a small subsection of the
texture is mapped that contains the respective character. For more
information about TXF fonts, see
http://www.opengl.org/resources/code/rendering/mjktips/TexFont/
TexFont.html
The following piece of code shows all parameters you can set when
creating a TXF font:
OSG::TextTXFParam txfParam;
//txfParam.size = 46;
//txfParam.gap = 1;
//txfParam.setCharacters("Hello World!");
//txfParam.textureWidth = 0;
OSG::TextTXFFace *face = OSG::TextTXFFace::create("Arial",
OSG::TextFace::STYLE_PLAIN, txfParam);
- The "textureWidth" parameter controls the width of the texture, not
the size of the characters in the texture. Usually, this parameter is
set to 0, which means that OpenSG automatically tries to create a
texture that is more or less quadratic. Usually you should leave this
parameter at 0. When you make this parameter small, you get a texture
with a large height, because OpenSG has to place the whole alphabet
in this small texture. When you make this parameter large, you get a
texture with a small height.
- The "gap" is the number of pixels between the characters in the
texture. By default, it is set to one pixel, but you can increase
this gap when adjacent characters bleed into each other as a result
of linear interpolation.
- "characters" controls which characters are contained in the
texture. By default, all printable ASCII characters are contained in
the texture.
- "size" is probably what you're looking for. It is the height of
each character in the texture in pixels. Use a smaller size when you
need text in a small resolution, or when you are low on texture
memory. Use a larger size when you need text in a high resolution.
When you finally create the geometry, there is one more parameter:
"scale"
OSG::Real32 scale = 1.f;
OSG::GeometryPtr geo = face->makeGeo(layoutResult, scale);
scale determines the the height of the text in world units. By
default, the height is one unit. When you need a larger geometry, you
have to adjust the scale parameter. For example, to get a height of
two units, you have to set the scale factor to two.
I hope this clarifies the different parameters of the TXF font.
Bye,
Patrick
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users