ARB_Multitexture Extension affecting consequent drawing

I’m writing a small 3d engine in Dev-C++ for Win32 and i finally got it to use the ARB_Multitexture extension for the lightmaps & textures. Before, I was using a blend function to overlap the texture and the lightmap.

The ARB_Multitexture extension works well, except for one thing: it seems to be affecting any drawing routines done after it (ie: models). The way it is affecting them is by changing the tint and brightness. I noticed that the Frames Per Second counter, which should be displayed as pure white (there is a glColor3f( 1.0, 1.0, 1.0 ); right above the drawing routine) was actually displayed as a dark green with ARB_Multitexturing but with the blending function, it came out pure white. The models are also darkened and tinted when ARB_Multitexturing is used.

Is there something i should do to turn it off before i exit the routine? Or some extra command i should give? Please help.

Some code:

void GamePlay :: drawLeaf ( int index, int cluster )
{
	int leafCluster = bsp.bsp_leafs[ index ].cluster;
	
	if( !( bsp.bsp_visdata.vecs[ cluster * bsp.bsp_visdata.sz_vecs + leafCluster / 8 ] & ( 1 << ( leafCluster & 7 ) ) ) && ( cluster > 0 ) )
		return;
	
	for( int i = 0; i < bsp.bsp_leafs[ index ].n_leaffaces; i++ )
	{
		BSP_Face & currFace = bsp.bsp_faces[ bsp.bsp_leaffaces[ bsp.bsp_leafs[ index ].leafface + i ].face ];
		
		// old blend method, begin
		/*
		glBindTexture( GL_TEXTURE_2D, textureArray[ bsp.texturesDirEntry.numElements + currFace.lm_index ] );
		glBegin( GL_TRIANGLES );
			for( int j = 0; j < currFace.n_meshverts; j++ )
			{
				glTexCoord2fv( bsp.bsp_vertexes[ bsp.bsp_meshverts[ currFace.meshvert + j ].offset + currFace.vertex ].texcoord[ 1 ] );

				glVertex3fv( bsp.bsp_vertexes[ bsp.bsp_meshverts[ currFace.meshvert + j ].offset + currFace.vertex ].position );
			}
		glEnd( );

		glEnable( GL_BLEND );

		glBlendFunc( GL_DST_COLOR, GL_ZERO );

		glBindTexture( GL_TEXTURE_2D, textureArray[ currFace.texture ] );
		glBegin( GL_TRIANGLES );
			for( int j = 0; j < currFace.n_meshverts; j++ )
			{
				glTexCoord2fv( bsp.bsp_vertexes[ bsp.bsp_meshverts[ currFace.meshvert + j ].offset + currFace.vertex ].texcoord[ 0 ] );

				glVertex3fv( bsp.bsp_vertexes[ bsp.bsp_meshverts[ currFace.meshvert + j ].offset + currFace.vertex ].position );
			}
		glEnd( );

		glDisable( GL_BLEND );
		*/
		// old blend method, end
		
		glActiveTextureARB(GL_TEXTURE1_ARB);
		glEnable(GL_TEXTURE_2D);
		glBindTexture(GL_TEXTURE_2D, textureArray[ currFace.texture ]);
		glActiveTextureARB(GL_TEXTURE0_ARB);
		glEnable(GL_TEXTURE_2D);
		glBindTexture(GL_TEXTURE_2D, textureArray[ bsp.texturesDirEntry.numElements + currFace.lm_index ]);


		glBegin( GL_TRIANGLES );
			for( int j = 0; j < currFace.n_meshverts; j++ )
			{
				glMultiTexCoord2fARB(GL_TEXTURE0_ARB, bsp.bsp_vertexes[ bsp.bsp_meshverts[ currFace.meshvert + j ].offset + currFace.vertex ].texcoord[ 1 ][ 0 ], bsp.bsp_vertexes[ bsp.bsp_meshverts[ currFace.meshvert + j ].offset + currFace.vertex ].texcoord[ 1 ][ 1 ] );
				glMultiTexCoord2fARB(GL_TEXTURE1_ARB, bsp.bsp_vertexes[ bsp.bsp_meshverts[ currFace.meshvert + j ].offset + currFace.vertex ].texcoord[ 0 ][ 0 ], bsp.bsp_vertexes[ bsp.bsp_meshverts[ currFace.meshvert + j ].offset + currFace.vertex ].texcoord[ 0 ][ 1 ] );
				glVertex3fv( bsp.bsp_vertexes[ bsp.bsp_meshverts[ currFace.meshvert + j ].offset + currFace.vertex ].position );
			}
		glEnd( );

	}
}

Try to glDisable the textures you’ve used after you’re done, or disable before the other code renders.

The better way to manage this is to track state in your app and enable or disable based on need, optimizine by sorting textures and untextured rendering and sorting by bound texture handle may further improve performance.

moving to the beginners section

Ahh, a

		glActiveTextureARB(GL_TEXTURE1_ARB);
		glDisable( GL_TEXTURE_2D );
		glActiveTextureARB(GL_TEXTURE0_ARB);
		glDisable( GL_TEXTURE_2D );

after all the above made everything go back to normal, thanks!