Applying textures to my terrain was actually more frustrating for me than it should have been. I thought that I had all of my textures ready to go, as there were a few of them that came with the obj files that I downloaded. However, for whatever reason, these textures refused to match up with the objects, and I had to paint my own. This was really annoying, especially with all of the complex flowers and trees that I had. In fact, I just refused to texture any of the bushes, saving myself days in the process. Apart from actually creating the textures, I never really had any huge issues with this feature, although I did have to read a bit of documentation. I was able to apply multiple textures to different objects by creating an array of GLuint’s and passing it to glGenTextures(). After that, it was simply a matter of setting each active texture, binding the texture, setting the parameters, and passing the textures to the fragment shaders, one by one. We had already worked on reading in UV coordinates in class, so that wasn’t a huge deal either.
Here are a couple of flowers that I textured myself.
Here’s a poorly textured cactus.
And here’s a tree that took me hours to paint…
I’ll need to give credit to whoever wrote the documentation on opengl.org for anything that I learned about how to apply multiple textures to a landscape, and to Dr. Johnson for his videos.
You can get to the video that I made via this link: