从索引缓冲区中获取索引
Getting indices out of index buffer
我有一个索引数组面临我将如何循环并获取每个索引?
for (int n = 0 ; n < updatedIndices.size(); n++)
{
int n0 = updatedIndices[n+0];
int n1 = updatedIndices[n+1];
int n2 = updatedIndices[n+2];
manual->triangle(n0, n1, n2);
}
但这崩溃了因为当 n == 更新.size((更新的索引将超出界限我知道它非常基本但是我将如何解决呢?
代码崩溃,因为您尝试访问超出范围的索引。只需遍历除 2 个项目之外的所有项目:
for (int n = 0; n < updatedIndices.size() - 2; n++)
相关文章:
- C++17:如何在并行 STL 中获取工作项的索引
- Direct3D 11 - HLSL - 获取顶点索引 ID
- 在 std::variant 中按类型获取索引
- CPtrList - 如何获取元素的索引?
- 根据字符获取数组的索引
- 特征获取索引数组,其中向量中的值为真(不需要循环)
- 获取结构 c++ 中元素的索引
- 是否可以将变体的索引作为 constexpr 变量获取?
- 如何使用值获取结构的索引
- 使用 Netlink 获取进程索引节点
- C++ 通过 std::transform 的 vector 索引获取向量
- 从 boost::variant 中逐个索引获取项目,就像使用 std::variant 一样
- 如何将排序的元素从数组中的起始索引获取到结束索引
- 按索引获取__m128成员?
- 通过(实际)监视器的索引获取其句柄
- 从 C++ 中的二维向量中的特定索引获取值
- RapidJSON 库通过索引获取数组中的值
- 通过其索引获取枚举值
- 奇怪的数组东西(数组索引获取值没有我设置它)
- 按索引获取 std::set 成员C++