質問
OpenGL 4.4、C++11
element_array_buffer と array_buffer の両方に頂点属性を設定することにより、各属性に対して 0 から element_array_buffer のインデックスを使用する権限はありますか?
データレイアウト
VAO
Buffer(array_buffer)
PositionFloat * n
TextureFloat * n
NormalFloat * n
Buffer(element_array_buffer)
PositionIndex * 1
TextureIndex * 1
NormalIndex * 1
データの使用
//gen
glBindVertexArray(VAO);
glBindBuffer(array_buffer, vbo);
glBufferData(array_buffer, size(vertices), data(vertices), access(vertices));
glVertexAttribPointer(POSITIONS, 3, float, offset(0));
glVertexAttribPointer(UVS, 2, float, offset(positions));
glVertexAttribPointer(NORMALS, 3, float, offset(normals));
glBindBuffer(element_array_buffer, ebo);
glBufferData(element_array_buffer, size(elements), data(elements), access(elements));
...?! /*Cannot set element attributes!
If I could, I would set a strided, offset attribPointer for each attribute,
so that if 0 appears in the NORMALS attribute, it will look up the first normal,
and not the first element in the buffer. */
問題
最初の頂点、UV、および法線を 0/0/0 で参照できるようにインデックスを記述します。これを element_array_buffer にマップしてそのまま使用することはできますか? または、nPositions をテクスチャ インデックスに追加し、nPositions+nTextures を通常のインデックスに追加するソリューションはありますか?