PDA

View Full Version : string text rotation



spearlss
05-06-2002, 10:51 PM
I need to use a string text rotated, but as I understand from a previuos question in this forum, bitmap can't be used since these are rendered from a raster position horizontally.

Then I tried to use FTGL library (Unix version) but I cannot render the glyph correctly. Is there any place where to find simple examples of OpenGl with FTGL calls?

Is there a better approch ? Since want to render strings from many different fonts I do not want use Glut.
Best regards.

MPech
05-06-2002, 11:21 PM
I don't know FTGL but mapping triangles/quad with appropriates texture coordinates seems to be a common way the raster text in OpenGL(use of a bitmap discribing your entire font)

take look to : http://www.gametutorials.com/Tutorials/OpenGL/OpenGL_Pg3.htm

the two font tutorials should help you.

spearlss
05-07-2002, 03:52 AM
Thanks for your reply.
It is very hard to find something good at that site - only Vc++ and Windows instead of simple c code and Unix -
If I use something like this:

fontInfo = XLoadQueryFont(xdisplay,
"-adobe-helvetica-medium-r-normal--17-120-100-100-p-88-iso8859-1");
id1 = fontInfo->fid;
first1 = fontInfo->min_char_or_byte2;
last1 = fontInfo->max_char_or_byte2;

base1 = glGenLists((GLuint) last1+1);
glXUseXFont(id1, first1, last1-first1+1, base1+first1);

how can I retrieve or use bitmap for texture generation in

glTexImage2D(GL_TEXTURE_2D, 0,/* level */
3,/* components */
imageWidth,
ImageHeight,
0, /* border */
GL_RGB,
GL_UNSIGNED_BYTE,
&Image[0][0][0]); ?
Regards.

spearlss
05-10-2002, 06:30 AM
If anyone is interested I found a good example from Mark J. Kilgard see: http://www.niksula.cs.hut.fi/~ti111300/examples/OpenGL/textfun.c
Bye.