2D font library

Started by
7 comments, last by Chr 18 years, 10 months ago
I want to use 2D font, like the windows bitmap font, but with which I can specify the character width and height (fixed width and height fonts) in pixels, or somehow get this information. I have tried glfont, but this is not what I am looking for as it uses the opengl coordinate system and not pixels. Thanks in advance for any help.
____________________________________________________________Programmers Resource Central
Advertisement
I've just found this incase anyone else has had the same problem. Though if you know of something that isn't on that list and is good, please do tell ;)
____________________________________________________________Programmers Resource Central
You can always write wrapper so that those units are transformed to pixels... or use such OGL coordinate system where each unit == pixel...

void SC :: Renderer :: Enter2DMode() {  glMatrixMode(GL_MODELVIEW);  glLoadIdentity();  /*   Inits orthographical projection. In this mode, screen looks like this:     (0,0) is left down corner of screen     (screenWidth-1, screenHeight-1) is upper right corner of screen  */  glOrtho (0, screenWidth, 0, screenHeight, 0, -100); // it must be called for MODELVIEW  glMatrixMode( GL_PROJECTION );  glLoadIdentity(); }



Or use SDL_TTF (like here: clicky).
edit: me slow, Koshmaar beat me to it (actually I'm fairly certain you need to call xxOrtho() in GL_PROJECTION mode but I may be wrong).

You can make the OpenGL coordinate system correspond to pixels by switching to ortho mode with the appropriate settings:

glMatrixMode(GL_PROJECTION);glLoadIdentity();gluOrtho2D(0, SCREEN_WIDTH, 0, SCREEN_HEIGHT);// make sure to set back to modelview before drawing stuff
Heh, you were only half a minute slower... :-)

Anyway, I've tried calling glOrtho for projection matrix and it didn't work. So, I've tried calling it for modelview, and it works... yes, for me it's illogical too. But I can't argue with what I see on screen :-/
I guess then I would be wrong. I learned something today ;).
i would recommend SDL_ttf for font rendering.
Has anyone used the glut font rendering? If so can you tell me how good it is, if you had any problems with it etc.
____________________________________________________________Programmers Resource Central
what's with freetype?

This topic is closed to new replies.

Advertisement