- 1 year ago
why glunurbscallback(theNurb, GLU_NURBS_VERTEX, (_GLUfuncptr)vertexCallback) can not get data under X64 procedure,but work under X86?
It's possible that the issue is related to differences in the way memory is handled between 32-bit (x86) and 64-bit (x64) architectures.
One possible explanation for the problem is that the callback function vertexCallback
uses a different calling convention than the one expected by the gluNurbsCallback
function. The calling convention determines how the function arguments are passed and how the return value is handled. On x86 systems, the default calling convention is usually cdecl
, whereas on x64 systems, the default calling convention is stdcall
. If the callback function is defined with the wrong calling convention, it may not work properly when called by gluNurbsCallback
.
To address this issue, you may need to explicitly specify the calling convention for the callback function. For example, you can define the function using the __stdcall
keyword on x64 systems, like this:
cvoid __stdcall vertexCallback(GLfloat* vertex)
{
// ...
}
Alternatively, you can use a function pointer typedef that specifies the correct calling convention, like this:
ctypedef void (__stdcall *PFNVERTEXCALLBACK)(GLfloat*);
void vertexCallback(GLfloat* vertex)
{
// ...
}
// ...
PFNVERTEXCALLBACK pfnVertexCallback = &vertexCallback;
// ...
gluNurbsCallback(theNurb, GLU_NURBS_VERTEX, (_GLUfuncptr)pfnVertexCallback);
By explicitly specifying the calling convention, you can ensure that the callback function is called correctly on both x86 and x64 systems.