Welcome to the official website for OpenGL Game Programming, available now from Premier Press (formerly Prima Tech). Here you will find information about what's contained in the book. You'll also find material supporting the book, including an FAQ and any errata we find.
OpenGL Game Programming is a book by Kevin Hawkins and Dave Astle, co-creators of GameDev.net. The book will teach you OpenGL, and then show you how to use it to create 3D games for Windows. Topics covered include graphics programming with OpenGL, physics, special effects, particle systems, integrating DirectInput and DirectSound with OpenGL, loading and animating 3D models, and game engine design. It even shows you how to bring all of these elements together in a simple first-person shooter.
Where to get it
OpenGL Game Programming is available now at the following online booksellers:
You should also be able to find it at the following stores
- Borders
- CompUSA
- Barnes and Noble
- Best Buy
The Buzz
"Personally, I'm thrilled to see this book be published. It is about time for PC programmers to find a practical resource to learn about 3D game design using OpenGL."
Mark J. Kilgard
Graphics Software Engineer, NVIDIA Corporation
Author of OpenGL Programming for the X Window System and the OpenGL Utility Toolkit (also known as GLUT)
"A book that finally understands the needs of those who have little idea of how to program graphics. ... A great writing style that simplifies concepts that other books somehow make difficult. ... The authors expertise shines through with the clarity and simplicity of the text. ... Save yourself some cash, buy this single book on OpenGL coding with C/C++ under Win32 and also save yourself months of time!"
Dean Butcher
"The book is simply awesome. It's a thorough reference that's essential to anyone beginning in OpenGL development. Topics are explained well and aren't made to sound more complicated than they really are."
"This book was the sole impetus for my finally buckling down and learning OpenGL after months of trying. It has volumes of useful information for any skill level, and I would most definitely recommend it as a first read for anyone interested in using OpenGL for games."
Warren Moore
Table of Contents
Chapter 1 - The Exploration Begins: OpenGL and DirectX
1.1 - What is OpenGL?
1.2 - OpenGL History
1.3 - OpenGL Architecture
1.4 - What is GLUT?
1.5 - What is DirectX?
1.6 - DirectX History
1.7 - DirectX Architecture
1.7.1 - DirectX Graphics
1.7.2 - DirectX Audio
1.7.3 - DirectInput
1.7.4 - DirectPlay
1.7.5 - DirectShow
1.7.6 -- DirectSetup
1.8 - OpenGL vs. DirectX
1.9 - Summary
Chapter 2 - Using Windows with OpenGL
2.1 - Introduction to Windows Programming
2.1.1 - A Basic Windows Application
2.1.2 - Getting Started with WinMain()
2.1.3 - The Windows Procedure
2.1.4 - Window Classes
2.1.5 -- Resources
2.1.6 - The Message Loop
2.1.7 - A Complete Windows Application
2.2 - Introduction to WGL
2.2.1 - The Rendering Context
2.2.2 - Using WGL
2.3 - Pixel Formats
2.4 - The OpenGL Window Application
2.5 - Fullscreen OpenGL
2.6 -- Summary
Chapter 3 - An Overview of 3D Graphics Theory
3.1 - Scalars, Points, and Vectors
3.1.1 - Vector Magnitude
3.1.2 - Vector Normalization
3.1.3 - Vector Addition
3.1.4 - Vector-Scalar Multiplication
3.1.5 - The Dot Product
3.1.6 - The Cross Product
3.2 - Coordinates and View Systems
3.3 - Matrices
3.3.1 - The Identity Matrix
3.3.2 - The Zero Matrix
3.3.3 - Matrix Addition and Subtraction
3.3.4 - Matrix Multiplication
3.4 - Transformations
3.4.1 -- Translation
3.4.2 -- Rotation
3.4.3 -- Scaling
3.4.4 -- Shear
3.5 - Projections
3.5.1 - Parallel Projection
3.5.2 - Perspective Projection
3.6 - 3D Clipping
3.7 - Lighting
3.7.1 - Ambient Light
3.7.2 - Diffuse Light
3.7.3 - Specular Light
3.8 - Texture Mapping
3.9 -- Summary
Chapter 4 - OpenGL States and Primitives
4.1 - State Functions
4.2 - The Basics of Primitives
4.3 - Drawing Points in 3D
4.4 - Drawing Lines in 3D
4.5 - Drawing Polygons in 3D
4.5.1 - Triangles
4.5.2 - Quads
4.5.3 - General Polygons
4.6 - Example: Using Primitives
4.7 -- Summary
Chapter 5 - Coordinate Transformations and OpenGL Matrices
5.1 - Understanding Coordinate Transformations
5.1.1 -- Eye Coordinates
5.1.2 -- Viewing Transformations
5.1.3 -- Modeling Transformations
5.1.4 -- Projection Transformations
5.1.5 -- Viewport Transformations
5.2 - OpenGL and Matrices
5.2.1 -- The Vertex Transformation Pipeline
5.2.2 -- The Modelview Matrix
5.2.3 -- Translation
5.2.4 -- Rotation
5.2.5 -- Scaling
5.2.6 -- The Identity Matrix
5.2.7 -- Matrix Stacks
5.2.8 - The Robot Example
5.3 - Projections
5.3.1 - Orthographic
5.3.2 - Perspective
5.3.3 -- Projection Example
5.4 - Using Your Own Matrices
5.4.1 -- Loading Your Matrix
5.4.2 -- Multiplying Matrices
5.4.3 -- Custom Matrix Example
5.5 - Summary
Chapter 6 - Adding Colors, Blending, and Lighting
6.1 - How Does Color Work?
6.2 - Using Colors in OpenGL
6.2.1 - Color Depth
6.2.2 - The Color Cube
6.2.3 - RGBA Mode in OpenGL
6.2.4 - Color-Index Mode in OpenGL
6.3 - Shading
6.4 - Lighting in OpenGL
6.4.1 - OpenGL Lighting and the Real World
6.4.1.1 - Ambient Light
6.4.1.2 - Diffuse Light
6.4.1.3 - Specular Light
6.4.1.4 - Emissive Light
6.4.2 - Materials
6.4.3 - Normals
6.4.3.1 - Calculating Normals
6.4.3.2 - Using Normals
6.4.3.3 - The Unit Normal
6.4.4 - Using OpenGL Lighting
6.4.4.1 - Creating Light Sources
6.4.4.2 - Positioning Light Sources
6.4.4.3 - Attenuation
6.4.4.4 - Spotlights
6.4.4.5 - Defining Materials
6.4.4.6 - Lighting Models
6.4.4.7 - Specular Lighting Effects
6.4.4.8 - Moving and Rotating Lights
6.5 - Blending
6.5.1 - Transparency
6.6 -- Summary
Chapter 7 -Bitmaps and Images With OpenGL
7.1 - The OpenGL Bitmap
7.1.1 - Positioning the Bitmap
7.1.2 - Drawing the Bitmap
7.1.3 - An OpenGL Bitmap Example
7.2 - Using Images
7.2.1 - Drawing Image Data
7.2.2 - Reading from the Screen
7.2.3 - Copying Screen Data
7.2.4 - Magnification, Reduction, and Flipping
7.3 - Managing Pixel Storage
7.4 - The Windows Bitmap
7.4.1 - The .BMP File Format
7.4.2 - Loading .BMP Files
7.4.3 - Writing .BMP Files
7.5 - Targa Image Files
7.5.1 - The .TGA File Format
7.5.2 - Loading .TGA Files
7.5.3 - Writing .TGA Files
7.6 -- Summary
Chapter 8 - Texture Mapping
8.1 - An Overview of Texture Mapping
8.1.1 - The Checkered Cube Example
8.2 - Applying the Texture Map
8.2.1 - 2D Textures
8.2.2 - 1D Textures
8.2.3 - 3D Textures
8.3 - Texture Objects
8.3.1 - Generating the Texture Name
8.3.2 - Creating and Using Texture Objects
8.4 - Texture Filtering
8.5 - Texture Functions
8.6 - Texture Coordinates
8.6.1 - Repeating and Clamping
8.7 - Mipmaps and Level of Detail
8.7.1 - Automatically Generating Mipmaps
8.8 - The Waving Flag Example
8.8.1 - The Explanation
8.8.2 - The Implementation
8.9 - The Textured Heightfield Terrain Example
8.9.1 - The Explanation
8.9.2 - The Implementation
8.10 -- Summary
Chapter 9 - Advanced Texture Mapping
9.1 - Multitexturing
9.1.1 - Verifying Multitexture Support
9.1.2 - Accessing Extension Functions
9.1.3 - Establishing the Texture Units
9.1.4 - Specifying the Texture Coordinates
9.1.5 - Putting it Together
9.2 -- Environment Mapping
9.2.1 - The Torus in the Sky
9.3 - The Texture Matrix Stack
9.4 - LIghtmapping
9.4.1 - What's a Lightmap?
9.4.2 - Using the Lightmap
9.5 - Multipass Multitexturing
9.6 - Summary
Chapter 10 - Display Lists
10.1 - Display Lists
10.1.1 - Creating a Display List
10.1.2 - Filling a Display List with Commands
10.1.3 - Executing Display Lists
10.1.4 - Display List Issues
10.1.5 - Destroying Display Lists
10.1.6 - Display Lists and Textures
10.2 - Example: Robot Demo with Display Lists
10.3 - Vertex Arrays
10.3.1 - Enabling Vertex Arrays
10.3.2 - Working with Arrays
10.3.3 - Vertex Arrays and Multitexturing
10.3.4 - Locking Arrays
10.4 - Example: Terrain Demo Revisited
10.5 - Summary
Chapter 11 - Displaying Text
11.1 - Bitmap Fonts
11.2 - Outline Fonts
11.3 - Texture Mapped Fonts
11.4 -- Summary
Chapter 12 - OpenGL Buffers
12.1 - What is an OpenGL Buffer?
12.1.1 - Setting Up the Pixel Format
12.1.2 - Clearing the Buffers
12.2 - The Color Buffer
12.2.1 - Double Buffered Systems
12.2.2 - Stereo Buffering
12.3 - The Depth Buffer
12.3.1 - Depth Comparison Functions
12.3.2 - Using the Depth Buffer
12.4 - The Stencil Buffer
12.4.1 - A Stencil Buffer Example
12.5 - The Accumulation Buffer
12.6 -- Summary
Chapter 13 - Quadrics
13.1 - Basics of OpenGL Quadrics
13.2 - Disks
13.3 - Cylinders
13.4 - Spheres
13.5 - Example: A Quadric Flythrough World
13.6 -- Summary
Chapter 14 - Curves and Surfaces
14.1 - Curve and Surface Representation
14.1.1 - Parametric Equations
14.1.2 - Control Points and Continuity
14.2 - Evaluators
14.2.1 - Evenly Spaced Grids
14.3 - Surfaces
14.3.1 - Applying Textures to Surfaces
14.4 - NURBS
14.5 - Summary
Chapter 15 - Special Effects
15.1 - Billboarding
15.2 - Example: Cacti in the Desert
15.3 - Particle Systems
15.3.1 - Particles
15.3.1.1 - Position
15.3.1.2 - Velocity
15.3.1.3 - Lifespan
15.3.1.4 - Size
15.3.1.5 - Weight
15.3.1.6 - Representation
15.3.1.7 - Color
15.3.1.8 - Owner
15.3.1.9 - Methods
15.3.2 - Particle System
15.3.2.1 - Particle List
15.3.2.2 - Position
15.3.2.3 - Emission Rate
15.3.2.4 - Forces
15.3.2.5 - Default Particle Attributes and Ranges
15.3.2.6 - Current State
15.3.2.7 - Blending
15.3.2.8 - Representation
15.3.2.9 - Methods
15.3.3 - Particle System Manager
15.3.4 - Implementation
15.4 - Particle System Effects
15.5 - Example: Snowstorm
15.6 - Fog
15.6.1 - OpenGL Fog
15.6.2 - Volumetric Fog
15.7 - Reflections
15.8 - Shadows
15.8.1 - Static Shadows
15.8.2 - Projective Shadows
15.8.3 - Stenciled Shadow Volumes
15.8.4 - Other Methods
15.9 - Example: Reflections and Shadows
15.10 - Summary
Chapter 16 - Using DirectX: DirectInput
16.1 - Why use DirectInput?
16.1.1 - Windows Messages
16.1.2 - Win32
16.1.2.1 - Win32 Keyboard Input
16.1.2.2 - Win32 Joystick Input
16.2 - DirectInput
16.2.1 - Initializing DirectInput
16.3 - Using DirectInput
16.3.1 - Adding Devices
16.3.1.1 - Creating Devices
16.3.1.2 - Enumerating Devices
16.3.1.3 - Device Capabilities
16.3.1.4 - Enumerating Objects
16.3.1.5 - Data Format
16.3.1.6 - Cooperative Level
16.3.1.7 - Device Properties
16.3.1.8 - Acquiring the Device
16.3.2 - Getting Input
16.3.2.1 - Immediate Data
16.3.2.2 - Buffered Data
16.3.2.3 - Polling Devices
16.3.3 - Shutting Down
16.4 - Action Mapping
16.5 - Building the Input Sub-system
16.6 - Input Example Program
16.7 -- Summary
Chapter 17 - Using DirectX Audio
17.1 - The Basics of Sound
17.1.1 - Sound on the Computer
17.1.1.1 - Digitized Sound
17.1.1.2 - Synthesized Sound
17.2 - What is DirectX Audio?
17.2.1 - DirectX Audio Concepts
17.2.1.1 - Loader
17.2.1.2 - Segments and Segment States
17.2.1.3 - Performance
17.2.1.4 - Messages
17.2.1.5 - Performance Channels
17.2.1.6 - DLS Synthesizer
17.2.1.7 - Instruments and Downloading
17.2.1.8 - Audiopaths and Buffers
17.2.2 - Audio Data Flow
17.3 - Loading and Playing Audio with DirectMusic
17.3.1 - Initialize COM
17.3.2 - Create and Initialize the Performance
17.3.3 - Create the Loader
17.3.4 - Load a Segment
17.3.5 - Download the Band
17.3.6 - Play the Segment
17.3.7 - Stopping a Segment
17.3.8 - Is the Segment Playing?
17.3.9 - Cleaning Up
17.4 - A Simple Example
17.5 - 3D Sound
17.5.1 - 3D Sound Coordinates
17.5.2 - Perception
17.5.3 - The DirectSound 3D Buffer
17.5.4 - Setting 3D Parameters
17.5.4.1 - The Minimum and Maximum Distances
17.5.4.2 - Processing Mode
17.5.4.3 - Position and Velocity
17.5.4.4 - Sound Cones
17.5.5 - The DirectSound 3D Listener
17.5.6 - 3D Clicking Text Example
17.6 - Summary
Chapter 18 - Working with 3D Models
18.1 - 3D Model File Formats
18.2 - The .MD2 File Format
18.2.1 - Our .MD2 Implementation
18.2.2 - Loading the .MD2
18.2.3 - Displaying the .MD2
18.2.4 - Adding the Texture
18.2.5 - Animating the Model
18.2.6 - Developing a CMD2Model Class
18.2.7 - Controlling the Model Animation
18.3 - One Last Tidbit
18.4 -- Summary
Chapter 19 - Physics Modeling with OpenGL
19.1 - A Physics Review
19.1.1 - Time
19.1.2 - Distance, Displacement, and Position
19.1.3 - Velocity
19.1.4 - Acceleration
19.1.5 - Force
19.1.5.1 - Newton's First Law
19.1.5.2 - Newton's Second Law
19.1.5.3 - Newton's Third Law
19.1.6 - Momentum
19.1.6.1 - Conservation of Momentum
19.1.7 - Friction
19.1.7.1 - Friction on a Flat Plane
19.1.7.2 - Friction on an Inclined Plane
19.2 - Modeling the Real World
19.2.1 - Breaking Things Up
19.2.2 - Timing
19.2.3 - The Vector
19.2.4 - The Plane
19.2.5 - The Object
19.1.6 - Handling Object Collisions
19.1.6.1 - Bounding Spheres
19.1.6.2 - Bounding Boxes
19.1.6.3 - Plane Collisions
19.1.6.4 - Collision Response
19.1.7 - An Example: Air Hockey
19.1.7.1 - The Air Hockey World
19.1.7.2 - The Hockey Table
19.1.7.3 - The Puck and Time-Based Collisions
19.1.7.4 - The Player
19.1.7.5 - Putting it Together
19.3 - Summary
Chapter 20 - Building a Game Engine
20.1 - Designing The SimpEngine
20.1.1 - Managing Data with CNode
20.1.2 - Working With Objects: CObject
20.2 - The Engine Core
20.2.1 - The Input System
20.2.2 - The CEngine Class
20.2.3 - The Game Cycle
20.2.4 - Handling Input
20.2.5 - The SimpEngine
20.3 - The Camera
20.4 - The World
20.5 - Adding Models
20.6 - The Audio System
20.7 - The Particle System
20.8 - Summary
Chapter 21- Making a Game: A Time to Kill
21.1 - Initial Design
21.2 - The Game World
21.3 - The Enemies
21.3.1 - Enemy AI
21.3.2 - The Ogro
21.3.3 - The Sod
21.4 - Rockets and Explosions
21.5 - The User Interface
21.6 - Playing the Game
21.7 - Building the EXE
21.8 - Summary
Appendices
A. Online Resources
B. Installing the CD
|