### Start Local Webserver (Python) Source: https://github.com/odin-lang/examples/blob/master/wasm/js_wasm32/README.md Command to start a local HTTP server using Python, necessary for serving the web assets required by the `js_wasm32` Odin example. Navigate to the `web` directory first. ```bash cd web python -m http.server ``` -------------------------------- ### Start Local Webserver (Node.js) Source: https://github.com/odin-lang/examples/blob/master/wasm/js_wasm32/README.md Command to start a local HTTP server using Node.js (`npx http-server`), required for serving the web assets for the `js_wasm32` Odin example. Navigate to the `web` directory first. ```bash cd web npx http-server -p 8000 . ``` -------------------------------- ### Run Raylib Example (Odin) Source: https://github.com/odin-lang/examples/blob/master/raylib/ports/README.md Demonstrates the correct procedure to run an Odin-based Raylib example. It requires navigating to the example's directory and using the `-file` flag for proper execution and resource loading. ```shell cd shaders odin run shaders_mesh_instancing.odin -file ``` -------------------------------- ### Odin Metal Imports Source: https://github.com/odin-lang/examples/blob/master/metal/learn_metal/README.md Demonstrates the necessary Odin imports to utilize the Metal framework, along with Foundation and QuartzCore for broader macOS/iOS development. These imports provide access to the native Metal APIs within Odin. ```odin import NS "vendor:darwin/Foundation" import MTL "vendor:darwin/Metal" import CA "vendor:darwin/QuartzCore" ``` -------------------------------- ### Run Odin Project Source: https://github.com/odin-lang/examples/blob/master/absolute_beginners/README.md Command to compile and run the Odin project from the current directory. Requires the Odin toolchain to be installed and configured. ```shell odin run . ``` -------------------------------- ### Compile and Run Odin Example Source: https://github.com/odin-lang/examples/blob/master/vulkan/triangle_glfw/README.md Command to compile and execute the main Odin program for the Vulkan triangle example. Assumes the Odin compiler is installed and the project is in the current directory. ```shell odin run . ``` -------------------------------- ### Odin Build Linker Flags Source: https://github.com/odin-lang/examples/blob/master/metal/learn_metal/README.md Provides the command-line argument for the Odin build tool to include specific linker flags. This is often required when linking against libraries installed via package managers like Homebrew, ensuring the Odin executable can find necessary system libraries. ```shell odin build . -extra-linker-flags:"-L/opt/homebrew/lib" ``` -------------------------------- ### Generate images.odin using Odin Source: https://github.com/odin-lang/examples/blob/master/code_generation/README.md Builds and runs a separate Odin program responsible for generating the `images.odin` file, which likely contains image metadata definitions. ```shell odin run generate_image_info ``` -------------------------------- ### Connect with Telnet Source: https://github.com/odin-lang/examples/blob/master/net/tcp_echo_server/README.md Example command to connect to the echo server using telnet. ```bash telnet 127.0.0.1 8080 ``` -------------------------------- ### Build and Run Main Odin Program Source: https://github.com/odin-lang/examples/blob/master/code_generation/README.md Builds and executes the main Odin program that utilizes the generated `images.odin` file to process image information, printing output related to image dimensions and sizes. ```shell odin run . ``` -------------------------------- ### Initialize WGPU and Run MicroUI with Odin Source: https://github.com/odin-lang/examples/blob/master/wgpu/microui/web/index.html This JavaScript code initializes a WebAssembly memory object and sets up the necessary interfaces for Wasm memory and WGPU. It then executes the 'microui.wasm' application, passing the WGPU interface and memory configuration. ```javascript const mem = new WebAssembly.Memory({ initial: 2000, maximum: 65536, shared: false }); const memInterface = new odin.WasmMemoryInterface(); memInterface.setMemory(mem); const wgpuInterface = new odin.WebGPUInterface(memInterface); odin.runWasm("microui.wasm", null, { wgpu: wgpuInterface.getInterface() }, memInterface, /*intSize=8*/); ``` -------------------------------- ### Initialize WebGPU Interface in JavaScript Source: https://github.com/odin-lang/examples/blob/master/wgpu/sdl3-triangle/web/index.html This snippet demonstrates the JavaScript code required to initialize the WebAssembly memory and the Odin WebGPU interface. It sets up the necessary components to interact with WebGPU from a WebAssembly module compiled by Odin. ```javascript const mem = new WebAssembly.Memory({ initial: 2000, maximum: 65536, shared: false }); const memInterface = new odin.WasmMemoryInterface(); memInterface.setMemory(mem); const wgpuInterface = new odin.WebGPUInterface(memInterface); odin.runWasm("triangle.wasm", null, { wgpu: wgpuInterface.getInterface() }, memInterface, /*intSize=8*/); ``` -------------------------------- ### Build Odin WASM Module Source: https://github.com/odin-lang/examples/blob/master/wasm/js_wasm32/README.md Instructions for building the WASM module using Odin's `js_wasm32` target. This process also involves copying the `odin.js` file, which is essential for `js_wasm32` builds. ```bash build.bat build.sh ``` -------------------------------- ### Initialize WebGPU Interface in JavaScript Source: https://github.com/odin-lang/examples/blob/master/wgpu/glfw-triangle/web/index.html This snippet demonstrates the JavaScript code required to initialize the WebAssembly memory and the Odin WebGPU interface. It sets up the necessary components to interact with WebGPU from a WebAssembly module compiled by Odin. ```javascript const mem = new WebAssembly.Memory({ initial: 2000, maximum: 65536, shared: false }); const memInterface = new odin.WasmMemoryInterface(); memInterface.setMemory(mem); const wgpuInterface = new odin.WebGPUInterface(memInterface); odin.runWasm("triangle.wasm", null, { wgpu: wgpuInterface.getInterface() }, memInterface, /*intSize=8*/); ``` -------------------------------- ### Compile Fragment Shader Source: https://github.com/odin-lang/examples/blob/master/vulkan/triangle_glfw/README.md Command to compile a GLSL fragment shader (`shader.frag`) into SPIR-V bytecode (`frag.spv`) using `glslc`. This is necessary if changes are made to the shader source file. ```shell glslc shader.frag -o frag.spv ``` -------------------------------- ### Compile Vertex Shader Source: https://github.com/odin-lang/examples/blob/master/vulkan/triangle_glfw/README.md Command to compile a GLSL vertex shader (`shader.vert`) into SPIR-V bytecode (`vert.spv`) using `glslc`. This is necessary if changes are made to the shader source file. ```shell glslc shader.vert -o vert.spv ``` -------------------------------- ### Run Odin Echo Server Source: https://github.com/odin-lang/examples/blob/master/net/tcp_echo_server/README.md Command to compile and run the Odin echo server application. ```bash odin run server ``` -------------------------------- ### Run Odin Echo Client Source: https://github.com/odin-lang/examples/blob/master/net/tcp_echo_server/README.md Command to compile and run the Odin echo client application. ```bash odin run client ```