OpenGL can someone find me a link for SOA implementation

So just about everything that I have seen has AOS the thing is I want to change just a section of the vertices.

if I have vertices like

vector<Vertex> vertices;

and I want to put in

vector<glm::vec3> positions;

it will not fit

What won’t fit? Based on what criteria?

You haven’t really told us what you’re doing exactly, or why you’re having problems.

For storing vertex attributes I assume. Yes, this is called Interleaved Vertex Attributes. It’s typically used as the GPU can read all the vertex attributes for a vertex from a single contiguous block of memory, rather than have to read from multiple blocks and do a gather operation. You can do either one though. Just profile it if you care about performance.

Typically you structure your data for efficient read access by the GPU (which happens frequently) vs. efficient CPU updates (which happens once or very infrequently).

1 Like

I need this because I want to use GPU programming to generate the vertex positions. This would make things a lot easier.

This is what I need but how do I specify the information that has to be put in.

glBindBuffer(GL_ARRAY_BUFFER, vboID);
glVertexPointer(3, GL_FLOAT, sizeof(TVertex_VNTWI), info->posOffset);
glTexCoordPointer(2, GL_FLOAT, sizeof(TVertex_VNTWI), info->texOffset);
glNormalPointer(GL_FLOAT, sizeof(TVertex_VNTWI), info->nmlOffset);
// --------------------
int weightPosition = glGetAttribLocation(programID, "blendWeights");
glVertexAttribPointer(weightPosition, 4, GL_FLOAT, GL_FALSE, sizeof(TVertex_VNTWI), info->weightOffset);
// --------------------
int indexPosition = glGetAttribLocation(programID, "blendIndices");
glVertexAttribPointer(indexPosition, 4, GL_UNSIGNED_BYTE, GL_FALSE, sizeof(TVertex_VNTWI), info->indexOffset);
// --------------------
glDrawElements(GL_TRIANGLES, numIndices, GL_UNSIGNED_SHORT, 0);