PDA

View Full Version : Replace GDI TextOut with OpenGL



Jeff1000
04-18-2007, 03:37 PM
Could anyone please pointer me how to replace TextOut with OpenGL in 2D, I want to change the font name, font height, font orientation, also the Text ouput change with scale.

Thanks

Joseph Steel
04-18-2007, 11:41 PM
Have a look at http://nehe.gamedev.net/lesson.asp?index=03 to start with.

Jeff1000
04-19-2007, 10:22 AM
Thanks for your reply. I did try both Bitmap Font and Outline Font, the Bitmap font can not scale with windows, and the Outline Font seems a little slow compared with GDI TextOut and Bitmap Font, any other better way to do this? I mean almost the same function like GDI TextOut function.

Thanks

Mazy
04-19-2007, 11:46 AM
Does GDI textout scale with scale?

Use Bitmapfonts but create a new set when the windowsize changes ( it shouldnt change that often)

Jeff1000
04-19-2007, 06:01 PM
Yes, TextOut does not scale with scale, the font size need to be calculated.

But I can not get the Bitmapfonts rotate, the CreateFont(..) does not work, could anyone help to rotate Bitmapfonts ?

Thanks

Relic
04-20-2007, 02:30 AM
For arbitrary rotation and simple scaling of fonts, use font textures and render textured quads.
Here's an official GLUT example: http://www.opengl.org/resources/code/samples/glut_examples/texfont/texfont.html

There are font libraries using OpenGL on the web as well, GLTT, FTGL, etc. (not used myself though).