On Wed, Jun 27, 2007 at 04:11:32PM +0200, dragoran wrote:
> I think he was talking about the anisotropic filtering patch ;)
Here they are. The compiz-anisotropic patch adds support for anisotropic
filtering to the core and the compiz-cube-anisotropic patch exposes that
functionality in cube plugin.

wolf
-- 
  Bartek   .  
  Taudul   :  
          .:....................................................................
w o l f @ p l d - l i n u x . o r g            .:. http://wolf.valkyrie.one.pl/
diff -ruN compiz./include/compiz.h compiz/include/compiz.h
--- compiz./include/compiz.h    2007-06-09 22:11:05.000000000 +0200
+++ compiz/include/compiz.h     2007-06-27 23:35:09.429822645 +0200
@@ -885,7 +885,8 @@
     unsigned int      lastPing;
     CompTimeoutHandle pingHandle;
 
-    GLenum textureFilter;
+    GLenum       textureFilter;
+    unsigned int textureAnisotropic;
 
     Window activeWindow;
 
@@ -1865,6 +1866,8 @@
     int                      fbo;
     int                      fragmentProgram;
     int                      maxTextureUnits;
+    Bool              anisotropicFiltering;
+    int               maxAnisotropy;
     Cursor           invisibleCursor;
     XRectangle        *exposeRects;
     int                      sizeExpose;
diff -ruN compiz./src/display.c compiz/src/display.c
--- compiz./src/display.c       2007-06-09 22:11:05.000000000 +0200
+++ compiz/src/display.c        2007-06-27 23:36:41.415789608 +0200
@@ -1971,8 +1971,9 @@
 
     d->dirtyPluginList = TRUE;
 
-    d->textureFilter = GL_LINEAR;
-    d->below        = None;
+    d->textureFilter      = GL_LINEAR;
+    d->below             = None;
+    d->textureAnisotropic = FALSE;
 
     d->activeWindow = 0;
 
diff -ruN compiz./src/screen.c compiz/src/screen.c
--- compiz./src/screen.c        2007-06-09 22:11:05.000000000 +0200
+++ compiz/src/screen.c 2007-06-27 23:40:05.384672877 +0200
@@ -1861,6 +1861,13 @@
            s->fbo = 1;
     }
 
+    s->anisotropicFiltering = FALSE;
+    if (strstr (glExtensions, "GL_EXT_texture_filter_anisotropic"))
+    {
+        glGetIntegerv (GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &s->maxAnisotropy);
+        s->anisotropicFiltering = TRUE;
+    }
+
     fbConfigs = (*s->getFBConfigs) (dpy,
                                    screenNum,
                                    &nElements);
diff -ruN compiz./src/texture.c compiz/src/texture.c
--- compiz./src/texture.c       2007-06-09 22:11:05.000000000 +0200
+++ compiz/src/texture.c        2007-06-27 23:46:43.823888475 +0200
@@ -465,6 +465,23 @@
            texture->oldMipmaps = FALSE;
        }
     }
+
+    if (screen->display->textureAnisotropic)
+    {
+        glTexParameteri (texture->target,
+                         GL_TEXTURE_MAX_ANISOTROPY_EXT,
+                         screen->maxAnisotropy);
+    }
+    else
+    {
+        if (screen->anisotropicFiltering)      /* may be not supported */
+        {
+            /* disable anisotropic filtering */
+            glTexParameteri (texture->target,
+                             GL_TEXTURE_MAX_ANISOTROPY_EXT,
+                             1);
+        }
+    }
 }
 
 void
diff -ruN compiz./include/cube.h compiz/include/cube.h
--- compiz./include/cube.h      2007-06-22 16:17:02.000000000 +0200
+++ compiz/include/cube.h       2007-06-28 00:06:10.145958731 +0200
@@ -59,7 +59,8 @@
 #define CUBE_SCREEN_OPTION_INACTIVE_OPACITY        16
 #define CUBE_SCREEN_OPTION_FADE_TIME               17
 #define CUBE_SCREEN_OPTION_TRANSPARENT_MANUAL_ONLY 18
-#define CUBE_SCREEN_OPTION_NUM                     19
+#define CUBE_SCREEN_OPTION_ANISOTROPIC             19
+#define CUBE_SCREEN_OPTION_NUM                     20
 
 typedef void (*CubeGetRotationProc) (CompScreen *s,
                                     float      *x,
diff -ruN compiz./metadata/cube.xml.in compiz/metadata/cube.xml.in
--- compiz./metadata/cube.xml.in        2007-06-22 16:17:02.000000000 +0200
+++ compiz/metadata/cube.xml.in 2007-06-28 00:02:15.681727720 +0200
@@ -124,6 +124,11 @@
                <_long>Generate mipmaps when possible for higher quality 
scaling</_long>
                <default>true</default>
            </option>
+           <option name="anisotropic" type="bool">
+               <_short>Anisotropic Filtering</_short>
+                <_long>Use anisotropic filtering to enhance cube sides at 
steep angles</_long>
+               <default>true</default>
+           </option>
            <option name="backgrounds" type="list">
                <_short>Background Images</_short>
                <_long>Background images</_long>
diff -ruN compiz./plugins/cube.c compiz/plugins/cube.c
--- compiz./plugins/cube.c      2007-06-27 01:21:28.000000000 +0200
+++ compiz/plugins/cube.c       2007-06-28 00:13:49.575869817 +0200
@@ -1335,6 +1335,7 @@
     int                      hsize, xMove = 0;
     float            size;
     GLenum            filter = s->display->textureFilter;
+    Bool              anisotropic = s->display->textureAnisotropic;
     PaintOrder        paintOrder;
     Bool             clear;
     Bool              wasCulled = FALSE;
@@ -1437,6 +1438,10 @@
     if (cs->opt[CUBE_SCREEN_OPTION_MIPMAP].value.b)
        s->display->textureFilter = GL_LINEAR_MIPMAP_LINEAR;
 
+    /* anisotropic filtering is not needed for unfolded cube */
+    if (!cs->grabIndex && cs->opt[CUBE_SCREEN_OPTION_ANISOTROPIC].value.b)
+       s->display->textureAnisotropic = TRUE;
+
     if (cs->invert == 1)
     {
        /* Outside cube - start with FTB faces */
@@ -1519,6 +1524,7 @@
                               size, hsize, paintOrder);
 
     s->display->textureFilter = filter;
+    s->display->textureAnisotropic = anisotropic;
 
     if (wasCulled)
        glEnable (GL_CULL_FACE);
@@ -2033,7 +2039,8 @@
     { "active_opacity", "float", "<min>0.0</min><max>100.0</max>", 0, 0 },
     { "inactive_opacity", "float", "<min>0.0</min><max>100.0</max>", 0, 0 },
     { "fade_time", "float", "<min>0.0</min>", 0, 0 },
-    { "transparent_manual_only", "bool", 0, 0, 0 }
+    { "transparent_manual_only", "bool", 0, 0, 0 },
+    { "anisotropic", "bool", 0, 0, 0 }
 };
 
 static Bool
_______________________________________________
compiz mailing list
compiz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/compiz

Reply via email to