Ok, got all my program up and running ,though there are some weird things happening with the texture.
I can’t really explain it, that’s why I made this video:
http://members.home.nl/painbug/Capture-002.avi
(Look near the cursor in the middle and you will see it).
When I have 2 Polygon’s next to eachother,and I’m at a high-coordinate, the texture seems to jump around at the seam.
This only occurs when I’m at coordinats like x14000 y200 z6000 etc…,
when I’m at x0 y0 z0 it doesnt happen at all.
I tried using floats, double’s, and even integers for glVertex… and
glMultiTextCoord, though without any results.
I have played around with the Perspective, ie. setting the near-plane to 10 and far-plane to 10,000 … or 2/2000 etc.
Z-buffering is done correctly and all polygons are not fighting along the depth-buffer.
Some people said that it maybe be the way how I’m building my mipmaps, so I’ll post my texture generation code here:
// Generate a texture with the associative texture ID stored in the array
glGenTextures(1, &textureArray[textureID]);glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
glBindTexture(GL_TEXTURE_2D, textureArray[textureID]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);if (engine_init_bpp < 24) textureType = GL_RGB4;
else textureType = GL_RGB;gluBuild2DMipmaps(GL_TEXTURE_2D, textureType, pImage->sizeX, pImage->sizeY, GL_RGB, GL_UNSIGNED_BYTE, pImage->data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);///////////////////////////////// SET TEXTURE COORD \\\\\\\\\\\\\\\\*
void SetTextureCoord(double x, double z,int MapSize,int Mod)
{
// Find the (u, v) coordinate for the current vertexdouble u = ((double)(x+LvlMem[Mod].Xmod/2) / (double)MapSize); // - (LvlMem[Mod].Xmod/2/MapSize)
double v = -((double)(z+LvlMem[Mod].Zmod/2) / (double)MapSize); // - (LvlMem[Mod].Zmod/2/MapSize))if(engine_init_detail == true && g_bMTSupported == true)
{
// Give OpenGL the current terrain texture coordinate for our height map
glMultiTexCoord2DARB(GL_TEXTURE0_ARB, u, v);// Give OpenGL the current detail texture coordinate for our height map glMultiTexCoord2DARB(GL_TEXTURE1_ARB, u, v);
} else {
glTexCoord2d(u,v);
}
}
Thanks for your time