To create a new sample based on the existing hellotriangle template, follow these steps:
- Prepare Directory:
- Navigate to
samples/. - Create a new directory (e.g.,
newsample). - Copy the template files:
cp -r hellotriangle/{CMakeLists.txt,app,build.gradle,settings.gradle} newsample/.
- Update Configuration:
- Add
add_subdirectory(newsample) to the root samples/CMakeLists.txt. - Update the
add_sample section in samples/CMakeLists.txt. - Update the package name in
newsample/app/AndroidManifest.xml. - Update resources in
newsample/app/res/values/strings.xml.
- Organize Files:
- Source files:
newsample/ - GLSL shaders:
newsample/shaders - General assets:
newsample/assets
cd samples
# add_subdirectory(newsample) in CMakeLists.txt
mkdir newsample
cp -r hellotriangle/{CMakeLists.txt,app,build.gradle,settings.gradle} newsample/
# Edit CMakeLists.txt, AndroidManifest.xml, and strings.xml