[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
[moving to ad]
On Wed, 06 Mar 2013 11:42:00 -0700, Jon Rafkind <workmin@xxxxxxxxxx> wrote:
> Also I had to add a line to src/bitmap.c that copied the parent's shader to the sub-bitmap in al_create_sub_bitmap
>
> bitmap->shader = parent->shader;
>
> Anyway, after implementing my idea below some graphics still don't show up. I guess the default shader is still not being set in some circumstances. Also its a little yucky to set a shader. I have to copy the old target, set the new target, set the shader, then set the old target back.
>
> if (al_get_bitmap_flags(bitmap) & ALLEGRO_VIDEO_BITMAP){
> ALLEGRO_BITMAP * old = al_get_target_bitmap();
> al_set_target_bitmap(bitmap);
> al_use_shader(shader_default);
> al_set_target_bitmap(old);
> }
>
> Could there be a al_use_shader_for_bitmap(ALLEGRO_BITMAP*, ALLEGRO_SHADER*) ?
>
I agree that's annoying.
I think some more conveniences are in order:
- a bitmap should by default act the same in programmable pipeline mode
or not, so I guess that means new bitmaps should use a default shader.
Would this solve the issue above in most cases?
- shaders should be destroyed automatically by the destructor system.
- shaders should implicitly be unused by any bitmaps when the shader is
destroyed. Otherwise your program will explode if you later target
one of those bitmaps.
Peter