View Full Version : Mipmapping question
RYX
May 30th, 2007, 01:51 PM
Hi!
Does anyone know if the mipmapping needs some special care? I am still working on the birdseye-effect in python and want to have the scaled windows appear anti-aliased like in switcher (if I remember correctly). But whatever I tried, the small windows are somehow jaggy and aliased after scaling them down.
Mike, maybe you can help here? I am using CompWindow.drawTransformed() to draw the windows (because the transform is not used when calling CompScreen.paintWindow and most of WindowPaintAttrib is read-only so it is also useless here). I also added the getter/setter for the CompDisplay.textureFilter-Attribute to the loader (as seen in switcher.c) - but still without success.
I hope someone can shed some light on this - thanks in advance :D ..
mikedee
May 30th, 2007, 02:17 PM
In switcher its done by just setting CompDisplay->textureFilter to GL_LINEAR_MIPMAP_LINEAR
I have added the ability to get and set that in the python plugin, have a go and see if that works. You should be able to get the GL defines from the GL module.
There is a new build system with the python plugin, so make sure you read the README ;)
OOps, sorry.. Didn't read your post fully... We have that now anyway :)
mikedee
May 30th, 2007, 02:31 PM
Did you try to replicate this part of the switcher code?
FragmentAttrib fragment;
CompTransform wTransform = *transform;
if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK)
return FALSE;
initFragmentAttrib (&fragment, &w->lastPaint);
if (w->alpha || fragment.opacity != OPAQUE)
mask |= PAINT_WINDOW_TRANSLUCENT_MASK;
matrixTranslate (&wTransform, w->attrib.x, w->attrib.y, 0.0f);
matrixScale (&wTransform, sw->scale, sw->scale, 0.0f);
matrixTranslate (&wTransform,
sw->tx / sw->scale - w->attrib.x,
sw->ty / sw->scale - w->attrib.y,
0.0f);
glPushMatrix ();
glLoadMatrixf (wTransform.m);
(*s->drawWindow) (w, &wTransform, &fragment, region,
mask | PAINT_WINDOW_TRANSFORMED_MASK);
glPopMatrix ();
The only tricky bit is loading the matrix, but I checked the docs a while ago and I think that function takes a 4x4 python array which is the same as CompTransform.matrix, matrix_ptr is there too but I dont think you will need it.
I think the mipmap only applies for newly drawn windows so if the window was originally drawn without mipmap then you cant add it to the texture later, so you should redraw the window rather than repainting its texture (I think)
mikedee
May 30th, 2007, 05:10 PM
I think I had the wrong brain in this morning :)
Ignore all above. I have now correctly implemented CompDisplay.textureFilter and I am using it in the miniwin class (They go blurry so I assume its working)
Setting it in miniwin is causing it to affect your birds eye view so it must work
RYX
May 30th, 2007, 05:51 PM
Thanks for all your help :) ... though it is still not working as it should.
After comparing the scaled windows of my plugin to the ones of the switcher plugin (I didn't use it for a while due to my "python-only" policy :D) I think the scaled down textures either just look like that or my card doesn't support mipmapping. The switcher looks exactly the same, mipmap is activated but the miniatures look aliased (like using the linear instead of the cubic scaling in gimp when scaling an image or using PHP's image-scaling without resampling).
Does anyone know if the geforce fx 5200 (nv34 chip) supprts mipmapping or how I can check that?
EDIT: Or maybe it just looks like that if you scale down a window to 33% of its size?? :)
mikedee
May 30th, 2007, 06:36 PM
I have a 7900 and I cannot notice any difference in switcher with mipmap enabled or not.
I have just updated the minime plugin to have a mipmaps option which I notice a BIG difference with mipmaps enabled. Maybe its just the ratios being used, switcher probably takes more care to resize to the best dimensions (ie a power of 2 most likely).
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.