Examples

Example 1-1

Chunk of OpenGL Code

6

Example 1-2

Simple OpenGL Program Using GLUT: hello.c

19

Example 1-3

Double-Buffered Program: double.c

25

Example 1-4

Creating an OpenGL Version 3.0 Context Using GLUT

28

Example 2-1

Reshape Callback Function

41

Example 2-2

Legal Uses of glVertex*()

46

Example 2-3

Filled Polygon

47

Example 2-4

Other Constructs between glBegin() and glEnd()

52

Example 2-5

Line Stipple Patterns: lines.c

59

Example 2-6

Polygon Stipple Patterns: polys.c

65

Example 2-7

Marking Polygon Boundary Edges

68

Example 2-8

Surface Normals at Vertices

69

Example 2-9

Enabling and Loading Vertex Arrays: varray.c

75

Example 2-10

Using glArrayElement() to ...

Get OpenGL Programming Guide: The Official Guide to Learning OpenGL, Versions 3.0 and 3.1, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.