Related Contents:
- OpenGL– An introduction to the graphics API
- OpenGL– Related terms explained
- OpenGL– Environment configuration
- OpenGL- Case 1- Draw a triangle
- OpenGL– Case 2 — Draw a square
- OpenGL– Image rip
- OpenGL–3D mathematics related (Vectors and Matrices)
- OpenGL– Matrix transformations and matrix stacks
So now that we’ve looked at some of the concepts of OpenGL and explained some of the nouns, we’re going to start really learning about OpenGL. Before you start learning, do a wave of environment building, after all, there is no environment, so HOW can I start coding.
Prepare resources
- CLTools
- glew
- libGLTools.a
Resource address sharing: Cloud disk link password :2txn
Configure the OpenGL environment
1. Create Cocoa Application
Create a new Xcode project and select macOS -> Cocoa Application.
2. Introduce system libraries OpenGL. Framework and GLUT. Framework
Targets -> Build Phass -> Link Binary With Libraries, click “+” then find the above two Libraries to add.
3. Download the resources provided in the beginning and drag them into the project
Next, you need to configure the path for the include
As shown in the figure above, search for “header search” under “Build Settings” to find “Header Search Paths” and then configure the “include” Paths that you drag in.
4. Delete unnecessary files
Delete the useless “AppDelegate” and “ViewController” files, and create a new “main. CPP “file.
Remember to remove the “✔️” from the red box when creating the “main. CPP “file
5. Check whether the test is successful
And since this is a build environment, what I’m going to do is I’m going to copy a big chunk of code, and let’s see if we can run it
The “. A “file is not included in the project, so it should be checked.
Another possible problem is that the “include” file used to import (gl-related content) headers is “< >”, which may cause an error. If you get an error, change them to “” and try again.
The current GL was dragged into the local project, so importing it with “< >” will cause an error
Finally, attach the operation of the effect map, completed!!!!