LearnOpenGL README

The project's README from github.com/JoeyDeVries/LearnOpenGL. As one markdown file: README.md.

learnopengl.com code repository

Contains code samples for all chapters of Learn OpenGL and https://learnopengl.com.

Windows building

All relevant libraries are found in /libs and all DLLs found in /dlls (pre-)compiled for Windows. The CMake script knows where to find the libraries so just run CMake script and generate project of choice.

Keep in mind the supplied libraries were generated with a specific compiler version which may or may not work on your system (generating a large batch of link errors). In that case it's advised to build the libraries yourself from the source.

Linux building

First make sure you have CMake, Git, and GCC by typing as root (sudo) apt-get install g++ cmake git and then get the required packages: Using root (sudo) and type apt-get install libsoil-dev libglm-dev libassimp-dev libglew-dev libglfw3-dev libxinerama-dev libxcursor-dev libxi-dev libfreetype-dev libgl1-mesa-dev xorg-dev .

Build through CMake-gui: The source directory is LearnOpenGL and specify the build directory as LearnOpenGL/build. Creating the build directory within LearnOpenGL is important for linking to the resource files (it also will be ignored by Git). Hit configure and specify your compiler files (Unix Makefiles are recommended), resolve any missing directories or libraries, and then hit generate. Navigate to the build directory (cd LearnOpenGL/build) and type make in the terminal. This should generate the executables in the respective chapter folders.

Build through Cmake command line:

cd /path/to/LearnOpenGL
mkdir build && cd build
cmake ..
cmake --build .

Note that CodeBlocks or other IDEs may have issues running the programs due to problems finding the shader and resource files, however it should still be able to generate the executables. To work around this problem it is possible to set an environment variable to tell the tutorials where the resource files can be found. The environment variable is named LOGL_ROOT_PATH and may be set to the path to the root of the LearnOpenGL directory tree. For example:

`export LOGL_ROOT_PATH=/home/user/tutorials/LearnOpenGL`

Running ls $LOGL_ROOT_PATH should list, among other things, this README file and the resources directory.

Mac OS X building

Building on Mac OS X is fairly simple:

brew install cmake assimp glm glfw freetype
cmake -S . -B build
cmake --build build -j$(sysctl -n hw.logicalcpu)

Create Xcode project on Mac platform

Thanks @caochao: After cloning the repo, go to the root path of the repo, and run the command below:

mkdir xcode
cd xcode
cmake -G Xcode ..

Glitter

Polytonic created a project called Glitter that is a dead-simple boilerplate for OpenGL. Everything you need to run a single LearnOpenGL Project (including all libraries) and just that; nothing more. Perfect if you want to follow along with the chapters, without the hassle of having to manually compile and link all third party libraries!

Ports

Check out @srcres258's port in Rust here.

LearnOpenGL (JoeyDeVries/LearnOpenGL)

Searching Database…

What is this?This is the code repository for the Learn OpenGL book and its companion website (learnopengl.com), providing the sample C++ programs that go with every tutorial chapter on OpenGL graphics programming.
Is this a library I can import, or just example code to read along with the book?It is a set of standalone example programs, one (or more) per chapter, built individually with CMake rather than a reusable library you import into your own project.
How do I build these examples?Install CMake, Git and a compiler, then run the CMake script to generate a project (CMake-gui or the command line) and build with make/your IDE; Windows already ships prebuilt libs/DLLs in /libs and /dlls.
Which libraries do I need installed before building on Linux?On Linux you need g++, cmake and git, plus the dev packages libsoil-dev, libglm-dev, libassimp-dev, libglew-dev, libglfw3-dev, libxinerama-dev, libxcursor-dev, libxi-dev, libfreetype-dev, libgl1-mesa-dev and xorg-dev.
Will the prebuilt Windows libraries always link correctly?Not necessarily - they were compiled with a specific compiler version, so using a different one can cause a batch of link errors, meaning you may have to rebuild the libraries yourself from source.
Which operating systems does the build process cover?The README gives separate CMake build instructions for Windows, Linux, and Mac OS X, so the examples are meant to compile on all three.
What is Glitter?Glitter is a minimal boilerplate project (made by Polytonic) that bundles everything needed to run a single LearnOpenGL chapter, including all required libraries, so you can follow along without manually compiling and linking third-party dependencies.
Is there a Rust version of these tutorials?Yes, there is a community-maintained Rust port of the LearnOpenGL examples linked in the README, credited to user @srcres258.
Where do I actually read the tutorial text?The written chapters live on the companion website learnopengl.com; this repository only contains the matching source code for each chapter.
How do the programs find their shader and resource files if an IDE cannot locate them?You can set an environment variable called LOGLROOTPATH to the root of the LearnOpenGL directory tree, which tells the executables where to find the resources.
Size
199.9 MB
Stars
12.7K
Updated
CommitAug 05
Age
11y
Commits · 90 Days