Loading an obj file! Obj files: First: Let's make one with Blender Blender is a large and complicated program I've used it for a few things, but not recently I'm kind of a klutz with the UI Export a trivial obj file anyway Note: Normals For lighting, might or might not be in our obj file We could parse this file tinyobjloader: tinyobj imports a namespace Documentation: read the code Unique vertices, and tinyobjloader We'll use elements, like usual A decision: We'll lift some code from hello_triangle_gui An object that loads a model from a file: init routine: The stuff we just did plus: Load the vertices into memory Load texture coordinates? Need that or color A hack: Color by texture coordinates We'll fix it later Load elements into memory We don't actually need the file in memory once it's on the GPU If we had multiple levels or areas, we might want to keep it List of instances of our object Draw: Pretty much like our other objects Alright, the textures: stbi_image, and loading it into memory Again, we can steal from hello_triangle_gui The fragment shader will have to load from a texture We can grab the Vulkan one and adapt it The vertex shader will have to pass the texture coordinates through Just like it did with color If we're using textures, we don't need "regular" colors Might as well save the memory and time Did any of this work? I'm hoping this can be the active learning: Save some other obj from Blender and load it in the game Faster: I could give you an obj to start with