Skip to content
trailcodePublic

About

CMake + Dear ImGui + OpenGL/WebGL2 + GLM template with Emscripten support

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

emgui

Minimal template app: CMake, Dear ImGui, OpenGL (desktop) / WebGL2 (Emscripten), GLM, and a hardcoded colored triangle.

NuGet supplies GLFW/GLEW on MSVC; ImGui is vendored under third_party/.

Tech stack

Piece Location
Dear ImGui (+ GLFW/OpenGL3 backends) third_party/imgui/ (vendored copy)
GLM third_party/glm/
GLFW + GLEW (native) NuGet via CMake (MSVC)

ImGui Emscripten HiDPI patch

third_party/imgui/imgui_impl_glfw.cpp includes the physical-pixel canvas sizing from imgui#7519. Details: third_party/imgui/PATCHES.md.

Native build (Windows / MSVC)

Requires CMake, a C++20 compiler, and nuget on PATH for GLFW/GLEW (choco install nuget.commandline).

cmake -S . -B build -G "Visual Studio 17 2022" -A x64
cmake --build build --config Release
.\build\Release\emgui.exe

Emscripten build

Uses emsdk. This repo assumes it lives at C:\src\emsdk.

# Activate the toolchain (same shell for the rest)
. C:\src\emsdk\emsdk_env.ps1

# Configure + build (Ninja recommended)
emcmake cmake -S . -B build-em -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build-em

# Serve the build output (needs a local HTTP server; file:// will not work for Wasm)
python -m http.server 8000 --directory build-em

Open http://localhost:8000/emgui.html — that is the generated page (emcc fills in the shell).

Debug (source maps):

emcmake cmake -S . -B build-em -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build build-em

Layout

cmake/modules/    FindGLFW3 / FindGLEW (native)
src/              main + triangle renderer
third_party/      imgui, glm
web/shell.html    Emscripten HTML shell template (used via --shell-file)

About

CMake + Dear ImGui + OpenGL/WebGL2 + GLM template with Emscripten support

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages