Hi Robert,
You could just patch Producer to have the const method and send this along
to Don, or do a const cast locally.
Or.. port to osgViewer as the osg::Camera that it uses does have const
methods for all the major accessors. To do this you'd need to use the SVN
version of the OSG, or one of the recent 1.9.x dev releases.
Robert.
On 4/30/07, Robert Doyle <[EMAIL PROTECTED]> wrote:
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/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/