Skip to content

Azhilus/OpenGL_Triangle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OpenGL Colored Triangle

This simple C++ program utilizes GLFW and GLAD to create an OpenGL window and render a colored triangle. The triangle is defined by vertex and fragment shaders, and the program provides a basic structure for setting up OpenGL, compiling shaders, and rendering graphics.

Prerequisites

Building and Running

  1. Make sure you have GLFW and GLAD installed.

  2. Compile the program using your preferred C++ compiler. For example, using g++:

    g++ -o main main.cpp -lglfw -ldl
  3. Run the executable:

    ./main

Controls

  • Press ESC to close the window.

Code Overview

  • The program initializes GLFW and sets up an OpenGL 3.3 Core Profile window.
  • Vertex and fragment shaders define the geometry and color of the triangle.
  • Vertex data and buffers are created, and shaders are compiled and linked into a shader program.
  • The main rendering loop clears the screen, uses the shader program, and draws the triangle.
  • Cleanup is performed at the end of the program.

Feel free to modify and extend this code to experiment with OpenGL graphics programming.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published