From e47cf7977355e47677a60cd791d975b8891eaa90 Mon Sep 17 00:00:00 2001 From: omar Date: Sat, 17 Jun 2017 19:30:30 +0200 Subject: [PATCH] Comments tweaks, typos (#1188) --- imgui.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index a9df9059..c86fe475 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2603,12 +2603,13 @@ static void AddDrawListToRenderList(ImVector& out_render_list, ImDr IM_ASSERT(draw_list->IdxBuffer.Size == 0 || draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size); IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size); - // Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = 2 bytes = 64K vertices per window) + // Check that draw_list doesn't use more vertices than indexable in a single draw call (default ImDrawIdx = unsigned short = 2 bytes = 64K vertices per window) // If this assert triggers because you are drawing lots of stuff manually, you can: - // A) Add '#define ImDrawIdx unsigned int' in imconfig.h to raise the index size of 4 bytes. You'll need to handle the 4-bytes indices to your renderer. - // For example, the OpenGL example code detect index size at compile-time and does - // 'glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset); - // B) If for some reason you cannot use 32-bit indices or don't want to, a workaround is to call BeginChild()/EndChild() because reaching the 64K limit to split your draw commands in multiple draw lists. + // A) Add '#define ImDrawIdx unsigned int' in imconfig.h to set the index size to 4 bytes. You'll need to handle the 4-bytes indices to your renderer. + // For example, the OpenGL example code detect index size at compile-time by doing: + // 'glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset);' + // Your own engine or render API may use different parameters or function calls to specify index sizes. 2 and 4 bytes indices are generally supported by most API. + // B) If for some reason you cannot use 4 bytes indices or don't want to, a workaround is to call BeginChild()/EndChild() before reaching the 64K limit to split your draw commands in multiple draw lists. IM_ASSERT((draw_list->_VtxCurrentIdx >> (sizeof(ImDrawIdx)*8)) == 0); // Too many vertices in same ImDrawList. See comment above. out_render_list.push_back(draw_list);