ARCore SDK for Android

repository·main·Indexed 26 days ago

https://github.com/google-ar/arcore-android-sdk

SDK providing essential APIs for augmented reality features on Android, including motion tracking, environmental understanding, and light estimation. Includes support for Java and NDK (C), Cloud Anchor API, and ML integration with ML Kit and Google Cloud Vision API. Also contains the GLM (OpenGL Mathematics) header-only C++ library for graphics software.

Tokens
12.8K
Snippets
25
Records
66
Agent score
81%

What's inside arcore-android-sdk

  1. Overview of GLM (OpenGL Mathematics)

    main

    GLM is a header-only C++ mathematics library for graphics software based on the OpenGL Shading Language (GLSL) specifications. It provides classes and functions (like vectors and matrices) using GLSL naming conventions, making it intuitive for developers familiar with GLSL.

    Key features:

    • GLSL Compatibility: Uses same naming and functionality as GLSL.
    • Extensions: Supports matrix transformations, quaternions, data packing, random numbers, and noise via an extension system.
    • Platform Independent: No dependencies; works with C++98 and C++11.
    • Supported Compilers: GCC 4.7+, Intel C++ Compiler XE 2013+, Clang 3.4+, Apple Clang 6.0+, Visual C++ 2013+, and CUDA 9.0+ (experimental).
  2. Use GLM extension headers

    main

    You can use specific extension headers to access vector and matrix extensions while keeping build times low.

    // Include GLM vector extensions:
    #include "third_party/glm/latest/glm/ext/vector_float2.hpp"                // vec2
    #include "third_party/glm/latest/glm/ext/vector_float3.hpp"                // vec3
    #include "third_party/glm/latest/glm/ext/vector_trigonometric.hpp"         // radians
    
    // Include GLM matrix extensions:
    #include "third_party/glm/latest/glm/ext/matrix_float4x4.hpp"              // mat4
    #include "third_party/glm/latest/glm/ext/matrix_transform.hpp"             // translate, rotate
    #include "third_party/glm/latest/glm/ext/matrix_clip_space.hpp"            // perspective
    
    glm::mat4 transform(glm::vec2 const& Orientation, glm::vec3 const& Translate, glm::vec3 const& Up)
    {
        glm::mat4 Proj = glm::perspective(glm::radians(45.f), 1.33f, 0.1f, 10.f);
        glm::mat4 ViewTranslate = glm::translate(glm::mat4(1.f), Translate);
        glm::mat4 ViewRotateX = glm::rotate(ViewTranslate, Orientation.y, Up);
        glm::mat4 View = glm::rotate(ViewRotateX, Orientation.x, Up);
        glm::mat4 Model = glm::mat4(1.0f);
        return Proj * View * Model;
    }
  3. View GLM configuration log with GLM_FORCE_MESSAGES

    main

    To see how GLM has detected your compiler, C++ standard, platform, and active configuration settings, define GLM_FORCE_MESSAGES before including any GLM headers. This will output the configuration details to your build log.

    #define GLM_FORCE_MESSAGES
    #include "third_party/glm/latest/glm/glm.hpp"
  4. Use GLM with global headers

    main

    GLM is a header-only library. For convenience, you can include the main GLM header to access core GLSL mathematics functionality, and the extension header to access additional features like perspective, translate, and rotate.

    Note: Including <glm/glm.hpp> and <glm/ext.hpp> pulls in a large amount of code, which can significantly increase build times if included in many source files.

    // Include all GLM core / GLSL features
    #include "third_party/glm/latest/glm/glm.hpp" // vec2, vec3, mat4, radians
    
    // Include all GLM extensions
    #include "third_party/glm/latest/glm/ext.hpp" // perspective, translate, rotate
    
    glm::mat4 transform(glm::vec2 const& Orientation, glm::vec3 const& Translate, glm::vec3 const& Up)
    {
        glm::mat4 Proj = glm::perspective(glm::radians(45.f), 1.33f, 0.1f, 10.f);
        glm::mat4 ViewTranslate = glm::translate(glm::mat4(1.f), Translate);
        glm::mat4 ViewRotateX = glm::rotate(ViewTranslate, Orientation.y, Up);
        glm::mat4 View = glm::rotate(ViewRotateX, Orientation.x, Up);
        glm::mat4 Model = glm::mat4(1.0f);
        return Proj * View * Model;
    }
  5. Comply with ARCore User Privacy Requirements

    main

    You must prominently disclose the use of ARCore and its data processing practices within your application. A recommended way to do this is by adding the following text to your main menu or notice screen:

    "This application runs on Google Play Services for AR (ARCore), which is provided by Google LLC and governed by the Google Privacy Policy".

    For more details, see the User privacy requirements.

  6. Report GLM bugs with configuration details

    main

    When reporting bugs on GitHub, provide a minimal reproduction code. To help maintainers diagnose configuration-specific issues, define GLM_FORCE_MESSAGES before including GLM headers. This will cause GLM to output its current configuration (version, compiler, platform, and active feature flags) during build.

    #define GLM_FORCE_MESSAGES
    #include "third_party/glm/latest/glm/glm.hpp"