Are you a beginning programmer just getting started in 3D graphics programming? If you’re comfortable programming in C++ and have a basic understanding of 3D math concepts, Beginning OpenGL Game Programming, Second Edition will get you started programming 3D graphics for games using the OpenGL API. Revised to work with the latest version of OpenGL, OpenGL 3.0, this book is perfect for programmers who are new to game development or new to OpenGL. New skills and concepts are taught using step-by-step instructions, with end-of-chapter exercises for testing and reinforcement. From creating a simple OpenGL application, to applying texture mapping, and even displaying 2D fonts, you’ll find complete yet concise coverage of all the newest features of OpenGL as they apply to 3D graphics for game development. And by the end of the book, you’ll be able to apply your newfound knowledge of OpenGL to create your very own games.

The accompanying CD-ROM includes the source code for all the sample applications that accompany the book.

Where to get it

Beginning OpenGL Game Programming, 2nd Ed. is available now at the following online booksellers:

Table of Contents

  1. The Exploration Begins. . . Again
    1. Why Make Games?
      1. The World of 3D Games
      2. The Elements of a Game
    2. What Is OpenGL?
      1. OpenGL History
      2. OpenGL Architecture
      3. Fixed-Function vs. Programmability
      4. The Deprecation Model
      5. Deprecated Features in This Book
      6. Related Libraries
      7. A Sneak Peek
    3. Summary
  2. Creating a Simple OpenGL Application
    1. About the Platform
    2. Introduction to WGL
      1. The Rendering Context
    3. Pixel Formats
      1. nSize
      2. dwFlags
      3. iPixelType
      4. cColorBits
      5. Setting the Pixel Format
    4. An OpenGL Application
      1. Full-Screen OpenGL
      2. The Example Class
      3. Summary
  3. OpenGL States and Primitives
    1. State Functions
    2. Querying Numeric States
    3. Enabling and Disabling States
      1. glIsEnabled()
      2. Querying String Values
      3. glGetStringi()
      4. Finding Errors
    4. Colors in OpenGL
    5. Handling Primitives
      1. Immediate Mode
      2. Vertex Arrays
      3. Vertex Buffer Objects
      4. Drawing Points in 3D
      5. Drawing Lines in 3D
      6. Drawing Triangles in 3D
    6. Summary
  4. Transformations and Matrices
    1. Understanding Coordinate Transformations
      1. Eye Coordinates
      2. Viewing Transformations
      3. Modeling Transformations
      4. Projection Transformations
      5. Viewport Transformations
    2. Fixed-Function OpenGL and Matrices
      1. The Modelview Matrix
      2. Translation
      3. Rotation
      4. Scaling
      5. Matrix Stacks
      6. The Robot Example
    3. Projections
      1. Orthographic
      2. Perspective
      3. Setting the Viewport
      4. Projection Example
    4. Manipulating the Viewpoint
      1. Using gluLookAt()
      2. Using glRotate() and glTranslate()
      3. Creating Your Own Custom Routines
    5. Using Your Own Matrices
      1. Loading Your Matrix
      2. Multiplying Matrices
    6. Summary
  5. OpenGL Extensions
    1. What Is an Extension?
      1. Extension Naming
      2. Name Strings
    2. Functions and Tokens
    3. Obtaining a Function’s Entry Point
    4. Extensions on Windows
    5. Finding Supported Extensions
      1. WGL Extensions
    6. Defining Tokens
    7. Introduction to Glee
      1. Setting Up Glee
      2. Using Glee
      3. Using GLee with Core Extensions
    8. Extensions in Action
    9. Summary
  6. Moving to a Programmable Pipeline
    1. The Future of OpenGL
    2. What Is GLSL?
      1. Vertex Shaders
      2. Fragment Shaders
    3. The GLSL Language
      1. Shader Structure
      2. Preprocessor
      3. Variables
      4. Shader Inputs
      5. Statements
      6. Constructors
      7. Swizzling
      8. Defining Functions
      9. Built-in Functions
    4. GLSL Deprecated Functions
    5. Using Shaders
      1. Creating GLSL Objects
      2. Querying the Information Logs
      3. Sending Data to Shaders
      4. The GLSLProgram Class
      5. Replacing the Fixed-Function Pipeline
    6. Handling Your Own Matrices
      1. The Kazmath Library
      2. The Robot Example Revisited
    7. Summary
  7. Texture Mapping
    1. An Overview of Texture Mapping
    2. Using the Texture Map
    3. Texture Objects
      1. Creating Texture Objects
      2. Deleting Texture Objects
    4. Specifying Textures
      1. 2D Textures
      2. 1D Textures
      3. 3D Textures
      4. Cube Map Textures
    5. Texture Filtering
    6. Texture Coordinates
      1. Applying Texture Coordinates
    7. Texture Parameters
    8. Texture Wrap Modes
    9. Mipmaps
      1. Mipmaps and the OpenGL Utility Library
    10. Loading Targa Image Files
      1. The Targa File Format
      2. The TargaImage Class
    11. Summary
  8. Lighting, Blending, and Fog
    1. Lighting
      1. Normals
      2. The Lighting Model
      3. Materials
      4. Lighting in GLSL
    2. Blending
      1. Separate Blend Functions
      2. Constant Blend Color
    3. Fog
      1. Fog Example
    4. Summary
  9. More on Texture Mapping
    1. Subimages
    2. Copying from the Color Buffer
    3. Environment Mapping
      1. Sphere Mapping
      2. Reflective Cube Mapping
    4. Alpha Testing
    5. Multitexturing
      1. Texture Units
      2. Multitexturing in GLSL
    6. Summary
  10. Improving Your Performance
    1. Frustum Culling
      1. The Plane Equation
      2. Defining Your Frustum
      3. Testing a Point
      4. Testing a Sphere
      5. Frustum Culling Applied
    2. Summary
  11. Displaying Text
    1. 2D Texture-Mapped Fonts
      1. Generating the Texture Coordinates
      2. The Texture-Mapped Fonts Example
    2. 2D Fonts with FreeType
      1. The FreeType Library
      2. Initializing FreeType and Loading a Font
      3. Setting the Font Size
      4. Generating Glyph Textures
      5. Freeing FreeType Resources
      6. The FreeType Example
    3. A Note on 3D Fonts
    4. Summary
  12. OpenGL Buffers
    1. What Is an OpenGL Buffer?
      1. Clearing Buffers
    2. The Scissor Test
    3. The Color Buffers
      1. Color Masking
      2. Setting the Clear Color
    4. The Depth Buffer
      1. Controlling Depth Testing
      2. Disabling Depth Buffer Writes
      3. Potential Issues
    5. The Stencil Buffer
    6. Summary
  13. The Endgame
    1. The MD2 Model Format
      1. The MD2 Header
      2. Loading the Model Data
      3. Animating the MD2 Model
      4. Rendering the Model
    2. Creating Explosions
    3. Point Sprites
      1. Using Point Sprites
    4. Ogro Invasion!
      1. A Note on Collision Detection
    5. Summary