Re: [AD] min/mag filters

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2010-08-12, Elias Pschernig <elias.pschernig@xxxxxxxxxx> wrote:
> Right now min/mag filters for drawing images can only be set in the
> config file. But looking at this in ex_haiku:
> 
>    cfg = al_get_system_config();
>    if (cfg) {
>       /* This should probably become a display option. */
>       default_cfg_value(cfg, "graphics", "min_filter", "linear");
>       default_cfg_value(cfg, "graphics", "mag_filter", "linear");
>    }
> 
> I completely agree with the comment. I was just going to remove those
> two options and add a few new flags you can pass to
> al_set_new_bitmap_flags:
> 
> ALLEGRO_MIN_FILTER_LINEAR
> ALLEGRO_MIN_FILTER_ANISOTROPIC
> ALLEGRO_MAG_FILTER_LINEAR
> ALLEGRO_MAG_FILTER_ANISOTROPIC
> 
> For OpenGL the implementation is trivial as we can just pass them to
> glTexParameter:
> http://www.khronos.org/opengles/sdk/1.1/docs/man/glTexParameter.xml
> 
> For D3D I found this so it should be easy as well:
> http://msdn.microsoft.com/en-us/library/bb172602%28v=VS.85%29.aspx
> 
> But not sure, maybe we want this as a display flag instead of bitmap
> flag? So I better ask here before I go ahead.

Tentatively, I think the display flag would be better, otherwise we
would need to call glTexParameter for every new source bitmap, right?
Or does the flag apply to the destination bitmap?

On a practical note, a lot of code is likely to call
al_set_new_bitmap_flag(ALLEGRO_VIDEO_BITMAP) without or'ing it
with the old flags. 

> 
> Also, we might want to add another flag:
> 
> ALLEGRO_MIPMAP
> 
> When you scale bitmaps out then that's almost a must to use. Mipmaps are
> automatically updated with opengl es 1 when you use glTexImage2d so it's
> just another flag to add to glTexParameter. (I don't know what happens
> when you modify the texture with FBO, or how it works in other opengl
> versions or in D3D though).

Perhaps mipmaps should be on by default, and add the flag
ALLEGRO_NO_MIPMAPS if you know you won't be scaling a particular
bitmap.

Peter




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/