scene_polygon3d(3alleg4)
π scene_polygon3d β putting a polygon in the scene rendering list (Allegro manual, bestie edition)
okay so this is scene_polygon3d(3alleg4) and its sparkly twin scene_polygon3d_f, straight out of the Allegro game programming library. sit down, grab a snack, we're learning scene rendering π
β¨ SYNOPSIS β¨
#include <allegro.h>
int scene_polygon3d(int type, BITMAP *texture, int vc, V3D *vtx[]);
int scene_polygon3d_f(int type, BITMAP *texture, int vc, V3D_f *vtx[]);
πΈ DESCRIPTION πΈ
So basically? It puts a polygon in the rendering list. That's it. That's the whole vibe. Nothing is really rendered at this moment β like, you're just adding it to the queue, bestie, not actually drawing it yet. The glow-up happens later.
You should be calling this between clear_scene() and render_scene(). Those two are your bookends, the main characters, and this function is the little cameo in the middle π
The arguments are the same as for polygon3d(), except the bitmap is missing. Why? Because the one you passed to clear_scene() gets used instead. Reuse, recycle, iconic behavior β¨
Now here's the fun part β unlike polygon3d(), the polygon may be concave or self-intersecting. Yes really, go off. Shapes that penetrate one another may look OK, but ngl they are not really handled by this code, so don't come for me if it gets weird π
β οΈ Real talk: the texture is stored as a pointer only. So you gotta keep the actual bitmap alive and around until render_scene(), because that's where it actually gets used. Let it die early and you're gonna have a bad time π
Since the FLAT style is implemented with the low-level hline() function, the FLAT style is subject to DRAW_MODEs. All these modes are valid β no gatekeeping here. Along with the polygon, this mode will be stored for the rendering moment, and also all the other related variables too: the color_map pointer, the pattern pointer, the anchor, and the blender values. Everything gets remembered for later, like a notes app you never clear π
And lowkey important: the settings of the CPU_MMX and CPU_3DNOW flags of the cpu_capabilities global variable on entry in this routine affect the choice of low-level asm routine that will be used by render_scene() for this polygon. So like, the CPU flags at the moment you call this? They decide which asm routine your polygon gets. That's the lore π₯
π¦ RETURN VALUE π¦
Returns zero on success, or a negative number if it won't be rendered for lack of a rendering routine. Not a vibe, but at least it tells you π
π SEE ALSO π
create_scene(3alleg4)clear_scene(3alleg4)render_scene(3alleg4)destroy_scene(3alleg4)polygon3d(3alleg4)cpu_capabilities(3alleg4)exscn3d(3alleg4)
okay that's the whole page bestie, you ate it π
β¨ this was Allegro version 4.4.3, and yes, scene_polygon3d(3alleg4) β go forth and render, periodt π«Ά
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms