Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

graphics programming

Status
Not open for further replies.

aibelectronics

New Member
i'm quite good with c, but graphics programming is altogether new to me.
I was going through this code when I ran into things like:

error=graphresult();
if(error! = grOk :? ){
printf("Graphics error %s/n", grapherrormsg(error));

etc and other weird stuffs like getch(), itoa() bla, bla, bla.

Does anyone understand what these stuffs mean? I've searched google but didn't find any helpful material . I'll appreciate any help.
Thanks. :D
 
gee that looks so familiar, i just haven't touched it in 15 years :)
i'm not positive but it looks like you are reading older code samples, possibly borland c++. this looks like error checking when setting graphic mode (like when using *.bgi drivers...).
 
yes, it is a turbo c code. The code is the interface software for a pc based oscilloscope i'm currently studying. Quite complicated.
15 YEARS!!!???, wow you've been around for quite some time. :lol:
 
aibelectronics said:
i'm quite good with c, but graphics programming is altogether new to me.
I was going through this code when I ran into things like:

error=graphresult();
if(error! = grOk :? ){
printf("Graphics error %s/n", grapherrormsg(error));

etc and other weird stuffs like getch(), itoa() bla, bla, bla.

Does anyone understand what these stuffs mean? I've searched google but didn't find any helpful material . I'll appreciate any help.
Thanks. :D

What is the include file at the top of the C-file this code came from, that will tell you what libs these GFX are based upon

Basically those lines of code are checks (and error catching) to ensure that the GFX have been setup by the C-code (and accepted by the OS) correctly

getch() = wait for a key input
itoa() is a type conversion int to string I believe
 
Thanks for the info. Now things are getting a bit clearer. what does the grOK expression do? It's the one that confuses me the most.
I'll appreciate any link to graphics programming in c.
:)
 
aibelectronics said:
Thanks for the info. Now things are getting a bit clearer. what does the grOK expression do? It's the one that confuses me the most.
I'll appreciate any link to graphics programming in c.
:)

I would imagine it's simply a constant?, used to check for a "Graphics Error" - graphics OK.

I can't help in C, as I never use it, but DOS based graphics programming is VERY complicated, because of the large number of completely different graphics cards. The idea of the Borland graphics libraries is to give a standard interface across the supported types, and it generally works pretty well.
 
i think that graOK or whatever is just a class reference like:
int hello = 0;
string by = "0";
MyClass foo = 0;
 
Those are just functions from the borland graphics interface.
A crappy and slow set of graphics functions included into all the old borland compilers for dos (pascal & c(++))

https://www.cs.colorado.edu/~main/bgi/doc/

not recommended for writing new programs for dos...
accessing video memory directly is MUCH faster, not difficult and safe enough - all dos games did it, and they ran fine (better then windows?)

The itoa(), getch(),... funtions are part of the standard C libraries.
you should be able to find info on google about those...

@ Nigel: The BGI interface never had any real use, it only supported lower resolutions (320*200*8bit - 640*480*4bit), in these modes all video cards act the same. It's only for higher resolutions that cards act diffirent.
It was a nice interface if you wanted to write something quick and didnt have time to write your own set of routines, but when speed was required BGI falls to its knees ...

@ daniel: grOk is just a value from a enum, not a class reference, thats something completely diffirent..
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top