mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-05 04:28:47 +02:00
Examples: Accessing ImVector fields directly, feel less stl-ey and fix renderer side assert when render list only contains a callback (#810)
This commit is contained in:
@ -648,7 +648,7 @@ static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
|
||||
ImDrawIdx* idx_buffer = &cmd_list->IdxBuffer.front();
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle);
|
||||
int needed_vtx_size = cmd_list->VtxBuffer.size() * sizeof(ImDrawVert);
|
||||
const int needed_vtx_size = cmd_list->VtxBuffer.Size * sizeof(ImDrawVert);
|
||||
if (g_VboSize < needed_vtx_size)
|
||||
{
|
||||
// Grow our buffer if needed
|
||||
@ -659,11 +659,12 @@ static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
|
||||
unsigned char* vtx_data = (unsigned char*)glMapBufferRange(GL_ARRAY_BUFFER, 0, needed_vtx_size, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
if (!vtx_data)
|
||||
continue;
|
||||
memcpy(vtx_data, &cmd_list->VtxBuffer[0], cmd_list->VtxBuffer.size() * sizeof(ImDrawVert));
|
||||
memcpy(vtx_data, cmd_list->VtxBuffer.Data, cmd_list->VtxBuffer.Size * sizeof(ImDrawVert));
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
|
||||
for (const ImDrawCmd* pcmd = cmd_list->CmdBuffer.begin(); pcmd != cmd_list->CmdBuffer.end(); pcmd++)
|
||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||
{
|
||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||
if (pcmd->UserCallback)
|
||||
{
|
||||
pcmd->UserCallback(cmd_list, pcmd);
|
||||
|
Reference in New Issue
Block a user