OpenGL on Fedora 33
2021-04-14
2 minute read
Installation requirements:
Useful links:
Step 1: Install GLFW and GLAD
After installing GLFW,
-
cd <source-directory>
-
cmake -G "Unix Makefiles"
-
sudo dnf install dnf-utils glfw
-
make
-
sudo make install
After installing GLAD,
sudo ln -s <path/to/glad> /usr/local/include/glad # In my case, sudo ln -s ~/glad/include/glad /usr/local/include/glad
-
You will need
glad.c
when compiling, so put it in the project directory or wherever you can remember.
Step 2: Compile
-
Grab an example code from here and name it
shaders.cpp
. -
Compile
shaders.cpp
with:g++ -std=c++11 -c shaders.cpp <path/to/glad.c> # In my case, g++ -std=c++11 -c shaders.cpp ~/glad/src/glad.c
-
Output an executable file with:
g++ shaders.o glad.o -o shaders.exec -lGL -lglfw3 -lX11 -lpthread -ldl
-
Finally execute with:
./shaders.exec
And you should see something like this:
Finally
If this didn't help, you should be missing more required packages and you want to google until you find an answer. I don't know anything about C/ C++, so it was kind of confusing to learn how to link stuff and whatnot, but eventually I found the answers I needed. :)
Good luck!