This repository provides a simple template for setting up an OpenGL project in C++ using Visual Studio Code. It includes configuration files for building and debugging with MinGW on Windows.
opengl-template/
├── src/
│ └── main.cpp # Your main application file
| └── glfw3.dll # GLFW dynamic library
├── include/ # Include directory for header files
│ └── (header files if any)
├── lib/
│ └── other library files (.lib or .dll)
├── .vscode/ # VS Code configuration files
│ ├── launch.json
│ ├── tasks.json
│ └── c_cpp_properties.json
└── .gitignore # Git ignore file
- Visual Studio Code
- MinGW or another GCC-compatible compiler
- Git
-
Clone the repository:
git clone https://github.com/yourusername/opengl-template-cpp.git cd opengl-template-cpp
-
Open the project in Visual Studio Code:
code .
-
Install necessary extensions in VS Code:
- C/C++ (Microsoft)
- CMake (Optional, if using CMake for project management)
- Code Runner (Optional, for running code snippets)
-
Build the project:
- Press
Ctrl+Shift+B
to run the build task defined intasks.json
.
- Press
-
Run the project:
- Press
F5
to start debugging with the configuration defined inlaunch.json
.
- Press
launch.json
: Configures debugging settings.tasks.json
: Defines build tasks.c_cpp_properties.json
: Sets include paths and IntelliSense configurations.
- Ensure that the
glfw3.dll
and any other necessary DLLs are located in thelib
directory or a directory included in your system'sPATH
. - Modify the
tasks.json
andc_cpp_properties.json
files according to your specific setup and dependencies.
Feel free to fork this repository and make your own modifications. Pull requests are welcome!
This project is licensed under the MIT License - see the LICENSE file for details.