Use lambda to workaround __stdcall issue

This commit is contained in:
Benau 2017-04-10 10:00:34 +08:00
parent bcf996e291
commit f30962b944
2 changed files with 14 additions and 7 deletions

View File

@ -624,11 +624,17 @@ void IrrDriver::initDevice()
"RecorderConfig is invalid, use the default one.");
}
ogrRegReadPixelsFunction((ogrFucReadPixels)glReadPixels);
ogrRegPBOFunctions((ogrFucGenBuffers)glGenBuffers,
(ogrFucBindBuffer)glBindBuffer, (ogrFucBufferData)glBufferData,
(ogrFucDeleteBuffers)glDeleteBuffers, (ogrFucMapBuffer)glMapBuffer,
(ogrFucUnmapBuffer)glUnmapBuffer);
ogrRegReadPixelsFunction([]
(int x, int y, int w, int h, unsigned int f, unsigned int t, void* d)
{ glReadPixels(x, y, w, h, f, t, d); });
ogrRegPBOFunctions([](int n, unsigned int* b) { glGenBuffers(n, b); },
[](unsigned int t, unsigned int b) { glBindBuffer(t, b); },
[](unsigned int t, ptrdiff_t s, const void* d, unsigned int u)
{ glBufferData(t, s, d, u); },
[](int n, const unsigned int* b) { glDeleteBuffers(n, b); },
[](unsigned int t, unsigned int a) { return glMapBuffer(t, a); },
[](unsigned int t) { return glUnmapBuffer(t); });
ogrRegGeneralCallback(OGR_CBT_START_RECORDING,
[] (void* user_data) { MessageQueue::add

View File

@ -167,10 +167,11 @@ typedef void(*ogrFucReadPixels)(int, int, int, int, unsigned int, unsigned int,
void*);
typedef void(*ogrFucGenBuffers)(int, unsigned int*);
typedef void(*ogrFucBindBuffer)(unsigned int, unsigned int);
typedef void(*ogrFucBufferData)(unsigned int, ptrdiff_t, const void*, unsigned int);
typedef void(*ogrFucBufferData)(unsigned int, ptrdiff_t, const void*,
unsigned int);
typedef void(*ogrFucDeleteBuffers)(int, const unsigned int*);
typedef void*(*ogrFucMapBuffer)(unsigned int, unsigned int);
typedef void(*ogrFucUnmapBuffer)(unsigned int);
typedef unsigned char(*ogrFucUnmapBuffer)(unsigned int);
#ifdef __cplusplus
extern "C"