I've created a vertex buffer in the "load vulkan" stage of my program. it's ment to be a buffer for all vertices, no matter what model instances may use them. 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 static size of 8 vertices, and the index buffer has a static size of 12 indices.
I'm tryin' now to load a first model instance (4 vertices, 6 indices), which works. I can see a result on the screen. (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 right. 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!
so any help please?
you can find the source code here:
game design, loading model instances: gm_update.cpp
engine stuff, vulkan: de_core.cpp
vertex shader: shaders/stage.vert
fragment shader: shaders/stage.frag
you can find all source files in that folder. just change the file name. I wanted to post code samples. but I don't know really where exactly the error is located in de_core.cpp
VkDeviceSize offsets[] = {0};beforevkCmdBindVertexBuffers(), andvkCmdBindIndexBuffer()::offset= 0 too, so that looks you are not using offsets yet at all. - krOoze