Re: [AD] float positions

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


--- Elias Pschernig <elias@xxxxxxxxxx> escreveu:

> On Mon, 2007-01-22 at 16:25 +0000, Victor wrote:
> > OTOH non-integer pixels positions could slow down many allegro
> programs
> > which put/get integer pixels and blit in integer bitmap positions.
> 
> Assuming that the OpenGL drivers will be the fastest available
> drivers,
> and those already use floating point natively, I doubt it. Also, on
> desktop computers, there won't be a performance difference in using
> floats or int.
> 

For some platforms yes, but for some others no. There are many places
which doesn't support hardware acceleration and/or OpenGL very well,
mainly in older computers, but still common nowadays.
EG: My older computer that is with my syster don't run any opengl
games, though it uses Windows 2003 server (which IMO sucks). In my
work, with Windows 2000 (when the boss isn't around :), no opengl too.

> Even if Allegro is to be ported to some kind of handheld device which
> doesn't support floating point in HW, it shouldn't run slower. If you
> try to compile a program which already uses float, they simply are
> cut
> to ints (won't affect performace, as one conversion / gfx API call
> can
> be neglected compared to the vtables, clipping and color stuff going
> on..).
> 

Yes and no. It depends a lot in what the programmer does and how. It
depends on compilers differences, hardware differences and lots of
other things too. However about the vtables, i think you're right.

> >  May
> > create some caveats on lots situations too.
> 
> Which ones?
> 

Many programs assume that pixels are integers. E.g:

// Changes yellow to blue in some bitmap.
int x, y, color;
for (x = 0; x < bmp->h; x++) {
    for (y = 0; y < bmp->w; y++)
        color = getpixel(bmp, x, y);
        if (color == makecol(255, 255, 0))
            putpixel(bmp, x, y, makecol(255, 255, 0));
    }
}

If pixels aren't integers, things like that may fail or bug.

> > It would be better to create new functions to put/get non-integer
> > pixels and use non-integer blit, without deprecating or changing
> the
> > existing ones. Its important to note that they don't need to use
> > OpenGL, it's feasible and not very complex to implement they by
> hand
> > _IF_ needed for whatever reason.
> 
> There are no existing ones as it is yet to be written..
> 

I am not sure if I am misunderstanding what you are talking about or if
you went nuts. What about putpixel, getpixel, blit, line, hline, vline,
polygon, circle, masked_blit, draw_sprite, rotate_sprite, floodfill,
and many, many others which indeed exists for a long time ago?

> -- 
> Elias Pschernig
> 

Victor Williams Stafusa da Silva

__________________________________________________
Fale com seus amigos  de graça com o novo Yahoo! Messenger 
http://br.messenger.yahoo.com/ 




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