Skip to content

Repository files navigation

Learn OpenGL Template repository

This is a repository which contains empty Visual Studio C++ project ready for development.

Original Learn OpenGL course provides some really nasty and bad practices ragarding C++ project organization and libraries management. Here I povide ready-for-use C++ template project with all Visual studio stuff setup and a guide how to setup all libraries without scattering them all over you machine and hardcoding absolute paths.

You can use this guide instead of Part #1 of original course.

Link to Learn Open GL

You will need Visual Studio 2022

Steps to setup basic OpenGL environment

Installing GLFW (library for creating window and OpenGL context)

  1. Download GLFW prebuilt binaries for x64 (GLFW Binaries)

  2. Create vendors/glfw directory in the project

  3. Extract include, lib-vc2022 and lisence.md to vendors/glfw

  4. Add GLFW to additional include directories in project settings

The path sould be $(SolutionDir)vendors\glfw\include

  1. Add GLFW library to the list of project libraries.

Path: $(SolutionDir)vendors\glfw\lib-vc2022\glfw3.lib

  1. Add OpenGL library to the list of project libraries.

opengl32.lib

  1. Include GLFW to your Main.cpp
#include <glfw/glfw3.h>

int main()
{
}
  1. Build the project. It should compile successfully.



Installing GLAD (library for creating window and OpenGL context)


  1. Go to [Link] and generate library sources. Set all parameters as on screenshot and press generate

  1. Download zip

  2. Extract src and include to vendors/glad

  1. Add GLAD to project include directories.

Path $(SolutionDir)vendors\glad\include

  1. Add GLAD sources to your project.

Add vendors/glad/src/glad.c

  1. Include GLAD BEFORE GLFW in your Main.cpp
#include <glad/glad.h>
#include <glfw/glfw3.h>

int main()
{
}
  1. Build project. All should be OK. You are ready for doing OpenGL stuff now!

About

Template repository for LearnOpenGL course

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages