Texture stops to repeat when another texture is bound after.

Hi, I have problem with texturing. I’m drawing a circle with planet texture and square with shadow texture on it.

Picture 1 shows what I get, and if I won’t draw shadow texture or just not bind another texture the planet texture will repeat just fine like on picture 2.

link to image: img213.imageshack.us/img213/8600/testbx.jpg
I can’t post it normal, you must add http stuff.

Here is my code:


	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glDisable(GL_TEXTURE_2D);					
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);	
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);	
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
 
	
	glOrtho(
		gameData->mousePos.x * CAMERA_MOVE_SCALE - gameData->mousePos.x,
		windowWidth + gameData->mousePos.x * CAMERA_MOVE_SCALE - gameData->mousePos.x, 
		windowHeight + gameData->mousePos.y * CAMERA_MOVE_SCALE - gameData->mousePos.y, 
		gameData->mousePos.y * CAMERA_MOVE_SCALE - gameData->mousePos.y,
		1,
		-1
	);
 
	glMatrixMode(GL_MODELVIEW);
	
	glLoadIdentity();

	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, textEarth);
				
	glTranslatef(windowWidth, windowHeight, 0);
	glRotatef(0, 0, 0, 1);

	glBegin(GL_TRIANGLE_FAN);
				
		float move = (clock() % (CLOCKS_PER_SEC * 10)) / 10000.0f;

		float radius = 100;
		glTexCoord2d(0.25f + move, 0.5f);
		glVertex3f(0.0f, 0.0f, 0.0f);

		for(float i = 0; i < 2 * M_PI; i += 2* M_PI / 180){
			float x = cos(i);
			float y = sin(i);
			glTexCoord2d((x + 1.0f) / 4 + move, (y + 1.0f) / 2);
			glVertex3f(x * radius, y * radius, 0.0f);
		}		

	glEnd();
	glDisable(GL_TEXTURE_2D);
	

	glLoadIdentity();
	glEnable(GL_TEXTURE_2D);
				
	glTranslatef(windowWidth, windowHeight, 0);
	glRotatef(0, 0, 0, 1);

	glBindTexture(GL_TEXTURE_2D, textPlanetShadow);

	glBegin(GL_QUADS);
				
		radius = 101;

		glTexCoord2d(0.0f, 0.0f);
		glVertex3f(-radius, -radius, 0);
		glTexCoord2d(1.0f, 0.0f);
		glVertex3f(radius, -radius, 0);
		glTexCoord2d(1.0f, -1.0f);
		glVertex3f(radius, radius, 0);
		glTexCoord2d(0.0f, -1.0f);
		glVertex3f(-radius, radius, 0);

	glEnd();
	glDisable(GL_TEXTURE_2D);
	
	SDL_GL_SwapBuffers();

respecify the texture parameters after each texture bind


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

It works :slight_smile: Thank you.