Skip to main content

History: Ogre iPhone FAQ

Source of version: 5

Copy to clipboard
            !!Issues and Troubleshooting

* Viewport::SetOrientation must be called after a frame is rendered to take effect. For example to change to Viewport::OR_PORTRAIT:

{CODE(wrap="1", colors="c++")}mRoot->renderOneFrame();
mCamera->getViewport()->setOrientation(Viewport::OR_PORTRAIT);{CODE}

* Current state of Viewport::OR_LANDSCAPELEFT (default value) has known issues related with camera frustum, that deliver early entity clipping and problems with getCameraToViewportRay. Change to OR_PORTRAIT while this problem is resolved.

Until the issue is fixed here is a workaround.  As a side effect of this, the x and y values of input will be swapped.  Your code will need to take this into account.

{CODE(wrap="1", colors="c++")}Ogre::Camera *camera = mCameraMan->getCamera();
if (camera)
{
	int width = camera->getViewport()->getActualWidth();
	int height = camera->getViewport()->getActualHeight();

	camera->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
	camera->setAspectRatio(Ogre::Real(width) / Ogre::Real(height));

	// Use PORTRAIT and rotate the projection matrix
	camera->getViewport()->setOrientation(Viewport::OR_PORTRAIT);
	camera->setOrthoWindowWidth(block_dim*(num_blocks_y+1));
	Matrix4 proj = camera->getProjectionMatrix();
	proj = proj * Quaternion(Degree(-90), Vector3::UNIT_Z);
	camera->setCustomProjectionMatrix(true, proj);
}{CODE}


        

History

Information Version
Mon 01 of Aug, 2011 00:04 GMT-0000 jacmoe 8
Sat 01 of May, 2010 05:23 GMT-0000 jacmoe 7
Mon 04 of Jan, 2010 17:58 GMT-0000 jacmoe 6
Thu 31 of Dec, 2009 19:31 GMT-0000 jacmoe 5
Thu 17 of Dec, 2009 17:27 GMT-0000 spacegaier 4
Thu 17 of Dec, 2009 16:29 GMT-0000 jacmoe 3
Thu 17 of Dec, 2009 16:28 GMT-0000 jacmoe 2
Sat 31 of Oct, 2009 08:46 GMT-0000 Spacegaier added category and improved markup a bit 1