View Full Version : CG without an API?
I was looking through some introductory textbooks on computer graphics and noticed that they all rely on some type of graphics library (PHIGS, OpenGL, etc.) to draw pixels. They discuss algorithms for line/curve drawing, but those rely on some simple pixel drawing function in some API.
My question is how can one do CG without using a library such as OpenGL?
For example, how does a PC's BIOS display it's stuff on the screen when you boot your PC? It doesn't seem to need an OS or a graphics library.
10-03-2001, 01:47 PM
Actually, in a PC, the BIOS does have an API it can use. The rudimentary API in the video card's BIOS.
this is true. But you can also get around APIs to a certain extent, if you know about the underling hardware. Anyone who's done graphics in MeSsyDOS would have done;
MOV AX, 0x13
or something like that. Actually, I can't really remember the numbers... its been that long ago =) This is still arguably an API, tho', since the interrupt is still the interface for the application. You can set pixels by writing to video ram once you've set up the graphics mode:
unsigned char *v=(unsigned char *)0xA0000000;
memset(v, 0, 320*200);
will clear the screen to black.
Is your question just out of idle curiosity, or is there some underlying idea you need to know? APIs are everywhere; they're there to make the programmer's life easier (in the same way that a CLI or a GUI is there to make a user's life easier). You can't really avoid them, and you SHOULDN'T avoid them unless you really know what you're doing and don't care for such a minor issue as portability.
10-03-2001, 06:06 PM
Ya, brings back memories of programming the bare metal for my sprite library for my Tandy Color Computer. I'd love to get my hands on a modern console or heck even the register specs of my TNT would be cool to have so I could make a simple game os and boot into a game like in the early days of PC's. I used to routinely boot into Dig-Dug http://www.opengl.org/discussion_boards/ubb/tongue.gif
10-08-2001, 12:17 PM
If you want to get the flavour of graphics the old way, I recommend "The C Graphics Handbook" by Roger T Stevens, Academic Press, 1992 (ISBN:0-12-668320-4). You might find it in the library (my copy came with a 5.25" diskette).
A quick look through it's pages will help you to appreciate the folks at SGI for giving us OpenGL.
Just for software rendering sake, get these two demos from the demoscene, they still use PLAIN SOFTWARE rendering (ie. no api like OGL or DX)
SPOT by Exceed : software rendering the polygonal way (DEMO) http://ural2.hszk.bme.hu/~s7623kov/exd-spot.zip
Heaven 7 : software rendering the realtime raytracing way (INTRO) http://www.inf.bme.hu/~exceed/h7-final.zip
I prefer the second one... damn fast on every gfx card (simple, tey just don't use any gfx card feature!)
And if you have an OLD dos box try also www.spinningkids.org (http://www.spinningkids.org) for some more realtime raytracing fashion.
10-09-2001, 11:31 AM
If you really want to draw something without an api (even without the video bios) you have to write to the framebuffer directly (although you have to set the display mode with the video bios before that), but modern operating systems don't allow direct access to either the video bios or the video memory.
So you are left with two solutions:
1) write a dos program
2) write your own os
PS: The two solutions are not as different as you may expect.
10-09-2001, 06:07 PM
You can write directly to the frame buffer, even in w2k. I've done it with debug tools that that let you peek and poke values to memory and it would be easy enough to write your own code to do it. All you need is the register specs for you video card.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.