Re: [Plib-devel] [PATCH] fntBitmapFont::puts(): set negative coordinates correctly
Brought to you by:
sjbaker
From: Bram S. <br...@sa...> - 2005-07-04 14:50:54
|
Franz, At first glance, this looks like good detective-work by you. I have cvs write access, and will commit this patch. Please note that I assume the following: -1- This still works in cases with positive coords :-) -2- You tested your own patch and found it to be satisfactory. Let me know if these assumptions are incorrect. Bram Melchior FRANZ wrote: > plib does currently not display bitmap fonts with negative coordinates. > As soon as a the first character in a string lies outside the viewport > (movable dialogs!), the *whole* string isn't displayed. > > The reason is, that glBitmap() must not get called on negative coordinates. > Its manpage says: > > NOTES > To set a valid raster position outside the viewport, first set > a valid raster position inside the viewport, then call glBitmap > with NULL as the bitmap parameter and with xmove and ymove set to > the offsets of the new raster position. This technique is useful > when panning an image around the viewport. > > This is done by the attached patch, and it fixes the bug. > Please review and apply! > > m. > > > ------------------------------------------------------------------------ > > Index: fntBitmap.cxx > =================================================================== > RCS file: /cvsroot/plib/plib/src/fnt/fntBitmap.cxx,v > retrieving revision 1.1 > diff -u -p -r1.1 fntBitmap.cxx > --- fntBitmap.cxx 15 Feb 2004 19:51:23 -0000 1.1 > +++ fntBitmap.cxx 4 Jul 2005 14:22:49 -0000 > @@ -84,7 +84,9 @@ void fntBitmapFont::putch ( sgVec3 curpo > void fntBitmapFont::puts ( sgVec3 curpos, float pointsize, float italic, const char *s ) > { > float x0 = curpos[0]; > - glRasterPos3fv(curpos); > + glRasterPos2i(0, 0); > + glBitmap(0, 0, 0, 0, curpos[0], curpos[1], NULL); > + > for (int i = 0; s[i] != '\0'; i++) { > if (s[i] == '\n') { > curpos[0] = x0; |