Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Después de descargar la biblioteca en tu máquina y de incluirla en el sistema de control de código fuente, realiza los cambios siguientes en la configuración de compilación del proyecto.
Biblioteca estática
Sigue estos pasos para vincular tu proyecto a la biblioteca estática:
Agrega gamesdk/include a las rutas de inclusión de tu compilador.
Incluye swappy/swappyGL.h a fin de realizar la integración con OpenGL ES. En la mayoría de los casos, el archivo de encabezado contiene todas las funciones que necesitas para integrar la biblioteca al motor.
Agrega una ruta de acceso con el siguiente formato en las rutas de acceso de tu biblioteca de vinculadores:
Por ejemplo: gamesdk/libs/arm64-v8a_API24_NDK17_cpp_static_Release
Agrega -lswappy_static a tu comando de vinculador.
Biblioteca compartida
Los pasos anteriores se vinculan estáticamente a una versión de la biblioteca de Frame Pacing que se compiló para la combinación determinada de ABI, nivel de API, NDK y STL. Si la combinación no está disponible para tu configuración, puedes vincularla a la biblioteca compartida:
Sigue los pasos 1 y 2 de la sección anterior a fin de actualizar las rutas de inclusión de tu compilador y usar el archivo de encabezado adecuado.
Agrega una ruta de acceso con el siguiente formato en las rutas de acceso de tu biblioteca de vinculadores:
La vinculación estática te brindará una huella de código mucho más pequeña, ya que no necesitarás empaquetar la biblioteca compartida libswappy.so.
Cómo usar CMake (solo biblioteca estática)
Si usas CMake, consulta el archivo gamesdk/samples/bouncyball/app/CMakeLists.txt de la biblioteca descargada para obtener un ejemplo de configuración de CMake. En él, se incluye un archivo de utilidad, gamesdk/samples/gamesdk.cmake, que realiza las comprobaciones finales, agrega las rutas correctas de inclusión del compilador y genera un destino que puedes usar para vincular la biblioteca.
Para usar esta utilidad, haz lo siguiente:
Incluye este archivo en tu CMakeLists.txt:
include("path/to/gamesdk/samples/gamesdk.cmake").
Llama a la función add_gamesdk_target con la carpeta que contiene el gamesdk:
add_gamesdk_target(PACKAGE_DIR path/to/gamesdk).
En tu target_link_libraries de la biblioteca nativa, agrega swappy como una dependencia:
target_link_libraries(native-lib swappy ...)
.
El contenido y las muestras de código que aparecen en esta página están sujetas a las licencias que se describen en la Licencia de Contenido. Java y OpenJDK son marcas registradas de Oracle o sus afiliados.
Última actualización: 2025-08-26 (UTC)
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-26 (UTC)"],[],[],null,["After you've [downloaded the library](/games/sdk/frame-pacing/opengl) onto your\nmachine and have checked it into your source control system, make the following\nchanges to your project's build settings.\n\nStatic library\n\nDo the following steps to link your project to the static library:\n\n1. Add `gamesdk/include` to your compiler include paths.\n2. Include `swappy/swappyGL.h` for integration with OpenGL ES. In most cases, the header file contains all the functions you need to integrate the library into your engine.\n3. Add a path of the following form in your linker library paths:\n\n ```\n gamesdk/libs/architecture_APIapiLevel_NDKndkVersion_stlVersion_Release\n ```\n\n For example: `gamesdk/libs/arm64-v8a_API24_NDK17_cpp_static_Release`\n4. Add `-lswappy_static` to your linker command.\n\nShared library\n\nThe above steps statically link against a version of the Frame Pacing library\ncompiled for the given ABI, API level, NDK and STL combination. If the combination\nis not available for your settings, you can instead link against the shared\nlibrary:\n\n1. Follow steps 1 and 2 from the previous section to update your compiler include paths and use the appropriate header file.\n2. Add a path of the following form in your linker library paths:\n\n ```\n gamesdk/libs/architecture_APIapiLevel_NDKndkVersion_stlVersion_Release/lib/swappy\n ```\n3. Add `-lswappy` to your linker command.\n\nStatic linking will give you a much smaller code footprint as you don't need to\nbundle the `libswappy.so` shared library.\n\nUsing CMake (static library only)\n\nIf you are using CMake, see the `gamesdk/samples/bouncyball/app/CMakeLists.txt`\nfile in the [downloaded library](/games/sdk/frame-pacing/opengl)\nfor an example CMake configuration. It includes a utility file, `gamesdk/samples/gamesdk.cmake`,\nthat performs final checks, adds the proper compiler include paths and\ngenerates a target that you can use to link the library.\n\nTo use this utility, do the following:\n\n1. Include this file in your CMakeLists.txt: `include(\"`\u003cvar translate=\"no\"\u003epath/to/gamesdk\u003c/var\u003e`/samples/gamesdk.cmake\")`\n2. Call the `add_gamesdk_target` function with the folder containing the gamesdk: `add_gamesdk_target(PACKAGE_DIR `\u003cvar translate=\"no\"\u003epath/to/gamesdk\u003c/var\u003e`)`\n3. In your `target_link_libraries` for your native library, add `swappy` as a dependency: `\n target_link_libraries(native-lib swappy ...)\n `\n\n| **Note:** The path to the gamesdk used for `include` and `add_gamesdk_target` can either be absolute (for example, `/home/yourusername/gamesdk` or `C:\\Android\\gamesdk`) or relative to the `CMakeLists.txt` file.\n\nFor advanced usage of CMake, see the [`gamesdk.cmake` source file](https://android.googlesource.com/platform/frameworks/opt/gamesdk/+/refs/heads/master/samples/gamesdk.cmake)."]]