The first program - drawing a triangle (1)

    In the previous article,  I gave a brief introduction to Filament in general. I learned that Filament is a small but very

Efficient rendering engine. Like HelloWorld in the early stages of learning other programs, in this chapter we begin to introduce how to use Filament

Draw a simple triangle.

    Before we start drawing triangles, there are several important concepts in Filament that we will briefly explain:

Engine It can be understood as the program entry point of Filament, which is mainly used to track all resources created by users, manage rendering threads and hardware rendering.
Renderer Can be understood as the window of the operating system
SwapChain Can be understood as a drawable canvas of the operating system
View         Used to save drawable objects and their related information. A View is associated with a Scene.
Scene It can be understood as a container, containing lighting and drawable entity information.
Camera Camera information includes projection matrix information and its exposure value parameters

    Before starting to draw, the first thing we have to do is to prepare the environment. On the Android platform we develop APP, mainly using

Android Studio is an IDE. All we have to do is add the required dependent library files to the compiled file:

dependencies {
    implementation 'com.google.android.filament:filament-android:1.27.1'
    implementation 'com.google.android.filament:filament-utils-android:1.27.1'
    implementation 'com.google.android.filament:gltfio-android:1.27.1'
    implementation 'com.google.android.filament:filamat-android:1.27.1'
}

    The dependencies cited above have version information. Filament is currently being updated. The latest version currently (2023-01-31) is

v1.31.2. After adding the dependencies, we can develop in the Android Studio project. on Android platform

The first thing to do when using Filament is to call:

Filament.init()

    Its function is to initialize the engine environment, mainly loading the so library. Let's take a look at the specific implementation:

<

Guess you like

Origin blog.csdn.net/jake9602/article/details/128743674