Skip to content

TextWrapped causes "Too many vertices in ImDrawList" even with VfxOffset #5720

@dbr

Description

@dbr

Version/Branch of Dear ImGui:

Version: 1.86
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: Via imgui-rs, using imgui-glow-renderer

My Issue/Question:

As per imgui-rs/imgui-rs#331 (comment)

Displaying a long (1000 lines with 100 characters per line) string in TextWrapped triggers this assertion:

hello_world: ./third-party/imgui-master/imgui/imgui.cpp:4364: void AddDrawListToDrawData(ImVector<ImDrawList*>*, ImDrawList*): Assertion `draw_list->_VtxCurrentIdx < (1 << 16) && "Too many vertices in ImDrawList using 16-bit indices. Read comment above"' failed.

This is with a backend that has VfxOffset support - I think all the text is being added in a single DrawCmd thus cannot use the VfxOffset

Screenshots/Video

text_wrapped_drawlist

Standalone, minimal, complete and verifiable example:

Following can be put in imgui-examples/examples/something.rs in https://github.com/imgui-rs/imgui-rs/ and run via cargo run --example something - but should be pretty trivial to convert into C++!

use imgui::*;

mod support;

fn main() {
    let system = support::init(file!());
    let mut text = String::new();
    for _row in 0..1_000 {
        for _char in 0..100 {
            text += "a";
        }
        text += "\n";
    }
    system.main_loop(move |_, ui| {
        ui.window("Hello world")
            .size([300.0, 110.0], Condition::FirstUseEver)
            .build(|| {
                ui.child_window("Hm").build(||{
                    ui.text_wrapped(&text);
                });
            });
    });
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions