🔒 Locked
Beginning graphics?
Advertisement
Original Post
Hi, as a beginning programmer (who has currently not moved out of regular dos ansi) I was wondering if there are any beginning graphics site''s/tutorials, for adding VGA graphics into DOS C programs, without use of Windows or a graphics library, just basic stuff so I can learn how they work. Thanks in advance.
Hi BigChris,
Sorry, Dude i dont have any links to Tut... but search for VLA maybe you'll find some...
But here the basic ...
The text memory is located at segment (B800), the video segment is at (A000). So to simply draw something on the screen you need a pointer to that segment. But first of all you must switch to video card to a Video Mode. To do so, use mode 13h. Its the VGA standart mode. (320x200x8bits - 256 colors)
With that you will be able to get a feel from VGA programming...
And it's all come directly from my head so maybe you will need to change some piece of code. But i think it will compile without any problem in BC. But if you use DJGPP, it won't work, sorry a little more complex 'cause DJGPP use Protected-Mode ... So keep that for a latter day.
Happy Coding ...
LowRad
Edited by - LowRad on June 26, 2000 4:08:41 PM
Sorry, Dude i dont have any links to Tut... but search for VLA maybe you'll find some...
But here the basic ...
The text memory is located at segment (B800), the video segment is at (A000). So to simply draw something on the screen you need a pointer to that segment. But first of all you must switch to video card to a Video Mode. To do so, use mode 13h. Its the VGA standart mode. (320x200x8bits - 256 colors)
|
With that you will be able to get a feel from VGA programming...
And it's all come directly from my head so maybe you will need to change some piece of code. But i think it will compile without any problem in BC. But if you use DJGPP, it won't work, sorry a little more complex 'cause DJGPP use Protected-Mode ... So keep that for a latter day.
Happy Coding ...
LowRad
Edited by - LowRad on June 26, 2000 4:08:41 PM
I don''t know how well you know C/C++(even ASM & Pascal) but if you don''t know at least C/C++ then that''s the first think you gotta know before you start... anyways.. here''s some code that would put a pixel at the center of the screen in mode 13h (320x200)
Hopefully you''ve learned something from my ranting... If you need help with anything just ask... before I go
..-=ViKtOr=-..
|
Hopefully you''ve learned something from my ranting... If you need help with anything just ask... before I go
..-=ViKtOr=-..
Thanks for taking the time to answer guys, much appreciated.
Gladiator, I get the idea now from your code, thanks a lot. Only prob, it wouldn't compile in DJGPP, is that a djgpp error? I got:
undefined ref. to main and
Error: collect2: ld returned 1 exit status
It's probably something stupid that I did wrong, but I cant see it
I am pretty new to programming (about a week of learning c from a book) but know most of the basics now, I just wanted to see how I would start in vga mode. Do you know of any good books of beginning graphics?
Thanks again fellas...
Chris
Edited by - BigChris on June 26, 2000 4:39:51 PM
Gladiator, I get the idea now from your code, thanks a lot. Only prob, it wouldn't compile in DJGPP, is that a djgpp error? I got:
undefined ref. to main and
Error: collect2: ld returned 1 exit status
It's probably something stupid that I did wrong, but I cant see it
I am pretty new to programming (about a week of learning c from a book) but know most of the basics now, I just wanted to see how I would start in vga mode. Do you know of any good books of beginning graphics?
Thanks again fellas...
Chris
Edited by - BigChris on June 26, 2000 4:39:51 PM
Chris,
As i told you DJGPP use Protected Mode. It''s a 32bits compiler.
In Real-Mode, the normal mode of operation of DOS. An address is specified by parring a SEGMENT:OFFSET, which Segment is the base adress and the offset is the offset from that segment. (hmmmm... i think an exemple is required) If i do - A000:0010 = 15;
This line will put a White Pixel ''15'' to the 10th pixel on the first row of your screen. A000:320 = 15; will put a White Pixel to the first pixel on the second row.
For the protected-mode interface, like DJGGP, you use a SELECTOR:OFFSET, which is a little different and a lot more difficult to work it. Start in Real-Mode or jump right away to windows!
Just hope its help...
LowRad
As i told you DJGPP use Protected Mode. It''s a 32bits compiler.
In Real-Mode, the normal mode of operation of DOS. An address is specified by parring a SEGMENT:OFFSET, which Segment is the base adress and the offset is the offset from that segment. (hmmmm... i think an exemple is required) If i do - A000:0010 = 15;
This line will put a White Pixel ''15'' to the 10th pixel on the first row of your screen. A000:320 = 15; will put a White Pixel to the first pixel on the second row.
For the protected-mode interface, like DJGGP, you use a SELECTOR:OFFSET, which is a little different and a lot more difficult to work it. Start in Real-Mode or jump right away to windows!
Just hope its help...
LowRad
Here is a DJGPP example off the top of my head..
I'm not exactly sure about the __djgpp.... naming of the functions, but it would be something similar. Search for some tuts on the net... Try www.yahoo.com and www.av.com..
Oh and in order to use the REGS structure you gotta add an additional header file, but i forgot the name... I think it's stdlib.h... not sure... later!
..-=ViKtOr=-..
Edited by - Gladiator on June 26, 2000 4:58:06 PM
|
I'm not exactly sure about the __djgpp.... naming of the functions, but it would be something similar. Search for some tuts on the net... Try www.yahoo.com and www.av.com..
Oh and in order to use the REGS structure you gotta add an additional header file, but i forgot the name... I think it's stdlib.h... not sure... later!
..-=ViKtOr=-..
Edited by - Gladiator on June 26, 2000 4:58:06 PM
Chris,
The Base for Graphics in Windows is GDI, probably you have already see that word. Its slow, and inefficient. From that base microsoft''s programmers have develop MFC which is simply classes using GDI to draw windows, button, messagebox,...
When its come to Game Programming, use DirectX or any other API for Windows... DirectX include Direct3D too...
While you seem to dont known much about programming... Its will not be so hard to start from windows !!
Check for some docs here on GameDev for Win32, DirectX, ...
You will see ...
Happy Coding
LowRad
The Base for Graphics in Windows is GDI, probably you have already see that word. Its slow, and inefficient. From that base microsoft''s programmers have develop MFC which is simply classes using GDI to draw windows, button, messagebox,...
When its come to Game Programming, use DirectX or any other API for Windows... DirectX include Direct3D too...
While you seem to dont known much about programming... Its will not be so hard to start from windows !!
Check for some docs here on GameDev for Win32, DirectX, ...
You will see ...
Happy Coding
LowRad
2Gladiator, you should replace
byte* vga = (byte *)0xA000;
with
byte* vga = (byte *)0xA0000;
just to be sure you''re giving right and working example
and to BigChris, i suggest you to examine examples from djgpp or even get an Allegro library if for some reason you''ll stay with dos
and btw, what ubb tags you guys using to place code into that kind of white box?
Regards,
FlyFire/CodeX
http://www.codex.nm.ru
byte* vga = (byte *)0xA000;
with
byte* vga = (byte *)0xA0000;
just to be sure you''re giving right and working example
and to BigChris, i suggest you to examine examples from djgpp or even get an Allegro library if for some reason you''ll stay with dos
and btw, what ubb tags you guys using to place code into that kind of white box?
Regards,
FlyFire/CodeX
http://www.codex.nm.ru
Buy a book!
for $50 you can get LaMothe''s lastest & greatest treatise on Dx called "Tricks of the Windows Game Programming Gurus" A demo version of MS VC++ 6 comes on the second of the two CD''s that come with it
If you have never written a windows or directX program before it''ll get you started
for $50 you can get LaMothe''s lastest & greatest treatise on Dx called "Tricks of the Windows Game Programming Gurus" A demo version of MS VC++ 6 comes on the second of the two CD''s that come with it
If you have never written a windows or directX program before it''ll get you started
quote:
Actually, i'm not talking about assembly so much as I'm talking about direct writes to video memory, and calling video bios functions directly
Really? I thought for a second that you didn't know what you're talking about... ASM is still useful, and it will always be. So stop ranting and... I dunno... go take cold shower...
FlyFire, thanks for fixing that mistake... I forgot to change that...
btw, you mean to tell me that I got the correct function names (__djgpp_xxx ones
..-=ViKtOr=-..
Edited by - Gladiator on July 5, 2000 12:39:42 PM
BigChris,
Freshen up on linear algebra and matrices, and then head on over to The OpenGL Homepage!
Its a very cool API for 3D graphics and I think is great for begginers as long as you know C (and a little math
).
Edited by - Zipster on July 6, 2000 5:26:01 AM
Freshen up on linear algebra and matrices, and then head on over to The OpenGL Homepage!
Its a very cool API for 3D graphics and I think is great for begginers as long as you know C (and a little math
Edited by - Zipster on July 6, 2000 5:26:01 AM
BigChris,
I think I know what you mean. If you want to stick to a DOS environment and get the hang of C and a basic graphics library, and easy and quick way is to get a copy of Turbo C v1.5 or v2.0 for DOS. It comes with a couple examples. There are other compiler options out there, but you can pick up Turbo C for free at the Borland/Inprise "museum".
Just go to http://community.borland.com/museum/
// CHRIS
I think I know what you mean. If you want to stick to a DOS environment and get the hang of C and a basic graphics library, and easy and quick way is to get a copy of Turbo C v1.5 or v2.0 for DOS. It comes with a couple examples. There are other compiler options out there, but you can pick up Turbo C for free at the Borland/Inprise "museum".
Just go to http://community.borland.com/museum/
// CHRIS
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement