VOGONS


First post, by vgagame

User metadata
Rank Newbie
Rank
Newbie

I am learning to program in C and I am trying to understand how the actual programming for bit blitting in Allegro 4 works. I don't want to make a game and use the library. Rather I am interested in how allegro bit blitting works. So far, I have learned it uses directX 7. But somehow it does so indirectly. Perhaps through the component object model interface? I've seen the code for bit blitting in Allegro but I am only familiar with mode 13h and using the frame buffer. I have no idea why allegro uses a structure called BITMAP nor why it uses source and destination surfaces. What is going on? Is it using directX 7?

Reply 1 of 4, by megatron-uk

User metadata
Rank l33t
Rank
l33t

As with libSDL Allegro can actually use multiple back end device libraries. DirectX is just one of them.

The bitmap structure you describe is a platform agnostic means of defining a set of pixels in memory, along with bounding boxes and other metadata.

Depending on your platform Allegro may or may not use hardware acceleration for this and other data structures.

My collection database and technical wiki:
https://www.target-earth.net

Reply 2 of 4, by vgagame

User metadata
Rank Newbie
Rank
Newbie

Thank you. No wonder why the code is very different from what I am used to, mode 13h. The design of blit.c inAllegro 4.0 is based on being multi-platform.

Reply 3 of 4, by megatron-uk

User metadata
Rank l33t
Rank
l33t

It's also one of the very few APIs that can take advantage of accelerated drawing in DOS via VBE/AF functions. Depending on the functions exposed by your VBE/AF driver it can do transparent masked blits in hardware, video to video blits, hardware fills, etc.

Of course very few cards ever got a vbe/af driver so it's use is somewhat limited... but it *does* work.

My collection database and technical wiki:
https://www.target-earth.net

Reply 4 of 4, by vgagame

User metadata
Rank Newbie
Rank
Newbie
megatron-uk wrote on 2025-02-15, 23:41:

It's also one of the very few APIs that can take advantage of accelerated drawing in DOS via VBE/AF functions. Depending on the functions exposed by your VBE/AF driver it can do transparent masked blits in hardware, video to video blits, hardware fills, etc.

Of course very few cards ever got a vbe/af driver so it's use is somewhat limited... but it *does* work.

I believe that if I understood how C works I could benefit from books that cover VBE. I found out, from wikipedia, vbe dates back to the early 90s. I have a book by Michael Abrash from 1995 Zen of Graphics Programming but VESA isn't even mentioned in the index under the letter "V". Maybe VBE is in Abrash's Graphics Programming Black Book. But regardless I am on the verge of understanding C, just not there yet. I've been held back for quite sometime because I only know the keywords of C. Not how it works under the hood.

This is where I am at with Allegro: I now know that Allegro is multi-platform and this makes the code more confusing for a novice. More importantly it means that somewhere else, I don't where or how, perhaps indirectly, Allegro accesses DirectX 7. But it also uses OpenGL and since it is multi-platform I could be using it on Linux or FreeBSD. What I am realizing, thanks to help from this forum, is that from the Windows Operating System and DirectX 7 one is locked into using C++. It is because C++ is what is used by developers for Windows Software. To understand DirectX you have to study COM. I searched through many books on COM and all require proficiency in C++. Most books on DirectX require C++. But if I were to go with Linux or FreeBSD and OpenGL I might be able to escape C++. It seems possible. OpenGL doesn't use a multifaceted interface like DirectX does. DirectX needs a lot of different interactions with the Windows OS. OpenGL is a standard that video card manufacturers adhere to and it works primarily with the video hardware itself.