Initializing graphics in C/C++ native compiler
Posted by admin | Posted in C/C++ Programming, computer graphics | Posted on 09-06-2009
Tags: Compiler, computer graphics, Government, graphics, Languages, Linker, Main function, Military, Navy, programming, Ships, United States, Video Graphics Array
1
One of the basic component need in order to initialize graphics in native C/C++ is the graphics.h. After that, you need to check if all the VGA drivers are exist and put it in the right path. Mostly can be found in “tc\bgi” in the C/C++ compiler, and then set the linker so that you can link the graphics.h library in the C/C++ Compiler.
If you already done these following procedure then you are now ready to have your first CG in C/C++. First is to follow these codes in order to initialize you CG (Computer Graphics).
#include <graphics.h>
#include <conio.h>
void main()
{
int gd = VGA, gm = VGAHI;
initgraph(&gd, &gm, “C:\\tc:\\bgi”);
getch();
}
Now, save your file and try to run. You will see black screen in a full screen. That is how are going to initialize you graphics. You can try different functions in order to draw graphics using native C/C++ Compiler.


![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_e.png?x-id=1dc5e93f-a2fa-48d7-abc6-7788a4b7504b)
![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_e.png?x-id=a22f21c2-d423-42a2-83a4-27d433feae9a)



