mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-27 01:26:30 +00:00
Changed: #1275 Create an OpenGL ES driver
This commit is contained in:
parent
2c27caef09
commit
db208efe92
6 changed files with 125 additions and 80 deletions
|
@ -123,7 +123,7 @@ public:
|
||||||
|
|
||||||
/// \name Object
|
/// \name Object
|
||||||
// @{
|
// @{
|
||||||
CDriverUser (uint windowIcon = 0, bool direct3d = false, emptyProc exitFunc = 0);
|
CDriverUser (uint windowIcon, UDriver::TDriver driver, emptyProc exitFunc = 0);
|
||||||
virtual ~CDriverUser();
|
virtual ~CDriverUser();
|
||||||
// @}
|
// @}
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,11 @@
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NL3D_GL_DLL_NAME "nel_drv_opengl_win"
|
# define NL3D_GL_DLL_NAME "nel_drv_opengl_win"
|
||||||
|
# define NL3D_GLES_DLL_NAME "nel_drv_opengles_win"
|
||||||
# define NL3D_D3D_DLL_NAME "nel_drv_direct3d_win"
|
# define NL3D_D3D_DLL_NAME "nel_drv_direct3d_win"
|
||||||
#elif defined (NL_OS_UNIX)
|
#elif defined (NL_OS_UNIX)
|
||||||
# define NL3D_GL_DLL_NAME "nel_drv_opengl"
|
# define NL3D_GL_DLL_NAME "nel_drv_opengl"
|
||||||
|
# define NL3D_GLES_DLL_NAME "nel_drv_opengles"
|
||||||
#else
|
#else
|
||||||
# error "Unknown system"
|
# error "Unknown system"
|
||||||
#endif
|
#endif
|
||||||
|
@ -43,6 +45,7 @@ struct EDru : public NLMISC::Exception
|
||||||
EDru(const std::string &reason) : Exception(reason) {}
|
EDru(const std::string &reason) : Exception(reason) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// OpenGL
|
||||||
struct EDruOpenglDriverNotFound : public EDru
|
struct EDruOpenglDriverNotFound : public EDru
|
||||||
{
|
{
|
||||||
EDruOpenglDriverNotFound() : EDru( NL3D_GL_DLL_NAME " not found" ) {}
|
EDruOpenglDriverNotFound() : EDru( NL3D_GL_DLL_NAME " not found" ) {}
|
||||||
|
@ -68,7 +71,34 @@ struct EDruOpenglDriverCantCreateDriver : public EDru
|
||||||
EDruOpenglDriverCantCreateDriver() : EDru( NL3D_GL_DLL_NAME " can't create driver" ) {}
|
EDruOpenglDriverCantCreateDriver() : EDru( NL3D_GL_DLL_NAME " can't create driver" ) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// OpenGL ES
|
||||||
|
struct EDruOpenglEsDriverNotFound : public EDru
|
||||||
|
{
|
||||||
|
EDruOpenglEsDriverNotFound() : EDru( NL3D_GLES_DLL_NAME " not found" ) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct EDruOpenglEsDriverCorrupted : public EDru
|
||||||
|
{
|
||||||
|
EDruOpenglEsDriverCorrupted() : EDru( "Can't get NL3D_createIDriverInstance from " NL3D_GLES_DLL_NAME " (Bad dll?)" ) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct EDruOpenglEsDriverOldVersion : public EDru
|
||||||
|
{
|
||||||
|
EDruOpenglEsDriverOldVersion() : EDru( NL3D_GLES_DLL_NAME " is a too old version. Ask for a more recent file" ) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct EDruOpenglEsDriverUnknownVersion : public EDru
|
||||||
|
{
|
||||||
|
EDruOpenglEsDriverUnknownVersion() : EDru( NL3D_GLES_DLL_NAME " is more recent than the application" ) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct EDruOpenglEsDriverCantCreateDriver : public EDru
|
||||||
|
{
|
||||||
|
EDruOpenglEsDriverCantCreateDriver() : EDru( NL3D_GLES_DLL_NAME " can't create driver" ) {}
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
// Direct3D
|
||||||
struct EDruDirect3dDriverNotFound : public EDru
|
struct EDruDirect3dDriverNotFound : public EDru
|
||||||
{
|
{
|
||||||
EDruDirect3dDriverNotFound() : EDru( NL3D_D3D_DLL_NAME " not found" ) {}
|
EDruDirect3dDriverNotFound() : EDru( NL3D_D3D_DLL_NAME " not found" ) {}
|
||||||
|
@ -103,6 +133,9 @@ public:
|
||||||
/// Portable Function which create a GL Driver (using gl dll...).
|
/// Portable Function which create a GL Driver (using gl dll...).
|
||||||
static IDriver *createGlDriver() throw(EDru);
|
static IDriver *createGlDriver() throw(EDru);
|
||||||
|
|
||||||
|
/// Portable Function which create a GL ES Driver (using gl dll...).
|
||||||
|
static IDriver *createGlEsDriver() throw(EDru);
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
/// Windows Function which create a Direct3d Driver.
|
/// Windows Function which create a Direct3d Driver.
|
||||||
static IDriver *createD3DDriver() throw(EDru);
|
static IDriver *createD3DDriver() throw(EDru);
|
||||||
|
|
|
@ -139,6 +139,9 @@ public:
|
||||||
enum TStencilOp { keep = 0, zero, replace, incr, decr, invert };
|
enum TStencilOp { keep = 0, zero, replace, incr, decr, invert };
|
||||||
enum TStencilFunc { never = 0, less, lessequal, equal, notequal, greaterequal, greater, always};
|
enum TStencilFunc { never = 0, less, lessequal, equal, notequal, greaterequal, greater, always};
|
||||||
|
|
||||||
|
// Existing drivers
|
||||||
|
enum TDriver { Direct3d = 0, OpenGl, OpenGlEs };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// The EventServer of this driver. Init after setDisplay()!!
|
/// The EventServer of this driver. Init after setDisplay()!!
|
||||||
NLMISC::CEventServer EventServer;
|
NLMISC::CEventServer EventServer;
|
||||||
|
@ -844,6 +847,7 @@ public:
|
||||||
* This is the static function which build a UDriver, the root for all 3D functions.
|
* This is the static function which build a UDriver, the root for all 3D functions.
|
||||||
*/
|
*/
|
||||||
static UDriver *createDriver(uint windowIcon = 0, bool direct3d = false, emptyProc exitFunc = 0);
|
static UDriver *createDriver(uint windowIcon = 0, bool direct3d = false, emptyProc exitFunc = 0);
|
||||||
|
static UDriver *createDriver(uint windowIcon, TDriver driver, emptyProc exitFunc = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Purge static memory
|
* Purge static memory
|
||||||
|
|
|
@ -90,21 +90,28 @@ const uint32 CDriverGL::ReleaseVersion = 0x11;
|
||||||
// Number of register to allocate for the EXTVertexShader extension
|
// Number of register to allocate for the EXTVertexShader extension
|
||||||
const uint CDriverGL::_EVSNumConstant = 97;
|
const uint CDriverGL::_EVSNumConstant = 97;
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
|
||||||
|
|
||||||
#ifdef NL_STATIC
|
#ifdef NL_STATIC
|
||||||
|
|
||||||
# pragma comment(lib, "opengl32")
|
#ifdef USE_OPENGLES
|
||||||
# pragma comment(lib, "dinput8")
|
|
||||||
# pragma comment(lib, "dxguid")
|
IDriver* createGlEsDriverInstance ()
|
||||||
|
{
|
||||||
|
return new CDriverGL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
IDriver* createGlDriverInstance ()
|
IDriver* createGlDriverInstance ()
|
||||||
{
|
{
|
||||||
return new CDriverGL;
|
return new CDriverGL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#ifdef NL_OS_WINDOWS
|
||||||
|
|
||||||
__declspec(dllexport) IDriver* NL3D_createIDriverInstance ()
|
__declspec(dllexport) IDriver* NL3D_createIDriverInstance ()
|
||||||
{
|
{
|
||||||
return new CDriverGL;
|
return new CDriverGL;
|
||||||
|
@ -115,19 +122,8 @@ __declspec(dllexport) uint32 NL3D_interfaceVersion ()
|
||||||
return IDriver::InterfaceVersion;
|
return IDriver::InterfaceVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined (NL_OS_UNIX)
|
#elif defined (NL_OS_UNIX)
|
||||||
|
|
||||||
#ifdef NL_STATIC
|
|
||||||
|
|
||||||
IDriver* createGlDriverInstance ()
|
|
||||||
{
|
|
||||||
return new CDriverGL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
IDriver* NL3D_createIDriverInstance ()
|
IDriver* NL3D_createIDriverInstance ()
|
||||||
|
@ -141,9 +137,9 @@ extern "C"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
#endif // NL_OS_UNIX
|
#endif // NL_STATIC
|
||||||
|
|
||||||
GLenum CDriverGL::NLCubeFaceToGLCubeFace[6] =
|
GLenum CDriverGL::NLCubeFaceToGLCubeFace[6] =
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,25 +69,29 @@ UDriver::~UDriver()
|
||||||
purgeMemory();
|
purgeMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void UDriver::setMatrixMode2D11()
|
void UDriver::setMatrixMode2D11()
|
||||||
{
|
{
|
||||||
setMatrixMode2D(CFrustum(0.0f,1.0f,0.0f,1.0f,-1.0f,1.0f,false));
|
setMatrixMode2D(CFrustum(0.0f,1.0f,0.0f,1.0f,-1.0f,1.0f,false));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void UDriver::setMatrixMode2D43()
|
void UDriver::setMatrixMode2D43()
|
||||||
{
|
{
|
||||||
setMatrixMode2D(CFrustum(0.0f,4.0f/3.0f,0.0f,1.0f,-1.0f,1.0f,false));
|
setMatrixMode2D(CFrustum(0.0f,4.0f/3.0f,0.0f,1.0f,-1.0f,1.0f,false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
UDriver *UDriver::createDriver(uint windowIcon, bool direct3d, emptyProc exitFunc)
|
UDriver *UDriver::createDriver(uint windowIcon, bool direct3d, emptyProc exitFunc)
|
||||||
{
|
{
|
||||||
return new CDriverUser (windowIcon, direct3d, exitFunc);
|
return new CDriverUser (windowIcon, direct3d ? CDriverUser::Direct3d:CDriverUser::OpenGl, exitFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
UDriver *UDriver::createDriver(uint windowIcon, TDriver driver, emptyProc exitFunc)
|
||||||
|
{
|
||||||
|
return new CDriverUser (windowIcon, (CDriverUser::TDriver)driver, exitFunc);
|
||||||
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void UDriver::purgeMemory()
|
void UDriver::purgeMemory()
|
||||||
|
@ -110,9 +114,8 @@ bool CDriverUser::_StaticInit= false;
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
CDriverUser::CDriverUser (uint windowIcon, bool direct3d, emptyProc exitFunc)
|
CDriverUser::CDriverUser (uint windowIcon, TDriver driver, emptyProc exitFunc)
|
||||||
{
|
{
|
||||||
|
|
||||||
// The enum of IDriver and UDriver MUST be the same!!!
|
// The enum of IDriver and UDriver MUST be the same!!!
|
||||||
nlassert((uint)IDriver::idCount == (uint)UDriver::idCount);
|
nlassert((uint)IDriver::idCount == (uint)UDriver::idCount);
|
||||||
nlassert((uint)IDriver::typeCount == (uint)UDriver::typeCount);
|
nlassert((uint)IDriver::typeCount == (uint)UDriver::typeCount);
|
||||||
|
@ -134,13 +137,16 @@ CDriverUser::CDriverUser (uint windowIcon, bool direct3d, emptyProc exitFunc)
|
||||||
|
|
||||||
// Create/Init Driver.
|
// Create/Init Driver.
|
||||||
#if defined(NL_OS_WINDOWS)
|
#if defined(NL_OS_WINDOWS)
|
||||||
if (direct3d)
|
if (driver == Direct3d)
|
||||||
_Driver= CDRU::createD3DDriver();
|
_Driver= CDRU::createD3DDriver();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!_Driver)
|
if (!_Driver && driver == OpenGl)
|
||||||
_Driver= CDRU::createGlDriver();
|
_Driver= CDRU::createGlDriver();
|
||||||
|
|
||||||
|
if (!_Driver && driver == OpenGlEs)
|
||||||
|
_Driver= CDRU::createGlEsDriver();
|
||||||
|
|
||||||
nlassert(_Driver);
|
nlassert(_Driver);
|
||||||
_Driver->init (windowIcon, exitFunc);
|
_Driver->init (windowIcon, exitFunc);
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,10 @@ extern IDriver* createGlDriverInstance ();
|
||||||
extern IDriver* createD3DDriverInstance ();
|
extern IDriver* createD3DDriverInstance ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NL_OPENGLES_AVAILABLE
|
||||||
|
extern IDriver* createGlEsDriverInstance ();
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
@ -82,36 +86,25 @@ IDriver *CDRU::createGlDriver() throw (EDru)
|
||||||
IDRV_CREATE_PROC createDriver = NULL;
|
IDRV_CREATE_PROC createDriver = NULL;
|
||||||
IDRV_VERSION_PROC versionDriver = NULL;
|
IDRV_VERSION_PROC versionDriver = NULL;
|
||||||
|
|
||||||
//#ifdef NL_OS_WINDOWS
|
|
||||||
|
|
||||||
// WINDOWS code.
|
|
||||||
// HINSTANCE hInst;
|
|
||||||
|
|
||||||
// hInst=LoadLibrary(NL3D_GL_DLL_NAME);
|
|
||||||
CLibrary driverLib;
|
CLibrary driverLib;
|
||||||
|
|
||||||
#if defined(NL_OS_UNIX) && defined(NL_DRIVER_PREFIX)
|
#if defined(NL_OS_UNIX) && defined(NL_DRIVER_PREFIX)
|
||||||
driverLib.addLibPath(NL_DRIVER_PREFIX);
|
driverLib.addLibPath(NL_DRIVER_PREFIX);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// if (!hInst)
|
|
||||||
if (!driverLib.loadLibrary(NL3D_GL_DLL_NAME, true, true, false))
|
if (!driverLib.loadLibrary(NL3D_GL_DLL_NAME, true, true, false))
|
||||||
{
|
{
|
||||||
throw EDruOpenglDriverNotFound();
|
throw EDruOpenglDriverNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
// char buffer[1024], *ptr;
|
|
||||||
// SearchPath (NULL, NL3D_GL_DLL_NAME, NULL, 1023, buffer, &ptr);
|
|
||||||
nlinfo ("Using the library '"NL3D_GL_DLL_NAME"' that is in the directory: '%s'", driverLib.getLibFileName().c_str());
|
nlinfo ("Using the library '"NL3D_GL_DLL_NAME"' that is in the directory: '%s'", driverLib.getLibFileName().c_str());
|
||||||
|
|
||||||
// createDriver = (IDRV_CREATE_PROC) GetProcAddress (hInst, IDRV_CREATE_PROC_NAME);
|
|
||||||
createDriver = (IDRV_CREATE_PROC) driverLib.getSymbolAddress(IDRV_CREATE_PROC_NAME);
|
createDriver = (IDRV_CREATE_PROC) driverLib.getSymbolAddress(IDRV_CREATE_PROC_NAME);
|
||||||
if (createDriver == NULL)
|
if (createDriver == NULL)
|
||||||
{
|
{
|
||||||
throw EDruOpenglDriverCorrupted();
|
throw EDruOpenglDriverCorrupted();
|
||||||
}
|
}
|
||||||
|
|
||||||
// versionDriver = (IDRV_VERSION_PROC) GetProcAddress (hInst, IDRV_VERSION_PROC_NAME);
|
|
||||||
versionDriver = (IDRV_VERSION_PROC) driverLib.getSymbolAddress(IDRV_VERSION_PROC_NAME);
|
versionDriver = (IDRV_VERSION_PROC) driverLib.getSymbolAddress(IDRV_VERSION_PROC_NAME);
|
||||||
if (versionDriver != NULL)
|
if (versionDriver != NULL)
|
||||||
{
|
{
|
||||||
|
@ -121,44 +114,67 @@ IDriver *CDRU::createGlDriver() throw (EDru)
|
||||||
throw EDruOpenglDriverUnknownVersion();
|
throw EDruOpenglDriverUnknownVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
//#elif defined (NL_OS_UNIX)
|
|
||||||
//
|
|
||||||
// void *handle = dlopen(NL3D_GL_DLL_NAME, RTLD_NOW);
|
|
||||||
//
|
|
||||||
// if (handle == NULL)
|
|
||||||
// {
|
|
||||||
// nlwarning ("when loading dynamic library '%s': %s", NL3D_GL_DLL_NAME, dlerror());
|
|
||||||
// throw EDruOpenglDriverNotFound();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /* Not ANSI. Might produce a warning */
|
|
||||||
// createDriver = (IDRV_CREATE_PROC) dlsym (handle, IDRV_CREATE_PROC_NAME);
|
|
||||||
// if (createDriver == NULL)
|
|
||||||
// {
|
|
||||||
// nlwarning ("when getting function in dynamic library '%s': %s", NL3D_GL_DLL_NAME, dlerror());
|
|
||||||
// throw EDruOpenglDriverCorrupted();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// versionDriver = (IDRV_VERSION_PROC) dlsym (handle, IDRV_VERSION_PROC_NAME);
|
|
||||||
// if (versionDriver != NULL)
|
|
||||||
// {
|
|
||||||
// if (versionDriver()<IDriver::InterfaceVersion)
|
|
||||||
// throw EDruOpenglDriverOldVersion();
|
|
||||||
// else if (versionDriver()>IDriver::InterfaceVersion)
|
|
||||||
// throw EDruOpenglDriverUnknownVersion();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//#else // NL_OS_UNIX
|
|
||||||
//#error "Dynamic DLL loading not implemented!"
|
|
||||||
//#endif // NL_OS_UNIX
|
|
||||||
|
|
||||||
IDriver *ret= createDriver();
|
IDriver *ret= createDriver();
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
{
|
||||||
throw EDruOpenglDriverCantCreateDriver();
|
throw EDruOpenglDriverCantCreateDriver();
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
IDriver *CDRU::createGlEsDriver() throw (EDru)
|
||||||
|
{
|
||||||
|
#ifdef NL_STATIC
|
||||||
|
|
||||||
|
#ifdef NL_OPENGLES_AVAILABLE
|
||||||
|
return createGlEsDriverInstance ();
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif // NL_OPENGLES_AVAILABLE
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
IDRV_CREATE_PROC createDriver = NULL;
|
||||||
|
IDRV_VERSION_PROC versionDriver = NULL;
|
||||||
|
|
||||||
|
CLibrary driverLib;
|
||||||
|
|
||||||
|
#if defined(NL_OS_UNIX) && defined(NL_DRIVER_PREFIX)
|
||||||
|
driverLib.addLibPath(NL_DRIVER_PREFIX);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!driverLib.loadLibrary(NL3D_GLES_DLL_NAME, true, true, false))
|
||||||
|
{
|
||||||
|
throw EDruOpenglEsDriverNotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
nlinfo ("Using the library '"NL3D_GLES_DLL_NAME"' that is in the directory: '%s'", driverLib.getLibFileName().c_str());
|
||||||
|
|
||||||
|
createDriver = (IDRV_CREATE_PROC) driverLib.getSymbolAddress(IDRV_CREATE_PROC_NAME);
|
||||||
|
if (createDriver == NULL)
|
||||||
|
{
|
||||||
|
throw EDruOpenglDriverCorrupted();
|
||||||
|
}
|
||||||
|
|
||||||
|
versionDriver = (IDRV_VERSION_PROC) driverLib.getSymbolAddress(IDRV_VERSION_PROC_NAME);
|
||||||
|
if (versionDriver != NULL)
|
||||||
|
{
|
||||||
|
if (versionDriver()<IDriver::InterfaceVersion)
|
||||||
|
throw EDruOpenglDriverOldVersion();
|
||||||
|
else if (versionDriver()>IDriver::InterfaceVersion)
|
||||||
|
throw EDruOpenglDriverUnknownVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
IDriver *ret= createDriver();
|
||||||
|
if (ret == NULL)
|
||||||
|
{
|
||||||
|
throw EDruOpenglEsDriverCantCreateDriver();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,31 +197,21 @@ IDriver *CDRU::createD3DDriver() throw (EDru)
|
||||||
IDRV_CREATE_PROC createDriver = NULL;
|
IDRV_CREATE_PROC createDriver = NULL;
|
||||||
IDRV_VERSION_PROC versionDriver = NULL;
|
IDRV_VERSION_PROC versionDriver = NULL;
|
||||||
|
|
||||||
// WINDOWS code.
|
|
||||||
// HINSTANCE hInst;
|
|
||||||
|
|
||||||
// hInst=LoadLibrary(NL3D_D3D_DLL_NAME);
|
|
||||||
|
|
||||||
CLibrary driverLib;
|
CLibrary driverLib;
|
||||||
|
|
||||||
// if (!hInst)
|
|
||||||
if (!driverLib.loadLibrary(NL3D_D3D_DLL_NAME, true, true, false))
|
if (!driverLib.loadLibrary(NL3D_D3D_DLL_NAME, true, true, false))
|
||||||
{
|
{
|
||||||
throw EDruDirect3dDriverNotFound();
|
throw EDruDirect3dDriverNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
// char buffer[1024], *ptr;
|
|
||||||
// SearchPath (NULL, NL3D_D3D_DLL_NAME, NULL, 1023, buffer, &ptr);
|
|
||||||
nlinfo ("Using the library '"NL3D_D3D_DLL_NAME"' that is in the directory: '%s'", driverLib.getLibFileName().c_str());
|
nlinfo ("Using the library '"NL3D_D3D_DLL_NAME"' that is in the directory: '%s'", driverLib.getLibFileName().c_str());
|
||||||
|
|
||||||
// createDriver = (IDRV_CREATE_PROC) GetProcAddress (hInst, IDRV_CREATE_PROC_NAME);
|
|
||||||
createDriver = (IDRV_CREATE_PROC) driverLib.getSymbolAddress(IDRV_CREATE_PROC_NAME);
|
createDriver = (IDRV_CREATE_PROC) driverLib.getSymbolAddress(IDRV_CREATE_PROC_NAME);
|
||||||
if (createDriver == NULL)
|
if (createDriver == NULL)
|
||||||
{
|
{
|
||||||
throw EDruDirect3dDriverCorrupted();
|
throw EDruDirect3dDriverCorrupted();
|
||||||
}
|
}
|
||||||
|
|
||||||
// versionDriver = (IDRV_VERSION_PROC) GetProcAddress (hInst, IDRV_VERSION_PROC_NAME);
|
|
||||||
versionDriver = (IDRV_VERSION_PROC) driverLib.getSymbolAddress(IDRV_VERSION_PROC_NAME);
|
versionDriver = (IDRV_VERSION_PROC) driverLib.getSymbolAddress(IDRV_VERSION_PROC_NAME);
|
||||||
if (versionDriver != NULL)
|
if (versionDriver != NULL)
|
||||||
{
|
{
|
||||||
|
@ -220,8 +226,8 @@ IDriver *CDRU::createD3DDriver() throw (EDru)
|
||||||
{
|
{
|
||||||
throw EDruDirect3dDriverCantCreateDriver();
|
throw EDruDirect3dDriverCantCreateDriver();
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
|
|
||||||
|
return ret;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
Loading…
Reference in a new issue