OpenGL Programming Guide

by Dave Shreiner

Published 27 November 2003

The OpenGL Programming Guide provides definitive and comprehensive information on OpenGL and the OpenGL Utility Library. The previous edition covered OpenGL through version 1.2. This fourth edition of the bestselling guide will describe all of the latest features of OpenGL versions 1.3 and 1.4, as well as the important OpenGL ARB extensions. Some of the new features in the core library include cube-mapped texture mapping, multi-texturing, multi-sampled anti-aliasing, depth-texturing and shadows, and advanced texture application modes. Most importantly, the ARB vertex and fragment program extension (commonly referred to as "shaders") will be introduced. Many new example programs and color slides have been incorporated as well. As with all of the previous editions, this one was developed under the auspices of the OpenGL Architecture Review Board, and industry consortium responsible for guiding the evolution of OpenGL, and written by some of the most influential developers in the field.


OpenGL ES 2.0 is the industry’s leading software interface and graphics library for rendering sophisticated 3D graphics on handheld and embedded devices. With OpenGL ES 2.0, the full programmability of shaders is now available on small and portable devices—including cell phones, PDAs, consoles, appliances, and vehicles. However, OpenGL ES differs significantly from OpenGL. Graphics programmers and mobile developers have had very little information about it—until now.

In the OpenGL® ES 2.0 Programming Guide, three leading authorities on the Open GL ES 2.0 interface—including the specification’s editor—provide start-to-finish guidance for maximizing the interface’s value in a wide range of high-performance applications. The authors cover the entire API, including Khronos-ratified extensions. Using detailed C-based code examples, they demonstrate how to set up and program every aspect of the graphics pipeline. You’ll move from introductory techniques all the way to advanced per-pixel lighting, particle systems, and performance optimization. 

Coverage includes:
  • Shaders in depth: creating shader objects, compiling shaders, checking for compile errors, attaching shader objects to program objects, and linking final program objects
  • The OpenGL ES Shading Language: variables, types, constructors, structures, arrays, attributes, uniforms, varyings, precision qualifiers, and invariance
  • Inputting geometry into the graphics pipeline, and assembling geometry into primitives
  • Vertex shaders, their special variables, and their use in per-vertex lighting, skinning, and other applications
  • Using fragment shaders—including examples of multitexturing, fog, alpha test, and user clip planes
  • Fragment operations: scissor test, stencil test, depth test, multisampling, blending, and dithering
  • Advanced rendering: per-pixel lighting with normal maps, environment mapping, particle systems, image post-processing, and projective texturing
  • Real-world programming challenges: platform diversity, C++ portability, OpenKODE, and platform-specific shader binaries


Using the new OpenCL (Open Computing Language) standard, you can write applications that access all available programming resources: CPUs, GPUs, and other processors such as DSPs and the Cell/B.E. processor. Already implemented by Apple, AMD, Intel, IBM, NVIDIA, and other leaders, OpenCL has outstanding potential for PCs, servers, handheld/embedded devices, high performance computing, and even cloud systems. This is the first comprehensive, authoritative, and practical guide to OpenCL 1.1 specifically for working developers and software architects.  

Written by five leading OpenCL authorities, OpenCL Programming Guide covers the entire specification. It reviews key use cases, shows how OpenCL can express a wide range of parallel algorithms, and offers complete reference material on both the API and OpenCL C programming language.

 

Through complete case studies and downloadable code examples, the authors show how to write complex parallel programs that decompose workloads across many different devices. They also present all the essentials of OpenCL software performance optimization, including probing and adapting to hardware. Coverage includes

 



Understanding OpenCL’s architecture, concepts, terminology, goals, and rationale
Programming with OpenCL C and the runtime API
Using buffers, sub-buffers, images, samplers, and events
Sharing and synchronizing data with OpenGL and Microsoft’s Direct3D
Simplifying development with the C++ Wrapper API
Using OpenCL Embedded Profiles to support devices ranging from cellphones to supercomputer nodes
Case studies dealing with physics simulation; image and signal processing, such as image histograms, edge detection filters, Fast Fourier Transforms, and optical flow; math libraries, such as matrix multiplication and high-performance sparse matrix multiplication; and more
Source code for this book is available at https://code.google.com/p/opencl-book-samples/