This is a simple OpenGL template using GLFW, GLEW, and GLAD. The template provides a basic setup for creating an OpenGL window, rendering a simple triangle, and setting up the necessary dependencies.
Ensure you have the following installed before using this template:
- Visual Studio (Recommended: 2022 or later)
- OpenGL-compatible GPU and drivers
OpenGLProject/
├── OpenGLProject.sln # Solution file
├── OpenGLProject.vcxproj # Project file
├── Dependencies/ # Contains all necessary libraries
│ ├── GLEW/
│ ├── GLAD/
│ ├── GLFW/
├── Src/
│ ├── main.cpp # Main source file
│ ├── glad.c # GLAD source file
├── Build/
├── x64/
│ ├── Debug/
│ │ ├── OpenGLProject.exe # Compiled executable
Follow these steps to configure project properties for OpenGLProject in Microsoft Visual Studio:
- Open Visual Studio and load
OpenGLProject.sln. - Navigate to View > Solution Explorer.
- Right-click on OpenGLProject in the Solution Explorer.
- Click Properties.
- In the OpenGLProject Property Pages, select the Configuration and Platform options as required.
- Expand the C/C++ section in the left panel and click General.
- Set Additional Include Directories to:
$(SolutionDir)Dependencies\GLFW\include; $(SolutionDir)Dependencies\GLAD; $(SolutionDir)Dependencies\GLEW\include\GL; %(AdditionalIncludeDirectories)
- Navigate to C/C++ > Preprocessor.
- Add the following to Preprocessor Definitions:
GLEW_STATIC; *(Ensure other required definitions are present.)*
- Expand the Linker section and click General.
- Set Additional Library Directories to:
$(SolutionDir)Dependencies\GLEW\lib\Release\x64; $(SolutionDir)Dependencies\GLFW\lib-vc2022; %(AdditionalLibraryDirectories)
- Click Input under Linker and set Additional Dependencies:
$(CoreLibraryDependencies); %(AdditionalDependencies); glfw3.lib; opengl32.lib; glew32s.lib; - In the same section, set Ignore Specific Default Libraries to:
MSVCRT.lib
- Navigate to Source Files in Solution Explorer.
- Open
main.cpp. - Use the following shortcuts to compile and build:
- Ctrl + Shift + B → Build the project.
- Ctrl + F7 → Compile the project without running.
(These shortcuts apply to Windows; for other platforms, refer to respective IDE settings.)
Once completed, the OpenGLProject should be successfully configured and ready for execution.
- Uses GLFW for window and input handling.
- Uses GLEW to load OpenGL functions.
- Uses GLAD for OpenGL function management.
- Renders a simple color-interpolated triangle.
- Supports easy modification and extension.
- Modify
main.cppto add your own rendering logic. - The rendering section is marked between:
/* START MODIFYING HERE */ /* END MODIFYING HERE */
- Add shaders, models, or textures as needed.
- All dependencies are pre-included; no additional installations are required.
- You may need to manually install GLFW, GLEW, and GLAD using package managers.
- Adjust include and library paths accordingly in project settings.
This template is provided as-is for learning and development purposes.
Enjoy coding with OpenGL! 🚀



