将 Android Frame Pacing 集成至 OpenGL 渲染程序
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本教程介绍如何将 Android Frame Pacing 集成到您的工具链中,如何使用该库提供的函数,以及如何验证帧同步是否已改进。Android Frame Pacing 作为 AGDK 库中的静态或共享库提供。
开始使用
- 下载 SDK .zip 文件或从 Android 开源项目克隆代码库。
在 Android Studio 中运行 Bouncyball 示例。此示例项目将 Android Frame Pacing 库集成到一款使用 OpenGL ES 进行渲染的游戏中。
- 将 .zip 文件内容解压到一个文件夹中。
- 打开 Android Studio。
- 依次点击 File > Open,然后选择
gamesdk/samples/bouncyball
目录。
- 等待 Android Studio 同步项目。
- 连接设备或创建虚拟设备以运行此示例(如需了解详情,请参阅构建和运行应用)。
- 选择目标设备,然后点击 Run 图标
。
应在目标设备上构建和安装示例 APK。如果您遇到错误,请检查以下事项:
- 您拥有的 Android SDK 为受支持的版本;如需了解详情,请参阅应用模块
build.gradle
文件中的 compileSdkVersion
字段。您可以从 SDK 管理器的 SDK Platforms 标签页中更新 SDK 版本。
- 您拥有的 Android NDK 为受支持的版本;如需了解详情,请参阅应用模块
build.gradle
文件中的 ndkVersion
字段。您可以从 SDK 管理器的 SDK Tools 标签页中安装特定版本的 NDK。
- 项目中的
local.properties
文件没有适用于 ndk.dir
的条目。此位置由 Android Studio 指定,并使用上述 NDK 版本。如果您有此条目,请清除整行。
- 更改任何构建设置后,清理项目 (Build > Clean Project) 并刷新关联的 C++ 项目 (Build > Refresh Linked C++ Projects)。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2023-09-25。
[null,null,["最后更新时间 (UTC):2023-09-25。"],[],[],null,["# Integrate Android Frame Pacing into your OpenGL renderer\n\nThis tutorial describes how to integrate Android Frame Pacing into your\ntoolchain, how to use the functions that the library provides, and how to verify\nthat your frame pacing has improved. Android Frame Pacing is available as a\nstatic or shared library in the AGDK Libraries.\n\nGet started\n-----------\n\n1. Clone the [`games-samples` repository](https://github.com/android/games-samples.git).\n2. Follow the instructions in the [prerequisites section of the AGDKTunnel README](https://github.com/android/games-samples/tree/main/agdk/agdktunnel#prerequisites).\n3. Run the [AGDKTunnel sample](https://github.com/android/games-samples/tree/main/agdk/agdktunnel) in Android Studio. This example\n project integrates Android Frame Pacing into a game that uses OpenGL ES for\n rendering.\n\n 1. Open Android Studio.\n 2. Click **Projects \\\u003e Open** and select the `/games-samples/agdk/agdktunnel` directory.\n 3. Wait for Android Studio to sync the project.\n 4. Connect a device or create a virtual device to run the sample (for more information, see [Build and run your app](/studio/run)).\n 5. Select the target device and click **Run** .\n 6. The sample APK should build and install on the target device. If you\n encounter errors, check the following:\n\n - You have a [supported version](/games/sdk#requirements) of the Android SDK; see the `compileSdkVersion` field in the app module `build.gradle` file for more information. You can [update the SDK version](/studio/intro/update#sdk-manager) from the **SDK Platforms** tab in the SDK Manager.\n - You have a [supported version](/games/sdk#requirements) of the Android NDK; see the `ndkVersion` field in the app module `build.gradle` file for more information. You can [install a specific version of the NDK](/studio/projects/install-ndk#specific-version) from the **SDK Tools** tab in the SDK Manager.\n - The `local.properties` file in the project does *not* have an entry for `ndk.dir`. This location is specified by Android Studio and uses the NDK version from above. If you have this entry, clear the entire line.\n - After any build setting change, clean the project (**Build \\\u003e Clean\n Project** ) and refresh the linked C++ projects (**Build \\\u003e Refresh\n Linked C++ Projects**)."]]