Is it possible to output text on a GL screen?

An embedded and charset-unspecified text was scrubbed…
Name: not available

I havent used SDL that much nor have I used SDL-ttf. (for the moment I am stuck using glut. not MY
api of choice… :wink: )

You would need to render your text using SDL-ttf or similar, which would presumably produce a
bitmap of some sort in memory. (or you can load an image off of disk)

you can then turn it into a surface and blit it, but I recall reading that there is a problem with
doing that to GL surfaces in SDL.

you can make GL itself display it by using glDrawPixels This as far as I bieleve, puts the image in
front of anything else you are rendering of the screen.

void glDrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid
*pixels )

width and height are the size of the image. format is the format the image is in (RGB etc). type is
the type of data, GLShort, GLBitmap, etc… Pixels is the pointer the the image. It is written to
the framebuffer at the current raster position. (glRastorPos is the way to get that data). You may
need to play around a bit to get it to do what you want.

another option is to use glBitmap, but that is more complex.

The GL red and blue books (equivilent to man + howto guide) are very helpful as a reference. I only
have the GL version 1.0 man pages, fire me an e-mail if you want them though.

see if that helps you any.


Michael West

Ricardo Rio wrote:> I was wondering if it was possible to write normal text or alterd font text on a GL screen?

The only way I know if to create an image and the place in on a Squared poligon (very complex).

If this the only way?

Thanks in advanes?