diff --git a/panda/src/text/dynamicTextGlyph.cxx b/panda/src/text/dynamicTextGlyph.cxx index 6a3e14f3e8..92dbd38c4b 100644 --- a/panda/src/text/dynamicTextGlyph.cxx +++ b/panda/src/text/dynamicTextGlyph.cxx @@ -116,11 +116,13 @@ make_geom(int bitmap_top, int bitmap_left, float advance, float poly_margin, float bottom = origin_y - tex_y_size / tex_pixels_per_unit - tex_poly_margin; float right = origin_x + tex_x_size / tex_pixels_per_unit + tex_poly_margin; - // And the corresponding corners in UV units. - float uv_top = 1.0f - (float)(_y - poly_margin) / _page->get_y_size(); - float uv_left = (float)(_x - poly_margin) / _page->get_x_size(); - float uv_bottom = 1.0f - (float)(_y + poly_margin + tex_y_size) / _page->get_y_size(); - float uv_right = (float)(_x + poly_margin + tex_x_size) / _page->get_x_size(); + // And the corresponding corners in UV units. We add 0.5f to center + // the UV in the middle of its texel, to minimize roundoff errors + // when we are close to 1-to-1 pixel size. + float uv_top = 1.0f - ((float)(_y - poly_margin) + 0.5f) / _page->get_y_size(); + float uv_left = ((float)(_x - poly_margin) + 0.5f) / _page->get_x_size(); + float uv_bottom = 1.0f - ((float)(_y + poly_margin + tex_y_size) + 0.5f) / _page->get_y_size(); + float uv_right = ((float)(_x + poly_margin + tex_x_size) + 0.5f) / _page->get_x_size(); // Create a corresponding triangle pair. We use a pair of indexed // triangles rther than a single triangle strip, to avoid the bad // vertex duplication behavior with lots of two-triangle strips. diff --git a/panda/src/text/textNode.cxx b/panda/src/text/textNode.cxx index ab24918463..c66d9a8258 100644 --- a/panda/src/text/textNode.cxx +++ b/panda/src/text/textNode.cxx @@ -237,8 +237,7 @@ output(ostream &out) const { //////////////////////////////////////////////////////////////////// void TextNode:: write(ostream &out, int indent_level) const { - indent(out, indent_level) - << "TextNode " << get_name() << "\n"; + PandaNode::write(out, indent_level); TextProperties::write(out, indent_level + 2); indent(out, indent_level + 2) << "transform is: " << *TransformState::make_mat(_transform) << "\n";