Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

OGLDrv.h File Reference

#include "DCommon.h"
#include "glext.h"

Go to the source code of this file.

Defines

#define COLOR_DEPTH   16
#define ZBUFFER_DEPTH   16
#define USE_LIGHTMAPS
#define USE_LINEAR_INTERPOLATION

Functions

geBoolean DRIVERCC SetFogEnable (geBoolean Enable, float r, float g, float b, float Start, float End)
geBoolean DRIVERCC DrvInit (DRV_DriverHook *Hook)
geBoolean DRIVERCC DrvShutdown (void)
geBoolean DRIVERCC DrvUpdateWindow (void)
geBoolean DRIVERCC DrvSetActive (geBoolean Active)
geBoolean DRIVERCC SetGamma (float Gamma)
geBoolean DRIVERCC GetGamma (float *Gamma)
geBoolean DRIVERCC ScreenShot (const char *Name)
geBoolean DRIVERCC EnumSubDrivers (DRV_ENUM_DRV_CB *Cb, void *Context)
geBoolean DRIVERCC EnumModes (int32 Driver, char *DriverName, DRV_ENUM_MODES_CB *Cb, void *Context)
geBoolean DRIVERCC EnumPixelFormats (DRV_ENUM_PFORMAT_CB *Cb, void *Context)
void SetLastDrvError (int32 Error, char *ErrorStr)

Variables

DRV_Driver OGLDRV
DRV_Window ClientWindow
PFNGLACTIVETEXTUREARBPROC glActiveTextureARB
PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4fARB
GLboolean multitexture
 maxTextureSize


Define Documentation

#define COLOR_DEPTH   16
 

Definition at line 29 of file OGLDrv.h.

Referenced by EnumNativeModes(), SetFullscreen(), and SetGLPixelFormat().

#define USE_LIGHTMAPS
 

Definition at line 32 of file OGLDrv.h.

#define USE_LINEAR_INTERPOLATION
 

Definition at line 33 of file OGLDrv.h.

#define ZBUFFER_DEPTH   16
 

Definition at line 30 of file OGLDrv.h.

Referenced by SetGLPixelFormat().


Function Documentation

geBoolean DRIVERCC DrvInit DRV_DriverHook Hook  ) 
 

Definition at line 51 of file D3ddrv7x.cpp.

References tagRECT::bottom, ClientWindow, D3DMain_InitD3D(), DRIVERCC, DRV_DriverHook::DriverName, FALSE, DRV_Window::Height, DRV_DriverHook::Height, DRV_Window::hWnd, DRV_DriverHook::hWnd, tagRECT::left, tagRECT::right, tagRECT::top, TRUE, DRV_Window::Width, and DRV_DriverHook::Width.

00052 {
00053         RECT    WRect;
00054 
00055         // Start up
00056         if (!D3DMain_InitD3D(Hook->hWnd, Hook->DriverName+5, Hook->Width, Hook->Height))
00057         {
00058                 //SetLastDrvError(DRV_ERROR_INIT_ERROR, "D3D_DrvInit: Could not init driver.\n");
00059                 return FALSE;
00060         }
00061         
00062         // If they are asking for a window mode, use there hWnd for the size
00063         if (Hook->Width ==-1 && Hook->Height == -1)
00064         {
00065                 GetClientRect(Hook->hWnd, &WRect);
00066                 
00067                 Hook->Width = (WRect.right - WRect.left);
00068                 Hook->Height = (WRect.bottom - WRect.top);
00069         }
00070 
00071         ClientWindow.Width = Hook->Width;
00072         ClientWindow.Height = Hook->Height;
00073         ClientWindow.hWnd = Hook->hWnd;
00074 
00075         return TRUE;
00076 }

geBoolean DRIVERCC DrvSetActive geBoolean  Active  ) 
 

Definition at line 186 of file GlideDrv.c.

00187 {
00188         return  GE_TRUE;
00189 }

geBoolean DRIVERCC DrvShutdown void   ) 
 

Definition at line 58 of file GlideDrv.c.

00059 {
00060         GMain_Shutdown();
00061 
00062         return TRUE;
00063 }

geBoolean DRIVERCC DrvUpdateWindow void   ) 
 

Definition at line 182 of file GlideDrv.c.

References DRIVERCC, GE_TRUE, and geBoolean.

00183 {
00184         return  GE_TRUE;
00185 }

geBoolean DRIVERCC EnumModes int32  Driver,
char *  DriverName,
DRV_ENUM_MODES_CB Cb,
void *  Context
 

Definition at line 94 of file GlideDrv.c.

References DRIVERCC, g_BoardInfo, GE_TRUE, geBoolean, and GMain_BoardInfo::MainRam.

