Page 1 of 1

landscape viewport orientation on Windows

Posted: Sat Aug 30, 2014 9:40 am
by suny2000
Hi,

I'm looking for a way to orient the Ogre viewport in lanscape, in order to use a full screen scene on a 90 degrees rotated LCD screen.
I tried to use the orientation mode of the camera, or of the viewport, and of course, it throws an exception because it only works on IOS.
Dammed.
Anyone can think of a way to orient in landscape an Ogre viewport on Windows or Mac?

S.

Re: landscape viewport orientation on Windows

Posted: Sat Aug 30, 2014 5:38 pm
by Kojack
Try this:

Code: Select all

	m_camera->setAspectRatio(float(m_window->getWidth()) / float(m_window->getHeight()));
	Ogre::Matrix4 mat = m_camera->getProjectionMatrix();
	mat = mat * Ogre::Quaternion(Ogre::Degree(90.0f), Ogre::Vector3::UNIT_Z);
	m_camera->setCustomProjectionMatrix(true, mat);
It rotates the projection matrix of the camera by 90 degrees. You might need to change it to -90 if the screen ends up upside down.
Auto aspect ration was having trouble with it, I needed to manually set the aspect ratio for it to work.

Re: landscape viewport orientation on Windows

Posted: Sun Aug 31, 2014 9:05 am
by suny2000
Thanks a lot Kojack!
It's working perfectly for the 3D scene.
Unfortunately, it doesn't rotate the overlay.
But, it's a great step in the right direction :)

Re: landscape viewport orientation on Windows

Posted: Sun Aug 31, 2014 9:16 am
by Kojack
Overlays will use their own projection matrix to remove the perspective calculation. It can be rotated too, you just need to find it (or use a shader and do the multiply there.
I'm not sure how easy to replace an overlay's matrix would be, I've never tried. :)