This guide will walk you through the steps to set up, build, and run the program on macOS, Windows, and Linux.
Before starting, make sure you have the following installed:
- C++ Compiler (e.g.,
g++,clangon macOS) - GLFW (for OpenGL context and window creation)
- GLEW (for managing OpenGL extensions)
- OpenGL (for graphics rendering)
On macOS, you'll need Xcode Command Line Tools, Homebrew (optional but recommended), and the required libraries.
On Windows, you'll need MinGW or MSVC, GLFW, and GLEW for managing libraries and compiling the program.
On Linux (Ubuntu/Debian-based), you will need g++ or clang++, GLFW, and GLEW to build the program.
-
Install Xcode Command Line Tools (for compilers and essential tools):
xcode-select --install
-
Install Homebrew (if not already installed):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Install GLFW and GLEW via Homebrew:
brew install glfw glew
-
Install MinGW (GCC) or MSVC:
- For MinGW, download and install from MinGW website.
- For MSVC, install Visual Studio from Microsoft's website.
-
Install GLFW:
- Download precompiled GLFW binaries from GLFW website.
- Alternatively, use vcpkg or vcpkg-install to install GLFW.
-
Install GLEW:
- Download GLEW from GLEW website.
- Follow the instructions to install GLEW for your compiler.
-
Install Dependencies via
apt(Ubuntu/Debian):sudo apt update sudo apt install build-essential cmake libglew-dev libglfw3-dev libglm-dev
-
Install GLFW (if not already installed):
sudo apt install libglfw3 libglfw3-dev
-
Install GLEW:
sudo apt install libglew-dev
- Clone the repository:
git clone https://github.com/{user-name}/Graphics-OpenGL.git cd graphics-opengl
-
Using Terminal: Open the Terminal in the project folder:
cd /path/to/your/project -
Compile Using g++: Run the following command:
g++ -std=c++11 -g -Iinclude -o main src/main.cpp src/engine/GraphicsEngineMock.cpp -lglfw -lGLEW -framework OpenGL
-
Run the Program:
./main
- macOS/Linux: Make sure you have installed the libraries using Homebrew (
brew install glfw glew) or the package manager. - Windows: Ensure that you've added the correct paths to GLFW and GLEW in your build command.
- On macOS and Linux, use the
-framework OpenGLflag for macOS or-lGLfor Linux in your build command. - On Windows, use
-lopengl32to link OpenGL.
After building, you can clean up the build directory:
rm -rf build/Feel free to fork, create a pull request, or report issues! Here are the general steps:
- Fork the repository.
- Clone your fork locally.
- Create a new branch (
git checkout -b feature-name). - Make your changes and commit (
git commit -am 'Add feature'). - Push your changes (
git push origin feature-name). - Create a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.