Hi, I will start by appologising for this thread. I am aware that this topic has been covered a million times, but I just cant grasp what everyones saying and to be honest i think i need my hand held through this
I’ve trawled various forums and websites looking for help and so many of them are in different languages and/or using different methods (render in 1 pass etc) that im confused. so im just going to write what i think i know to be fact and then hope some kind soul will fill in the blanks…
I have a heightmap composed of 4 point quads with a heightmap. As it stands there are 3 textures: Grass, Rock and Snow. At the point of rendering each quad i check the height of a point and bind a texture reletive to the smallest height. This works but obviously looks hideous, and i wanted to apply blending to smoothe the transition between textures.
Texture Blending:- A Method Thereof
glDisable(GL_BLEND); //Disable Blending
RenderTerrainWithBaseTexture(); //First pass…render whole terrain with green fields
glEnable(GL_BLEND); //Enable blending
glEnable(GL_BLEND); //Enable blending
glBlendFunc(); //There should be a blend function here but I’m not sure of the parameters…one of the threads i read on this forum suggested GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA
RenderTerrainWithOtherTextures
{
…
BindAppropriateTexture();
// Set The Color Value Of The Current Vertex
glTexCoord2f(1,0);
glColor4f(0.0f, 0.0f, 0.0f, FindVertexAlpha());
glVertex3f(x, y, z);// Send This Vertex To OpenGL To Be Rendered
…
}
glBindTexture(GL_TEXTURE_2D, NULL);// Clear the bound texture