I need some help with the line algorithm given in the graphics tutorial. Whenever I use it, it doesn't draw the line but instead draws lines in opposite directions from my coordinates.
I am using Turbo C++ V 1.00 in mode 19 (320x200, 256 colors).
I need some help with the line algorithm given in the graphics tutorial. Whenever I use it, it doesn't draw the line but instead draws lines in opposite directions from my coordinates.
I am using Turbo C++ V 1.00 in mode 19 (320x200, 256 colors).
forget mode 19. Use 13h or MCGA.
19 decimal = 13 hex.Originally posted by Xterria
forget mode 19. Use 13h or MCGA.
MSVC++ 6.0
oooooo....i knew that. someday I should learn that hex crap. How does it work anyway?
Dec:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 etc...
Hex:
1 2 3 4 5 6 7 8 9 A B C D E F 10 etc...
Hex is like decimal except when it gets to the 10-15th digits it will substitute a letter, when you get up in the numbers each letter will have a digit in front of it, such as decimal 26 being 1A hexadecimal.
A google search for Hexadecimal conversion charts will show you a more complete sequence.
-Prelude
My best code is written with the delete key.
Well, decimal uses hundreds, tens and units.
Binary uses 4s, 2s and units.
Hex uses 256s, 16s and units.
These numeric systems are called base 10, 2 and 16 respectively. Note that each place holder's value is equal to base ^ it's position (least significant = 0). Each placeholder can hold as many unique digits as nominated by the base (so binary: each place holder can be one of two values, decimal: each placeholder can be one of 10 values, etc). As with decimal, the other systems use the digits to express the magnitude of each placeholder, but as there are only 10 digits we have to substitute letters for the other 6.
Therefore 0x13 = (1 * 16) + (3 * 1) = 19.
0x2a4 = (2 * 256) + (10 * 16) + (4 *1) = 676.
Complex? Sorry, but with this knowledge you can construct a numeric system with ANY base!
Also of note: one hex digit corresponds to four binary digits. This is called a nibble (nibble is half a byte! Geddit?).
Seriously though, you're doing a lot better that I was at 12. At that age I was still programming in qBasic. I wasn't introduced to C until I was 14.
Last edited by samGwilliam; 02-13-2002 at 03:43 PM.
MSVC++ 6.0
>nibble is half a byte! Geddit?
Sadly, I do. I always found that joke both funny and scary at the same time seeing as how it's probably more correct than I'd like to imagine.
-Prelude
My best code is written with the delete key.
Still, though, video modes are always referred to in hex form not decimal.
hmm, where did you get the source for your algorithm? is it brensenhams? can we see your code so we can diagnose it?
http://www.brackeen.com/home/vga/ would help you out for 13h if you are interested.
hasafraggin shizigishin oppashigger...