//------------------------------------------------------------------------------------------------------
	void TextureResourceGL::_DoSetFilterType( const TextureProperty::FilterType& ft )
	{
		ActiveTexture();
		int TexType = _GLTextureType( _GetTextureType() );
		glTexParameteri(TexType, GL_TEXTURE_MAG_FILTER, _GLFilter(ft.m_MagFilter) );
		CHECK_GRAPHIC_SYSTEM_ERROR;
		glTexParameteri(TexType, GL_TEXTURE_MIN_FILTER, _GLFilter(ft.m_MinFilter) ); 
		CHECK_GRAPHIC_SYSTEM_ERROR;
	}
	//------------------------------------------------------------------------------------------------------
	void TextureResourceGL::_DoSetWarpType( const TextureProperty::WarpType& wt )
	{
		ActiveTexture();
		int TexType = _GLTextureType( _GetTextureType() );
		glTexParameteri( TexType, GL_TEXTURE_WRAP_S, _GLWrap(wt.m_SWarp) );
		CHECK_GRAPHIC_SYSTEM_ERROR;
		glTexParameteri( TexType, GL_TEXTURE_WRAP_T,  _GLWrap(wt.m_TWarp) );
		CHECK_GRAPHIC_SYSTEM_ERROR;
	}
	//------------------------------------------------------------------------------------------------------
	void TextureResourceGL::_DoSetWarpType( const TextureStatus::WarpType& wt )
	{
		ActiveTexture();
		int TexType = _GLTextureType( _GetTextureType() );
		glTexParameteri( TexType, GL_TEXTURE_WRAP_S, _GLWrap(wt.m_SWarp) );
		CHECK_ERROR_RENDER;
		glTexParameteri( TexType, GL_TEXTURE_WRAP_T,  _GLWrap(wt.m_TWarp) );
		CHECK_ERROR_RENDER;
	}
	//------------------------------------------------------------------------------------------------------
	void TextureResourceGL::_DoSetFilterType( const TextureStatus::FilterType& ft )
	{
		ActiveTexture();
		int TexType = _GLTextureType( _GetTextureType() );
		glTexParameteri(TexType, GL_TEXTURE_MAG_FILTER, _GLFilter(ft.m_MagFilter) );
		CHECK_ERROR_RENDER;
		glTexParameteri(TexType, GL_TEXTURE_MIN_FILTER, _GLFilter(ft.m_MinFilter) ); 
		CHECK_ERROR_RENDER;
	}
	//------------------------------------------------------------------------------------------------------
	void TextureResourceGL::_DoActiveTexture( handle h ) const
	{
		OpenGLGraphicSystem* glsys = static_cast<OpenGLGraphicSystem*>( IGraphicSystem::Instance() );
		const_cast<TextureResourceGL*>(this)->m_hSlotIndex = glsys->GetTextureReferencre();
		glsys->IncreaseTextureReferencre();
		glActiveTexture( GL_TEXTURE0 + m_hSlotIndex );
		CHECK_GRAPHIC_SYSTEM_ERROR;
		glBindTexture( _GLTextureType( _GetTextureType() ), h );
		CHECK_GRAPHIC_SYSTEM_ERROR;
	}
	//------------------------------------------------------------------------------------------------------
	void TextureResourceGL::_DoSetAnisotropic( uint ani )
	{
		if( /*true == m_isUsingAnisotropic &&*/ 0 != ani )	//如果支持各向异性
		{
			ActiveTexture();
			int TexType = _GLTextureType( _GetTextureType() );
			/*uint to = x <= m_fMaxAnisotropic ? x : m_fMaxAnisotropic;*/
			glTexParameterf(TexType, GL_TEXTURE_MAX_ANISOTROPY_EXT, ani );
			CHECK_GRAPHIC_SYSTEM_ERROR;
		}
	}
	//------------------------------------------------------------------------------------------------------
	void TextureResourceGL::_DoSubstituteTextureBuffer( const BohgeEngine::vector2d& begin, const BohgeEngine::vector2d& size, const byte* const buffer )
	{
		ActiveTexture();
		glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
		GLenum glformat, gltype, gltext;		
		gltext = _GLTextureType( _GetTextureType() );
		glformat = _GLPixelFormat( _GetPixelFormat() );
		gltype = _GLDataType( _GetPixelFormat() );
		glTexSubImage2D( gltext, 0, begin.m_x, begin.m_y, size.m_x, size.m_y, glformat, gltype, buffer );
		CHECK_GRAPHIC_SYSTEM_ERROR;
		if ( isMipMap() )
		{
			glGenerateMipmap( gltext );
			CHECK_GRAPHIC_SYSTEM_ERROR;
		}
		glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
	}
	//------------------------------------------------------------------------------------------------------
	void TextureResourceGL::_DoActiveTexture( handle h )
	{
		glActiveTexture( GL_TEXTURE0 /*+ m_uTextrueReferenceCount*/ );
		glBindTexture( _GLTextureType( _GetTextureType() ), h );
		CHECK_ERROR_RENDER;
	}