2D font library
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.
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 ;)
You can always write wrapper so that those units are transformed to pixels... or use such OGL coordinate system where each unit == pixel...
Or use SDL_TTF (like here: clicky).
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:
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 :-/
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 :-/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement