iPhone problem with camera orientation

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Post Reply
elkree
Gnoblar
Posts: 20
Joined: Wed Apr 21, 2010 9:08 pm
x 1

iPhone problem with camera orientation

Post by elkree »

Hi, i'm porting a soccer game from linux to iPhone and i have some problems

with this code

Code: Select all

	Ogre::SceneNode* cameraNode = gameSceneMgr->getSceneNode("basicNode")->createChildSceneNode("cameraNode");
	camera = gameSceneMgr->createCamera("gameCamera");
	cameraNode->setPosition(Ogre::Vector3(0, GameStates::SIZEY/2, -GameStates::SIZEX*1.2));
	cameraNode->attachObject(camera);

	camera->lookAt(Ogre::Vector3(0, 0, 50));
	camera->setNearClipDistance(1);
	camera->setAspectRatio(Ogre::Real(OgreFramework::getSingletonPtr()->m_pViewport->getActualWidth()) / 
							  Ogre::Real(OgreFramework::getSingletonPtr()->m_pViewport->getActualHeight()));
	OgreFramework::getSingletonPtr()->m_pViewport->setCamera(camera);
using in iphone
*-*-* OGRE Initialising
*-*-* Version 1.7.3 (Cthugha)
Installing plugin: OpenGL ES 1.x RenderSystem

and in linux normal with openGL render system and ogre version 1.7.3

the results are:
Image
using linux

Image
using iphone

main problem is the orientation of the camera, set position works fine with the players, the soccer map i think i can't visualize correctly because with openglES1 i can't put a texture in a plane, using ogre 1.8 with opengles 2 can correct this? and the gorilla GUI can be corrected turning 270 degree

any idea about how to resolve the camera problem? i tried to use set direction/set orientation/look at methods and i don't have any correct result

i created the viewport with the next lines before making the camera:

Code: Select all

	m_pViewport = m_pRenderWnd->addViewport(0);
	m_pViewport->setBackgroundColour(ColourValue(0.8, 0.8, 0.8, 1.0));

	m_pViewport->setCamera(0);
thx!
elkree
Gnoblar
Posts: 20
Joined: Wed Apr 21, 2010 9:08 pm
x 1

Re: iPhone problem with camera orientation

Post by elkree »

playing with set direction in camera class
from api:
void Ogre::Camera::setDirection ( const Vector3 & vec )
Sets the camera's direction vector.
using the next core

Code: Select all

    OgreFramework::getSingletonPtr()->m_pLog->logMessage("SceneGame :: camara debug: "+Ogre::StringConverter::toString(camera->getDirection()));
	camera->setDirection(0,-1,0);
    OgreFramework::getSingletonPtr()->m_pLog->logMessage("SceneGame :: camara debug2: "+Ogre::StringConverter::toString(camera->getDirection()));
the result:

SceneGame :: camara debug: 0 0 -1
SceneGame :: camara debug2: 0 -0.5 -0.5


this result isn't the expected reading the api, can be a bug? how i can put a correct direction?

thx
elkree
Gnoblar
Posts: 20
Joined: Wed Apr 21, 2010 9:08 pm
x 1

Re: iPhone problem with camera orientation

Post by elkree »

my solution at this problem is: move the world, not the camera
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: iPhone problem with camera orientation

Post by masterfalcon »

Another option would be to set the viewport orientation according to how the device is oriented.
elkree
Gnoblar
Posts: 20
Joined: Wed Apr 21, 2010 9:08 pm
x 1

Re: iPhone problem with camera orientation

Post by elkree »

The main problem is the iphone simulator provided by apple, deploying the project in a normal device (iphone or ipad) looks really good!
Post Reply