Practical sessions
As in the previous chapters, here are some ideas to try out with the example Vulkan rendering code. If you break anything, just roll back to the downloaded version:
- Add some more triangles to the model class. You can achieve this by adding more vertex and texture lines to
std::vector
. See what happens if you change the last value of theglm::vec3
position of the vertices. This is the z-value (or depth) of the vertex. The renderer has a depth buffer as an attachment on the framebuffer. The current ordering of the triangles from front to back should be independent of their position in the vertex’s vectors ofVkMesh
. - Use another image type as a texture, such as a JPG file from your system. You will break the display for sure because the number of channels is hardcoded for a PNG file (four channels: red, green, blue, and transparency), and a JPG file has no transparency. The
stbi_load()
function returns the number of channels of the loaded image, adding...