It originally ran on Linux using a NVIDIA card (9500 GT). It looks great running on Linux! But, when porting the code to Windows a hideous problem emerged in the terrain system.
drum role please.....
There are nasty seams between the terrain tiles!!! I am running the code on the same computer, only under Windows XP rather than Linux. Same drivers, same hardware, etc.
Here are a couple of pictures to help illustrate the problem.
The Linux port: http://img84.imageshack.us/img84/2686/noseamsscreenshot.jpg
The Windows port: http://img269.imageshack.us/img269/9443/seamsscreenshot.jpg
As you can see there are nasty seams in between the tiles when running it on Windows. The Linux port, however, does not suffer from this issue.
The terrain system works in a similar way to Warcraft 3's. Each tileset has a base texture, then a series of transitioning tiles. The engine chooses the appropriate tile depending on the adjacent tiles, and layers them if necessary.
I have encountered this problem before, but was able to fix it (or suppress it, more likely) by breaking each sub-tile in each tileset into a separate texture, rather than keeping the sub-tiles tiled in a single texture. I then hand each texture as a layer in a texture array to OpenGL.
This suggests to me that there is a texture wrapping problem, and that OpenGL is tiling the texture(s) ever-so-slightly at the edge of the tiles, resulting in the seams.
So, I set the texture parameters to GL_CLAMP as such:
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP);glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP);
But, that only made the problem worse.
Here is the relevant code (pertaining to texture wrapping):
GLenum internalFormat = GL_RGBA;GLenum format = GL_RGBA;s32 w = 128;s32 h = 128;s32 d = numberOfTilesets * 16;u8 * Pixels = new u8[w * h * d * 4];glBindTexture(GL_TEXTURE_2D_ARRAY, textureID);glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP);glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP);glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_GENERATE_MIPMAP, GL_TRUE);glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, internalFormat, w, h, d, 0, format, GL_UNSIGNED_BYTE, Pixels);
Has anybody here encountered problems like this before, and know a (preferably) quick and easy fix?
Thanks beforehand!
P.S: Yes, the bright orange Lava is animated! :D