vertex buffer, index buffer and offset


I’ve created a vertex buffer in the “load vulkan” stage in the beginning of my program. it’s ment to be a buffer for all vertices, irrespective of model instances and my application should be able to load vertices during run time at any time, using different offsets for the vertex buffer (and of course index buffer).

for testing the vertex buffer has a size of 8 vertices, and the index buffer has a size of 12 indices.

I’m tryin’ now to load a first model instance (4 vertices, 6 indices), which works and can be displayed. (it’s a square)
Then I’m tryin’ to load another model instance (again 4 vertices, 6 indices) (another square).

problem: the second model instance wouldn’t show up on the screen. I checked the offsets for vertex buffer and index buffer. they seem correct. i know that there is no texture image for the second instance yet, however there should be a white square at least, 'cause default mix color in the shaders is white. default clear color for the screen is black. for testing I also changed it to white, assuming, that uv colors could be 0, 0, 0.

so why isn’t the second instance visible on the screen?
I read some articles and some suggest to “execute the command buffer” after updating the vertex buffer. aside from understanding what that means, it wouldn’t make sense really, 'cause both instances are created during run time, and the first one works, without that advice!

so any help please?

you can find the source code here:

main function
loading instances (game design stage)
vulkan / engine stuff

you can find all source files in that folder. just change the file name.

vertex shader
fragment shader