Fonts in OpenGL

Started by
6 comments, last by sdlprorammer 19 years, 10 months ago
I was wondering about something: In SDL, to write something in the screen, you have to use an image which contains the fonts. or you can write your own function that will draw the letters, depending on your own drawing skills. My qustion is, what happens in OpenGl? Do u still need to have the picture with the letters in your computer to write text? thanks
Advertisement
NeHe has a tutorial on doing bitmap fonts in OpenGL. Yes you do store the image in memory to write text, but as an OpenGL texture.
And like in SDL you can use TrueType fonts.
It is not easier in OpenGl.
Writing errors since 10/25/2003 2:25:56 AM
With wglLoadFont or whatever the function is, Fonts in OpenGL are pretty *** easy. check out nehe.gamedev.net tutorials on the font subject.

Getting nice wrapping fonts is trickier... I''m currently looking into the FreeType2 docs to do this.
Be careful though. Those wgl functions are Windows specific. So if you want cross-platform, you can''t use them.


First make it work, then make it fast. --Brian Kernighan

The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities. We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)

Do not interrupt your enemy when he is making a mistake. - Napolean Bonaparte
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]
...remember just that using wglLoadFont produces good looking fonts but it''s *REALLY* slow... A 2d blitting of portions from a textured font is by far faster in OpenGL.
Ok! thanks for the valueable help everybody
NeHe

I''ve read a couple of your other threads and, while I don''t mean to sound like I''m flaming you, you really should do at least MINIMAL ressearch before posting threads. Many of them can easily be answered by looking through the docs real quick (for SDL) or by reading the NeHe tutorials.

If you''ve never heard of NeHe, I suggest going there and doing the tutorials. While NeHe isn''t going to teach you how to get the most out of OpenGL, it''ll teach you enough to get some rather good stuff going. You should have a look at the tutorials there before posting a thread, and only post if the resources there don''t answer your question.

It''s just a little irritating having to post the same link all the time.

Try here for tutorials on bitmapped fonts, as well as other means of displaying text in OpenGL. NeHe tutorials.

This topic is closed to new replies.

Advertisement