You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3.[Compiling on Windows with Visual Studio](#compiling-on-windows-with-visual-studio)
12
+
4.[Compiling on Windows with GCC](#compiling-on-windows-with-gcc)
13
+
5.[Contribution and Contributors](contribution-and-contributors)
14
+
6.[Licence](licence)
15
+
7
16
## Info
8
17
9
18
Each chapter with major demonstration code has a corresponding demo here.
@@ -16,9 +25,7 @@ This code is some years old now and builds may fall out of date.
16
25
I try to maintain this so that it functions, but be aware that Makefiles and
17
26
build details may differ slightly from book text for this reason.
18
27
19
-
## Compiling Demos
20
-
21
-
### Linux
28
+
## Compiling on Linux
22
29
23
30
* Install a C and C++ compiler - usually by installing a `build-essential`
24
31
bundle package via the package manager on your distribution. E.g. for Ubuntu:
@@ -41,8 +48,7 @@ make -f Makefile.linux64
41
48
42
49
* Or, to build all the demos at once, you can run `./build_all_linux_macos.sh` from the main directory.
43
50
44
-
45
-
### Apple macOS
51
+
## Compiling on macOS
46
52
47
53
* Install the Clang or GNU compiler and tools. Usually this is done by installing Apple [XCode](https://apps.apple.com/us/app/xcode/id497799835?mt=12) through the App Store.
48
54
@@ -60,11 +66,20 @@ make -f Makefile.osx
60
66
61
67
* Or, to build all the demos at once, you can run `./build_all_linux_macos.sh` from the main directory.
62
68
63
-
###Windows with Visual Studio
69
+
##Compiling on Windows with Visual Studio
64
70
65
-
Install Microsoft Visual Studio. Any edition is fine.
71
+
Install Microsoft Visual Studio. Any edition is fine. There are several alternatives to compile with Visual Studio:
66
72
67
-
#### With `build.bat` and `build_all_msvc.bat`
73
+
* Using the included batch files.
74
+
* Installing libraries with NuGet within Visual Studio.
75
+
* Installing libraries manually within Visual Studio.
76
+
77
+
> [!NOTE]\
78
+
> Compiling using a batch file is an easy option for working with Visual Studio's compiler.
79
+
> It's also an easier way to build all the demos in one go, if you just want to try them all first.
80
+
> The only catch is editing the batch file to get the correct path to your compiler tools.
81
+
82
+
### Batch Files
68
83
69
84
For your convenience a `build.bat` file is included in each demo. These will use Visual Studio's command-line tools to
70
85
compile the demo:
@@ -76,28 +91,27 @@ compile the demo:
76
91
If you want to build all the demos in one go, there is a file called `build_all_msvc.bat`.
77
92
You will also need to check the Visual Studio tool path at the top of this file.
78
93
79
-
####Within Visual Studio
94
+
### Within Visual Studio
80
95
81
96
Create a new _Empty_, _C++_, _Console_ project.
82
97
You can then easily install the required libraries with _NuGet_, under the _Project_ menu of a new C++ project, and you're ready to draw a triangle in 5 minutes.
83
98
84
-
#### Install Libraries with NuGet
99
+
#####Install Libraries with NuGet
85
100
86
101
1. In the _Browse_ tab search for and install; `glfw`, and `glew`. For later tutorials you can also find `assimp`, and `freetype`, when required.
87
102
2. You need to add the text `opengl32.lib` to your linker input string. You can find this in _Project->Properties->Configuration Properties->Linker->Input->Additional Dependencies_. Just add `opengl32.lib;` to the front of the long string of dependencies so that it changes to `opengl32.lib;kernel32.lib;user32;...`.
88
103
3. You do not need to add the libraries you installed _via_ NuGet to the linker string.
89
104
4. You can now compile a _Hello Triangle_ demo for OpenGL using GLFW and GLEW.
90
105
91
-
#### Install Libraries Manually
106
+
#####Install Libraries Manually
92
107
93
108
If you would rather do things the old fashioned way, without using a package manager, I have recorded a 2020 video stream tutorial where I show how to get Visual Studio set up and start programming OpenGL, including downloading and setting up libraries.
94
109
95
110
[Tutorial: Intro to 3D Graphics Programming with OpenGL 4 (with Anton). Stream Recording.](https://youtu.be/qQJ7irgxZFQ)
96
111
97
112
This includes a very verbose set-up of Visual Studio 2019 with helper libraries.
98
113
99
-
100
-
### Windows with GCC
114
+
## Compiling on Windows with GCC
101
115
102
116
* Install the GNU Compiler Collection - usually by installing MinGW. I suggest the minimal MinGW GCC distribution at [https://nuwen.net/mingw.html](https://nuwen.net/mingw.html).
0 commit comments