Re: [AD] Meaning of the texture coordinates for the primitives addon

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


On Tue, August 25, 2009 5:40 am, Paul Suntsov said:
> As you know, the primitives addon currently supports textured primitives. To accomplish that, each
> vertex has a pair of UV coordinates. Right now, they represent the parametrized location on the
> texture, with (0,0) being one corner of the bitmap and (1,1) being the opposite corner. Elias
> suggested that it may be better to de-parametrize them and use pixel coordinates. In the previous
> example, the other corner would then be (bitmap_width, bitmap_height). This would be done for
> consistency with al_draw_bitmap_region and the like, and a general perception of ease of use. If
> this is what is decided to be done, this would be implemented via texture transformations, which
> both D3D and OGL have, so there's no problem on that front.
>
> Are there any strong opinions on this one way or another?
>
> My preference is slightly to keeping them parametrized, since that allows you to easily swap
> textures with similar images at different scales, without fiddling with the coordinates. But that
> may be a rare enough operation for it to not matter.

I don't have a preference on this but I do have a related preference. Right now texture coordinates
are using the default opengl system of 0,0 being bottom left and 1,1 being top right. I think 0,0
should be top left and 1,1 or w,h should be bottom right. But I guess if we take that step then
perhaps using pixel coordinates is just another natural step towards consistency. I think you make
good points though about why they should be parameterized. Ok, I guess I'll vote: I like them
parameterized but I think the y axis is currently upside down in GL. It's not like it's hard to
convert
pixel coordinates to texture coordinates anyway. We could have some
al_make_vertex_pixels(ALLEGRO_VERTEX *,
float x, float y, int px, int py, ALLEGRO_COLOR color) convenience functions maybe (or just ones
that convert only the pixel coords to texture coords given the bitmap).

Trent :-)




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