delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/20/00:26:49

Date: Sat, 20 Jul 1996 12:25:19 +0800 (GMT)
From: Orlando Andico <orly AT gibson DOT eee DOT upd DOT edu DOT ph>
To: Mohan Khurana <mohan AT stealth DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: Graphics w/o GRX
In-Reply-To: <4sou0p$4va@news.stealth.net>
Message-ID: <Pine.SGI.3.93.960720121638.27355A-100000@gibson.eee.upd.edu.ph>
MIME-Version: 1.0

On Sat, 20 Jul 1996, Mohan Khurana wrote:

> Now... I want to try to do some graphics without using GRX, JLIB, BGI,
> and all those other libraries because I'd like to have some experience
> in figuring out how to work with both ASM and C.  I also think that it
> would be better for me to do graphics the hard way because it might
> help me if I ever switch to a UNIX platform, like SGI or SUN.

That won't help, 'cause in general on UNIX platforms, you can't do
graphics straight to the hardware, you gotta do it thru X. The only UNIX
platform I know of that supports graphics console I/O is Linux. If you
wanna program graphics in UNIX, start learning X. That's not the worst
part, some UNIX implementations (like SGI) have X extensions which nobody
else has... :)

<snip>
> Question 1:     Is there any way to get a better graphics mode?  I am
> looking for maybe a list of the different modes and their
> correstponding resolutions.

The list can be found in any documentation of the VESA standard.
As for the ugly DOS font, it's 'cause you didn't restore text mode
afterwards. Try a "mode co80" to restore text mode from DOS, although you
should be doing that from your program.

> Question 2:      Is there any way to change the background to a color?
> I am looking for a way that maybe communicates with the computer
> directly, I would preffer not to use conio.h or dos.h.

Yeah, fill the buffer.. this is complicated by bank-switching shit in many
SVGA cards (unless you prefer mode 0x13 only). Generally it's not such a
wise idea to Reinvent The Wheel really..

> Question 3:      Is there any way to make a colored line?
> 
> Again, I would preffer not to use the PC specific header files, not
> because I hate DOS, just because I'd like to learn more ASM, and get
> into more computer graphics.

To make a colored line, you need to be able to plot a point. Once you're
figured that out, use Bresenham's Line Algorithm. Use Bresenham's Circle
Algorithm to draw circles.

Again, armies have covered this ground before, so Why Reinvent The Wheel?
I must say, the algorithms are completely general, but if your intention
is to do graphics in UNIX later, well the X server handles all that stuff
for you.. dabbling with asm to do it your way means you (a) reinvent the
*square* wheel.. (b) swim in incompatibility. I don't think any of the
UNIX machines (excepting Linux) will let you touch their frame buffers
directly. Not to mention, on SUN alone there are probably two dozen
different video buffers (cg3,cg6,cg12,cg14,tcx0, etc.... ad nauseum) that
you'll be swamped unless you use X.

Not to discourage you, of course..

Cheers,

----
Orlando Andico                           http://gibson.eee.upd.edu.ph/~orly/
orly AT gibson DOT eee DOT upd DOT edu DOT ph                "Who knows what's going to happen,
IRC Lab/EE Dept/UP Diliman     lottery or car crash, or you'll join a cult."


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019