a simple OpenGL example written in C++ that demonstrates clean coding practices and modular design. The program creates a triangle with colored vertices and renders it in an OpenGL window using GLFW and GLEW.
main.cpp
: Main program that initializes OpenGL, creates a window, and renders the triangle.Shader.cpp
andShader.h
: Classes responsible for shader compilation and linking.Renderer.cpp
andRenderer.h
: handles OpenGL rendering and clearing operations.Application.cpp
andApplication.h
: manages the application lifecycle and coordinates other classes.
- OpenGL: for rendering graphics.
- GLFW: for creating windows and handling user input.
- GLEW: for managing OpenGL extensions.
- A a++ compiler supporting C++11 or higher.
-
Clone the repository:
git clone https://github.com/yourusername/OpenGL-Clean-Code-Example.git
- Shader Class manages shader compilation and program linking.
- Renderer Class: handles the initialization and rendering of OpenGL objects.
- Application Class: controls the window and openGL context, and main loop.