Re: [AD] al_set_target_bitmap question

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


I was imagining there might be problems if you loaded an image from a
file and then tried to draw on it. If your main display was OpenGL you
would have to upload the bitmap to the graphics card, draw using
pbuffers or whatever, then get it back into main memory.

Initially I thought that it was going to work like Java or GDI+, where
you start with the memory bitmap, then create a display from it, draw,
then flush/dispose of the display. Having looked at the current
implementation, it seems that loading an image automatically asks the
current display to allocate a bitmap, then copies the image to it.

I know this was discussed at length before, I suppose I just haven't
got my head around it yet.

Pete

On Jan 5, 2008 1:12 PM, Elias Pschernig <elias@xxxxxxxxxx> wrote:
>
>
> On Sat, 2008-01-05 at 10:25 +0000, Peter Hull wrote:
> > In al_set_target_bitmap, is there a restriction on what kind of bitmap
> > can be passed? The reason for asking is that the current display is
> > all set up with a vtable appropriate for a particular kind of driver
> > (say OpenGL, or whatever) then if you pass an arbitrary bitmap that
> > vtable might not be appropriate.
> >
> > On in other words I'm not sure how al_set_target_bitmap is supposed to
> > work. Could someone help?
> >
>
> No, we allow drawing to any kind of bitmap. So if you have some bitmap,
> and want to draw a line to it, you do:
>
> al_set_target_bitmap(bmp);
> al_line(x, y, tx, ty, color);
>
> To draw to the backbuffer again, you do:
>
> al_set_target_bitmap(al_get_display_backbuffer());
>
> Actually, I don't like that last bit at all, but not sure what would be
> a better solution. Maybe just a shortcut:
>
> al_unset_target_bitmap()
>
> or
>
> al_set_backbuffer_target()
>
> About the vtable not being appropriate, each ALLEGRO_BITMAP has its own
> ALLEGRO_BITMAP_INTERFACE property and also a pointer to the display it
> belongs to, should be enough to figure out what to do I think. But I
> never tried to mix different kinds of displays so far - maybe if you can
> give a more concrete example showing a possible problem.
>
> --
> Elias Pschernig <elias@xxxxxxxxxx>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> --
> https://lists.sourceforge.net/lists/listinfo/alleg-developers
>




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