Im working on my game project with OGL 3.2 and I was using GL_REPEAT in the texture parameters to set up my terrain very fast by defining ST coordinates more than (1;1). But now, when I’ve added a skybox, an edges between skybox textures looks very scratchy and I don’t want them to be. I can remove them by using GL_CLAMP_TO_EDGE parameter, but terrain texture renders wrong without GL_REPEAT parameter. So I must choose between GL_REPEAT and GL_CLAMP_TO_EDGE. If I switch it to GL_CLAMP_TO_EDGE I can’t use GL_REPEAT advantage and have to divide my terrain to smaller chunks and give texture to each one by one, which is (in my opinion) very inefficient, especially when I want huge sized map.
Is there any way to use both advantages of GL_REPEAT and GL_CLAMP_TO_EDGE or maybe there is some more awesome way to solve this which I don’t know?
You can use both at once. The texture wrapping mode is stored on a per-texture basis, so use
GL_REPEATfor your ground texture andGL_CLAMP_TO_EDGEfor your sky texture.Set it for each texture immediately after (or immediately before, just as long as the texture is bound) uploading the texture image.