Thanks for your help. your code does work.
But I have another problem:
I want to extract the eye, projection_center, upDirection information from maya and apply it to openGL environment via gluPerspective,gluLookAt.
I follow your method and use the following code.
MPoint eye = camFn.eyePoint(MSpace::kWorld);
MPoint center = camFn.centerOfInterestPoint(MSpace::kWorld);
MVector up =camFn.upDirection(MSpace::kWorld);
double aspect=camFn.aspectRatio();
double near_clip= camFn.nearClippingPlane();
double far_clip = camFn.farClippingPlane();
double fovy = camFn.verticalFieldOfView();
But it turns out the position information(such as eye position) is not correct. kind of confused. Did I specify wrong argument(kWorld) to function call?
Thanks again.