If you must have an AcGsView to work with then use acgsGetGsView passing in "true" for the bCreateIfNone parameter.
However, the necessary information for calculating the projection matrix is available without using an AcGsView if you dig around in the ARX help files. What you need is the device's width and height (in the device coordinate system), the camera to target distance (in world coordinates), and whether or not the projection is orthographic or perspective.
Once you have that info, the projection matrix calculation is as follows...
AcGeMatrix3d
getProjectionMatrix
(
double dcsWidth,
double dcsHeight,
double wcsCameraToTargetDistance,
bool isPerspective
)
{
AcGeMatrix3d xform;
xform(0, 0) = 2.0 / dcsWidth;
xform(1, 1) = 2.0 / dcsHeight;
if (isPerspective)
{
xform(2, 2) = xform(3, 2) = 1.0 / wcsCameraToTargetDistance;
}
else // if projection is orthographic.
{
xform(2, 2) = 0.1 / wcsCameraToTargetDistance;
}
return xform;
}
That should give you the same projection matrix as AcGsView::projectionMatrix().
Regards,
Andy F.