OpenGL when turning an Android phone

What did he call (what term should google be) when flipping / tipping the phone so that the view rotates when Android starts?

When I launch My (OpenGL) application for the first time, when I do this, there are some certain steps when working with OpenGL, when does this happen?

Is there anything else I could think of?

+5
source share
4 answers

The problem is similar to the configuration change that occurs when the screen orientation changes. See Configuration Changes . You might want to tell Android that you can handle the orientation change yourself using the configChanges attribute .

+3
source

if you do not set the AndroidManifest.xml attributes for actions that handle their own rotations, your activity will be restarted, the GL context will be recreated, and at least any surfaces and buffers that you used will be invalid.

gles 1.1, AndroidManifest.xml, , , , ()

<application android:label="@string/app_name" 
             android:icon="@drawable/icon" 
             android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
             android:debuggable="true">
    <activity android:name="MainActivity"
              android:configChanges="keyboard|keyboardHidden|orientation"
              android:screenOrientation="nosensor"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
+5

" Android" " Android OpenGL", 3D. , , .

I would recommend looking into some sample code to see the correct way to handle screen rotation, look for "ApiDemos.apk" in Android (sources open it, by the way), especially those using GL ", all of which handle screen rotation.

0
source

All Articles