Hi there,
I'm trying to implement a POC of Dark Occlusion to see if it is working or not for DGDK.
So far, I tried to load as a library the sample 'DarkOcclusion.dll', that is provided at the product page for testings.
The dll seems to load fine, but I got an 'access violation' when trying to use the function pointers.
I'm trying to keep it simple:
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSyncOn();
dbSyncRate(60);
//Declare function pointers
void (*setOcclusionSettingsPtr)(int,int);
void (*setObjectOcclusionCullPtr) (int, int, int);
//...
//Load Dark Occlusion DLL as library
HMODULE DarkOcclusionDLL = LoadLibrary( ".\\DarkOcclusion.dll");
if (DarkOcclusionDLL)
{
//Load Dark Occlusion function pointers
setOcclusionSettingsPtr = (void (*)(int,int)) GetProcAddress(DarkOcclusionDLL,"?dbSetOcclusionSettings@@YAXHM@Z");
setObjectOcclusionCullPtr = (void (*)(int,int,int)) GetProcAddress(DarkOcclusionDLL,"?dbSetObjectOcclusionCull@@YAXHHH@Z");
//..
if (!setOcclusionSettingsPtr)
{
dbPrint("Failed to load function address setOcclusionSettingsPtr.");
}
else
{
dbPrint("setOcclusionSettingsPtr loaded.");
};
if (!setObjectOcclusionCullPtr)
{
dbPrint("Failed to load function address setObjectOcclusionCullPtr.");
}
else
{
dbPrint("setObjectOcclusionCullPtr loaded.");
};
}
else
{
dbPrint("Someone crapped up, the DLL won't load.");
};
dbPrint("Press any key.");
dbSync();
dbSuspendForKey();
//********THIS DOESN'T WORK***************
//Set Dark Occlusion settings
setOcclusionSettingsPtr(4,0);
//****************************************
// Create a cube
int objectID = 1;
dbMakeObjectCube (objectID, 1);
//********THIS DOESN'T WORK EITHER****************
// Enable occlusion culling for the cube
setObjectOcclusionCullPtr (objectID, 1, objectID);
//************************************************
while ( LoopGDK ( ) )
{
dbSync();
}
//Free resources
FreeLibrary(DarkOcclusionDLL);
return;
}
I attach the full VS2008 project and the 'DarkOcclusion.dll' demo file.
Please guys can you help?
Thanks in advance.