Xavier Holt
Xavier Holt

Reputation: 14619

Memory Management: Name that Structure

I'm working with OpenGL, and using buffers to store vertex data in video memory. For effiency / convenience, I'm allocating big chunks of video memory, and then reserving chunks as I need them. There are three data structures I'm using:

Now I reckon that "Buffer" is a good name for that first data structure, but what are the other two called? I assume there's a technical term, but I don't know it, and don't know how to find it...

And here's an example memory layout, to back up my sketchy description (this buffer has three types of attributes: colors, vertices, and normals):

+--+--+--+--+--+--+--+--+--+--+--+
|c1|c2|c3|c4|c5|v1|n1|v2|n2|v3|n3|
+--+--+--+--+--+--+--+--+--+--+--+
|------------Buffer--------------| <- Buffer Class
|----chunk1----|------chunk2-----| <- "Chunk" classes
               |--|  |--|  |--|    <- "Skippy Chunk" class (vertices)
                  |--|  |--|  |--| <- "Skippy Chunk" class (normals)

Thanks in advance!

Upvotes: 0

Views: 204

Answers (2)

Alex P.
Alex P.

Reputation: 770

The part with your "skippy chunks" resembles interleaved arrays. It is quite common to mix such data (vertices, texture coordinates, normals, colors, ...) in a chunk of linear memory ("buffer") and access it using base addresses, offsets, and strides.

Upvotes: 1

datenwolf
datenwolf

Reputation: 162164

Buffer Chunk is actually the most common name for these.

Upvotes: 1

Related Questions