Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Drawing in Allegro5

This thread is locked; no one can reply to it. rss feed Print
Drawing in Allegro5
pmprog
Member #11,579
January 2010
avatar

I've been watching Javidx9's videos for a bit, and I really like some of the stuff he shows off.

1. I've been tempted to port his 3D engine across to use within Allegro (when I've finally watched them), though I see there's some 3D transformation functions in Allegro. Is their purpose for 3D perspective transformations, or am I misunderstanding their purpose? and are there any examples of how to use these?

2. In regards to 2D bitmaps, my understanding is they're drawn as two textured triangles, so would it be possible to render a bitmap with a custom set of points so you could get non-square renderings?
Example shown here:
https://youtu.be/8OfgGUGP4Vc?t=835

Thanks

dthompson
Member #5,749
April 2005
avatar

Ha, I've just started watching his channel too. Small world.

Allegro is more than capable of proper 3D these days, though. It depends what level of functionality you need really; al_perspective_transform does just that, and along with some of the slightly higher-level stuff like al_build_camera_transform it's not bad at all.

As for drawing sprites on arbitrary polygons, a good starting point for that is al_draw_prim - you can just pass in an ALLEGRO_BITMAP as the texture.

______________________________________________________
Website. It was freakdesign.bafsoft.net.
This isn't a game!

pmprog
Member #11,579
January 2010
avatar

Thanks for the reply.

Must have overlooked al_draw_prim, but that's great to know, thank you.

Regarding 3D, I'm looking at a simple voxel engine (but, no, not Minecraft-esque).

At the minute, I've just created a bitmap with orthographic view of a cube, with the idea of tint-drawing them to give them colour. But I did like the idea of changing to one of the four orthographic views, and also texturing the different faces - hence the questions on drawing none-square bitmaps.

That said though Javidx9's latest video could pretty much work for me, if I shrink down his tilesize and "layer up".

It still might be worth trying to understand the 3D transform functions anyway, so thank you for the pointers. I'll see if I can figure out how to draw the usual 3D hello world (spinning cube).

Go to: