Text in OpenGL
Through some research I have learned that aglUseFont() isnt the way to go for built in text support. I was wondering what some of you have been using for text output and what advice you have on OpenGL text. Any sample code would be much appeciated as always.
I took a look at FreeType and it looks like it may be a bit too powerful for the simple things im working with right now.
Thanks as always.
I took a look at FreeType and it looks like it may be a bit too powerful for the simple things im working with right now.
Thanks as always.
I used this:
http://www.geocities.com/ed72678954/GlyphTool.zip
for my OMG entry among other things, Nick has turned it into a framework also which and made several improvments, but I think the link for that is dead atm.
http://www.geocities.com/ed72678954/GlyphTool.zip
for my OMG entry among other things, Nick has turned it into a framework also which and made several improvments, but I think the link for that is dead atm.
Sir, e^iπ + 1 = 0, hence God exists; reply!
I've been using FTGL for the past, say, 4-5 months and I love it.
It uses freetype2 to render a font to a texture at whatever fontsize I need it at for beatifully sized fonts. I can't think of something I'd want for it to do that it doesn't already do just great.
It uses freetype2 to render a font to a texture at whatever fontsize I need it at for beatifully sized fonts. I can't think of something I'd want for it to do that it doesn't already do just great.
If you don't care about portability, you can use Cocoa to render text into a bitmap, and texture from that. It's easy to do on 10.4: http://onesadcookie.com/svn/repos/NSViewTexture , and possible on previous versions of the OS.
If you do care about portability, but don't care about complex languages (eg. Arabic, Thai) you can use FTGL ( http://homepages.paradise.net.nz/henryj/code/index.html ) or just use FreeType raw ( eg. http://onesadcookie.com/svn/repos/RubyGa...rce/font.c ).
If you do care about portability and do care about complex languages, the best solution I've found is to use Pango + FreeType to render into a bitmap, and texture from that. It works easily on Mac OS X and Linux, but the port to Windows is rather harder.
If you do care about portability, but don't care about complex languages (eg. Arabic, Thai) you can use FTGL ( http://homepages.paradise.net.nz/henryj/code/index.html ) or just use FreeType raw ( eg. http://onesadcookie.com/svn/repos/RubyGa...rce/font.c ).
If you do care about portability and do care about complex languages, the best solution I've found is to use Pango + FreeType to render into a bitmap, and texture from that. It works easily on Mac OS X and Linux, but the port to Windows is rather harder.
unknown Wrote:I used this:could you give me the command to create something like this:
http://www.geocities.com/ed72678954/GlyphTool.zip
for my OMG entry among other things, Nick has turned it into a framework also which and made several improvments, but I think the link for that is dead atm.
![[Image: Font2.png]](http://i24.photobucket.com/albums/c11/skeldi/Font2.png)
the font doesn't matter. It's just whenever I seem to feed it a string, or anything else, it turns up all screwy.
size of the texture is 512x512
Not the best but an alternative to look into, polyfonts at http://gameprogrammer.com/programming.html uses polygons and polylines for drawing out a character. There are pros and cons with vector fonts vs bitmap fonts.
unknown Wrote:I used this:Here's the framework.
http://www.geocities.com/ed72678954/GlyphTool.zip
for my OMG entry among other things, Nick has turned it into a framework also which and made several improvments, but I think the link for that is dead atm.
http://www.simrealitystudios.com/GlyphTo...mework.zip
skyhawk Wrote:could you give me the command to create something like this:This will give you a 512x512 image where the text is white and background is transparent, that way you use glColor3f() to set the font color.
(image here)
the font doesn't matter. It's just whenever I seem to feed it a string, or anything else, it turns up all screwy.
size of the texture is 512x512
Code:
./GlyphTool Impact -square 512 -pt 50 -color FFFFFF -ts -o Impact.pngI'll also hint at the fact that I'm working on a Cocoa-ized version of the GlyphTool, so I'll definitely post about it when I get it working. Then you won't need to remember the commands. It'll be as easy as checking boxes and filling in text fields.
Nick Wrote:I'll also hint at the fact that I'm working on a Cocoa-ized version of the GlyphTool, so I'll definitely post about it when I get it working. Then you won't need to remember the commands. It'll be as easy as checking boxes and filling in text fields.I'd love you forever if you did that!
skyhawk Wrote:I'd love you forever if you did that!Not ready yet, but here's a teaser screenshot.
Here is the v0.0.1 alpha release thread over at iDA:
http://www.idevapps.com/forum/showthread...#post48299
http://www.idevapps.com/forum/showthread...#post48299
#1 feature request:
automate it.
I pick a squaresize and font, and you make it all fit to use up all the space appropriately
automate it.
I pick a squaresize and font, and you make it all fit to use up all the space appropriately
skyhawk Wrote:#1 feature request:I'll check in to doing that. I've always been thinking that'd be nice. Does that mean you want to be rid of the kerning option or have that option AND an "automatically fill the whole square" option?
automate it.
I pick a squaresize and font, and you make it all fit to use up all the space appropriately
I put a new version up (same link as above) so you can check it out.
One note, I released an updated framework with the new GlyphTool which will only work with files produced by the new GlyphTool. Not a HUGE difference, but enough that you won't get anything written to the screen with the other framework. I also took out some unnecessary UI options.
I personally don't use kerning =)
skyhawk Wrote:I personally don't use kerning =)I've never found real need for it, either, except trying to fill up the whole texture. Hopefully I'll be able to figure out the auto-fill feature in a reasonable amount of time. I'll post updates over at the iDA thread I posted above and on my website (see signature).
Kerning can be useful: for instance, if you want to apply a filter in Photoshop/GIMP to the resulting font texture, an extra margin around each char prevents "bleeding" of pixels from other chars nearby.
In my fontmaker app (that I need to fix someday), I have kerning per char, but it is mostly used for the opposite reason (bringing chars closer together) as well as correcting any unnatural spacing caused by weird-shaped letters.
In my fontmaker app (that I need to fix someday), I have kerning per char, but it is mostly used for the opposite reason (bringing chars closer together) as well as correcting any unnatural spacing caused by weird-shaped letters.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Opengl/Cocoa text rendering | tesil | 15 | 14,416 |
Mar 20, 2012 11:16 AM Last Post: OneSadCookie |
|
| SDL/OpenGL fullscreen text rendering | StealthyCoin | 2 | 5,366 |
Mar 26, 2009 09:47 AM Last Post: StealthyCoin |
|
| OpenGL Text Rendering (in Cocoa) | daveh84 | 5 | 6,621 |
Feb 19, 2009 12:44 PM Last Post: TomorrowPlusX |
|
| opengl text/font drawing from CGContext | fretmunky | 11 | 11,408 |
Dec 7, 2008 11:29 AM Last Post: fretmunky |
|
| OpenGL text and other things. | Talyn | 7 | 3,925 |
Jul 22, 2008 02:09 AM Last Post: OneSadCookie |
|

