Why Genesis 3D is portable for Directx and GL

Posted on 2003-03-03
Medium Priority
Last Modified: 2013-12-04
respected men, i started experimenting with Genesis3D in Last january , i soon found that it is very simple and flexible. One thing i don't understand is how they made it portable for DirectX ,OpenGL and Glide at the same time.I mean how  that "drivers" work? Can any body clear it.
Question by:smallbug005
  • 2
  • 2

Expert Comment

ID: 8056656
I haven't used Genesis but I would imagen that they have made an abstract interface and then the interface has to translate the calls to the sublayer that handles DX, GL etc.


Author Comment

ID: 8117546
u re right jo but i ant the answer in more detail
will any body comeup with more details about source code.

Expert Comment

ID: 8221553
the drivers are dll files that are called by the engine. From what I remember, it just changes the dll file name to call based on which driver is selected by the user, but it can also auto-detect which to use.

Accepted Solution

DSole earned 300 total points
ID: 8221624
the drivers available are enumerated in the function

in the system.c file.

it loops through the DriverFileNames Array and adds info abt each one (DriverInfo class) available to an instance of the Sys_DriverInfo object.

this is called in the Sys_EngineCreate() function.

if (!EnumSubDrivers(&NewEngine->DriverInfo, DriverDirectory))
goto ExitWithError;

the drivers are abstracted through a struct called DRV_Driver :

typedef struct
     char                    *Name;
     S32                         VersionMajor;
     S32                         VersionMinor;

     // Error handling hooks set by driver
     S32                         LastError;                                   // Last error driver made
     char                    *LastErrorStr;                              // NULL terminated error string
     // Enum Modes/Drivers
     DRV_ENUM_DRIVER          *EnumSubDrivers;
     DRV_ENUM_MODES          *EnumModes;
     DRV_ENUM_PFORMAT     *EnumPixelFormats;

     // Init/DeInit functions
     DRV_INIT                         *Init;
     DRV_SHUTDOWN                    *Shutdown;
     DRV_RESET                         *Reset;
     DRV_UPDATE_WINDOW               *UpdateWindow;
     DRV_SET_ACTIVE                    *SetActive;
     // Create/Destroy texture functions
     CREATE_TEXTURE          *THandle_Create;
     DESTROY_TEXTURE          *THandle_Destroy;

     // Texture manipulation functions
     LOCK_THANDLE          *THandle_Lock;
     UNLOCK_THANDLE          *THandle_UnLock;

     // Palette access functions
     SET_PALETTE               *THandle_SetPalette;
     GET_PALETTE               *THandle_GetPalette;

     // Palette access functions
     SET_ALPHA               *THandle_SetAlpha;
     GET_ALPHA                 *THandle_GetAlpha;

     THANDLE_GET_INFO     *THandle_GetInfo;

     // Scene management functions
     BEGIN_SCENE               *BeginScene;
     END_SCENE               *EndScene;
     BEGIN_WORLD               *BeginWorld;
     END_WORLD               *EndWorld;
     BEGIN_MESHES          *BeginMeshes;
     END_MESHES               *EndMeshes;
     BEGIN_MODELS          *BeginModels;
     END_MODELS               *EndModels;
     // Render functions
     RENDER_G_POLY          *RenderGouraudPoly;
     RENDER_W_POLY          *RenderWorldPoly;
     RENDER_MT_POLY          *RenderMiscTexturePoly;

     //Decal functions
     DRAW_DECAL               *DrawDecal;

     S32                         NumWorldPixels;
     S32                         NumWorldSpans;
     S32                         NumRenderedPolys;
     DRV_CacheInfo          *CacheInfo;

     SCREEN_SHOT               *ScreenShot;

     SET_GAMMA               *SetGamma;
     GET_GAMMA               *GetGamma;

     DRV_SET_FOG_ENABLE     *SetFogEnable;
     // Driver preferences
     DRV_EngineSettings     *EngineSettings;

     // The engine supplies these for the drivers misc use
     SETUP_LIGHTMAP_CB     *SetupLightmap;

     // Temp hack global
     GInfo                    *GlobalInfo;
} DRV_Driver;

Author Comment

ID: 8277859
Yes Dsole this is the answer i want,but it will be better if you detail the overall working for other viewers in more simple language. Thanks for your efforts

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses
Course of the Month9 days, 7 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question