[PDF] [PDF] this OpenGL book - Learn OpenGL

OpenGL is mainly considered an API (an Application Programming Interface) that provides us with a large set of functions that we can use to manipulate graphics 



Previous PDF Next PDF





[PDF] OpenGL et GLUT Une introduction

Les transformations sont représentées dans OpenGL sous la forme de matrices Spécifier la transformation courante appliquée aux primitives avant la projection



[PDF] Introduction à OpenGL et GLUT

Le rendu des primitives dépend de nombreuses variables d'état (matrice de transformation, couleur, matériau, texture, éclairage, etc ) OpenGL ne sait pas ce que 



[PDF] Initiation à OpenGL

Nous parlerons de : - GLUT : un système simple de fenêtrage - Couleurs et primitives de tracé (lignes et polygones) - Transformations géométriques pour la  



[PDF] Introduction à OpenGL

Une API (bas niveau) en C permettant de tirer faisant l'interface entre le logiciel et le driver matériel Spécialisé pour le rendu réaliste 2D et 3D Des matrices 



[PDF] Programmation 3D en C++ avec OpenGL et GLSL - Rémy Malgouyres

Dans notre cas, la version d'OpenGL est 3 3 et la version de GLSL est 1 3 1 1 2 a Code C++ de création d'une fenêtre SDL pour OpenGL Voici le code 



[PDF] this OpenGL book - Learn OpenGL

OpenGL is mainly considered an API (an Application Programming Interface) that provides us with a large set of functions that we can use to manipulate graphics 



[PDF] OpenGL 45 - Khronos Group

1 mai 2020 · pdf Khronos grants a con- ditional copyright license to use and reproduce the unmodified specification for any purpose, without fee or royalty, 



[PDF] Chapitre I : Présentation dOpenGL - Positionnement 3D

OpenGL : qu'est ce que c'est ? Librairie pour la programmation 2D/3D (GL = Graphics Library) Alternative propriétaire : Direct3D de Microsoft Standard 



[PDF] An Interactive Introduction to OpenGL Programming

OpenGL is a rendering library available on almost any computer which supports a graphics monitor Today, we'll discuss the basic elements of OpenGL: rendering 



[PDF] OpenGL® Programming Guide - Department of Computing Sciences

Modern OpenGL is centered on the use of shaders, and this edition of the OpenGL programming guide : the official guide to learning OpenGL, version 4 3 /

[PDF] terminologie juridique français arabe gratuit

[PDF] repérage pavé droit exercices

[PDF] reperage espace 4eme

[PDF] oxydoréduction cuivre zinc

[PDF] motion blur photoshop traduction

[PDF] oxydoréduction pile

[PDF] la république expliquée ? ma fille extrait

[PDF] la république expliquée ? ma fille pdf

[PDF] la chose dans la clarté lunaire analyse

[PDF] autoportrait michel leiris

[PDF] les apports du judaïsme du christianisme et de l'islam ? la pensée occidentale

[PDF] gorgias platon résumé

[PDF] gorgias platon pdf

[PDF] animaux fables symbole

[PDF] quel est l'animal le plus souvent cité dans les fables de jean de la fontaine

Learn OpenGL

An offline transcript of learnopengl.com

Joey de Vries

Copyright

c

2015 Joey de Vries

PUBLISHED BY ME:)

LEARNOPENGL.COMLicensed under the Creative Commons Attribution-NonCommercial 3.0 Unported License (the

"License"). You may not use this file except in compliance with the License. You may obtain a copy of the License athttp://creativecommons.org/licenses/by-nc/3.0. Un- less required by applicable law or agreed to in writing, software distributed under the License is distributed on an"AS IS"BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Second printing, July 2015

Contents

1Introduction.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

1.1 Prerequisites

14

1.2 Structure

15

1.2.1 Boxes

15

1.2.2 Code

15

1.2.3 Color hints

15

1.2.4 OpenGL Function references

15 IGetting started

2OpenGL.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2.1 Core-profile vs Immediate mode

18

2.2 Extensions

19

2.3 State machine

19

2.4 Objects

20

2.5 Let"s get started

21

2.6 Additional resources

21

3Creating a window.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

3.1 GLFW

22

3.2 Building GLFW

23

3.2.1 CMake

23

3.2.2 Compilation

24

3.3 Our first project24

3.4 Linking

24

3.4.1 OpenGL library on Windows

25

3.4.2 OpenGL library on Linux

26

3.5 GLEW

26

3.5.1 Building and linking GLEW

26

3.6 Additional resources

27

4Hello Window.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

4.1 GLEW

29

4.2 Viewport

30

4.3 Ready your engines

30

4.4 One last thing

31

4.5 Input

32

4.6 Rendering

33

5Hello Triangle.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

5.1 Vertex input

37

5.2 Vertex shader

39

5.3 Compiling a shader

40

5.4 Fragment shader

