problem with texture

Hello, I’m a new user. I have a problem with the inclusion of texture. I added texture but it when I move the camera moves itself. how can I lock the texture?
thank you very much.

Mary

sorry,
I forgot to say that my programming language is C++
thanks

Could u post your code so that we may tell u what u r doing wrong?

well the code is as follows
In the function display’ve enabled automatic generation of texture.


void display()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 

	glMatrixMode(GL_MODELVIEW);


	glDisable(GL_TEXTURE_GEN_S);
	glDisable(GL_TEXTURE_GEN_T);
	glDisable(GL_TEXTURE_GEN_R);
	glMatrixMode(GL_MODELVIEW);


	

	glLoadIdentity();
	gluLookAt(pos[0], pos[1], pos[2], at[0], at[1], at[2], up[0], up[1], up[2]);
		
	glColor3f(1.0, 1.0, 1.0);
	for(int i=0;i<100;i++)
	{
		for(int j=0;j<100;j++)
		{
			glPushMatrix();
			float x = -50 + i;  
			float z = -100 + j;
			glTranslatef(x, 0, z);
			glScalef(1.0, 0.0, 1.0);	
			glutWireCube(4.0);
			glPopMatrix();
		}
	}


	glEnable(GL_TEXTURE_GEN_S);
	glEnable(GL_TEXTURE_GEN_T);
	glEnable(GL_TEXTURE_GEN_R);
	glMatrixMode(GL_MODELVIEW);


	for(int i=0; i<list.counter; i++){		
		list.data[i];
		draw(list.data[i]);		
	}
	glFlush ();
	glutSwapBuffers();
}



void draw(objectcad objcad){
	GLfloat xobj = objcad.xpos;
	GLfloat yobj = objcad.ypos;
	GLfloat zobj = objcad.zpos;
	GLfloat alphaObj = objcad.alpha;
	GLfloat xScaleObj = objcad.xscale;
	GLfloat yScaleObj = objcad.yscale;
	GLfloat zScaleObj = objcad.zscale;
	int idColor = objcad.color;
	int index = objcad.indexObject;

	glBindTexture(GL_TEXTURE_2D, texNames[objcad.idTexture]);
	
	glPushMatrix();
	glColor3fv(colors[idColore]);
	glTranslatef(xobj, yobj, zobj);
	glScalef(xScaleObj, yScaleObj, zScaleObj);
	glRotatef(alphaObj, 0.0, 1.0, 0.0);
	glLoadName(objcad.picking);
	if(wire_solid==true){
		drawSolid(index);
	}else{
		drawWire(index);
	}

	glPopMatrix();
}



GLuint loadTexture(const char *filename){
	GLuint idTexture;
	
	FREE_IMAGE_FORMAT fifmt = FreeImage_GetFileType(filename, 0);


	FIBITMAP *dib = FreeImage_Load(fifmt, filename,0);

	
	dib = FreeImage_ConvertTo24Bits(dib);

	if( dib != NULL )
	{
		glGenTextures( 1, &idTexture );
		glBindTexture( GL_TEXTURE_2D, idTexture );
		
		
		BYTE *pixels = (BYTE*)FreeImage_GetBits(dib);

		
		glTexImage2D( GL_TEXTURE_2D, 0, 3, 
			FreeImage_GetWidth(dib), FreeImage_GetHeight(dib), 0,
			GL_BGR_EXT, GL_UNSIGNED_BYTE, pixels );

		glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_NEAREST );
		glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_NEAREST );
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

		FreeImage_Unload(dib);
		return idTexture;
	}
	return -1;
}

int main(int argc, char **argv){
	.....
	texNames[0]=loadTexture("t1.jpg");
	texNames[1]=loadTexture("t2.jpg");
	texNames[2]=loadTexture("t3.jpg");
	texNames[3]=loadTexture("t4.jpg");
}


thanks

mary