quote:Original post by Ignacio Liverotti
Original post by Sorensen
I would like to know HOW does the api does to render it correctly on my screen.
It tells the hardware to do it.
But how? Where can I learn those principles?
Continue pursuing X86 assembly language.
If you''re doing things in DOS (which I assume you will be if you''re using Abrash''s book), start with Mode 0x13 which is a linear 8-bit 320x200 mode. Learn about the palette registers and do some stuff with them. None of this stuff will be particularly insightful to you (except perhaps the VGA palette registers, if you haven''t dealt with them before), but it''s a great place to start learning.
Then, if you have the time, it might not be such a bad idea to take a look at 320x240 or 320x200 ModeX (planar.) Nowadays you will only have to worry about linear modes but trying out a planar is an interesting exercise and will teach you how old games worked back in the Stone Age
You''ll learn about how and why the VGA hardware uses planes (hint: 64KB segment limit in real mode) and you''ll get hands-on experience with VGA plane control registers. Just so you know, you don''t have to worry too much about HOW to get into ModeX (learning the functions of all of those registers used to set the mode will be rather pointless), but the rest is interesting stuff. Many consoles (prior to the 3D 32-bit systems) of yesteryear used planar graphics, and it is still an important concept to understand if you ever want to write code for or emulate older console and arcade systems.
I don''t know how Abrash teaches Mode X, as I skipped over that portion of the book, but I learned how to use it by looking at the tutorial included with it. Grab the Tweak package here: http://home.nvg.org/~rsc/programming.html
Anyway, if you get that far and want more, you can either keep working under DOS with VESA Video BIOS Extensions (a standardized set of SVGA BIOS calls for accessing high resolutions and color depths with linear frame buffers using bank switching or true linear frame buffer support in protected mode) or you can go back to Windows.
As to how APIs work for rendering 3D graphics, the best place to learn that would be to look at existing documentation for 3D hardware. This sort of hardware often works by having the CPU send commands to registers (or the card''s RAM) and the specified polygons end up getting drawn in a frame buffer which is displayed on the screen. Some console (PSX, Saturn, possible N64) and arcade (Hard Drivin'' in MAME) hardware is documented and that''s a great place to learn about this stuff since PC cards are fairly similar concept-wise.
There are probably articles and papers out there which deal with this as well (IEEE computer publications will sometimes have articles on this stuff.)
Have fun! You definitely are curious about this stuff and rather than accepting half-baked answers like "the API just _does_" or "it''s not important to know how", it''s a good thing that you are taking steps to educate yourself.
—
Bart