小编cut*_*xyz的帖子

如何使用纯 C++ 代码通过 NDK 强制横向模式

一般来说,它工作正常。但如果我锁定屏幕,并等待 APP_CMD_LOST_FOCUS 发生,然后我解锁屏幕。它变成肖像了!但我发现egl buff仍然是风景设置,并且所有坐标都更大。

我的 AndroidManifest.xml 设置:

<activity android:name="android.app.NativeActivity"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:configChanges="orientation|keyboardHidden"
        android:screenOrientation="landscape"
        android:clearTaskOnLaunch="true">
    <meta-data android:name="android.app.lib_name"
            android:value="sunred" />

    <intent-filter>
          <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>

</activity>
Run Code Online (Sandbox Code Playgroud)

我的egl init C++代码

int engine_init_display(OSCONTEXTENGINE* pEngine, const DISPLAY_CONFIG* pConfig)
{
    // initialize OpenGL ES and EGL
    /*
     * Here specify the attributes of the desired configuration.
     * Below, we select an EGLConfig with at least 8 bits per color
     * component compatible with on-screen windows
     */
    const EGLint attribs[] =
    { EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDERABLE_TYPE, …
Run Code Online (Sandbox Code Playgroud)

android opengl-es android-ndk opengl-es-2.0

5
推荐指数
1
解决办法
3489
查看次数

标签 统计

android ×1

android-ndk ×1

opengl-es ×1

opengl-es-2.0 ×1