Skip to content

migueraoui/OpenGL-Clean-Code-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

OpenGL Clean Code Example

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.

Project Structure

  • main.cpp: Main program that initializes OpenGL, creates a window, and renders the triangle.
  • Shader.cpp and Shader.h: Classes responsible for shader compilation and linking.
  • Renderer.cpp and Renderer.h: handles OpenGL rendering and clearing operations.
  • Application.cpp and Application.h: manages the application lifecycle and coordinates other classes.

Requirements

  • 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.

How to Compile and Run

  1. Clone the repository:

    git clone https://github.com/yourusername/OpenGL-Clean-Code-Example.git
    

Code Explanation

  • 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.

About

A simple OpenGL example with clean C++ code.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages