draw_gouraud_sprite(3)
π draw_gouraud_sprite β Allegro manual, page 3, bestie edition
okay so we're in the Allegro manual today and the function on the docket is draw_gouraud_sprite(3). she's a glow-up function. literally. β¨
β¨ NAME β¨
draw_gouraud_sprite β draws a sprite with gouraud shading, courtesy of the Allegro game programming library. π
πΈ SYNOPSIS πΈ
#include <allegro.h>
void draw_gouraud_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int c1, int c2, int c3, int c4);
π DESCRIPTION π
so draw_gouraud_sprite() is the fancier, more sophisticated sibling of draw_lit_sprite(). the glow-up? the color parameter is not constant across the sprite image anymore. nope. instead it gets interpolated between the four corner colors you hand her. it's giving gradient. it's giving β¨dimensionβ¨.
the corner values you pass in tell her the strength of the color applied on each corner, and the range is:
0β no strength at all, babes. zero. nada.255β full strength. maxed out. π―
and obvs anything in between is fair game.
here's the example, straight from the source, no notes:
/* Some one time initialisation code. */
COLOR_MAP global_light_table;
create_light_table(&global_trans_table, my_palette,
0, 0, 0, NULL);
...
if (get_color_depth() == 8)
color_map = &global_light_table;
else
set_trans_blender(0, 0, 0, 128);
/* Enemies are in shadow unless lit by torch. */
draw_gouraud_sprite(buffer, menacing_spy, x, y,
light_strength_on_corner_1,
light_strength_on_corner_2,
light_strength_on_corner_3,
light_strength_on_corner_4);
not me crying over menacing_spy in the shadows until a torch finds him π the atmospheric lighting is immaculate, no cap.
π¦ SEE ALSO π¦
and that's the whole page, bestie, you ate it. π«Ά this was Allegro, version 4.4.3, and yes the footer says draw_gouraud_sprite(3) again because she's the main character and she knows it. ππ
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms