I`m going over the gpu direct option to implement in a plugin.
looking inside the the sop cpp example.
Can someone explain this lines of this code ?
the comments are bit confusing along side the variables names …
what the number 12 represent ?
int32_t numVertices = 12;
int32_t numIndices = 12;
output->allocVBO(numVertices, numIndices, VBOBufferMode::Static);
Even if i reduce the numIndices to 1 - it still works…
(seem like buffer update thing)
as far as i understand now:
the cube example it can be :
int32_t numVertices = 8;
int32_t numIndices = 12;
output->allocVBO(numVertices, numIndices, VBOBufferMode::Static);
numVertices means number of vertices.
numIndices means number of triangles .
in the commnet your description is :
// Allocates and setup VBO buffers.
// Call this fucntion before adding any points, colors or normals,
// but after enableNormal(), enableColor(), addCustomAttribute().
// ‘numVertices’ is how much memory to allocate for positions/normals etc.
// ‘numIndices’ is how much memory to allocate for indices that are used
// to build primitives.
thank you.
Barak
A primitive is made up of indices to select each vertex that makes it up. So for example a triangle requires 3 indices to be defined. You could have only 5 points, but 50 triangles made up of various combinations of those 5 points, requiring 150 indices.
Thanks for the explanation,
maybe this one could be written differently…
// 'numVertices' is how much memory to allocate for positions/normals etc.
Yep for sure, we’ll reword that. Thanks!