3d - no graphics
3d - no graphics
i was wondering if any one has tried making 3-d boxes out of characters, no graphics, no plotting pixels? sound cool, but worth it? or would it look like a wreck on the screen, if not (if it doesnt look bad on the screen) it sounds like a good challenge to be taken upon.
- NickJohnson
- Member
- Posts: 1249
- Joined: Tue Mar 24, 2009 8:11 pm
- Location: Sunnyvale, California
Re: 3d - no graphics
I think I've seen it done before. You can either use filled in or shaded "characters" sort of like pixels, or do an ASCII-art style thing (which is definitely more complex). I'm not sure how well the ASCII-art kind of thing would work on the PC text console though - nothing matches up correctly, most notably the slashes and backslashes.
Either way, it would be hard to give much of a 3D impression, but you could do some sort of low-res 2D vector graphics. Or just write a VGA driver. Your choice.
Either way, it would be hard to give much of a 3D impression, but you could do some sort of low-res 2D vector graphics. Or just write a VGA driver. Your choice.
Re: 3d - no graphics
i think i would go with 2D, but im not using slashes, i am using boxes (looks better to me).
- NickJohnson
- Member
- Posts: 1249
- Joined: Tue Mar 24, 2009 8:11 pm
- Location: Sunnyvale, California
Re: 3d - no graphics
I mean, it's really just a matter of resolution. If all you're doing is making Tetris, text mode graphics are perfect. But if you want to do something actually graphical, you are probably going to be much happier with VGA mode in the end. It would be sort of interesting to try and make 3D graphics with text mode, but you would get generally crappy pictures of simple objects at best - nothing much beyond proof-of-concept stuff. It's like how you *can* make a car with square wheels, but you're not going to be able to sell it to anyone.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: 3d - no graphics
From the archives of one wretched programmer:
Like this?
Like this?
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: 3d - no graphics
Combuster: It would work loads better in 8x8 mode square "pixels" ftw!
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: 3d - no graphics
This does 8x9 pixels with a 16x9 font. No VGA code, always works
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: 3d - no graphics
Hehe. Although it appears that the top half of the "pixels" are actually a real pixel shorter than the bottom half. In 8x8 it's like 320x200 just blown up. A lot.
Re: 3d - no graphics
You could always use a font set(if you configure it right, you can choose from 512 characters, but only 8 colors) perfected for such a thing, or make one yourself, all it is is a bitmap font.
*pulls out old pmode adapted geezer code from JouleOS(2006)
*pulls out old pmode adapted geezer code from JouleOS(2006)
Code: Select all
void set_plane(unsigned p)
{
unsigned char pmask;
p &= 3;
pmask = 1 << p;
/* set read plane */
outportb(VGA_GC_INDEX, 4);
outportb(VGA_GC_DATA, p);
/* set write plane */
outportb(VGA_SEQ_INDEX, 2);
outportb(VGA_SEQ_DATA, pmask);
}
void write_regs(unsigned char *regs)
{
unsigned i;
/* write MISCELLANEOUS reg */
outportb(VGA_MISC_WRITE, *regs);
regs++;
/* write SEQUENCER regs */
for(i = 0; i < VGA_NUM_SEQ_REGS; i++)
{
outportb(VGA_SEQ_INDEX, i);
outportb(VGA_SEQ_DATA, *regs);
regs++;
}
/* unlock CRTC registers */
outportb(VGA_CRTC_INDEX, 0x03);
outportb(VGA_CRTC_DATA, inportb(VGA_CRTC_DATA) | 0x80);
outportb(VGA_CRTC_INDEX, 0x11);
outportb(VGA_CRTC_DATA, inportb(VGA_CRTC_DATA) & ~0x80);
/* make sure they remain unlocked */
regs[0x03] |= 0x80;
regs[0x11] &= ~0x80;
/* write CRTC regs */
for(i = 0; i < VGA_NUM_CRTC_REGS; i++)
{
outportb(VGA_CRTC_INDEX, i);
outportb(VGA_CRTC_DATA, *regs);
regs++;
}
/* write GRAPHICS CONTROLLER regs */
for(i = 0; i < VGA_NUM_GC_REGS; i++)
{
outportb(VGA_GC_INDEX, i);
outportb(VGA_GC_DATA, *regs);
regs++;
}
/* write ATTRIBUTE CONTROLLER regs */
for(i = 0; i < VGA_NUM_AC_REGS; i++)
{
(void)inportb(VGA_INSTAT_READ);
outportb(VGA_AC_INDEX, i);
outportb(VGA_AC_WRITE, *regs);
regs++;
}
/* lock 16-color palette and unblank display */
(void)inportb(VGA_INSTAT_READ);
outportb(VGA_AC_INDEX, 0x20);
}
static void vmemwr(unsigned dst_off, unsigned char *src, unsigned count)
{
memcpy(dst_off|0xB8000, src, count);
}
void write_font(unsigned char *buf, unsigned font_height) //buf is pointer to our font.
{
unsigned char seq2, seq4, gc4, gc5, gc6;
unsigned i;
/* save registers
set_plane() modifies GC 4 and SEQ 2, so save them as well */
outportb(VGA_SEQ_INDEX, 2);
seq2 = inportb(VGA_SEQ_DATA);
outportb(VGA_SEQ_INDEX, 4);
seq4 = inportb(VGA_SEQ_DATA);
/* turn off even-odd addressing (set flat addressing)
assume: chain-4 addressing already off */
outportb(VGA_SEQ_DATA, seq4 | 0x04);
outportb(VGA_GC_INDEX, 4);
gc4 = inportb(VGA_GC_DATA);
outportb(VGA_GC_INDEX, 5);
gc5 = inportb(VGA_GC_DATA);
/* turn off even-odd addressing */
outportb(VGA_GC_DATA, gc5 & ~0x10);
outportb(VGA_GC_INDEX, 6);
gc6 = inportb(VGA_GC_DATA);
/* turn off even-odd addressing */
outportb(VGA_GC_DATA, gc6 & ~0x02);
/* write font to plane P4 */
set_plane(2);
/* write font 0 */
for(i = 0; i < 256; i++)
{
vmemwr(16384u * 0 + i * 32, buf, font_height);
buf += font_height;
}
#if 0
/* write font 1 */
for(i = 0; i < 256; i++)
{
vmemwr(16384u * 1 + i * 32, buf, font_height);
buf += font_height;
}
#endif
/* restore registers */
outportb(VGA_SEQ_INDEX, 2);
outportb(VGA_SEQ_DATA, seq2);
outportb(VGA_SEQ_INDEX, 4);
outportb(VGA_SEQ_DATA, seq4);
outportb(VGA_GC_INDEX, 4);
outportb(VGA_GC_DATA, gc4);
outportb(VGA_GC_INDEX, 5);
outportb(VGA_GC_DATA, gc5);
outportb(VGA_GC_INDEX, 6);
outportb(VGA_GC_DATA, gc6);
}
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: 3d - no graphics
If you allow something as complex as font reprogramming, you could just as well use graphics mode. Besides, you can only put two pixels in a character cell since that's the amount of color data you can put in the text buffer.
Speaking of which, for the best results, set a 4x8 font with codepage 437 and then use the left-right pair of box-drawing characters. Again, setting mode 13 is easier.
Speaking of which, for the best results, set a 4x8 font with codepage 437 and then use the left-right pair of box-drawing characters. Again, setting mode 13 is easier.
Re: 3d - no graphics
yes thats it, i want to construct a macro that the user can just put in some parameters and make a shape like that and give it an effect to make it at an angle or some kind a 3-d effect, it would ask the user for a color for each side of the shape depending upon how many sides there will be, but at the momen, i havent come up with even making a window with one macro, (i make my windows line by line, but with a macro to make each line)Combuster wrote:Like this?
untill i can create the whole (one macro does it all) effect on a window i will start on this project
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: 3d - no graphics
having a putpixel for any (80x50x3 included) resolution just works
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: 3d - no graphics
You keep mentioning macros... Sometimes function calls might be a better idea than macros (like in the 2 cases mentioned above).GhostXoPCorp wrote:yes thats it, i want to construct a macro that the user can just put in some parameters and make a shape like that and give it an effect to make it at an angle or some kind a 3-d effect, it would ask the user for a color for each side of the shape depending upon how many sides there will be, but at the momen, i havent come up with even making a window with one macro, (i make my windows line by line, but with a macro to make each line)Combuster wrote:Like this?
untill i can create the whole (one macro does it all) effect on a window i will start on this project
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
- gravaera
- Member
- Posts: 737
- Joined: Tue Jun 02, 2009 4:35 pm
- Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.
Re: 3d - no graphics
I understand what you're saying. That may or may not be useful during the absolute earliest stages of development, but if I were you, I'd concentrate on altering the charset od the driver (plane 0, 1, etc) to create a Text User Interface. (Google it)
It's a lot more efficient, and less stressful once you get past the reprogramming part. And you could use it for stylish bootup screens and whatnot, and other UI services that you may need before you initialize GFX mode.
Anyway: wish you luck.
It's a lot more efficient, and less stressful once you get past the reprogramming part. And you could use it for stylish bootup screens and whatnot, and other UI services that you may need before you initialize GFX mode.
Anyway: wish you luck.
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Re: 3d - no graphics
i was going to put macro this, macro that after every thing, i know i used macro to many times, but what else was i going to use, i am an assemby programmer, never was much in to any other language, i figured macro was the proper way to say it.You keep mentioning macros... Sometimes function calls might be a better idea than macros (like in the 2 cases mentioned above).
sorry if that is a little annoying, i thought it was myself.
isnt a function call in assembly
call <function>
a macro is
<function> thats why i use macros, it easier to me to use, less time to type the extra stuff(makes me a little bit lazy)
but what ever works