From 84261142539cb1d105521bbd10d5c28244a84d9b Mon Sep 17 00:00:00 2001 From: raster Date: Wed, 17 Feb 2010 07:26:44 +0000 Subject: [PATCH] get ansio ext + max val. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@46240 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/modules/engines/gl_common/evas_gl_common.h | 3 ++- src/modules/engines/gl_common/evas_gl_context.c | 31 +++++++++++++++++++------ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/modules/engines/gl_common/evas_gl_common.h b/src/modules/engines/gl_common/evas_gl_common.h index b1b5740..9901773 100644 --- a/src/modules/engines/gl_common/evas_gl_common.h +++ b/src/modules/engines/gl_common/evas_gl_common.h @@ -88,6 +88,7 @@ struct _Evas_GL_Shared struct { GLint max_texture_units; GLint max_texture_size; + GLfloat anisotropic; Eina_Bool tex_npo2 : 1; Eina_Bool tex_rect : 1; } info; @@ -340,7 +341,7 @@ void (*glsym_glBindFramebuffer) (GLenum a, GLuint b); void (*glsym_glFramebufferTexture2D) (GLenum a, GLenum b, GLenum c, GLuint d, GLint e); void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b); -#define GL_ERRORS 1 +//#define GL_ERRORS 1 #ifdef GL_ERRORS # define GLERR(fn, fl, ln, op) \ diff --git a/src/modules/engines/gl_common/evas_gl_context.c b/src/modules/engines/gl_common/evas_gl_context.c index 9fb266c..7e42b61 100644 --- a/src/modules/engines/gl_common/evas_gl_context.c +++ b/src/modules/engines/gl_common/evas_gl_context.c @@ -209,6 +209,14 @@ evas_gl_common_context_new(void) (strstr((char*) ext, "GL_ARB_texture_rectangle")) ) shared->info.tex_rect = 1; +#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT + if ((strstr((char*) ext, "GL_EXT_texture_filter_anisotropic"))) + { + glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, + &(shared->info.anisotropic)); + printf("max aniso: %3.3f\n", shared->info.anisotropic); + } +#endif } glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &(shared->info.max_texture_units)); @@ -248,9 +256,12 @@ evas_gl_common_context_new(void) GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); -#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); +#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT + if (shared->info.anisotropic > 0.0) + { + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } #endif glEnableVertexAttribArray(SHAD_VERTEX); @@ -1023,8 +1034,11 @@ shader_array_flush(Evas_GL_Context *gc) if (gc->shader.smooth) { #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + if (shared->info.anisotropic > 0.0) + { + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, shared->info.anisotropic); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } #endif glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); @@ -1038,8 +1052,11 @@ shader_array_flush(Evas_GL_Context *gc) else { #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + if (shared->info.anisotropic > 0.0) + { + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } #endif glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); -- 2.7.4