Height Map and Textures

Hello.
Im using auto generation of coords to texture mapping, and Im using a height map loader I want to know how to make 1 texture applied for all the map, not for every QUAD.

sorry about english.

my code:

int LoadGLTextures(char filename, int id){ int status = false; AUX_RGBImageRec TextureImage = NULL; ZeroMemory(&TextureImage, sizeof(void)1); if (TextureImage = LoadBMP(filename)) { GLfloat terrain[] = {1.0, 0.0, 0.0, 0.0}; status = true; glGenTextures(1, &texture[id]); glBindTexture(GL_TEXTURE_2D, texture[id]); gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage->sizeX, TextureImage->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage->data); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); glTexGenfv(GL_S, GL_OBJECT_PLANE, terrain); } if (TextureImage) { if (TextureImage->data) free(TextureImage->data); free(TextureImage); } return status;}void RenderHeightMap(BYTE pHeightMap[]){ GLfloat x,y,z,X=0,Y=0; if(!pHeightMap) return; glBegin(GL_QUADS); for ( X = 0; X < MAP_SIZE; X += STEP_SIZE ) for ( Y = 0; Y < MAP_SIZE; Y += STEP_SIZE ) { x = X; y = Height(pHeightMap, X, Y ); z = Y; glTexCoord2f(0.0, 0.0); glVertex3f(x, yELEVATION, z); x = X; y = Height(pHeightMap, X, Y + STEP_SIZE ); z = Y + STEP_SIZE ; glTexCoord2f(0.0, 1.0); glVertex3f(x,yELEVATION, z); x = X + STEP_SIZE; y = Height(pHeightMap, X + STEP_SIZE, Y + STEP_SIZE ); z = Y + STEP_SIZE ; glTexCoord2f(1.0, 1.0); glVertex3f(x, yELEVATION, z); x = X + STEP_SIZE; y = Height(pHeightMap, X + STEP_SIZE, Y ); z = Y; glTexCoord2f(1.0, 0.0); glVertex3f(x, yELEVATION, z); } glEnd();}

A lot of thanks!

Why are you generating texture cooridnates for one domension only, while explicitly setting it for the other? Generate coordinates for both dimensions at the same time.

GLfloat sPlane[] = {1.0/MAP_SIZE, 0, 0, 0};
GLfloat tPlane[] = {0, 0, 1.0/MAP_SIZE, 0};
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, sPlane);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tPlane);

[This message has been edited by Bob (edited 01-17-2002).]