41

5.4.1 Shader program

42

5.5 Linking Vertex Attributes

43

5.5.1 Vertex Array Object

45

5.5.2 The triangle we"ve all been waiting for

47

5.6 Element Buffer Objects

48

5.7 Additional resources

51

5.8 Exercises

51

6Shaders.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

6.1 GLSL

52

6.2 Types

53

6.2.1 Vectors

53

6.3 Ins and outs

54

6.4 Uniforms

56

6.5 Our own shader class

59

6.6 Reading from file

60

6.7 Exercises

62

7Textures.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

7.1 Texture Wrapping

65

7.2 Texture Filtering

66

7.2.1 Mipmaps

67

7.3 Loading and creating textures68

7.4 SOIL

69

7.5 Generating a texture

69

7.6 Applying textures

70

7.7 Texture Units

73

7.8 Exercises

76

8Transformations.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

8.1 Vectors

77

8.2 Scalar vector operations

78

8.3 Vector negation

79

8.4 Addition and subtraction

79

8.5 Length

80

8.6 Vector-vector multiplication

81

8.6.1 Dot product

81

8.6.2 Cross product

82

8.7 Matrices

82

8.8 Addition and subtraction

83

8.9 Matrix-scalar products

84

8.10 Matrix-matrix multiplication

84

8.11 Matrix-Vector multiplication

85

8.12 Identity matrix

86

8.13 Scaling

86

8.14 Translation

87

8.15 Rotation

88

8.16 Combining matrices

89

8.17 In practice

90

8.18 GLM

90

8.19 Exercises

94

9Coordinate Systems.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

9.1 The global picture

96

9.2 Local space

97

9.3 World space

97

9.4 View space

97

9.5 Clip space

97

9.5.1 Orthographic projection

98

9.5.2 Perspective projection

99

9.6 Putting it all together

102

9.7 Going 3D

102

9.8 More 3D

106

9.8.1 Z-buffer

107

9.8.2 More cubes!. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

9.9 Exercises

109

10Camera.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

10.1 Camera/View space

110

10.1.1 1. Camera position

111

10.1.2 2. Camera direction

111

10.1.3 3. Right axis

111

10.1.4 4. Up axis

111

10.2 Look At

112

10.3 Walk around

113

10.4 Movement speed

115

10.5 Look around

116

10.6 Euler angles

117

10.7 Mouse input

119

10.8 Zoom

121

10.9 Camera class

122

10.10 Exercises

123

11Review.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

11.1 Glossary

124 IILighting

12Colors.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

12.1 A lighting scene

129

13Basic Lighting.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

13.1 Ambient lighting

134

13.2 Diffuse lighting

135

13.3 Normal vectors

136

13.4 Calculating the diffuse color

137

13.5 One last thing

139

13.6 Specular Lighting

141

13.7 Exercises

145

14Materials.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

14.1 Setting materials

147

14.2 Light properties

149

14.3 Different light colors

151

14.4 Exercises

152

15Lighting maps.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

15.1 Diffuse maps

154

15.2 Specular maps

157

15.3 Sampling specular maps

158

15.4 Exercises

160

16Light casters.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

16.1 Directional Light

161

16.2 Point lights

164

16.3 Attenuation

165

16.3.1 Choosing the right values

166

16.3.2 Implementing attenuation

167

16.4 Spotlight

169

16.5 Flashlight

169

16.6 Smooth/Soft edges

172

16.7 Exercises

174

17Multiple lights.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

17.1 Directional light

176

17.2 Point light

177

17.3 Putting it all together

178

17.4 Exercises

181

18Review.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182

18.1 Glossary

182 IIIModel Loading

19Assimp.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185

19.1 A model loading library

186

19.2 Building Assimp

187

20Mesh.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

20.1 Initialization

190

20.2 Rendering

192

21Model.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194

21.1 Importing a 3D model into OpenGL

195

21.1.1 Assimp to Mesh

197

21.1.2 Indices

199

21.1.3 Material

199

21.2 A large optimization200

21.3 No more containers!

202

21.4 Exercises

203 IVAdvanced OpenGL

22Depth testing.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205

22.1 Depth test function

206

22.2 Depth value precision

209

22.3 Visualizing the depth buffer

210

22.4 Z-fighting

213

22.4.1 Prevent z-fighting

214

23Stencil testing.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216

23.1 Stencil functions

218

23.2 Object outlining

219

24Blending.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

24.1 Discarding fragments

224

24.2 Blending

228

24.3 Rendering semi-transparent textures

231

24.4 Don"t break the order

233

25Face culling.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235

25.1 Winding order

235

25.2 Face culling

237

25.3 Exercises

239

26Framebuffers.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240

26.1 Creating a framebuffer

240

26.1.1 Texture attachments

242

26.1.2 Renderbuffer object attachments

quotesdbs_dbs16.pdfusesText_22