I am applying texture to objects and its fine but when I move camera because its 3D scene then texture also moves.. Texture having lines on it is clearly visible moving.. How can I fix the texture (paste) on the objects so that it will not move with me.
Here is the Texture Code.
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); //scale linearly when image bigger than texture
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); //scale linearly when image smalled than texture
//glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexImage2D(GL_TEXTURE_2D, 0, 3, image1->sizeX, image1->sizeY, 0,GL_RGB, GL_UNSIGNED_BYTE, image1->data);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glShadeModel(GL_FLAT);
I am applying it like this on objects (its glutSolidcube)
glPushMatrix();
glColor3f(0.50f, 0.35f, 0.25f);
glTranslated(-8, 2, -8);
glScaled(2.8,5, 4);
glEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_GEN_S); //enable texture coordinate generation
glEnable(GL_TEXTURE_GEN_T);
drawhouse(0.08);
glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_GEN_S); //enable texture coordinate generation
glDisable(GL_TEXTURE_GEN_T);
glPopMatrix();