**DosGL** *2004 (DOS, C & x86 Assembly)* Versions:
v1.1 - 12 December 2004
v1.0 - 10 December 2004 Graphics library for DOS written in C and Assembly (Borland C++ environment). It includes graphic driver based on VESA BIOS Extension (VBE), which allows application to switch graphics card into one of the high resolution modes exposed by VESA 2.0. While regular DOS applications could only display graphics using VGA modes like 320x200 in 256 colors, this driver allowed rendering in resolutions as high as 1024x768 in full 32bpp. Rendering in higher resolutions, means using higher resolution bitmaps, and thus requires much more memory than 1MB exposed in Real Mode. DosGL solves this problem by using extended memory manager (XMM) to store assets in system memory above 1MB. Final DOS limitation to overcome, is fact that graphics card framebuffer in VRAM, is visible to CPU only through 64KB memory region in Real Mode memory. It's called "banked mode", with mentioned region being "window" into cards framebuffer. This mean that to fill whole screen, DosGL driver needs to re-map that window, into different portions of the framebuffer multiple times. For example in 1024x768 @ 32bpp mode, framebuffer size is equal to 3145728 bytes (3 MB). To gradually fill whole frame, it requires switching that mapping exactly 48 times each time frame is presented. Switching of that mapping is costly and thus DosGL have its own framebuffer allocated in XMS memory. This way all the graphics operations happen inside of XMS, and only finally composed image is being blitted part by part from XMS through Real Mode window into actual framebuffer for presentation. Due to above limitations DosGL APIs are limited to blitting rectangular regions (with and without transparency) from assets to framebuffer. Loading assets from BMP files, displaying text using bitmap fonts and mouse driver are provided as well for convenience. This is more than enough to write compelling 2D games. DosGL was successfully used in few projects at the time, not only by me but also by my collegues. I consider it precursor to game engine that I've started developing few years later. Source code, samples and documentation:
[DosGL v1.1](DosGL_final_2.rar) One way to properly overcome all above limitations would be to switch CPU into Protected Mode, and use VESA 3.0. But at that point I got to conclusion that it would be better to write new operating system for 386 from scratch, which would also let me have other missing features like multi-process support and threads.