00095 {
00096         //if (!GMain_GetBoardInfo(&g_BoardInfo))
00097         //      return GE_TRUE;
00098 
00099         if (g_BoardInfo.MainRam == 0)
00100                 return GE_TRUE;                         // No modes
00101 
00102         if (g_BoardInfo.MainRam >= 1)
00103         {
00104                 if (!Cb(0, "512x384", 512, 384, Context))
00105                         return GE_TRUE;
00106         }
00107 
00108         if (g_BoardInfo.MainRam >= 2)
00109         {
00110                 if (!Cb(1, "640x480", 640, 480, Context))
00111                         return GE_TRUE;
00112         }
00113 
00114         if (g_BoardInfo.MainRam >= 4)
00115         {
00116                 if (!Cb(2, "800x600", 800, 600, Context))
00117                         return GE_TRUE;
00118         }
00119 
00120         if (g_BoardInfo.MainRam > 4)
00121         {
00122                 if (!Cb(3, "1024x768", 1024, 768, Context))
00123                         return GE_TRUE;
00124         }
00125 
00126         return GE_TRUE;
00127 }

geBoolean DRIVERCC EnumPixelFormats DRV_ENUM_PFORMAT_CB Cb,
void *  Context
 

Definition at line 98 of file D3ddrv7x.cpp.

00099 {
00100         int32                   i;
00101         gePixelFormat   Format3d, Format2d;
00102         uint32                  CurrentBpp;
00103 
00104         CurrentBpp = AppInfo.ddsd.ddpfPixelFormat.dwRGBBitCount;
00105 
00106         // Setup the 2d surface format
00107         if (CurrentBpp == 32 && AppInfo.ddSurfFormat.ddpfPixelFormat.dwRGBAlphaBitMask == 0xff000000)
00108                 Format2d = GE_PIXELFORMAT_32BIT_ARGB;
00109         else if (CurrentBpp == 32 && AppInfo.ddSurfFormat.ddpfPixelFormat.dwBBitMask == 0xff)
00110                 Format2d = GE_PIXELFORMAT_32BIT_XRGB;
00111         else if (CurrentBpp == 24 && AppInfo.ddSurfFormat.ddpfPixelFormat.dwBBitMask == 0xff)
00112                 Format2d = GE_PIXELFORMAT_24BIT_RGB;
00113         else if (AppInfo.ddSurfFormat.ddpfPixelFormat.dwGBitMask == (31<<5))
00114                 Format2d = GE_PIXELFORMAT_16BIT_555_RGB;
00115         else
00116                 Format2d = GE_PIXELFORMAT_16BIT_565_RGB;
00117 
00118         // Setup the 3d (Texture) format
00119         if (AppInfo.ddTexFormat.ddpfPixelFormat.dwGBitMask == (31<<5))
00120                 Format3d = GE_PIXELFORMAT_16BIT_555_RGB;
00121         else
00122                 Format3d = GE_PIXELFORMAT_16BIT_565_RGB;
00123 
00124 
00125         // Create the surface formats now
00126         PixelFormat[0].PixelFormat = Format3d;                                                  // 3d 565/555 surface
00127         PixelFormat[0].Flags = RDRIVER_PF_3D | RDRIVER_PF_COMBINE_LIGHTMAP;
00128                 
00129         PixelFormat[1].PixelFormat = GE_PIXELFORMAT_16BIT_4444_ARGB;    // 3d 4444 surface
00130         PixelFormat[1].Flags = RDRIVER_PF_3D | RDRIVER_PF_COMBINE_LIGHTMAP;
00131 
00132         PixelFormat[2].PixelFormat = Format2d;                                                  // 2d 565/555 surface
00133         PixelFormat[2].Flags = RDRIVER_PF_2D | RDRIVER_PF_CAN_DO_COLORKEY;
00134 
00135         PixelFormat[3].PixelFormat = Format3d;                                                  // Lightmap 565/555 surface
00136         PixelFormat[3].Flags = RDRIVER_PF_LIGHTMAP;
00137 
00138         PixelFormat[4].PixelFormat = GE_PIXELFORMAT_16BIT_1555_ARGB;    
00139         PixelFormat[4].Flags = RDRIVER_PF_3D | RDRIVER_PF_COMBINE_LIGHTMAP;
00140 
00141         // Then hand them off to the caller
00142         for (i=0; i<5; i++)
00143         {
00144                 if (!Cb(&PixelFormat[i], Context))
00145                         return GE_TRUE;
00146         }
00147 
00148         return TRUE;
00149 }

geBoolean DRIVERCC EnumSubDrivers DRV_ENUM_DRV_CB Cb,
void *  Context
 

Definition at line 131 of file GlideDrv.c.

00132 {
00133         // Initialize the Glide library 
00134         grGlideInit();
00135 
00136         // Get the info about this board
00137         if (!GMain_GetBoardInfo(&g_BoardInfo))
00138                 return GE_TRUE;
00139 
00140         if (g_BoardInfo.MainRam == 0)
00141                 return GE_TRUE;                         // No modes, so don't return any drivers
00142 
00143         if (!Cb(0, "Glide Driver v"DRV_VMAJS"."DRV_VMINS".", Context))
00144                 return GE_TRUE;
00145 
00146         // Shutdown Glide library
00147         grGlideShutdown();
00148 
00149         return GE_TRUE;
00150 }

