Camera rotation question

Tutorials concerning the OpenGL® ES cross-platform API for full-function 2D and 3D graphics on the Google-Android platform.

Camera rotation question

Postby mortefer » Sat Jan 03, 2009 1:30 am

Hello guys,
I've got a small question here.
The phone is in a Portrait position, and i'm rendering a 3D app as same as show in tutorials. But i want to application to rendered as if rotated to 90 degrees (landscape mode). So here is the question - how do i do that? :) i tried setting the up vector for GLU.gluLookAt function from standart (0,1,0) to (0,0,1) but when moving lookAt vector the perspective gets skewed (it think the skew stuff begins when i'm near 90 or -90 degress of lookAt rotation). Perhaps someone spotted smth like that? Maybe i'm missing smth?
Some notes to add - i'm using emulator (not an actual device) always in portrait mode, not landscape. Another question here to be asked - when user rotates actual device to landscape mode, does device handles this rotation by it self, or it only happens when user flip's the screen to get to the keyboard?

Thanx everyone in advance.
mortefer
Experienced Developer
Experienced Developer
 
Posts: 54
Joined: Sat Dec 20, 2008 11:24 am

Top

Postby mortefer » Sat Jan 03, 2009 2:09 am

Just launched emulator in Landscape mode, everything works as expected. so the question remains - do G1 has an auto-rotate feature? so then user rotates the device my application renders fine?
mortefer
Experienced Developer
Experienced Developer
 
Posts: 54
Joined: Sat Dec 20, 2008 11:24 am

Postby Ultrano » Sun Jan 04, 2009 9:07 am

In emulator, Numpad7: switch between modes. It works exactly like the real phone.
In your manifest.xml, put android:screenOrientation="sensor" in the <activity /> tag
http://androidguys.com/?p=2914

To make Android not kill and restart you app, add
android:configChanges="keyboardHidden|orientation", but search this string for the Activity method you may want to override.
Ultrano
Junior Developer
Junior Developer
 
Posts: 16
Joined: Sat Dec 20, 2008 12:53 am

Postby mortefer » Sun Jan 04, 2009 12:10 pm

Thanx for the response - that really helped
mortefer
Experienced Developer
Experienced Developer
 
Posts: 54
Joined: Sat Dec 20, 2008 11:24 am

Top

Return to Android 2D/3D Graphics - OpenGL Tutorials

Who is online

Users browsing this forum: No registered users and 4 guests