Portable way to display fonts in OpenGL?

In my OpenGL game I need a lot text info on screen. It’s car simulator, and I
have trouble with physics, so many variables are visible on screen all the
time.
I read NeHe tutorial 13, SDL example, and I use that solution, but it needs
GLX. So I added #ifndef _WIN32, so less fortunate people :wink: (don’t shot me!)
can compile it, too.
I need something portable. I am thinking about SDL_ttf, can you tell me how to
display text with SDL_ttf on OpenGL screen? Should I draw on SDL_Surface then
draw that surface in OpenGL?–
You’ve seen them walking on the water
You’ve seen flying through the sky
They were frightening in the darkness "Egypt (The Chains Are On)"
They had rainbows in their eyes - Ronnie James Dio

In my OpenGL game I need a lot text info on screen. It’s car simulator, and I
have trouble with physics, so many variables are visible on screen all the
time.
I read NeHe tutorial 13, SDL example, and I use that solution, but it needs

ew, nehe shudder

GLX. So I added #ifndef _WIN32, so less fortunate people :wink: (don’t shot me!)
can compile it, too.
I need something portable. I am thinking about SDL_ttf, can you tell me how to
display text with SDL_ttf on OpenGL screen? Should I draw on SDL_Surface then
draw that surface in OpenGL?

an easy very fast way to do nice looking text is to put the font on a texture.
Take a look at mark kilgard texfont package (steve baker uses it in his plib
suite), or merely write your own. It’s extremely easy to use texture fonts, the
trick is in building them :slight_smile:

    -Erik <@Erik_Greenwald> [http://math.smsu.edu/~erik]

The opinions expressed by me are not necessarily opinions. In all probability,
they are random rambling, and to be ignored. Failure to ignore may result in
severe boredom or confusion. Shake well before opening. Keep Refrigerated.

ew, nehe shudder

what’s bad in nehe?

an easy very fast way to do nice looking text is to put the font on a texture.

I think I will use ttfOn Sun, Sep 02, 2001 at 02:01:36PM -0500, Erik Greenwald wrote:


Hot wind, moving fast across the desert
We feel that our time has arrived
The world spins, while we put his dream together "Stargazer"
A tower of stone to take him straight to the sky - Ronnie James Dio

SDL_ttf just generates SDL_Surfaces. So, you should be able to just go ahead
and use SDL_ttf text generated surfaces under OpenGL the exact same way you
use other surfaces (at least, I would assume… I have never used SDL_ttf in
conjunction with OpenGL ;-)On Sunday 02 September 2001 8:37am, Jacek Pop?awski wrote:

I need something portable. I am thinking about SDL_ttf, can you tell me how
to display text with SDL_ttf on OpenGL screen? Should I draw on SDL_Surface
then draw that surface in OpenGL?


Sam “Criswell” Hart <@Sam_Hart> AIM, Yahoo!:
Homepage: < http://www.geekcomix.com/snh/ >
PGP Info: < http://www.geekcomix.com/snh/contact/ >
Tux4Kids: < http://www.geekcomix.com/tux4kids/ >

I’ve got a couple… One’s 128x128 with very sharp 8x8 chars designed for
"tiny" print. One’s 256x256 and has characters that look just like Q3A
(and I spent hours making that happen!), and another font done by DeeTee
which uses a sharper squarish font. It came as 512x512 but I have gimped
it to 256x256 so it works even with 3dfx cards. I can make all of these
available if needed, and in an evening or so I can prepare another tile
full of the other glyphs I’ve made over time.

My sig selector is apparently an AI.On Sun, Sep 02, 2001 at 02:01:36PM -0500, Erik Greenwald wrote:

an easy very fast way to do nice looking text is to put the font on a
texture. Take a look at mark kilgard texfont package (steve baker uses
it in his plib suite), or merely write your own. It’s extremely easy to
use texture fonts, the trick is in building them :slight_smile:


Joseph Carter Free software developer

This font is starting to come out very nicely
Knghtbrd: oh dear, are you hacking up another quake font in vi? :slight_smile:

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20010902/79c460f0/attachment.pgp

Joseph Carter writes:

an easy very fast way to do nice looking text is to put the font on a
texture. Take a look at mark kilgard texfont package (steve baker uses
it in his plib suite), or merely write your own. It’s extremely easy to
use texture fonts, the trick is in building them :slight_smile:

I’ve got a couple… One’s 128x128 with very sharp 8x8 chars designed for
"tiny" print. One’s 256x256 and has characters that look just like Q3A
(and I spent hours making that happen!), and another font done by DeeTee
which uses a sharper squarish font. It came as 512x512 but I have gimped
it to 256x256 so it works even with 3dfx cards. I can make all of these
available if needed, and in an evening or so I can prepare another tile
full of the other glyphs I’ve made over time.

Theres a freeware bitmap font builder at http://www.lmnopc.com/. (I
may have found out about it on this list, so forgive me if I’m
repeating stuff).

Its written in VB so you’ll need a windows box (picks up windows
fonts), does nehe style 2font textures and full ascii, occasionally
baulks on some fonts at large tex sizes and I don’t think it writes
alpha channel. Could give you a starting point though.

Cheers

Lee> On Sun, Sep 02, 2001 at 02:01:36PM -0500, Erik Greenwald wrote:

My sig selector is apparently an AI.


Joseph Carter Free software developer

This font is starting to come out very nicely
Knghtbrd: oh dear, are you hacking up another quake font in vi? :slight_smile:


sdl

Grab SDL_console under “Libraries” at the www.libsdl.org website. You
can send text to the console programatically and it also ships with
simple bitmap fonts. The example program is really nice and also
includes an OpenGL version.----------------------------------------------------------------------
Olivier A. Dagenais - Software Architect and Developer

Message: 4
Date: Sun, 2 Sep 2001 17:37:59 +0200
From: Jacek Poplawski
To: sdl at libsdl.org
Subject: [SDL] portable way to display fonts in OpenGL?
Reply-To: sdl at libsdl.org

In my OpenGL game I need a lot text info on screen. It’s car
simulator, and I
have trouble with physics, so many variables are visible on screen
all the
time.
I read NeHe tutorial 13, SDL example, and I use that solution, but
it needs
GLX. So I added #ifndef _WIN32, so less fortunate people :wink: (don’t
shot me!)
can compile it, too.
I need something portable. I am thinking about SDL_ttf, can you tell
me how to
display text with SDL_ttf on OpenGL screen? Should I draw on
SDL_Surface then
draw that surface in OpenGL?


You’ve seen them walking on the water
You’ve seen flying through the sky
They were frightening in the darkness "Egypt (The
Chains Are On)"
They had rainbows in their eyes - Ronnie
James Dio