geBoolean DRIVERCC GetGamma float *  Gamma  ) 
 

Definition at line 156 of file D3ddrv7x.cpp.

References DRIVERCC, GE_TRUE, and geBoolean.

00157 {
00158         *Gamma = 1.0f;
00159                 
00160         return GE_TRUE;
00161 }

geBoolean DRIVERCC ScreenShot const char *  Name  ) 
 

Definition at line 357 of file OGLDrv.c.

00358 {
00359         unsigned char tgaHeader[18];
00360         GLubyte *buffer;
00361         FILE *fp;
00362         char *newName;
00363         int nameLen;
00364 
00365         buffer = (GLubyte *)malloc(sizeof(GLubyte) * ClientWindow.Width * ClientWindow.Height * 3);     
00366 
00367         glFinish();
00368 
00369         glReadPixels(0, 0, ClientWindow.Width, ClientWindow.Height, 
00370                 GL_BGR_EXT, GL_UNSIGNED_BYTE, buffer);
00371  
00372         memset(tgaHeader, 0, sizeof(tgaHeader));
00373         tgaHeader[2] = 2;
00374         tgaHeader[12] = (unsigned char)ClientWindow.Width;
00375         tgaHeader[13] = (unsigned char)((unsigned long)ClientWindow.Width >> 8);
00376         tgaHeader[14] = (unsigned char)ClientWindow.Height;
00377         tgaHeader[15] = (unsigned char)((unsigned long)ClientWindow.Height >> 8);
00378         tgaHeader[16] = 24;
00379  
00380         // Convert the extention (if one exists) to .tga.  They probably expect a .bmp.
00381         newName = strdup(Name);
00382 
00383         nameLen = strlen(newName);
00384 
00385         if(nameLen > 3)
00386         {
00387                 if(newName[nameLen - 4] == '.')
00388                 {
00389                         strcpy(newName + nameLen - 3, "tga");
00390                 }
00391         }
00392 
00393     fp = fopen(newName, "wb");
00394     
00395         free(newName);
00396 
00397         if(fp == NULL) 
00398         {
00399                 free(buffer);
00400         return GE_FALSE;
00401     }
00402  
00403     fwrite(tgaHeader, 1, 18, fp);
00404     fwrite(buffer, 3, ClientWindow.Width * ClientWindow.Height, fp);
00405     fclose(fp);
00406  
00407         free(buffer);
00408         
00409         return GE_TRUE;
00410 }

geBoolean DRIVERCC SetFogEnable geBoolean  Enable,
float  r,
float  g,
float  b,
float  Start,
float  End
 

Definition at line 116 of file OGLDrv.c.

References DRIVERCC, GE_TRUE, and geBoolean.

Referenced by DrvInit().

00117 {
00118 
00119         return GE_TRUE;
00120 }

geBoolean DRIVERCC SetGamma float  Gamma  ) 
 

Definition at line 151 of file D3ddrv7x.cpp.

References DRIVERCC, GE_TRUE, and geBoolean.

00152 {
00153         return GE_TRUE;
00154 }

void SetLastDrvError int32  Error,
char *  ErrorStr
 

Definition at line 250 of file D3ddrv7x.cpp.

00251 {
00252         LastError = Error;
00253         
00254         if (ErrorStr)
00255         {
00256                 strcpy(LastErrorStr, ErrorStr);
00257         }
00258         else
00259                 LastErrorStr[0] = NULL;
00260 
00261     D3DDRV.LastErrorStr = LastErrorStr;
00262     D3DDRV.LastError = LastError;
00263 }


Variable Documentation

DRV_Window ClientWindow
 

Definition at line 38 of file OGLDrv.h.

PFNGLACTIVETEXTUREARBPROC glActiveTextureARB
 

Definition at line 40 of file OGLDrv.h.

Referenced by DrvInit(), and Render_WorldPolyMultitexture().

PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4fARB
 

Definition at line 41 of file OGLDrv.h.

Referenced by DrvInit(), and Render_WorldPolyMultitexture().

maxTextureSize
 

Definition at line 44 of file OGLDrv.h.

Referenced by DrawDecal(), DrvInit(), THandle_Create(), and THandle_Update().

GLboolean multitexture
 

Definition at line 42 of file OGLDrv.h.

Referenced by DrvInit(), and Render_WorldPoly().

DRV_Driver OGLDRV
 

Definition at line 37 of file OGLDrv.h.

Referenced by BeginScene(), BeginWorld(), DriverHook(), Render_GouraudPoly(), Render_WorldPoly(), and SetLastDrvError().


Generated on Tue Sep 30 12:37:49 2003 for GTestAndEngine by doxygen 1.3.2