![]() |
|
Texture on ALLEGRO_VERTEX |
SaintBass
Member #16,076
September 2015
![]() |
Hi guys!!! I`m using ALLEGRO_VERTEX but i can`t understand how the texture`s work, the u and v attributes are in pixels, but ¿How can i draw a complete image?. and draw this: al_draw_prim(v, NULL, texture, 0, 4, 4); |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
I swapped your 3rd and 4th vertices so that it draws triangles with vertices 0,1,2 and 0,2,3. You also need to adjust your u,v coordinates to match the bitmap's corners. int w = al_get_bitmap_width(bmp); int h = al_get_bitmap_height(bmp); ALLEGRO_VERTEX v[4] = { {150,50 ,0,0,0,al_map_rgb(255,255,255)}, {300,50 ,0,w,0,al_map_rgb(255,255,255)}, {300,200,0,w,h,al_map_rgb(255,255,255)}, {150,200,0,0,h,al_map_rgb(255,255,255)} }; al_draw_prim(v, NULL, texture, 0, 4, ALLEGRO_PRIM_TRIANGLE_FAN);
My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
SaintBass
Member #16,076
September 2015
![]() |
Thanks for your help!!! |
|