/*
*	EXT_Texture_filter_anisotropic.cpp
*
*	Programmé par Hillaire Sébastien
*
*
*	Se référé au fichier en-tête .h pour plus de détail
*
*/


#include "EXT_Texture_filter_anisotropic.h"
#include "MemoryManager/DebugNew.h"


bool EXT_texture_filter_anisotropic_IsDefined = false;
int EXT_MAX_texture_filter_anisotropy = 1;


bool getEXTTextureFilterAnisotropicProc(void)
{
	EXT_texture_filter_anisotropic_IsDefined=false;

    if (ogl_extensions::extensionSupported("GL_EXT_texture_filter_anisotropic"))
	{
		EXT_texture_filter_anisotropic_IsDefined = true;
		glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,&EXT_MAX_texture_filter_anisotropy);
	}

	return EXT_texture_filter_anisotropic_IsDefined;
}


bool setCurrentAnisotropy(int cAniso)
{
	bool ret = false;

	if( EXT_texture_filter_anisotropic_IsDefined && (cAniso>=1 || cAniso<=EXT_MAX_texture_filter_anisotropy))
	{
		ret = true;
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,cAniso);
	}

	return ret;
}