/* * render-text.c * * Simple text rendering * * (c) 2008 Thomas White * * thrust3d - a silly game * */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "render.h" #include "texture.h" void render_text_setup(RenderContext *r) { texture_load(r, "font"); } void render_text_write(GLfloat x, GLfloat y, const char *text, RenderContext *r) { Texture *texture; int i; const GLfloat lwidth = 0.03; const GLfloat lheight = lwidth*r->aspect; const GLfloat lspacing = lwidth/10.0; y -= lheight; texture = texture_lookup(r, "font"); glBindTexture(GL_TEXTURE_2D, texture->texname); glEnable(GL_TEXTURE_2D); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glBegin(GL_QUADS); for ( i=0; i