Interactive 3D graphics demos with real-time UI controls. Includes a rotating cube with Phong shading (OpenGL) and Mandelbrot fractal explorer (CUDA).
- Windows 10/11 (64-bit)
- Visual Studio 2019 or 2022 with C++ workload
- CUDA Toolkit (project uses 12.2, but 11.x or 12.x work)
- NVIDIA GPU with CUDA support
Important: vcpkg must be installed at the same level as the cuda-demos folder.
parent-folder/
cuda-demos/ <- This project
vcpkg/ <- vcpkg installation (same level)
# Navigate to the parent directory of cuda-demos
cd ..
# Clone vcpkg at the same level as cuda-demos
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
# Install dependencies (static libraries)
.\vcpkg install freeglut:x64-windows-static glew:x64-windows-static imgui[opengl3-binding,glut-binding]:x64-windows-static tinygltf:x64-windows-static
# Note: vcpkg integration is disabled for this project to avoid path conflicts.
# The project uses explicit relative paths to vcpkg libraries.- Open
CudaDemos.slnin Visual Studio - Set platform to x64
- Build: Ctrl+Shift+B
- Run: Ctrl+F5
A rotating cube with Phong shading. Features:
- Real-time Phong lighting (ambient, diffuse, specular)
- Full 3D camera navigation (WASD + mouse)
- Adjustable rotation speed
- Adjustable light position and material properties
GPU-accelerated Mandelbrot set visualization. Features:
- Real-time zoom and pan with mouse
- Smooth color gradients
- Arrow key navigation
- 1: Switch to 3D Boxes demo
- 2: Switch to Mandelbrot Fractal demo
- H: Hide/show UI panel
- R: Start/stop video recording (requires ffmpeg)
- ESC: Exit
- W/A/S/D: Move forward/left/backward/right
- Q/E: Move down/up
- Left Mouse Drag: Orbit around clicked point
- Middle Mouse Drag: Pan/translate camera
- Right Mouse Drag: Rotate view (first-person)
- Mouse Wheel: Zoom in/out
- Mouse Wheel: Zoom
- Click and Drag: Pan
- Arrow Keys: Pan
Press R to start/stop recording demos to MP4 video.
Requirements:
- Download ffmpeg: https://ffmpeg.org/download.html
- Add ffmpeg to your system PATH, or place
ffmpeg.exein the project directory - Videos save as
output.mp4(30 FPS, overwritten each recording)
Verification:
ffmpeg -version # Should display ffmpeg version infoError: CUDA 12.2.props not found
Fix: Edit CudaDemos.vcxproj, search for CUDA 12.2 and replace with your version (e.g., CUDA 11.8)
Note: The project uses $(CUDA_PATH_V12_2) instead of $(CUDA_PATH) to avoid conflicts when multiple CUDA versions are installed. If you're using a different version, replace all instances of CUDA_PATH_V12_2 with your version (e.g., CUDA_PATH_V11_8 or CUDA_PATH_V12_8)
Error: The build tools for v142 cannot be found
Fix: Install VS 2019 build tools, or change <PlatformToolset>v142</PlatformToolset> to v143 in the .vcxproj
Error: cannot open file 'imgui.lib' / 'glew32.lib' / 'freeglut.lib'
Fix:
- Ensure you installed static versions:
.\vcpkg install freeglut:x64-windows-static glew:x64-windows-static imgui[opengl3-binding,glut-binding]:x64-windows-static - Verify vcpkg is installed at the same level as the cuda-demos folder (see setup instructions)
- Check that the relative path
../vcpkg/installed/x64-windows-static/libis correct
Error: This project requires a CUDA capable GPU
Fix: Update NVIDIA drivers, verify GPU with nvidia-smi command
Error: glew32.dll or freeglut.dll not found
Fix: This shouldn't happen with static build. Verify GLEW_STATIC and FREEGLUT_STATIC are in preprocessor definitions.
CudaDemos.sln - Visual Studio solution
CudaDemos.vcxproj - Project configuration
main.cpp - Application and UI code
BoxesDemo.h/cpp - OpenGL 3D cube with Phong shading
MandelbrotDemo.h/cpp - Mandelbrot fractal
MandelbrotDemo.cu - CUDA kernel for Mandelbrot
Demo.h - Base demo interface
Educational and demonstration purposes. Feel free to modify and extend.