GML Reading the contents of a vertex bufferr

I'm planning on creating a vertex buffer-building DLL in C++, to take advantage of multithreading while generating large and dynamic vertex buffers without editing any of GameMaker's source files (technically possible, according to this thread here). To do this, though, I need to know how Game Maker: Studio stores data in vertex buffers.

With that in mind, is there any way to save the contents of a vertex buffer into a human-understandable format? I don't care if the values are visually paired with a descriptor of what it is; that would probably be far too much trouble for what little benefit I would get out of it. But assuming I already know the coordinates of a set of points, the texture coordinates assigned to them, et cetera, is there a way to visually see the order that information is saved in?


You can create a regular buffer out of a vertex buffer. Look up buffer_create_from_vertex_buffer. You can also go the other way.

When it is in a normal buffer you can use buffer_get_address to retrieve the pointer to the actual array containing the data (which you can pass to your DLL for modification).

In the array itself you need to format the data to match your vertex_format. Take a look at this page to see what kinds of data each type of category needs. You may have to play around with datatype sizes to figure it out but I would assume the data is probably a mix of floats and bytes (floats for things like normals, bytes for color) but, as said, you may have to play with it until you figure out what works.

I did something like this way back but it was long enough ago I can't remember the datatype sizes. I do know you should be able to get it to work, however.
Last edited: