There is an openGL implementation example here
http://www.nvidia.com/content/gtc-2010/pdfs/2010_gtc2010.pdf
Page 10
http://www.nvidia.com/content/gtc-2010/pdfs/2010_gtc2010.pdf
Page 10
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
EXPORT int GetControllerData(int _iID, SControllerData_t *_psData)
{
if(_iID == ctrInfo.m_iID)
{
//ServGetData(&servInData);
//for(int i=0; i < 6; i++)
// ctrData.m_aiAxis[i] = servInData.axes[i];
ctrData.m_aiAxis[0] = sin(dbg_rad+= 0.01F) * 32000;
//_psData = &ctrData; <<<< WRONG
memcpy(_psData, &ctrData, sizeof(SControllerData_t));//<<< OK
}
return 0;
}
#include "gpb_plugin.h"
#include "GPBInput.h"
#include "stdafx.h"
/*
If compiled as C++, extern "C" must be added to declaration of functions to export
X+ is right, Y+ is top and Z+ is forward.
*/
ServOutData servOutData;
ServInData servInData;
SControllerInfo_t ctrInfo;
SControllerData_t ctrData;
EXPORT int Version()
{
return 2;
}
/* called when software is started. If return value is not 0, the plugin is disabled */
EXPORT int Startup()
{
ServOpen(27004);
strcpy((char*)&ctrInfo.m_szName, "OvfCtr");
strcpy((char*)&ctrInfo.m_szUUID, "ee72a6ac-0e2a-459b-882e-a122eb634e4d");/* universally unique identifier */
ctrInfo.m_iID = 136; /* internal unique ID */
ctrInfo.m_iNumAxis = 6; /* number of axis */
//short m_aaiAxisRange[6][3]; /* min, max and center value of each axis */
for(int i=0; i < 6; i++)
{
//ctrInfo.m_aaiAxisRange[i][0] = -32768;
//ctrInfo.m_aaiAxisRange[i][1] = 32767;
//ctrInfo.m_aaiAxisRange[i][2] = 0;
ctrInfo.m_aaiAxisRange[i][0] = 0;
ctrInfo.m_aaiAxisRange[i][1] = 128;
ctrInfo.m_aaiAxisRange[i][2] = 128;
}
//char m_iNumSliders; /* number of sliders */
//short m_aiSliderRange[6]; /* max value of each slider */
//char m_iNumButtons; /* number of buttons */
//char m_iNumPOV; /* number of POVs */
//char m_iNumDials; /* number of dials */
//char m_aiDialRange[8]; /* max value of dials */
return 0;
}
/* called when software is closed */
EXPORT void Shutdown()
{
ServClose();
}
/* called every rendering frame. This function is optional */
EXPORT void Update()
{
}
/* called when a control is queried */
EXPORT void Reset()
{
}
int dbgControllers = 1;
/* called every few seconds to support hot plugging. The return value is the number of active controllers */
EXPORT int GetNumControllers()
{
return dbgControllers;
}
/* _iIndex is the 0 based controller index. _psInfo must be filled with controller info */
EXPORT int GetControllerInfo(int _iIndex,SControllerInfo_t *_psInfo)
{
if(_iIndex == 0)
{
_psInfo = &ctrInfo;
}
return 0;
}
/* _iID is the unique controller ID. _psData must be filled with controller data */
EXPORT int GetControllerData(int _iID, SControllerData_t *_psData)
{
//if(_iID == ctrInfo.m_iID)
{
ServGetData(&servInData);
for(int i=0; i < 6; i++)
ctrData.m_aiAxis[i] = servInData.axes[i];
_psData = &ctrData;
}
return 0;
}