Hello OSG users:
I'm having difficulty getting the projection matrix in the post-draw
callback below. The matrix returned from cam.getProjectionMatrix() is
not const and so error C2662 is generated. Is there a workaround to this
problem or have I missed something?
Thanks,
Bob Doyle
// Set up in main() by:
// viewer.getCamera(0)->addPostDrawCallback(new
CaptureDepthCallback(depthImage));
class CaptureDepthCallback : public Producer::Camera::Callback
{
public:
CaptureDepthCallback(osg::Image* image):
_image(image)
{}
void operator () (const Producer::Camera &cam)
{
int x, y;
unsigned int width, height;
viewMatrix = cam.getViewMatrix();
projectionMatrix = cam.getProjectionMatrix();
// error C2662: 'Producer::Camera::getProjectionMatrix'
:
// cannot convert 'this' pointer from 'const
Producer::Camera'
// to 'Producer::Camera &'
cam.getProjectionRectangle(x, y, width, height);
_image->readPixels(x, y, width, height,
GL_DEPTH_COMPONENT,
GL_FLOAT);
}
osg::Image* _image;
osg::Matrix::value_type* projectionMatrix;
const osg::Matrix::value_type* viewMatrix;
};
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/