After I gave up on trying to get NVIDIA drivers to work with my Ubuntu installation so I could develop with Vulkan, I decided to try out OpenGL instead. I'm loosely following this highly recommended tutorial to learn how the OpenGL API works with some organizational and operational changes of my own (such as using classes to encapsulate different aspects of drawing, like compiling shaders, drawing a shape, and the actual rendering).
Ubuntu:
Enter the following commands in a shell at the root of this repository (replacing build
with whatever directory name you want):
$ cmake -B build .
$ make -C build
Or, you can do:
$ mkdir build
$ cd build
$ cmake ..
$ make
This will generate a binary named opengl-basics
inside the build
folder.
Windows:
- Open the CMake GUI.
- Set the source directory to the root of this repository and set the build directory to a new sub-directory called
build
(or anything you want) - Click Configure and follow the steps (I use vcpkg so I specify its CMake toolchain).
- Once that's done, click Generate.
- Inside the
build
folder will be a file nameopengl-basics.sln
. Open this in Visual Studio. - Once everything is loaded, click Build > Build 'opengl-basics' or press Ctrl-B.
An executable name
opengl-basics.exe
will be generated insidebuild/Debug/
.
Ubuntu:
After building, make sure you're at the root of the repository, then type ./build/opengl-basics
in a shell.
Windows:
After building, make sure you're at the root of the repository, then type ./build/Debug/opengl-basics.exe
in a shell.
Alternatively, copy the assets/
folder from the root of the repository to build/Debug
.
Then, just run opengl-basics.exe
from inside build/Debug
.
Press 1 to switch to filled mode and 2 to switch to wireframe mode. Press Q to close the application.