-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indexed Rendering 65536 Limit per window #292
Comments
PS: I'd like to see a full resolution version of those picture! :) |
FYI I hit this too! I decided that I didn't much care, for my use, but a relatively simple workaround would also be pleasant. |
What did you do to hit this Adam? |
Hi Omar, I did it as you've been suggesting (ChildWindows) and it works perfectly! //...
int currentChild = 0;
ImVec2 wpos = ImGui::GetWindowPos();
ImVec2 backupPos = ImGui::GetCursorScreenPos();
ImGui::SetCursorScreenPos(wpos);
ImGui::BeginChild(currentChild++);
ImDrawList* draw_list = ImGui::GetWindowDrawList();
int numberOfPoints = pDlg->cv.getObject(foundObject)->_numVerifyPts;
double* pX = pDlg->cv.getObject(foundObject)->_aVerifyPtsX;
double* pY = pDlg->cv.getObject(foundObject)->_aVerifyPtsY;
for (int i = 0; i < numberOfPoints; i++)
{
float x = static_cast<float>(pX[i]);
float y = static_cast<float>(pY[i]);
x *= zoom;
y *= zoom;
x += topLeftScreen.x;
y += topLeftScreen.y;
const float w = 1.0f;
ImVec2 minR(x - w, y - w), maxR(x + w, y + w);
draw_list->AddRectFilled(minR, maxR,ImColor(0,255,0,128));
if (draw_list->_VtxCurrentIdx > 65536 - 8)
{
ImGui::EndChild();
ImGui::SetCursorScreenPos(wpos);
ImGui::BeginChild(currentChild++);
draw_list = ImGui::GetWindowDrawList();
}
}
ImGui::EndChild();
ImGui::SetCursorScreenPos(backupPos);
//... I'm also attaching some screenshot of our Robotic Visual Guidance software (CortexRecognition:registered: ), as you're requesting ;) It's a world class 6DOF robotic guidance solution ! https://www.youtube.com/watch?v=ebob20egGjE (those old videos are not featuring the new IMGUI UI...but the upcoming ones will!) |
Thanks for the screenshots! I have added an assert and the possibility to override ImDrawIdx with a different type. Tested with unsigned int and it works (of course you need to adjust your draw function accordingly). |
There's now another solution to this, see #2591 |
I understand that it's probably a design decision but I've been hitting the 65536 Index limit inside a single window, due to ImDrawIdx being an unsigned short. I was searching some API to "break" the index chain but looks like there's one unique VTX and IDX buffer per DrawList, and there's one DrawList per Window.
FYI, the reason is that I am drawing a good number of 2D points (as small rectangles) to display edge outlines of an image.
I could use the usercallback mechanism, but I'm wondering if there's a better way.
Additionally in my opinion the ImDrawList should assert in debug if someone tries to write more than 65536 vertices.
Suggestions?
Here's a good one.

here's a bad one (more than 65536 indexes), my background image becomes garbage.

The text was updated successfully, but these errors were encountered: