Hello,

I have a scene which I render into a viewport with a perspective camera.
Now I would like to render the same scene from another view point into a
different viewport but using an orthographic projection. I have tried to
use the MatrixCameraDecoratror class but I'm unable to get it
functioning.

What is the best way to solve such a problem? 

I have used the MatrixCameraDecorator to render the scene into another
viewport in perspective view with some translation and rotation
modification from the decoratee camera. That does work fine. Then I
thought that I could setup an orthographic projection matrix and modify
the decorator projection with the functions setPreProjection and
setPostProjection:

Camera* camera = _view->getCamera();

Matrix ortho;
Real32 vs = _view->getPort()->getPixelWidth() / 2;
Real32 hs = _view->getPort()->getPixelHeight() / 2;

bool ret = MatrixOrthogonal(ortho, -hs, hs, -vs, vs, camera->getNear(),
camera->getFar());

Matrix projection, inv_proj;
camera->getProjection(projection, _view->getPort()->getPixelWidth(),
_view->getPort()->getPixelHeight());
ret = inv_proj.invertFrom(projection);

MatrixCameraDecoratorUnrecPtr decorator =
MatrixCameraDecorator::create();
decorator->setDecoratee(camera);

decorator->setPreProjection(inv_proj);
decorator->setPostProjection(ortho);

This does not work...

Best,
Johannes



____________
Virus checked by G DATA AntiVirusKit
Version: AVB 22.111 from 20.05.2011
Virus news: www.antiviruslab.com

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to