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…

这是什么?这是《Learn OpenGL》一书及其配套网站(learnopengl.com)的代码仓库,提供与每个 OpenGL 图形编程教程章节配套的 C++ 示例程序。
这是可以导入的库,还是只是配合书本阅读的示例代码?这是一组独立的示例程序,每章一个(或多个),使用 CMake 单独构建,并不是可以导入到你自己项目中的通用库。
如何构建这些示例?安装 CMake、Git 和编译器,然后运行 CMake 脚本生成项目(使用 CMake-gui 或命令行),再用 make 或你的 IDE 进行构建;Windows 下 /libs 和 /dlls 中已附带预编译的库和 DLL。
在 Linux 上构建之前,需要安装哪些库?在 Linux 上,你需要 g++、cmake 和 git,以及以下开发包:libsoil-dev、libglm-dev、libassimp-dev、libglew-dev、libglfw3-dev、libxinerama-dev、libxcursor-dev、libxi-dev、libfreetype-dev、libgl1-mesa-dev 和 xorg-dev。
Windows 下的预编译库能保证总是能正确链接吗?不一定。这些库是用特定版本的编译器编译的,换用其他版本可能会导致一大批链接错误,因此你可能需要自己从源代码重新编译这些库。
构建过程支持哪些操作系统?README 分别给出了 Windows、Linux 和 Mac OS X 的 CMake 构建说明,因此这些示例旨在能在这三个系统上编译。
什么是 Glitter?Glitter 是一个极简的样板项目(由 Polytonic 制作),它打包了运行单个 LearnOpenGL 章节所需的一切,包括所有必需的库,因此你无需手动编译和链接第三方依赖即可跟着学习。
这些教程有 Rust 版本吗?有。README 中链接了一个由社区维护的 LearnOpenGL 示例 Rust 移植版,作者为用户 @srcres258。
教程正文在哪里阅读?文字章节位于配套网站 learnopengl.com 上;本仓库只包含每章对应的源代码。
如果 IDE 找不到着色器和资源文件,程序如何找到它们?你可以将名为 LOGLROOTPATH 的环境变量设置为 LearnOpenGL 目录树的根路径,这样可执行程序就能找到所需的资源。
Size
199.9 MB
Stars
12.7K
Updated
CommitAug 05
Age
11y
Commits · 90 Days