Hey there, thanks in advance for any help!
This is my issue, I have a terrain and it’s lovely and smooth and stuff so I thought I’d texture it all nice! So I thought I’d have two textures a grass texture and a snow texture and I’d use multitexturing to blend the two into each other at a certain height. Alas, it was never meant to be, I have fallen at the first hurdle!
Ok, so, in my render function for my terrain I have:
glActiveTextureARB(GL_TEXTURE1_ARB); //Set up texture unit 2
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, grassTexture);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glActiveTextureARB(GL_TEXTURE0_ARB); //Set up texture Unit1
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, snowTexture);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
This is all before I render the first vertex.
I then have a height test so if it’s over a certain height I use:
glNormal3f(normal.x,normal.y,normal.z);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, 0.0f);
glVertex3f(position.x,position.y,position.z);
obviously this is repeated 4 times with different round the 4 corners of each patch.
For under the certain height I have:
glNormal3f(normal.x,normal.y,normal.z);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, 0.0f);
glVertex3f(position.x,position.y,position.z);
Now, I thought that by doing this I’d at least have snow capped peaks and grassy plains but instead I seem to get normal grass and the snow looks like it’s been blended with the grass (it’s green!)
I think a picture probably illustrates this best:
Also, I know I don’t need to use multitexturing just yet since there is no textures actually being blended (or i don’t want them to be yet) but the next step will be blending the partition between the high and the low areas.
Any help would be much appreciated!
Thankyou.