I'm trying to add SpaceNavigator support to our 3D Modeler. But I run into a problem. I'm calling the redraw function for the 3D scene directly in the Connexion message handler. That works fine for simple scenes but it doesn't work for complex scenes. It looks like the messages get queued. So all movements get delayed more and more after some time. After removing my had from the space navigator there are still messages sent for some time.
You can easily reproduce that behavior if you modify the "3DxCubeCarbon" example project which comes with the SDK.
Code: Select all
void drawGL (pRecContext pContextInfo, Boolean swap)
{
// printf("Result of drawGL: Context = %08X = %08X \n", pContextInfo, pContextInfo->aglContext ); fflush( stdout );
if ( !pContextInfo || !(pContextInfo->aglContext) )
return;
// ensure the context is current
aglSetCurrentContext( pContextInfo->aglContext );
updateProjection( pContextInfo );
// clear our drawable
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// projection matrix already set
updateModelView(pContextInfo);
glCallList( pContextInfo->polyList );
if ( swap )
aglSwapBuffers (pContextInfo->aglContext);
else
glFlush();
////////////////////////////////////////////////////
//add these lines too the 3DxCubeCarbon example code
////////////////////////////////////////////////////
int i;
for(i=0;i<1500000;i++){
float f=5;
f=sqrt(f);
}
////////////////////////////////////////////////////
//add these lines too the 3DxCubeCarbon example code
////////////////////////////////////////////////////
}
The few added lines should just show what happens if the drawGL function consumes some more CPU time.
Any help would be highly appreciated.
Bye,
Martin
P.S. I use Mac OS X 10.4.9, Driver 1.2, Firmware 3.18