Learn OpenGL 1
Setting up OpenGL in Ubuntu (GLFW, GLAD)
github source code: link
learning materials: learnopengl.com
Introduction
This tutorial shows how to setup a basic opengl project on ubuntu 22.04. Other platforms such as Mac and Windows are not covered. There should be plenty of resources online that you can refer to.
GLFW and GLAD
GLFW is a library, written in C, specifically targeted at OpenGL. GLFW gives us the bare necessities required for rendering goodies to the screen. It allows us to create an OpenGL context, define window parameters, and handle user input, which is plenty enough for our purposes.
Install GLFW:
1 | sudo apt-get install libglfw3-dev |
GLAD is a tool used for generating a loader for OpenGL function pointers. It simplifies the process of setting up OpenGL in a program by automatically generating the code necessary to load OpenGL functions at runtime.
GLAD has a .c file and a .h file. You can directly put these two files under your project. To access glad files, refer to my github project.
Create a window
1 |
|
run build.sh
, if everything is correct. You should see a blue window.