Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BGI Graphics not working on my PC. Why?

Status
Not open for further replies.

Tommy599

Programmer
Feb 6, 2007
5
RO
I have an AMD 850Mhz PC with a PCChips motherboard and a SIS onboard video-card. I've been programming in Borland Pascal 7.0 for a while now, and I recently wanted to try out graphics. I wrote this simple code:

uses graph;

var gd,gm:integer;
path:string;


Begin
gd:=detect;
gm:=0;
path:='d:\pascal\BGI';
initgraph(gd,gm,path);
line(100,100,200,200);
readln;
closegraph;
end.

This should draw a line, but all I am getting after I compile and run is a black screen with the cursor flickering.
I tried this same code on a friend's PC (2200 AMD double core, high-perfomance video card) and it worked fine.

Any help would be appreciated, I have no clue why it isn't working on my PC.
Thanks.
 
I added the line write(graphresult); right after the initgraph call and nothing happens, it doesn't write anything on the screen. The cursor moves forward one position form the top left corner, jumps to the beginning of a new line and that's it.
 
I placed the write(graphresult) after the closegraph and it displayed a 0 on the screen. I also made it write the result in a file while in graph mode and it too showed a 0. What does that mean?
 
Hi

Tommy599 said:
I placed the write(graphresult) after the closegraph and it displayed a 0 on the screen.
TP5.5 help said:
function GraphResult : Integer;

Returns an error code for the last graphics
operation.
So if you called [tt]GraphResult[/tt] after [tt]CloseGraph[/tt], it already held the result code of [tt]CloseGraph[/tt].

The 0 value ( corresponding to the [tt]grOk[/tt] constant ) means no error.

Wired. Try to set an explicit value for [tt]gd[/tt] and [tt]gm[/tt]. For example :
Code:
gd:=[red]VGA[/red];
gm:=[red]VGAHi[/red];

Feherke.
 
Ok, I did that and the same result occurred. I ran it step-by step and watched the values of gd and gm and they were 9 for the gd and 2 for the gm. Are they normal? The same results occured with the previous version of code.
 
Hi

Certainly they are 9 and 2 as we explicitly set them. Those are the values of the [tt]VGA[/tt] and [tt]VGAHi[/tt] constants.

I have no more idea for now. What operating system are you using ?

Feherke.
 
I'm using Windows XP Professional SP1.

Thanks for trying to help, I appreciate it.

I hope I won't have to change my graphics card because of this...
 
(1) Have you yet tried getting graphresult straight after the initgraph and putting it somewhere to read later? It would be a good idea to check that pascal really didn't encounter an error at the initgraph stage.

(2) Have you checked that you've got a copy of EGAVGA.BGI in the right directory? And that it looks the same as your friend's copy, where everything worked?

(3) You could try using a path of '', since if the bgi files are in the normal places, tp can find them itself.

(4) I wouldn't recommend changing your graphics card. EGAVGA uses only standard features of VGA graphics, which are emulated exactly by just about everything nowadays. They are as standard as anything available in the world of IT.

(5) If it helps, I know that EGAVGA graphics for TP6 work fine on winXP professional. Nowadays, however, for retro-hobby programing I just use my own set of graphics routines, mostly written in embedded assembler. They don't exactly mirror the borland ones, so they're not suitable for replacing graphics in existing work, but if you'd like a copy, you're welcome. They're still in TP6, but I'd imagine they'll be fine with little modification.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top