To learn OpenGL, I’m sure many of you have seen this website:

https://learnopengl.com/

This is the original English version of the website, and it has since been translated into different languages. The Chinese version is:

https://learnopengl-cn.github…

These two websites are very helpful for learning OpenGL, which can be used as an introductory textbook, or as a reference book for follow-up omission filling.

And its content is very comprehensive, in addition to OpenGL basic knowledge, coordinate system, texture, Shader, model loading, and advanced lighting, PBR and other rendering techniques, which are used in the development of rendering engine, I will continue to share with you later.

<! –more–>


This article mainly explains how to run the sample code in Learnopengl article, compile and debug on Xcode, the effect is as follows:

The content of a section on the website corresponds to the specific code of a small section of the Xcode project. We can select the section code to run and see the final result on the Mac.

In addition, we can also modify relevant code in Xcode, adjust some parameters, and verify our own ideas and experimental results.

This is very important for beginners to try and fail and grow.

Before we start with the Learnopengl code, let’s introduce the owner.

I have to say, he is a big shot. Anyone who is interested can Follow him.

His personal page is:

https://joeydevries.com

From the home page you can see that the big guy in graphics and game development is quite deep, do a lot of interesting things.

  • Realization of a simple rendering engine, using C++ development, support a number of features, can be seen on the Learnopengl website.

https://github.com/JoeyDeVrie…

This can be regarded as a big job to consolidate and improve after learning OpenGL.

  • In addition, a teaching website of Vulkan has been made. Although it is not yet completed, it is still worth looking forward to.

https://learnvulkan.com/

  • Of course, you can also see my website, may be of some help to you

https://glumes.com/


Anyway, back to the compilation part of the code.

The Learnopengl website sample code address is as follows. Clone the project to your computer.

https://github.com/JoeyDeVrie…

The project’s readme. md has instructions on how to compile on the Mac platform.

brew install cmake assimp glm glfw mkdir build cd build cmake .. /. make -j8

However, this compilation is not what we want, because it compiles binary executables.

Although we can run these executables using./ XXX, we can’t compile them every time we change a bit of code.

The ideal way to do this is to compile and run it through an IDE (integrated development environment), modify the code on the IDE, and see the results.

Xcode acts as an IDE here.

Here is the new compiled code:

brew install cmake assimp glm glfw
mkdir build
cd build
cmake -G "Xcode" ..

The only change is the last line, which generates the Xcode project in the build directory.

Double click on Learnopengl. XCodeProj to open the whole project.


Next is the free play time, you can make any modifications on the basis of the source code, with Learnopengl website explained, step by step to debug verification, accumulate experience, in the road to become a big man more and more far ~~~~

Have a good time??

Welcome to pay attention to WeChat public number: [paper talk], learn more audio and video multimedia development ~~~