### Build Example with Visual Studio CLI (64-bit)
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_sdl2_opengl3/README.md
Compile the ImGui example using the Visual Studio command-line compiler for a 64-bit executable. Ensure SDL2_DIR is set to your SDL2 installation path.
```batch
cl /Zi /MD /utf-8 /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
```
--------------------------------
### Build Example with Visual Studio CLI (Windows 64-bit)
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_sdl2_sdlrenderer2/README.md
Compile the example on Windows using the Visual Studio command-line interface for a 64-bit build. Ensure SDL2_DIR is set to your SDL2 installation path.
```batch
cl /Zi /MD /utf-8 /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_sdlrenderer2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_sdlrenderer.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib /subsystem:console
```
--------------------------------
### Build imgui Example with SDL2/OpenGL2 on Windows (CLI)
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_sdl2_opengl2/README.md
Use this command to build the example on Windows via the command line. Ensure SDL2_DIR is set to your SDL2 installation path. Adjust lib path for 32-bit or 64-bit compilation.
```bash
set SDL2_DIR=path_to_your_sdl2_folder
cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
```
```bash
cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
```
--------------------------------
### Build Example with Visual Studio CLI (Windows 32-bit)
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_sdl2_sdlrenderer2/README.md
Compile the example on Windows using the Visual Studio command-line interface for a 32-bit build. Ensure SDL2_DIR is set to your SDL2 installation path.
```batch
set SDL2_DIR=path_to_your_sdl2_folder
cl /Zi /MD /utf-8 /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_sdlrenderer2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_sdlrenderer.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib /subsystem:console
```
--------------------------------
### Build Example with Visual Studio CLI (32-bit)
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_sdl2_opengl3/README.md
Compile the ImGui example using the Visual Studio command-line compiler for a 32-bit executable. Ensure SDL2_DIR is set to your SDL2 installation path.
```batch
set SDL2_DIR=path_to_your_sdl2_folder
cl /Zi /MD /utf-8 /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
```
--------------------------------
### Build imgui Example with SDL2/OpenGL2 on Mac OS X (CLI)
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_sdl2_opengl2/README.md
Build the example on macOS. Requires Homebrew to install SDL2. Links against SDL2 and OpenGL frameworks.
```bash
brew install sdl2
c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl
```
--------------------------------
### Build ImGui Example on Windows with MSVC (64-bit)
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_sdl3_opengl3/README.md
Compile the ImGui example using MSVC on Windows for a 64-bit executable. Ensure SDL3_DIR is set to your SDL3 installation path.
```batch
cl /Zi /MD /utf-8 /I.. /I..\.. /I%SDL3_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp /FeDebug/example_sdl3_opengl3.exe /FoDebug/ /link /libpath:%SDL3_DIR%\lib\x64 SDL3.lib SDL2mainopengl32.lib /subsystem:console
```
--------------------------------
### Setup Linux Environment for GPUPixel
Source: https://github.com/pixpark/gpupixel/blob/main/docs/docs/en/guide/build.md
Run this script to install necessary dependencies for building GPUPixel on Debian or Ubuntu systems.
```bash
./script/setup_env_linux.sh
```
--------------------------------
### Build ImGui Example on Windows with MSVC (32-bit)
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_sdl3_opengl3/README.md
Compile the ImGui example using MSVC on Windows for a 32-bit executable. Ensure SDL3_DIR is set to your SDL3 installation path.
```batch
set SDL3_DIR=path_to_your_sdl3_folder
cl /Zi /MD /utf-8 /I.. /I..\.. /I%SDL3_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp /FeDebug/example_sdl3_opengl3.exe /FoDebug/ /link /libpath:%SDL3_DIR%\lib\x86 SDL3.lib opengl32.lib /subsystem:console
```
--------------------------------
### Build Example on Mac OS X
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_sdl2_sdlrenderer2/README.md
Compile the example on macOS. This command requires SDL2 to be installed via Homebrew and uses `sdl2-config` for flags, linking against the OpenGL framework.
```c++
brew install sdl2
c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_sdlrenderer2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl
```
--------------------------------
### Build Example with g++ on macOS
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_sdl2_opengl3/README.md
Compile the ImGui example using g++ on macOS. This command requires sdl2 to be installed via Homebrew and links against OpenGL and CoreFoundation frameworks.
```bash
brew install sdl2
c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends \
main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_opengl3.cpp ../../imgui*.cpp \
`sdl2-config --libs` -framework OpenGl -framework CoreFoundation
```
--------------------------------
### Release build and install with CMake
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/libyuv/docs/getting_started.md
Configures a Release build for libyuv with a specified installation prefix, builds the project, and then installs it.
```bash
mkdir out
cd out
cmake -DCMAKE_INSTALL_PREFIX="/usr/lib" -DCMAKE_BUILD_TYPE="Release" ..
cmake --build . --config Release
sudo cmake --build . --target install --config Release
```
--------------------------------
### Example .gclient file configuration
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/libyuv/docs/getting_started.md
This is an example of a .gclient file configuration for fetching libyuv. It specifies the source URL and other managed properties.
```python
solutions = [
{ "name" : "src",
"url" : "https://chromium.googlesource.com/libyuv/libyuv",
"deps_file" : "DEPS",
"managed" : True,
"custom_deps" : {
},
"safesync_url": "",
},
];
```
--------------------------------
### Build ImGui Allegro5 Example on Windows with Visual Studio CLI
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_allegro5/README.md
Compile the ImGui Allegro5 example using the Visual Studio command-line compiler (cl). Set the ALLEGRODIR environment variable to your Allegro 5 installation path. The IMGUI_USER_CONFIG macro should be defined to include imconfig_allegro5.h.
```batch
set ALLEGRODIR=path_to_your_allegro5_folder
cl /Zi /MD /utf-8 /I %ALLEGRODIR%\include /DIMGUI_USER_CONFIG="examples/example_allegro5/imconfig_allegro5.h" /I .. /I ..\.. /I ..\..\backends main.cpp ..\..\backends\imgui_impl_allegro5.cpp ..\..\imgui*.cpp /link /LIBPATH:%ALLEGRODIR%\lib allegro-5.0.10-monolith-md.lib user32.lib
```
--------------------------------
### C++ Example: SDL Visual Studio Project
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/CHANGELOG.txt
Updates the Visual Studio project files (`.vcxproj`) for the SDL example to use `%SDL2_DIR%` instead of `%SDL_DIR%`. This aligns with the more standard SDL2 directory variable, simplifying project setup and dependency management.
```xml
$(ProgramFiles)\SDL2-devel\
$(SDL2_DIR)\include;$(IncludePath)
$(SDL2_DIR)\lib\x64;$(LibraryPath)
```
--------------------------------
### Example .gclient Configuration
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/libyuv/docs/deprecated_builds.md
An example of a .gclient file configuration for the libyuv project. This file specifies the repository URL and other settings for gclient.
```python
solutions = [
{
"name" : "libyuv",
"url" : "https://chromium.googlesource.com/libyuv/libyuv",
"deps_file" : "DEPS",
"managed" : True,
"custom_deps" : {
},
"safesync_url": "",
},
];
```
--------------------------------
### Simplified OpenGL3 Vertex Buffer Setup (C++)
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/CHANGELOG.txt
The OpenGL3 example has been simplified to use `glBufferData` for vertex data, similar to how index data is handled. This streamlines the vertex buffer setup process.
```cpp
// Simplified code using glBufferData for vertices
glBufferData(GL_ARRAY_BUFFER, draw_data->TotalVtxCount * sizeof(ImDrawVert), NULL, GL_DYNAMIC_DRAW);
```
--------------------------------
### Build imgui Example with SDL2/OpenGL2 on Linux (CLI)
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_sdl2_opengl2/README.md
Compile the example on Linux using sdl2-config for flags and libraries. Links against SDL2 and OpenGL.
```bash
c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL
```
--------------------------------
### C++ Example: DirectX12 Backend
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/CHANGELOG.txt
Provides a complete DirectX 12 backend example for ImGui. This includes necessary setup, rendering loop integration, and device management specific to DirectX 12, enabling ImGui rendering within a DirectX 12 application.
```c++
// Example setup for DirectX 12 backend (simplified)
// ... Initialize DirectX 12 Device, Command Queue, etc. ...
// ImGui_ImplDX12_Init(pDevice, NUM_FRAMES_IN_FLIGHT, backBufferFormat, pDescriptorHeap, ...);
// ... Main render loop ...
// ImGui_ImplDX12_NewFrame();
// ImGui::NewFrame();
// ImGui::Render();
// ImGui_ImplDX12_RenderDrawData(ImGui::GetDrawData());
// ... Present frame ...
// ImGui_ImplDX12_Shutdown();
```
--------------------------------
### Add SDL + SDL_Renderer example
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/CHANGELOG.txt
Includes a new example demonstrating the integration of ImGui with SDL and the SDL_Renderer backend. This example is located in the `examples/example_sdl_sdlrenderer/` folder.
```c++
// Examples: Added SDL + SDL_Renderer example in "examples/example_sdl_sdlrenderer/" folder. (#3926) [@1bsyl]
```
--------------------------------
### Example Applications: Default Nav Flags
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/CHANGELOG.txt
Updated all example applications to enable ImGuiConfigFlags_NavEnableKeyboard and ImGuiConfigFlags_NavEnableGamepad by default. This improves navigation support out-of-the-box.
```c++
ImGuiIO& io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
// ...
```
--------------------------------
### Example Applications
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/CHANGELOG.txt
Includes new example applications for various platforms to demonstrate ImGui integration. These examples cover SDL2, iOS, and Allegro 5, showcasing different rendering backends and input handling methods.
```c++
// SDL2 Example
// int main(int argc, char** argv) { ... return 0; }
// iOS Example
// (Requires Objective-C integration)
// Allegro 5 Example
// int main(int argc, char **argv) { ... return 0; }
```
--------------------------------
### Install Project Headers
Source: https://github.com/pixpark/gpupixel/blob/main/src/CMakeLists.txt
Installs the project's header files from the 'include' directory to the 'include' destination in the installation path.
```cmake
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include)
```
--------------------------------
### Consolidate Apple+Metal Example Implementation
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/CHANGELOG.txt
The Apple+Metal example has been consolidated and simplified to align more closely with other example implementations. This streamlines the Metal backend example.
```c++
Apple+Metal;
```
--------------------------------
### Build and Install libyuv with cmake (Release)
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/libyuv/docs/deprecated_builds.md
Perform a release build and installation of libyuv using cmake. This command specifies the installation prefix, build type, and then builds and installs the project.
```bash
mkdir out
cd out
cmake -DCMAKE_INSTALL_PREFIX="/usr/lib" -DCMAKE_BUILD_TYPE="Release" ..
cmake --build . --config Release
sudo cmake --build . --target install --config Release
```
--------------------------------
### Install Project Library
Source: https://github.com/pixpark/gpupixel/blob/main/src/CMakeLists.txt
Installs the main library target, specifying destinations for archive, library, runtime (DLLs on Windows), and framework files.
```cmake
install(
TARGETS ${gpupixel_libs_name}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib # win dll install lib
FRAMEWORK DESTINATION lib)
```
--------------------------------
### Install Allegro5 on Windows with vcpkg
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_allegro5/README.md
Use vcpkg to install Allegro5 for either 32-bit or 64-bit Windows. After installation, integrate vcpkg with Visual Studio for easier library and include path management.
```bash
git clone https://github.com/Microsoft/vcpkg
cd vcpkg
bootstrap-vcpkg.bat
vcpkg install allegro5 --triplet=x86-windows ; for win32
vcpkg install allegro5 --triplet=x64-windows ; for win64
vcpkg integrate install ; register include / libs in Visual Studio
```
--------------------------------
### Build ImGui Example on macOS
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_sdl3_opengl3/README.md
Compile the ImGui example on macOS using clang. This command uses sdl3-config and links against the OpenGL and CoreFoundation frameworks.
```bash
brew install sdl3
c++ `sdl3-config --cflags` -I .. -I ../.. -I ../../backends \
main.cpp ../../backends/imgui_impl_sdl3.cpp ../../backends/imgui_impl_opengl3.cpp ../../imgui*.cpp \
`sdl3-config --libs` -framework OpenGl -framework CoreFoundation
```
--------------------------------
### Console Example Standard Memory Allocation
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/CHANGELOG.txt
The Console example has been updated to use standard `malloc`/`free` instead of custom allocators, making it a more straightforward copy-pasteable example.
```c++
char* buffer = (char*)malloc(size);
// ... use buffer ...
free(buffer);
```
--------------------------------
### Example Gamepad Mapping
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/glfw/docs/input.dox
This is an example of a gamepad mapping configuration. Real gamepad mappings must be a single line.
```unparsed
78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,
b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,
rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,
righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,
```
--------------------------------
### Install Wayland and xkbcommon development packages on FreeBSD
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/glfw/docs/compile.dox
Installs the Wayland, libxkbcommon, and related packages on FreeBSD, which are necessary for compiling GLFW with Wayland support.
```shell
pkg install wayland libxkbcommon wayland-protocols evdev-proto kf5-extra-cmake-modules
```
--------------------------------
### Build Example on Linux/Unix
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_sdl2_sdlrenderer2/README.md
Compile the example on Linux or similar Unix-like systems using g++. This command utilizes `sdl2-config` to automatically determine include paths and libraries.
```c++
c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_sdlrenderer2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL
```
--------------------------------
### Creating an ImGui Window with Menu and Widgets
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/README.md
Shows how to create a window with a menu bar, including file operations like Open, Save, and Close. It also demonstrates using color pickers, plotting data, and creating scrollable child regions within the window. The window can be controlled by a boolean flag.
```cpp
// Create a window called "My First Tool", with a menu bar.
ImGui::Begin("My First Tool", &my_tool_active, ImGuiWindowFlags_MenuBar);
if (ImGui::BeginMenuBar())
{
if (ImGui::BeginMenu("File"))
{
if (ImGui::MenuItem("Open..", "Ctrl+O")) { /* Do stuff */ }
if (ImGui::MenuItem("Save", "Ctrl+S")) { /* Do stuff */ }
if (ImGui::MenuItem("Close", "Ctrl+W")) { my_tool_active = false; }
ImGui::EndMenu();
}
ImGui::EndMenuBar();
}
// Edit a color stored as 4 floats
ImGui::ColorEdit4("Color", my_color);
// Generate samples and plot them
float samples[100];
for (int n = 0; n < 100; n++)
samples[n] = sinf(n * 0.2f + ImGui::GetTime() * 1.5f);
ImGui::PlotLines("Samples", samples, 100);
// Display contents in a scrolling region
ImGui::TextColored(ImVec4(1,1,0,1), "Important Stuff");
ImGui::BeginChild("Scrolling");
for (int n = 0; n < 50; n++)
ImGui::Text("%04d: Some text", n);
ImGui::EndChild();
ImGui::End();
```
--------------------------------
### Configure GLFW Subdirectory
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_glfw_vulkan/CMakeLists.txt
Includes the GLFW library as a subdirectory, setting its path and disabling examples, tests, docs, and installation.
```cmake
if(NOT GLFW_DIR)
set(GLFW_DIR ../../../glfw) # Set this to point to an up-to-date GLFW repo
endif()
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF)
option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF)
option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF)
option(GLFW_INSTALL "Generate installation target" OFF)
option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF)
add_subdirectory(${GLFW_DIR} binary_dir EXCLUDE_FROM_ALL)
include_directories(${GLFW_DIR}/include)
```
--------------------------------
### Build Example with g++ on Linux/Unix
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_sdl2_opengl3/README.md
Compile the ImGui example using g++ on Linux or similar Unix systems. This command utilizes sdl2-config for flags and libraries.
```bash
c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends \
main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_opengl3.cpp ../../imgui*.cpp \
`sdl2-config --libs` -lGL -ldl
```
--------------------------------
### Load and Use OpenGL Extensions
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/glfw/docs/context.dox
This example demonstrates how to combine checking for extension support and fetching function pointers to safely use extension functions. It includes a flag to track extension availability and a function to load extensions.
```c
#define GLFW_INCLUDE_GLEXT
#include
#define glSpecializeShaderARB pfnSpecializeShaderARB
PFNGLSPECIALIZESHADERARBPROC pfnSpecializeShaderARB;
// Flag indicating whether the extension is supported
int has_ARB_gl_spirv = 0;
void load_extensions(void)
{
if (glfwExtensionSupported("GL_ARB_gl_spirv"))
{
pfnSpecializeShaderARB = (PFNGLSPECIALIZESHADERARBPROC)
glfwGetProcAddress("glSpecializeShaderARB");
has_ARB_gl_spirv = 1;
}
}
void some_function(void)
{
if (has_ARB_gl_spirv)
{
// Now the extension function can be called as usual
glSpecializeShaderARB(...);
}
}
```
--------------------------------
### Configure GLFW Window Management Library
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/CMakeLists.txt
Configures the GLFW library for cross-platform window and input management. Examples and tests are disabled, and installation is turned off. An alias is created for convenience.
```cmake
set(GLFW_BUILD_EXAMPLES
OFF
CACHE BOOL "Disable building GLFW examples")
set(GLFW_BUILD_TESTS
OFF
CACHE BOOL "Disable building GLFW tests")
set(GLFW_INSTALL
OFF
CACHE BOOL "Disable GLFW installation")
add_subdirectory(glfw EXCLUDE_FROM_ALL)
add_library(glfw::glfw ALIAS glfw)
```
--------------------------------
### C++ Code Style Example
Source: https://github.com/pixpark/gpupixel/blob/main/docs/docs/en/guide/contributing.md
Demonstrates adherence to the Google C++ Style Guide with specific modifications for GPUPixel, including class naming, constant declaration, and method implementation.
```cpp
class MyClass {
public:
void doSomething(const std::string& inputParam) {
if (inputParam.empty()) {
return;
}
int someValue = calculateValue(inputParam);
processResult(someValue);
}
private:
static const int MAX_VALUE = 100;
std::string className_;
};
```
--------------------------------
### Dear ImGui Integration Steps
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/EXAMPLES.md
Outlines the essential function calls required for integrating Dear ImGui into an application at initialization, frame start, frame end, and shutdown. Assumes standard backends are used.
```cpp
At initialization:
call ImGui::CreateContext()
call ImGui_ImplXXXX_Init() for each backend.
At the beginning of your frame:
call ImGui_ImplXXXX_NewFrame() for each backend.
call ImGui::NewFrame()
At the end of your frame:
call ImGui::Render()
call ImGui_ImplXXXX_RenderDrawData() for your Renderer backend.
At shutdown:
call ImGui_ImplXXXX_Shutdown() for each backend.
call ImGui::DestroyContext()
```
--------------------------------
### Build ImGui Example on Linux/Unix
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_sdl3_opengl3/README.md
Compile the ImGui example on Linux or similar Unix-like systems using g++. This command uses sdl3-config to fetch compiler and linker flags.
```bash
c++ `sdl3-config --cflags` -I .. -I ../.. -I ../../backends \
main.cpp ../../backends/imgui_impl_sdl3.cpp ../../backends/imgui_impl_opengl3.cpp ../../imgui*.cpp \
`sdl3-config --libs` -lGL -ldl
```
--------------------------------
### iOS Examples: Missing Files Fix
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/CHANGELOG.txt
Corrects an issue in the iOS project setup where certain files were missing, ensuring the project builds and runs correctly on iOS.
```c++
Examples: iOS: fixed missing files in project.
```
--------------------------------
### Build GPUPixel Project
Source: https://github.com/pixpark/gpupixel/blob/main/docs/docs/en/guide/contributing.md
Instructions for cloning the repository, creating a build directory, and compiling the project using CMake and Make.
```bash
git clone https://github.com/YOUR_USERNAME/gpupixel.git
cd gpupixel
mkdir build && cd build
cmake ..
make
```
--------------------------------
### Get Main Viewport Information in ImGui
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/CHANGELOG.txt
Demonstrates how to retrieve viewport information using ImGui::GetMainViewport(). This is crucial for multi-viewport and multi-monitor setups. It provides access to the host window's position, size, and work area, adapting to different configurations.
```cpp
ImGuiViewport* main_viewport = ImGui::GetMainViewport();
// Access position: main_viewport->Pos
// Access size: main_viewport->Size
// Access work area position: main_viewport->WorkPos
// Access work area size: main_viewport->WorkSize
```
--------------------------------
### Continuous Integration with GitHub Actions for ImGui
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/CHANGELOG.txt
This snippet describes the setup of continuous integration tests for ImGui using GitHub Actions. It outlines that various example applications are now compiled on multiple platforms including Windows, Linux, MacOS, iOS, and Emscripten, replacing the Travis integration.
```YAML
# CI: Set up a bunch of continuous-integration tests using GitHub Actions.
# We now compile many of the example applications on Windows, Linux, MacOS, iOS, Emscripten.
# Removed Travis integration. (#2865)
```
--------------------------------
### Build ImGui Allegro5 Example on Ubuntu/macOS
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/examples/example_allegro5/README.md
Compile the ImGui Allegro5 example using g++. Ensure IMGUI_USER_CONFIG is set to point to imconfig_allegro5.h for 32-bit index support. Allegro libraries are required.
```bash
g++ -DIMGUI_USER_CONFIG="examples/example_allegro5/imconfig_allegro5.h" -I .. -I ../.. -I ../../backends main.cpp ../../backends/imgui_impl_allegro5.cpp ../../imgui*.cpp -lallegro -lallegro_main -lallegro_primitives -o allegro5_example
```
--------------------------------
### OpenGL Example Enhancements in ImGui
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/CHANGELOG.txt
Details improvements made to the OpenGL examples, including the addition of a "Fixed overlay" example, the re-inclusion of a programmable-pipeline example alongside the fixed-pipeline one, and the ability for OpenGL examples to resize the application window.
```c++
// Examples: Added a "Fixed overlay" example in ShowTestWindow().
// Examples: Re-added OpenGL 3 programmable-pipeline example (along with the existing fixed pipeline example).
// Examples: OpenGL examples can now resize the application window.
```
--------------------------------
### Backend and Example Changes
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/CHANGELOG.txt
Summary of changes affecting different backends (GLFW, WebGPU) and examples (Vulkan), including configuration and resource management.
```APIDOC
## Backend and Example Updates
### General Backend
- **`IMGUI_DISABLE` Macro**: All backend source files now support the global `IMGUI_DISABLE` macro for disabling backend functionality. (#6601)
### GLFW Backend
- **Mouse Data Handling**: Reverted the change that ignored mouse data when `GLFW_CURSOR_DISABLED`. Users can now choose to ignore mouse input by setting `ImGuiConfigFlags_NoMouse`. (#5625, #6609)
### WebGPU Backend
- **Dawn Update**: Updated to accommodate recent changes in the Dawn WebGPU implementation. (#6602, #6188)
### Vulkan Example
- **Descriptor Pool Optimization**: Minimal descriptor pools are now created to fit only the resources needed by the example. (#6642)
```
--------------------------------
### DirectX Example Applications in ImGui
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/CHANGELOG.txt
Notes the addition of a DirectX11 example application and fixes to the DirectX9 example, such as correcting the initial display of an hourglass cursor. The solution file for all example projects has also been consolidated.
```c++
// Examples: Added DirectX11 example application.
// Examples: Created single .sln solution for all example projects.
// Examples: Fixed DirectX9 example window initially showing an hourglass cursor.
```
--------------------------------
### Installing GLFW Files
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/glfw/CMakeLists.txt
Installs GLFW header files, CMake configuration files, pkg-config files, and generates an uninstall target if the GLFW_INSTALL option is enabled. The library itself is installed by its own CMakeLists.txt.
```cmake
if (GLFW_INSTALL)
install(DIRECTORY include/GLFW DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h)
install(FILES "${GLFW_BINARY_DIR}/src/glfw3Config.cmake"
"${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake"
DESTINATION "${GLFW_CONFIG_PATH}")
install(EXPORT glfwTargets FILE glfw3Targets.cmake
EXPORT_LINK_INTERFACE_LIBRARIES
DESTINATION "${GLFW_CONFIG_PATH}")
install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
if (NOT TARGET uninstall)
configure_file(cmake_uninstall.cmake.in
cmake_uninstall.cmake IMMEDIATE @ONLY)
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P
"${GLFW_BINARY_DIR}/cmake_uninstall.cmake")
set_target_properties(uninstall PROPERTIES FOLDER "GLFW3")
endif()
endif()
```
--------------------------------
### Add Emscripten 'make serve' Helper
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/CHANGELOG.txt
A 'make serve' helper has been added to the Emscripten examples, which spawns a web server on localhost. This simplifies local testing of Emscripten-compiled applications.
```makefile
make serve;
```
--------------------------------
### Prepare RISC-V toolchain and QEMU
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/libyuv/docs/getting_started.md
Downloads and builds the RISC-V clang toolchain and QEMU emulator, necessary for cross-compiling and running RISC-V targets.
```bash
./riscv_script/prepare_toolchain_qemu.sh
```
--------------------------------
### Install Dependencies for Arm Cross Compile
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/libyuv/docs/getting_started.md
Installs essential packages for Arm cross-compilation on Debian-based systems.
```bash
sudo apt-get install ssh dkms build-essential linux-headers-generic
sudo apt-get install kdevelop cmake git subversion
sudo apt-get install graphviz doxygen doxygen-gui
sudo apt-get install manpages manpages-dev manpages-posix manpages-posix-dev
sudo apt-get install libboost-all-dev libboost-dev libssl-dev
sudo apt-get install rpm terminator fish
sudo apt-get install g++-arm-linux-gnueabihf gcc-arm-linux-gnueabihf
```
--------------------------------
### Android Example Build Fix
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/imgui/docs/CHANGELOG.txt
Resolves an issue with the Android example build process for Gradle 8, ensuring that examples can be compiled and run successfully on the latest Gradle versions.
```gradle
// Examples: Android: Fixed example build for Gradle 8. (#6229, #6227)
```
--------------------------------
### Install Model Resource Files
Source: https://github.com/pixpark/gpupixel/blob/main/src/CMakeLists.txt
Installs model resource files to the 'models' destination and assigns them to the 'resource' component.
```cmake
install(
FILES ${lib_models_resource_files}
DESTINATION models
COMPONENT resource)
```
--------------------------------
### Build libyuv for 64-bit Windows
Source: https://github.com/pixpark/gpupixel/blob/main/third_party/libyuv/docs/deprecated_builds.md
Configure and build libyuv for 64-bit Windows. This involves setting the target architecture environment variable and running gclient runhooks with verbosity.
```bash
set GYP_DEFINES=target_arch=x64
gclient runhooks V=1
```
--------------------------------
### Install Image Resource Files
Source: https://github.com/pixpark/gpupixel/blob/main/src/CMakeLists.txt
Installs image resource files to the 'res' destination and assigns them to the 'resource' component.
```cmake
install(
FILES ${lib_image_resource_files}
DESTINATION res
COMPONENT resource)
```
--------------------------------
### Implement Static Create Method
Source: https://github.com/pixpark/gpupixel/blob/main/docs/docs/en/custom/custom_input.md
The `Create` method handles the instantiation and initialization of your custom input source. It returns a shared pointer to the input source or nullptr if initialization fails.
```cpp
std::shared_ptr YourCustomInput::Create() {
auto input = std::shared_ptr(new YourCustomInput());
if (input->Init()) {
return input;
}
return nullptr;
}
```