egavga.bgi problem

This is a discussion on egavga.bgi problem within the A Brief History of Cprogramming.com forums, part of the Community Boards category; I am running turbo c++ IDE .I am doing some programs in graphics. What i am currently doing is : ...

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    19

    egavga.bgi problem

    I am running turbo c++ IDE .I am doing some programs in graphics.
    What i am currently doing is :
    in ide i copy egavga.bgi to bin folder and give the path as "" in initgraph.
    It is working except the program need the egavag.bgi file in the same directory.
    **Then using bgiobj.exe i converted the egavga.bgi to egavga.obj and registered
    it in graphics.lib using tlib.

    compilation of my graphics.cpp is
    (i included a line "registerbgidriver(EGAVGA_driver);" before initgraph.)

    command line : TCC graphics.cpp graphics.lib egavga.obj
    it worked fine .
    but when i try to do it inside the IDE it is showing error (undefined _EGAVGA_driver).
    What is the error ?

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Are you including graphics.h?

  3. #3
    Registered User
    Join Date
    Sep 2003
    Posts
    19

    yes

    yes i include graphics.h

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    These are the valid constants defined in graphics.h

    Code:
    Syntax #include <graphics.h> void far initgraph(int far *graphdriver, int far *graphmode, char far *pathtodriver); Description initgraph initializes the graphics system by loading a graphics driver from disk (or validating a registered driver), and putting the system into graphics mode. To start the graphics system, first call the initgraph function. initgraph loads the graphics driver and puts the system into graphics mode. You can tell initgraph to use a particular graphics driver and mode, or to autodetect the attached video adapter at run time and pick the corresponding driver. If you tell initgraph to autodetect, it calls detectgraph to select a graphics driver and mode. initgraph also resets all graphics settings to their defaults (current position, palette, color, viewport, and so on) and resets graphresult to 0. Normally, initgraph loads a graphics driver by allocating memory for the driver (through _graphgetmem), then loading the appropriate .BGI file from disk. As an alternative to this dynamic loading scheme, you can link a graphics driver file (or several of them) directly into your executable program file. pathtodriver specifies the directory path where initgraph looks for graphics drivers. initgraph first looks in the path specified in pathtodriver, then (if they are not there) in the current directory. Accordingly, if pathtodriver is null, the driver files (*.BGI) must be in the current directory. This is also the path settextstyle searches for the stroked character font files (*.CHR). *graphdriver is an integer that specifies the graphics driver to be used. You can give it a value using a constant of the graphics_drivers enumeration type, which is defined in graphics.h and listed below. graphics_drivers constant Numeric value DETECT 0 (requests autodetection) CGA 1 MCGA 2 EGA 3 EGA64 4 EGAMONO 5 IBM8514 6 HERCMONO 7 ATT400 8 VGA 9 PC3270 10 *graphmode is an integer that specifies the initial graphics mode (unless *graphdriver equals DETECT, in which case *graphmode is set by initgraph to the highest resolution available for the detected driver). You can give *graphmode a value using a constant of the graphics_modes enumeration type, which is defined in graphics.h and listed below. graphdriver and graphmode must be set to valid values from the following tables, or you will get unpredictable results. The exception is graphdriver = DETECT. Palette listings C0, C1, C2, and C3 refer to the four predefined four-color palettes available on CGA (and compatible) systems. You can select the background color (entry #0) in each of these palettes, but the other colors are fixed. Palette number 0 LIGHTGREEN LIGHTRED YELLOW 1 LIGHTCYAN LIGHTMAGENTA WHITE 2 GREEN RED BROWN 3 CYAN MAGENTA LIGHTGRAY Color assigned to pixel value: 1 2 3 After a call to initgraph, *graphdriver is set to the current graphics driver, and *graphmode is set to the current graphics mode. Graphics graphics_modes Value Column Palette Pages driver mode x Row ---------------------------------------------------------------------- CGA CGAC0 0 320 x 200 C0 1 CGAC1 1 320 x 200 C1 1 CGAC2 2 320 x 200 C2 1 CGAC3 3 320 x 200 C3 1 CGAHI 4 640 x 200 2 color 1 MCGA MCGAC0 0 320 x 200 C0 1 MCGAC1 1 320 x 200 C1 1 MCGAC2 2 320 x 200 C2 1 MCGAC3 3 320 x 200 C3 1 MCGAMED 4 640 x 200 2 color 1 MCGAHI 5 640 x 480 2 color 1 EGA EGALO 0 640 x 200 16 color 4 EGAHI 1 640 x 350 16 color 2 EGA64 EGA64LO 0 640 x 200 16 color 1 EGA64HI 1 640 x 350 4 color 1 EGA-MONO EGAMONOHI 3 640 x 350 2 color 1 * EGAMONOHI 3 640 x 350 2 color 2 ** HERC HERCMONOHI 0 720 x 348 2 color 2 ATT400 ATT400C0 0 320 x 200 C0 1 ATT400C1 1 320 x 200 C1 1 ATT400C2 2 320 x 200 C2 1 ATT400C3 3 320 x 200 C3 1 ATT400MED 4 640 x 200 2 color 1 ATT400HI 5 640 x 400 2 color 1 VGA VGALO 0 640 x 200 16 color 2 VGAMED 1 640 x 350 16 color 2 VGAHI 2 640 x 480 16 color 1 PC3270 PC3270HI 0 720 x 350 2 color 1 IBM8514 IBM8514HI 1 1024 x 768 256 color IBM8514LO 0 640 x 480 256 color * 64K on EGAMONO card ** 256K on EGAMONO card Return Value initgraph always sets the internal error code; on success, it sets the code to 0. If an error occurred, *graphdriver is set to -2, -3, -4, or -5, and graphresult returns the same value as listed below: grNotDetected -2 Cannot detect a graphics card grFileNotFound -3 Cannot find driver file grInvalidDriver -4 Invalid driver grNoLoadMem -5 Insufficient memory to load driver
    Last edited by VirtualAce; 09-22-2003 at 06:18 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 05:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 09:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21