Large angle views and RTT problem using Hydrax


16-12-2009 06:57:46

Hi everyone:
I have two problems while using Hydrax:
1) in order to get large angle views, i use two computers and monitors to work together, one for the left half scene and the other for the right half part to enlarge view angle, not to get high resolution(a third computer is used as console to synchronize the two scene). my code is as follow:

//for the right half:
m_pCamera->getFrustumExtents(l, r, t, b); // l = -r, (0, 0) is at the center of screen
m_pCamera->setFrustumExtents(0, 2*r, t, b);
//for the left half:
m_pCamera->getFrustumExtents(l, r, t, b); // l = -r
m_pCamera->setFrustumExtents(-2*r, 0, t, b);

Result is below:
the left view is:

the right view is:

there is no problem for Caelum and other scenes.
scene is a little stretched because of asymmetrical projection matrix by calling setFrustumExtents().
it seems that shifting camera, such as yawing a certain angle before any other camera operation, could not work properly.
the left part is:

the rigth part is:

two camera shift around itself axis, not the same axis.

2) I use RTT to draw the ocean onto a Rectangle2D object following the intermediate tutorial 7. The mini screen itself still has a miniscreen as follows.

my code is below:

TexturePtr mTexture = TextureManager::getSingleton().createManual("RttTex", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_2D, m_pRenderWnd->getWidth(), m_pRenderWnd->getHeight(), 0, PF_R8G8B8, TU_RENDERTARGET);
RenderTexture *rttTex = mTexture->getBuffer()->getRenderTarget();
Viewport *v = rttTex->addViewport(m_pCamera);

MaterialPtr mat = MaterialManager::getSingleton().create("RttMtr", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
Ogre::Technique* pTech = mat->createTechnique();

m_pTile = new Ogre::Rectangle2D(true);
m_pTile->setCorners(-0.5, 0.5, 1.0, -1.0);
m_pTile->setBoundingBox(AxisAlignedBox(-500000*Vector3::UNIT_SCALE, 500000*Vector3::UNIT_SCALE));

Ogre::SceneNode *miniScreenNode = m_pSceneMgr->getRootSceneNode()->createChildSceneNode("MiniScreenNode");

rttTex->addListener(new RttRenderTargetListener(m_pTile));

render target listener is defined below:

class RttRenderTargetListener : public RenderTargetListener
RttRenderTargetListener(Ogre::Rectangle2D* pTile) : m_pTile(pTile)

void preRenderTargetUpdate(const RenderTargetEvent& evt)
void postRenderTargetUpdate(const RenderTargetEvent& evt)

Ogre::Rectangle2D* m_pTile;

did anyone have this problem before? any suggestion is welcomed!