TextNode assertion error

Traceback (most recent call last):
  File "C:\p\treegui\tut1.py", line 57, in <module>
  File "C:\Panda3D-1.6.2\direct\showbase\ShowBase.py", line 2423, in run
  File "C:\Panda3D-1.6.2\direct\task\TaskNew.py", line 471, in run
  File "C:\Panda3D-1.6.2\direct\task\TaskNew.py", line 429, in step
  File "C:\Panda3D-1.6.2\direct\showbase\ShowBase.py", line 1568, in __igLoop
AssertionError: x >= 0 && x + x_size <= _x_size && y >= 0 && y + y_size <= _y_size at line 99 of c:\p\p3d\panda3d-1.6.2\panda\src\text\dynamicTextPage.cxx

What is this error? And why is textNode producing it? Also happes with 1.6.0 and probably before.

Have some sample code to reproduce?

my code is never simple :frowning:

It looks like using textNode.generate() instead of paranting textNode directly eases the problem.

It’s very strange. The error itself indicates some internal error with the DynamicTextFont as it attempts to clean itself up while removing glyphs from the texture (presumably to make room for new glyphs). This error shouldn’t be possible; I would like to understand how it happened.

If you can find some way to make a simple application that reproduces the same problem, it would be greatly appreciated.


We’re getting this too.

Haven’t been able to track it down or make a simple reproducible example, but here are some values that it fails on:
x: 199
y: 9
x_size: 59
y_size: 59
_x_size: 256
_y_size: 256

You can see that x + x_size (258) is just bigger than _x_size (256).

And here’s a C++ stack trace:

libdtoolconfig.dll!Notify::assert_failure(const char * expression=0x02274880, int line=107, const char * source_file=0x022748c8)  Line 426	C++
libpanda.dll!DynamicTextPage::fill_region(int x=199, int y=9, int x_size=59, int y_size=59, const LVecBase4f & color={...})  Line 107 + 0x3c bytes	C++
libpanda.dll!DynamicTextGlyph::erase(DynamicTextFont * font=0x00fcf0e0)  Line 79 + 0x32 bytes	C++
libpanda.dll!DynamicTextPage::garbage_collect(DynamicTextFont * font=0x00fcf0e0)  Line 205 + 0xf bytes	C++
libpanda.dll!DynamicTextFont::garbage_collect()  Line 172 + 0xc bytes	C++
libpanda.dll!DynamicTextFont::slot_glyph(int character=77, int x_size=87, int y_size=60)  Line 830 + 0x7 bytes	C++
libpanda.dll!DynamicTextFont::make_glyph(int character=77, int glyph_index=45)  Line 559	C++
libpanda.dll!DynamicTextFont::get_glyph(int character=77, const TextGlyph * & glyph=0x00000000)  Line 262 + 0xd bytes	C++
libpanda.dll!TextAssembler::get_character_glyphs(int character=77, const TextProperties * properties=0x096a1ed4, bool & got_glyph=false, const TextGlyph * & glyph=0x00000000, const TextGlyph * & second_glyph=0x00000000, UnicodeLatinMap::AccentType & accent_type=AT_none, int & additional_flags=0, float & glyph_scale=1.0000000, float & advance_scale=1.0000000)  Line 1657	C++
libpanda.dll!TextAssembler::calc_width(wchar_t character=0, const TextProperties & properties={...})  Line 698	C++
libpanda.dll!TextAssembler::wordwrap_text()  Line 1040 + 0x83 bytes	C++
libpanda.dll!TextAssembler::set_wtext(const std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > & wtext="Move it into the glowing outline.")  Line 194	C++
libpanda.dll!TextNode::generate()  Line 400	C++
libpanda.dll!TextNode::do_rebuild()  Line 781 + 0xa bytes	C++
libpanda.dll!TextNode::compute_internal_bounds(ConstPointerTo<BoundingVolume> & internal_bounds={...}, int & internal_vertices=383, int pipeline_stage=0, Thread * current_thread=0x00f3dad0)  Line 733	C++
libpanda.dll!PandaNode::get_internal_bounds(int pipeline_stage=0, Thread * current_thread=0x00000000)  Line 2568	C++
libpanda.dll!PandaNode::update_bounds(int pipeline_stage=0, CycleDataLockedStageReader<PandaNode::CData> & cdata={...})  Line 3785	C++
libpanda.dll!PandaNode::update_bounds(int pipeline_stage=0, CycleDataLockedStageReader<PandaNode::CData> & cdata={...})  Line 3808	C++
libpanda.dll!PandaNode::update_bounds(int pipeline_stage=0, CycleDataLockedStageReader<PandaNode::CData> & cdata={...})  Line 3808	C++
libpanda.dll!PandaNode::update_bounds(int pipeline_stage=0, CycleDataLockedStageReader<PandaNode::CData> & cdata={...})  Line 3808	C++
libpanda.dll!PandaNode::get_bounds(Thread * current_thread=0x00000000)  Line 2360	C++
libpanda.dll!NodePath::get_bounds(Thread * current_thread=0x00f3dad0)  Line 5995 + 0x4c bytes	C++
libpanda.dll!GraphicsEngine::render_frame()  Line 692 + 0x13 bytes	C++

Ah, I found it. There is indeed a bug in DynamicTextGlyph::erase(); it was erasing too far by the width of the margin. This appears to be a longstanding bug; my apologies.

If you build your own Panda, you can fix this by picking up the latest dynamicTextGlyph.cxx. If you’re using the prebuilt Panda, I guess you’ll need to wait for 1.6.3, if there’s going to be one, or you can minimize the danger of encountering the bug by reducing your font’s pixels-per-unit or point size settings, or increasing the font’s page size.


Great. Thanks David.