My step by step guides for SDL3 to build for Android and WebAssembly

GLM in the browser

GLM is a header only library for linear algebra. You can copy source code of this library to your project directory (where main.cpp is placed). Copy and paste the glm folder.

#define GLM_FORCE_PURE
#include "glm/glm.hpp"
// First vector
glm::vec3 v1 = glm::vec3(1.f, 2.f, 3.f);
std::cout << "v1 = (" << v1.x << ", " << v1.y << ", " << v1.z << ")" << std::endl;
// Second vector
glm::vec3 v2 = glm::vec3(5.f, 6.f, 7.f);
std::cout << "v2 = (" << v2.x << ", " << v2.y << ", " << v2.z << ")" << std::endl;
// Sum of the vectors
glm::vec3 result = v1 + v2;
float x = result.x;
float y = result.y;
float z = result.z;
std::cout << "v1 + v2 = (" << x << ", " << y << ", " << z << ")" << std::endl;

Output:

v1 = (1, 2, 3)
v2 = (5, 6, 7)
v1 + v2 = (6, 8, 10)