I need currently working on clipmapping textures. I got to a part where I can correctly update textures when user moves around. But I am having problem on how to map this texture on the terrain quickly.
What I am doing now is, for each detail level I have allocated different textures (using glGenTextures). They all are loaded correctly and when user moves around they are correctly updated too(using torodial stuff). To map the texture in the terrain, I calculate area each textures covers, then enable the texture and texture map it. But the problem is I have to divide terrain depending upon the texture detail level. They have to match up exactly.
here is what my algorithm look like
at beginning
.
glGenTextures(maxTextures,levels)
...
at render function
.
for i = 0 to max Detail Level
{
update Texture at Level i
find the vertices that belong to texture level i
bind texture at level i
draw vertices that belong to texture level i
}
Is there other way of doing it.Do I have to use multi-textureing?? Are there any special extensions used??
Thanks
Sujal