Multi-Texturing with a single texture using different S, T texCoords.
Hey all, new here.
I just asked a question on the stackoverflow forums here Link to post
What I am trying to do is texture my 3D triangle based terrain (using GL_TRIANGLE_STRIP) with different textures depending on a multitude of things such as height (a snowy texture), steepness (rocky texture) or flat (grass texture).
I started by trying to use shaders but as they are not required for this project (it's part of an assignment) and since I didn't know much about them I decided to go with more of a fixed pipeline solution. I first tried using multiTexCoords but found they didn't work the way I wanted so I ended up moving all my textures into one single texture.png and then using texCoords to try and place the correct S, T coords onto the terrain.
Currently my code is as such:
with the textures being bound with a Texture java utils object.
The current code makes my terrain display as such: Stripy Texture and Stripy Texture 2 What I want is to shift the S and T coords so that I can easily have the entire terrain be only the grass section of the .png file, or only snow, or only rocky. From there I could easily have different parts of the terrain use different S and T coords of the texture object.
Re: Multi-Texturing with a single texture using different S, T texCoords.
When you want to use only grass, you can update the texture coordinates so that you only use the grass section of the texture. What is wrong with that?
You just have to ensure that each triangle is exclusively considered as rocky, snow or grass, a given triangle in your triangle strip mustn't use the texture coordinates of multiple sections at the same time, it makes no sense to randomly mix the texture coordinates of the grass section with those of the snow section.