Re: [Plib-devel] [PATCH] fntBitmapFont::puts(): set negative coordinates correctly (Part II)
Brought to you by:
sjbaker
From: Bram S. <br...@sa...> - 2005-07-05 10:56:36
|
Melchior FRANZ wrote: > I had responded immediately after my first message showed up on the > list, but then I used the wrong mail address. And the bloody sf.net > server didn't complain, so it took me a while to notice. Here again: > > The patch from yesterday wasn't complete: it hadn't considered, that > the same bug would happen in puts() after "\n", and also in putch(). > The attached patch fixes that, too. > > But I'm not sure if I did it right. I set the RasterPos only with 2i, > assuming that the z-component would be zero in all cases. Is this true? > Or should I rather have used: glRasterPos3f(0.0f, 0.0f, curpos[2]) > in all three cases instead? Uh... I think this depends wether z-tests are done when writing the text? If z-test is off, and z-buffer writes are off, my guess is that the z coord does not matter. In any case, I think that these issues warrant a more complex fnt test in examples. Do you have a nice fnt tst program for us we can use in examples/src/fnt ? (one with negative coords of course) Bram > > m. > > > ------------------------------------------------------------------------ > > Index: fntBitmap.cxx > =================================================================== > RCS file: /cvsroot/plib/plib/src/fnt/fntBitmap.cxx,v > retrieving revision 1.2 > diff -u -p -r1.2 fntBitmap.cxx > --- fntBitmap.cxx 4 Jul 2005 14:58:54 -0000 1.2 > +++ fntBitmap.cxx 5 Jul 2005 06:00:35 -0000 > @@ -71,7 +71,8 @@ void fntBitmapFont::putch ( sgVec3 curpo > if (c == '\n') { > curpos[1] -= height; > } else { > - glRasterPos3fv(curpos); > + glRasterPos2i(0, 0); > + glBitmap(0, 0, 0, 0, curpos[0], curpos[1], NULL); > int i = (GLubyte) c - first; > if (i >= 0 && i < count) { > glBitmap(data[i][0], height, xorig, yorig, (float) data[i][0], 0, data[i] + 1); > @@ -90,7 +91,8 @@ void fntBitmapFont::puts ( sgVec3 curpos > if (s[i] == '\n') { > curpos[0] = x0; > curpos[1] -= height; > - glRasterPos3fv(curpos); > + glRasterPos2i(0, 0); > + glBitmap(0, 0, 0, 0, curpos[0], curpos[1], NULL); > } else { > int j = (GLubyte) s[i] - first; > if (j >= 0 && j < count) { |